简化版本检查代码
Former-commit-id: 4f1bbdc34a208047aa26a37b3a15034f16463e9d [formerly 4f1bbdc34a208047aa26a37b3a15034f16463e9d [formerly 4f1bbdc34a208047aa26a37b3a15034f16463e9d [formerly 4f1bbdc34a208047aa26a37b3a15034f16463e9d [formerly f10219d0337fc94fcad4a395f634ff82da269a2e [formerly 3c58b53fea597ae0fe5418d44133a7e59ee1441e]]]]] Former-commit-id: 94e99a356571ebf8274954ca601c593e8ea93514 Former-commit-id: 1cab1aa58616e215d1a39f4d6a3a7c2453ca2153 Former-commit-id: ed071e422a123fb3094e88a936724e9c65d70888 [formerly 12d167b90bfde092d7521b4041cee7c656d944b7] Former-commit-id: 42a97fc37840b20ca517afabfa28a24bf557625d Former-commit-id: 764d8f4a94a499abbd2aaa9c3307600c13b78028 Former-commit-id: db598cfc092862c94b8bd859f9b941135c124069 Former-commit-id: 77f5ca3d799fe9d4a8bb9b08e5be79686369e361 Former-commit-id: 18c090ca7aaa651db442c4b41d39ba0543a89944
This commit is contained in:
@@ -4,7 +4,7 @@ export default {
|
||||
namespaced: true,
|
||||
actions: {
|
||||
/**
|
||||
* 登陆
|
||||
* @description 登陆
|
||||
* @param {Object} param context
|
||||
* @param {Object} param vm {Object} vue 实例
|
||||
* @param {Object} param username {String} 用户账号
|
||||
@@ -33,7 +33,7 @@ export default {
|
||||
name: res.data.name
|
||||
}, { root: true })
|
||||
// 用户登陆后从持久化数据加载一系列的设置
|
||||
commit('d2admin/account/load', null, { root: true })
|
||||
commit('load')
|
||||
// 跳转路由
|
||||
vm.$router.push({
|
||||
name: 'index'
|
||||
@@ -46,7 +46,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 注销用户并返回登陆页面
|
||||
* @description 注销用户并返回登陆页面
|
||||
* @param {Object} param context
|
||||
* @param {Object} param vm {Object} vue 实例
|
||||
* @param {Object} param confirm {Boolean} 是否需要确认
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// 设置文件
|
||||
import axios from 'axios'
|
||||
import semver from 'semver'
|
||||
import util from '@/libs/util.js'
|
||||
import setting from '@/setting.js'
|
||||
|
||||
export default {
|
||||
@@ -11,7 +13,38 @@ export default {
|
||||
// 有新版本
|
||||
update: false
|
||||
},
|
||||
actions: {
|
||||
/**
|
||||
* @description 检查版本更新
|
||||
* @param {Object} param context
|
||||
*/
|
||||
checkUpdate ({ state, commit }) {
|
||||
axios.get('https://api.github.com/repos/FairyEver/d2-admin/releases/latest')
|
||||
.then(res => {
|
||||
let versionGet = res.tag_name
|
||||
const update = semver.lt(state.version, versionGet)
|
||||
if (update) {
|
||||
util.log.capsule('D2Admin', `New version ${res.name}`)
|
||||
console.log(`版本号: ${res.tag_name} | 详情 ${res.html_url}`)
|
||||
commit('updateSet', true)
|
||||
}
|
||||
commit('latestSet', res)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('checkUpdate error', err)
|
||||
})
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
/**
|
||||
* @description 显示版本信息
|
||||
* @param {Object} state vuex state
|
||||
*/
|
||||
versionShow (state) {
|
||||
util.log.capsule('D2Admin', `v${state.version}`)
|
||||
console.log('Github https://github.com/d2-projects/d2-admin')
|
||||
console.log('Doc http://d2admin.fairyever.com/zh/')
|
||||
},
|
||||
/**
|
||||
* @description 设置是否有新的 D2Admin 版本
|
||||
* @param {Object} state vuex state
|
||||
|
||||
Reference in New Issue
Block a user