Commit d0ca0110 by honghong

联系热线

parent 0bfde124
import request from '@/utils/request'
// 查询系统配置列表
export function getConnectList(query) {
return request({
url: '/xinrenli/config/list',
method: 'get',
params: query
})
}
// 修改系统配置列表
export function editConnectConfig(data) {
return request({
url: '/xinrenli/config/edit',
method: 'post',
data: data
})
}
\ No newline at end of file
......@@ -62,7 +62,7 @@ export default {
dialogVisible: false,
hideUpload: false,
baseUrl: process.env.VUE_APP_BASE_API,
uploadImgUrl: "http://xinrenli.nyinhong.com/api/xinrenli/file/upload", // 上传的图片服务器地址
uploadImgUrl: "https://xinrenli.nyinhong.com/api/xinrenli/file/upload", // 上传的图片服务器地址
headers: {
Authorization: "Bearer " + getToken(),
},
......
<template>
<div class="app-container">
<div class="thirty-percent">
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item label="客服热线" prop="hotline">
<el-input v-model="form.hotline" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSave">保存</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import { getConnectList, editConnectConfig } from "@/api/connect/index";
export default {
data() {
var checkPhone = (rule, value, callback) => {
if (value === "") {
callback(new Error("请输入客服热线"));
} else if (!/^1[3|4|5|7|8][0-9]{9}$/.test(value)) {
callback(new Error("请输入正确的手机号码"));
} else {
callback();
}
};
return {
form: {
hotline: "",
id: "",
},
rules: {
hotline: [{ validator: checkPhone, required: true, trigger: "blur" }],
},
};
},
mounted() {
console.log("金");
this.getConnect();
},
methods: {
//获取联系电话列表
getConnect() {
let that = this;
getConnectList().then((res) => {
console.log("列表", res);
const { code, rows } = res;
if (res.code == 200) {
if (rows.length) {
that.form = rows[0];
// that.$set(that.form,'hotline',rows[0].hotline)
// that.$set(that.form,'id',rows[0].id)
}
}
});
},
handleSave() {
this.$refs.form.validate((valid) => {
if (valid) {
// alert('submit!');
editConnectConfig(this.form).then((res) => {
const { code } = res;
if (code != 200) return this.$message.error("修改失败!");
this.getConnect();
this.$message.success("修改成功!");
});
} else {
console.log("error submit!!");
return false;
}
});
},
},
};
</script>
<style lang="scss" scoped>
.thirty-percent {
width: 30%;
}
</style>
<template>
<div>
<div class="app-container">
<el-table :data="tableData" border style="width: 100%">
<el-table-column type="index" width="50" label="序号" align="center">
</el-table-column>
......
......@@ -35,7 +35,7 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://xinrenli.nyinhong.com/api`,
target: `https://xinrenli.nyinhong.com/api`,
// target: `http://192.168.0.175:7001`,
changeOrigin: true,
pathRewrite: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment