Просмотр исходного кода

feat: 续费咨询支持微信、微信小程序链接配置

zhangyuhan 7 месяцев назад
Родитель
Сommit
0087d33c3c

+ 189 - 119
apps/mobile/src/components/mine/MineHeader.vue

@@ -8,59 +8,94 @@
           @error="errorImgFun"
         />
         <span v-if="accountInfo.hasVip" class="j-icon vip-icon">
-          <img src="@/assets/image/icon/vip/vip-icon.png" alt="">
+          <img src="@/assets/image/icon/vip/vip-icon.png" alt="" />
         </span>
         <span v-if="accountInfo.hasBigmember" class="j-icon bigmember-icon">
-            <img src="@/assets/image/icon/big-member/icon-gaojihy2.png" alt="">
+          <img src="@/assets/image/icon/big-member/icon-gaojihy2.png" alt="" />
         </span>
       </div>
       <div class="user-info-container">
         <div class="user-info-top">
-          <span class="ellipsis user-name"
-            v-if="getName">{{ getName }}</span>
+          <span class="ellipsis user-name" v-if="getName">{{ getName }}</span>
         </div>
-        <div class="user-info-bottom" :class="{'single-identity-container': userIdentityList.length === 1}">
+        <div
+          class="user-info-bottom"
+          :class="{
+            'single-identity-container': userIdentityList.length === 1
+          }"
+        >
           <span class="change-identity" @click="changeIdentityHandle">
             <span class="identity-name ellipsis">
-               {{userCurrentIdentity ? userCurrentIdentity.name : '' }}
+              {{ userCurrentIdentity ? userCurrentIdentity.name : '' }}
             </span>
-            <AppIcon v-if="userIdentityList.length > 1" name="qiehuan" size="12" color="#171826" />
+            <AppIcon
+              v-if="userIdentityList.length > 1"
+              name="qiehuan"
+              size="12"
+              color="#171826"
+            />
           </span>
-          <span class="identity-keep " @click.stop="jumpIdentityKeep">
+          <span class="identity-keep" @click.stop="jumpIdentityKeep">
             <span>身份信息维护</span>
             <AppIcon name="youbian" size="10" color="#fff" />
           </span>
         </div>
       </div>
-      <div class="app-header-set clickable"  @click="jumpSetting">
-        <AppIcon name="Setting" size="24" color="#fff"/>
+      <div class="app-header-set clickable" @click="jumpSetting">
+        <AppIcon name="Setting" size="24" color="#fff" />
       </div>
     </div>
-    <div class="account-info" v-if="Array.isArray(accountList) && accountList.length > 0">
+    <div
+      class="account-info"
+      v-if="Array.isArray(accountList) && accountList.length > 0"
+    >
       <div class="account-info-label">
-        <div class="account-info-name" :class="{'active-type': temp.selected && accountList.length > 1}"  v-for="temp in accountList" @click="changeAccountType(temp)">
-          <span class="type-name">{{accountList.length === 1 ? '账号类型:' : ''}}{{ temp.name }}</span>
-          <span class="tip" v-if="activeAccountType.name === '注册用户'">您尚未开通会员</span>
+        <div
+          class="account-info-name"
+          :class="{ 'active-type': temp.selected && accountList.length > 1 }"
+          v-for="temp in accountList"
+          @click="changeAccountType(temp)"
+        >
+          <span class="type-name"
+            >{{ accountList.length === 1 ? '账号类型:' : ''
+            }}{{ temp.name }}</span
+          >
+          <span class="tip" v-if="activeAccountType.name === '注册用户'"
+            >您尚未开通会员</span
+          >
         </div>
       </div>
       <div class="account-info-content" v-if="activeAccountType">
-        <div class="account-handle account-handle--free bg-line-gold" v-if="activeAccountType.name === '注册用户'">
+        <div
+          class="account-handle account-handle--free bg-line-gold"
+          v-if="activeAccountType.name === '注册用户'"
+        >
           <p>
             <span class="j-icon vip-icon">
-              <img src="@/assets/image/icon/vip/vip-icon.png" alt="">
+              <img src="@/assets/image/icon/vip/vip-icon.png" alt="" />
             </span>
             <span class="text bold">开通超级订阅</span>
