Pārlūkot izejas kodu

Merge branch 'master' of git.caimei365.com:git_lijun/caimei-mall-admin-ui

zhengjinyi 5 gadi atpakaļ
vecāks
revīzija
4e7c9278ba

+ 1 - 4
src/layout/index.vue

@@ -63,10 +63,7 @@ export default {
       if (this.systemName) {
       if (this.systemName) {
         return false
         return false
       }
       }
-      this.$store.dispatch('user/getSysInfo', this.organizeID).then(() => {
-        this.systemName = this.$store.getters.systemName
-        this.systemImage = this.$store.getters.systemImage
-      })
+      this.$store.dispatch('user/getSysInfo', this.organizeID)
     }
     }
   }
   }
 }
 }

+ 1 - 1
src/router/index.js

@@ -73,7 +73,7 @@ export const constantRoutes = [
         path: 'dashboard',
         path: 'dashboard',
         component: () => import('@/views/dashboard/index'),
         component: () => import('@/views/dashboard/index'),
         name: 'Dashboard',
         name: 'Dashboard',
-        meta: { title: '首页', icon: 'dashboard', affix: true }
+        meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
       }
       }
     ]
     ]
   },
   },

+ 1 - 0
src/store/getters.js

@@ -5,6 +5,7 @@ const getters = {
   visitedViews: state => state.tagsView.visitedViews,
   visitedViews: state => state.tagsView.visitedViews,
   cachedViews: state => state.tagsView.cachedViews,
   cachedViews: state => state.tagsView.cachedViews,
   token: state => state.user.token,
   token: state => state.user.token,
+  isSimplePwd: state => state.user.isSimplePwd,
   systemName: state => state.user.systemName,
   systemName: state => state.user.systemName,
   systemImage: state => state.user.systemImage,
   systemImage: state => state.user.systemImage,
   name: state => state.user.name,
   name: state => state.user.name,

+ 8 - 1
src/store/modules/user.js

@@ -7,6 +7,7 @@ import router, { resetRouter } from '@/router'
 
 
 const state = {
 const state = {
   token: getToken(),
   token: getToken(),
+  isSimplePwd: false,
   name: '',
   name: '',
   avatar: '',
   avatar: '',
   systemName: '',
   systemName: '',
@@ -18,6 +19,9 @@ const mutations = {
   SET_TOKEN: (state, token) => {
   SET_TOKEN: (state, token) => {
     state.token = token
     state.token = token
   },
   },
+  SET_IS_SIMPLE_PWD: (state, isSimplePwd) => {
+    state.isSimplePwd = isSimplePwd
+  },
   SET_SYSTEM_NAME: (state, systemName) => {
   SET_SYSTEM_NAME: (state, systemName) => {
     state.systemName = systemName
     state.systemName = systemName
   },
   },
@@ -54,8 +58,11 @@ const actions = {
 
 
   // user login
   // user login
   login: function({ commit }, userInfo) {
   login: function({ commit }, userInfo) {
-    const { account, password, organizeID } = userInfo
+    const { account, password, organizeID, simplePwd } = userInfo
     return new Promise((resolve, reject) => {
     return new Promise((resolve, reject) => {
+      if (password.trim() === simplePwd) {
+        commit('SET_IS_SIMPLE_PWD', true)
+      }
       login({ account: account.trim(), password: password, organizeID: organizeID }).then(response => {
       login({ account: account.trim(), password: password, organizeID: organizeID }).then(response => {
         const { data } = response
         const { data } = response
         commit('SET_TOKEN', data)
         commit('SET_TOKEN', data)

+ 23 - 2
src/views/dashboard/index.vue

@@ -1,6 +1,18 @@
 <template>
 <template>
   <div class="dashboard-container">
   <div class="dashboard-container">
     <component :is="currentRole" />
     <component :is="currentRole" />
+    <el-dialog
+      title="安全提示"
+      :visible.sync="dialogVisible"
+      type="warning"
+      width="30%"
+    >
+      <span>密码太过简单,请尽快修改密码!</span>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <router-link to="/other/password"><el-button type="primary">修改密码</el-button></router-link>
+      </span>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -14,18 +26,27 @@ export default {
   components: { adminDashboard, editorDashboard },
   components: { adminDashboard, editorDashboard },
   data() {
   data() {
     return {
     return {
-      currentRole: 'adminDashboard'
+      currentRole: 'adminDashboard',
+      dialogVisible: false
     }
     }
   },
   },
   computed: {
   computed: {
     ...mapGetters([
     ...mapGetters([
       'roles'
       'roles'
-    ])
+    ]),
+    isSimplePwd() {
+      return this.$store.getters.isSimplePwd
+    }
   },
   },
   created() {
   created() {
     if (!this.roles.includes('admin')) {
     if (!this.roles.includes('admin')) {
       this.currentRole = 'editorDashboard'
       this.currentRole = 'editorDashboard'
     }
     }
+  },
+  mounted() {
+    if (this.isSimplePwd) {
+      this.dialogVisible = true
+    }
   }
   }
 }
 }
 </script>
 </script>

+ 2 - 1
src/views/login/index.vue

@@ -76,7 +76,8 @@ export default {
       loginForm: {
       loginForm: {
         account: '',
         account: '',
         password: '',
         password: '',
-        organizeID: this.organizeID
+        organizeID: this.organizeID,
+        simplePwd: this.simplePwd
       },
       },
       loginRules: {
       loginRules: {
         account: [{ required: true, trigger: 'blur', validator: validateUsername }],
         account: [{ required: true, trigger: 'blur', validator: validateUsername }],