Merge branch 'hotfix/删除版本检查请求'

Former-commit-id: 6e2e94aedf3f5466f130cfc22349352f80ab7145 [formerly 6e2e94aedf3f5466f130cfc22349352f80ab7145 [formerly 6e2e94aedf3f5466f130cfc22349352f80ab7145 [formerly 6e2e94aedf3f5466f130cfc22349352f80ab7145 [formerly fbfc76426f2c1552bb306de81ddbe68420f6c3f6 [formerly 1e07b5cf65973de8d7a3a7fa32545a8287a1702c]]]]]
Former-commit-id: 2f0e1b78a1a273be87bdfb57797ef1df85831321
Former-commit-id: a41515ae4be9db509d3362d93ca7a8dff7b4220d
Former-commit-id: a6e4e0fcbaada53e0a49c8d556c9e04fd5bb6978 [formerly 7be01821472369dc9175697adba5bfc1d5dae6ae]
Former-commit-id: 17438896d0f5ad5d62d39fd5026578a9a975e9ce
Former-commit-id: c80844a3d02081717ed857f9cbf55c13ece678dd
Former-commit-id: ce9a71e565de85ddfd13673aab21b18c85196b3f
Former-commit-id: 7a080adc51f2a917cc85c6adaf70788eab0e25c0
Former-commit-id: 22005b5fb2b48fc28b5a4c995a54ecec9b7b677b
This commit is contained in:
liyang
2018-10-23 19:12:45 +08:00
7 changed files with 10 additions and 77 deletions

View File

@@ -1 +1 @@
3c97ecdb32c4ce5031fe7b3341f49499ac9e47de
e6ea0a41cb4fd47248aa8ea156fc3de00668d3e6

View File

@@ -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",

View File

@@ -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
})
}

View File

@@ -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

View File

@@ -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">

View File

@@ -27,8 +27,7 @@ const setting = {
},
// 版本
releases: {
version: version,
api: 'https://api.github.com/repos/FairyEver/d2-admin/releases/latest'
version
},
// 菜单搜索
search: {

View File

@@ -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谢谢 ~')
}
}
}