mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 19:52:10 +08:00
前端代码优化
This commit is contained in:
@@ -51,7 +51,7 @@ const config = {
|
||||
workers: 1
|
||||
},
|
||||
autoUpdate: {
|
||||
windows: true, // windows可以开启;macOs 需要签名验证
|
||||
windows: false, // windows可以开启;macOs 需要签名验证
|
||||
macOS: false,
|
||||
Linux: false,
|
||||
options: {
|
||||
|
||||
@@ -13,15 +13,24 @@ const mainApi = {
|
||||
/**
|
||||
* outApi
|
||||
*/
|
||||
// export function outApi (parameter) {
|
||||
// parameter.data.token = storage.get(ACCESS_TOKEN)
|
||||
// parameter.data.uid = storage.get(USER_INFO) ? storage.get(USER_INFO).uid : ''
|
||||
// return request({
|
||||
// url: mainApi.outApi,
|
||||
// method: 'post',
|
||||
// data: parameter
|
||||
// })
|
||||
// }
|
||||
export function outApi (uri, parameter) {
|
||||
return request({
|
||||
url: mainApi[uri],
|
||||
method: 'post',
|
||||
data: parameter
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* local api
|
||||
*/
|
||||
export function localApi (uri, parameter) {
|
||||
return request({
|
||||
url: mainApi[uri],
|
||||
method: 'post',
|
||||
data: parameter
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* openDir
|
||||
@@ -43,37 +52,4 @@ export function uploadFile (parameter) {
|
||||
method: 'post',
|
||||
data: parameter
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* autoLaunchEnable
|
||||
*/
|
||||
export function autoLaunchEnable (parameter) {
|
||||
return request({
|
||||
url: mainApi.autoLaunchEnable,
|
||||
method: 'post',
|
||||
data: parameter
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* autoLaunchDisable
|
||||
*/
|
||||
export function autoLaunchDisable (parameter) {
|
||||
return request({
|
||||
url: mainApi.autoLaunchDisable,
|
||||
method: 'post',
|
||||
data: parameter
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* autoLaunchIsEnabled
|
||||
*/
|
||||
export function autoLaunchIsEnabled (parameter) {
|
||||
return request({
|
||||
url: mainApi.autoLaunchIsEnabled,
|
||||
method: 'post',
|
||||
data: parameter
|
||||
})
|
||||
}
|
||||
@@ -19,7 +19,7 @@ export const constantRouterMap = [
|
||||
},
|
||||
{
|
||||
path: 'setting',
|
||||
name: 'setting',
|
||||
name: 'Setting',
|
||||
component: () => import('@/views/Setting')
|
||||
}
|
||||
]
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
>
|
||||
<a-menu class="sub-menu-item" theme="light" mode="inline" v-model="subMenuKey" :default-selected-keys="subMenuKey">
|
||||
<a-menu-item :key="subIndex" v-for="(menuInfo, subIndex) in subMenu">
|
||||
<router-link :to="{ path: menuInfo.page }">
|
||||
<router-link :to="{ name: menuInfo.pageName, params: menuInfo.params}">
|
||||
<span>{{ menuInfo.title }}</span>
|
||||
</router-link>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-layout-sider>
|
||||
<a-layout-content :style="{}">
|
||||
<div :style="{ padding: '24px', background: '#fff', minHeight: '560px' }">
|
||||
<div :style="{ padding: '10px', background: '#fff', minHeight: '560px' }">
|
||||
<router-view />
|
||||
</div>
|
||||
</a-layout-content>
|
||||
@@ -56,17 +56,20 @@ export default {
|
||||
'menu_1' : {
|
||||
'subMenu_1' : {
|
||||
title: '上传文件到sm图床',
|
||||
page: 'uploadFile'
|
||||
pageName: 'UploadFile',
|
||||
params: {}
|
||||
},
|
||||
'subMenu_2' : {
|
||||
title: '打开文件夹',
|
||||
page: 'fileOpenDir'
|
||||
pageName: 'FileOpenDir',
|
||||
params: {},
|
||||
}
|
||||
},
|
||||
'menu_2' : {
|
||||
'subMenu_1' : {
|
||||
title: '基础设置',
|
||||
page: '/setting'
|
||||
pageName: 'Setting',
|
||||
params: {},
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -80,8 +83,8 @@ export default {
|
||||
menuHandle (item) {
|
||||
this.subMenu = this.subMenuList[item.key]
|
||||
this.subMenuKey = ['subMenu_1']
|
||||
const linkPage = this.subMenu['subMenu_1']['page']
|
||||
this.$router.push(linkPage)
|
||||
const linkInfo = this.subMenu['subMenu_1']
|
||||
this.$router.push({ name: linkInfo.pageName, params: linkInfo.params})
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</a-list>
|
||||
</template>
|
||||
<script>
|
||||
import { autoLaunchEnable, autoLaunchDisable, autoLaunchIsEnabled } from '@/api/main'
|
||||
import { localApi } from '@/api/main'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
autoLaunchInit () {
|
||||
autoLaunchIsEnabled({}).then(res => {
|
||||
localApi('autoLaunchIsEnabled', {}).then(res => {
|
||||
if (res.code !== 0) {
|
||||
return false
|
||||
}
|
||||
@@ -45,7 +45,7 @@ export default {
|
||||
'checkStatus': checkStatus
|
||||
}
|
||||
if (checkStatus) {
|
||||
autoLaunchEnable(params).then(res => {
|
||||
localApi('autoLaunchEnable', params).then(res => {
|
||||
if (res.code !== 0) {
|
||||
return false
|
||||
}
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
console.log('err:', err)
|
||||
})
|
||||
} else {
|
||||
autoLaunchDisable(params).then(res => {
|
||||
localApi('autoLaunchDisable', params).then(res => {
|
||||
if (res.code !== 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user