Browse Source

update code

kevin.T 2 months ago
parent
commit
28baa76565

+ 7 - 2
packages/app/src/App.vue

@@ -4,8 +4,13 @@ import { useAnalysis } from '@/composables/analysis'
 
 useAnalysis(true, true)
 
-onLaunch(() => {
-  console.log('App Launch')
+onLaunch((options: any) => {
+  console.log('App Launch', options)
+  if (options.query?.isShared === 'true' && options.path === 'pages-sub/mine/homepage/index') {
+    uni.reLaunch({
+      url: `/pages-sub/mine/homepage/index?id=${options.query.id}&isShared=true`,
+    })
+  }
 })
 onShow(() => {
   console.log('App Show')

+ 5 - 2
packages/app/src/components/moment-item.vue

@@ -192,7 +192,10 @@ onMounted(async () => {
         </template>
         <template v-else>{{ options.circleDesc }}</template>
       </view>
-      <view v-if="props.options.tagName !== ''" class="my-5.5 flex flex-wrap gap-3.5">
+      <view
+        v-if="props.options.tagName && props.options.tagName?.split(',').length > 0"
+        class="my-5.5 flex flex-wrap gap-3.5"
+      >
         <template v-if="props.options.tagName !== ''">
           <template v-for="it of props.options.tagName?.split(',')" :key="it">
             <Tag>{{ it }}</Tag>
@@ -200,7 +203,7 @@ onMounted(async () => {
         </template>
       </view>
 
-      <view v-if="!isShared" class="flex justify-between">
+      <view v-if="!isShared" class="flex justify-between items-center">
         <div>
           <template v-if="features.shareMoment">
             <button

+ 1 - 1
packages/app/src/composables/share.ts

@@ -32,9 +32,9 @@ export const useShare = () => {
       }
     }
     if (from === 'menu') {
-      console.log('menu::::::::', from, target)
       res.title = messages.home.shareTitle
     }
+    console.log('res:::::::分享数据:', res)
     return res
   }
   return { shareAppMessage }

+ 1 - 0
packages/app/src/core/libs/models.ts

@@ -53,6 +53,7 @@ export interface MaterialDealer {
    * 累计到店次数
    */
   cumulativeStoreNum?: number
+  bannerUrl?: string
 }
 export interface ShopList {
   id: number

+ 26 - 21
packages/app/src/layouts/tabbar.vue

@@ -1,9 +1,7 @@
 <script setup lang="ts">
 import TabbarEvo from '@/components/tabbar-evo.vue'
 import { iconCamera, iconWallet } from '../core/libs/pngs'
-import {
-  readCount
-} from '../core/libs/requests'
+import { readCount } from '../core/libs/requests'
 import {
   home,
   homeActive,
@@ -18,7 +16,7 @@ import {
 import { currRoute } from '../utils'
 import { defaultThemeVars } from '../core/themes/default'
 import { useRouter } from '../core/utils/router'
-import HonorDialog from "@/pages/home/components/honor-dialog/honor-dialog.vue";
+import HonorDialog from '@/pages/home/components/honor-dialog/honor-dialog.vue'
 
 const router = useRouter()
 const publishState = ref(false)
@@ -47,7 +45,7 @@ const items = [
     title: '消息',
     iconPath: message,
     selectedIconPath: messageActive,
-	notice:messageCount,
+    notice: messageCount,
     path: '/pages/messages/index',
   },
   {
@@ -60,36 +58,43 @@ const items = [
 const handleTabbarItemClick = (path: string) => {
   if (path === '/pages-sub/publish/index') {
     publishState.value = true
+    uni.$emit('clickTabbar', publishState.value)
     return
   }
   getMessageNotice()
   router.push(path, true)
   // uni.switchTab({ url: path })
 }
-const getMessageNotice = async () =>{
-	let value = await readCount();
-	if(value?.data?.length > 0){
-		let count = 0
-		for(let i in value.data){
-			count += value.data[i].quantity
-		}
-		if(count > 0){
-			messageCount.value = true
-		}else{
-			messageCount.value = false
-		}
-	}
+const getMessageNotice = async () => {
+  let value = await readCount()
+  if (value?.data?.length > 0) {
+    let count = 0
+    for (let i in value.data) {
+      count += value.data[i].quantity
+    }
+    if (count > 0) {
+      messageCount.value = true
+    } else {
+      messageCount.value = false
+    }
+  }
+}
+const handlePublishState = () => {
+  publishState.value = false
+  uni.$emit('clickTabbar', publishState.value)
 }
-onShow(async ()=>{
-	await getMessageNotice()
+onShow(async () => {
+  await getMessageNotice()
 })
 const toPublishMoment = () => {
   router.push('/pages-sub/publish/moment/index?circleType=1')
   publishState.value = false
+  uni.$emit('clickTabbar', publishState.value)
 }
 const toPublishCase = () => {
   router.push('/pages-sub/publish/moment/index?circleType=2')
   publishState.value = false
+  uni.$emit('clickTabbar', publishState.value)
 }
 </script>
 
@@ -135,7 +140,7 @@ const toPublishCase = () => {
             custom-class="mt-15"
             type="icon"
             icon="close"
-            @click="publishState = false"
+            @click="handlePublishState"
           ></wd-button>
         </div>
       </div>

+ 5 - 11
packages/app/src/pages-sub/home/moment/index.vue

@@ -58,6 +58,9 @@ const focus = ref(false)
 const hot = ref(true)
 const active = ref('hot')
 const { data, run } = useRequest(() => getCircle(id.value), { initialData: {} })
+const toPreview = () => {
+  uni.previewImage({ current: current.value, urls: data.value.bannerUrls, loop: true })
+}
 const { data: reviews, run: runGetReviews } = useRequest(
   () => getCircleReviews({ circleId: id.value, hot: hot.value }),
   {
@@ -243,13 +246,13 @@ const handleClick = async (value: boolean) => {
             :indicator-dots="true"
           >
             <template v-for="it of data?.bannerUrls" :key="it">
-              <swiper-item>
+              <swiper-item @click="toPreview">
                 <wd-img
                   width="100%"
                   height="100%"
                   :src="it"
                   mode="aspectFill"
-                  :enable-preview="true"
+                  :enable-preview="false"
                 ></wd-img>
               </swiper-item>
             </template>
@@ -262,15 +265,6 @@ const handleClick = async (value: boolean) => {
           <swiper @change="handleChange">
             <template v-for="it of data?.bannerUrls" :key="it">
               <swiper-item>
-                <!--                <video-->
-                <!--                  ref="momentVideo"-->
-                <!--                  width="100%"-->
-                <!--                  class="w-full aspect-[1.64/1]"-->
-                <!--                  :controls="'contimg'"-->
-                <!--                  :loop="true"-->
-                <!--                  :enable-progress-gesture="false"-->
-                <!--                  :src="it"-->
-                <!--                ></video>-->
                 <MomentVideo
                   ref="momentVideoRef"
                   :src="it"

+ 5 - 5
packages/app/src/pages-sub/home/study-tour/index.vue

@@ -27,11 +27,11 @@ import { useRouter } from '../../../core/utils/router'
 import PageHelper from '@/components/page-helper.vue'
 import RegisterCard from './components/register-card.vue'
 import { ComponentExposed } from 'vue-component-type-helpers'
-import ShareActionSheet from './components/share-action-sheet.vue'
 import { useShare } from '@/composables/share'
 import { getByDictType } from '@/core/libs/requests'
 import { DictType } from '@/core/libs/models'
-const pageHelperRef = ref<ComponentExposed<typeof PageHelper>>()
+import PageHelperEvo from '@/components/page-helper-evo.vue'
+const pageHelperRef = ref<ComponentExposed<typeof PageHelperEvo>>()
 const currentBanner = ref(0)
 const dictMemberDesignStyle = ref<any[]>()
 const dictCircleSpaceType = ref<any[]>()
@@ -76,7 +76,7 @@ const levelsByMemberLevel = computed(() =>
     return acc
   }, {}),
 )
-onMounted(async () => {
+onLoad(async () => {
   await Promise.all([setLevels(), setStudyTours(), setClassmates(), setBanners()])
   let value1 = await getByDictType(DictType.circleSpaceType)
   dictCircleSpaceType.value = value1.data
@@ -154,7 +154,7 @@ onShareAppMessage(shareAppMessage)
       tip="暂无内容"
     ></wd-status-tip>
     <section-heading custom-class="" title="设计圈"></section-heading>
-    <PageHelper
+    <PageHelperEvo
       ref="pageHelperRef"
       :request="getCircles"
       :query="{ tagName: '设计游学' }"
@@ -172,7 +172,7 @@ onShareAppMessage(shareAppMessage)
           </template>
         </div>
       </template>
-    </PageHelper>
+    </PageHelperEvo>
   </view>
 </template>
 <style scoped>

+ 17 - 6
packages/app/src/pages-sub/mine/homepage/index.vue

@@ -38,7 +38,6 @@ import { useShare } from '@/composables/share'
 import { useMemberLevelsStore } from '../../../store/member-levles'
 import { getByDictType } from '@/core/libs/requests'
 import { DictType } from '@/core/libs/models'
-import { title } from 'radash'
 
 const memberLevelsStore = useMemberLevelsStore()
 const { getMemberAvatarFrame } = memberLevelsStore
@@ -95,7 +94,7 @@ const shareContent = computed(() => {
     title: designerInfo.value?.homePageName
       ? designerInfo.value?.homePageName
       : memberInfo.value.nickname,
-    imageUrl: designerInfo.value?.sharePageUrl,
+    imageUrl: designerInfo.value?.sharePageUrl ?? designerInfo.value?.homePageUrl,
     path: `/pages-sub/mine/homepage/index?id=${id.value}&isShared=true`,
   }
 })
@@ -109,7 +108,7 @@ const shareMessage = () => {
       res.title = designerInfo.value?.homePageName
         ? designerInfo.value?.homePageName
         : memberInfo.value.nickname
-      res.imageUrl = designerInfo.value.sharePageUrl
+      res.imageUrl = designerInfo.value.sharePageUrl ?? designerInfo.value?.homePageUrl
       res.path = `/pages-sub/mine/homepage/index?id=${id.value}&isShared=true`
       resolve(res)
     }
@@ -217,13 +216,25 @@ onLoad(async (query: { id: string; isShared?: string }) => {
   dictCircleSpaceType.value = value1.data
   let value2 = await getByDictType(DictType.memberDesignStyle)
   dictMemberDesignStyle.value = value2.data
+
+  // 若 等级 小于 2 则无法分享
+  if (userInfo.value?.level?.level < 2) {
+    uni.hideShareMenu({
+      hideShareItems: ['shareAppMessage', 'shareTimeline'],
+    })
+  }
 })
 onShow(async () => {
-  console.log('onShow')
   await setDesignerInfo()
   await pageHelperRef.value?.refresh()
 })
-onShareAppMessage(shareAppMessage)
+onShareAppMessage(async (share) => {
+  if (share.from === 'button') {
+    return await shareAppMessage(share)
+  } else if (share.from === 'menu') {
+    return shareContent.value
+  }
+})
 onUnload(async () => {
   viewDuration.value = dayjs().diff(viewStartAt.value, 'seconds')
   const { data, code } = await createBrowseHistory({
@@ -476,7 +487,7 @@ defineExpose({
             :data-share-content="shareContent"
             :open-type="features.shareMoment ? 'share' : ''"
             :data-options="{ userId: userInfo.userId, homepageId: id }"
-            :data-level="userInfo.level"
+            :data-level="userInfo.level.level"
             @click="clickByPermission('share', () => {})"
           >
             <wd-button block :round="false">分享</wd-button>

+ 18 - 8
packages/app/src/pages-sub/mine/honors/detail/index.vue

@@ -23,6 +23,14 @@ const canvasHidden = ref<boolean>(false)
 const posterUrl = ref<string | any>()
 const userStore = useUserStore()
 const { userInfo } = storeToRefs(userStore)
+const badgePath = ref<any[]>([
+  { badgeType: '游学徽章', path: '/pages-sub/home/study-tour/index' },
+  { badgeType: '课程徽章', path: '/pages-sub/home/offline-activity/index' },
+  { badgeType: '传播徽章', path: '/pages-sub/mine/homepage/index' },
+  { badgeType: '积分徽章', path: '/pages-sub/home/mall/index' },
+  { badgeType: '打卡徽章', path: '/pages/mine/index' },
+  { badgeType: '活动徽章', path: '/pages-sub/home/offline-activity/index' },
+])
 const panels = ref([
   {
     iconUrl: NetImages.savePosterIcon,
@@ -124,11 +132,7 @@ const subTitle = computed(() =>
     : `${dayjs(data.value.createTime).format('YYYY年MM月DD日')}获得`,
 )
 const setBadgesPath = (type: string) => {
-  if (type === '活动徽章') {
-    uni.redirectTo({
-      url: `/pages-sub/home/offline-activity/index`,
-    })
-  } else if (type === '游学徽章' || type === '典藏勋章') {
+  if (type === '游学徽章' || type === '典藏勋章') {
     if (banners.value?.length > 0) {
       uni.redirectTo({
         url: `/pages-sub/home/study-tour/list?designStudyAbroadYear=${banners.value[0].designStudyAbroadYear}&designDesc=${banners.value[0].designDesc}`,
@@ -140,9 +144,15 @@ const setBadgesPath = (type: string) => {
       })
     }
   } else {
-    uni.switchTab({
-      url: `/pages/home/index`,
-    })
+    if (type === '打卡徽章') {
+      uni.switchTab({
+        url: badgePath.value.find((it) => it.badgeType === type)?.path,
+      })
+    } else {
+      uni.redirectTo({
+        url: badgePath.value.find((it) => it.badgeType === type)?.path,
+      })
+    }
   }
 }
 const showActions = () => {

+ 40 - 14
packages/app/src/pages/material/detail/index.vue

@@ -60,6 +60,13 @@ const copy = (url) => {
     },
   })
 }
+const imageGroup = ref<any[]>([
+  { height: '171px' },
+  1,
+  { width: '107px' },
+  [{ width: '93px' }, { width: '32px', marginLeft: '41px' }],
+])
+const isLoaded = ref(false)
 const handleDownload = async () => {
   downloading.value = true
   const { filePath } = await uni.downloadFile({
@@ -95,19 +102,24 @@ const handleDownload = async () => {
   }
 }
 onLoad(async (query: { id: number }) => {
-  id.value = query.id
-  await setData()
-  option.value = {
-    remark: `最近浏览品牌: ${data.value?.materialsName}`,
+  console.log(query, '最近浏览品牌')
+  if (query.id) {
+    id.value = query.id
+    await setData()
+    option.value = {
+      remark: `最近浏览品牌: ${data.value?.materialsName}`,
+    }
+    await setMaterialHomePageData()
+    console.log(data.value)
+    await Promise.all([
+      setMaterialBrandLevels(),
+      setMaterialBrandTypes(),
+      setMaterialOperationTypes(),
+      setMaterialsManageBrands(),
+    ]).then(() => {
+      isLoaded.value = true
+    })
   }
-  await setMaterialHomePageData()
-  console.log(data.value)
-  await Promise.all([
-    setMaterialBrandLevels(),
-    setMaterialBrandTypes(),
-    setMaterialOperationTypes(),
-    setMaterialsManageBrands(),
-  ])
 })
 onShareAppMessage(() => ({
   title: data.value?.materialsName,
@@ -119,7 +131,7 @@ onShareTimeline(() => ({
 }))
 </script>
 <template>
-  <view class="flex-grow flex flex-col">
+  <view class="flex-grow flex flex-col" v-if="isLoaded">
     <div
       class="w-full aspect-[1.16/1] bg-[url(https://image.zhuchaohui.com/zhucaohui/9da274c73312f5ff828b60457bf4a469e631c001a4bf1c1f355338887b19f035.png)] bg-[length:100%]"
       :style="{ backgroundImage: `url(${materialHomePageData?.bannerUrl})` }"
@@ -253,7 +265,11 @@ onShareTimeline(() => ({
       <template v-if="materialHomePageData.productDOList?.length">
         <SectionHeading title="产品展示"></SectionHeading>
       </template>
-      <template v-for="(it, index) in materialHomePageData.productDOList" :key="index">
+      <template
+        v-if="materialHomePageData.productDOList?.length"
+        v-for="(it, index) in materialHomePageData.productDOList"
+        :key="index"
+      >
         <div class="aspect-[1.66/1] rounded-2xl overflow-hidden relative">
           <swiper class="h-[55.7vw]" @change="handleSwiperChange">
             <template v-for="(img, index) in it?.productImgUrl?.split(',')" :key="img">
@@ -318,6 +334,16 @@ onShareTimeline(() => ({
       </view>
     </wd-overlay>
   </view>
+  <!-- 骨架 屏 -->
+  <view v-else>
+    <wd-skeleton animation="gradient" theme="paragraph" :row-col="imageGroup" />
+    <wd-skeleton
+      animation="gradient"
+      theme="paragraph"
+      :custom-style="{ marginTop: '20px' }"
+      :row-col="imageGroup"
+    />
+  </view>
 </template>
 <style scoped>
 .dots {

+ 1 - 1
packages/app/src/pages/messages/components/message-card.vue

@@ -13,7 +13,7 @@ import { messages } from '../../../core/libs/messages'
 import { stringify } from 'qs'
 
 const props = withDefaults(
-  defineProps<{ options?: Message & { selectedCoupons?: Coupon[] } }>(),
+  defineProps<{ options?: Message & { selectedCoupons?: Coupon[]; couponType?: any } }>(),
   {},
 )
 const emits = defineEmits<{

+ 6 - 1
packages/app/src/pages/mine/index.vue

@@ -30,6 +30,7 @@ import { AnalysisEventType, useAnalysis } from '@/composables/analysis'
 
 const { option, report } = useAnalysis(false)
 const official = ref(false)
+const isPublish = ref<boolean>(false)
 const router = useRouter()
 const userStore = useUserStore()
 const { isLogined, userInfo } = storeToRefs(userStore)
@@ -224,6 +225,10 @@ const handleClickScan = async () => {
 const navBarProps = ref({ customClass: 'bg-transparent!' })
 onMounted(async () => {
   await setLevelConfigs()
+  // 监听 tabbar 点击事件
+  uni.$on('clickTabbar', (e) => {
+    isPublish.value = e
+  })
 })
 onShow(async () => {
   if (isLogined.value) {
@@ -250,7 +255,7 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
       :bordered="false"
       v-bind="navBarProps"
     >
-      <template #left>
+      <template v-if="!isPublish" #left>
         <wd-button
           v-if="isLogined"
           type="text"