liuyg
2021-07-17 631691a4ca47df3be65af0c87f63c84f7be53466
测试代码,依赖出问题
5 files modified
1 files deleted
352 ■■■■ changed files
src/components/iframe/main.vue 19 ●●●● patch | view | raw | blame | history
src/page/login/userlogin copy.vue 260 ●●●●● patch | view | raw | blame | history
src/permission.js 69 ●●●●● patch | view | raw | blame | history
src/router/axios.js patch | view | raw | blame | history
src/store/modules/user.js 1 ●●●● patch | view | raw | blame | history
vue.config.js 3 ●●●● patch | view | raw | blame | history
src/components/iframe/main.vue
@@ -1,8 +1,6 @@
<template>
  <basic-container>
    <iframe :src="src"
            class="iframe"
            ref="iframe"></iframe>
    <iframe :src="src" class="iframe" ref="iframe"></iframe>
  </basic-container>
</template>
@@ -14,7 +12,7 @@
    name: "AvueIframe",
    data() {
      return {
        urlPath: this.getUrlPath() //iframe src 路径
      urlPath: this.getUrlPath(), //iframe src 路径
      };
    },
    created() {
@@ -32,7 +30,7 @@
      routerPath: function () {
        // 监听routerPath变化,改变src路径
        this.urlPath = this.getUrlPath();
      }
    },
    },
    computed: {
      ...mapGetters(["screen"]),
@@ -40,7 +38,7 @@
        return this.$route.query.src
          ? this.$route.query.src.replace("$", "#")
          : this.urlPath;
      }
    },
    },
    methods: {
      // 显示等待框
@@ -61,7 +59,10 @@
      load() {
        this.show();
        var flag = true; //URL是否包含问号
        if (this.$route.query.src !== undefined && this.$route.query.src.indexOf("?") === -1) {
      if (
        this.$route.query.src !== undefined &&
        this.$route.query.src.indexOf("?") === -1
      ) {
          flag = false;
        }
        var list = [];
@@ -113,8 +114,8 @@
        let url = window.location.href;
        url = url.replace("/myiframe", "");
        return url;
      }
    }
    },
  },
  };
</script>
src/page/login/userlogin copy.vue
File was deleted
src/permission.js
@@ -4,10 +4,13 @@
 */
import router from './router/router'
import store from './store'
import md5 from 'js-md5'
import request from '@/router/axios';
import {validatenull} from '@/util/validate'
import {getToken} from '@/util/auth'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import cons from 'consolidate';
NProgress.configure({showSpinner: false});
const lockPage = store.getters.website.lockPage; //锁屏页
router.beforeEach((to, from, next) => {
@@ -57,7 +60,71 @@
    if (meta.isAuth === false) {
      next()
    } else {
      next('/login')
      console.log(to, from);
      next();
      if (to.path == '/wel') {
        var a = to.query.main;
        if (typeof a == "string") {
          console.log(to.query.main, 'main');
          console.log("有main");
          var obj = JSON.parse(a);
          console.log(obj, "obj");
          if (typeof obj == "object" && obj) {
            console.log("自动登入");
            var data = {
              tenantId: obj.data.dip,
              username: obj.data.rese,
              password: md5(obj.data.sap),
              grant_type: 'password',
              scope: 'all',
              type: 'account'
            };
            console.log(data, "自动ssss");
            // request({
            //   url: '/api/blade-auth/oauth/token',
            //   method: 'post',
            //   headers: {
            //     'Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0',
            //     "Tenant-Id": "000000"
            //   },
            //   params: data
            // }).then(res => {
            //   console.log(res, 'res')
            // })
            // this.loginForm.username = obj.data.rese;
            // this.loginForm.password = obj.data.admin;
            // this.loginForm.tenantId = obj.data.dip;
            // console.log(this.loginForm1·);
            // const loading = this.$loading({
            //   lock: true,
            //   text: "登录中,请稍后。。。",
            //   spinner: "el-icon-loading",
            // });
            // this.$store
            //   .dispatch("LoginByUsername", data)
            //   .then(() => {
            //     this.$router.push({ path: "/wel" });
            //     loading.close();
            //   })
            //   .catch(() => {
            //     loading.close();
            //     this.refreshCode();
            //   });
            return true;
          } else {
            console.log("手动登入main不是JSON对象");
            return false;
          }
        } else {
          next('/login');
        }
        return;
      }
      next('/login');
    }
  }
})
src/router/axios.js
src/store/modules/user.js
@@ -50,6 +50,7 @@
      return new Promise((resolve, reject) => {
        loginByUsername(userInfo.tenantId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key, userInfo.code).then(res => {
          const data = res.data;
          console.log(data, '获取到token');
          if (data.error_description) {
            Message({
              message: data.error_description,
vue.config.js
@@ -28,8 +28,9 @@
      '/api': {
        //本地服务接口地址
        // target: 'http://192.168.0.104',
        target: 'http://192.168.109:80',
        //远程演示服务地址,可用于直接启动项目
        target: 'http://2h3f861221.wicp.vip:58646',
        // target: 'http://2h3f861221.wicp.vip:58646',
        ws: true,
        pathRewrite: {
          '^/api': '/'