From 0cd01cdd783dd45d20617d5945efe4f9433eb00e Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 09 七月 2024 15:55:59 +0800
Subject: [PATCH] 系统配置代码
---
src/api/sysConfig.js | 18 +++++++++
src/router.js | 17 ++++++++
src/views/sys/SysSetting.vue | 56 ++++++++++++++++++++++++++++
3 files changed, 91 insertions(+), 0 deletions(-)
diff --git a/src/api/sysConfig.js b/src/api/sysConfig.js
new file mode 100644
index 0000000..a2bd09e
--- /dev/null
+++ b/src/api/sysConfig.js
@@ -0,0 +1,18 @@
+import axios from './request'
+
+// 鑾峰彇绯荤粺閰�
+export const getSysConfig = () => {
+ return axios({
+ url: '/api/sys-config',
+ method: 'GET'
+ })
+}
+
+// 淇敼绯荤粺閰嶇疆琛�
+export const editSysConfig = (params) => {
+ return axios({
+ url: '/api/sys-config/',
+ method: 'PUT',
+ data: params
+ })
+}
diff --git a/src/router.js b/src/router.js
index 8fc0cf1..1e2c89f 100644
--- a/src/router.js
+++ b/src/router.js
@@ -313,6 +313,23 @@
}
]
},
+ {
+ path: '/config',
+ component: Layout,
+ children: [
+ {
+ path: '/setting',
+ name: 'SysSetting',
+ meta: {
+ title: '绯荤粺閰嶇疆',
+ icon: 'answer',
+ affix: true
+ },
+ component: () => import('@/views/sys/SysSetting')
+ },
+ ]
+ },
+
// {
// path: '/message',
// component: Layout,
diff --git a/src/views/sys/SysSetting.vue b/src/views/sys/SysSetting.vue
new file mode 100644
index 0000000..d5dfdfe
--- /dev/null
+++ b/src/views/sys/SysSetting.vue
@@ -0,0 +1,56 @@
+<template>
+ <div class="app-container">
+ <el-form :model="form" status-icon :rules="rules" ref="form" label-width="150px">
+ <el-form-item label="瀵嗙爜杩囨湡鏃堕棿(澶�)" prop="passwordExpireTime">
+ <el-input v-model="form.passwordExpireTime" type="number" autocomplete="off" placeholder="姣斿锛�30澶╁瘑鐮佽繃鏈�"></el-input>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" @click="edit()">淇濆瓨</el-button>
+ </el-form-item>
+ </el-form>
+ </div>
+</template>
+
+<script>
+import { getSysConfig, editSysConfig } from '@/api/sysConfig'
+
+export default {
+ name: 'SysSetting',
+ data () {
+ return {
+ form: {
+ id: null,
+ passwordExpireTime: null
+ },
+ rules: {
+ passwordExpireTime: [
+ { required: true, message: '璇疯緭鍏ュ瘑鐮佽繃鏈熸椂闂�', trigger: 'blur' }
+ ]
+ }
+ }
+ },
+ mounted () {
+ this.getConfig()
+ },
+ methods: {
+ getConfig () {
+ getSysConfig().then(res => {
+ this.form = res.data.data
+ })
+ },
+ edit () {
+ this.$refs['form'].validate((valid) => {
+ if (valid) {
+ editSysConfig(this.form).then(res => {
+ this.$message.success('淇敼鎴愬姛')
+ })
+ }
+ })
+ }
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
--
Gitblit v1.8.0