删除请求新版本相关的代码
Former-commit-id: c4aafa90eef4fa78782d750fc33e484d071e93af [formerly c4aafa90eef4fa78782d750fc33e484d071e93af [formerly c4aafa90eef4fa78782d750fc33e484d071e93af [formerly c4aafa90eef4fa78782d750fc33e484d071e93af [formerly 2ef73ea49b3405be63a1552eaa45649af7d559df [formerly e8792780e531de7b81bec704953a57fb05c3255e]]]]] Former-commit-id: 80c8177590bbadb58158ea371d1aa67f05de60f5 Former-commit-id: ef3cdcd6a5eed24569fa9a0c38ead6903d8f84b0 Former-commit-id: 9874c1f8f43c8beda5404b222d53697774f808bb [formerly 810d6baa2283c6310dd8ae35fa99b810331cd7f3] Former-commit-id: cd5531c1a53a55fa62d897a8ffa27b30b0d5be50 Former-commit-id: 79be8e7248a71c1b608c009d4b200c6cf04572ca Former-commit-id: 0d797ed715b7091e9b9a3748dd85152a7c86549e Former-commit-id: c175d6cb3db552a3b8749fa51c0cb6375fcfc0a7 Former-commit-id: 6c2d3338e77a6f3ca12fee92621d23ea795f7a3d
This commit is contained in:
@@ -1 +1 @@
|
|||||||
3c97ecdb32c4ce5031fe7b3341f49499ac9e47de
|
e6ea0a41cb4fd47248aa8ea156fc3de00668d3e6
|
||||||
@@ -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 () {
|
mounted () {
|
||||||
// 展示系统信息
|
// 展示系统信息
|
||||||
this.$store.commit('d2admin/releases/versionShow')
|
this.$store.commit('d2admin/releases/versionShow')
|
||||||
// 检查最新版本
|
|
||||||
this.$store.dispatch('d2admin/releases/checkUpdate')
|
|
||||||
// 用户登录后从数据库加载一系列的设置
|
// 用户登录后从数据库加载一系列的设置
|
||||||
this.$store.dispatch('d2admin/account/load')
|
this.$store.dispatch('d2admin/account/load')
|
||||||
// 获取并记录用户 UA
|
// 获取并记录用户 UA
|
||||||
|
|||||||
@@ -6,11 +6,12 @@
|
|||||||
<d2-icon-svg style="width: 120px;" name="d2-admin"/>
|
<d2-icon-svg style="width: 120px;" name="d2-admin"/>
|
||||||
<template slot="footer">
|
<template slot="footer">
|
||||||
<div class="page__btn-group">
|
<div class="page__btn-group">
|
||||||
<span @click="$open('https://github.com/d2-projects')">项目组</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://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://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://alibaba.github.io/ice/scaffold?type=vue')">飞冰</span> |
|
||||||
<span @click="$open('https://juejin.im/user/57a48b632e958a006691b946/posts')">掘金专栏</span> |
|
<span @click="$open('https://juejin.im/user/57a48b632e958a006691b946/posts')">掘金</span> |
|
||||||
|
<span @click="$open('https://awesome.fairyever.com/daily/')">程序员日报</span> |
|
||||||
<el-popover
|
<el-popover
|
||||||
:width="172"
|
:width="172"
|
||||||
trigger="hover">
|
trigger="hover">
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ const setting = {
|
|||||||
},
|
},
|
||||||
// 版本
|
// 版本
|
||||||
releases: {
|
releases: {
|
||||||
version: version,
|
version
|
||||||
api: 'https://api.github.com/repos/FairyEver/d2-admin/releases/latest'
|
|
||||||
},
|
},
|
||||||
// 菜单搜索
|
// 菜单搜索
|
||||||
search: {
|
search: {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { httpGet } from '@/api/sys/http'
|
|
||||||
import semver from 'semver'
|
|
||||||
import util from '@/libs/util.js'
|
import util from '@/libs/util.js'
|
||||||
import setting from '@/setting.js'
|
import setting from '@/setting.js'
|
||||||
|
|
||||||
@@ -7,33 +5,7 @@ export default {
|
|||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
// D2Admin 版本
|
// D2Admin 版本
|
||||||
version: setting.releases.version,
|
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)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
/**
|
/**
|
||||||
@@ -44,24 +16,7 @@ export default {
|
|||||||
util.log.capsule('D2Admin', `v${state.version}`)
|
util.log.capsule('D2Admin', `v${state.version}`)
|
||||||
console.log('Github https://github.com/d2-projects/d2-admin')
|
console.log('Github https://github.com/d2-projects/d2-admin')
|
||||||
console.log('Doc https://d2-projects.github.io/d2-admin-doc/zh/')
|
console.log('Doc https://d2-projects.github.io/d2-admin-doc/zh/')
|
||||||
},
|
console.log('请不要吝啬您的 star,谢谢 ~')
|
||||||
/**
|
|
||||||
* @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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user