Browse Source

修改bug

purui 2 days ago
parent
commit
90bc9ae843

+ 4 - 0
packages/app/src/core/libs/requests.ts

@@ -684,6 +684,10 @@ export const orderPointsSubmit = (data: { id: number; userId: number; couponUser
  */
 export const getBanner = (id) => httpGet<Banner>('/app-api/member/banner/get-by-id', { id })
 /**
+ * 获取Banner
+ */
+export const getHomeBanner = (id) => httpGet<Banner>('/app-api/basicsetting/set-index-config/get', { id })
+/**
  * 获取积分明细列表
  */
 export const getPoints = (query) =>

+ 25 - 6
packages/app/src/pages-sub/home/activity/images/index.vue

@@ -14,6 +14,8 @@ import dayjs from 'dayjs'
 const id = ref()
 const type = ref()
 const img = ref()
+const imgTab = ref([])
+const imgTabIndex = ref(0)
 const pageNo = ref(1)
 const imgList = ref([])
 const more = ref(false)
@@ -49,8 +51,20 @@ const previewImgNew = (i) => {
 		urls:[i]
 	})
 }
+const timeTabChange = async (it,i) =>{
+	more.value = false;
+	pageNo.value = 1;
+	img.value = it
+	imgTabIndex.value = i;
+	let imgInfo = await setImgData()
+	console.log(imgInfo)
+	imgList.value = imgInfo.list
+	if(imgList.value.length >= imgInfo.total){
+		more.value = true
+	}
+}
+
 onReachBottom(async ()=>{
-	console.log("11111")
 	if(!more.value){
 		pageNo.value ++ 
 		let imgInfo = await setImgData()
@@ -65,10 +79,12 @@ onLoad(async (query: { id: string; type: 'activity' | 'studyTour'; title: string
   id.value = query.id
   type.value = query.type
   let res = await setData();
-  console.log(res.list)
-  if(res.list.length > 0){
-	  img.value = res.list[0]
+  imgTab.value = res.list
+  console.log(imgTab.value)
+  if(imgTab.value.length > 0){
+	  img.value = imgTab.value[0]
 	  let imgInfo = await setImgData()
+	  console.log(imgInfo)
 	  imgList.value = imgInfo.list
 	  if(imgList.value.length >= imgInfo.total){
 		  more.value = true
@@ -78,10 +94,13 @@ onLoad(async (query: { id: string; type: 'activity' | 'studyTour'; title: string
 </script>
 <template>
   <div class="flex flex-col flex-grow p-4 bg-white gap-4">
+	<div class="flex items-center overflow-x-scroll">
+		<div class="px-[14rpx] py-[8rpx] text-[24rpx] rounded-[10rpx] mr-[20rpx] shrink-0" :class="imgTabIndex===i?'bg-black text-white':'bg-black/10'" v-for="(it, i) in imgTab" :key="i" @click="timeTabChange(it,i)">{{ dayjs(it.travelDate).format('YYYY-MM-DD') || "2022" }}</div>
+	</div>  
     <template v-for="(it, i) in imgList" :key="i">
-      <SectionHeading
+      <!-- <SectionHeading
         :title="'第' + Number(i + 1) + '天 ' + dayjs(img.travelDate).format('YYYY-MM-DD')"
-      ></SectionHeading>
+      ></SectionHeading> -->
 	  <video v-if="it.type=='1'" class="w-full" :src="it.url"></video>
 	  <wd-img v-else width="100%" mode="widthFix" :src="it.url" @click="previewImgNew(it.url)" />
       <!-- <template v-for="(video, index) in it.video" :key="index">

+ 31 - 13
packages/app/src/pages-sub/home/content/index.vue

@@ -8,7 +8,7 @@
 </route>
 <script setup lang="ts">
 import { logo } from '../../../core/libs/svgs'
-import { getBanner, getContent } from '../../../core/libs/requests'
+import { getBanner, getContent, getHomeBanner } from '../../../core/libs/requests'
 import Article from '../components/article.vue'
 import { Content } from '../../../core/libs/models'
 
@@ -42,13 +42,17 @@ const detailArticle = computed(() => {
       ...data.value,
     }
   } else if (type.value === 'home-banner') {
-    return {
-      isBanner: true,
-      title: bannerHome.value.name,
-      contentDetail: bannerHome.value.details,
-      createTime: bannerHome.value.createTime.toString(),
-      viewsCount: bannerHome.value.playCount,
-    }
+	  return {
+	    isBanner: true,
+	    ...data.value,
+	  }
+    // return {
+    //   isBanner: true,
+    //   title: bannerHome.value.name,
+    //   contentDetail: bannerHome.value.details,
+    //   createTime: bannerHome.value.createTime.toString(),
+    //   viewsCount: bannerHome.value.playCount,
+    // }
   } else {
     return {
       isBanner: false,
@@ -89,11 +93,25 @@ onLoad(async (query: { id: string; type?: 'banner'; data?: string }) => {
       })
   } else if (type.value === 'home-banner') {
     // console.log('home-banner', query.data)
-    bannerHome.value = JSON.parse(decodeURIComponent(query.data))
-	console.log('home-banner', bannerHome.value)
-    uni.setNavigationBarTitle({
-      title: bannerHome.value.name,
-    })
+ //    bannerHome.value = JSON.parse(decodeURIComponent(query.data))
+	// console.log('home-banner', bannerHome.value)
+ //    uni.setNavigationBarTitle({
+ //      title: bannerHome.value.name,
+ //    })
+	request.value = () => getHomeBanner(id.value).then((res) => {
+        uni.setNavigationBarTitle({
+          title: res.data?.name,
+        })
+        return {
+          ...res,
+          data: {
+            isBanner: true,
+            title: res.data?.name,
+            contentDetail: res.data?.details,
+            createTime: res.data?.createTime.toString()
+          },
+        }
+      })
   } else {
     request.value = () => getContent({ id: id.value })
   }

+ 9 - 3
packages/app/src/pages/home/components/home-banner.vue

@@ -25,9 +25,15 @@ const handleClick = () => {
     router.push(`/pages-sub/common/webview/index?url=${props.item.url}`)
   }
   if (props.detailsType === '1' && !props?.item?.url) {
-    router.push(
-      `/pages-sub/home/content/index?type=home-banner&id=${props.id}&data=${encodeURIComponent(JSON.stringify(props.item))}`,
-    )
+    // router.push(
+    //   `/pages-sub/home/content/index?type=home-banner&id=${props.id}&data=${encodeURIComponent(JSON.stringify(props.item))}`,
+    // )
+	router.push(
+	  `/pages-sub/home/content/index?type=home-banner&id=${props.id}`,
+	)
+  }
+  if (props.detailsType === '2' && props?.item?.url) {  
+    router.push(props?.item?.url) 
   }
 }
 const handlePlay = async () => {

+ 2 - 3
packages/app/src/pages/material/detail/index.vue

@@ -177,14 +177,13 @@ onShareTimeline(() => ({
                     .join(' / ')
                 }}
               </div>
-              <div>
+              <!-- <div>
                 <span class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-[10px]">
                   经营品牌:
                 </span>
                 <span
                   class="text-black/40 text-xs font-normal font-['PingFang_SC'] uppercase leading-[10px]"
                 >
-                  <!-- imola / chedit -->
                   {{
                     materialsManageBrands
                       .filter(({ value }) => data.manageBrand.includes(Number.parseInt(value)))
@@ -192,7 +191,7 @@ onShareTimeline(() => ({
                       .join(' / ')
                   }}
                 </span>
-              </div>
+              </div> -->
 			  <div>
 			    <span class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-[10px]">
 			      经营范围:

+ 2 - 2
packages/app/src/utils/date-util.ts

@@ -10,9 +10,9 @@ export const beforeNow = (date: Date) => {
     return `${Math.floor((now.getTime() - date.getTime()) / 60 / 60 / 1000)}小时前`
   // 大于1天且本年内发布的,显示mm-dd hh:mm;
   if (now.getFullYear() === date.getFullYear())
-    return `${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}`
+    return `${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()<10?'0'+date.getMinutes():date.getMinutes()}`
   // 不是本年内发布的,显示yyyy-mm-dd hh:mm;
-  return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}`
+  return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()<10?'0'+date.getMinutes():date.getMinutes()}`
 }
 
 export const secondToMinute = (seconds: any) => {