Merge branch 'feature/axios' into develop
Former-commit-id: 6365ab70f2b0e38c5b6a4b8dab79f4e2fb15dba5 [formerly fd62dd7bd246717507fe620d6d33db43346a9722] [formerly 6365ab70f2b0e38c5b6a4b8dab79f4e2fb15dba5 [formerly fd62dd7bd246717507fe620d6d33db43346a9722] [formerly 6365ab70f2b0e38c5b6a4b8dab79f4e2fb15dba5 [formerly fd62dd7bd246717507fe620d6d33db43346a9722] [formerly fd62dd7bd246717507fe620d6d33db43346a9722 [formerly 29c5e1f3f141b30c5833e63931f9bbc5d307107a [formerly 7ad7e37e9a03efafafaef0b0bc5fdfecc8cc2236]]]]] Former-commit-id: 11be3b472f29710e781133f4acd3623b7644ddba Former-commit-id: 35c9e53b8b86fcf1a6cddf8e89ba15ec91ec3710 Former-commit-id: bf03d0b2546ee58ec83e1cd7a714503f8a369822 [formerly 75a6e74d4091cb6aab4931d6d4c128b255e90444] Former-commit-id: 77a269a0d9c4d9a0295ef1b7cedc3421fdbd4529 Former-commit-id: 577ba6f0673b649a99fa92d275c69e19885becee Former-commit-id: 0e79723e2d53d910c896fde9002ed20f2b249205 Former-commit-id: c7584ec9ff0de12590a0d52152dbf60d08c98f73 Former-commit-id: f6c3f6e76a9c0a146beaca119639f4db488a32ab
This commit is contained in:
3
.env
3
.env
@@ -1,4 +1,5 @@
|
|||||||
# 所有环境
|
# 所有环境
|
||||||
|
|
||||||
# 页面 title 前缀
|
# 页面 title 前缀
|
||||||
VUE_APP_TITLE=D2Admin
|
VUE_APP_TITLE=D2Admin
|
||||||
|
VUE_APP_API=/api/
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ sidebar: auto
|
|||||||
| <img src="https://avatars1.githubusercontent.com/u/24645480?s=460&v=4" style="width: 30px;"/> | sunhaoxiang | [https://github.com/sunhaoxiang](https://github.com/sunhaoxiang) |
|
| <img src="https://avatars1.githubusercontent.com/u/24645480?s=460&v=4" style="width: 30px;"/> | sunhaoxiang | [https://github.com/sunhaoxiang](https://github.com/sunhaoxiang) |
|
||||||
| <img src="https://avatars2.githubusercontent.com/u/11420885?s=460&v=4" style="width: 30px;"/> | namklaw | [https://github.com/namklaw](https://github.com/namklaw) |
|
| <img src="https://avatars2.githubusercontent.com/u/11420885?s=460&v=4" style="width: 30px;"/> | namklaw | [https://github.com/namklaw](https://github.com/namklaw) |
|
||||||
| <img src="https://avatars2.githubusercontent.com/u/6757507?s=460&v=4" style="width: 30px;"/> | mokeyjay | [https://github.com/mokeyjay](https://github.com/mokeyjay) |
|
| <img src="https://avatars2.githubusercontent.com/u/6757507?s=460&v=4" style="width: 30px;"/> | mokeyjay | [https://github.com/mokeyjay](https://github.com/mokeyjay) |
|
||||||
| <img src="https://avatars2.githubusercontent.com/u/10137653?s=460&v=4" style="width: 30px;"/> | Aysnine | [https://github.com/Aysnine](https://github.com/Aysnine) |
|
| <img src="https://avatars2.githubusercontent.com/u/10137653?s=460&v=4" style="width: 30px;"/> | Aysnine | [https://github.com/Aysnine](https://github.com/Aysnine) |
|
||||||
|
| <img src="https://avatars2.githubusercontent.com/u/12825624?s=460&v=4" style="width: 30px;"/> | rongxingsun | [https://github.com/rongxingsun](https://github.com/rongxingsun) |
|
||||||
@@ -1 +1 @@
|
|||||||
208665c165b32daf4021f61c3ad430a972cb9735
|
937f5369a5d9b43eeb3c7fa2991f76724481721c
|
||||||
9
src/api/components/markdown/index.js
Normal file
9
src/api/components/markdown/index.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import request from '@/plugin/axios'
|
||||||
|
|
||||||
|
export function ComponentsMarkdownBase (url) {
|
||||||
|
return request({
|
||||||
|
baseURL: process.env.BASE_URL,
|
||||||
|
url,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
9
src/api/demo/business/table/1/index.js
Normal file
9
src/api/demo/business/table/1/index.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import request from '@/plugin/axios'
|
||||||
|
|
||||||
|
export function BusinessTable1List (data) {
|
||||||
|
return request({
|
||||||
|
url: '/demo/business/table/1',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
8
src/api/demo/plugins/mocks/ajax/index.js
Normal file
8
src/api/demo/plugins/mocks/ajax/index.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import request from '@/plugin/axios'
|
||||||
|
|
||||||
|
export function PluginMocksAjax () {
|
||||||
|
return request({
|
||||||
|
url: '/demo/plugins/mock/ajax',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
17
src/api/sys/http/index.js
Normal file
17
src/api/sys/http/index.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
9
src/api/sys/login/index.js
Normal file
9
src/api/sys/login/index.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import request from '@/plugin/axios'
|
||||||
|
|
||||||
|
export function AccountLogin (data) {
|
||||||
|
return request({
|
||||||
|
url: '/login',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
87fff7214e7b64123842f1f52b649a8af614eb46
|
bfee5e91a3b150e04d9f24695061f6f3e7c59342
|
||||||
@@ -12,6 +12,7 @@ import marked from 'marked'
|
|||||||
import highlight from 'highlight.js'
|
import highlight from 'highlight.js'
|
||||||
import bandupan from './plugin/baidupan'
|
import bandupan from './plugin/baidupan'
|
||||||
import 'github-markdown-css'
|
import 'github-markdown-css'
|
||||||
|
import { ComponentsMarkdownBase } from '@/api/components/markdown'
|
||||||
export default {
|
export default {
|
||||||
name: 'd2-markdown',
|
name: 'd2-markdown',
|
||||||
props: {
|
props: {
|
||||||
@@ -63,7 +64,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 从 url 加载原始数据
|
// 从 url 加载原始数据
|
||||||
async getReadme (url) {
|
async getReadme (url) {
|
||||||
const data = await this.$axios.get(url)
|
const data = await ComponentsMarkdownBase(url)
|
||||||
return this.marked(data)
|
return this.marked(data)
|
||||||
},
|
},
|
||||||
marked (data) {
|
marked (data) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-menu mode="horizontal" @select="handleMenuSelect">
|
<el-menu mode="horizontal" :default-active="active" @select="handleMenuSelect">
|
||||||
<template v-for="(menu, menuIndex) in header">
|
<template v-for="(menu, menuIndex) in header">
|
||||||
<d2-layout-header-aside-menu-item v-if="menu.children === undefined" :menu="menu" :key="menuIndex"/>
|
<d2-layout-header-aside-menu-item v-if="menu.children === undefined" :menu="menu" :key="menuIndex"/>
|
||||||
<d2-layout-header-aside-menu-sub v-else :menu="menu" :key="menuIndex"/>
|
<d2-layout-header-aside-menu-sub v-else :menu="menu" :key="menuIndex"/>
|
||||||
@@ -25,6 +25,19 @@ export default {
|
|||||||
...mapState('d2admin/menu', [
|
...mapState('d2admin/menu', [
|
||||||
'header'
|
'header'
|
||||||
])
|
])
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
active: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'$route.matched': {
|
||||||
|
handler (val) {
|
||||||
|
this.active = val[val.length - 1].path
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,17 +7,23 @@ Mock.mock('/api/demo/business/table/1', ({ body }) => {
|
|||||||
page.total = 1000
|
page.total = 1000
|
||||||
return Mock.mock(
|
return Mock.mock(
|
||||||
{
|
{
|
||||||
page,
|
code: 0,
|
||||||
'list|20': [{
|
msg: '获取数据成功',
|
||||||
'key': '@guid',
|
data: {
|
||||||
'value|1': [10, 100, 200, 500],
|
page,
|
||||||
'type': '@boolean',
|
'list|20': [
|
||||||
'admin': '@cname',
|
{
|
||||||
'adminNote': '@cparagraph(0.5)',
|
'key': '@guid',
|
||||||
'dateTimeCreat': '@datetime',
|
'value|1': [10, 100, 200, 500],
|
||||||
'used': '@boolean',
|
'type': '@boolean',
|
||||||
'dateTimeUse': '@datetime'
|
'admin': '@cname',
|
||||||
}]
|
'adminNote': '@cparagraph(0.5)',
|
||||||
|
'dateTimeCreat': '@datetime',
|
||||||
|
'used': '@boolean',
|
||||||
|
'dateTimeUse': '@datetime'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
import Mock from 'mockjs'
|
import Mock from 'mockjs'
|
||||||
|
|
||||||
Mock.mock('/api/demo/plugins/mock/ajax', {
|
Mock.mock('/api/demo/plugins/mock/ajax', {
|
||||||
'list|4-10': [{
|
code: 0,
|
||||||
'id|+1': 1,
|
msg: '获取数据成功',
|
||||||
'name': '@CNAME',
|
data: {
|
||||||
'star|1-5': '★',
|
'list|4-10': [
|
||||||
'delFlag|1': [0, 1],
|
{
|
||||||
'creatDate': '@DATE',
|
'id|+1': 1,
|
||||||
'address': '@CITY',
|
'name': '@CNAME',
|
||||||
'zip': '@ZIP'
|
'star|1-5': '★',
|
||||||
}]
|
'delFlag|1': [0, 1],
|
||||||
|
'creatDate': '@DATE',
|
||||||
|
'address': '@CITY',
|
||||||
|
'zip': '@ZIP'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const userDB = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
Mock.mock('/login', 'post', ({url, type, body}) => {
|
Mock.mock('/api/login', 'post', ({url, type, body}) => {
|
||||||
const bodyObj = JSON.parse(body)
|
const bodyObj = JSON.parse(body)
|
||||||
const user = userDB.find(e => e.username === bodyObj.username && e.password === bodyObj.password)
|
const user = userDB.find(e => e.username === bodyObj.username && e.password === bodyObj.password)
|
||||||
if (user) {
|
if (user) {
|
||||||
@@ -36,7 +36,8 @@ Mock.mock('/login', 'post', ({url, type, body}) => {
|
|||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
code: 401,
|
code: 401,
|
||||||
msg: '用户名或密码错误'
|
msg: '用户名或密码错误',
|
||||||
|
data: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { BusinessTable1List } from '@/api/demo/business/table/1'
|
||||||
export default {
|
export default {
|
||||||
// name 值和本页的 $route.name 一致才可以缓存页面
|
// name 值和本页的 $route.name 一致才可以缓存页面
|
||||||
name: 'demo-business-table-1',
|
name: 'demo-business-table-1',
|
||||||
@@ -53,7 +54,7 @@ export default {
|
|||||||
this.$notify({
|
this.$notify({
|
||||||
title: '开始请求模拟表格数据'
|
title: '开始请求模拟表格数据'
|
||||||
})
|
})
|
||||||
this.$axios.post('/api/demo/business/table/1', {
|
BusinessTable1List({
|
||||||
...form,
|
...form,
|
||||||
page: this.page
|
page: this.page
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<d2-container>
|
<d2-container>
|
||||||
<template slot="header">异步加载文件</template>
|
<template slot="header">异步加载文件</template>
|
||||||
<d2-markdown :url="`${$baseUrl}markdown/demo.md`"/>
|
<d2-markdown url="markdown/demo.md"/>
|
||||||
</d2-container>
|
</d2-container>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -23,7 +23,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { PluginMocksAjax } from '@/api/demo/plugins/mocks/ajax'
|
||||||
export default {
|
export default {
|
||||||
|
name: 'demo-plugins-mock-ajax',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
table: {
|
table: {
|
||||||
@@ -37,7 +39,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
ajax () {
|
ajax () {
|
||||||
this.$axios.get('/api/demo/plugins/mock/ajax')
|
PluginMocksAjax()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.table.columns = Object.keys(res.list[0]).map(e => ({
|
this.table.columns = Object.keys(res.list[0]).map(e => ({
|
||||||
label: e,
|
label: e,
|
||||||
@@ -45,6 +47,9 @@ export default {
|
|||||||
}))
|
}))
|
||||||
this.table.data = res.list
|
this.table.data = res.list
|
||||||
})
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// 错误情况
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,110 @@
|
|||||||
|
import store from '@/store'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { Message } from 'element-ui'
|
||||||
|
import util from '@/libs/util'
|
||||||
|
|
||||||
axios.interceptors.response.use(res => {
|
// 创建一个错误
|
||||||
return res.data
|
function errorCreat (msg) {
|
||||||
}, err => {
|
const err = new Error(msg)
|
||||||
return Promise.reject(err)
|
errorLog(err)
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 记录和显示错误
|
||||||
|
function errorLog (err) {
|
||||||
|
// 添加到日志
|
||||||
|
store.dispatch('d2admin/log/add', {
|
||||||
|
type: 'error',
|
||||||
|
err,
|
||||||
|
info: '数据请求异常'
|
||||||
|
})
|
||||||
|
// 打印到控制台
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
util.log.danger('>>>>>> Error >>>>>>')
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
// 显示提示
|
||||||
|
Message({
|
||||||
|
message: err.message,
|
||||||
|
type: 'error',
|
||||||
|
duration: 5 * 1000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建一个 axios 实例
|
||||||
|
const service = axios.create({
|
||||||
|
baseURL: process.env.VUE_APP_API,
|
||||||
|
timeout: 5000 // 请求超时时间
|
||||||
})
|
})
|
||||||
|
|
||||||
export default {
|
// 请求拦截器
|
||||||
install (Vue, options) {
|
service.interceptors.request.use(
|
||||||
Vue.prototype.$axios = axios
|
config => {
|
||||||
|
// 在请求发送之前做一些处理
|
||||||
|
if (!(/^https:\/\/|http:\/\//.test(config.url))) {
|
||||||
|
const token = util.cookies.get('token')
|
||||||
|
if (token && token !== 'undefined') {
|
||||||
|
// 让每个请求携带token-- ['X-Token']为自定义key 请根据实际情况自行修改
|
||||||
|
config.headers['X-Token'] = token
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
// 发送失败
|
||||||
|
console.log(error)
|
||||||
|
Promise.reject(error)
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
|
// 响应拦截器
|
||||||
|
service.interceptors.response.use(
|
||||||
|
response => {
|
||||||
|
// dataAxios 是 axios 返回数据中的 data
|
||||||
|
const dataAxios = response.data
|
||||||
|
// 这个状态码是和后端约定的
|
||||||
|
const { code } = dataAxios
|
||||||
|
// 根据 code 进行判断
|
||||||
|
if (code === undefined) {
|
||||||
|
// 如果没有 code 代表这不是项目后端开发的接口 比如可能是 D2Admin 请求最新版本
|
||||||
|
return dataAxios
|
||||||
|
} else {
|
||||||
|
// 有 code 代表这是一个后端接口 可以进行进一步的判断
|
||||||
|
switch (code) {
|
||||||
|
case 0:
|
||||||
|
// [ 示例 ] code === 0 代表没有错误
|
||||||
|
return dataAxios.data
|
||||||
|
case 'xxx':
|
||||||
|
// [ 示例 ] 其它和后台约定的 code
|
||||||
|
errorCreat(`[ code: xxx ] ${dataAxios.msg}: ${response.config.url}`)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
// 不是正确的 code
|
||||||
|
errorCreat(`${dataAxios.msg}: ${response.config.url}`)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
if (error && error.response) {
|
||||||
|
switch (error.response.status) {
|
||||||
|
case 400: error.message = '请求错误'; break
|
||||||
|
case 401: error.message = '未授权,请登录'; break
|
||||||
|
case 403: error.message = '拒绝访问'; break
|
||||||
|
case 404: error.message = `请求地址出错: ${error.response.config.url}`; break
|
||||||
|
case 408: error.message = '请求超时'; break
|
||||||
|
case 500: error.message = '服务器内部错误'; break
|
||||||
|
case 501: error.message = '服务未实现'; break
|
||||||
|
case 502: error.message = '网关错误'; break
|
||||||
|
case 503: error.message = '服务不可用'; break
|
||||||
|
case 504: error.message = '网关超时'; break
|
||||||
|
case 505: error.message = 'HTTP版本不受支持'; break
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errorLog(error)
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export default service
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import '@/components'
|
|||||||
// svg 图标
|
// svg 图标
|
||||||
import '@/assets/svg-icons'
|
import '@/assets/svg-icons'
|
||||||
// 功能插件
|
// 功能插件
|
||||||
import pluginAxios from '@/plugin/axios'
|
|
||||||
import pluginError from '@/plugin/error'
|
import pluginError from '@/plugin/error'
|
||||||
import pluginExport from '@/plugin/export'
|
import pluginExport from '@/plugin/export'
|
||||||
import pluginImport from '@/plugin/import'
|
import pluginImport from '@/plugin/import'
|
||||||
@@ -20,7 +19,6 @@ export default {
|
|||||||
// Element
|
// Element
|
||||||
Vue.use(ElementUI)
|
Vue.use(ElementUI)
|
||||||
// 插件
|
// 插件
|
||||||
Vue.use(pluginAxios)
|
|
||||||
Vue.use(pluginError)
|
Vue.use(pluginError)
|
||||||
Vue.use(pluginExport)
|
Vue.use(pluginExport)
|
||||||
Vue.use(pluginImport)
|
Vue.use(pluginImport)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import util from '@/libs/util.js'
|
import util from '@/libs/util.js'
|
||||||
|
import { AccountLogin } from '@/api/sys/login'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
@@ -12,13 +13,9 @@ export default {
|
|||||||
*/
|
*/
|
||||||
login ({ commit }, { vm, username, password }) {
|
login ({ commit }, { vm, username, password }) {
|
||||||
// 开始请求登录接口
|
// 开始请求登录接口
|
||||||
vm.$axios({
|
AccountLogin({
|
||||||
method: 'post',
|
username,
|
||||||
url: '/login',
|
password
|
||||||
data: {
|
|
||||||
username,
|
|
||||||
password
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
// 设置 cookie 一定要存 uuid 和 token 两个 cookie
|
// 设置 cookie 一定要存 uuid 和 token 两个 cookie
|
||||||
@@ -26,11 +23,11 @@ export default {
|
|||||||
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
|
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
|
||||||
// token 代表用户当前登录状态 建议在网络请求中携带 token
|
// token 代表用户当前登录状态 建议在网络请求中携带 token
|
||||||
// 如有必要 token 需要定时更新,默认保存一天
|
// 如有必要 token 需要定时更新,默认保存一天
|
||||||
util.cookies.set('uuid', res.data.uuid)
|
util.cookies.set('uuid', res.uuid)
|
||||||
util.cookies.set('token', res.data.token)
|
util.cookies.set('token', res.token)
|
||||||
// 设置 vuex 用户信息
|
// 设置 vuex 用户信息
|
||||||
commit('d2admin/user/set', {
|
commit('d2admin/user/set', {
|
||||||
name: res.data.name
|
name: res.name
|
||||||
}, { root: true })
|
}, { root: true })
|
||||||
// 用户登陆后从持久化数据加载一系列的设置
|
// 用户登陆后从持久化数据加载一系列的设置
|
||||||
commit('load')
|
commit('load')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import axios from 'axios'
|
import { httpGet } from '@/api/sys/http'
|
||||||
import semver from 'semver'
|
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'
|
||||||
@@ -19,7 +19,7 @@ export default {
|
|||||||
* @param {Object} param context
|
* @param {Object} param context
|
||||||
*/
|
*/
|
||||||
checkUpdate ({ state, commit }) {
|
checkUpdate ({ state, commit }) {
|
||||||
axios.get(setting.releases.api)
|
httpGet(setting.releases.api)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let versionGet = res.tag_name
|
let versionGet = res.tag_name
|
||||||
const update = semver.lt(state.version, versionGet)
|
const update = semver.lt(state.version, versionGet)
|
||||||
|
|||||||
Reference in New Issue
Block a user