修改专题

This commit is contained in:
lcc
2024-07-29 19:23:52 +08:00
parent 3d53c51cd0
commit bc4bdda418
7 changed files with 407 additions and 10 deletions
+34
View File
@@ -0,0 +1,34 @@
import request from '@/utils/request';
/**
* 分页查询专题
* @param params 查询条件
*/
export async function pageSyTopicEnroll(params) {
const res = await request.get('/sytopic/enroll/page', {
params
});
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
export async function pageSyTopicEnrollTypes() {
const res = await request.get('/sytopic/enroll/status', {});
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
export async function updateTopicEnrollStatus(id, status) {
const res = await request.put('/sytopic/enroll/status', {
id,
status
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
+14
View File
@@ -67,3 +67,17 @@ export async function removeTopic(ids) {
}
return Promise.reject(new Error(res.data.message));
}
/**
* 专题详情
* @param params
*/
export async function getTopicDetail(params) {
const res = await request.get('/sytopic/topic/detail', {
params
});
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
@@ -0,0 +1,99 @@
<!-- 用户编辑弹窗 -->
<template>
<ele-modal
width="700px"
:visible="visible"
:append-to-body="true"
:close-on-click-modal="true"
custom-class="ele-dialog-form"
title="链接"
@update:visible="updateVisible"
>
<el-form ref="form" :model="form" :rules="rules" label-width="82px">
<el-form-item label="状态:">
<el-select v-model="form.status" class="ele-fluid">
<el-option
v-for="(item, key) in statusLists"
:key="key"
:label="item"
:value="key"
/>
</el-select>
</el-form-item>
</el-form>
<template v-slot:footer>
<el-button @click="updateVisible(false)">取消</el-button>
<el-button type="primary" :loading="loading" @click="save">
保存
</el-button>
</template>
</ele-modal>
</template>
<script>
import { updateTopicEnrollStatus } from '@/api/sytopic/enroll';
export default {
components: {},
props: {
// 弹窗是否打开
visible: Boolean,
statusLists: Array,
// 修改回显的数据
data: Object
},
data() {
const defaultForm = {
id: '',
status: 0
};
return {
defaultForm,
// 表单数据
form: { ...defaultForm },
rules: {},
// 表单验证规则
// 提交状态
loading: false
};
},
created() {},
computed: {
// 是否开启响应式布局
styleResponsive() {
return this.$store.state.theme.styleResponsive;
}
},
methods: {
/* 更新visible */
updateVisible(value) {
this.$emit('update:visible', value);
},
save() {
const loading = this.$loading({ lock: true });
updateTopicEnrollStatus(this.form.id, this.form.status)
.then((msg) => {
loading.close();
this.$message.success(msg);
this.updateVisible(false);
this.$emit('done');
})
.catch((e) => {
loading.close();
this.$message.error(e.message);
});
}
},
watch: {
visible(visible) {
if (visible) {
if (this.data) {
this.$util.assignObject(this.form, {
...this.data
});
}
}
}
}
};
</script>
+228
View File
@@ -0,0 +1,228 @@
<template>
<div class="ele-body">
<el-card shadow="never">
<!-- 搜索表单 -->
<!--
<el-form label-width="77px" class="ele-form-search">
<el-row :gutter="15">
<el-col :md="6" :sm="12">
<el-form-item label="专题标题:">
<el-input
placeholder="请输入专题标题"
clearable
v-model="where.title"
/>
</el-form-item>
</el-col>
<el-col :md="6" :sm="12">
<div class="ele-form-actions">
<el-button
type="primary"
icon="el-icon-search"
class="ele-btn-icon"
@click="reload"
>
查询
</el-button>
<el-button @click="reset">重置</el-button>
</div>
</el-col>
</el-row>
</el-form>
-->
<!-- 数据表格 -->
<ele-pro-table
ref="table"
:columns="columns"
:datasource="datasource"
:selection.sync="selection"
cache-key="syliveActivityTable"
>
<!-- 表头工具栏 -->
<template v-slot:toolbar></template>
<!-- 状态列 -->
<template v-slot:status="{ row }">
{{ statusLists[row.status] }}
</template>
<!-- 操作列 -->
<template v-slot:action="{ row }">
<el-link
type="primary"
:underline="false"
icon="el-icon-edit"
:key="row.id"
@click="showEditStatus(row)"
>
修改状态
</el-link>
</template>
</ele-pro-table>
</el-card>
<!-- 编辑弹窗 -->
<EditStatus
:data="current"
:visible.sync="showEdit"
:status-lists="statusLists"
@done="reload"
/>
</div>
</template>
<script>
import { removeTopic } from '@/api/sytopic/sytopic';
import {
pageSyTopicEnroll,
pageSyTopicEnrollTypes
} from '@/api/sytopic/enroll';
import EditStatus from '@/views/sytopic/enroll/components/edit-status.vue';
export default {
name: 'syTopicEnroll',
components: { EditStatus },
data() {
return {
where: {
title: ''
},
// 门店数据
organizationList: [],
// 表格列配置
columns: [
{
prop: 'id',
label: 'ID',
minWidth: 40,
align: 'center',
showOverflowTooltip: true,
fixed: 'left'
},
{
prop: 'name',
label: '姓名',
showOverflowTooltip: true
},
{
prop: 'mobile',
label: '手机号',
showOverflowTooltip: true
},
{
prop: 'enTime',
label: '留资时间',
sortable: 'custom',
showOverflowTooltip: true,
minWidth: 90,
formatter: (_row, _column, cellValue) => {
return this.$util.toDateString(cellValue);
}
},
{
prop: 'channelName',
label: '来源人',
showOverflowTooltip: true
},
{
prop: 'topicTitle',
label: '来源专题',
showOverflowTooltip: true
},
{
prop: 'status',
label: '状态',
align: 'center',
resizable: false,
slot: 'status',
showOverflowTooltip: true
},
{
columnKey: 'action',
label: '操作',
width: 150,
align: 'center',
resizable: false,
slot: 'action'
}
],
// 表格选中数据
selection: [],
// 当前编辑数据
current: null,
// 是否显示编辑弹窗
showEdit: false,
statusLists: []
};
},
created() {},
methods: {
/* 查询机构 */
statusQuery() {
pageSyTopicEnrollTypes()
.then((list) => {
this.statusLists = list;
})
.catch((e) => {
this.$message.error(e.message);
});
},
/* 表格数据源 */
datasource({ page, limit, where, order }) {
if (page === 1) {
this.statusQuery();
}
return pageSyTopicEnroll({ ...where, ...order, page, limit });
},
/* 刷新表格 */
reload() {
this.$refs.table.reload({ page: 1, where: this.where });
},
/* 删除 */
remove(row) {
const loading = this.$loading({ lock: true });
removeTopic(row.id)
.then((msg) => {
loading.close();
this.$message.success(msg);
this.reload();
})
.catch((e) => {
loading.close();
this.$message.error(e.message);
});
},
/* 批量删除 */
removeBatch() {
if (!this.selection.length) {
this.$message.error('请至少选择一条数据');
return;
}
this.$confirm('确定要删除选中的活动吗?', '提示', {
type: 'warning'
})
.then(() => {
const loading = this.$loading({ lock: true });
removeTopic(this.selection.map((d) => d.id))
.then((msg) => {
loading.close();
this.$message.success(msg);
this.reload();
})
.catch((e) => {
loading.close();
this.$message.error(e.message);
});
})
.catch(() => {});
},
showEditStatus(row) {
this.showEdit = true;
this.current = row;
},
/* 更改状态 */
editStatus() {},
/* 重置搜索 */
reset() {
this.where = {};
}
}
};
</script>
@@ -59,14 +59,14 @@
<script>
import EleQrCode from 'ele-admin/es/ele-qr-code';
import { getTopicDetail } from '@/api/sytopic/sytopic';
export default {
components: { EleQrCode },
props: {
// 弹窗是否打开
visible: Boolean,
// 修改回显的数据
data: Object
topicId: String
},
data() {
const defaultForm = {
@@ -123,10 +123,17 @@
watch: {
visible(visible) {
if (visible) {
if (this.data) {
this.$util.assignObject(this.form, {
...this.data
});
if (this.topicId) {
getTopicDetail({ id: this.topicId })
.then((result) => {
this.form.url = result.url;
})
.catch((e) => {
this.$message.error(e.message);
});
// this.$util.assignObject(this.form, {
// ...this.data
// });
}
}
}
+1 -1
View File
@@ -92,7 +92,7 @@
@done="reload"
/>
<!--二维码-->
<qr-code :visible.sync="showQr" :data="current" />
<qr-code :visible.sync="showQr" :topic-id="topicId" />
</div>
</template>
@@ -44,10 +44,13 @@
class="ele-fluid"
/>
</el-form-item>
<el-form-item label="banner:" prop="banner">
<el-form-item label="入口图:" prop="banner">
<upload-img v-model="form.banner" :images="form.banner" />
<div class="ele-text-secondary">建议尺寸750*340</div>
</el-form-item>
<el-form-item label="banner:">
<upload-img v-model="form.json.banner" :images="form.json.banner" />
</el-form-item>
<el-form-item label="分享图片:" prop="sharePhoto">
<upload-img v-model="form.sharePhoto" :images="form.sharePhoto" />
<div class="ele-text-secondary">建议尺寸200X200</div>
@@ -86,6 +89,14 @@
新增分享文案
</el-button>
</el-form-item>
<el-form-item label="背景色:">
<el-input
clearable
v-model="form.json.bg_color"
placeholder="请输入背景色"
/>
<div class="ele-text-secondary">例如#fff</div>
</el-form-item>
<el-form-item label="活动简介:">
<tinymce-editor
:init="editoption"
@@ -131,7 +142,11 @@
introduction: '',
banner: [],
sharePhoto: [],
organizationId: null
organizationId: null,
json: {
banner: [],
bg_color: ''
}
};
return {
editVersion: false,
@@ -164,7 +179,7 @@
banner: [
{
required: true,
message: '请上banner图',
message: '请上入口图',
trigger: 'blur'
}
],