Bläddra i källkod

:bookmark: Releasing / Version tags. 2.6.0 鄙视某些人的盗窃、分享,持续开源

lishangbu 6 år sedan
förälder
incheckning
7453e3a648

+ 1 - 2
package.json

@@ -1,6 +1,6 @@
 {
   "name": "pigx-ui",
-  "version": "2.5.0",
+  "version": "2.6.0",
   "private": true,
   "scripts": {
     "pre": "yarn --registry https://registry.npm.taobao.org || npm install --registry https://registry.npm.taobao.org ",
@@ -9,7 +9,6 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
-    "@smallwei/avue": "^1.5.0",
     "axios": "^0.18.0",
     "babel-polyfill": "^6.26.0",
     "classlist-polyfill": "^1.2.0",

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
public/cdn/avue/index.css


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
public/cdn/avue/index.js


+ 8 - 0
public/cdn/iconfont/1.0.0/index.css

@@ -7,6 +7,14 @@
 	-webkit-font-smoothing: antialiased;
 	-moz-osx-font-smoothing: grayscale;
 }
+.avue-crud-icon-select__item i {
+  font-family: "iconfont" !important;
+  /* 以下内容参照第三方图标库本身的规则 */
+  font-size: 24px !important;
+  font-style: normal;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
 .el-menu-item [class^=icon-] {
     margin-right: 5px;
     width: 24px;

+ 4 - 2
public/index.html

@@ -13,13 +13,14 @@
     <link rel="stylesheet" href="<%= BASE_URL %>cdn/animate/3.5.2/animate.css">
     <link rel="stylesheet" href="<%= BASE_URL %>cdn/iconfont/1.0.0/index.css">
     <link rel="stylesheet" href="<%= BASE_URL %>cdn/avue/avue.css">
+    <link rel="stylesheet" href="<%= BASE_URL %>cdn/avue/index.css">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <title>PigX微服务快速开发框架</title>
 </head>
 
 <body>
     <noscript>
-      <strong>很抱歉,如果没有 JavaScript 支持,网站将不能正常工作。请启用浏览器的 JavaScript 然后继续。</strong>
+        <strong>很抱歉,如果没有 JavaScript 支持,网站将不能正常工作。请启用浏览器的 JavaScript 然后继续。</strong>
     </noscript>
     <div id="app">
         <div class="avue-home">
@@ -49,6 +50,7 @@
     <script src="<%= BASE_URL %>cdn/vue-router/3.0.2/vue-router.min.js" charset="utf-8"></script>
     <script src="<%= BASE_URL %>cdn/axios/1.0.0/axios.min.js" charset="utf-8"></script>
     <script src="<%= BASE_URL %>cdn/element-ui/2.4.11/index.js" charset="utf-8"></script>
+    <script src="<%= BASE_URL %>cdn/avue/index.js" charset="utf-8"></script>
 </body>
 
-</html>
+</html>

+ 28 - 0
src/const/iconList.js

@@ -0,0 +1,28 @@
+export default [
+  {
+    label: "阿里云图标",
+    list: [
+      "icon-quanxianguanli",
+      "icon-yonghuguanli",
+      "icon-jiaoseguanli",
+      "icon-web-icon-",
+      "icon-xitongguanli",
+      "icon-rizhiguanli",
+      "icon-navicon-zdgl",
+      "icon-weibiaoti46",
+      "icon-miyue",
+      "icon-shouji",
+      "icon-miyue",
+      "icon-denglvlingpai",
+      "icon-luyou",
+      "icon-msnui-supervise",
+      "icon-server",
+      "icon-wendang",
+      "icon-gtsquanjushiwufuwuGTS",
+      "icon-caidanguanli",
+      "icon-guanwang",
+      "icon-guanwangfangwen",
+      "icon-guiji"
+    ]
+  }
+]

+ 0 - 6
src/main.js

@@ -13,10 +13,6 @@ import * as urls from '@/config/env'
 import { iconfontUrl, iconfontVersion } from '@/config/env'
 import * as filters from './filters' // 全局filter
 import './styles/common.scss'
-// 引入avue的包
-import Avue from '@smallwei/avue/lib/index.js'
-// 引入avue的样式文件
-import '@smallwei/avue/lib/theme-chalk/index.css'
 import basicContainer from './components/basic-container/main'
 // 插件 json 展示
 import vueJsonTreeView from 'vue-json-tree-view'
@@ -25,8 +21,6 @@ import { validatenull } from '@/util/validate'
 
 Vue.prototype.validatenull = validatenull
 
-Vue.use(Avue, { menuType: 'text' })
-
 Vue.use(router)
 
 Vue.use(vueJsonTreeView)

+ 0 - 2
src/page/index/index.vue

@@ -64,8 +64,6 @@
       this.refreshToken()
     },
     destroyed() {
-      console.log("销毁")
-      console.log(this.refreshTime)
       clearInterval(this.refreshTime)
       this.disconnect()
     },

+ 81 - 74
src/page/index/top/index.vue

@@ -60,10 +60,12 @@
              @click="handleScreen"></i>
         </div>
       </el-tooltip>
-      <el-tooltip v-if="this.userInfo.avatar" effect="dark"
+      <el-tooltip v-if="this.userInfo.avatar"
+                  effect="dark"
                   content="用户头像"
                   placement="bottom">
-        <img id="thumbnail" class="top-bar__img">
+        <img id="thumbnail"
+             class="top-bar__img">
       </el-tooltip>
       <el-dropdown>
         <span class="el-dropdown-link">
@@ -77,90 +79,95 @@
           <el-dropdown-item>
             <router-link to="/info/index">个人信息</router-link>
           </el-dropdown-item>
+          <el-dropdown-item @click.native="$refs.seting.open()"
+                            divided>界面设置
+          </el-dropdown-item>
           <el-dropdown-item @click.native="logout"
-                            divided>退出系统</el-dropdown-item>
+                            divided>退出系统
+          </el-dropdown-item>
         </el-dropdown-menu>
       </el-dropdown>
-      <top-setting></top-setting>
+      <top-setting ref="seting"></top-setting>
     </div>
   </div>
 </template>
 <script>
-import { mapGetters, mapState } from "vuex";
-import { fullscreenToggel, listenfullscreen,handleImg } from "@/util/util";
-import topLock from "./top-lock";
-import topMenu from "./top-menu";
-import topSearch from "./top-search";
-import topTheme from "./top-theme";
-import topLogs from "./top-logs";
-import topColor from "./top-color";
-import topSetting from "./top-setting";
-export default {
-  components: {
-    topLock,
-    topMenu,
-    topSearch,
-    topTheme,
-    topLogs,
-    topColor,
-    topSetting
-  },
-  name: "top",
-  data() {
-    return {};
-  },
-  filters: {},
-  created() {
-    handleImg(this.userInfo.avatar, 'thumbnail');
-  },
-  mounted() {
-    listenfullscreen(this.setScreen);
-  },
-  computed: {
-    ...mapState({
-      showDebug: state => state.common.showDebug,
-      showTheme: state => state.common.showTheme,
-      showLock: state => state.common.showLock,
-      showFullScren: state => state.common.showFullScren,
-      showCollapse: state => state.common.showCollapse,
-      showSearch: state => state.common.showSearch,
-      showMenu: state => state.common.showMenu,
-      showColor: state => state.common.showColor
-    }),
-    ...mapGetters([
-      "userInfo",
-      "isFullScren",
-      "tagWel",
-      "tagList",
-      "isCollapse",
-      "tag",
-      "logsLen",
-      "logsFlag"
-    ])
-  },
-  methods: {
-    handleScreen() {
-      fullscreenToggel();
+  import {mapGetters, mapState} from "vuex";
+  import {fullscreenToggel, handleImg, listenfullscreen} from "@/util/util";
+  import topLock from "./top-lock";
+  import topMenu from "./top-menu";
+  import topSearch from "./top-search";
+  import topTheme from "./top-theme";
+  import topLogs from "./top-logs";
+  import topColor from "./top-color";
+  import topSetting from "./top-setting";
+
+  export default {
+    components: {
+      topLock,
+      topMenu,
+      topSearch,
+      topTheme,
+      topLogs,
+      topColor,
+      topSetting
+    },
+    name: "top",
+    data() {
+      return {};
+    },
+    filters: {},
+    created() {
+      handleImg(this.userInfo.avatar, "thumbnail");
     },
-    setCollapse() {
-      this.$store.commit("SET_COLLAPSE");
+    mounted() {
+      listenfullscreen(this.setScreen);
     },
-    setScreen() {
-      this.$store.commit("SET_FULLSCREN");
+    computed: {
+      ...mapState({
+        showDebug: state => state.common.showDebug,
+        showTheme: state => state.common.showTheme,
+        showLock: state => state.common.showLock,
+        showFullScren: state => state.common.showFullScren,
+        showCollapse: state => state.common.showCollapse,
+        showSearch: state => state.common.showSearch,
+        showMenu: state => state.common.showMenu,
+        showColor: state => state.common.showColor
+      }),
+      ...mapGetters([
+        "userInfo",
+        "isFullScren",
+        "tagWel",
+        "tagList",
+        "isCollapse",
+        "tag",
+        "logsLen",
+        "logsFlag"
+      ])
     },
-    logout() {
-      this.$confirm("是否退出系统, 是否继续?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      }).then(() => {
-        this.$store.dispatch("LogOut").then(() => {
-          this.$router.push({ path: "/login" });
+    methods: {
+      handleScreen() {
+        fullscreenToggel();
+      },
+      setCollapse() {
+        this.$store.commit("SET_COLLAPSE");
+      },
+      setScreen() {
+        this.$store.commit("SET_FULLSCREN");
+      },
+      logout() {
+        this.$confirm("是否退出系统, 是否继续?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.$store.dispatch("LogOut").then(() => {
+            this.$router.push({path: "/login"});
+          });
         });
-      });
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>

+ 4 - 4
src/page/index/top/top-setting.vue

@@ -3,13 +3,11 @@
     <div class="setting__shade"
          :class="{'setting__shade--show':isShade}"
          @click="close"></div>
-    <i class="el-icon-more setting__icon"
-       @click="open"></i>
     <div class="setting__content"
          :class="{'setting__content--show':box}">
       <div class="setting__header">版权信息</div>
       <div class="setting__body setting__about">
-        <p>Version:PigX 2.5.0</p>
+        <p>Version:PigX 2.6.0</p>
         <p>Copyright: Pig4Cloud ©2018-2025</p>
       </div>
       <div class="setting__header">设置
@@ -53,7 +51,9 @@ export default {
     })
   },
   created () {
-    this.init();
+   setTimeout(()=>{
+     this.init();
+   },0)
   },
   methods: {
     close () {

+ 47 - 46
src/page/index/top/top-theme.vue

@@ -25,55 +25,56 @@
 </template>
 
 <script>
-import { setTheme } from "@/util/util";
-import { mapGetters } from "vuex";
-export default {
-  data() {
-    return {
-      box: false,
-      text: "",
-      list: [
-        {
-          name: "默认",
-          value: "default"
-        },
-        {
-          name: "白色",
-          value: "theme-white"
-        },
-        {
-          name: "炫彩",
-          value: "theme-star"
-        }
-      ]
-    };
-  },
-  watch: {
-    text: function(val) {
-      this.$store.commit("SET_THEME_NAME", val);
-      setTheme(val);
-    }
-  },
-  computed: {
-    ...mapGetters(["themeName"])
-  },
-  mounted() {
-    this.text = this.themeName;
-    if (!this.text) {
-      this.text = "";
-    }
-  },
-  methods: {
-    open() {
-      this.box = true;
+  import {setTheme} from "@/util/util";
+  import {mapGetters} from "vuex";
+
+  export default {
+    data() {
+      return {
+        box: false,
+        text: "",
+        list: [
+          {
+            name: "默认",
+            value: "default"
+          },
+          {
+            name: "白色",
+            value: "theme-white"
+          },
+          {
+            name: "炫彩",
+            value: "theme-star"
+          }
+        ]
+      };
+    },
+    watch: {
+      text: function (val) {
+        this.$store.commit("SET_THEME_NAME", val);
+        setTheme(val);
+      }
+    },
+    computed: {
+      ...mapGetters(["themeName"])
+    },
+    mounted() {
+      this.text = this.themeName;
+      if (!this.text) {
+        this.text = "";
+      }
+    },
+    methods: {
+      open() {
+        this.box = true;
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.list {
-  width: 100%;
-}
+  .list {
+    width: 100%;
+  }
 </style>
 

+ 1 - 1
src/page/login/authredirect.vue

@@ -31,7 +31,7 @@ export default {
       })
     } else {
       window.close()
-      window.opener.location.href = `${window.location.origin}/#/login?state=${state}&code=${code}`
+      window.opener.location.href = `${window.location.origin}/#/login?state=${state}&code=${code}&time=`+new Date().getTime()
     }
   }
 }

+ 55 - 26
src/page/login/index.vue

@@ -11,7 +11,7 @@
              src="/img/logo.png"
              alt="">
         <p class="title">{{website.infoTitle}}</p>
-        <p>v 2.5.0</p>
+        <p>v 2.6.0</p>
       </div>
       <div class="login-border">
         <div class="login-main">
@@ -48,11 +48,12 @@
   import userLogin from "./userlogin";
   import codeLogin from "./codelogin";
   import thirdLogin from "./thirdlogin";
-  import { mapGetters } from "vuex";
-  import { setStore, getStore } from "@/util/store";
-  import { dateFormat } from "@/util/date";
-  import { validatenull } from "@/util/validate";
+  import {mapGetters} from "vuex";
+  import {getStore, setStore} from "@/util/store";
+  import {dateFormat} from "@/util/date";
+  import {validatenull} from "@/util/validate";
   import topColor from "@/page/index/top/top-color";
+
   export default {
     name: "login",
     components: {
@@ -65,43 +66,51 @@
       return {
         time: "",
         active: "",
-        activeName: "user"
+        activeName: "user",
+        socialForm: {}
       };
     },
     watch: {
-      $route() {
-        const params = this.$route.query;
-        this.socialForm.state = params.state;
-        this.socialForm.code = params.code;
-        if (!validatenull(this.socialForm.state)) {
+      $route: {
+        handler() {
+          const params = this.$route.query
+          if (validatenull(params.state) && validatenull(params.code)) return
+
+          this.socialForm.state = params.state
+          this.socialForm.code = params.code
           const loading = this.$loading({
             lock: true,
-            text: `${
-              this.socialForm.state === "WX" ? "微信" : "QQ"
-              }登录中,请稍后。。。`,
-            spinner: "el-icon-loading"
-          });
-          setTimeout(() => {
-            loading.close();
-          }, 2000);
-        }
+            text: `登录中,请稍后。。。`,
+            spinner: 'el-icon-loading'
+          })
+          this.$store.dispatch('LoginBySocial', this.socialForm).then(
+            () => {
+              loading.close()
+              this.$router.push({path: this.tagWel.value});
+            }).catch(() => {
+            loading.close()
+          })
+
+        },
+        immediate: true
       }
     },
     created() {
-      this.active = getStore({ name: "tenantId" });
+      this.active = getStore({name: "tenantId"});
       this.getTime();
       setInterval(() => {
         this.getTime();
       }, 1000);
     },
-    mounted() {},
+    mounted() {
+    },
     computed: {
-      ...mapGetters(["website"])
+      ...mapGetters(["website",'tagWel'])
     },
     props: [],
     methods: {
       handleCommand(command) {
-        setStore({ name: "tenantId", content: command });
+        setStore({name: "tenantId", content: command});
       },
       getTime() {
         this.time = dateFormat(new Date());
@@ -118,10 +127,10 @@
     width: 100%;
     height: 100%;
     margin: 0 auto;
-    background: url("http://www.17sucai.com/preview/242158/2015-01-10/%E7%99%BB%E5%BD%95/images/cloud.jpg")
-    0 bottom repeat-x #049ec4;
+    background: url("http://www.17sucai.com/preview/242158/2015-01-10/%E7%99%BB%E5%BD%95/images/cloud.jpg") 0 bottom repeat-x #049ec4;
     animation: animate-cloud 20s linear infinite;
   }
+
   .login-weaper {
     margin: 0 auto;
     width: 1000px;
@@ -135,6 +144,7 @@
     align-items: center;
     display: flex;
   }
+
   .login-left {
     border-top-left-radius: 5px;
     border-bottom-left-radius: 5px;
@@ -146,9 +156,11 @@
     width: 50%;
     position: relative;
   }
+
   .login-left .img {
     width: 140px;
   }
+
   .login-time {
     position: absolute;
     left: 25px;
@@ -160,6 +172,7 @@
     font-size: 18px;
     overflow: hidden;
   }
+
   .login-left .title {
     margin-top: 60px;
     text-align: center;
@@ -179,17 +192,21 @@
     float: left;
     box-sizing: border-box;
   }
+
   .login-main {
     margin: 0 auto;
     width: 65%;
     box-sizing: border-box;
   }
+
   .login-main > h3 {
     margin-bottom: 20px;
   }
+
   .login-main > p {
     color: #76838f;
   }
+
   .login-title {
     color: #333;
     margin-bottom: 40px;
@@ -198,6 +215,7 @@
     text-align: center;
     letter-spacing: 4px;
   }
+
   .login-select {
     input {
       color: #333;
@@ -207,16 +225,19 @@
       text-align: center;
     }
   }
+
   .login-menu {
     margin-top: 40px;
     width: 100%;
     text-align: center;
+
     a {
       color: #999;
       font-size: 12px;
       margin: 0px 8px;
     }
   }
+
   .login-submit {
     width: 100%;
     height: 45px;
@@ -231,17 +252,22 @@
     font-family: "neo";
     transition: 0.25s;
   }
+
   .login-form {
     margin: 10px 0;
+
     i {
       color: #333;
     }
+
     .el-form-item__content {
       width: 100%;
     }
+
     .el-form-item {
       margin-bottom: 12px;
     }
+
     .el-input {
       input {
         padding-bottom: 10px;
@@ -252,6 +278,7 @@
         color: #333;
         border-bottom: 1px solid rgb(235, 237, 242);
       }
+
       .el-input__prefix {
         i {
           padding: 0 5px;
@@ -260,12 +287,14 @@
       }
     }
   }
+
   .login-code {
     display: flex;
     align-items: center;
     justify-content: space-around;
     margin: 0 0 0 10px;
   }
+
   .login-code-img {
     margin-top: 2px;
     width: 100px;

+ 70 - 92
src/page/login/userlogin.vue

@@ -61,112 +61,90 @@
       <el-button type="primary"
                  size="small"
                  @click.native.prevent="handleLogin"
-                 class="login-submit">登录</el-button>
+                 class="login-submit">登录
+      </el-button>
     </el-form-item>
   </el-form>
 </template>
 
 <script>
-import { randomLenNum } from "@/util/util";
-import { mapGetters } from "vuex";
-export default {
-  name: "userlogin",
-  data () {
+  import {randomLenNum} from "@/util/util";
+  import {mapGetters} from "vuex";
 
-    return {
-      socialForm: {
+  export default {
+    name: "userlogin",
+    data() {
+
+      return {
+        socialForm: {
           code: '',
           state: ''
-      },
-      loginForm: {
-        username: "admin",
-        password: "123456",
-        code: "",
-        redomStr: ""
-      },
-      checked: false,
-      code: {
-        src: "/code",
-        value: "",
-        len: 4,
-        type: "image"
-      },
-      loginRules: {
-        username: [
-          { required: true, message: "请输入用户名", trigger: "blur" }
-        ],
-        password: [
-          { required: true, message: "请输入密码", trigger: "blur" },
-          { min: 6, message: "密码长度最少为6位", trigger: "blur" }
-        ],
-        code: [
-          { required: true, message: "请输入验证码", trigger: "blur" },
-          { min: 4, max: 4, message: "验证码长度为4位", trigger: "blur" }
-        ]
-      },
-      passwordType: "password"
-    };
-  },
-  watch: {
-        $route() {
-            const params = this.$route.query
-            this.socialForm.state = params.state
-            this.socialForm.code = params.code
-            if (!validatenull(this.socialForm.state)) {
-                const loading = this.$loading({
-                    lock: true,
-                    text: `登录中,请稍后。。。`,
-                    spinner: 'el-icon-loading'
-                })
-                setTimeout(() => {
-                    loading.close()
-                }, 2000)
-                this.handleSocialLogin()
-            }
-        }
+        },
+        loginForm: {
+          username: "admin",
+          password: "123456",
+          code: "",
+          redomStr: ""
+        },
+        checked: false,
+        code: {
+          src: "/code",
+          value: "",
+          len: 4,
+          type: "image"
+        },
+        loginRules: {
+          username: [
+            {required: true, message: "请输入用户名", trigger: "blur"}
+          ],
+          password: [
+            {required: true, message: "请输入密码", trigger: "blur"},
+            {min: 6, message: "密码长度最少为6位", trigger: "blur"}
+          ],
+          code: [
+            {required: true, message: "请输入验证码", trigger: "blur"},
+            {min: 4, max: 4, message: "验证码长度为4位", trigger: "blur"}
+          ]
+        },
+        passwordType: "password"
+      };
     },
-  created () {
-    this.refreshCode();
-  },
-  mounted () { },
-  computed: {
-    ...mapGetters(["tagWel"])
-  },
-  props: [],
-  methods: {
-    refreshCode () {
-      this.loginForm.code = ''
-      this.loginForm.randomStr = randomLenNum(this.code.len, true)
-      this.code.type === 'text'
-        ? (this.code.value = randomLenNum(this.code.len))
-        : (this.code.src = `${this.codeUrl}?randomStr=${this.loginForm.randomStr}`)
+    created() {
+      this.refreshCode();
     },
-    showPassword () {
-      this.passwordType == ''
-        ? (this.passwordType = 'password')
-        : (this.passwordType = '')
+    mounted() {
     },
-    handleSocialLogin () {
-      this.$store.dispatch('LoginBySocial', this.socialForm).then(
-        () => {
-          this.$router.push({ path: this.tagWel.value });
-        }
-      )
+    computed: {
+      ...mapGetters(["tagWel"])
     },
-    handleLogin () {
-      this.$refs.loginForm.validate(valid => {
-        if (valid) {
-          this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
-            this.$router.push({ path: this.tagWel.value });
-          }).catch(()=>{
-            this.refreshCode()
-          })
+    props: [],
+    methods: {
+      refreshCode() {
+        this.loginForm.code = ''
+        this.loginForm.randomStr = randomLenNum(this.code.len, true)
+        this.code.type === 'text'
+          ? (this.code.value = randomLenNum(this.code.len))
+          : (this.code.src = `${this.codeUrl}?randomStr=${this.loginForm.randomStr}`)
+      },
+      showPassword() {
+        this.passwordType == ''
+          ? (this.passwordType = 'password')
+          : (this.passwordType = '')
+      },
+      handleLogin() {
+        this.$refs.loginForm.validate(valid => {
+          if (valid) {
+            this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
+              this.$router.push({path: this.tagWel.value});
+            }).catch(() => {
+              this.refreshCode()
+            })
 
-        }
-      });
+          }
+        });
+      }
     }
-  }
-};
+  };
 </script>
 
 <style>

+ 7 - 7
src/router/axios.js

@@ -1,9 +1,9 @@
-import {serialize} from '@/util/util'
-import {getStore} from '../util/store'
+import { serialize } from '@/util/util'
+import { getStore } from '../util/store'
 import NProgress from 'nprogress' // progress bar
 import errorCode from '@/const/errorCode'
 import router from "@/router/router"
-import {Message} from 'element-ui'
+import { Message } from 'element-ui'
 import 'nprogress/nprogress.css'
 import store from "@/store"; // progress bar style
 axios.defaults.timeout = 30000
@@ -21,9 +21,9 @@ NProgress.configure({
 // HTTPrequest拦截
 axios.interceptors.request.use(config => {
   NProgress.start() // start progress bar
-  const TENANT_ID = getStore({name: 'tenantId'})
+  const TENANT_ID = getStore({ name: 'tenantId' })
   const isToken = (config.headers || {}).isToken === false
-  let token =  store.getters.access_token
+  let token = store.getters.access_token
   if (token && !isToken) {
     config.headers['Authorization'] = 'Bearer ' + token// token
   }
@@ -31,7 +31,7 @@ axios.interceptors.request.use(config => {
     config.headers['TENANT_ID'] = TENANT_ID // 租户ID
   }
   // headers中配置serialize为true开启序列化
-  if (config.methods === 'post' && config.headers.serialize) {
+  if (config.method === 'post' && config.headers.serialize) {
     config.data = serialize(config.data)
     delete config.data.serialize
   }
@@ -48,7 +48,7 @@ axios.interceptors.response.use(res => {
   const message = res.data.msg || errorCode[status] || errorCode['default']
   if (status === 401) {
     store.dispatch('FedLogOut').then(() => {
-      router.push({path: '/login'})
+      router.push({ path: '/login' })
     })
     return
   }

+ 12 - 1
src/router/page/index.js

@@ -75,5 +75,16 @@ export default [{
     {
       path: '*',
       redirect: '/404',
-    }
+    },
+    {
+      path: '/authredirect',
+      name: '授权页',
+      component: () =>
+      import ( /* webpackChunkName: "page" */ '@/page/login/authredirect'),
+      meta: {
+        keepAlive: true,
+        isTab: false,
+        isAuth: false
+      }
+    },
 ]

+ 193 - 187
src/views/admin/menu/index.vue

@@ -86,9 +86,10 @@
               </el-form-item>
               <el-form-item label="图标"
                             prop="icon">
-                <el-input v-model="form.icon"
-                          :disabled="formEdit"
-                          placeholder="请输入图标"></el-input>
+                <avue-crud-icon-select v-model="form.icon"
+                                       :iconList="iconList"
+                                       :disabled="formEdit"
+                                       placeholder="请输入图标"></avue-crud-icon-select>
               </el-form-item>
               <el-form-item label="类型"
                             prop="type">
@@ -152,202 +153,207 @@
 </template>
 
 <script>
-  import {addObj, delObj, fetchMenuTree, getObj, putObj} from '@/api/admin/menu'
-  import {mapGetters} from 'vuex'
+import {
+  addObj,
+  delObj,
+  fetchMenuTree,
+  getObj,
+  putObj
+} from "@/api/admin/menu";
+import { mapGetters } from "vuex";
+import iconList from "@/const/iconList";
 
-  export default {
-    name: 'menu',
-    data() {
-      return {
-        list: null,
-        total: null,
-        formEdit: true,
-        formAdd: true,
-        formStatus: '',
-        showElement: false,
-        typeOptions: ['0', '1'],
-        methodOptions: ['GET', 'POST', 'PUT', 'DELETE'],
-        listQuery: {
-          name: undefined
-        },
-        treeData: [],
-        oExpandedKey: {
-          // key (from tree id) : expandedOrNot boolean
-        },
-        oTreeNodeChildren: {
-          // id1 : [children] (from tree node id1)
-          // id2 : [children] (from tree node id2)
-        },
-        aExpandedKeys: [],
-        defaultProps: {
-          children: 'children',
-          label: 'name'
-        },
-        labelPosition: 'right',
-        form: {
-          permission: undefined,
-          name: undefined,
-          menuId: undefined,
-          parentId: undefined,
-          icon: undefined,
-          sort: undefined,
-          component: undefined,
-          type: undefined,
-          path: undefined
-        },
-        currentId: -1,
-        menuManager_btn_add: false,
-        menuManager_btn_edit: false,
-        menuManager_btn_del: false
-      }
-    },
-    filters: {
-      typeFilter(type) {
-        const typeMap = {
-          0: '菜单',
-          1: '按钮'
-        }
-        return typeMap[type]
-      }
-    },
-    created() {
-      this.getList()
-      this.menuManager_btn_add = this.permissions['sys_menu_add']
-      this.menuManager_btn_edit = this.permissions['sys_menu_edit']
-      this.menuManager_btn_del = this.permissions['sys_menu_del']
-    },
-    computed: {
-      ...mapGetters([
-        'elements',
-        'permissions'
-      ])
-    },
-    methods: {
-      getList() {
-        fetchMenuTree(this.listQuery).then(response => {
-          this.treeData = response.data.data
-        })
-      },
-      filterNode(value, data) {
-        if (!value) return true
-        return data.label.indexOf(value) !== -1
+export default {
+  name: "menu",
+  data() {
+    return {
+      iconList: iconList,
+      list: null,
+      total: null,
+      formEdit: true,
+      formAdd: true,
+      formStatus: "",
+      showElement: false,
+      typeOptions: ["0", "1"],
+      methodOptions: ["GET", "POST", "PUT", "DELETE"],
+      listQuery: {
+        name: undefined
       },
-
-      nodeExpand(data) {
-        let aChildren = data.children
-        if (aChildren.length > 0) {
-          this.oExpandedKey[data.id] = true
-          this.oTreeNodeChildren[data.id] = aChildren
-        }
-        this.setExpandedKeys()
+      treeData: [],
+      oExpandedKey: {
+        // key (from tree id) : expandedOrNot boolean
       },
-      nodeCollapse(data) {
-        this.oExpandedKey[data.id] = false
-        // 如果有子节点
-        this.treeRecursion(this.oTreeNodeChildren[data.id], (oNode) => {
-          this.oExpandedKey[oNode.id] = false
-        });
-        this.setExpandedKeys()
+      oTreeNodeChildren: {
+        // id1 : [children] (from tree node id1)
+        // id2 : [children] (from tree node id2)
       },
-      setExpandedKeys() {
-        let oTemp = this.oExpandedKey
-        this.aExpandedKeys = []
-        for (let sKey in oTemp) {
-          if (oTemp[sKey]) {
-            this.aExpandedKeys.push(parseInt(sKey));
-          }
-        }
+      aExpandedKeys: [],
+      defaultProps: {
+        children: "children",
+        label: "name"
       },
-      treeRecursion(aChildren, fnCallback) {
-        if (aChildren) {
-          for (let i = 0; i < aChildren.length; ++i) {
-            let oNode = aChildren[i]
-            fnCallback && fnCallback(oNode)
-            this.treeRecursion(oNode.children, fnCallback)
-          }
-        }
+      labelPosition: "right",
+      form: {
+        permission: undefined,
+        name: undefined,
+        menuId: undefined,
+        parentId: undefined,
+        icon: undefined,
+        sort: undefined,
+        component: undefined,
+        type: undefined,
+        path: undefined
       },
+      currentId: -1,
+      menuManager_btn_add: false,
+      menuManager_btn_edit: false,
+      menuManager_btn_del: false
+    };
+  },
+  filters: {
+    typeFilter(type) {
+      const typeMap = {
+        0: "菜单",
+        1: "按钮"
+      };
+      return typeMap[type];
+    }
+  },
+  created() {
+    this.getList();
+    this.menuManager_btn_add = this.permissions["sys_menu_add"];
+    this.menuManager_btn_edit = this.permissions["sys_menu_edit"];
+    this.menuManager_btn_del = this.permissions["sys_menu_del"];
+  },
+  computed: {
+    ...mapGetters(["elements", "permissions"])
+  },
+  methods: {
+    getList() {
+      fetchMenuTree(this.listQuery).then(response => {
+        this.treeData = response.data.data;
+      });
+    },
+    filterNode(value, data) {
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
+    },
 
-      getNodeData(data) {
-        if (!this.formEdit) {
-          this.formStatus = 'update'
+    nodeExpand(data) {
+      let aChildren = data.children;
+      if (aChildren.length > 0) {
+        this.oExpandedKey[data.id] = true;
+        this.oTreeNodeChildren[data.id] = aChildren;
+      }
+      this.setExpandedKeys();
+    },
+    nodeCollapse(data) {
+      this.oExpandedKey[data.id] = false;
+      // 如果有子节点
+      this.treeRecursion(this.oTreeNodeChildren[data.id], oNode => {
+        this.oExpandedKey[oNode.id] = false;
+      });
+      this.setExpandedKeys();
+    },
+    setExpandedKeys() {
+      let oTemp = this.oExpandedKey;
+      this.aExpandedKeys = [];
+      for (let sKey in oTemp) {
+        if (oTemp[sKey]) {
+          this.aExpandedKeys.push(parseInt(sKey));
         }
-        getObj(data.id).then(response => {
-          this.form = response.data.data
-        })
-        this.currentId = data.id
-        this.showElement = true
-      },
-      handlerEdit() {
-        if (this.form.menuId) {
-          this.formEdit = false
-          this.formStatus = 'update'
+      }
+    },
+    treeRecursion(aChildren, fnCallback) {
+      if (aChildren) {
+        for (let i = 0; i < aChildren.length; ++i) {
+          let oNode = aChildren[i];
+          fnCallback && fnCallback(oNode);
+          this.treeRecursion(oNode.children, fnCallback);
         }
-      },
-      handlerAdd() {
-        this.resetForm()
-        this.formEdit = false
-        this.formStatus = 'create'
-      },
-      handleDelete() {
-        this.$confirm('此操作将永久删除, 是否继续?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          delObj(this.currentId).then(() => {
-            this.getList()
-            this.resetForm()
-            this.onCancel()
-            this.$notify({
-              title: '成功',
-              message: '删除成功',
-              type: 'success',
-              duration: 2000
-            })
-          })
-        })
-      },
-      update() {
-        putObj(this.form).then(() => {
-          this.getList()
-          this.$notify({
-            title: '成功',
-            message: '更新成功',
-            type: 'success',
-            duration: 2000
-          })
-        })
-      },
-      create() {
-        addObj(this.form).then(() => {
-          this.getList()
+      }
+    },
+
+    getNodeData(data) {
+      if (!this.formEdit) {
+        this.formStatus = "update";
+      }
+      getObj(data.id).then(response => {
+        this.form = response.data.data;
+      });
+      this.currentId = data.id;
+      this.showElement = true;
+    },
+    handlerEdit() {
+      if (this.form.menuId) {
+        this.formEdit = false;
+        this.formStatus = "update";
+      }
+    },
+    handlerAdd() {
+      this.resetForm();
+      this.formEdit = false;
+      this.formStatus = "create";
+    },
+    handleDelete() {
+      this.$confirm("此操作将永久删除, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        delObj(this.currentId).then(() => {
+          this.getList();
+          this.resetForm();
+          this.onCancel();
           this.$notify({
-            title: '成功',
-            message: '创建成功',
-            type: 'success',
+            title: "成功",
+            message: "删除成功",
+            type: "success",
             duration: 2000
-          })
-        })
-      },
-      onCancel() {
-        this.formEdit = true
-        this.formStatus = ''
-      },
-      resetForm() {
-        this.form = {
-          permission: undefined,
-          name: undefined,
-          menuId: undefined,
-          parentId: this.currentId,
-          icon: undefined,
-          sort: undefined,
-          component: undefined,
-          type: undefined,
-          path: undefined
-        }
-      }
+          });
+        });
+      });
+    },
+    update() {
+      putObj(this.form).then(() => {
+        this.getList();
+        this.$notify({
+          title: "成功",
+          message: "更新成功",
+          type: "success",
+          duration: 2000
+        });
+      });
+    },
+    create() {
+      addObj(this.form).then(() => {
+        this.getList();
+        this.$notify({
+          title: "成功",
+          message: "创建成功",
+          type: "success",
+          duration: 2000
+        });
+      });
+    },
+    onCancel() {
+      this.formEdit = true;
+      this.formStatus = "";
+    },
+    resetForm() {
+      this.form = {
+        permission: undefined,
+        name: undefined,
+        menuId: undefined,
+        parentId: this.currentId,
+        icon: undefined,
+        sort: undefined,
+        component: undefined,
+        type: undefined,
+        path: undefined
+      };
     }
   }
+};
 </script>
 

+ 1 - 0
vue.config.js

@@ -21,6 +21,7 @@ module.exports = {
   },
   // 配置转发代理
   devServer: {
+    disableHostCheck: true,
     proxy: {
       '/auth': {
         target: url,