|
@@ -1,31 +1,114 @@
|
|
|
<template>
|
|
|
- <div id="index">
|
|
|
+ <div id="detail">
|
|
|
<el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <p>index</p>
|
|
|
+ <el-col :span="24" class="main">
|
|
|
+ <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
|
|
|
+ <el-col :span="24" class="container">
|
|
|
+ <el-col :span="24" class="list" v-if="loading">
|
|
|
+ <el-form ref="form" :model="form" label-width="80px">
|
|
|
+ <el-form-item label="网站logo" prop="logourl">
|
|
|
+ <upload :limit="1" :data="form.logourl" type="logourl" :url="'/files/links/upload'" @upload="uploadSuccess"></upload>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="联系方式" prop="content">
|
|
|
+ <wang-editor v-model="form.content" placeholder="请输入联系方式"></wang-editor>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="submit()">保存</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import wangEditor from '@c/frame/wang-editor.vue';
|
|
|
+import upload from '@c/frame/uploadone.vue';
|
|
|
+import breadcrumb from '@c/common/breadcrumb.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions } = createNamespacedHelpers('site');
|
|
|
export default {
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|
|
|
},
|
|
|
- name: 'index',
|
|
|
+ name: 'detail',
|
|
|
props: {},
|
|
|
- components: {},
|
|
|
+ components: {
|
|
|
+ breadcrumb,
|
|
|
+ upload,
|
|
|
+ wangEditor,
|
|
|
+ },
|
|
|
data: function() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ form: {},
|
|
|
+ loading: false,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions(['showInfo', 'create', 'update']),
|
|
|
+ // 查询列表
|
|
|
+ async search() {
|
|
|
+ this.loading = false;
|
|
|
+ let res = await this.showInfo();
|
|
|
+ let object = JSON.parse(JSON.stringify(res.data));
|
|
|
+ if (object) {
|
|
|
+ this.$set(this, `form`, res.data);
|
|
|
+ }
|
|
|
+ this.loading = true;
|
|
|
+ },
|
|
|
+ async submit() {
|
|
|
+ let data = this.form;
|
|
|
+ let res;
|
|
|
+ let msg;
|
|
|
+ if (data.id) {
|
|
|
+ res = await this.update(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ res = await this.create(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ uploadSuccess({ type, data }) {
|
|
|
+ this.$set(this.form, `${type}`, data.uri);
|
|
|
+ },
|
|
|
},
|
|
|
- created() {},
|
|
|
- methods: {},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="less" scoped></style>
|
|
|
+<style lang="less" scoped>
|
|
|
+.main {
|
|
|
+ .top {
|
|
|
+ text-align: right;
|
|
|
+ margin: 15px 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|