fix: 🧩 修复测试bug
This commit is contained in:
@@ -17,6 +17,11 @@
|
||||
<template #sort="scope">
|
||||
<el-input v-model="scope.row.sort" @blur="handleBlur(scope.row)" @input="handleInput(scope.row)"></el-input>
|
||||
</template>
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'" effect="dark">{{
|
||||
scope.row.status === 1 ? "启用" : "禁用"
|
||||
}}</el-tag>
|
||||
</template>
|
||||
<template #operation="scope">
|
||||
<el-button size="small" type="primary" @click="getBannerRead(scope.row.id)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="getBannerDel(scope.row.id)">删除</el-button>
|
||||
@@ -147,7 +152,7 @@ const buildTree = (data: any, outerLinkTo: any = "") => {
|
||||
};
|
||||
// let isFirstRequest = true;
|
||||
const handleRadioGroupEmits = (value: any) => {
|
||||
getBannerClassList();
|
||||
// getBannerClassList();
|
||||
if (value === "image") {
|
||||
dataStore.isFirstRequest = true;
|
||||
dataStore.editFormData = EDIT_FORM_DATA;
|
||||
@@ -184,6 +189,13 @@ const getSystemUrls = async (node: any, resolve: any) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
const setImgOrVideo = () => {
|
||||
if (dataStore.editRuleForm.type === "image") {
|
||||
dataStore.editFormData = EDIT_FORM_DATA;
|
||||
} else {
|
||||
dataStore.editFormData = EDIT_FORM_DATA1;
|
||||
}
|
||||
};
|
||||
// 详情
|
||||
const getBannerRead = async (id: any) => {
|
||||
dataStore.title = "编辑Banner";
|
||||
@@ -191,6 +203,7 @@ const getBannerRead = async (id: any) => {
|
||||
const result = await getBannerReadApi(id);
|
||||
if (result?.code === 0) {
|
||||
dataStore.editRuleForm = result?.data;
|
||||
setImgOrVideo();
|
||||
if (dataStore.editRuleForm.link && dataStore.editRuleForm.link_to) {
|
||||
let { id, name, link } = dataStore.editRuleForm.link_echo_data;
|
||||
let obj: any = {
|
||||
@@ -239,18 +252,29 @@ const getBannerUp = async () => {
|
||||
|
||||
// 分类
|
||||
const getBannerClassList = async () => {
|
||||
const result = await getBannerClassListApi();
|
||||
const result = await getBannerClassListApi({ is_show: 0 });
|
||||
if (result?.code === 0) {
|
||||
let arr: any = [];
|
||||
result?.data?.forEach((item: any) => {
|
||||
arr.push({ value: item.id, label: item.name });
|
||||
});
|
||||
console.log(arr, "========arr===============");
|
||||
dataStore.formData[1].options = arr;
|
||||
dataStore.editFormData[4].options = arr;
|
||||
// dataStore.editFormData[4].options = arr;
|
||||
}
|
||||
};
|
||||
getBannerClassList();
|
||||
//详情里的分类
|
||||
const getBannerClassEditList = async () => {
|
||||
const result = await getBannerClassListApi({ is_show: 1 });
|
||||
if (result?.code === 0) {
|
||||
let arr: any = [];
|
||||
result?.data?.forEach((item: any) => {
|
||||
arr.push({ value: item.id, label: item.name });
|
||||
});
|
||||
dataStore.editFormData[4].options = arr;
|
||||
}
|
||||
};
|
||||
getBannerClassEditList();
|
||||
// 新增 getBannerListSave
|
||||
const getBannerListSave = async () => {
|
||||
const result = await getBannerListSaveApi(dataStore.editRuleForm);
|
||||
@@ -343,6 +367,21 @@ const handleBlur = (row: any) => {
|
||||
const handleInput = (row: any) => {
|
||||
row.sort = integerRexg(row.sort);
|
||||
};
|
||||
// watch(
|
||||
// () => dataStore.editRuleForm.type,
|
||||
// newVal => {
|
||||
// console.log(dataStore.editRuleForm.type);
|
||||
// if (newVal === "video") {
|
||||
// dataStore.editFormData = EDIT_FORM_DATA1;
|
||||
// } else {
|
||||
// dataStore.editFormData = EDIT_FORM_DATA;
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// immediate: true,
|
||||
// deep: true
|
||||
// }
|
||||
// );
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user