li.shaoyi 3 месяцев назад
Родитель
Сommit
ac16355b59

+ 2 - 2
src/packages/mobile/App.vue

@@ -132,8 +132,8 @@ watch(() => noticeStore.isInitialized, () => {
   const readKey = 'read_' + loginStore.loginId
   const readValue = formatDate(new Date().toISOString(), 'YYYY-MM-DD')
 
-  const localValue = localStorage.getItem(readKey)
-  const showUnread = props.showUnread && localValue !== readValue // 未读消息一天内只会弹框一次
+  const storageValue = localStorage.getItem(readKey)
+  const showUnread = props.showUnread && storageValue !== readValue // 未读消息一天内只会弹框一次
 
   // 过滤数据
   const filteredData = noticeStore.localizedDataList.filter((e) => (showUnread && !e.readed) || e.isforcedisplay)

+ 3 - 1
src/packages/mobile/views/rules/fwrx/Index.vue

@@ -3,7 +3,8 @@
         <template #header>
             <app-navbar :title="$t('rules.fwrx')" />
         </template>
-        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(commonStore.getDocumentById(1))" />
+        <HtmlContainer style="padding: 15px;" class="content"
+            :context="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +14,5 @@ import HtmlContainer from '@mobile/components/base/html-container/index.vue'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(1)
 </script>

+ 2 - 1
src/packages/mobile/views/rules/gywm/Index.vue

@@ -3,7 +3,7 @@
         <template #header>
             <app-navbar :title="$t('routes.about')" />
         </template>
-        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(commonStore.getDocumentById(2))" />
+        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +13,5 @@ import HtmlContainer from '@mobile/components/base/html-container/index.vue'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(2)
 </script>

+ 5 - 6
src/packages/mobile/views/rules/yszc/Index.vue

@@ -1,16 +1,15 @@
 <template>
     <app-view>
         <template #header>
-            <app-navbar :title="$t('rules.yszc')" />
+            <app-navbar :title="$t('rules.ryszc')" />
         </template>
-        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(commonStore.getDocumentById(4))" />
+        <component :is="asyncComponent" :url="getHtmlFileUrl('yszc.htm')" />
     </app-view>
 </template>
 
 <script lang="ts" setup>
-import { useCommonStore } from '@/stores/modules/common'
-import HtmlContainer from '@mobile/components/base/html-container/index.vue'
-import { formatHtmlString } from '@/filters'
+import { defineAsyncComponent } from 'vue'
+import { getHtmlFileUrl } from '@/filters'
 
-const commonStore = useCommonStore()
+const asyncComponent = defineAsyncComponent(() => import('@mobile/components/base/html-panel/index.vue'))
 </script>

+ 2 - 1
src/packages/mobile/views/rules/zcxy/Index.vue

@@ -3,7 +3,7 @@
         <template #header>
             <app-navbar :title="$t('rules.zcxy')" />
         </template>
-        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(commonStore.getDocumentById(3))" />
+        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +13,5 @@ import HtmlContainer from '@mobile/components/base/html-container/index.vue'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(3)
 </script>

+ 58 - 47
src/packages/tss/views/boot/Index.vue

@@ -1,72 +1,83 @@
 <template>
   <div class="boot" :style="`background-image: url(${'./app/splashscreen/1080x1920.png'});`">
-    <Swipe class="boot__guide" :loop="false" v-if="state.showGuide">
-      <SwipeItem>
-        <img :src="'./app/splashscreen/1080x1920.png'" />
-      </SwipeItem>
-      <SwipeItem>
-        <img src="../../assets/images/guide-1.png" />
-      </SwipeItem>
-      <SwipeItem>
-        <img src="../../assets/images/guide-2.png" @click="skip(init())" />
-      </SwipeItem>
-    </Swipe>
+    <article v-if="state.showSplash">
+      <section v-html="formatHtmlString(state.documentContent)" />
+      <footer>
+        <Button type="danger" block @click="navigateToHome">{{ state.buttonText }}</Button>
+      </footer>
+    </article>
   </div>
 </template>
 
 <script lang="ts" setup>
-import { reactive, onUnmounted } from 'vue'
+import { reactive } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
-import { Swipe, SwipeItem } from 'vant'
+import { Button } from 'vant'
+import { formatHtmlString } from '@/filters'
 import { showLoading, dialog } from '@/utils/vant'
 import { useLogin } from '@/business/login'
 import { useCommonStore } from '@/stores/modules/common'
 import service from '@/services'
 import plus from '@/utils/h5plus'
 
-const { logining, initBaseData } = useLogin()
+const { initBaseData } = useLogin()
 const route = useRoute()
 const router = useRouter()
-const countdown = 1  // 倒计时秒数
-
-const commonStore=useCommonStore()
 
 const state = reactive({
-  showGuide: false,
-  //showGuide: (!plus.hasPlus() || localStorage.getItem('muchinfo_app_showguide') === 'false') ? false : true, // 是否显示引导页
-  second: countdown, // 剩余秒数
-  currentRate: 100, // 当前进度
-  rate: 100, // 目标进度
+  showSplash: false,
+  documentContent: '',
+  buttonText: ''
 })
 
-const init = () => initBaseData(true) // 初始化数据
-const onLoad = state.showGuide ? Promise.resolve() : init()
+// 任务 #7076
+const shouldShowSplash = () => {
+  const commonStore = useCommonStore()
+  const { isenabled, displayfrequency, intervaldays = 0, documentcontent = '', buttontext = '进入首页' } = commonStore.getDocumentById(6) ?? {}
+
+  state.documentContent = documentcontent
+  state.buttonText = buttontext
+
+  if (isenabled) {
+    if (displayfrequency === 1) {
+      const shown = localStorage.getItem('splash_shown') === 'true'
 
-// 倒计时
-const timer = window.setInterval(() => {
-  state.second--
-  state.rate = (100 / countdown) * state.second
-  if (state.second <= 0) {
-    clearInterval(timer)
-    // 判断是否首次打开应用
-    if (!state.showGuide) {
-      skip(onLoad)
+      if (!shown) {
+        localStorage.setItem('splash_shown', 'true')
+        state.showSplash = true
+      }
+    } else if (displayfrequency === 2) {
+      state.showSplash = true
+    } else if (displayfrequency === 3) {
+      const storageTimestamp = Number(localStorage.getItem('splash_timestamp'))
+      const currentTimestamp = Date.now()
+      const intervalMillisecond = intervaldays * 86400000 // 将天数转换为毫秒
+
+      if ((currentTimestamp - storageTimestamp) > intervalMillisecond) {
+        state.showSplash = true
+      }
     }
   }
-}, 1000)
+}
 
-// 跳过广告
-const skip = (promise: Promise<void>) => {
-  clearInterval(timer)
-  const toast = logining.value ? showLoading() : undefined
+// 进入首页
+const navigateToHome = () => {
+  const redirect = route.query.redirect
+  if (redirect) {
+    router.replace(redirect.toString())
+  } else {
+    router.replace({ name: 'home-index' })
+  }
+  plus.exitFullSreen()
+}
 
-  promise.then(() => {
-    localStorage.setItem('muchinfo_app_showguide', 'false')
-    const redirect = route.query.redirect
-    if (redirect) {
-      router.replace(redirect.toString())
-    } else {
-      router.replace({ name: 'home-index' })
+// 初始化
+const init = () => {
+  const toast = showLoading()
+  initBaseData(true).then(() => {
+    shouldShowSplash()
+    if (!state.showSplash) {
+      navigateToHome()
     }
   }).catch((err) => {
     if (service.isReady) {
@@ -87,14 +98,14 @@ const tryInit = (message: string) => {
     cancelButtonText: '退出',
     confirmButtonText: '重试'
   }).then(() => {
-    skip(init())
+    init()
   }).catch(() => {
     plus.quit()
   })
 }
 
+init()
 plus.setFullSreen()
-onUnmounted(() => plus.exitFullSreen())
 </script>
 
 <style lang="less" scoped>

+ 25 - 0
src/packages/tss/views/boot/index.less

@@ -16,4 +16,29 @@
             object-fit: contain;
         }
     }
+
+    article {
+        position: relative;
+        display: flex;
+        flex-direction: column;
+        height: 100%;
+        background-color: #fff;
+
+        section {
+            flex: 1;
+            overflow-y: auto;
+
+            img {
+                max-width: 100%;
+            }
+        }
+
+        footer {
+            position: absolute;
+            bottom: 0;
+            left: 0;
+            width: 100%;
+            padding: 10px 20px;
+        }
+    }
 }

+ 2 - 1
src/packages/tss/views/order/delivery/components/aftersale/Index.vue

@@ -1,6 +1,6 @@
 <!-- 交收提货-退换货 -->
 <template>
-    <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(commonStore.getDocumentById(104))" />
+    <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(document?.documentcontent)" />
 </template>
 
 <script lang="ts" setup>
@@ -9,4 +9,5 @@ import HtmlContainer from '@mobile/components/base/html-container/index.vue'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(104)
 </script>

+ 2 - 1
src/packages/tss/views/rules/benefits/index.vue

@@ -4,7 +4,7 @@
         <template #header>
             <app-navbar :title="$t('tss.benefits')" />
         </template>
-        <div v-html="formatHtmlString(commonStore.getDocumentById(101))" />
+        <div v-html="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +13,5 @@ import { useCommonStore } from '@/stores/modules/common'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(101)
 </script>

+ 2 - 1
src/packages/tss/views/rules/czzn/index.vue

@@ -4,7 +4,7 @@
         <template #header>
             <app-navbar :title="$t('tss.czzn')" />
         </template>
-        <div v-html="formatHtmlString(commonStore.getDocumentById(105))" />
+        <div v-html="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +13,5 @@ import { useCommonStore } from '@/stores/modules/common'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(105)
 </script>

+ 2 - 1
src/packages/tss/views/rules/fwrx/Index.vue

@@ -3,7 +3,7 @@
         <template #header>
             <app-navbar :title="$t('rules.fwrx')" />
         </template>
-        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(commonStore.getDocumentById(1))" />
+        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +13,5 @@ import HtmlContainer from '@mobile/components/base/html-container/index.vue'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(1)
 </script>

+ 2 - 1
src/packages/tss/views/rules/gywm/Index.vue

@@ -3,7 +3,7 @@
         <template #header>
             <app-navbar :title="$t('routes.about')" />
         </template>
-        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(commonStore.getDocumentById(2))" />
+        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +13,5 @@ import HtmlContainer from '@mobile/components/base/html-container/index.vue'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(2)
 </script>

+ 2 - 1
src/packages/tss/views/rules/logistics/index.vue

@@ -4,7 +4,7 @@
         <template #header>
             <app-navbar :title="$t('tss.logistics')" />
         </template>
-        <div v-html="formatHtmlString(commonStore.getDocumentById(103))" />
+        <div v-html="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +13,5 @@ import { useCommonStore } from '@/stores/modules/common'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(103)
 </script>

+ 2 - 1
src/packages/tss/views/rules/malls/index.vue

@@ -4,7 +4,7 @@
         <template #header>
             <app-navbar :title="$t('tss.malls')" />
         </template>
-        <div v-html="formatHtmlString(commonStore.getDocumentById(102))" />
+        <div v-html="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +13,5 @@ import { useCommonStore } from '@/stores/modules/common'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(102)
 </script>

+ 2 - 1
src/packages/tss/views/rules/yszc/index.vue

@@ -3,7 +3,7 @@
         <template #header>
             <app-navbar :title="$t('rules.yszc')" />
         </template>
-        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(commonStore.getDocumentById(4))" />
+        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +13,5 @@ import HtmlContainer from '@mobile/components/base/html-container/index.vue'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(4)
 </script>

+ 2 - 1
src/packages/tss/views/rules/zcxy/index.vue

@@ -3,7 +3,7 @@
         <template #header>
             <app-navbar :title="$t('rules.zcxy')" />
         </template>
-        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(commonStore.getDocumentById(3))" />
+        <HtmlContainer style="padding: 15px;" class="content" :context="formatHtmlString(document?.documentcontent)" />
     </app-view>
 </template>
 
@@ -13,4 +13,5 @@ import HtmlContainer from '@mobile/components/base/html-container/index.vue'
 import { formatHtmlString } from '@/filters'
 
 const commonStore = useCommonStore()
+const document = commonStore.getDocumentById(3)
 </script>

+ 7 - 10
src/stores/modules/common.ts

@@ -14,11 +14,11 @@ export const useCommonStore = defineStore(() => {
     // 本地化商品集合
     const documents = computed<Model.DocumnetConfigsRsp[]>(() => state.documents.map((e) => {
         const localizedProperties = {
-            [Language.Simplified]: { documentcontent: e.documentcontent },
-            [Language.English]: { documentcontent: e.documentcontenten },
-            [Language.Thai]: { documentcontent: e.documentcontentth },
-            [Language.Traditional]: { documentcontent: e.documentcontenttw },
-            [Language.Vietnamese]: { documentcontent: e.documentcontentvi },
+            [Language.Simplified]: { documentcontent: e.documentcontent, buttontext: e.buttontext },
+            [Language.English]: { documentcontent: e.documentcontenten, buttontext: e.buttontexten },
+            [Language.Thai]: { documentcontent: e.documentcontentth, buttontext: e.buttontextth },
+            [Language.Traditional]: { documentcontent: e.documentcontenttw, buttontext: e.buttontexttw },
+            [Language.Vietnamese]: { documentcontent: e.documentcontentvi, buttontext: e.buttontextvi },
         }
 
         const localizedValues = localizedProperties[i18n.global.locale] // 本地化语言
@@ -29,11 +29,8 @@ export const useCommonStore = defineStore(() => {
         }
     }))
 
-    // 根据商品 ID 查找对应的商品信息
-    const getDocumentById = (id: number) => {
-        const documnet = documents.value.find((e) => e.documenttype === id)
-        return documnet?.documentcontent
-    }
+    // 根据商品 ID 查找对应的文档信息
+    const getDocumentById = (id: number) => documents.value.find((e) => e.documenttype === id)
 
     // 获取商品集合列表
     const fetcheDocuments = async () => {