liyongli 2 жил өмнө
parent
commit
4c06f54676

+ 3 - 3
src/utils/tool.js

@@ -36,7 +36,7 @@ export function loadScript(url, callback) {
  * @param {function} next
  * @returns
  */
-export function getUser(next) {
+export function getUser(next, isNotToLogin) {
   window.$shanshipin = {};
   // 判断闪视频登录状态
   if (isWindows || isMac || isWechat) return next && next();
@@ -44,7 +44,7 @@ export function getUser(next) {
   if (isIpad || isIpod || isIphone) {
     if (!window.webkit || !window.webkit.messageHandlers) return next && next();
     window.setUser = user => {
-      if (user == "{}")
+      if (user == "{}" && !isNotToLogin)
         return window.webkit.messageHandlers.iosJumpLogin.postMessage([]);
       const u1 = JSON.parse(user || "{}");
       window.webkit.messageHandlers.getAppInfo.postMessage([]);
@@ -62,7 +62,7 @@ export function getUser(next) {
   } else {
     if (!window.TideApp) return next && next();
     const u1 = JSON.parse(window.TideApp.getUser() || "{}");
-    if (!u1.UserId) window.TideApp.login();
+    if (!u1.UserId && !isNotToLogin) window.TideApp.login();
     const u2 = JSON.parse(window.TideApp.getAppInfo() || "{}");
     window.$shanshipin = {
       ...u1,

+ 9 - 1
src/view/CalligraphyAndPaintingCompetition/index.js

@@ -1,6 +1,7 @@
 import App from './index.vue';
 import '@/assets/js/common';
 import { createApp } from 'vue';
+import { getUser } from '@/utils/tool.js';
 import { getPageParameters, environment } from '../../config/pageConfig';
 // 判断环境
 environment();
@@ -16,4 +17,11 @@ window.weixin_Share_Init(
     Date.now()
 );
 
-createApp(App).mount('#app');
+!window.$shanshipin || !window.$shanshipin.Phone
+  ? getUser(() => createApp(App).mount('#app'), true)
+  : createApp(App).mount('#app');
+
+window.setUserSession = () => {
+  console.log('登录');
+  getUser(() => createApp(App).mount('#app'), true);
+};

+ 10 - 2
src/view/CalligraphyAndPaintingCompetition/index.vue

@@ -5,10 +5,10 @@
         <div class="btn" @click="toDetail = true">活动详情</div>
       </div>
       <div class="bottom_item" style="flex: 3">
-        <div class="btn" @click="toShanshipin = true">我要投稿</div>
+        <div class="btn" @click="tougao">我要投稿</div>
       </div>
       <div class="bottom_item">
-        <div class="btn" @click="toShanshipin = true">我的作品</div>
+        <div class="btn">我的作品</div>
       </div>
     </div>
 
@@ -114,6 +114,14 @@ function toShanshipinFunc() {
         'https://ssp.sxtvs.com.cn'; /***打开app的协议,有安卓同事提供***/
     }, 2000);
 }
+
+function tougao(){
+    if(window.$shanshipin) {
+        if(location.replace) return location.replace("https://ssp-api.sxtvs.com.cn/tapi/form/index.html?ChannelID=20441");
+        else return location.href = "https://ssp-api.sxtvs.com.cn/tapi/form/index.html?ChannelID=20441";
+    }
+    toShanshipin.value = true;
+}
 </script>
 <style lang="scss">
 .CalligraphyAndPaintingCompetition {