-            <span class="activity-tip" v-if="activeAccountType.attr.subVipActMsg">
+            <span
+              class="activity-tip"
+              v-if="activeAccountType.attr.subVipActMsg"
+            >
               <i class="limit-time-icon"></i>
               {{ activeAccountType.attr.subVipActMsg }}
             </span>
           </p>
           <p>
             <span>立享27+项专属权益</span>
-            <span class="self-handle-btn" @click="toBuyVip('buy')">立即开通</span>
+            <span class="self-handle-btn" @click="toBuyVip('buy')"
+              >立即开通</span
+            >
           </p>
         </div>
-        <div class="account-handle account-handle--vip " v-else-if="activeAccountType.name === '超级订阅' && activeAccountType.attr">
+        <div
+          class="account-handle account-handle--vip"
+          v-else-if="
+            activeAccountType.name === '超级订阅' && activeAccountType.attr
+          "
+        >
           <div class="account-handle-item bg-line-gold">
             <p class="bold">到期时间:{{ activeAccountType.vipEntTime }}</p>
             <p class="self-handle-btn" @click="renewVip">
@@ -70,13 +105,23 @@
           <div class="gap"></div>
           <div class="account-handle-item bg-line-gold">
             <p class="bold">购买区域:{{ activeAccountType.attr.buyMsg }}</p>
-            <p class="self-handle-btn" @click="updateVip(activeAccountType.attr)">
-              <span>{{activeAccountType.attr.upgrade ? '去升级' : '升级咨询'}}</span>
+            <p
+              class="self-handle-btn"
+              @click="updateVip(activeAccountType.attr)"
+            >
+              <span>{{
+                activeAccountType.attr.upgrade ? '去升级' : '升级咨询'
+              }}</span>
               <AppIcon name="youbian" size="16" color="#171826" />
             </p>
           </div>
         </div>
-        <div class="account-handle account-handle--vip " v-else-if="activeAccountType.name === '省份订阅包' && activeAccountType.attr">
+        <div
+          class="account-handle account-handle--vip"
+          v-else-if="
+            activeAccountType.name === '省份订阅包' && activeAccountType.attr
+          "
+        >
           <div class="account-handle-item bg-line-blue">
             <p class="bold">到期时间:{{ activeAccountType.vipEntTime }}</p>
             <p class="self-handle-btn" @click="areaVip('renew')">
@@ -84,25 +129,40 @@
             </p>
           </div>
           <div class="gap"></div>
-          <div class="account-handle-item" :class="activeAccountType.attr.upgrade ? 'bg-line-blue' : 'bg-line-gold'">
+          <div
+            class="account-handle-item"
+            :class="
+              activeAccountType.attr.upgrade ? 'bg-line-blue' : 'bg-line-gold'
+            "
+          >
             <p class="bold">购买区域:{{ activeAccountType.attr.buyMsg }}</p>
-            <p class="self-handle-btn" @click="areaVipUpdate(activeAccountType.attr)">
-              <span>{{activeAccountType.attr.upgrade ? '去升级' : '开通超级订阅'}} </span>
+            <p
+              class="self-handle-btn"
+              @click="areaVipUpdate(activeAccountType.attr)"
+            >
+              <span
+                >{{
+                  activeAccountType.attr.upgrade ? '去升级' : '开通超级订阅'
+                }}
+              </span>
               <AppIcon name="youbian" size="16" color="#171826" />
             </p>
           </div>
         </div>
         <!--大会员和商机管理-->
         <div class="account-handle account-handle--big-ent bg-line-gold" v-else>
-          <p class="bold">{{accountList.length > 1 ? '到期时间:' : '您的会员到期时间:'}}{{ activeAccountType.vipEntTime }}</p>
+          <p class="bold">
+            {{ accountList.length > 1 ? '到期时间:' : '您的会员到期时间:'
+            }}{{ activeAccountType.vipEntTime }}
+          </p>
           <p class="self-handle-btn" @click="renewConsult">
             续费咨询 <AppIcon name="youbian" size="16" color="#171826" />
           </p>
         </div>
       </div>
     </div>
-<!--    订单tab-->
-    <order-tabs/>
+    <!--    订单tab-->
+    <order-tabs />
   </div>
 </template>
 
