liuyg
2021-07-26 ee37509449b84794286081e1da820d1d9116578f
一键登入    指令表格加图片
2 files modified
55 ■■■■ changed files
src/permission.js 46 ●●●●● patch | view | raw | blame | history
src/views/commandQuery/taskDistribution.vue 9 ●●●●● patch | view | raw | blame | history
src/permission.js
@@ -63,17 +63,22 @@
      next()
    } else {
      // console.log(to, from);
      next();
      // next();
      if (to.path == '/wel') {
        // console.log('进入首页-----')
        var a = to.query.securitySupervisionSystem;
        if (typeof a == "string") {
          // console.log(to.query.securitySupervisionSystem, 'securitySupervisionSystem');
          // console.log("有main");
        if (a == undefined || typeof a != "string") {
          // console.log("无securitySupervisionSystem参数  跳回登入");
          next('/login');
          next('/login');
          return;
        }
        // console.log("有securitySupervisionSystem参数");
        try {
          // console.log("判断securitySupervisionSystem是否能被JSOn解码");
          var obj = JSON.parse(a);
          // console.log(obj, "obj");
          if (typeof obj == "object" && obj) {
            // console.log("自动登入");
          if (typeof obj == "object" && obj && obj.tokenMY == '987654321S') {
            // console.log("成功解码 并为对象");
            var data = {
              tenantId: obj.data.dip,
              username: obj.data.rese,
@@ -82,7 +87,6 @@
              scope: 'all',
              type: 'account'
            };
            // console.log(data, "自动ssss");
            request({
              url: '/api/blade-auth/oauth/token',
              method: 'post',
@@ -94,30 +98,40 @@
            }).then(res => {
              const data = res.data;
              if (data.error_description) {
                // console.log("登入失败");
                Message({
                  message: data.error_description,
                  type: 'error'
                })
                next('/login');
                next('/login');
                return;
              } else {
                // console.log("登入成功");
                store.commit('SET_TOKEN', data.access_token);
                store.commit('SET_REFRESH_TOKEN', data.refresh_token);
                store.commit('SET_TENANT_ID', data.tenant_id);
                store.commit('SET_USER_INFO', data);
                store.commit('DEL_ALL_TAG');
                store.commit('CLEAR_LOCK');
                next('/wel');
                return;
              }
            })
            return true;
            return;
          } else {
            // console.log("手动登入main不是JSON对象");
            return false;
            // console.log("成功解码 不是对象");
            next('/login');
            next('/login');
            return;
          }
        } else {
        } catch {
          // console.log('不是Json对象 跳回登入');
          next('/login');
          next('/login');
          return;
        }
        return;
        // return;
      }
      next('/login');
    }
src/views/commandQuery/taskDistribution.vue
@@ -134,6 +134,12 @@
            label: "指令内容",
            prop: "content",
          },
          {
            label: "图片",
            prop: "url",
            dataType: "string",
            type: "img",
          },
        ],
      },
      data: [
@@ -262,6 +268,9 @@
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        // for (var k in this.data) {
        //   this.data[k]["url"] = "https://avuejs.com/images/logo-bg.jpg";
        // }
        console.log(this.data, "getLisperetaskDistribution");
        this.loading = false;
        // this.selectionClear();