Browse Source

fix:
- 去掉mgop请求
- blank页面增加未授权提示

梦辉 4 months ago
parent
commit
3e50e2131a
6 changed files with 47 additions and 863 deletions
  1. 24 659
      package-lock.json
  2. 0 1
      package.json
  3. 8 8
      public/index.html
  4. 0 9
      src/main.js
  5. 15 3
      src/pages/blank/blank.vue
  6. 0 183
      src/utils/fetch/index.js

File diff suppressed because it is too large
+ 24 - 659
package-lock.json


+ 0 - 1
package.json

@@ -48,7 +48,6 @@
     "test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i"
   },
   "dependencies": {
-    "@aligov/jssdk-mgop": "^3.1.9",
     "@dcloudio/uni-app-plus": "^2.0.1-34920220630001",
     "@dcloudio/uni-h5": "^2.0.1-34920220630001",
     "@dcloudio/uni-helper-json": "^1.0.13",

+ 8 - 8
public/index.html

@@ -19,14 +19,14 @@
       rel="stylesheet"
       href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css"
     />
-    <script
-      type="text/javascript"
-      src="//assets.zjzwfw.gov.cn/assets/ZWJSBridge/1.1.0/zwjsbridge.js"
-    ></script>
-    <script
-      type="text/javascript"
-      src="//assets.zjzwfw.gov.cn/assets/zwlog/1.0.0/zwlog.js"
-    ></script>
+    <!--<script-->
+    <!--  type="text/javascript"-->
+    <!--  src="//assets.zjzwfw.gov.cn/assets/ZWJSBridge/1.1.0/zwjsbridge.js"-->
+    <!--&gt;</script>-->
+    <!--<script-->
+    <!--  type="text/javascript"-->
+    <!--  src="//assets.zjzwfw.gov.cn/assets/zwlog/1.0.0/zwlog.js"-->
+    <!--&gt;</script>-->
   </head>
 
   <body>

+ 0 - 9
src/main.js

@@ -22,15 +22,6 @@ Vue.use(Vant);
 // #endif
 Vue.mixin(Mixin);
 Vue.prototype.$uiStyle = "normal";
-ZWJSBridge.onReady(() => {
-  console.log('初始化完成后,执行bridge方法')
-  ZWJSBridge.getUiStyle({}).then((result) => {
-    // uistyle normal和elder两种模式
-    Vue.prototype.$uiStyle = result.uiStyle;
-  }).catch(res => {
-    console.log('获取uistyle 失败')
- });
-})
 
 
 Vue.config.productionTip = false;

+ 15 - 3
src/pages/blank/blank.vue

@@ -1,5 +1,7 @@
 <template>
-  <view class="blank-page"></view>
+  <view class="blank-page">
+    <van-empty v-if="noAuth" image="error" :description="noAuthDesc" />
+  </view>
 </template>
 
 <script>
@@ -18,7 +20,14 @@ export default {
   components: {},
   props: {},
   data() {
-    return {};
+    return {
+      noAuth:true,
+      noAuthDesc:'请使用浙政钉扫码登录'
+    };
+  },
+  onUnload() {
+    this.noAuth = false
+    this.noAuthDesc = ""
   },
   onShow() {
     this.handleLogin()
@@ -270,9 +279,12 @@ export default {
             });
           }else {
             this.$toast('获取用户信息失败')
+            this.noAuth = true
+            this.noAuthDesc = exemptionRes.msg
           }
         }catch (e) {
-          this.$toast('获取用户信息失败')
+          this.noAuth = true
+          this.noAuthDesc = "当前用户暂无权限"
           console.log('error',e)
         }
       }

+ 0 - 183
src/utils/fetch/index.js

@@ -1,191 +1,8 @@
-import {mgop} from "@aligov/jssdk-mgop";
-import zlbConfig from "@/common/js/zlbConfig";
 import {httpApi} from "@/common/js/baseUrl";
 import {handleHttpError, handleNormalResponse} from "@/utils/fetch/responseHandler";
 import handleReqLoading from "@/utils/fetch/handleReqLoading";
 import {handleRequest} from "@/utils/fetch/requestHandler";
 
