Bläddra i källkod

Merge branch 'develop' of Software/android-cloud-H5 into release/v5.4.0

zengzhixiang 2 år sedan
förälder
incheckning
1dcb7e67fc

+ 7 - 1
.eslintrc.js

@@ -4,11 +4,17 @@ module.exports = {
     browser: true,
     node: true,
   },
+  parser: 'vue-eslint-parser',
   parserOptions: {
     parser: '@babel/eslint-parser',
     requireConfigFile: false,
   },
-  extends: ['@nuxtjs', 'plugin:nuxt/recommended', 'prettier'],
+  extends: [
+    'plugin:vue/recommended',
+    '@nuxtjs',
+    'plugin:nuxt/recommended',
+    'prettier',
+  ],
   plugins: [],
   // add your custom rules here
   rules: {

BIN
assets/image/activity/invite-user/bg-2@2x.png


BIN
assets/image/activity/invite-user/cybz-content-2@2x.png


BIN
assets/image/logo.png


+ 40 - 45
components/disk/index.vue

@@ -20,7 +20,7 @@
         ></v-progress-circular>
         <div v-if="loadingLabel" class="label mt-2">{{ loadingLabel }}</div>
       </div>
-      <div class="" v-else-if="$fetchState.error">
+      <div v-else-if="$fetchState.error" class="">
         <v-icon>$error</v-icon>
         <div class="">{{ $fetchState.error.message }}</div>
         <div class="">
@@ -71,11 +71,6 @@ export default {
       // activePhoneSizeId: 0,
     };
   },
