瀏覽代碼

优化工作报告功能模块/合并微信公众号代码

fanghuisheng 8 月之前
父節點
當前提交
5b54e9e74c

+ 1 - 1
src/pages/business/common/projectMange/record/index.vue

@@ -1,6 +1,6 @@
 <template>
   <u-sticky class="shadow-default" bgColor="#fff" style="top: 0">
-    <u-navbar :titleStyle="{ color: '#000' }" :autoBack="true" title="报告记录" :placeholder="true" :safeAreaInsetTop="true" bgColor="#fff">
+    <u-navbar :titleStyle="{ color: '#000' }" :autoBack="true" title="工作报告" :placeholder="true" :safeAreaInsetTop="true" bgColor="#fff">
       <template #left>
         <view class="u-navbar__content__left__item">
           <u-icon name="arrow-left" size="20" color="#000"></u-icon>

+ 0 - 1
src/pages/business/common/projectMange/write/insert.vue

@@ -41,7 +41,6 @@
 import { onLoad, onShow, onReady, onHide, onLaunch, onUnload, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
 import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
 /*----------------------------------接口引入-----------------------------------*/
-import { projectApi } from "@/api/business/project.js";
 /*----------------------------------组件引入-----------------------------------*/
 import template1 from "./components/template1.vue";
 /*----------------------------------store引入-----------------------------------*/

+ 3 - 3
src/pages/login.vue

@@ -94,7 +94,7 @@ import { reactive, getCurrentInstance, toRefs, inject, nextTick } from "vue";
 import { useStores, commonStores } from "@/store/modules/index";
 /*----------------------------------公共方法引入-----------------------------------*/
 import config from "@/config";
-import { storage, storageSystem } from "@/utils/storage";
+import { storageSystem } from "@/utils/storage";
 /*----------------------------------公共变量-----------------------------------*/
 const { proxy } = getCurrentInstance();
 const useStore = useStores();
@@ -226,7 +226,7 @@ function submitRes() {
       tenantId: useStore.tenantId,
       cids: proxy.$settingStore.pushClientId || undefined,
       type: proxy.$common.isWechatMp() ? "wx" : "app",
-      openId: useStore.wxOpenId || undefined,
+      openId: proxy.$common.isWechatMp() ? localStorage.getItem("wxOpenId") : undefined,
     });
   } else {
     if (!username.value) {
@@ -244,7 +244,7 @@ function submitRes() {
       tenantId: useStore.tenantId,
       cids: proxy.$settingStore.pushClientId || undefined,
       type: proxy.$common.isWechatMp() ? "wx" : "app",
-      openId: useStore.wxOpenId || undefined,
+      openId: proxy.$common.isWechatMp() ? localStorage.getItem("wxOpenId") : undefined,
     });
   }
 }

+ 2 - 2
src/plugins/constData.plugins.js

@@ -100,14 +100,14 @@ let projectTabbar = [
 		pagePath: "/pages/business/common/projectMange/record/index",
 		iconPath: "/static/images/tabBar/tab-home.png",
 		selectedIconPath: "/static/images/tabBar/tab-home-blue.png",
-		text: "看日志",
+		text: "报告记录",
 		dot: false,
 	},
 	{
 		pagePath: "/pages/business/common/projectMange/write/index",
 		iconPath: "/static/images/tabBar/tab-info.png",
 		selectedIconPath: "/static/images/tabBar/tab-info-blue.png",
-		text: "写日志",
+		text: "报告填写",
 		dot: false,
 	},
 	// {

+ 23 - 17
src/store/modules/user.js

@@ -281,32 +281,38 @@ const useStores = defineStore("useStores", {
      * @param { 类型 } type 
      */
     GetWxOpenId(type, options) {
+      let url = "https://manager.usky.cn/mobile/#/"
       if (type == 1 && common.isWechatMp()) {
-        if (storage.get("wxOpenId") && getToken()) {
-          // alert("已登录");
-          tab.reLaunch("/pages/index?flag=true");
+        if (localStorage.getItem("wxOpenId") && getToken()) {
+          getPageAuthorization({ openId: localStorage.getItem("wxOpenId") }).then((res) => {
+            if (res.data?.openid) {
+              window.location.href = `${url}pages/index`;
+            } else {
+              this.LogOut().then(() => {
+                localStorage.removeItem("wxOpenId")
+                window.location.href = config.baseUrl + "/service-iot/weChat/getFirst1";
+              })
+            }
+          })
         } else {
-          // alert("未授权")
           if (window.location.href.indexOf("openId=") == -1) {
-            // alert("未授权url无openid")
             window.location.href = config.baseUrl + "/service-iot/weChat/getFirst1";
           } else {
-            // alert("未授权url有openid")
-            storage.set("wxOpenId", common.getUrlList().openId)
+            localStorage.setItem("wxOpenId", common.getUrlList().openId)
           }
         }
       } else if (type == 2 && common.isWechatMp()) {
-        if (options?.flag === undefined || options?.flag == false) {
-          // alert("首页无flag",)
-          if (storage.get("wxOpenId") && getToken()) {
-            // alert("首页有openid、token")
-            window.location.href = config.baseUrl + "/service-iot/weChat/getPageAuthorization?openId=" + storage.get("wxOpenId");
-          } else {
-            // alert("首页无openid,回登录页")
-            window.location.href = config.baseUrl + "/service-iot/weChat/getFirst1";
-          }
+        if (localStorage.getItem("wxOpenId") && getToken()) {
+          getPageAuthorization({ openId: localStorage.getItem("wxOpenId") }).then((res) => {
+            if (!res.data?.openid) {
+              this.LogOut().then(() => {
+                localStorage.removeItem("wxOpenId")
+                window.location.href = config.baseUrl + "/service-iot/weChat/getFirst1";
+              })
+            }
+          })
         } else {
-          // alert("首页有flag,结束")
+          window.location.href = config.baseUrl + "/service-iot/weChat/getFirst1";
         }
       }
     },

+ 6 - 2
src/utils/request.js

@@ -103,7 +103,9 @@ const request = (config) => {
         } else if (errMsg.includes("Request failed with status code")) {
           errMsg = "系统接口" + errMsg.substr(errMsg.length - 3) + "异常";
         }
-        modal.msg(errMsg);
+        if (errMsg != "request:fail") {
+          modal.msg(errMsg);
+        }
         reject(error);
       });
   });
@@ -144,7 +146,9 @@ const uploads = (config) => {
         } else if (errMsg.includes("Request failed with status code")) {
           errMsg = "系统接口" + errMsg.substr(errMsg.length - 3) + "异常";
         }
-        modal.msg(errMsg);
+        if (errMsg != "request:fail") {
+          modal.msg(errMsg);
+        }
         reject(error);
       },
     });