liyongli 1 år sedan
förälder
incheckning
5999d217aa
2 ändrade filer med 96 tillägg och 35 borttagningar
  1. 3 5
      src/view/finance/index.js
  2. 93 30
      src/view/finance/index.vue

+ 3 - 5
src/view/finance/index.js

@@ -36,7 +36,6 @@ const getUser = () => {
         createApp(App).mount('#app');
       };
     };
-
     window.webkit.messageHandlers.tideGetUser.postMessage([]);
   } else {
     if (!window.TideApp) return createApp(App).mount('#app');
@@ -53,11 +52,10 @@ const getUser = () => {
 getUser();
 // 分享
 window.weixin_Share_Init(
-  '我要上丝路春晚!火热投票中...',
-  '长武果娃·2023丝路嘉年华暨丝路春晚线上投票通道已开启,快来投票吧~',
+  document.title,
+  '',
   'https://cxzx.smcic.net/topic/tool/img/silulogo.jpg',
-  'https://cxzx.smcic.net/topic/activity/SilkRoadShanShiPinList.html?' +
-    Date.now()
+  'https://cxzx.smcic.net/topic/activity/finance.html?' + Date.now()
 );
 window.setUserSession = () => {
   console.log('登录');

+ 93 - 30
src/view/finance/index.vue

@@ -6,7 +6,12 @@
     <van-tabs color="#ff2c2c" background="#e0f2fa">
       <van-tab title="网络短视频">
         <van-row gutter="8">
-          <van-col span="12" v-for="item in list" :key="item.id">
+          <van-col
+            span="12"
+            style="position: relative"
+            v-for="item in list"
+            :key="item.id"
+          >
             <van-image
               :width="width"
               :height="height"
@@ -25,19 +30,24 @@
                 class="van-ellipsis"
                 >{{ item.name }}</van-col
               >
-              <van-col span="24">
-                <div class="btn" @click="() => toupiao(item)">
-                  <img src="../../assets/img/btn.png" />
-                </div>
-              </van-col>
             </van-row>
             <br />
+            <van-checkbox
+              class="act"
+              v-model="ids[item.phone].select"
+              checked-color="#ff2c2c"
+            />
           </van-col>
         </van-row>
       </van-tab>
       <van-tab title="优秀宣讲员">
         <van-row gutter="8">
-          <van-col span="12" v-for="item in list_self" :key="item.id">
+          <van-col
+            span="12"
+            style="position: relative"
+            v-for="item in list_self"
+            :key="item.id"
+          >
             <van-image
               :width="width"
               :height="height"
@@ -56,18 +66,26 @@
                 class="van-ellipsis"
                 >{{ item.name }}</van-col
               >
-              <van-col span="24">
-                <div class="btn" @click="() => toupiao(item)">
-                  <img src="../../assets/img/btn.png" />
-                </div>
-              </van-col>
             </van-row>
             <br />
+            <van-checkbox
+              class="act"
+              v-model="ids[item.phone].select"
+              checked-color="#ff2c2c"
+            />
           </van-col>
         </van-row>
       </van-tab>
     </van-tabs>
+    <div
+      class="btn"
+      :style="{ bottom: config.isShanShiPin ? '5px' : '75px' }"
+      @click="toupiao"
+    >
+      投票
+    </div>
     <Shanshipin v-if="!config.isShanShiPin" color="#e0f2fa" />
+    <!-- 投票框 -->
     <van-dialog v-model:show="showPaihang" confirm-button-text="关闭">
       <div style="height: 50vh">
         <van-tabs color="#ff2c2c">
@@ -112,6 +130,7 @@
         </van-tabs>
       </div>
     </van-dialog>
+    <!-- 登录框 -->
     <van-dialog
       theme="round-button"
       v-model:show="showLogin"
@@ -132,10 +151,16 @@
               @click="getCode"
               size="small"
               type="primary"
+              color="#ff2c2c"
             >
               发送验证码
             </van-button>
-            <van-count-down format="ss 秒" v-else :time="codePhoen" />
+            <van-count-down
+              format="ss 秒"
+              v-else
+              :time="codePhoen"
+              @finish="() => (codePhoen = 0)"
+            />
           </template>
         </van-field>
         <van-field required v-model="login.code" type="digit" label="验证码" />
@@ -156,12 +181,17 @@ import {
 } from '@/api/SilkRoadSpringGala.js';
 
 import Shanshipin from '@/components/shanshipin.vue';
+
+// import {
+//   isIpad,
+//   isIpod,
+//   isIphone,
+// } from '../../utils/isTerminal';
 /**
  * window.$originData.orginParames.title 页面标题
  * window.$originData.orginParames.parameters 固定参数值
  * window.$originData.urlParames url参数
  */
-
 const w = window.$originData.orginParames.availWidth || 0;
 const operateId = window.$originData.orginParames.operateId;
 const width = (w - 16) / 2;
@@ -172,6 +202,7 @@ const list = ref([]);
 const rankList = ref([]);
 const list_self = ref([]);
 const rankList_self = ref([]);
+const ids = ref({});
 const codePhoen = ref(0);
 const config = reactive({
   times: -1,
@@ -181,7 +212,7 @@ const t = config.isShanShiPin ? 5 : 1;
 const phone =
   window.$shanshipin.Phone && window.$shanshipin.Phone != 0
     ? window.$shanshipin.Phone
-    : localStorage.getItem('financePhone') || '';
+    : localStorage.getItem('financePhone') || '18439106376';
 const login = reactive({
   phone,
   code: '',
@@ -199,9 +230,21 @@ const getList = call => {
   ]).then(resList => {
     list.value = resList[0] || [];
     list_self.value = resList[1] || [];
+    const l = [...resList[0], ...resList[1]];
+    const ids_list = [];
+    for (let i = 0; i < l.length; i++) {
+      const v = l[i];
+      ids_list[v.phone] = {
+        select: false,
+        name: v.name,
+        phone: v.phone,
+      };
+    }
+    ids.value = ids_list;
     call && call();
   });
 };
+getList();
 
 const getRankList = Call => {
   Promise.all([
@@ -220,8 +263,6 @@ const getRankList = Call => {
   });
 };
 
-getList();
-
 const getCode = () => {
   // 获取验证码
   if (!/1[0-9]{10}/.test(login.phone)) {
@@ -235,16 +276,25 @@ const getCode = () => {
     codePhoen.value = 60000;
   });
 };
-const toupiao = function (item) {
+const toupiao = function () {
+  let names = [];
+  let phones = [];
+  for (let i = 0; i < ids.value.length; i++) {
+    const v = ids.value[i] || {};
+    if (!v.select) continue;
+    names.push(v.name);
+    phones.push(v.phone);
+  }
+  if (!phones.length) return showToast('请选择您中意的候选人');
+  if (phones.length > 10) return showToast('最多只能投10人');
   if (!login.phone || login.phone.length < 11) return (showLogin.value = true); //如果没有手机号提示登录
   showConfirmDialog({
-    message: '确定投票给' + item.name + '么?',
+    message: '确定投票给' + names.join(',') + '么?',
     beforeClose: type => {
-      console.log(type);
       if (type !== 'confirm') return true;
       return new Promise(resolve => {
         getVote({
-          target: item.phone,
+          target: phones.join(','),
           source: login.phone,
           client: config.isShanShiPin ? '闪视频' : '其他',
           operateId,
@@ -349,7 +399,14 @@ const formmate = num => {
 };
 
 const clickShowVideo = item => {
-  console.log(item);
+  console.log(item, window.TideApp);
+  //   if (!config.isShanShiPin) return (location.href = item.file);
+  //   if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
+  //     window.location.href = 'tidecontent://tide?url=' + item.file;
+  //   } else {
+  //     window.TideApp.content(item.file);
+  //   }
+  location.href = item.file;
 };
 </script>
 <style lang="scss">
@@ -362,6 +419,12 @@ const clickShowVideo = item => {
   .van-cell__value {
     color: #000;
   }
+  .act {
+    position: absolute;
+    top: 2px;
+    left: 2px;
+    z-index: 1;
+  }
   .text {
     padding: 10px 16px;
   }
@@ -383,17 +446,17 @@ const clickShowVideo = item => {
     overflow-y: auto;
   }
   .btn {
-    font-size: 0;
     text-align: center;
-    color: #666;
-    position: relative;
+    color: #fff;
+    position: fixed;
+    line-height: 2.5em;
+    height: 2.5em;
+    left: 5%;
+    width: 90%;
+    background-color: #ff2c2c;
+    z-index: 2;
     padding: 3px 0;
     border-radius: 5px;
-    img {
-      display: block;
-      margin: 0 auto;
-      width: 80px;
-    }
   }
   .videoEle {
     width: 100vw;