@@ -137,7 +197,9 @@ export default {
   computed: {
     getName() {
       const { nickname, phone, jyname } = this.pageUserInfo
-      const rephone = phone ? phone.replace(/(\d{3})\d{4}(\d{4})/, '$1 **** $2') : ''
+      const rephone = phone
+        ? phone.replace(/(\d{3})\d{4}(\d{4})/, '$1 **** $2')
+        : ''
       return nickname || rephone || jyname
     },
     // setBigVipPic() {
@@ -170,43 +232,47 @@ export default {
     //   return url
     // },
     // 账户权益类型列表
-    accountList () {
+    accountList() {
       return this.accountInfo.list || []
     },
     // 当前选中账户权益类型
     activeAccountType() {
-      const obj = this.accountList.filter(item => {
+      const obj = this.accountList.filter((item) => {
         return item.selected
       })
       return obj.length > 0 ? obj[0] : {}
     },
-    mineClass () {
+    mineClass() {
       const type = this.accountList[0] ? this.accountList[0].name : '注册用户'
       let cl = 'mine-header--blue'
-      if(type === '注册用户' || type === '省份订阅包') {
+      if (type === '注册用户' || type === '省份订阅包') {
         cl = 'mine-header--blue'
-      } else if(type === '超级订阅' ) {
+      } else if (type === '超级订阅') {
         cl = 'mine-header--gold'
       } else {
         cl = 'mine-header--black'
       }
       // 多个权益类型的时候默认黑棕
-      if(this.accountList.length > 1) {
+      if (this.accountList.length > 1) {
         cl = 'mine-header--black'
       }
       return cl
     },
-    ...mapGetters('user', ['userCurrentIdentity', 'userIdentityList', 'isLogin'])
+    ...mapGetters('user', [
+      'userCurrentIdentity',
+      'userIdentityList',
+      'isLogin'
+    ])
   },
   watch: {
     userCurrentIdentity: {
-      handler () {
+      handler() {
         localStorage.removeItem('mine_account_active_Type')
       },
       deep: true,
-      immediate: true,
+      immediate: true
     },
-    isLogin () {
+    isLogin() {
       localStorage.removeItem('mine_account_active_Type')
     }
   },
@@ -233,23 +299,25 @@ export default {
       }
     },
     // 获取用户账号类型信息
-    async getUserAccountInfo () {
+    async getUserAccountInfo() {
       try {
         const { error_code: code, data } = await getUserAccountInfo()
         if (code === 0) {
-          if(Array.isArray(data.list) && data.list.length > 0) {
+          if (Array.isArray(data.list) && data.list.length > 0) {
             data.list.forEach((item, index) => {
-               if(item.name && item.name.includes('大会员')) {
+              if (item.name && item.name.includes('大会员')) {
                 data.hasBigmember = true
-              } else if(item.name === '超级订阅') {
+              } else if (item.name === '超级订阅') {
                 data.hasVip = true
               }
-              item.vipEntTime = item.endTime ? dateFormatter(item.endTime * 1000, 'yyyy-MM-dd') : ''
+              item.vipEntTime = item.endTime
+                ? dateFormatter(item.endTime * 1000, 'yyyy-MM-dd')
+                : ''
               item.selected = false
-              if(index === 0) {
+              if (index === 0) {
                 item.selected = true
               }
-              if(!localStorage.getItem('mine_account_active_Type')) {
+              if (!localStorage.getItem('mine_account_active_Type')) {
                 localStorage.setItem('mine_account_active_Type', item.name)
               }
             })
@@ -294,21 +362,21 @@ export default {
       this.$router.push('/identity/keep')
     },
     // 账号权益类型切换
-    changeAccountType (temp) {
-      if(this.accountInfo.list) {
-        this.accountInfo.list.forEach(item => {
+    changeAccountType(temp) {
+      if (this.accountInfo.list) {
+        this.accountInfo.list.forEach((item) => {
           item.selected = false
         })
         temp.selected = true
       }
       localStorage.setItem('mine_account_active_Type', temp.name)
     },
-    backActiveName () {
+    backActiveName() {
       const active = localStorage.getItem('mine_account_active_Type')
-      if(active && this.accountInfo.list) {
-        this.accountInfo.list.forEach(item => {
+      if (active && this.accountInfo.list) {
+        this.accountInfo.list.forEach((item) => {
           item.selected = false
-          if(item.name === active) {
+          if (item.name === active) {
             item.selected = true
           }
         })
@@ -319,28 +387,28 @@ export default {
       location.href = `/jy_mobile/order/create/svip?type=${type}`
     },
     // 去续费
-    renewVip () {
-      if(this.activeAccountType.attr && this.activeAccountType.attr.renew) {
+    renewVip() {
+      if (this.activeAccountType.attr && this.activeAccountType.attr.renew) {
         this.toBuyVip('renew')
       } else {
         this.openCustomer()
       }
     },
     // 升级
-    updateVip (item) {
-      if(item.upgrade) {
+    updateVip(item) {
+      if (item.upgrade) {
         this.toBuyVip('upgrade')
       } else {
         this.openCustomer()
       }
     },
     // 省份订阅包续费/升级
-    areaVip (type) {
+    areaVip(type) {
       location.href = `/jy_mobile/order/create/areapack?type=${type}`
     },
     // 省份订阅包升级
-    areaVipUpdate (item) {
-      if(item.upgrade) {
+    areaVipUpdate(item) {
+      if (item.upgrade) {
         this.areaVip('upgrade')
       } else {
         // 开通超级订阅
@@ -348,14 +416,18 @@ export default {
       }
     },
     // 大会员or商机管理续费咨询
-    renewConsult () {
+    renewConsult() {
       // 大会员续费咨询跳转落地页
-      if(this.activeAccountType.name && this.activeAccountType.name.includes('大会员')) {
+      if (
+        this.activeAccountType.name &&
+        this.activeAccountType.name.includes('大会员')
+      ) {
         const attr = this.activeAccountType.attr || {}
         const link = {
           app: attr.app,
           h5: attr.h5,
-          wx: attr.h5
+          wx: attr.wx,
+          mini: attr.mini
         }
         openAppOrWxPage(link)
       } else {
@@ -364,7 +436,7 @@ export default {
       }
     },
     // 联系客服
-    openCustomer () {
+    openCustomer() {
       if (this.$envs.inWX) {
         window.location.href = '/big/wx/page/customer'
       } else {
@@ -396,7 +468,7 @@ export default {
   }
   .app-header-set {
     margin-right: 4px;
-    margin-top:2px;
+    margin-top: 2px;
     align-self: flex-start;
   }
   .header-info {
@@ -404,7 +476,7 @@ export default {
     flex: 1;
     justify-content: space-between;
     align-items: center;
-    padding:8px 0;
+    padding: 8px 0;
     .user-info-container {
       display: flex;
       flex-direction: column;
@@ -435,18 +507,18 @@ export default {
       position: relative;
       border: 1px solid rgba(255, 255, 255, 0.5);
       border-radius: 50%;
-      img{
+      img {
         border-radius: 50%;
       }
       .j-icon {
         position: absolute;
       }
-      .vip-icon{
-        left:0;
+      .vip-icon {
+        left: 0;
         background-size: 20px;
       }
       .bigmember-icon {
-        right:0;
+        right: 0;
         bottom: 0;
       }
     }
@@ -466,10 +538,10 @@ export default {
     //.icon-super-sub {
     //  background-image: url(@/assets/image/icon/vip/icon-vip-gold-deep.png);
     //}
-    .user-info-bottom{
+    .user-info-bottom {
       display: flex;
       align-items: center;
-      .change-identity{
+      .change-identity {
         display: flex;
         align-items: center;
         font-size: 10px;
@@ -477,16 +549,16 @@ export default {
         color: #171826;
         padding: 2px 8px;
         border-radius: 10px;
-        border: 1px solid  #fff;
+        border: 1px solid #fff;
         background: rgba(255, 255, 255, 0.65);
         margin-right: 8px;
-        .identity-name{
+        .identity-name {
           overflow: hidden;
           display: inline-block;
           max-width: 150px;
         }
       }
-      .identity-keep{
+      .identity-keep {
         color: #fff;
         line-height: 18px;
         font-size: 12px;
@@ -500,15 +572,15 @@ export default {
     padding-left: 12px;
     padding-right: 12px;
   }
-  .self-handle-btn{
+  .self-handle-btn {
     display: flex;
     align-items: center;
-    font-size:12px;
+    font-size: 12px;
     line-height: 18px;
     padding: 3px 12px;
     border-radius: 16px;
     border: 1px solid #fff;
-    background: rgba(255, 255, 255, .65);
+    background: rgba(255, 255, 255, 0.65);
     color: #171826;
   }
   .j-icon {
@@ -518,24 +590,24 @@ export default {
     border-radius: 50%;
     border: 1px solid rgba(255, 255, 255, 0.65);
   }
-  .vip-icon{
-    background:rgba(255, 255, 255, 0.65);
+  .vip-icon {
+    background: rgba(255, 255, 255, 0.65);
     backdrop-filter: blur(2px);
   }
   .bigmember-icon {
-    background:rgba(255, 255, 255, 0.5);
+    background: rgba(255, 255, 255, 0.5);
     backdrop-filter: blur(2px);
   }
-  .bg-line-gold{
-    background: linear-gradient(90deg,#FFECCE 0%, #FCD7B2 100%);
-    .self-handle-btn{
-      border: 1px solid rgba(255,255,255,.5);
+  .bg-line-gold {
+    background: linear-gradient(90deg, #ffecce 0%, #fcd7b2 100%);
+    .self-handle-btn {
+      border: 1px solid rgba(255, 255, 255, 0.5);
       box-shadow: 0px 4px 12px 0px rgba(186, 105, 31, 0.32);
     }
   }
-  .bg-line-blue{
-    background: linear-gradient(90deg, #DDFFF5 0%, #7CE8F6 100%);
-    .self-handle-btn{
+  .bg-line-blue {
+    background: linear-gradient(90deg, #ddfff5 0%, #7ce8f6 100%);
+    .self-handle-btn {
       border: 1px solid #fff;
       box-shadow: 0 4px 12px 0 rgba(31, 186, 177, 0.32);
     }
@@ -548,8 +620,8 @@ export default {
     background-size: cover;
     vertical-align: text-bottom;
   }
-  .account-info{
-    font-size:12px;
+  .account-info {
+    font-size: 12px;
     color: #171826;
     margin-top: 8px;
     span {
@@ -559,7 +631,7 @@ export default {
       display: flex;
       justify-content: flex-start;
     }
-    .account-info-name{
+    .account-info-name {
       line-height: 18px;
       cursor: pointer;
       .type-name {
@@ -569,17 +641,17 @@ export default {
       }
       .tip {
         color: #fff;
-        margin-left:4px;
+        margin-left: 4px;
       }
     }
-    .account-handle{
+    .account-handle {
       display: flex;
       justify-content: space-between;
       margin-top: 8px;
-      .gap{
-        width:8px;
+      .gap {
+        width: 8px;
       }
-      &-item{
+      &-item {
         display: flex;
         align-items: center;
         flex-direction: column;
@@ -590,9 +662,9 @@ export default {
         border-radius: 12px 12px 0 0;
         color: #171826;
         box-shadow: 0px -2px 8px 0px rgba(169, 117, 39, 0.15);
-        p{
+        p {
           font-size: 12px;
-          line-height:18px;
+          line-height: 18px;
         }
         p:nth-of-type(1) {
           margin-bottom: 6px;
@@ -612,10 +684,10 @@ export default {
             line-height: 24px;
             margin-left: 2px;
           }
-          .activity-tip{
+          .activity-tip {
             padding: 2px 5px;
             border-radius: 9px 0 9px 0;
-            background: linear-gradient(90deg, #FF7C32 0%, #F33838 100%);
+            background: linear-gradient(90deg, #ff7c32 0%, #f33838 100%);
             margin-left: 4px;
             font-size: 10px;
             line-height: 14px;
@@ -627,18 +699,18 @@ export default {
           line-height: 18px;
         }
 
-        .self-handle-btn{
+        .self-handle-btn {
           position: absolute;
           bottom: 18px;
           right: 12px;
-          font-size:12px;
+          font-size: 12px;
           line-height: 18px;
           padding: 5px 12px;
           border-radius: 16px;
-          border: 1px solid rgba(255, 255, 255, .5);
-          background: rgba(255, 255, 255, .65);
+          border: 1px solid rgba(255, 255, 255, 0.5);
+          background: rgba(255, 255, 255, 0.65);
           box-shadow: 0 4px 12px 0 rgba(186, 105, 31, 0.32);
-          color: #33323A;
+          color: #33323a;
         }
       }
 
@@ -650,7 +722,6 @@ export default {
         box-shadow: 0 -2px 8px 0 rgba(169, 117, 39, 0.15);
       }
     }
-
   }
   .icon-youbian {
     vertical-align: middle;
@@ -659,14 +730,14 @@ export default {
 .mine-header--blue {
   .account-info {
     .type-name {
-      background: #B9F1F8;
+      background: #b9f1f8;
     }
   }
 }
 .mine-header--gold {
   .account-info {
     .type-name {
-      background: #FAE7CA;
+      background: #fae7ca;
     }
   }
 }
@@ -674,21 +745,20 @@ export default {
   .account-info {
     .type-name {
       background: linear-gradient(90deg, #171826 0%, #444444 100%);
-      color: #FAE7CA;
+      color: #fae7ca;
     }
     .active-type {
-      .type-name{
-        background: #FAE7CA;
-        color: #1B1A2A;
+      .type-name {
+        background: #fae7ca;
+        color: #1b1a2a;
       }
     }
   }
-  .single-identity-container{
-    .change-identity{
+  .single-identity-container {
+    .change-identity {
       background: #171826 !important;
       border-color: #171826 !important;
-      color: #FAE7CA !important;
-
+      color: #fae7ca !important;
     }
   }
 }
@@ -698,13 +768,13 @@ export default {
 ::v-deep {
   .order-tabs {
     position: absolute;
-    width:100%;
-    left:0;
+    width: 100%;
+    left: 0;
     bottom: 0px;
     //height: 81px;
     border-top-right-radius: 16px;
     box-shadow: 0 -8px 12px 0 rgba(92, 31, 5, 0.15);
-    background: linear-gradient(180deg, #fff 0%, #F5F6F7 100%);
+    background: linear-gradient(180deg, #fff 0%, #f5f6f7 100%);
   }
 }
 </style>

+ 65 - 41
apps/mobile/src/utils/callFn/index.js

@@ -1,16 +1,16 @@
-import routerVm from '@/router'
 import {
-  appShare,
-  appCallPhone,
-  appCallOpenWindow,
   appCallChangeTab,
-  appCallReloadTab,
-  appCallHideTab,
   appCallGetToken,
+  appCallHideTab,
+  appCallOpenWindow,
+  appCallPhone,
+  appCallReloadTab,
   appDownLoadFile,
-  getAppVersion,
-  appHideRedSpotOnMenu
+  appHideRedSpotOnMenu,
+  appShare,
+  getAppVersion
 } from './appFn'
+import routerVm from '@/router'
 import { env, envs } from '@/utils/prototype/modules/platform'
 import { getFormatURL, resolveUrlQueryParams } from '@/utils'
 import { appStorage } from '@/utils/storage'
@@ -46,12 +46,13 @@ export function compareVersion(v1, v2) {
   }
 
   for (let i = 0; i < len; i++) {
-    const num1 = parseInt(v1[i])
-    const num2 = parseInt(v2[i])
+    const num1 = Number.parseInt(v1[i])
+    const num2 = Number.parseInt(v2[i])
 
     if (num1 > num2) {
       return 1
-    } else if (num1 < num2) {
+    }
+    else if (num1 < num2) {
       return -1
     }
   }
@@ -64,9 +65,10 @@ export function appVersionGt305() {
   const currentVersion = env.appVersion || getAppVersion()
   const targetVersion = '3.0.5' // 3.0.6版本更新移除某些客户端方法。详细描述在common.js中
   if (currentVersion) {
-    var c = compareVersion(currentVersion, targetVersion)
+    const c = compareVersion(currentVersion, targetVersion)
     return c === 1
-  } else {
+  }
+  else {
     return true
   }
 }
@@ -78,8 +80,9 @@ export function appVersionGt305() {
 export function callPhone(phone) {
   if (inApp) {
     appCallPhone(phone)
-  } else {
-    location.href = 'tel:' + phone
+  }
+  else {
+    location.href = `tel:${phone}`
   }
 }
 
@@ -92,7 +95,8 @@ export function callPhone(phone) {
  * authTip: 授权提示文案
  */
 export function callAppShare(shareType, title, content, link, authTip) {
-  if (!inApp) return
+  if (!inApp)
+    return
   console.log(shareType, title, content, link, authTip)
   appShare(shareType, title, content, link, authTip)
 }
@@ -113,7 +117,8 @@ export function openLinkOfAd({
   const openWindow = type === 'abroad'
   if (openWindow && inApp) {
     appCallOpenWindow(platformOS === 'ios' ? iosHref || link : link, title)
-  } else {
+  }
+  else {
     openLinkOfOther(platformOS === 'ios' ? iosHref || link : link)
   }
 }
@@ -125,13 +130,15 @@ export function openLinkOfAd({
  * @param config.type 打开形式 仅支持 replace、push
  */
 export function openLinkOfOther(link, config = {}, router = routerVm) {
-  if (!link) return
+  if (!link)
+    return
   const { query = {}, type = 'push', match = true } = config
   let prefix = ''
   if (NotURLPrefixRegExp.test(link)) {
     if (inWeiXinBrowser) {
       prefix = import.meta.env.VITE_APP_WX_PROJECT_BASE
-    } else {
+    }
+    else {
       prefix = import.meta.env.VITE_APP_APP_PROJECT_BASE
     }
   }
@@ -170,13 +177,16 @@ export function openLinkOfOther(link, config = {}, router = routerVm) {
     }
     if (type !== 'push') {
       router.replace(routeInfo)
-    } else {
+    }
+    else {
       router.push(routeInfo)
     }
-  } else {
+  }
+  else {
     if (type !== 'push') {
       location.replace(toLink)
-    } else {
+    }
+    else {
       location.href = toLink
     }
   }
@@ -194,7 +204,8 @@ export function openLinkOfOther(link, config = {}, router = routerVm) {
  *
  */
 export function checkLinkRegistered(url, router = routerVm) {
-  if (!url) return console.error('url为必传参数')
+  if (!url)
+    return console.error('url为必传参数')
   const routerBase = router.options.base || ''
   let waitingMatchUrl = ''
   const withDomain = url.includes('http://') || url.includes('https://')
@@ -204,29 +215,33 @@ export function checkLinkRegistered(url, router = routerVm) {
     // 域名为剑鱼,并且pathname中有路由前缀(/jy_mobile/),进行匹配。否则直接进行跳转
     if (u.host.includes('jianyu360')) {
       waitingMatchUrl = u.pathname
-    } else {
+    }
+    else {
       return {
         url
       }
     }
-  } else {
+  }
+  else {
     waitingMatchUrl = url
   }
 
   // pathname中有路由前缀(/jy_mobile/),进行匹配并替换。否则直接进行跳转
-  const hasRouterBaseStart =
-    waitingMatchUrl && waitingMatchUrl.match(new RegExp(`^${routerBase}/`))
+  const hasRouterBaseStart
+    = waitingMatchUrl && waitingMatchUrl.match(new RegExp(`^${routerBase}/`))
   if (hasRouterBaseStart) {
-    waitingMatchUrl = waitingMatchUrl.replace(new RegExp('^' + routerBase), '')
+    waitingMatchUrl = waitingMatchUrl.replace(new RegExp(`^${routerBase}`), '')
     const r = router.matcher.match(waitingMatchUrl)
     if (r.name === '404') {
       return {
         url
       }
-    } else {
+    }
+    else {
       return r
     }
-  } else {
+  }
+  else {
     // 直接返回url进行location.href跳转
     return {
       url
@@ -245,8 +260,12 @@ export function getAppOrWxPageLink(page) {
   let link
   if (typeof page === 'string') {
     link = page
-  } else {
+  }
+  else {
     link = page[platform]
+    if (envs.inWxMini && page.mini) {
+      link = page.mini
+    }
   }
   // 如果没找到link
   if (platform === 'h5' && !link) {
@@ -289,12 +308,14 @@ export function callChangeTab(name, router = routerVm) {
   if (inApp && !inUnifyApp) {
     // 旧版app
     return appCallChangeTab(name)
-  } else if (inWeiXinBrowser && name === 'me') {
+  }
+  else if (inWeiXinBrowser && name === 'me') {
     // 微信
-    const url =
-      import.meta.env.VITE_APP_WX_PROJECT_BASE + '/front/wxMyOrder/myMenu'
+    const url
+      = `${import.meta.env.VITE_APP_WX_PROJECT_BASE}/front/wxMyOrder/myMenu`
     location.replace(url)
-  } else {
+  }
+  else {
     router.replace({
       name: `tabbar-${name}`
     })
@@ -332,7 +353,8 @@ export function callGetToken() {
 export function downLoadFile(filename, filetype, fileurl, filesize) {
   if (inApp) {
     appDownLoadFile(filename, filetype, fileurl, filesize)
-  } else {
+  }
+  else {
     downLoadFileH5(filename, fileurl)
   }
 }
@@ -352,11 +374,13 @@ export function downLoadFileH5(name, url) {
  * APP独有:隐藏底部栏的小红点
  */
 export function callHideRedSpotOnMenu(menu) {
-  if (!inApp) return
+  if (!inApp)
+    return
   try {
     appHideRedSpotOnMenu(menu)
-  } catch (e) {
-    console.warn('error: app hideRedSpotOnMenu failed')
+  }
+  catch (e) {
+    console.warn('error: app hideRedSpotOnMenu failed', e)
   }
 }
 
@@ -376,8 +400,8 @@ export function checkNowInAppTabbarPage(link) {
 
   let appTabbarName = ''
   for (const appTabbarsKey in appTabbars) {
-    const hasTabbar =
-      (link || location.href).indexOf([appTabbars[appTabbarsKey]]) > -1
+    const hasTabbar
+      = (link || location.href).includes([appTabbars[appTabbarsKey]])
     if (hasTabbar) {
       appTabbarName = appTabbarsKey
       break

+ 22 - 13
apps/mobile/src/utils/prototype/modules/platform.js

@@ -1,4 +1,5 @@
 import { getAppVersion } from '@/utils/callFn/appFn'
+
 const ua = navigator.userAgent
 const hostname = location.hostname.toLowerCase()
 
@@ -8,7 +9,8 @@ export const androidOrIOS = function () {
   let agent = ''
   if (/iphone|ipod|ipad|ios/.test(u)) {
     agent = 'ios'
-  } else {
+  }
+  else {
     agent = 'android'
   }
   return agent
@@ -45,39 +47,45 @@ export const getIsInTheAppContainer = function () {
   }
   try {
     if (androidOrIOS() === 'ios') {
-      const iniOSApp =
-        typeof window.webkit.messageHandlers.skipAppointTab.postMessage ===
-        'function'
+      const iniOSApp
+        = typeof window.webkit.messageHandlers.skipAppointTab.postMessage
+        === 'function'
       inApp = iniOSApp
-    } else {
+    }
+    else {
       const inAndroidApp = typeof window.JyObj !== 'undefined'
       inApp = inAndroidApp
     }
-  } catch (e) {
+  }
+  catch (e) {
     console.warn(e)
     inApp = false
   }
   return inApp
 }
 
-export const getIsH5HostName = () => {
+export function getIsH5HostName() {
   return hostname.includes('h5')
 }
 
 // 判断是否是微信浏览器
-export const inWeiXinBrowser = ua.toLowerCase().indexOf('micromessenger') !== -1
+export const inWeiXinBrowser = ua.toLowerCase().includes('micromessenger')
+export const inWeiXinMiniApp = ua.toLowerCase().includes('miniprogram')
 const platformOS = androidOrIOS()
 const inApp = getIsInTheAppContainer()
 
-export const getPlatform = () => {
+export function getPlatform() {
   const h5host = getIsH5HostName()
   if (inApp) {
     return 'app'
-  } else if (h5host) {
+  }
+  else if (h5host) {
     return 'h5'
-  } else if (inWeiXinBrowser) {
+  }
+  else if (inWeiXinBrowser) {
     return 'wx'
-  } else {
+  }
+  else {
     return 'h5'
   }
 }
@@ -101,7 +109,8 @@ const inH5 = _env.platform === 'h5'
 const _envs = {
   inWX: _env.platform === 'wx',
   inH5,
-  inApp: inApp,
+  inWxMini: inWeiXinMiniApp,
+  inApp,
   inUnifyApp: getIsInTheUnifyAppContainer(),
   inAppOrH5: inApp || inH5,
   inAndroid: _env.platformOS === 'android',