Explorar o código

task-835【许可证功能更新】

cfort %!s(int64=2) %!d(string=hai) anos
pai
achega
ea3c25795c

+ 3 - 0
src/api/oauth2/oauth2.js

@@ -93,6 +93,7 @@ var OAuth = function (clientId, clientSecret, getToken, saveToken) {
     this.clientId = clientId
     this.clientId = clientId
     this.clientSecret = clientSecret
     this.clientSecret = clientSecret
     this.statistic = ''
     this.statistic = ''
+    this.username = ''
     // token的获取和存储
     // token的获取和存储
     this.store = {}
     this.store = {}
     this.getToken = getToken || function (uid, callback) {
     this.getToken = getToken || function (uid, callback) {
@@ -220,6 +221,7 @@ OAuth.prototype.getAccessTokenByCode = function (code, callback) {
             client_id: this.clientId,
             client_id: this.clientId,
             client_secret: this.clientSecret,
             client_secret: this.clientSecret,
             authorize_code: code,
             authorize_code: code,
+            username: this.username,
             grant_type: 'authorization_code'
             grant_type: 'authorization_code'
         },
         },
         method: 'post'
         method: 'post'
@@ -535,6 +537,7 @@ OAuth.prototype.getUserByCode = function (options, callback) {
  * @param {*} callback
  * @param {*} callback
  */
  */
 OAuth.prototype.getLoginCode = function (options, callback) {
 OAuth.prototype.getLoginCode = function (options, callback) {
+    this.username = options.username
     const that = this
     const that = this
     /**
     /**
      * 用户登录
      * 用户登录

+ 136 - 123
src/api/oauth2/user.js

@@ -16,12 +16,12 @@ const oauthApi = new IbpsOAuth(CLIENT_ID, CLIENT_SECRET)
  * @param {*} captcha  验证码
  * @param {*} captcha  验证码
  * @param {*} requestId 验证码请求ID
  * @param {*} requestId 验证码请求ID
  */
  */
-export function login(params) {
-  if (GRANT_TYPE === 'authorization_code') {
-    return loginByCode(params)
-  } else if (GRANT_TYPE === 'password_credentials') {
-    return loginByPassword(params)
-  }
+export function login (params) {
+    if (GRANT_TYPE === 'authorization_code') {
+        return loginByCode(params)
+    } else if (GRANT_TYPE === 'password_credentials') {
+        return loginByPassword(params)
+    }
 }
 }
 
 
 /**
 /**
@@ -31,16 +31,16 @@ export function login(params) {
  * @param {*} captcha  验证码
  * @param {*} captcha  验证码
  * @param {*} requestId 验证码请求ID
  * @param {*} requestId 验证码请求ID
  */
  */
-export function loginByCode(params) {
-  return new Promise((resolve, reject) => {
-    oauthApi.getLoginCode(params, (error, res) => {
-      if (error) {
-        return reject(error)
-      }
-      res.data.statistic = oauthApi.statistic
-      resolve(res)
+export function loginByCode (params) {
+    return new Promise((resolve, reject) => {
+        oauthApi.getLoginCode(params, (error, res) => {
+            if (error) {
+                return reject(error)
+            }
+            res.data.statistic = oauthApi.statistic
+            resolve(res)
+        })
     })
     })
-  })
 }
 }
 
 
 /**
 /**
@@ -50,172 +50,185 @@ export function loginByCode(params) {
  * @param {*} captcha  验证码
  * @param {*} captcha  验证码
  * @param {*} requestId 验证码请求ID
  * @param {*} requestId 验证码请求ID
  */
  */
-export function loginByPassword(params) {
-  return new Promise((resolve, reject) => {
-    oauthApi.getAccessTokenByPassword(params, function(error, res) {
-      if (error) {
-        return reject(error)
-      }
-      console.log(res)
-      resolve(res)
+export function loginByPassword (params) {
+    return new Promise((resolve, reject) => {
+        oauthApi.getAccessTokenByPassword(params, function (error, res) {
+            if (error) {
+                return reject(error)
+            }
+            console.log(res)
+            resolve(res)
+        })
     })
     })
-  })
 }
 }
 
 
 /**
 /**
  * 用户登出
  * 用户登出
  *
  *
  */
  */
-export function logout(accessToken) {
-  return request({
-    url: OAUTH2_URL() + '/user/logout',
-    method: 'post',
-    params: {
-      access_token: accessToken
-    }
-  })
+export function logout (accessToken) {
+    return request({
+        url: OAUTH2_URL() + '/user/logout',
+        method: 'post',
+        params: {
+            access_token: accessToken
+        }
+    })
 }
 }
 
 
 /**
 /**
  *获取验证码[匿名]
  *获取验证码[匿名]
  */
  */
-export function getValidCode(params) {
-  return request({
-    url: OAUTH2_URL() + '/user/captcha',
-    method: 'get',
-    params: params
-  })
+export function getValidCode (params) {
+    return request({
+        url: OAUTH2_URL() + '/user/captcha',
+        method: 'get',
+        params: params
+    })
 }
 }
 
 
 /**
 /**
  *  根据用户名, 获取用户上下文信息
  *  根据用户名, 获取用户上下文信息
  * @param {*} token
  * @param {*} token
  */
  */
-export function getUserInfo(username) {
-  return request({
-    url: OAUTH2_URL() + '/user/context',
-    method: 'post',
-    params: {
-      username
-    }
-  })
+export function getUserInfo (username) {
+    return request({
+        url: OAUTH2_URL() + '/user/context',
+        method: 'post',
+        params: {
+            username
+        }
+    })
 }
 }
 
 
 /**
 /**
  * 刷新tonken
  * 刷新tonken
  */
  */
-export function refreshAccessToken() {
-  return new Promise((resolve, reject) => {
-    oauthApi.refreshAccessToken(getRefreshToken(), function(error, res) {
-      if (error) {
-        return reject(error)
-      }
-      resolve(res)
-    })
-  })
-}
-
-export function switchUser({ username, token }) {
-  return request({
-    url: OAUTH2_URL() + '/authentication/switch',
-    method: 'post',
-    data: {
-      'client_id': CLIENT_ID,
-      'client_secret': CLIENT_SECRET,
-      'grant_type': 'authorization_code',
-      'access_token': token,
-      'username': username
-    }
-  })
-}
-
-export function exitSwitchUser({ username, token }) {
-  return request({
-    url: OAUTH2_URL() + '/authentication/switch/exit',
-    method: 'post',
-    data: {
-      'client_id': CLIENT_ID,
-      'client_secret': CLIENT_SECRET,
-      'grant_type': 'authorization_code',
-      'access_token': token,
-      'username': username
-    }
-  })
+export function refreshAccessToken () {
+    return new Promise((resolve, reject) => {
+        oauthApi.refreshAccessToken(getRefreshToken(), function (error, res) {
+            if (error) {
+                return reject(error)
+            }
+            resolve(res)
+        })
+    })
+}
+
+export function switchUser ({ username, token }) {
+    return request({
+        url: OAUTH2_URL() + '/authentication/switch',
+        method: 'post',
+        data: {
+            'client_id': CLIENT_ID,
+            'client_secret': CLIENT_SECRET,
+            'grant_type': 'authorization_code',
+            'access_token': token,
+            'username': username
+        }
+    })
+}
+
+export function exitSwitchUser ({ username, token }) {
+    return request({
+        url: OAUTH2_URL() + '/authentication/switch/exit',
+        method: 'post',
+        data: {
+            'client_id': CLIENT_ID,
+            'client_secret': CLIENT_SECRET,
+            'grant_type': 'authorization_code',
+            'access_token': token,
+            'username': username
+        }
+    })
 }
 }
 /**
 /**
  *  是否开启注册
  *  是否开启注册
  */
  */
-export function getRegisterOpen() {
-  return request({
-    url: OAUTH2_URL() + '/user/open',
-    method: 'get'
-  })
+export function getRegisterOpen () {
+    return request({
+        url: OAUTH2_URL() + '/user/open',
+        method: 'get'
+    })
 }
 }
 
 
 /**
 /**
  *  用户注册
  *  用户注册
  * @param {*} params
  * @param {*} params
  */
  */
-export function register(params) {
-  return request({
-    url: OAUTH2_URL() + '/user/register',
-    method: 'post',
-    data: params
-  })
+export function register (params) {
+    return request({
+        url: OAUTH2_URL() + '/user/register',
+        method: 'post',
+        data: params
+    })
 }
 }
 
 
 /**
 /**
  *  用户短信验证
  *  用户短信验证
  * @param {*} params
  * @param {*} params
  */
  */
-export function sendSms(params) {
-  return request({
-    url: OAUTH2_URL() + '/user/send/sms',
-    method: 'get',
-    params: params
-  })
+export function sendSms (params) {
+    return request({
+        url: OAUTH2_URL() + '/user/send/sms',
+        method: 'get',
+        params: params
+    })
 }
 }
 
 
 /**
 /**
  *  用户短信验证码
  *  用户短信验证码
  * @param {*} params
  * @param {*} params
  */
  */
-export function sendSmsTenant(params) {
-  return request({
-    url: OAUTH2_URL() + '/user/send/sms/tenant',
-    method: 'get',
-    params: params
-  })
+export function sendSmsTenant (params) {
+    return request({
+        url: OAUTH2_URL() + '/user/send/sms/tenant',
+        method: 'get',
+        params: params
+    })
 }
 }
 /**
 /**
  *  重置密码-注册用户使用
  *  重置密码-注册用户使用
  * @param {*} params
  * @param {*} params
  */
  */
-export function resetPasswd(params) {
-  return request({
-    url: OAUTH2_URL() + '/user/reset/passwd',
-    method: 'post',
-    data: params
-  })
+export function resetPasswd (params) {
+    return request({
+        url: OAUTH2_URL() + '/user/reset/passwd',
+        method: 'post',
+        data: params
+    })
 }
 }
 /**
 /**
  *  重置密码-企业租户用户使用
  *  重置密码-企业租户用户使用
  * @param {*} params
  * @param {*} params
  */
  */
-export function resetTenantPasswd(params) {
-  return request({
-    url: OAUTH2_URL() + '/user/reset/passwd/tenant',
-    method: 'post',
-    data: params
-  })
+export function resetTenantPasswd (params) {
+    return request({
+        url: OAUTH2_URL() + '/user/reset/passwd/tenant',
+        method: 'post',
+        data: params
+    })
 }
 }
 
 
 /**
 /**
  * 是否开启租户模式
  * 是否开启租户模式
  */
  */
-export function open() {
-  return request({
-    url: OAUTH2_URL() + '/user/open/tenant',
-    method: 'get'
-  })
+export function open () {
+    return request({
+        url: OAUTH2_URL() + '/user/open/tenant',
+        method: 'get'
+    })
+}
+
+/**
+ * 更新许可证
+ * @param {String} username 用户名
+ * @param {String} licence 许可证
+ */
+export function updateLicence (params) {
+    return request({
+        url: OAUTH2_URL() + '/authentication/updateLicense',
+        method: 'post',
+        data: params
+    })
 }
 }

+ 4 - 1
src/layout/header-aside/components/header-message/index.vue

@@ -157,7 +157,10 @@ export default {
             }
             }
             if (needRemind) {
             if (needRemind) {
                 this.$confirm('系统试用期即将结束,请联系开发方购买永久版或申请新的试用许可证!', '提示', {
                 this.$confirm('系统试用期即将结束,请联系开发方购买永久版或申请新的试用许可证!', '提示', {
-                    type: 'warning'
+                    type: 'warning',
+                    showCancelButton: false,
+                    showClose: false,
+                    closeOnClickModal: false
                 })
                 })
             }
             }
             const limitDate = new Date(notAfter).toLocaleDateString('zh-CN')
             const limitDate = new Date(notAfter).toLocaleDateString('zh-CN')

+ 453 - 453
src/store/modules/ibps/modules/page.js

@@ -9,475 +9,475 @@ const defaultIndex = setting.page.opened[0]
 const indexName = 'dashboard'
 const indexName = 'dashboard'
 
 
 export default {
 export default {
-  namespaced: true,
-  state: {
-    // 可以在多页 tab 模式下显示的页面
-    pool: [],
-    // 当前显示的多页面列表
-    opened: setting.page.opened,
-    // 已经加载多标签页数据
-    openedLoaded: false,
-    // 当前页面
-    current: '',
-    // 需要缓存的页面 name
-    keepAlive: []
-  },
-  actions: {
-    /**
-     * @description 确认已经加载多标签页数据
-     * @param {Object} context
-     */
-    isLoaded({ state }) {
-      if (state.openedLoaded) return Promise.resolve()
-      return new Promise(resolve => {
-        const timer = setInterval(() => {
-          if (state.openedLoaded) {
-            resolve(clearInterval(timer))
-          }
-        }, 10)
-      })
+    namespaced: true,
+    state: {
+        // 可以在多页 tab 模式下显示的页面
+        pool: [],
+        // 当前显示的多页面列表
+        opened: setting.page.opened,
+        // 已经加载多标签页数据
+        openedLoaded: false,
+        // 当前页面
+        current: '',
+        // 需要缓存的页面 name
+        keepAlive: []
     },
     },
-    /**
-     * @class opened
-     * @description 从持久化数据载入标签页列表
-     * @param {Object} context
-     */
-    openedLoad({ state, commit, dispatch }) {
-      return new Promise(async resolve => {
-        // store 赋值
-        const value = await dispatch('ibps/db/get', {
-          dbName: 'sys',
-          path: 'page.opened',
-          defaultValue: setting.page.opened,
-          user: true
-        }, { root: true })
-        // 在处理函数中进行数据优化 过滤掉现在已经失效的页签或者已经改变了信息的页签
-        // 以 fullPath 字段为准
-        // 如果页面过多的话可能需要优化算法
-        // valid 有效列表 1, 1, 0, 1 => 有效, 有效, 失效, 有效
-        const valid = []
-        let hasIndex = false
-        // 处理数据
-        const opened = value.map(opened => {
-          // 忽略首页
-          if (opened.fullPath === defaultIndex.fullPath || opened.name === defaultIndex.name) {
-            hasIndex = true
-            valid.push(1)
-            return opened
-          }
-          // 尝试在所有的支持多标签页的页面里找到 name 匹配的页面
-          const find = state.pool.find(item => item.name === opened.name)
-          // 记录有效或无效信息
-          valid.push(find ? 1 : 0)
-          // 返回合并后的数据 新的覆盖旧的
-          // 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
-          return Object.assign({}, opened, find)
-        }).filter((opened, index) => valid[index] === 1)
+    actions: {
+        /**
+         * @description 确认已经加载多标签页数据
+         * @param {Object} context
+         */
+        isLoaded ({ state }) {
+            if (state.openedLoaded) return Promise.resolve()
+            return new Promise(resolve => {
+                const timer = setInterval(() => {
+                    if (state.openedLoaded) {
+                        resolve(clearInterval(timer))
+                    }
+                }, 10)
+            })
+        },
+        /**
+         * @class opened
+         * @description 从持久化数据载入标签页列表
+         * @param {Object} context
+         */
+        openedLoad ({ state, commit, dispatch }) {
+            return new Promise(async resolve => {
+                // store 赋值
+                const value = await dispatch('ibps/db/get', {
+                    dbName: 'sys',
+                    path: 'page.opened',
+                    defaultValue: setting.page.opened,
+                    user: true
+                }, { root: true })
+                // 在处理函数中进行数据优化 过滤掉现在已经失效的页签或者已经改变了信息的页签
+                // 以 fullPath 字段为准
+                // 如果页面过多的话可能需要优化算法
+                // valid 有效列表 1, 1, 0, 1 => 有效, 有效, 失效, 有效
+                const valid = []
+                let hasIndex = false
+                // 处理数据
+                const opened = value.map(opened => {
+                    // 忽略首页
+                    if (opened.fullPath === defaultIndex.fullPath || opened.name === defaultIndex.name) {
+                        hasIndex = true
+                        valid.push(1)
+                        return opened
+                    }
+                    // 尝试在所有的支持多标签页的页面里找到 name 匹配的页面
+                    const find = state.pool.find(item => item.name === opened.name)
+                    // 记录有效或无效信息
+                    valid.push(find ? 1 : 0)
+                    // 返回合并后的数据 新的覆盖旧的
+                    // 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
+                    return Object.assign({}, opened, find)
+                }).filter((opened, index) => valid[index] === 1)
 
 
-        // 判断是否有首页,避免为空,首页丢失
-        if (!hasIndex) {
-          opened.unshift(defaultIndex)
-        }
+                // 判断是否有首页,避免为空,首页丢失
+                if (!hasIndex) {
+                    opened.unshift(defaultIndex)
+                }
 
 
-        state.opened = opened
+                state.opened = opened
 
 
-        // 标记已经加载多标签页数据
-        state.openedLoaded = true
-        // 根据 opened 数据生成缓存设置
-        commit('keepAliveRefresh')
-        // end
-        resolve()
-      })
-    },
-    /**
-     * 将 opened 属性赋值并持久化 在这之前请先确保已经更新了 state.opened
-     * @param {Object} context
-     */
-    openIbpsdb({ state, dispatch }) {
-      return new Promise(async resolve => {
-        // 设置数据
-        dispatch('ibps/db/set', {
-          dbName: 'sys',
-          path: 'page.opened',
-          value: state.opened,
-          user: true
-        }, { root: true })
-        // end
-        resolve()
-      })
-    },
-    /**
-     * @class opened
-     * @description 更新页面列表上的某一项
-     * @param {Object} context
-     * @param {Object} payload { index, params, query, fullPath } 路由信息
-     */
-    openedUpdate({ state, commit, dispatch }, { index, params, query, fullPath }) {
-      return new Promise(async resolve => {
-        // 更新页面列表某一项
-        const page = state.opened[index]
-        page.params = params || page.params
-        page.query = query || page.query
-        page.fullPath = fullPath || page.fullPath
-        state.opened.splice(index, 1, page)
-        // 增加缓存设置
-        if (isKeepAlive(page)) {
-          commit('keepAlivePush', page.name)
-        }
-        // 持久化
-        await dispatch('openIbpsdb')
-        // end
-        resolve()
-      })
-    },
-    /**
-     * @class opened
-     * @description 重排页面列表上的某一项
-     * @param {Object} context
-     * @param {Object} payload { oldIndex, newIndex } 位置信息
-     */
-    openedSort({ state, commit, dispatch }, { oldIndex, newIndex }) {
-      return new Promise(async resolve => {
-        // 重排页面列表某一项
-        const page = state.opened[oldIndex]
-        state.opened.splice(oldIndex, 1)
-        state.opened.splice(newIndex, 0, page)
-        // 持久化
-        await dispatch('openIbpsdb')
-        // end
-        resolve()
-      })
-    },
-    /**
-     * @class opened
-     * @description 新增一个 tag (打开一个页面)
-     * @param {Object} context
-     * @param {Object} payload new tag info
-     */
-    add({ state, commit, dispatch }, { tag, params, query, fullPath }) {
-      return new Promise(async resolve => {
-        // 设置新的 tag 在新打开一个以前没打开过的页面时使用
-        const newTag = tag
-        newTag.params = params || newTag.params
-        newTag.query = query || newTag.query
-        newTag.fullPath = fullPath || newTag.fullPath
-        // 添加进当前显示的页面数组
-        state.opened.push(newTag)
-        // 如果这个页面需要缓存 将其添加到缓存设置
-        if (isKeepAlive(newTag)) {
-          commit('keepAlivePush', tag.name)
-        }
-        // 持久化
-        await dispatch('openIbpsdb')
-        // end
-        resolve()
-      })
-    },
-    /**
-     * @class current
-     * @description 打开一个新的页面
-     * @param {Object} context
-     * @param {Object} payload 从路由钩子的 to 对象上获取 { name, params, query, fullPath } 路由信息
-     */
-    open({ state, commit, dispatch }, { name, params, query, fullPath, meta }) {
-      return new Promise(async resolve => {
-        // 已经打开的页面
-        const opened = state.opened
-        // 判断此页面是否已经打开 并且记录位置
-        let pageOpendIndex = 0
-        const pageOpend = opened.find((page, index) => {
-          // 修复别名进入的
-          const same = (meta && page.meta && page.meta.name === meta.name) ? true : page.fullPath === fullPath
-          pageOpendIndex = same ? index : pageOpendIndex
-          return same
-        })
-        if (pageOpend) {
-          // 页面以前打开过
-          await dispatch('openedUpdate', {
-            index: pageOpendIndex,
-            params,
-            query,
-            fullPath
-          })
-        } else {
-          // 页面以前没有打开过
-          const page = state.pool.find(t => t.name === name)
-          // 如果这里没有找到 page 代表这个路由虽然在框架内 但是不参与标签页显示
-          if (page) {
-            await dispatch('add', {
-              tag: Object.assign({}, page),
-              params,
-              query,
-              fullPath
+                // 标记已经加载多标签页数据
+                state.openedLoaded = true
+                // 根据 opened 数据生成缓存设置
+                commit('keepAliveRefresh')
+                // end
+                resolve()
             })
             })
-          }
-        }
-        commit('currentSet', fullPath)
-        // end
-        resolve()
-      })
-    },
-    /**
-     * @class opened
-     * @description 关闭一个 tag (关闭一个页面)
-     * @param {Object} context
-     * @param {Object} payload { tagName: 要关闭的标签名字 }
-     */
-    close({ state, commit, dispatch }, { pageSelect }) {
-      return new Promise(async resolve => {
-        const pageAim = pageSelect || state.current
-        if (defaultIndex.fullPath === pageAim) {
-          return
-        }
+        },
+        /**
+         * 将 opened 属性赋值并持久化 在这之前请先确保已经更新了 state.opened
+         * @param {Object} context
+         */
+        openIbpsdb ({ state, dispatch }) {
+            return new Promise(async resolve => {
+                // 设置数据
+                dispatch('ibps/db/set', {
+                    dbName: 'sys',
+                    path: 'page.opened',
+                    value: state.opened,
+                    user: true
+                }, { root: true })
+                // end
+                resolve()
+            })
+        },
+        /**
+         * @class opened
+         * @description 更新页面列表上的某一项
+         * @param {Object} context
+         * @param {Object} payload { index, params, query, fullPath } 路由信息
+         */
+        openedUpdate ({ state, commit, dispatch }, { index, params, query, fullPath }) {
+            return new Promise(async resolve => {
+                // 更新页面列表某一项
+                const page = state.opened[index]
+                page.params = params || page.params
+                page.query = query || page.query
+                page.fullPath = fullPath || page.fullPath
+                state.opened.splice(index, 1, page)
+                // 增加缓存设置
+                if (isKeepAlive(page)) {
+                    commit('keepAlivePush', page.name)
+                }
+                // 持久化
+                await dispatch('openIbpsdb')
+                // end
+                resolve()
+            })
+        },
+        /**
+         * @class opened
+         * @description 重排页面列表上的某一项
+         * @param {Object} context
+         * @param {Object} payload { oldIndex, newIndex } 位置信息
+         */
+        openedSort ({ state, commit, dispatch }, { oldIndex, newIndex }) {
+            return new Promise(async resolve => {
+                // 重排页面列表某一项
+                const page = state.opened[oldIndex]
+                state.opened.splice(oldIndex, 1)
+                state.opened.splice(newIndex, 0, page)
+                // 持久化
+                await dispatch('openIbpsdb')
+                // end
+                resolve()
+            })
+        },
+        /**
+         * @class opened
+         * @description 新增一个 tag (打开一个页面)
+         * @param {Object} context
+         * @param {Object} payload new tag info
+         */
+        add ({ state, commit, dispatch }, { tag, params, query, fullPath }) {
+            return new Promise(async resolve => {
+                // 设置新的 tag 在新打开一个以前没打开过的页面时使用
+                const newTag = tag
+                newTag.params = params || newTag.params
+                newTag.query = query || newTag.query
+                newTag.fullPath = fullPath || newTag.fullPath
+                // 添加进当前显示的页面数组
+                state.opened.push(newTag)
+                // 如果这个页面需要缓存 将其添加到缓存设置
+                if (isKeepAlive(newTag)) {
+                    commit('keepAlivePush', tag.name)
+                }
+                // 持久化
+                await dispatch('openIbpsdb')
+                // end
+                resolve()
+            })
+        },
+        /**
+         * @class current
+         * @description 打开一个新的页面
+         * @param {Object} context
+         * @param {Object} payload 从路由钩子的 to 对象上获取 { name, params, query, fullPath } 路由信息
+         */
+        open ({ state, commit, dispatch }, { name, params, query, fullPath, meta }) {
+            return new Promise(async resolve => {
+                // 已经打开的页面
+                const opened = state.opened
+                // 判断此页面是否已经打开 并且记录位置
+                let pageOpendIndex = 0
+                const pageOpend = opened.find((page, index) => {
+                    // 修复别名进入的
+                    const same = (meta && page.meta && page.meta.name === meta.name) ? true : page.fullPath === fullPath
+                    pageOpendIndex = same ? index : pageOpendIndex
+                    return same
+                })
+                if (pageOpend) {
+                    // 页面以前打开过
+                    await dispatch('openedUpdate', {
+                        index: pageOpendIndex,
+                        params,
+                        query,
+                        fullPath
+                    })
+                } else {
+                    // 页面以前没有打开过
+                    const page = state.pool.find(t => t.name === name)
+                    // 如果这里没有找到 page 代表这个路由虽然在框架内 但是不参与标签页显示
+                    if (page) {
+                        await dispatch('add', {
+                            tag: Object.assign({}, page),
+                            params,
+                            query,
+                            fullPath
+                        })
+                    }
+                }
+                commit('currentSet', fullPath)
+                // end
+                resolve()
+            })
+        },
+        /**
+         * @class opened
+         * @description 关闭一个 tag (关闭一个页面)
+         * @param {Object} context
+         * @param {Object} payload { tagName: 要关闭的标签名字 }
+         */
+        close ({ state, commit, dispatch }, { pageSelect }) {
+            return new Promise(async resolve => {
+                const pageAim = pageSelect || state.current
+                if (defaultIndex.fullPath === pageAim) {
+                    return
+                }
 
 
-        // 预定下个新页面
-        let newPage = {}
-        const isCurrent = state.current === pageAim
-        // 如果关闭的页面就是当前显示的页面
-        if (isCurrent) {
-          // 去找一个新的页面
-          const len = state.opened.length
-          for (let i = 0; i < len; i++) {
-            if (state.opened[i].fullPath === pageAim) {
-              newPage = i < len - 1 ? state.opened[i + 1] : state.opened[i - 1]
-              break
-            }
-          }
-        }
-        // 找到这个页面在已经打开的数据里是第几个
-        const index = state.opened.findIndex(page => page.fullPath === pageAim)
-        if (index >= 0) {
-          // 如果这个页面是缓存的页面 将其在缓存设置中删除
-          commit('keepAliveRemove', state.opened[index].name)
-          // 更新数据 删除关闭的页面
-          state.opened.splice(index, 1)
-        }
-        // 持久化
-        await dispatch('openIbpsdb')
-        // 决定最后停留的页面
-        if (isCurrent) {
-          const { name = indexName, params = {}, query = {}} = newPage
-          const routerObj = { name, params, query }
-          await router.push(routerObj)
-        }
-        // end
-        resolve()
-      })
-    },
-    /**
-     * @class opened
-     * @description 关闭当前标签左边的标签
-     * @param {Object} context
-     * @param {Object} payload { pageSelect: 当前选中的tagName }
-     */
-    closeLeft({ state, commit, dispatch }, { pageSelect } = {}) {
-      return new Promise(async resolve => {
-        const pageAim = pageSelect || state.current
-        let currentIndex = 0
-        state.opened.forEach((page, index) => {
-          if (page.fullPath === pageAim) {
-            currentIndex = index
-          }
-        })
-        if (currentIndex > 0) {
-          // 删除打开的页面 并在缓存设置中删除
-          for (let i = state.opened.length - 1; i >= 0; i--) {
-            if (state.opened[i].name === indexName || i >= currentIndex) {
-              continue
-            }
+                // 预定下个新页面
+                let newPage = {}
+                const isCurrent = state.current === pageAim
+                // 如果关闭的页面就是当前显示的页面
+                if (isCurrent) {
+                    // 去找一个新的页面
+                    const len = state.opened.length
+                    for (let i = 0; i < len; i++) {
+                        if (state.opened[i].fullPath === pageAim) {
+                            newPage = i < len - 1 ? state.opened[i + 1] : state.opened[i - 1]
+                            break
+                        }
+                    }
+                }
+                // 找到这个页面在已经打开的数据里是第几个
+                const index = state.opened.findIndex(page => page.fullPath === pageAim)
+                if (index >= 0) {
+                    // 如果这个页面是缓存的页面 将其在缓存设置中删除
+                    commit('keepAliveRemove', state.opened[index].name)
+                    // 更新数据 删除关闭的页面
+                    state.opened.splice(index, 1)
+                }
+                // 持久化
+                await dispatch('openIbpsdb')
+                // 决定最后停留的页面
+                if (isCurrent) {
+                    const { name = indexName, params = {}, query = {}} = newPage
+                    const routerObj = { name, params, query }
+                    await router.push(routerObj)
+                }
+                // end
+                resolve()
+            })
+        },
+        /**
+         * @class opened
+         * @description 关闭当前标签左边的标签
+         * @param {Object} context
+         * @param {Object} payload { pageSelect: 当前选中的tagName }
+         */
+        closeLeft ({ state, commit, dispatch }, { pageSelect } = {}) {
+            return new Promise(async resolve => {
+                const pageAim = pageSelect || state.current
+                let currentIndex = 0
+                state.opened.forEach((page, index) => {
+                    if (page.fullPath === pageAim) {
+                        currentIndex = index
+                    }
+                })
+                if (currentIndex > 0) {
+                    // 删除打开的页面 并在缓存设置中删除
+                    for (let i = state.opened.length - 1; i >= 0; i--) {
+                        if (state.opened[i].name === indexName || i >= currentIndex) {
+                            continue
+                        }
 
 
-            commit('keepAliveRemove', state.opened[i].name)
-            state.opened.splice(i, 1)
-          }
-        }
-        // 持久化
-        await dispatch('openIbpsdb')
-        // 设置当前的页面
-        state.current = pageAim
-        if (router.app.$route.fullPath !== pageAim) {
-          await router.push(pageAim)
-        }
-        // end
-        resolve()
-      })
-    },
-    /**
-     * @class opened
-     * @description 关闭当前标签右边的标签
-     * @param {Object} context
-     * @param {Object} payload { pageSelect: 当前选中的tagName }
-     */
-    closeRight({ state, commit, dispatch }, { pageSelect } = {}) {
-      return new Promise(async resolve => {
-        const pageAim = pageSelect || state.current
-        let currentIndex = 0
-        state.opened.forEach((page, index) => {
-          if (page.fullPath === pageAim) {
-            currentIndex = index
-          }
-        })
-        // 删除打开的页面 并在缓存设置中删除
-        for (let i = state.opened.length - 1; i >= 0; i--) {
-          if (state.opened[i].name === indexName || currentIndex >= i) {
-            continue
-          }
+                        commit('keepAliveRemove', state.opened[i].name)
+                        state.opened.splice(i, 1)
+                    }
+                }
+                // 持久化
+                await dispatch('openIbpsdb')
+                // 设置当前的页面
+                state.current = pageAim
+                if (router.app.$route.fullPath !== pageAim) {
+                    await router.push(pageAim)
+                }
+                // end
+                resolve()
+            })
+        },
+        /**
+         * @class opened
+         * @description 关闭当前标签右边的标签
+         * @param {Object} context
+         * @param {Object} payload { pageSelect: 当前选中的tagName }
+         */
+        closeRight ({ state, commit, dispatch }, { pageSelect } = {}) {
+            return new Promise(async resolve => {
+                const pageAim = pageSelect || state.current
+                let currentIndex = 0
+                state.opened.forEach((page, index) => {
+                    if (page.fullPath === pageAim) {
+                        currentIndex = index
+                    }
+                })
+                // 删除打开的页面 并在缓存设置中删除
+                for (let i = state.opened.length - 1; i >= 0; i--) {
+                    if (state.opened[i].name === indexName || currentIndex >= i) {
+                        continue
+                    }
 
 
-          commit('keepAliveRemove', state.opened[i].name)
-          state.opened.splice(i, 1)
-        }
-        // 持久化
-        await dispatch('openIbpsdb')
-        // 设置当前的页面
-        state.current = pageAim
-        if (router.app.$route.fullPath !== pageAim) {
-          await router.push(pageAim)
-        }
+                    commit('keepAliveRemove', state.opened[i].name)
+                    state.opened.splice(i, 1)
+                }
+                // 持久化
+                await dispatch('openIbpsdb')
+                // 设置当前的页面
+                state.current = pageAim
+                if (router.app.$route.fullPath !== pageAim) {
+                    await router.push(pageAim)
+                }
 
 
-        // end
-        resolve()
-      })
-    },
-    /**
-     * @class opened
-     * @description 关闭当前激活之外的 tag
-     * @param {Object} context
-     * @param {Object} payload { pageSelect: 当前选中的tagName }
-     */
-    closeOther({ state, commit, dispatch }, { pageSelect } = {}) {
-      return new Promise(async resolve => {
-        const pageAim = pageSelect || state.current
-        let currentIndex = 0
-        state.opened.forEach((page, index) => {
-          if (page.fullPath === pageAim) {
-            currentIndex = index
-          }
-        })
-        // 删除打开的页面数据 并更新缓存设置
-        for (let i = state.opened.length - 1; i >= 0; i--) {
-          if (state.opened[i].name === indexName || currentIndex === i) {
-            continue
-          }
+                // end
+                resolve()
+            })
+        },
+        /**
+         * @class opened
+         * @description 关闭当前激活之外的 tag
+         * @param {Object} context
+         * @param {Object} payload { pageSelect: 当前选中的tagName }
+         */
+        closeOther ({ state, commit, dispatch }, { pageSelect } = {}) {
+            return new Promise(async resolve => {
+                const pageAim = pageSelect || state.current
+                let currentIndex = 0
+                state.opened.forEach((page, index) => {
+                    if (page.fullPath === pageAim) {
+                        currentIndex = index
+                    }
+                })
+                // 删除打开的页面数据 并更新缓存设置
+                for (let i = state.opened.length - 1; i >= 0; i--) {
+                    if (state.opened[i].name === indexName || currentIndex === i) {
+                        continue
+                    }
 
 
-          commit('keepAliveRemove', state.opened[i].name)
-          state.opened.splice(i, 1)
-        }
-        // 持久化
-        await dispatch('openIbpsdb')
-        // 设置新的页面
-        state.current = pageAim
-        if (router.app.$route.fullPath !== pageAim) {
-          router.push(pageAim)
-        }
+                    commit('keepAliveRemove', state.opened[i].name)
+                    state.opened.splice(i, 1)
+                }
+                // 持久化
+                await dispatch('openIbpsdb')
+                // 设置新的页面
+                state.current = pageAim
+                if (router.app.$route.fullPath !== pageAim) {
+                    router.push(pageAim)
+                }
 
 
-        // end
-        resolve()
-      })
-    },
-    /**
-     * @class opened
-     * @description 关闭所有 tag
-     * @param {Object} context
-     */
-    closeAll({ state, commit, dispatch }) {
-      return new Promise(async resolve => {
-        // 删除打开的页面 并在缓存设置中删除
-        for (let i = state.opened.length - 1; i >= 0; i--) {
-          if (state.opened[i].name === indexName) {
-            continue
-          }
+                // end
+                resolve()
+            })
+        },
+        /**
+         * @class opened
+         * @description 关闭所有 tag
+         * @param {Object} context
+         */
+        closeAll ({ state, commit, dispatch }) {
+            return new Promise(async resolve => {
+                // 删除打开的页面 并在缓存设置中删除
+                for (let i = state.opened.length - 1; i >= 0; i--) {
+                    if (state.opened[i].name === indexName) {
+                        continue
+                    }
 
 
-          commit('keepAliveRemove', state.opened[i].name)
-          state.opened.splice(i, 1)
-        }
-        // 持久化
-        await dispatch('openIbpsdb')
-        // 关闭所有的标签页后需要判断一次现在是不是在首页,不是则导航到首页
-        if (router.app.$route.name !== defaultIndex.name) {
-          router.push({
-            name: defaultIndex.name
-          })
+                    commit('keepAliveRemove', state.opened[i].name)
+                    state.opened.splice(i, 1)
+                }
+                // 持久化
+                await dispatch('openIbpsdb')
+                // 关闭所有的标签页后需要判断一次现在是不是在首页,不是则导航到首页
+                if (router.app.$route.name !== defaultIndex.name) {
+                    router.push({
+                        name: defaultIndex.name
+                    })
+                }
+                // end
+                resolve()
+            })
         }
         }
-        // end
-        resolve()
-      })
-    }
-  },
-  mutations: {
-    /**
-     * @class keepAlive
-     * @description 从已经打开的页面记录中更新需要缓存的页面记录
-     * @param {Object} state state
-     */
-    keepAliveRefresh(state) {
-      state.keepAlive = state.opened.filter(item => isKeepAlive(item)).map(e => e.name)
     },
     },
-    /**
-     * @description 删除一个页面的缓存设置
-     * @param {Object} state state
-     * @param {String} name name
-     */
-    keepAliveRemove(state, name) {
-      const list = [...state.keepAlive]
-      const index = list.findIndex(item => item === name)
+    mutations: {
+        /**
+         * @class keepAlive
+         * @description 从已经打开的页面记录中更新需要缓存的页面记录
+         * @param {Object} state state
+         */
+        keepAliveRefresh (state) {
+            state.keepAlive = state.opened.filter(item => isKeepAlive(item)).map(e => e.name)
+        },
+        /**
+         * @description 删除一个页面的缓存设置
+         * @param {Object} state state
+         * @param {String} name name
+         */
+        keepAliveRemove (state, name) {
+            const list = [...state.keepAlive]
+            const index = list.findIndex(item => item === name)
 
 
-      if (index !== -1) {
-        list.splice(index, 1)
-        state.keepAlive = list
-      }
-    },
-    /**
-     * @description 增加一个页面的缓存设置
-     * @param {Object} state state
-     * @param {String} name name
-     */
-    keepAlivePush(state, name) {
-      const keep = [...state.keepAlive]
-      const index = keep.findIndex(item => item === name)
-      if (index === -1) {
-        keep.push(name)
-      }
-      state.keepAlive = keep
-    },
-    /**
-     * @description 清空页面缓存设置
-     * @param {Object} state state
-     */
-    keepAliveClean(state) {
-      state.keepAlive = []
-    },
-    /**
-     * @class current
-     * @description 设置当前激活的页面 fullPath
-     * @param {Object} state state
-     * @param {String} fullPath new fullPath
-     */
-    currentSet(state, fullPath) {
-      state.current = fullPath
-    },
-    /**
-     * @class init
-     * @description 初始化 pool (候选池)
-     * @param {Object} state state
-     * @param {Array} routes routes
-     */
-    init(state, routes) {
-      const pool = []
-      if (routes && routes.length > 0) {
-        const push = function(routes) {
-          routes.forEach(route => {
-            if (route.children && route.children.length > 0) {
-              push(route.children)
-            } else {
-              if (!route.hidden) {
-                const { meta, name, path } = route
-                pool.push({ meta, name, path })
-              }
+            if (index !== -1) {
+                list.splice(index, 1)
+                state.keepAlive = list
+            }
+        },
+        /**
+         * @description 增加一个页面的缓存设置
+         * @param {Object} state state
+         * @param {String} name name
+         */
+        keepAlivePush (state, name) {
+            const keep = [...state.keepAlive]
+            const index = keep.findIndex(item => item === name)
+            if (index === -1) {
+                keep.push(name)
+            }
+            state.keepAlive = keep
+        },
+        /**
+         * @description 清空页面缓存设置
+         * @param {Object} state state
+         */
+        keepAliveClean (state) {
+            state.keepAlive = []
+        },
+        /**
+         * @class current
+         * @description 设置当前激活的页面 fullPath
+         * @param {Object} state state
+         * @param {String} fullPath new fullPath
+         */
+        currentSet (state, fullPath) {
+            state.current = fullPath
+        },
+        /**
+         * @class init
+         * @description 初始化 pool (候选池)
+         * @param {Object} state state
+         * @param {Array} routes routes
+         */
+        init (state, routes) {
+            const pool = []
+            if (routes && routes.length > 0) {
+                const push = function (routes) {
+                    routes.forEach(route => {
+                        if (route.children && route.children.length > 0) {
+                            push(route.children)
+                        } else {
+                            if (!route.hidden) {
+                                const { meta, name, path } = route
+                                pool.push({ meta, name, path })
+                            }
+                        }
+                    })
+                }
+                push(routes)
             }
             }
-          })
+            state.pool = pool
         }
         }
-        push(routes)
-      }
-      state.pool = pool
     }
     }
-  }
 }
 }

+ 9 - 9
src/store/modules/ibps/modules/releases.js

@@ -2,14 +2,14 @@ import util from '@/utils/util.js'
 import setting from '@/setting.js'
 import setting from '@/setting.js'
 
 
 export default {
 export default {
-  namespaced: true,
-  mutations: {
-    /**
-     * @description 显示版本信息
-     * @param {Object} state state
-     */
-    versionShow() {
-      util.log.capsule('ibps', `v${setting.releases.version}`)
+    namespaced: true,
+    mutations: {
+        /**
+         * @description 显示版本信息
+         * @param {Object} state state
+         */
+        versionShow () {
+            util.log.capsule('ibps', `v${setting.releases.version}`)
+        }
     }
     }
-  }
 }
 }

+ 23 - 27
src/utils/request.js

@@ -59,7 +59,7 @@ let requestCount = 0
  *
  *
  * get请求,统一参数放在params里面,后台对应只有@RequestParam
  * get请求,统一参数放在params里面,后台对应只有@RequestParam
  * `params`是即将与请求一起发送的 URL 参数,必须是一个无格式对象(plain object)或 URLSearchParams 对象
  * `params`是即将与请求一起发送的 URL 参数,必须是一个无格式对象(plain object)或 URLSearchParams 对象
- * 
+ *
  * post请求,统一参数放在data里面——json格式,后台对应@RequestBody ,其他 后台对应@RequestParam
  * post请求,统一参数放在data里面——json格式,后台对应@RequestBody ,其他 后台对应@RequestParam
  * `data` 是作为请求主体被发送的数据
  * `data` 是作为请求主体被发送的数据
  * 只适用于这些请求方法 'PUT', 'POST', 和 'PATCH'
  * 只适用于这些请求方法 'PUT', 'POST', 和 'PATCH'
@@ -130,7 +130,7 @@ service.interceptors.request.use(async config => {
  * 响应(respone)拦截器
  * 响应(respone)拦截器
  */
  */
 service.interceptors.response.use(response => {
 service.interceptors.response.use(response => {
-    //临时关闭了保存等待的取消功能
+    // 临时关闭了保存等待的取消功能
     tryHideFullScreenLoading()
     tryHideFullScreenLoading()
 
 
     const dataAxios = response.data
     const dataAxios = response.data
@@ -194,9 +194,7 @@ service.interceptors.response.use(response => {
         state === requestState.OTHER_CLIENTS) {
         state === requestState.OTHER_CLIENTS) {
         if (!cancelRequest) {
         if (!cancelRequest) {
             cancelRequest = false
             cancelRequest = false
-            MessageBox.confirm(
-                I18n.t('error.logout.message'),
-                I18n.t('error.logout.title'), {
+            MessageBox.confirm(I18n.t('error.logout.message'), I18n.t('error.logout.title'), {
                 confirmButtonText: I18n.t('error.logout.confirmButtonText'),
                 confirmButtonText: I18n.t('error.logout.confirmButtonText'),
                 cancelButtonText: I18n.t('error.logout.cancelButtonText'),
                 cancelButtonText: I18n.t('error.logout.cancelButtonText'),
                 type: 'warning'
                 type: 'warning'
@@ -248,30 +246,28 @@ service.interceptors.response.use(response => {
         err.cause = cause
         err.cause = cause
         return Promise.reject(err)
         return Promise.reject(err)
     }
     }
-},
+}, error => {
     // 异常处理
     // 异常处理
-    error => {
-        tryHideFullScreenLoading()
-        // for debug
-        console.error('request-error', error)
-        if (error && error.response) {
-            error.message = I18n.t('error.status.' + error.response.status, {
-                url: error.response.config.url
-            })
-        } else {
-            error.state = 500
-            // '服务器君开小差了,请稍后再试'
-            error.message = I18n.t('error.network')
-        }
-        Message.closeAll()
-        Message({
-            message: error.message || I18n.t('error.network'),
-            type: 'error',
-            showClose: true,
-            duration: 5 * 1000
+    tryHideFullScreenLoading()
+    // for debug
+    console.error('request-error', error)
+    if (error && error.response) {
+        error.message = I18n.t('error.status.' + error.response.status, {
+            url: error.response.config.url
         })
         })
-        return Promise.reject(error)
+    } else {
+        error.state = 500
+        // '服务器君开小差了,请稍后再试'
+        error.message = I18n.t('error.network')
     }
     }
-)
+    Message.closeAll()
+    Message({
+        message: error.message || I18n.t('error.network'),
+        type: 'error',
+        showClose: true,
+        duration: 5 * 1000
+    })
+    return Promise.reject(error)
+})
 
 
 export default service
 export default service

+ 148 - 0
src/views/system/licence/index.vue

@@ -0,0 +1,148 @@
+<template>
+    <ibps-container
+        type="full"
+        header-background-color
+        class="licence"
+    >
+        <div class="licence-container">
+            <div class="title">
+                <span>许可证信息</span>
+                <span>{{ `(${licence.isTrialVersion ? '试用版' : '正式版'})` }}</span>
+                <el-button
+                    v-if="licence.isTrialVersion"
+                    type="success"
+                    size="mini"
+                    @click="licenceFormVisible = true"
+                ><i class="el-icon-refresh el-icon--left" />更新</el-button>
+            </div>
+            <div class="card">
+                <div class="item">
+                    <div class="label">单位名称</div>
+                    <div class="value">{{ licence.customerInfo }}</div>
+                </div>
+                <div class="item">
+                    <div class="label">发布时间</div>
+                    <div class="value">{{ transformDate(licence.issuedTime) }}</div>
+                </div>
+                <div class="item">
+                    <div class="label">生效时间</div>
+                    <div class="value">{{ transformDate(licence.notBefore) }}</div>
+                </div>
+                <template v-if="licence.isTrialVersion">
+                    <div class="item">
+                        <div class="label">失效时间</div>
+                        <div class="value">{{ transformDate(licence.notAfter) }}</div>
+                    </div>
+                    <div class="item">
+                        <div class="label">到期提醒天数</div>
+                        <div class="value">{{ licence.reminderDays }}</div>
+                    </div>
+                </template>
+                <div class="item">
+                    <div class="label">状态</div>
+                    <div class="value">
+                        <el-tag :type="state"> {{ status[state] }} </el-tag>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <update-licence
+            :visible="licenceFormVisible"
+            :username="account"
+            @close="visible => licenceFormVisible = visible"
+        />
+    </ibps-container>
+</template>
+<script>
+
+export default {
+    components: {
+        updateLicence: () => import('@/views/system/licence/update')
+    },
+    data () {
+        const { account = '', licence = {}} = this.$store.getters
+        return {
+            licenceFormVisible: false,
+            account,
+            licence,
+            status: {
+                success: '正常',
+                warning: '即将到期',
+                danger: '过期'
+            }
+        }
+    },
+    computed: {
+        state () {
+            const { isTrialVersion, needRemind, overtime } = this.licence || {}
+            if (!isTrialVersion) {
+                return 'success'
+            }
+            if (overtime) {
+                return 'danger'
+            }
+            if (needRemind) {
+                return 'warning'
+            }
+            return 'success'
+        }
+    },
+    mounted () {
+        console.log(this.licence)
+    },
+    methods: {
+        handUpdate () {
+            this.licenceFormVisible = true
+        },
+        transformDate (v) {
+            return new Date(v).toLocaleString('zh-CN', { hour12: false }).replace(/\//g, '-')
+        }
+    }
+}
+</script>
+<style lang="scss" scoped>
+.licence-container {
+    width: 1080px;
+    margin: 20px auto;
+    height: calc(100% - 100px);
+    padding: 20px;
+    border: 1px solid #ccc;
+    border-radius: 10px;
+    background-color: #f9f9f9;
+    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
+    transition: transform 0.2s;
+    .title {
+        font-size: 24px;
+        font-weight: bold;
+        margin-bottom: 20px;
+        display: flex;
+        align-items: center;
+    }
+    .card {
+        display: flex;
+        flex-wrap: wrap;
+        justify-content: space-between;
+        .item {
+            width: 100%;
+            margin-bottom: 20px;
+            padding: 15px;
+            border: 1px solid #ccc;
+            border-radius: 5px;
+            background-color: #fff;
+            transition: transform 0.2s;
+            &:hover {
+                transform: scale(1.03);
+            }
+            .label {
+                font-size: 16px;
+                font-weight: bold;
+                margin-bottom: 10px;
+            }
+            .value {
+                font-size: 16px;
+                color: #666;
+            }
+        }
+    }
+}
+</style>

+ 13 - 4
src/views/system/auth/update.vue → src/views/system/licence/update.vue

@@ -40,7 +40,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-
+import { updateLicence } from '@/api/oauth2/user'
 export default {
 export default {
     props: {
     props: {
         visible: {
         visible: {
@@ -51,7 +51,10 @@ export default {
             type: String,
             type: String,
             default: '更新许可证'
             default: '更新许可证'
         },
         },
-        categoryKey: String
+        username: {
+            type: String,
+            default: ''
+        }
     },
     },
     data () {
     data () {
         return {
         return {
@@ -109,8 +112,14 @@ export default {
         },
         },
         // 提交保存数据
         // 提交保存数据
         saveData () {
         saveData () {
-            this.$message.success('更新许可证成功,请重新登录!')
-            this.closeDialog()
+            updateLicence({
+                username: this.username,
+                license: this.formModel.licenceKey
+            }).then(res => {
+                console.log(res)
+                this.$message.success('更新许可证成功,请重新登录!')
+                this.closeDialog()
+            })
         },
         },
         // 关闭当前窗口
         // 关闭当前窗口
         closeDialog () {
         closeDialog () {

+ 12 - 2
src/views/system/login/user-login.vue

@@ -112,7 +112,11 @@
             class="login-submit"
             class="login-submit"
             @click.native.prevent="handleLogin"
             @click.native.prevent="handleLogin"
         >{{ $t('login.logIn') }}</el-button>
         >{{ $t('login.logIn') }}</el-button>
-        <update-licence :visible="licenceFormVisible" @close="visible => licenceFormVisible = visible" />
+        <update-licence
+            :visible="licenceFormVisible"
+            :username="loginForm.username"
+            @close="visible => licenceFormVisible = visible"
+        />
     </el-form>
     </el-form>
 </template>
 </template>
 
 
@@ -175,7 +179,7 @@ const validateCode = (rule, value, callback) => {
 export default {
 export default {
     name: 'login-form',
     name: 'login-form',
     components: {
     components: {
-        updateLicence: () => import('@/views/system/auth/update')
+        updateLicence: () => import('@/views/system/licence/update')
     },
     },
     data () {
     data () {
         return {
         return {
@@ -373,6 +377,12 @@ export default {
                         }, 1000)
                         }, 1000)
                     }
                     }
                 }).catch((err) => {
                 }).catch((err) => {
+                    if (err && err.state === 6020203) {
+                        // 许可证过期,前台登出
+                        this.$store.dispatch('ibps/account/fedLogout').then(() => {
+                            this.licenceFormVisible = true
+                        })
+                    }
                     // 验证码错误自动清空&密码输入错误5次后触发验证码填写模块
                     // 验证码错误自动清空&密码输入错误5次后触发验证码填写模块
                     if (err && err.state === 6020104) {
                     if (err && err.state === 6020104) {
                         this.loginForm.captcha = ''
                         this.loginForm.captcha = ''