zhangyuhan 10 сар өмнө
parent
commit
c36cf3fe06

+ 75 - 43
apps/mobile/src/utils/callFn/appFn.js

@@ -1,3 +1,5 @@
+import { copyText } from '@/utils'
+
 /**
  * 客户端拨打电话
  * @param phone
@@ -5,8 +7,19 @@
 export function appCallPhone(phone) {
   try {
     JyObj.callPhone(phone)
-  } catch (e) {
-    console.warn('error: app call phone')
+  }
+  catch (e) {
+    console.warn('error: app call phone', e)
+  }
+}
+
+export function appCallCopyText(text) {
+  try {
+    JyObj.wirteRight(text)
+  }
+  catch (e) {
+    console.warn('error: app call copy text', e)
+    copyText(text)
   }
 }
 
@@ -18,8 +31,9 @@ export function appCallPhone(phone) {
 export function appCallOpenWindow(link, title = '剑鱼标讯') {
   try {
     JyObj.openExternalLink(link, title)
-  } catch (e) {
-    console.warn('error: app call openExternalLink')
+  }
+  catch (e) {
+    console.warn('error: app call openExternalLink', e)
   }
 }
 
@@ -30,8 +44,9 @@ export function appCallOpenWindow(link, title = '剑鱼标讯') {
 export function appCallChangeTab(name) {
   try {
     JyObj.skipAppointTab(name)
-  } catch (e) {
-    console.warn('error: app call skipAppointTab')
+  }
+  catch (e) {
+    console.warn('error: app call skipAppointTab', e)
   }
 }
 
@@ -42,8 +57,9 @@ export function appCallChangeTab(name) {
 export function appCallReloadTab(name, status = 1) {
   try {
     JyObj.refreshAppointTab(name, status)
-  } catch (e) {
-    console.warn('error: app call refreshAppointTab')
+  }
+  catch (e) {
+    console.warn('error: app call refreshAppointTab', e)
   }
 }
 
@@ -56,8 +72,9 @@ export function appCallReloadTab(name, status = 1) {
 export function appCallBackTab(name) {
   try {
     JyObj.backUrl(name)
-  } catch (e) {
-    console.warn('error: app call backUrl')
+  }
+  catch (e) {
+    console.warn('error: app call backUrl', e)
   }
 }
 
@@ -68,8 +85,9 @@ export function appCallBackTab(name) {
 export function appCallHideTab(type) {
   try {
     JyObj.hiddenBottom(type)
-  } catch (e) {
-    console.warn('error: app call hiddenBottom')
+  }
+  catch (e) {
+    console.warn('error: app call hiddenBottom', e)
   }
 }
 
@@ -80,8 +98,9 @@ export function appCallGetToken() {
   let result
   try {
     result = JyObj.getUserToken()
-  } catch (e) {
-    console.warn('error: app call getUserToken')
+  }
+  catch (e) {
+    console.warn('error: app call getUserToken', e)
   }
   return result
 }
@@ -96,8 +115,9 @@ export function savePic(
 ) {
   try {
     window.__compatibleAppFn(JyObj.savePic, imgbase64, tip)
-  } catch (e) {
-    console.warn('error: app call savePic')
+  }
+  catch (e) {
+    console.warn('error: app call savePic', e)
   }
 }
 
@@ -106,8 +126,9 @@ export function checkNoticePermission() {
   let status
   try {
     status = JyObj.IosCall('checkNoticePermission')
-  } catch (error) {
-    console.warn('error: app call checkNoticePermission')
+  }
+  catch (e) {
+    console.warn('error: app call checkNoticePermission', e)
   }
   return status
 }
@@ -116,8 +137,9 @@ export function checkNoticePermission() {
 export function openSystemNotification() {
   try {
     JyObj.openSystemNotification()
-  } catch (error) {
-    console.warn('error: app call openSystemNotification')
+  }
+  catch (e) {
+    console.warn('error: app call openSystemNotification', e)
   }
 }
 
@@ -128,8 +150,9 @@ export function getAppVersion() {
   let version = ''
   try {
     version = JyObj.getVersion()
-  } catch (e) {
-    console.warn('error: get app version failed')
+  }
+  catch (e) {
+    console.warn('error: get app version failed', e)
   }
   return version || ''
 }
@@ -146,14 +169,15 @@ export function getAppVersion() {
 export function appDownLoadFile(filename, filetype, fileurl, filesize) {
   try {
     JyObj.downLoadFile(filename, filetype, fileurl, filesize)
-  } catch (e) {
-    console.warn('error: app ios download file failed')
+  }
+  catch (e) {
+    console.warn('error: app ios download file failed', e)
   }
 }
 
 /**
  * 隐藏小红点,3.0.6版本移除
- * @param { String } menu [搜索:search 订阅:subscribe 百宝箱:box 我的:me 消息:message]
+ * @param {string} menu [搜索:search 订阅:subscribe 百宝箱:box 我的:me 消息:message]
  */
 export function appHideRedSpotOnMenu(menu) {
   if (menu === 'me') {
@@ -161,20 +185,22 @@ export function appHideRedSpotOnMenu(menu) {
   }
   try {
     JyObj.hideRedSpotOnMenu(menu)
-  } catch (e) {
-    console.warn('error: app hideRedSpotOnMenu failed')
+  }
+  catch (e) {
+    console.warn('error: app hideRedSpotOnMenu failed', e)
   }
 }
 
 /**
  * 底部栏消息角标数量,3.0.6版本移除
- * @param { String } num
+ * @param {string} num
  */
 export function appSendMsgCount(num) {
   try {
     JyObj.sendMsgCount(num)
-  } catch (e) {
-    console.warn('error: app sendMsgCount failed')
+  }
+  catch (e) {
+    console.warn('error: app sendMsgCount failed', e)
   }
 }
 
@@ -184,8 +210,9 @@ export function appSendMsgCount(num) {
 export function appOpenWeChartScan() {
   try {
     JyObj.openWeChartScan()
-  } catch (e) {
-    console.warn('error: app openWeChartScan failed')
+  }
+  catch (e) {
+    console.warn('error: app openWeChartScan failed', e)
   }
 }
 
@@ -197,8 +224,9 @@ export function appOpenWeChartScan() {
 export function appClearHistory() {
   try {
     JyObj.clearHistory()
-  } catch (e) {
-    console.warn('error: app clearHistory failed')
+  }
+  catch (e) {
+    console.warn('error: app clearHistory failed', e)
   }
 }
 
@@ -208,8 +236,9 @@ export function appClearHistory() {
 export function appSideslipOpen() {
   try {
     JyObj.sideslipOpen()
-  } catch (e) {
-    console.warn('error: app sideslipOpen failed')
+  }
+  catch (e) {
+    console.warn('error: app sideslipOpen failed', e)
   }
 }
 /**
@@ -218,8 +247,9 @@ export function appSideslipOpen() {
 export function appSideslipClose() {
   try {
     JyObj.sideslipClose()
-  } catch (e) {
-    console.warn('error: app sideslipClose failed')
+  }
+  catch (e) {
+    console.warn('error: app sideslipClose failed', e)
   }
 }
 
@@ -240,14 +270,16 @@ export function appShare(
 ) {
   try {
     if (
-      window.__checkAppVersionCanRunTips &&
-      window.__checkAppVersionCanRunTips()
+      window.__checkAppVersionCanRunTips
+      && window.__checkAppVersionCanRunTips()
     ) {
       JyObj.share(shareType, title, content, link, authTip)
-    } else {
+    }
+    else {
       JyObj.share(shareType, title, content, link)
     }
-  } catch (e) {
-    console.warn('error: app call share')
+  }
+  catch (e) {
+    console.warn('error: app call share', e)
   }
 }

+ 77 - 117
apps/mobile/src/views/equitycenter/index.vue

@@ -105,7 +105,7 @@
         </div>
       </van-tab>
       <van-tab name="other" title="第三方会员兑换码">
-        <div class="equity-exchange">
+        <div class="equity-exchange other-equity-exchange">
           <div class="list">
             <div class="title">待获取兑换码订单列表</div>
             <div class="list-content">
@@ -159,7 +159,11 @@
           <div class="list">
             <div class="title go-to-exchange">
               <span>我的兑换记录</span>
-              <span class="go-to-exchange--text highlight-text">去兑换</span>
+              <span
+                @click="goToExChange"
+                class="go-to-exchange--text highlight-text"
+                >去兑换</span
+              >
             </div>
             <div class="list-content">
               <van-list
@@ -190,14 +194,19 @@
                   </div>
                   <div class="records-line" v-if="item.state === 1">
                     <div class="records-line-left">获取权益:</div>
-                    <div class="records-line-right">
+                    <div
+                      class="records-line-right"
+                      style="word-break: break-all"
+                    >
                       <div>
                         <span>获取权益:</span>
                         <span>{{ item.party_name }}</span>
                       </div>
                       <div>
                         <span>兑换码:</span>
-                        <span>{{ item.ex_code }}</span>
+                        <span @click="doCopyCode(item.ex_code)">{{
+                          item.ex_code
+                        }}</span>
                       </div>
                     </div>
                   </div>
@@ -256,7 +265,9 @@
         </div>
         <div class="records-line">
           <div class="records-line-left">兑换码:</div>
-          <div class="records-line-right">{{ otherResult.code }}</div>
+          <div class="records-line-right" @click="doCopyCode(otherResult.code)">
+            {{ otherResult.code }}
+          </div>
         </div>
         <div class="records-line">
           <div class="records-line-left">兑换链接:</div>
@@ -269,7 +280,7 @@
 
 <script>
 import { AppIcon } from '@/ui'
-import { callPhone } from '@/utils'
+import { callPhone, copyText, openLinkOfOther } from '@/utils'
 import {
   List,
   Button,
@@ -290,6 +301,7 @@ import {
   equityexchange,
   equitylist
 } from '@/api/modules/equitycode'
+import { appCallCopyText, appCallOpenWindow } from '@/utils/callFn/appFn'
 
 export default {
   name: 'equityCenter',
@@ -309,6 +321,7 @@ export default {
   data() {
     return {
       activeName: 'other',
+      exChangeAddress: '',
       showOtherTip: false,
       showOtherSuccessTip: false,
       otherProductId: null,
@@ -412,6 +425,26 @@ export default {
       if (!val) return '-'
       return val.replace(/-/g, '.')
     },
+    goToExChange() {
+      if (!this.exChangeAddress) {
+        return this.$toast('获取兑换地址异常')
+      }
+      if (this.$envs.inApp) {
+        appCallOpenWindow(this.exChangeAddress, '兑换')
+      } else {
+        openLinkOfOther(this.exChangeAddress)
+      }
+    },
+    doCopyCode(code) {
+      if (!code) {
+        return this.$toast('获取兑换码异常')
+      }
+      if (this.$envs.inApp) {
+        appCallCopyText(code)
+      } else {
+        copyText(code)
+      }
+    },
     onChange(index) {
       console.log('index', index)
       if (index === 'other') {
@@ -424,94 +457,15 @@ export default {
         .then((res) => {
           const data = res.data || []
           this.otherInfoList = data
+          this.exChangeAddress = data.address || ''
           this.otherListState.loading = false
           this.otherListState.finished = true
         })
         .catch(() => {
-          const res = {
-            error_code: 0,
-            error_msg: '',
-            data: {
-              pending: [
-                {
-                  id: 'TQ==',
-                  name: '(非全国)/季会员(升级)',
-                  create_date: '2024-05-09 14:39:15',
-                  state: 0,
-                  ex_code: '',
-                  party_name: ''
-                },
-                {
-                  id: 'TA==',
-                  name: '(非全国)/季会员(续费)',
-                  create_date: '2024-05-09 14:39:10',
-                  state: 0,
-                  ex_code: '',
-                  party_name: ''
-                },
-                {
-                  id: 'Qw==',
-                  name: '(非全国)/季会员(购买)',
-                  create_date: '2024-05-08 16:27:05',
-                  state: 0,
-                  ex_code: '',
-                  party_name: ''
-                },
-                {
-                  id: 'TA==',
-                  name: '(非全国)/季会员(续费)',
-                  create_date: '2024-05-08 16:26:59',
-                  state: 0,
-                  ex_code: '',
-                  party_name: ''
-                }
-              ],
-              processed: [
-                {
-                  id: 'Qg==',
-                  name: '全国/月会员(升级)',
-                  create_date: '2024-05-08 16:26:54',
-                  state: 1,
-                  ex_code: 'wyWsWamM2q2a7d60',
-                  party_name: '120剑鱼币'
-                },
-                {
-                  id: 'QQ==',
-                  name: '全国/月会员(续费)',
-                  create_date: '2024-05-08 16:26:48',
-                  state: 1,
-                  ex_code: 'wyWsWamM2q2a7d59',
-                  party_name: '网易云音乐黑胶VIP月卡'
-                },
-                {
-                  id: 'QA==',
-                  name: '全国/月会员(购买)',
-                  create_date: '2024-05-07 09:50:22',
-                  state: 1,
-                  ex_code: 'iCWsWamM2q2a7dac2014',
-                  party_name: 'WPS会员月卡'
-                },
-                {
-                  id: 'Rw==',
-                  name: '(非全国)/月会员(升级)',
-                  create_date: '2024-05-07 09:49:35',
-                  state: 1,
-                  ex_code: 'iCWsWamM2q2a7dac2023',
-                  party_name: '120剑鱼币'
-                },
-                {
-                  id: 'Rg==',
-                  name: '(非全国)/月会员(续费)',
-                  create_date: '2024-05-06 14:28:21',
-                  state: 1,
-                  ex_code: 'iCWsWamM2q2a7d49',
-                  party_name: '腾讯视频会员周卡'
-                }
-              ],
-              address: '/page_workDesktop/work-bench/app/points/detail'
-            }
+          this.otherInfoList = {
+            pending: [],
+            processed: []
           }
-          this.otherInfoList = res.data
           this.otherListState.loading = false
           this.otherListState.finished = true
         })
@@ -589,20 +543,40 @@ export default {
       .van-radio {
         margin-top: 9px;
       }
+      .van-radio__icon {
+        height: 18px;
+        line-height: 14px;
+      }
+      .van-radio__icon .van-icon {
+        font-size: 14px;
+      }
+      .van-radio__label {
+        line-height: 22px;
+        color: #5f5e64;
+      }
     }
   }
 
   .show-result-dialog {
-    padding: 8px 30px 24px 30px;
+    &.records-item {
+      padding: 8px 30px 24px 30px;
+      font-size: 15px;
+      color: #5f5e64;
+    }
     .records-line-left {
       min-width: 5em;
       width: auto;
     }
   }
+
   .records-item {
+    padding-left: 16px;
+    padding-right: 16px;
+    padding-bottom: 8px;
+    font-size: 13px;
+
     &:not(:last-of-type) {
-      margin-bottom: 18px;
-      padding-top: 10px;
+      padding-top: 8px;
       border-top: 1px solid rgb(240, 237, 237);
     }
 
@@ -613,11 +587,14 @@ export default {
 
     .records-line {
       display: flex;
-      margin-bottom: 10px;
+      line-height: 20px;
+      padding-top: 6px;
+      padding-bottom: 6px;
+      margin-bottom: unset;
     }
 
     .records-line-left {
-      width: 30%;
+      width: 70px;
       color: #5f5e64;
     }
 
@@ -715,25 +692,6 @@ export default {
     border-radius: 4px;
   }
 
-  .van-button__content {
-    position: absolute;
-    width: 70px;
-    height: 24px;
-    left: calc(50% - 64px / 2 - 0.5px);
-    top: calc(50% - 24px / 2);
-    font-family: 'PingFang SC';
-    font-style: normal;
-    font-weight: 400;
-    font-size: 16px;
-    line-height: 24px;
-    /* identical to box height, or 150% */
-    display: flex;
-    align-items: center;
-    text-align: center;
-    /* Font/#F7F9FA */
-    color: #f7f9fa;
-  }
-
   .j-container {
     background: #f2f2f2;
   }
@@ -748,7 +706,7 @@ export default {
   }
 
   .list {
-    margin: 4.267vw;
+    margin: 8px;
     background: #fff;
     border-radius: 8px;
   }
@@ -775,7 +733,8 @@ export default {
     border-radius: 10px 10px 0px 0px;
     width: 100%;
     height: 48px;
-    padding: 25px 20px;
+    padding: 16px;
+    padding-bottom: 6px;
   }
 
   .toptitle {
@@ -793,7 +752,8 @@ export default {
     background: #2abed1;
     border-radius: 4px;
     border: 1px solid #2abed1;
-    width: 13rem;
+    width: 96px;
+    font-size: 16px;
     display: block;
     margin: 0 auto;
   }
@@ -859,7 +819,7 @@ export default {
   }
 
   .list-content {
-    padding: 25px 20px;
+    padding: 0;
   }
 
   .j-equitycode {

+ 6 - 0
eslint.config.mjs

@@ -1,4 +1,5 @@
 import antfu from '@antfu/eslint-config'
+
 export default antfu({
   ignores: ['dist', '**/dist/**', 'public', '**/public/**'],
   vue: {
@@ -15,5 +16,10 @@ export default antfu({
   rules: {
     'style/comma-dangle': 'off',
     'node/prefer-global/process': 'off'
+  },
+  languageOptions: {
+    globals: {
+      JyObj: true
+    }
   }
 })