-function download(url, type = "get", data = {}) {
-    return new Promise((resolve, reject) => {
-        uni.request({
-            url: url,
-            method: type,
-            responseType: "arraybuffer",
-            header: {
-                "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
-                src: "wechat",
-            },
-            data: data,
-            timeout: 10000,
-            success: function (res) {
-                console.log("返回结果:", res);
-                if (res.statusCode === 200) {
-                    resolve(res);
-                } else {
-                    reject(); // 接口不正常 reject
-                    uni.showToast({title: "服务异常", icon: "none"});
-                }
-            },
-            fail: function (err) {
-                uni.showToast({title: "服务异常", icon: "none"});
-                reject(err);
-            },
-        });
-    });
-}
-
-// 通用版upload
-function commonUpload(url, data, config = {}) {
-    return new Promise((resolve, reject) => {
-        uni.uploadFile({
-            url: httpApi + url,
-            ...data,
-            ...config,
-            header: {
-                "content-type": "multipart/form-data",
-                Token: '1'
-            },
-            // 设置请求的 header
-            success: function (res) {
-            },
-            fail: function (res) {
-                uni.showToast({
-                    title: "服务异常",
-                    icon: "none",
-                    duration: 2000,
-                });
-                reject();
-            },
-        });
-    });
-}
-
-function index(url, type = "get", data = {}, dataType) {
-    return new Promise((resolve, reject) => {
-        (url && url.startsWith("mgop.alibaba")) ? handleMgop(url, type, data, dataType, resolve, reject) : handleFetch(url, type, data, dataType, resolve, reject);
-    });
-}
-
-function handleMgop(url, type, data, dataType, resolve, reject) {
-    let extraHeader = {};
-    /*  当请求头 isTestUrl 为 "1" 时,使用联调环境 */
-    extraHeader.isTestUrl = "1";
-    mgop({
-        api: url, // 必填
-        // host: 'https://mapi.zjzwfw.gov.cn/',
-        dataType: "JSON",
-        type: type,
-        data: data,
-        appKey: zlbConfig.appKey, // 必填
-        appId:zlbConfig.appId,
-        header: {
-            "Content-Type":
-                dataType === "form"
-                    ? "application/x-www-form-urlencoded"
-                    : "application/json",
-            src: "wechat", // 小程序免登陆
-            ...extraHeader,
-        },
-        onSuccess: (res) => {
-            const code = res.ret[0].split("::")[0];
-            if (code === "1000") {
-                if (
-                    res.data.code === 0 ||
-                    res.data.code === "0" ||
-                    res.data.status === 0 ||
-                    res.data.status === "1" //高德地图
-                ) {
-                    resolve(res.data);
-                } else {
-                    //特殊处理下,获取门牌数据的接口code是1 ,是业务错误
-                    if (res.api === "mgop.alibaba.digitalDoorplate.getHomePageOneDoorplateFullInfo") {
-                        resolve(res.data);
-                    } else {
-                        reject(res);
-                        if (res.data.message || res.data.msg) {
-                            uni.showToast({
-                                title: res.data.message || res.data.msg,
-                                icon: "none",
-                                duration: 2000,
-                            });
-                        }
-                    }
-
-                }
-            } else {
-                reject(res); // 接口不正常 reject
-                uni.showToast({
-                    title: "服务异常",
-                    icon: "none",
-                    duration: 2000,
-                });
-            }
-        },
-        onFail: (err) => {
-            reject(err);
-        },
-    });
-}
-
-
-function handleFetch(url, type, data, dataType, resolve, reject) {
-    let header = {
-        "Content-Type":
-            dataType === "form"
-                ? "application/x-www-form-urlencoded"
-                : "application/json",
-        Token: '1'
-    };
-    uni.request({
-        url: httpApi + url,
-        method: type,
-        header,
-        data: data,
-        timeout: 60000,
-        success: function (res) {
-            if (res.statusCode === 200) {
-                if (
-                    res.data.code === 0 ||
-                    res.data.code === "0" ||
-                    res.data.status === 0 ||
-                    res.data.status === "1" //高德地图
-                ) {
-                    resolve(res.data);
-                } else {
-                    reject();
-                    if (res.data.message || res.data.msg) {
-                        uni.showToast({
-                            title: res.data.message || res.data.msg,
-                            icon: "none",
-                            duration: 2000,
-                        });
-                    }
-                }
-            } else {
-                reject(); // 接口不正常 reject
-
-                uni.showToast({
-                    title: "服务异常",
-                    icon: "none",
-                    duration: 2000,
-                });
-            }
-        },
-        fail: function (err) {
-            uni.showToast({
-                title: "服务异常",
-                icon: "none",
-                duration: 2000,
-            });
-            reject(err);
-        },
-        complete: function () {
-        },
-    });
-}
-
-//export {index, download, commonUpload};
-
 /**
  * 封装请求
  * @param url 请求地址

Some files were not shown because too many files changed in this diff