@@ -0,0 +1,18 @@ | |||||
import request from '@/utils/request' | |||||
export function getBasicSetting(params) { | |||||
return request({ | |||||
url: 'basic/setting', | |||||
method: 'get', | |||||
params: params | |||||
}) | |||||
} | |||||
export function getBasicCreate(data) { | |||||
return request({ | |||||
url: 'basic/create', | |||||
method: 'POST', | |||||
data: data | |||||
}) | |||||
} | |||||
@@ -14,6 +14,9 @@ import memberManagement from './modules/member-management' | |||||
import booksManagement from './modules/books-management' | import booksManagement from './modules/books-management' | ||||
import sortManagement from './modules/sort-management' | import sortManagement from './modules/sort-management' | ||||
import basicSetting from './modules/basic-setting' | |||||
// import systemManagementRouter from './modules/system-management' | // import systemManagementRouter from './modules/system-management' | ||||
@@ -83,6 +86,8 @@ export const constantRoutes = [ | |||||
* the routes that need to be dynamically loaded based on user roles | * the routes that need to be dynamically loaded based on user roles | ||||
*/ | */ | ||||
export const asyncRoutes = [ | export const asyncRoutes = [ | ||||
basicSetting, | |||||
memberManagement, | memberManagement, | ||||
booksManagement, | booksManagement, | ||||
sortManagement, | sortManagement, | ||||
@@ -0,0 +1,24 @@ | |||||
/** When your routing table is too long, you can split it into small modules **/ | |||||
import Layout from '@/layout' | |||||
const basicSetting = { | |||||
path: '/basic-setting', | |||||
component: Layout, | |||||
redirect: '/basic-setting', | |||||
name: 'basic-setting', | |||||
meta: { | |||||
title: '基础设置', | |||||
icon: 'el-icon-setting' | |||||
}, | |||||
children: [ | |||||
{ | |||||
path: 'article', | |||||
component: () => import('@/views/basic-setting/basic-setting'), | |||||
name: 'articleManagement', | |||||
meta: { title: '基础设置' } | |||||
}, | |||||
] | |||||
} | |||||
export default basicSetting |
@@ -15,92 +15,25 @@ | |||||
display: none; | display: none; | ||||
} | } | ||||
.cell { | |||||
.el-tag { | |||||
margin-right: 0; | |||||
} | |||||
} | |||||
.small-padding { | |||||
.cell { | |||||
padding-left: 5px; | |||||
padding-right: 5px; | |||||
} | |||||
} | |||||
.fixed-width { | |||||
.el-button--mini { | |||||
padding: 7px 10px; | |||||
min-width: 60px; | |||||
} | |||||
} | |||||
.status-col { | |||||
.cell { | |||||
padding: 0 10px; | |||||
text-align: center; | |||||
.el-tag { | |||||
margin-right: 0; | |||||
.basic-box { | |||||
.el-form-item { | |||||
display: flex; | |||||
.el-form-item__label { | |||||
flex-shrink: 0; | |||||
} | } | ||||
} | |||||
} | |||||
// to fixed https://github.com/ElemeFE/element/issues/2461 | |||||
.el-dialog { | |||||
transform: none; | |||||
left: 0; | |||||
position: relative; | |||||
margin: 0 auto; | |||||
} | |||||
// refine element ui upload | |||||
.upload-container { | |||||
.el-upload { | |||||
width: 100%; | |||||
.el-upload-dragger { | |||||
width: 100%; | |||||
height: 200px; | |||||
.el-form-item__content { | |||||
width: 100%; | |||||
max-width: 700px; | |||||
margin-left: 0 !important; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
// dropdown | |||||
.el-dropdown-menu { | |||||
a { | |||||
display: block; | |||||
} | |||||
} | |||||
// fix date-picker ui bug in filter-item | |||||
.el-range-editor.el-input__inner { | |||||
display: inline-flex !important; | |||||
} | |||||
// to fix el-date-picker css style | |||||
.el-range-separator { | |||||
box-sizing: content-box; | |||||
} | |||||
.particles-js-canvas-el{ | |||||
position: absolute; | |||||
top: 0; | |||||
.head-box { | |||||
.el-input__inner { | |||||
width: 250px; | |||||
} | |||||
} | |||||
.particles-js-canvas-el { | |||||
position: fixed; | |||||
top: 0; | |||||
} | |||||
.dialog-area { | |||||
.el-tabs__nav-scroll { | |||||
background-color: #F9F9F9; | |||||
box-sizing: border-box; | |||||
padding: 0 24px; | |||||
} | |||||
.el-tabs__nav-wrap::after { | |||||
display: none; | |||||
} | |||||
} | |||||
} |
@@ -20,9 +20,15 @@ service.interceptors.request.use( | |||||
config.headers['Content-Type'] = 'application/x-www-form-urlencoded'; | config.headers['Content-Type'] = 'application/x-www-form-urlencoded'; | ||||
config.headers['api-token'] = getToken() || '' | config.headers['api-token'] = getToken() || '' | ||||
var formData = new FormData() | |||||
for(let i in config.data) { | |||||
formData.append(i, JSON.stringify(config.data[i])) | |||||
} | |||||
config.data = formData | |||||
config.data = qs.stringify(config.data) // 转为formdata数据格式 | |||||
return config | return config | ||||
}, | }, | ||||
error => { | error => { | ||||
@@ -60,7 +66,9 @@ service.interceptors.response.use( | |||||
} | } | ||||
}, | }, | ||||
error => { | error => { | ||||
const errorMsg = error.response.data.msg | |||||
console.log(error) | |||||
// const errorMsg = error.response.data.msg | |||||
// 特殊处理401,需要验证手机号 | // 特殊处理401,需要验证手机号 | ||||
if (error.response.data.code === 401) { | if (error.response.data.code === 401) { | ||||
@@ -0,0 +1,110 @@ | |||||
<template> | |||||
<div class="basic-box"> | |||||
<el-form ref="formData" :model="formData" label-width="190px"> | |||||
<div v-if="formData.zhimeng"> | |||||
<div class="basic-title">无字免费小说设置</div> | |||||
<el-form-item label="APP Key:" prop="zhimeng.app_key"> | |||||
<el-input v-model="formData.zhimeng.app_key" show-password></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="APP Secret:" prop="zhimeng.app_secret"> | |||||
<el-input v-model="formData.zhimeng.app_secret" show-password></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="短信 Key:" prop="zhimeng.zhimeng_msg_key"> | |||||
<el-input v-model="formData.zhimeng.zhimeng_msg_key" show-password></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="短信 Secret:" prop="zhimeng.zhimeng_msg_secret"> | |||||
<el-input | |||||
v-model="formData.zhimeng.zhimeng_msg_secret" | |||||
show-password | |||||
></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="网站 ID:" prop="zhimeng.zhimeng_web_id"> | |||||
<el-input v-model="formData.zhimeng.zhimeng_web_id" show-password></el-input> | |||||
</el-form-item> | |||||
</div> | |||||
<div v-if="formData.mob"> | |||||
<div class="basic-title">MOB设置</div> | |||||
<el-form-item label="Mob Android Scheme:" prop="mob.mob_android_scheme"> | |||||
<el-input v-model="formData.mob.mob_android_scheme" show-password></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="Mob IOS Scheme:" prop="mob.mob_ios_scheme"> | |||||
<el-input v-model="formData.mob.mob_ios_scheme" show-password></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="Mob APP Key:" prop="mob.mob_app_key"> | |||||
<el-input v-model="formData.mob.mob_app_key" show-password></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="Mob Link:" prop="mob.mob_link"> | |||||
<el-input v-model="formData.mob.mob_link" show-password></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="Mob App Secret:" prop="mob.mob_app_scheme"> | |||||
<el-input v-model="formData.mob.mob_app_scheme" show-password></el-input> | |||||
</el-form-item> | |||||
</div> | |||||
<el-form-item class="ml-100" style="margin-top: 50px"> | |||||
<button class="blue-btn" @click.prevent="handleSubmit">提交</button> | |||||
<button class="gray-btn ml-10" @click="resetQuery">重置</button> | |||||
</el-form-item> | |||||
</el-form> | |||||
</div> | |||||
</template> | |||||
<script> | |||||
import { getBasicSetting, getBasicCreate } from "@/api/basic-setting"; | |||||
export default { | |||||
data() { | |||||
return { | |||||
formData: {}, | |||||
}; | |||||
}, | |||||
mounted() { | |||||
this.init(); | |||||
}, | |||||
methods: { | |||||
init() { | |||||
getBasicSetting().then((res) => { | |||||
this.formData = res.data; | |||||
}); | |||||
}, | |||||
handleSubmit() { | |||||
getBasicCreate( this.formData ).then(res => { | |||||
this.$message.success('保存成功') | |||||
this.init() | |||||
}).catch(err=>{ | |||||
return | |||||
}) | |||||
}, | |||||
resetQuery() { | |||||
this.$refs.formData.resetFields(); | |||||
}, | |||||
}, | |||||
}; | |||||
</script> | |||||
<style lang="scss" scoped> | |||||
.basic-box { | |||||
width: 80%; | |||||
box-sizing: border-box; | |||||
padding: 63px 0 0px 150px; | |||||
.basic-title { | |||||
color: #333333; | |||||
font-size: 16px; | |||||
padding-left: 10px; | |||||
height: 16px; | |||||
line-height: 16px; | |||||
border-left: #1890ff 5px solid; | |||||
font-weight: bold; | |||||
margin-bottom: 30px; | |||||
margin-left: 50px; | |||||
} | |||||
} | |||||
</style> |
@@ -60,7 +60,7 @@ export default { | |||||
default: () => { | default: () => { | ||||
return { | return { | ||||
source_platform: "", | source_platform: "", | ||||
name: "" | |||||
name: "", | |||||
}; | }; | ||||
}, | }, | ||||
}, | }, | ||||
@@ -105,37 +105,36 @@ export default { | |||||
}, | }, | ||||
onSubmit() { | onSubmit() { | ||||
console.log(this.formData) | |||||
if (this.formData.name === "") return this.$message.error("请输入分类名称"); | if (this.formData.name === "") return this.$message.error("请输入分类名称"); | ||||
if (this.formData.source_platform === "") return this.$message.error("请选择书源"); | if (this.formData.source_platform === "") return this.$message.error("请选择书源"); | ||||
if (this.dialogTitle === "新增分类") { | if (this.dialogTitle === "新增分类") { | ||||
getCategoryAdd({ | getCategoryAdd({ | ||||
name: this.formData.name, | name: this.formData.name, | ||||
source_platform: this.formData.source_platform | |||||
}).then((res) => { | |||||
this.$emit("handle-success"); | |||||
this.$message.success('新增成功') | |||||
}).catch(err=>{ | |||||
this.$emit("handle-close"); | |||||
source_platform: this.formData.source_platform, | |||||
}) | }) | ||||
} else { | |||||
.then((res) => { | |||||
this.$emit("handle-success"); | |||||
this.$message.success("新增成功"); | |||||
}) | |||||
.catch((err) => { | |||||
this.$emit("handle-close"); | |||||
}); | |||||
} else { | |||||
getCategoryUpdate( | getCategoryUpdate( | ||||
{ | { | ||||
name: this.formData.name, | name: this.formData.name, | ||||
}, | }, | ||||
this.formData.source_platform | this.formData.source_platform | ||||
).then((res) => { | |||||
this.$emit("handle-success"); | |||||
this.$message.success('修改成功') | |||||
}).catch(err=>{ | |||||
this.$emit("handle-close"); | |||||
}) | |||||
) | |||||
.then((res) => { | |||||
this.$emit("handle-success"); | |||||
this.$message.success("修改成功"); | |||||
}) | |||||
.catch((err) => { | |||||
this.$emit("handle-close"); | |||||
}); | |||||
} | } | ||||
}, | }, | ||||
}, | }, | ||||