Browse Source

BUG修复

fanghuisheng 11 months ago
parent
commit
18a5c96e88
5 changed files with 11 additions and 25 deletions
  1. 0 12
      src/main.js
  2. 2 2
      src/plugins/common.plugins.js
  3. 8 0
      src/plugins/index.js
  4. 1 2
      src/store/modules/setting.js
  5. 0 9
      src/store/modules/user.js

+ 0 - 12
src/main.js

@@ -3,14 +3,10 @@ import App from "./App";
 import store from "./store"; // store
 import plugins from "./plugins"; // plugins
 import "./permission"; // permission
-import config from "@/config"; // config
 
 // 引入json导出组件
 import JsonExcel from "vue-json-excel";
 
-// 引入微信js-sdk
-import jweixin from 'weixin-js-sdk'
-
 // 引入UI组件
 import uviewPlus from "@/uni_modules/uview-plus";
 import oaCalendar from "@/components/oa-calendar/uni-calendar";
@@ -45,18 +41,10 @@ export function createApp() {
 
   // 挂载全局json导出
   app.component("downloadExcel", JsonExcel);
-
-
   // 添加全局变量
   app.provide("$store", store);
   app.config.globalProperties.$store = store;
 
-  app.provide("$BASE_URL", config.baseUrl);
-  app.config.globalProperties.$BASE_URL = config.baseUrl;
-
-  app.provide("$websiteUrl", config.websiteUrl);
-  app.config.globalProperties.$websiteUrl = config.websiteUrl;
-
   app
     .use(uviewPlus)
     .use(store)

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

@@ -294,8 +294,8 @@ export default {
    * @判断是否为微信公众号
    */
   isWechatMp() {
-    var ua = navigator.userAgent.toLowerCase();
-    if (ua.match(/MicroMessenger/i) == 'micromessenger') {
+    var ua = navigator?.userAgent.toLowerCase();
+    if (ua?.match(/MicroMessenger/i) == 'micromessenger') {
       return true;
     } else {
       // 不在微信内置浏览器中

+ 8 - 0
src/plugins/index.js

@@ -6,10 +6,18 @@ import setting from "./setting.plugins";
 import constData from "./constData.plugins.js";
 import grid from "./grid.plugins.js";
 import nfc from "./nfc.plugins.js";
+
+import config from "@/config"; // config
 import { settingStores } from "@/store/modules/index";
 
 export default {
   install(app) {
+    // 公共请求路径
+    app.provide("$BASE_URL", config.baseUrl);
+    app.config.globalProperties.$BASE_URL = config.baseUrl;
+    // 公共website路径
+    app.provide("$websiteUrl", config.websiteUrl);
+    app.config.globalProperties.$websiteUrl = config.websiteUrl;
     // 页签操作
     app.provide("$tab", tab);
     app.config.globalProperties.$tab = tab;

+ 1 - 2
src/store/modules/setting.js

@@ -7,7 +7,6 @@ import { baseAppInfoApi } from "@/api/common/index";
 import { checkUpdates } from "@/api/system/setting";
 // 组件引用
 import { useStores } from "@/store/modules/index";
-import jweixin from 'weixin-js-sdk'
 import config from "@/config";
 import tab from "@/plugins/tab.plugins.js";
 import modal from "@/plugins/modal.plugins.js";
@@ -70,7 +69,7 @@ const settingStore = defineStore("storage-setting", {
             let systemInfo = uni.getSystemInfoSync();
             this.webViewHeight = systemInfo.safeArea.bottom  //高度+安全区域的高度
             this.StatusBar = systemInfo.statusBarHeight
-            this.tabBarHeight = common.isWechatMp() ? "0px" : (systemInfo.screenHeight - systemInfo.safeArea.bottom + "px")
+            this.tabBarHeight = common.isWechatMp() ? "0px" : systemInfo.screenHeight - systemInfo.safeArea.bottom + "px"
             this.barHightTop = this.StatusBar ? this.StatusBar + 44 + 'px' : '44px'
 
             //#ifdef MP

+ 0 - 9
src/store/modules/user.js

@@ -6,7 +6,6 @@ import { login, logout, getInfo, getMobileTenantConfig, getCodeImg } from "@/api
 import { getUserProfile, appAdd, appDel } from "@/api/system/user";
 import { phoneVerify } from "@/api/common/index.js";
 // 组件引用
-import jweixin from 'weixin-js-sdk'
 import config from "@/config";
 import modal from "@/plugins/modal.plugins.js";
 import common from "@/plugins/common.plugins.js";
@@ -295,10 +294,6 @@ const useStores = defineStore("useStores", {
             wxOpenId: common.getUrlList().openId
           })
         }
-
-        // if (uni.getSystemInfoSync().platform == "ios") {
-        //   jweixin.call('hideToolbar');
-        // }
       } else if (type == 2 && common.isWechatMp()) {
         if (window.location.href.indexOf("openId=") == -1) {
           window.location.href = config.baseUrl + "/service-iot/weChat/getPageAuthorization?openId=" + this.wxOpenId;
@@ -307,10 +302,6 @@ const useStores = defineStore("useStores", {
             wxOpenId: common.getUrlList().openId
           })
         }
-
-        // if (uni.getSystemInfoSync().platform == "ios") {
-        //   jweixin.call('hideToolbar');
-        // }
       }
     },