liyongli 2 năm trước cách đây
mục cha
commit
0af4d801f3

+ 11 - 0
src/api/SilkRoadSpringGala.js

@@ -146,3 +146,14 @@ export function getTotalNum(data) {
       data,
     });
 }
+
+// 获得黄帝陵祭祖大典书法大赛报名人数
+export function getToupiaoUrl(data) {
+    return ajax({
+      url: "https://cxzx.smcic.net/topic/tool/data/huangdilingToupiao.json",
+      method: "GET",
+      urlType: "default",
+      header:{},
+      data,
+    });
+}

+ 58 - 37
src/view/CalligraphyAndPaintingCompetition/index.vue

@@ -15,7 +15,7 @@
         <div class="btn" @click="tougao">我要投稿</div>
       </div>
       <div class="bottom_item">
-        <div class="btn" @click="tougao">我的作品</div>
+        <div class="btn" @click="toupiao">我的作品</div>
       </div>
     </div>
 
@@ -96,7 +96,7 @@ import {
   isWechat,
 } from '../../utils/isTerminal';
 import countTo from '@/components/counto/vue-countTo.vue';
-import { getTotalNum } from '@/api/SilkRoadSpringGala.js';
+import { getTotalNum, getToupiaoUrl } from '@/api/SilkRoadSpringGala.js';
 /**
  * window.$originData.orginParames.title 页面标题
  * window.$originData.orginParames.parameters 固定参数值
@@ -107,6 +107,7 @@ const toShanshipin = ref(false);
 const toDetail = ref(false);
 const showWixin = ref(false);
 const total = ref(0);
+const toJianjie = ref(false);
 tot();
 window.setInterval(() => {
   tot();
@@ -132,48 +133,68 @@ function toShanshipinFunc() {
 }
 
 function tougao() {
-  console.log(window.$shanshipin);
+  const newDate = Date.now();
+  const inTime = newDate >= 1682870400000 && newDate < 1683734400000;
+  if (inTime) {
+    // 2023-5-1 00:00:00 到 2023-5-10 24:00:00 跳转到投票界面
+    getToupiaoUrl().then(r => {
+      const res = r || { toupiaourl: '' };
+      openShanshipinDetail(res.toupiaourl);
+    });
+    return;
+  } else {
+    // 否则打开简介
+    toJianjie.value = true;
+  }
+}
+
+function toupiao() {
   if (!window.$shanshipin || !window.$shanshipin.invitedIp)
     return (toShanshipin.value = true);
-    const url =
-        'https://ssp-api.sxtvs.com.cn/tapi/form/index.html?ChannelID=20441',
-      contentId = '',
-      shareTitle = '',
-      shareSummary = '',
-      shareIcon = '',
-      shareUrl = '';
-    if (isIphone || isIpad || isIpod) {
-      try {
-        window.webkit.messageHandlers.TideAppStartNewsDetail.postMessage([
-          url,
-          contentId,
-          shareTitle,
-          shareSummary,
-          shareIcon,
-          shareUrl,
-        ]);
-      } catch (e) {
-        console.log(e);
-      }
-    } else {
-      try {
-        window.TideApp.startNewsDetail(
-          url,
-          contentId,
-          shareTitle,
-          shareSummary,
-          shareIcon,
-          shareUrl
-        );
-      } catch (e) {
-        console.log(e);
-      }
+  openShanshipinDetail(
+    'https://ssp-api.sxtvs.com.cn/tapi/form/index.html?ChannelID=20441'
+  );
+}
+
+function openShanshipinDetail(url = '') {
+  const contentId = '',
+    shareTitle = '',
+    shareSummary = '',
+    shareIcon = '',
+    shareUrl = '';
+  if (isIphone || isIpad || isIpod) {
+    try {
+      window.webkit.messageHandlers.TideAppStartNewsDetail.postMessage([
+        url,
+        contentId,
+        shareTitle,
+        shareSummary,
+        shareIcon,
+        shareUrl,
+      ]);
+    } catch (e) {
+      console.log(e);
+    }
+  } else {
+    try {
+      window.TideApp.startNewsDetail(
+        url,
+        contentId,
+        shareTitle,
+        shareSummary,
+        shareIcon,
+        shareUrl
+      );
+    } catch (e) {
+      console.log(e);
     }
+  }
 }
 
 function tot() {
   getTotalNum().then(r => {
-    total.value = r || 0;
+    const res = r || {real: 0, unreal: 0}
+    total.value = Number(res.real || 0) + Number(res.unreal || 0);
   });
 }
 </script>

+ 7 - 7
vue.config.js

@@ -1,14 +1,14 @@
-const { VantResolver } = require("unplugin-vue-components/resolvers");
-const ComponentsPlugin = require("unplugin-vue-components/webpack");
+const { VantResolver } = require('unplugin-vue-components/resolvers');
+const ComponentsPlugin = require('unplugin-vue-components/webpack');
 
-const page = require("./page.config");
+const page = require('./page.config');
 module.exports = {
   pages: page.output,
   productionSourceMap: false,
-  publicPath: "./",
+  publicPath: './',
   pluginOptions: {
-    "style-resources-loader": {
-      preProcessor: "sass",
+    'style-resources-loader': {
+      preProcessor: 'sass',
       patterns: [],
     },
   },
@@ -17,6 +17,6 @@ module.exports = {
       ComponentsPlugin({
         resolvers: [VantResolver()],
       }),
-    ]
+    ],
   },
 };