liyongli hace 1 año
padre
commit
f0bf7d1aec
Se han modificado 1 ficheros con 57 adiciones y 52 borrados
  1. 57 52
      src/view/finance/index.vue

+ 57 - 52
src/view/finance/index.vue

@@ -126,11 +126,10 @@
     <!-- 候选人详情框 -->
     <van-dialog
       v-model:show="hxrDialog"
-      confirm-button-text="分享"
-      cancel-button-text="投票"
-      showCancelButton
+      confirm-button-text="投票"
+      :show-cancel-button="true"
+      @close="close"
       @confirm="shear_page"
-      @cancel="tp_btn"
       style="padding: 5px"
     >
       <van-row>
@@ -165,20 +164,10 @@
         />
       </div>
     </van-dialog>
-
-    <van-share-sheet
-      v-model:show="showShare"
-      title="立即分享给好友"
-      :options="[
-        { name: '微信', icon: 'wechat' },
-        { name: '微信朋友圈', icon: 'wechat-moments' },
-      ]"
-      @select="onSelect"
-    />
   </div>
 </template>
 <script setup>
-import { ref, reactive, watch } from 'vue';
+import { ref, reactive, watch, onMounted } from 'vue';
 import { showDialog, showConfirmDialog, showToast } from 'vant';
 import {
   getEnrollList,
@@ -199,7 +188,6 @@ const height = width * 0.57;
 const hxrDialog = ref(false);
 const showPaihang = ref(false);
 const showLogin = ref(false);
-const showShare = ref(false);
 const selectItem = ref({});
 
 const rankList = ref({});
@@ -214,6 +202,7 @@ const config = reactive({
 });
 const search = ref('');
 const t = config.isShanShiPin ? 5 : 1;
+let time_old= undefined;
 const phone =
   window.$shanshipin.Phone && window.$shanshipin.Phone != 0
     ? window.$shanshipin.Phone
@@ -229,6 +218,8 @@ const getList = call => {
     const array = r || [];
     const obj = [];
     const ids_list = [];
+    let item = undefined;
+
     for (let i = 0; i < array.length; i++) {
       const v = array[i];
       v.noShow = false;
@@ -241,13 +232,27 @@ const getList = call => {
         name: v.name,
         phone: v.phone,
       };
+
+      if (
+        window.$originData.urlParames.id &&
+        v.phone === window.$originData.urlParames.id
+      ) {
+        // 默认打开卡片
+        item = v;
+      }
     }
+    time_old = setTimeout(() => {
+        clickShowVideo(item);
+        clearTimeout(time_old);
+    }, 200);
     ids.value = ids_list;
     orilist.value = obj;
     call && call();
   });
 };
-getList();
+onMounted(() => {
+    getList();
+});
 
 const getIndex = key => {
   const sort_list = {
@@ -277,40 +282,6 @@ const getRankList = Call => {
 };
 
 const shear_page = () => {
-  // 分享
-  console.log(window.wx);
-  if (window.wx) showShare.value = true;
-  else showToast('请稍后');
-};
-let time_share = undefined;
-const onSelect = val => {
-  if (time_share) clearTimeout(time_share);
-  setTimeout(() => {
-    clearTimeout(time_share);
-    // 朋友圈
-    if(val.name === '朋友圈') window.WeixinJSBridge.invoke('shareTimeline', {
-      img_url: 'https://cxzx.smcic.net/topic/tool/img/silulogo.jpg',
-      //"img_width":"640",
-      //"img_height":"640",
-      link:
-        'https://cxzx.smcic.net/topic/activity/finance.html?id=' +
-        selectItem.value.id,
-      desc: selectItem.value.university,
-      title: selectItem.value.name,
-    });
-    // 微信
-    if(val.name === '微信') window.WeixinJSBridge.invoke('sendAppMessage', {
-      img_url: 'https://cxzx.smcic.net/topic/tool/img/silulogo.jpg',
-      link:
-        'https://cxzx.smcic.net/topic/activity/finance.html?id=' +
-        selectItem.value.id,
-      desc: selectItem.value.university,
-      title: selectItem.value.name,
-    });
-  }, 200);
-};
-
-const tp_btn = () => {
   // 投票
   if (!login.phone || login.phone.length < 11) return (showLogin.value = true); //如果没有手机号提示登录
   showConfirmDialog({
@@ -483,9 +454,43 @@ const formmate = num => {
 
 const clickShowVideo = item => {
   //   location.href = item.file;
-  console.log(item);
   selectItem.value = item || {};
   hxrDialog.value = true;
+
+  let link =
+    location.href.split('?')[0] +
+    '?id=' +
+    selectItem.value.id +
+    'v=' +
+    Date.now();
+    console.log(window.wx)
+  if (window.wx.updateAppMessageShareData)
+    window.wx.updateAppMessageShareData({
+      title: selectItem.value.name, // 分享标题
+      desc: selectItem.value.university, // 分享描述
+      link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+      imgUrl: 'https://cxzx.smcic.net/topic/tool/img/silulogo.jpg', // 分享图标
+    });
+  if (window.wx.updateTimelineShareData)
+    window.wx.updateTimelineShareData({
+      title: selectItem.value.name, // 分享标题
+      link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+      imgUrl: 'https://cxzx.smcic.net/topic/tool/img/silulogo.jpg', // 分享图标
+    });
+};
+const close = () => {
+  let link = location.href.split('?')[0] + '?v=' + Date.now();
+  window.wx.updateAppMessageShareData({
+    title: '金融好网民投票', // 分享标题
+    desc: '', // 分享描述
+    link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+    imgUrl: 'https://cxzx.smcic.net/topic/tool/img/silulogo.jpg', // 分享图标
+  });
+  window.wx.updateTimelineShareData({
+    title: '金融好网民投票', // 分享标题
+    link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+    imgUrl: 'https://cxzx.smcic.net/topic/tool/img/silulogo.jpg', // 分享图标
+  });
 };
 </script>
 <style lang="scss">