-  computed: {
-    // currentPhoneSize() {
-    //   // return this.phoneSizeList.find(v=> v.width=== )
-    // },
-  },
   async fetch() {
     // await this.getDiskInfo();
     if (this.userCardId) {
@@ -84,6 +79,11 @@ export default {
       await this.connect(this.userCardId);
     }
   },
+  computed: {
+    // currentPhoneSize() {
+    //   // return this.phoneSizeList.find(v=> v.width=== )
+    // },
+  },
   watch: {
     userCardId: '$fetch',
   },
@@ -123,50 +123,45 @@ export default {
      */
     async connect(userCardId) {
       // 连接云机
-      const getConnectData = () => {
-        return this.$axios
-          .$post('/resources/user/cloud/connect', {
-            userCardId,
-          })
-          .catch((error) => {
-            if (error.response.data.status === 5200) {
-              this.loadingLabel = '云手机挂载中...';
-            }
-            return error;
-          });
-      };
-
-      const res = await getConnectData();
+      const getConnectData = () =>
+        this.$axios.$post('/resources/user/cloud/connect', {
+          userCardId,
+        });
 
-      if (!res.isAxiosError) {
+      try {
+        const res = await getConnectData();
         this.connectInfo = res.data;
-        // this.connectInfo.sn = 'RK3931C13019';
         return res;
-      }
-      // 第一次连接失败,开启轮询
-      const wres = await new Promise((resolve, reject) => {
-        const startTime = Date.now();
-        const maxTime = 1000 * 20;
-        clearInterval(this._watchConnectInterval);
-        this._watchConnectInterval = setInterval(async () => {
-          try {
-            if (Date.now() - startTime >= maxTime) {
-              throw new Error('云手机挂载超时');
-            }
-            const res = await getConnectData();
-            if (!res.isAxiosError) {
+      } catch (error) {
+        const res = await new Promise((resolve, reject) => {
+          const startTime = Date.now();
+          const maxTime = 1000 * 60;
+          const interval = 1000 * 1;
+          clearInterval(this._watchConnectInterval);
+          this._watchConnectInterval = setInterval(async () => {
+            try {
+              if (Date.now() - startTime >= maxTime) {
+                throw new Error('云手机挂载超时');
+              }
+              await getConnectData().then(resolve, (error) => {
+                // console.log(
+                //   '🚀 ~ file: index.vue ~ line 149 ~ awaitgetConnectData ~ error',
+                //   error,
+                // );
+                if (error.response.data.status === 5220) {
+                  // console.log('一键修复');
+                  this.loadingLabel = error.response.data.msg;
+                }
+              });
+            } catch (error) {
               clearInterval(this._watchConnectInterval);
-              resolve(res);
+              reject(error);
             }
-          } catch (error) {
-            clearInterval(this._watchConnectInterval);
-            reject(error);
-          }
-        }, 1000);
-      });
-      this.connectInfo = wres.data;
-      // this.connectInfo.sn = 'RK3923C1201900139';
-      return res;
+          }, interval);
+        });
+        this.connectInfo = res.data;
+        return res;
+      }
     },
   },
 };

+ 26 - 15
components/disk/video.vue

@@ -2,15 +2,14 @@
   <div class="disk-video">
     <video
       v-if="hasMediaSource"
-      :id="videoId"
       ref="video"
       class="video"
-      src=""
       autoplay
+      muted
+      controls
     ></video>
     <canvas
       v-else
-      :id="videoId"
       class="canvas"
       width="720"
       height="1280"
@@ -145,12 +144,12 @@ function checkMultiLoginInfo(input) {
 // 切换清晰度
 function makeSharpness(sn, level) {
   // var sn = "RK3923C1201900139";
-  var jsonObj = {
+  const jsonObj = {
     type: 2,
     data: { definition: level, clientType: 'h5', sceneType: 'cloudPhone' },
   };
-  var jsonStr = JSON.stringify(jsonObj);
-  var outPut = new TextEncoder('utf-8').encode(jsonStr);
+  const jsonStr = JSON.stringify(jsonObj);
+  const outPut = new TextEncoder('utf-8').encode(jsonStr);
   return makeFrameExtend(sn, 0xd, outPut);
 }
 export default {
@@ -164,19 +163,23 @@ export default {
   data() {
     return {
       hasMediaSource: false,
-      videoId: `video-${Date.now()}`,
     };
   },
-  created() {},
-  mounted() {
-    this.initVideo();
-  },
   async fetch() {
     this.info && (await this.initPlugflowWebSocket());
   },
+  computed: {
+    sn() {
+      return this.info.sn;
+    },
+  },
   watch: {
     info: '$fetch',
   },
+  created() {},
+  mounted() {
+    this.initVideo();
+  },
   methods: {
     initPlugflowWebSocket() {
       this?._ws?.close();
@@ -289,22 +292,30 @@ export default {
     },
     initVideo() {
       this.hasMediaSource = !!window.MediaSource;
-      this.hasMediaSource = false;
+      // this.hasMediaSource = false;
       if (this.hasMediaSource) {
         this._jmuxer = new JMuxer({
-          node: this.videoId,
+          node: this.$refs.video,
           flushingTime: 33,
           fps: 30,
           mode: 'video',
-          debug: false,
+          debug: true,
+          onReady :()=>{
+            console.log('JMuxer ready');
+          }
         });
       } else {
         throw new Error('当前设备不支持MediaSource');
       }
     },
     pushVideo(data) {
+      console.log("🚀 ~ file: video.vue ~ line 315 ~ pushVideo ~ data", data)
       if (this.hasMediaSource) {
-        this?._jmuxer?.feed({ video: data.video });
+        this?._jmuxer?.feed({
+          video: data.video,
+          // duration: data.duration,
+          // frameType: data.frameType,
+        });
         this.$refs?.video?.play();
       }
     },

+ 4 - 2
jsconfig.json

@@ -6,7 +6,9 @@
       "@/*": ["./*"],
       "~~/*": ["./*"],
       "@@/*": ["./*"]
-    }
+    },
+    "jsx": "preserve"
   },
-  "exclude": ["node_modules", ".nuxt", "dist"]
+  "exclude": ["node_modules", ".nuxt", "dist"],
+  "vueCompilerOptions": { "target": 2.7 }
 }

+ 1 - 0
modules/postcss-px-to-viewport.js

@@ -1,5 +1,6 @@
 export default function () {
   this.nuxt.hook('build:before', (nuxt, buildOptions) => {
+    // console.log("🚀 ~ file: postcss-px-to-viewport.js ~ line 3 ~ this.nuxt.hook ~ buildOptions", buildOptions)
     // buildOptions.postcss.plugins;
     // console.log(
     //   '🚀 ~ file: postcss-px-to-viewport.js ~ line 9 ~ this.nuxt.hook ~ buildOptions.postcss.plugins',

+ 9 - 5
package.json

@@ -1,5 +1,5 @@
 {
-  "name": "android-cloud-H5",
+  "name": "android-cloud-h5",
   "version": "1.0.0",
   "private": true,
   "scripts": {
@@ -41,10 +41,10 @@
     "vant": "^2.12.47",
     "vconsole": "^3.14.6",
     "vee-validate": "^3.4.14",
-    "vue": "^2.6.14",
+    "vue": "^2.7.8",
     "vue-data-dict": "^1.0.6",
-    "vue-server-renderer": "^2.6.14",
-    "vue-template-compiler": "^2.6.14",
+    "vue-server-renderer": "^2.7.8",
+    "vue-template-compiler": "^2.7.8",
     "vuetify": "^2.6.1",
     "webpack": "^4.46.0"
   },
@@ -60,7 +60,8 @@
     "@nuxtjs/style-resources": "^1.2.1",
     "@nuxtjs/stylelint-module": "^4.1.0",
     "@nuxtjs/vuetify": "^1.12.3",
-    "@unocss/nuxt": "^0.39.0",
+    "@unocss/nuxt": "^0.43",
+    "@vue/runtime-dom": "^3.2.37",
     "babel-plugin-import": "^1.13.5",
     "eslint": "^8.4.1",
     "eslint-config-prettier": "^8.3.0",
@@ -69,8 +70,11 @@
     "less": "^4.1.3",
     "less-loader": "^7.3.0",
     "lqip-loader": "^2.2.1",
+    "postcss": "^8",
     "postcss-html": "^1.3.0",
+    "postcss-loader": "^4",
     "postcss-px-to-viewport": "^1.1.1",
+    "postcss-px-to-viewport-8-plugin": "^1.1.5",
     "prettier": "^2.5.1",
     "stylelint": "^14.1.0",
     "stylelint-config-prettier": "^9.0.3",

+ 259 - 71
pages/activity/invite-user/index.vue

@@ -1,20 +1,31 @@
 <template>
-  <v-container class="invite-user pa-0" fluid>
+  <v-container class="invite-user pa-0" fluid :class="`bg-${type}`">
     <div class="box box1">
       <div class="box-header">参与步骤</div>
       <div class="box-main">
         <v-img
+          v-if="type === 1"
           class="cybz-content"
           src="~/assets/image/activity/invite-user/cybz-content@2x.png"
         />
+        <v-img
+          v-else-if="type === 2"
+          class="cybz-content"
+          src="~/assets/image/activity/invite-user/cybz-content-2@2x.png"
+        />
         <div class="cybz-content-text">
           <div class="cybz-content-text-item">分享好友</div>
           <div class="cybz-content-text-item">邀请购买云机</div>
-          <div class="cybz-content-text-item">返星币换现金</div>
+          <div class="cybz-content-text-item">
+            <template v-if="type === 1">返星币换现金</template>
+            <template v-else-if="type === 2">返云手机时长</template>
+          </div>
         </div>
         <v-btn class="share-button" rounded @click="share()">
-          <template v-if="$userAgent.isApp">分享好友赚星币</template>
-          <template v-else>复制链接分享好友赚星币</template>
+          <template v-if="!($userAgent.isSzx || $userAgent.isSzxBrowser)"
+            >复制链接</template
+          >分享好友赚<template v-if="type === 1">星币</template
+          ><template v-else-if="type === 2">手机时长</template>
         </v-btn>
         <!-- <button @click="share()">邀请</button> -->
       </div>
@@ -41,12 +52,57 @@
         </div>
       </div>
     </div>
-    <!-- <div class="box box3">
-      <div class="box-header">返利套餐</div>
-      <div class="box-main"></div>
-    </div> -->
+
+    <div v-if="type === 2" class="box box3">
+      <div class="box-header">收益明细</div>
+      <div class="box-main">
+        <table class="w-full code-table">
+          <thead class="text-left text-sm whitespace-nowrap break-normal">
+            <tr>
+              <th class="w-120px">获得的时间</th>
+              <th>激活码编号</th>
+              <th class="w-60px">使用状态</th>
+            </tr>
+          </thead>
+          <tbody class="text-xs">
+            <tr v-for="(item, index) in myActivationCode" :key="index">
+              <td class="whitespace-nowrap break-normal">
+                {{ item.createTime }}
+              </td>
+              <td class="whitespace-nowrap break-normal">
+                <div class="flex">
+                  <span>{{ item.activationCode }} </span
+                  ><span class="ml-auto">|</span><v-btn
+                    text
+                    small
+                    color="#991AD2"
+                    class="copy-btn"
+                    @click="copyCode(item)"
+                    >复制</v-btn
+                  >
+                </div>
+              </td>
+              <td class="whitespace-nowrap break-normal text-right">
+                <span v-if="item.activationUse" style="color: #dd1b0d"
+                  >已使用</span
+                >
+                <span v-else>未使用</span>
+              </td>
+            </tr>
+          </tbody>
+        </table>
+        <!-- <div class="code-list">
+          <div
+            v-for="(item, index) in 10"
+            :key="index"
+            class="code-item"
+          ></div>
+        </div> -->
+      </div>
+    </div>
     <div class="box box4">
       <div class="box-header">活动规则</div>
+      <!-- eslint-disable-next-line vue/no-v-html -->
       <div class="box-main text-sm" v-html="activityRules">
         <!-- <p>1、传播过程中有任何疑问,可直接咨询客服</p>
         <p>
@@ -86,12 +142,22 @@
 // import qs from 'qs';
 // import clipboard from 'clipboardy/browser';
 import * as clipboard from 'clipboard-polyfill/text';
-import { getStarCoinOverview } from '~/api/activity/invite-user.js';
-import { getContentByType } from '~/api/public/agreement.js';
+// import { getStarCoinOverview } from '~/api/activity/invite-user.js';
+// import { getContentByType } from '~/api/public/agreement.js';
 export default {
   // auth: false,
   name: 'InviteUser',
   filters: {},
+  // async asyncData({ $axios }) {
+  //   // 页面初始化前触发
+  //   const res = await $axios.$get(
+  //     '/activity/v1/inviteUser/orderRelation/starCoinOverview',
+  //   );
+  //   res.data.type = 2;
+  //   return {
+  //     data: res.data,
+  //   };
+  // },
   data() {
     return {
       data: {
@@ -105,15 +171,21 @@ export default {
         inviteUserName: null,
         activityId: null,
         status: 0,
+        type: 0,
       },
       activityRules: '',
+      myActivationCode: [],
     };
   },
   async fetch() {
-    //
+    // 页面初始化后触发
     try {
-      this.getActivityRules();
-      this.data = (await getStarCoinOverview(this)).data;
+      await this.getActiveInfo();
+      this.$native.setShareInfo(this.shareInfo);
+      await Promise.all([
+        this.getActivityRules(),
+        this.type === 2 && this.getMyActivationCode(),
+      ]);
     } catch (error) {
       this.$toast.error(error.message);
     }
@@ -129,40 +201,114 @@ export default {
   },
   computed: {
     dataList() {
-      return [
-        { label: '今日收益(星币)', value: this.data.todayIncomeStarCoin },
-        { label: '总收益(星币)', value: this.data.totalIncomeStarCoin },
-        { label: '今日购买订单数', value: this.data.todayBuyOrderSuccessCount },
-        { label: '累计推广订单', value: this.data.totalBuyOrderCount },
-        {
-          label: '今日购买成功客户',
-          value: this.data.todayBuyOrderSuccessCount,
-        },
-        {
-          label: '累计购买成功客户',
-          value: this.data.totalBuyOrderSuccessCount,
-        },
-        // { label: '可提现星币数量', value: this.data.withdrawStarCoinNum },
-      ];
+      switch (this.type) {
+        case 1: {
+          return [
+            { label: '今日收益(星币)', value: this.data.todayIncomeStarCoin },
+            { label: '总收益(星币)', value: this.data.totalIncomeStarCoin },
+            {
+              label: '今日购买订单数',
+              value: this.data.todayBuyOrderSuccessCount,
+            },
+            { label: '累计推广订单', value: this.data.totalBuyOrderCount },
+            {
+              label: '今日购买成功客户',
+              value: this.data.todayBuyOrderSuccessCount,
+            },
+            {
+              label: '累计购买成功客户',
+              value: this.data.totalBuyOrderSuccessCount,
+            },
+            // { label: '可提现星币数量', value: this.data.withdrawStarCoinNum },
+          ];
+        }
+        case 2: {
+          return [
+            {
+              label: '今日获取的激活码',
+              value: this.data.todayIncomeActivationCode,
+            },
+            { label: '总激活码', value: this.data.totalIncomeActivationCode },
+            {
+              label: '今日购买订单数',
+              value: this.data.todayBuyOrderSuccessCount,
+            },
+            { label: '累计推广订单', value: this.data.totalBuyOrderCount },
+            {
+              label: '今日购买成功客户',
+              value: this.data.todayBuyOrderSuccessCount,
+            },
+            {
+              label: '累计购买成功客户',
+              value: this.data.totalBuyOrderSuccessCount,
+            },
+            // { label: '可提现星币数量', value: this.data.withdrawStarCoinNum },
+          ];
+        }
+        default: {
+          return [];
+        }
+      }
+    },
+    type() {
+      return this.data.type;
+    },
+    shareInfo() {
+      if (this.$userAgent.isMiniProgram) {
+        return {
+          title: '双子星APP',
+          path: '/pages/home/home',
+          imgUrl: location.origin + require('~/assets/image/logo.png'),
+        };
+      }
+      const url =
+        location.origin +
+        this.$router.resolve({
+          path: '/activity/invite-user/register',
+          query: {
+            invitationUserName: this.data.inviteUserName,
+            activityId: this.data.activityId,
+            type: this.type,
+          },
+        }).href;
+      return {
+        title: '双子星APP',
+        desc: '分享好友购买云机套餐,返星币换现金',
+        link: url,
+        imgUrl: location.origin + require('~/assets/image/logo.png'),
+      };
     },
   },
   mounted() {
-    this.$userAgent.isMiniProgram &&
-      this.$wx.miniProgram.postMessage({
-        data: {
-          action: 'updateAppMessageShareData',
-          params: {
-            title: '双子星云手机',
-            path: '/pages/home/home',
-            imageUrl:
-              location.origin +
-              require('~/assets/image/activity/invite-user/bg@2x.png'),
-            // promise: null,
-          },
-        },
-      });
+    // this.$userAgent.isMiniProgram &&
+    //   this.$wx.miniProgram.postMessage({
+    //     data: {
+    //       action: 'updateAppMessageShareData',
+    //       params: {
+    //         title: '双子星云手机',
+    //         path: '/pages/home/home',
+    //         imageUrl:
+    //           location.origin +
+    //           require('~/assets/image/activity/invite-user/bg@2x.png'),
+    //         // promise: null,
+    //       },
+    //     },
+    //   });
   },
   methods: {
+    async getActiveInfo() {
+      const res = await this.$axios.$get(
+        '/activity/v1/inviteUser/orderRelation/starCoinOverview',
+      );
+      // res.data.type = 2;
+      this.data = res.data;
+    },
+    async getMyActivationCode() {
+      const res = await this.$axios.$get(
+        '/activity/v1/inviteUser/orderRelation/myActivationCode',
+      );
+      this.myActivationCode = res.data.list;
+    },
     async share() {
       // console.log(this);
       if (this.data.status !== 1) {
@@ -179,40 +325,45 @@ export default {
       }
 
       this.$tongji.trackEvent('活动', '分享', '', 0);
-      const url =
-        location.origin +
-        this.$router.resolve({
-          path: '/activity/invite-user/register',
-          query: {
-            invitationUserName: this.data.inviteUserName,
-            activityId: this.data.activityId,
-          },
-        }).href;
 
-      if (this.$userAgent.isMiniProgram) {
-        // 小程序环境
-        await clipboard.writeText(`${url} 唔即云手机`);
-        this.$toast.success('链接复制成功');
-      } else if (this.$userAgent.isApp) {
+      // if (this.$userAgent.isMiniProgram) {
+      //   // 小程序环境
+      //   await clipboard.writeText(`${this.shareInfo.gotoUrl} 唔即云手机`);
+      //   this.$toast.success('链接复制成功');
+      // } else
+      if (this.$userAgent.isSzx || this.$userAgent.isSzxBrowser) {
         // app环境
-        this.$native.share({
-          title: '双子星APP',
-          content: '分享好友购买云机套餐,返星币换现金',
-          gotoUrl: url,
-          shareImg: 'sdsa.png',
-        });
+        this.$native.share(this.shareInfo);
       } else {
         // 浏览器环境
-        await clipboard.writeText(`${url} 唔即云手机`);
+        await clipboard.writeText(`${this.shareInfo.gotoUrl} 唔即云手机`);
         // throw new Error('1231');
         this.$toast.success('链接复制成功');
       }
     },
     async getActivityRules() {
-      const res = await getContentByType(this, 'iuserrules01');
-      this.activityRules = res.data.content
-        .replace(/[\d\D]*<body>([\d\D]+)<\/body>[\d\D]*/i, '$1')
-        .replace(/<div class="phone-container">([\d\D]+)<\/div>/g, '$1');
+      const agreementCoding = { 1: 'iuserrules01', 2: 'iuserrules02' }[
+        this.type
+      ];
+      if (agreementCoding) {
+        const res = await this.$axios.$get(
+          '/public/v5/agreementApi/content/getContentByType',
+          {
+            params: {
+              agreementCoding,
+              type: 1,
+            },
+          },
+        );
+
+        this.activityRules = res.data.content
+          .replace(/[\d\D]*<body>([\d\D]+)<\/body>[\d\D]*/i, '$1')
+          .replace(/<div class="phone-container">([\d\D]+)<\/div>/g, '$1');
+      }
+    },
+    async copyCode(item) {
+      await clipboard.writeText(item.activationCode);
+      this.$toast.success('复制成功');
     },
   },
 };
@@ -221,12 +372,20 @@ export default {
 <style lang="scss" scoped>
 .invite-user {
   color: #333;
-  background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
+  // background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
   background-size: 100% auto;
   // background-position-y: -44px;
   overflow: hidden;
   padding-bottom: 30px;
+
+  &.bg-1 {
+    background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
+  }
+  &.bg-2 {
+    background-image: url('~/assets/image/activity/invite-user/bg-2@2x.png');
+  }
 }
+
 .box {
   width: 373px;
   box-sizing: border-box;
@@ -240,9 +399,11 @@ export default {
   // border-width: 1px;
   border-style: solid;
   position: relative;
+
   + .box {
     margin-top: 30px;
   }
+
   .box-header {
     position: absolute;
     top: -30px;
@@ -253,17 +414,21 @@ export default {
     padding: 0 130px;
     color: #fff;
   }
+
   .box-main {
     padding: 30px 15px 20px;
   }
 }
+
 .box1 {
   margin-top: 275px;
+
   .box-main {
     // padding: 30px 15px 20px;
     padding-left: 0;
     padding-right: 0;
   }
+
   .cybz-content {
     width: 305px;
     height: 75px;
@@ -271,6 +436,7 @@ export default {
     display: block;
     // margin-top: 30px;
   }
+
   .cybz-content-text {
     // display: flex;
     display: grid;
@@ -282,12 +448,14 @@ export default {
     grid-template-columns: 1fr 1fr 1fr;
     font-size: 12px;
     color: #333;
+
     .cybz-content-text-item {
       // width: 0;
       // flex: auto;
       text-align: center;
     }
   }
+
   .share-button {
     display: block;
     margin: auto;
@@ -302,25 +470,45 @@ export default {
     font-weight: bold;
   }
 }
+
 .box2 {
   .label {
     // font-size: 14px;
   }
+
   .value {
     color: #ff6600;
     // font-size: 24px;
   }
+
   .box-main {
     padding-left: 20px;
     padding-right: 20px;
   }
 }
-.box4 {
+
+.box3 {
   .box-main {
     // padding-left: 20px;
     // padding-top: 0;
+    padding-left: 10px;
+    padding-right: 10px;
+  }
+}
+.code-table {
+  // width: 100%;
+  tr {
+    height: 30px;
+    color: #666;
+  }
+  td {
+    height: 30px;
+    color: #333;
+  }
+  .copy-btn {
+    min-width: 0 !important;
+    height: auto !important;
+    padding: 0 !important;
   }
 }
 </style>
-
-

+ 12 - 4
pages/activity/invite-user/register.vue

@@ -1,5 +1,5 @@
 <template>
-  <v-container class="register-for-invite pa-0" fluid>
+  <v-container class="register-for-invite pa-0" fluid :class="`type-${type}`">
     <div class="box box1">
       <div class="box-header">快速注册</div>
       <div class="box-main">
@@ -104,6 +104,11 @@ export default {
   head: {
     title: '注册',
   },
+  computed: {
+    type() {
+      return Number(this.$route.query.type);
+    },
+  },
   watch: {},
   methods: {
     maskPhone(value) {
@@ -153,16 +158,20 @@ export default {
 };
 </script>
 
-
 <style lang="scss" scoped>
 .register-for-invite {
   color: #333;
-  background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
   background-size: 100% auto;
   // background-position-y: -44px;
   overflow: hidden;
   padding-bottom: 30px;
   min-height: 100vh;
+  &.type-1 {
+    background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
+  }
+  &.type-2 {
+    background-image: url('~/assets/image/activity/invite-user/bg-2@2x.png');
+  }
 }
 .box {
   width: 373px;
@@ -216,4 +225,3 @@ export default {
   font-weight: bold !important;
 }
 </style>
-

+ 2 - 0
pages/phone/_id.vue

@@ -30,6 +30,7 @@ export default {
         sourceType,
         authPhone,
         validTime,
+        id,
       } = res.data;
       const token = $auth.strategy.token.get();
       const url = `${location.origin}${base}${
@@ -44,6 +45,7 @@ export default {
           sourceType,
           authPhone: authPhone ? 'huo' : 'none',
           validTime,
+          record: id,
         },
         {
           addQueryPrefix: true,

+ 59 - 0
pages/test/ios-post-message.vue

@@ -0,0 +1,59 @@
+<template lang="">
+  <div>
+    <div class="">
+      <div class="">window.webkit: {{ hasWebkit }}</div>
+      <div class="">
+        window.webkit.messageHandlers: {{ hasMessageHandlers }}
+      </div>
+      <div class="">
+        window.webkit.messageHandlers.setShareInfo: {{ hasSetShareInfo }}
+      </div>
+      <div class="">
+        window.webkit.messageHandlers.openShare: {{ hasOpenShare }}
+      </div>
+      <div class="">
+        <div class="">messageHandlersKeys {{ messageHandlersKeys.length }}</div>
+        <div v-for="item in messageHandlersKeys" :key="item">
+          {{ item }}
+        </div>
+      </div>
+    </div>
+    <v-btn @click="setShareInfo">setShareInfo</v-btn>
+    <v-btn @click="openShare">openShare</v-btn>
+  </div>
+</template>
+<script>
+export default {
+  auth: false,
+  data() {
+    return {
+      hasWebkit: !!window?.webkit,
+      hasMessageHandlers: !!window?.webkit?.messageHandlers,
+      hasSetShareInfo: !!window?.webkit?.messageHandlers?.setShareInfo,
+      hasOpenShare: !!window?.webkit?.messageHandlers?.openShare,
+      messageHandlersKeys: Object.keys(window?.webkit?.messageHandlers ?? {}),
+    };
+  },
+  fetch() {
+    try {
+      this.setShareInfo();
+    } catch (error) {}
+  },
+  mounted() {
+    // this.
+  },
+  methods: {
+    setShareInfo() {
+      window.webkit.messageHandlers.setShareInfo.postMessage({
+        title: '邀请好友赚星币',
+        gotoUrl: 'http://www.baidu.com',
+        shareImg:
+          'http://gntest.phone.androidscloud.com:1280/cloud/phone/web/static/img/logo.c898a0c6.png',
+      });
+    },
+    openShare() {
+      window.webkit.messageHandlers.openShare.postMessage();
+    },
+  },
+};
+</script>

+ 1 - 1
plugins/axios.js

@@ -8,7 +8,7 @@ export default function ({ $axios, $auth, redirect }) {
     return config;
   });
   $axios.onResponse(async (response) => {
-    console.log("🚀 ~ file: axios.js ~ line 11 ~ $axios.onResponse ~ response", response)
+    // console.log("🚀 ~ file: axios.js ~ line 11 ~ $axios.onResponse ~ response", response)
     if (Object.prototype.toString.call(response.data) === '[object Object]') {
       if ([6013, 6014].includes(response.data.status)) {
         // await $auth.logout();

+ 59 - 18
plugins/native.js

@@ -1,27 +1,68 @@
 export default function ({ $userAgent }, i) {
-  const before = () => {
-    if ($userAgent.isApp) {
-      return;
-    }
-    //  else if ($userAgent.isMiniProgram) {
-    //   throw new Error('小程序环境不支持');
-    // }
-    throw new Error('非App环境');
-  };
+  // const before = () => {
+  //   if ($userAgent.isApp) {
+  //     return;
+  //   }
+  //   //  else if ($userAgent.isMiniProgram) {
+  //   //   throw new Error('小程序环境不支持');
+  //   // }
+  //   throw new Error('非App环境');
+  // };
 
   i('native', {
-    share({ title, content, gotoUrl, shareImg }) {
-      before();
-      if ($userAgent.isIos) {
-        window.webkit.messageHandlers.share.postMessage({
+    share({ title, desc, link, imgUrl }) {
+      // before();
+      if ($userAgent.isSzx) {
+        if ($userAgent.isIos) {
+          window.webkit.messageHandlers.share.postMessage({
+            title,
+            content: desc,
+            gotoUrl: link,
+            shareImg: imgUrl,
+          });
+          return;
+        }
+
+        if ($userAgent.isAndroid) {
+          window.native.share(title, desc, link, imgUrl);
+          return;
+        }
+        return;
+      }
+
+      if ($userAgent.isSzxBrowser) {
+        this.setShareInfo({ title, desc, link, imgUrl });
+        window.webkit.messageHandlers.openShare.postMessage();
+      }
+    },
+    setShareInfo({ title, desc, link, imgUrl, path }) {
+      if ($userAgent.isSzxBrowser) {
+        // before();
+        window.webkit.messageHandlers.setShareInfo.postMessage({
           title,
-          content,
-          gotoUrl,
-          shareImg,
+          // content,
+          gotoUrl: link,
+          shareImg: imgUrl,
+        });
+        return;
+      }
+
+      if ($userAgent.isMiniProgram) {
+        this.$wx.miniProgram.postMessage({
+          data: {
+            action: 'updateAppMessageShareData',
+            params: {
+              title,
+              path,
+              imageUrl: imgUrl,
+            },
+          },
         });
-      } else {
-        window.native.share(title, content, gotoUrl, shareImg);
       }
+      // if ($userAgent.isIos) {
+      // } else {
+      //   window.native.setShareUrl(url);
+      // }
     },
   });
 }

+ 4 - 1
plugins/user-agent.js

@@ -6,7 +6,7 @@ export default function (c, i) {
     get isAndroid() {
       return /Android/i.test(navigator.userAgent);
     },
-    get isApp() {
+    get isSzx() {
       return /Szx/i.test(navigator.userAgent);
     },
     get isMobile() {
@@ -18,5 +18,8 @@ export default function (c, i) {
     get isMiniProgram() {
       return /miniProgram/i.test(navigator.userAgent);
     },
+    get isSzxBrowser() {
+      return /SzxBrowser/i.test(navigator.userAgent);
+    },
   });
 }

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 954 - 644
pnpm-lock.yaml


+ 13 - 5
static/screenAndroid/WXdraw.js

@@ -36,10 +36,10 @@ function changIsControl(value) {
 
 function throttle(fn, delay) {
   var flag = true;
-  errorTime += delay;
   return () => {
     if (!flag) return;
     flag = false;
+    errorTime += delay;
     timer = setTimeout(() => {
       fn();
       flag = true;
@@ -47,6 +47,10 @@ function throttle(fn, delay) {
   };
 }
 
+const throttleDoConnectDirectives = throttle(() => {
+  doConnectDirectives();
+}, 100);
+
 function doConnectDirectives() {
   videoWidth = Number(resolvingPower) ? Number(resolvingPower) : 720;
   videoHeight = videoWidth === 720 ? 1280 : 1920;
@@ -54,6 +58,7 @@ function doConnectDirectives() {
   wsss.binaryType = 'arraybuffer';
 
   wsss.onopen = function () {
+    errorTime = 0;
     // 进入发起询问
     var pings2 = {
       type: 'forwardMsg',
@@ -63,27 +68,30 @@ function doConnectDirectives() {
       },
     };
     wsss.send(JSON.stringify(pings2));
+
     wsss.send(
       JSON.stringify({
         type: 'getPhoneSize',
       }),
     );
   };
-  wsss.onerror = function (evt) {
-    // wsss.close();
+  wsss.onerror = function (e) {
+    // console.log('🚀 ~ file: WXdraw.js ~ line 82 ~ onerror ~ e', e);
+    wsss.close(1006);
     // throttle(doConnectDirectives, 100);
     // if (errorTime > 1000) {
     //   quit();
     // }
   };
   wsss.onclose = function (e) {
-    // console.log('🚀 ~ file: WXdraw.js ~ line 93 ~ onclose ~ e', e.code);
+    // console.log('🚀 ~ file: WXdraw.js ~ line 93 ~ onclose ~ e', e);
     // new WebSocket(e.)
     // doConnectDirectives();
     if (e.code === 1006) {
       // 异常关闭,重连
+      throttleDoConnectDirectives();
       // doConnectDirectives();
-      throttle(doConnectDirectives, 100);
+      // throttle(doConnectDirectives, 100);
       if (errorTime > 1000) {
         quit();
       }

+ 10 - 4
static/screenIos/WXdraw.js

@@ -34,10 +34,10 @@ function changIsControl(value) {
 
 function throttle(fn, delay) {
   var flag = true;
-  errorTime += delay;
   return () => {
     if (!flag) return;
     flag = false;
+    errorTime += delay;
     timer = setTimeout(() => {
       fn();
       flag = true;
@@ -45,6 +45,10 @@ function throttle(fn, delay) {
   };
 }
 
+const throttleDoConnectDirectives = throttle(() => {
+  doConnectDirectives();
+}, 100);
+
 function doConnectDirectives() {
   videoWidth = Number(resolvingPower) ? Number(resolvingPower) : 720;
   videoHeight = videoWidth === 720 ? 1280 : 1920;
@@ -53,6 +57,7 @@ function doConnectDirectives() {
 
   wsss.onopen = function () {
     // 获取虚拟场景状态
+    errorTime = 0;
     var pings = { type: 'getVsStatus' };
     wsss.send(JSON.stringify(pings));
     var bitRate = {
@@ -80,20 +85,21 @@ function doConnectDirectives() {
   };
   wsss.onerror = function (e) {
     // console.log('🚀 ~ file: WXdraw.js ~ line 82 ~ onerror ~ e', e);
-    // wsss.close(1006);
+    wsss.close(1006);
     // throttle(doConnectDirectives, 100);
     // if (errorTime > 1000) {
     //   quit();
     // }
   };
   wsss.onclose = function (e) {
-    // console.log('🚀 ~ file: WXdraw.js ~ line 93 ~ onclose ~ e', e.code);
+    // console.log('🚀 ~ file: WXdraw.js ~ line 93 ~ onclose ~ e', e);
     // new WebSocket(e.)
     // doConnectDirectives();
     if (e.code === 1006) {
       // 异常关闭,重连
+      throttleDoConnectDirectives();
       // doConnectDirectives();
-      throttle(doConnectDirectives, 100);
+      // throttle(doConnectDirectives, 100);
       if (errorTime > 1000) {
         quit();
       }