157 lines
3.9 KiB
Vue
157 lines
3.9 KiB
Vue
<template>
|
|
<div class="percentage-content">
|
|
<el-radio-group class="rg" v-model="tabIndex" @change="changeRadio">
|
|
<template v-for="item in tabs" :key="item.val">
|
|
<el-radio-button class="rb" :label="item.val">{{
|
|
item.name
|
|
}}</el-radio-button>
|
|
</template>
|
|
</el-radio-group>
|
|
<div class="content">
|
|
<div class="qedit">
|
|
<QuillEditor
|
|
class="qedit"
|
|
:value="formData.dealContent"
|
|
@updateValue="getMsg"
|
|
:id="formData.dealKeyId || uuid"
|
|
:userId="userId"
|
|
:FileType="FileType.agreement"
|
|
/>
|
|
</div>
|
|
<div class="option">
|
|
<el-button type="primary" class="btn" @click="save">保存</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang='ts' setup>
|
|
import { onMounted, reactive, ref } from "vue";
|
|
import { ElMessage, FormInstance, FormRules, ElMessageBox } from "element-plus";
|
|
import { dealSetting, saveSetting } from "@/api/Sys";
|
|
import { getYears, getUUID, FileType } from "@/utils/common";
|
|
import useUserStore from "@/store/modules/user";
|
|
import { log } from "console";
|
|
const userStore = useUserStore();
|
|
const user = ref(JSON.parse(userStore.userInfo));
|
|
const userId = ref(user.value.userId);
|
|
const tabIndex = ref("user_deal");
|
|
const tabs = ref([
|
|
{ name: "用户协议", val: "user_deal" },
|
|
{ name: "隐私协议", val: "privacy_deal" },
|
|
]);
|
|
|
|
const formData = ref<any>({ dealContent: "" });
|
|
const msgContent = ref("");
|
|
const getMsg = (val) => {
|
|
msgContent.value = val;
|
|
};
|
|
//查询基础设置
|
|
const getDealSetting = () => {
|
|
let params = {
|
|
dealKeyWord: tabIndex.value,
|
|
};
|
|
dealSetting(params).then((res: any) => {
|
|
console.log(res, "res===>");
|
|
formData.value = res.data;
|
|
});
|
|
};
|
|
// 保存
|
|
const save = () => {
|
|
let params = {};
|
|
switch (tabIndex.value) {
|
|
case "user_deal":
|
|
params = {
|
|
keyWord: "user_deal",
|
|
keyName: "用户协议",
|
|
keyContent: msgContent.value,
|
|
};
|
|
break;
|
|
case "privacy_deal":
|
|
params = {
|
|
keyWord: "privacy_deal",
|
|
keyName: "隐私协议",
|
|
keyContent: msgContent.value,
|
|
};
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
console.log(params, "params===>");
|
|
saveSetting(params).then((res: any) => {
|
|
if (res.code == 1) {
|
|
ElMessage.success({
|
|
message: "保存成功",
|
|
// type: "success",
|
|
});
|
|
getDealSetting();
|
|
} else {
|
|
ElMessage.error({
|
|
message: res.message,
|
|
type: "error",
|
|
});
|
|
}
|
|
});
|
|
};
|
|
const changeRadio = (e) => {
|
|
getDealSetting();
|
|
};
|
|
onMounted(() => {
|
|
getDealSetting();
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.percentage-content {
|
|
height: auto;
|
|
display: flex;
|
|
flex-direction: column;
|
|
.rg {
|
|
padding: 16px;
|
|
background: #fff;
|
|
box-shadow: 0 0 6px rgb(0 120 255 / 10%);
|
|
border-radius: 6px;
|
|
display: flex;
|
|
flex-direction: row;
|
|
margin-bottom: 10px;
|
|
:deep(.el-radio-button__inner) {
|
|
min-width: 150px;
|
|
}
|
|
}
|
|
.content {
|
|
width: 100%;
|
|
background: #fff;
|
|
border-radius: 0.26042vw;
|
|
box-shadow: 0 0 0.41667vw 0 rgb(8 33 85 / 10%);
|
|
padding: 0.83333vw;
|
|
overflow-y: auto;
|
|
overflow-x: hidden !important;
|
|
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
-moz-box-sizing: border-box;
|
|
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
-webkit-box-sizing: border-box;
|
|
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
-o-box-sizing: border-box;
|
|
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
-ms-box-sizing: border-box;
|
|
/* stylelint-disable-next-line indentation */
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
display: flex;
|
|
flex-direction: column;
|
|
.qedit {
|
|
height: 63vh;
|
|
}
|
|
.option {
|
|
margin: 50px 0 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
.btn {
|
|
width: 10vw;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|