Merge branch 'hotfix/删除版本检查请求' into develop
Former-commit-id: 04e768a1a70c015312ebf924b366394a864127b7 [formerly 04e768a1a70c015312ebf924b366394a864127b7 [formerly 04e768a1a70c015312ebf924b366394a864127b7 [formerly 04e768a1a70c015312ebf924b366394a864127b7 [formerly c89c330bdbf4530c346aa53f62b24d6dd69a0af6 [formerly 2b363b29ae4456a5e01a1eabdbfceb0725c27aec]]]]] Former-commit-id: aa1be54dc28950d54f063974f5cc55a1c393d81d Former-commit-id: 5437ec4c6a0d915a56a44e73daab056aad158d91 Former-commit-id: ad5c726748f68c4aea330e2942163489c621a3ef [formerly 126a2891417d76de8dfd6bcb549c27c03cb96648] Former-commit-id: 1e7f42e4d019638a5d8a4bfe8a0b301a92e8d63f Former-commit-id: eeecdb49bae0f933312b148e402f50dbbafef348 Former-commit-id: ca6230a84dbdf2cfe69004b577ce630b862cef6c Former-commit-id: 44cfba583c7574ef8966fb06b5695235cd217d87 Former-commit-id: fd8d16cb0d551735e83f32a87a75d20d5b9759e5
This commit is contained in:
@@ -1 +1 @@
|
||||
3c97ecdb32c4ce5031fe7b3341f49499ac9e47de
|
||||
e6ea0a41cb4fd47248aa8ea156fc3de00668d3e6
|
||||
@@ -67,9 +67,6 @@
|
||||
"text-loader": "0.0.1",
|
||||
"vue-template-compiler": "^2.5.17"
|
||||
},
|
||||
"gitHooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"vue-cli-service lint",
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import request from '@/plugin/axios'
|
||||
|
||||
export function httpGet (url, params = {}) {
|
||||
return request({
|
||||
url,
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function httpPost (url, data = {}) {
|
||||
return request({
|
||||
url,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
@@ -59,8 +59,6 @@ new Vue({
|
||||
mounted () {
|
||||
// 展示系统信息
|
||||
this.$store.commit('d2admin/releases/versionShow')
|
||||
// 检查最新版本
|
||||
this.$store.dispatch('d2admin/releases/checkUpdate')
|
||||
// 用户登录后从数据库加载一系列的设置
|
||||
this.$store.dispatch('d2admin/account/load')
|
||||
// 获取并记录用户 UA
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
<d2-icon-svg style="width: 120px;" name="d2-admin"/>
|
||||
<template slot="footer">
|
||||
<div class="page__btn-group">
|
||||
<span @click="$open('https://github.com/d2-projects')">项目组</span> |
|
||||
<span @click="$open('https://d2-projects.github.io/d2-admin-doc/zh/')">使用文档</span> |
|
||||
<span @click="$open('https://github.com/d2-projects/d2-admin-start-kit')">简化版脚手架</span> |
|
||||
<span @click="$open('https://alibaba.github.io/ice/scaffold?type=vue')">飞冰物料</span> |
|
||||
<span @click="$open('https://juejin.im/user/57a48b632e958a006691b946/posts')">掘金专栏</span> |
|
||||
<span @click="$open('https://github.com/d2-projects')">开源组织</span> |
|
||||
<span @click="$open('https://d2-projects.github.io/d2-admin-doc/zh/')">文档</span> |
|
||||
<span @click="$open('https://github.com/d2-projects/d2-admin-start-kit')">简化版</span> |
|
||||
<span @click="$open('https://alibaba.github.io/ice/scaffold?type=vue')">飞冰</span> |
|
||||
<span @click="$open('https://juejin.im/user/57a48b632e958a006691b946/posts')">掘金</span> |
|
||||
<span @click="$open('https://awesome.fairyever.com/daily/')">程序员日报</span> |
|
||||
<el-popover
|
||||
:width="172"
|
||||
trigger="hover">
|
||||
|
||||
@@ -27,8 +27,7 @@ const setting = {
|
||||
},
|
||||
// 版本
|
||||
releases: {
|
||||
version: version,
|
||||
api: 'https://api.github.com/repos/FairyEver/d2-admin/releases/latest'
|
||||
version
|
||||
},
|
||||
// 菜单搜索
|
||||
search: {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { httpGet } from '@/api/sys/http'
|
||||
import semver from 'semver'
|
||||
import util from '@/libs/util.js'
|
||||
import setting from '@/setting.js'
|
||||
|
||||
@@ -7,33 +5,7 @@ export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
// D2Admin 版本
|
||||
version: setting.releases.version,
|
||||
// 最新版本的信息
|
||||
latest: {},
|
||||
// 有新版本
|
||||
update: false
|
||||
},
|
||||
actions: {
|
||||
/**
|
||||
* @description 检查版本更新
|
||||
* @param {Object} param context
|
||||
*/
|
||||
checkUpdate ({ state, commit }) {
|
||||
httpGet(setting.releases.api)
|
||||
.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)
|
||||
})
|
||||
}
|
||||
version: setting.releases.version
|
||||
},
|
||||
mutations: {
|
||||
/**
|
||||
@@ -44,24 +16,7 @@ export default {
|
||||
util.log.capsule('D2Admin', `v${state.version}`)
|
||||
console.log('Github https://github.com/d2-projects/d2-admin')
|
||||
console.log('Doc https://d2-projects.github.io/d2-admin-doc/zh/')
|
||||
},
|
||||
/**
|
||||
* @description 设置是否有新的 D2Admin 版本
|
||||
* @param {Object} state vuex state
|
||||
* @param {Boolean} update can update
|
||||
*/
|
||||
updateSet (state, update) {
|
||||
// store 赋值
|
||||
state.update = update
|
||||
},
|
||||
/**
|
||||
* @description 设置最新版本的信息
|
||||
* @param {Object} state vuex state
|
||||
* @param {Object}} latest releases value
|
||||
*/
|
||||
latestSet (state, latest) {
|
||||
// store 赋值
|
||||
state.latest = latest
|
||||
console.log('请不要吝啬您的 star,谢谢 ~')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user