Files
nuttyreading-master-html/src/views/modules/content/psychologicalForum-add.vue
chenghuan 822f42cd96 feat(心理论坛模块): 更新新增/修改弹窗表单,添加同步功能
- 修改弹窗标题为“修改”,并移除链接地址输入项
- 更新表单数据结构,确保只保留分类信息
- 添加同步按钮,替换新增按钮,优化用户操作流程
- 实现同步弹窗的显示逻辑,支持数据列表的刷新
2026-04-07 14:31:48 +08:00

135 lines
3.2 KiB
Vue

<template>
<el-dialog
width="1260px"
title="同步"
:close-on-click-modal="false"
:visible.sync="visible"
@close="handlereset"
style="height: auto;"
>
<div style="margin-bottom: 60px;">
<el-form
style="height: auto;"
class="addFormBox"
:model="dataForm"
:rules="dataRule"
ref="dataForm"
label-width="80px"
>
<el-form-item label="token" prop="token">
<el-input
v-model="dataForm.token"
type="textarea"
:rows="4"
placeholder="token"
></el-input>
</el-form-item>
<el-form-item label="cookie" prop="cookie">
<el-input
v-model="dataForm.cookie"
type="textarea"
:rows="4"
placeholder="cookie"
></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import global from "../../common/common.vue";
export default {
data() {
return {
baseUrl: global.baseUrl,
visible: false,
dataForm: {
token: "",
cookie: ""
},
dataRule: {
token: [
{ required: true, message: "token不能为空", trigger: "blur" }
],
cookie: [
{ required: true, message: "cookie不能为空", trigger: "blur" }
]
},
urlList: {
add: "/common/wxPublicAccount/addWxPublicAccountArticle"
}
};
},
methods: {
init() {
this.dataForm = {
token: "",
cookie: ""
};
this.visible = true;
this.$nextTick(() => {
if (this.$refs["dataForm"]) {
this.$refs["dataForm"].clearValidate();
}
});
},
dataFormSubmit() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
const loading = this.$loading({
lock: true,
fullscreen: true
});
this.$http
.request({
url: this.$http.adornUrl(this.urlList.add),
method: "POST",
data: this.dataForm,
header: {
"Content-Type": "application/json"
}
})
.then(({ data }) => {
loading.close();
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.visible = false;
this.$emit("refreshDataList");
}
});
} else {
this.$message.error(data.msg);
}
})
.catch(() => {
loading.close();
});
}
});
},
handlereset() {
if (this.$refs["dataForm"]) {
this.$refs["dataForm"].clearValidate();
}
this.visible = false;
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .addFormBox.el-form-item {
margin-bottom: 10px !important;
}
</style>