1.代码优化
parent
8ed7700b0d
commit
7683b6aec7
|
|
@ -9,10 +9,10 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
<div v-if="!isEmpty(form.data_source_content)" class="flex-row mt-20 gap-20">
|
<div v-if="!isEmpty(form.data_source_content)" class="flex-row mt-20 gap-20">
|
||||||
<div class="re flex align-c">
|
<div class="re flex align-c">
|
||||||
<image-empty v-model="form.data_source_content[form.img_key]" style="width: 10rem; height: 10rem;"></image-empty>
|
<image-empty v-model="form.data_source_content[form.img_key]" style="width: 10rem; height: 10rem"></image-empty>
|
||||||
<div class="plr-15 bg-f abs replace-data size-14" @click="replace_data">替换数据</div>
|
<div class="plr-15 bg-f abs replace-data size-14" @click="replace_data">替换数据</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 size-14 text-line-3">{{ form.data_source_content.title || form.data_source_content.name }}</div>
|
<div class="flex-1 size-14 text-line-3">{{ form.data_source_content.title || form.data_source_content.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="mb-20">内容设置</div>
|
<div class="mb-20">内容设置</div>
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<url-value-dialog v-model:dialog-visible="url_value_dialog_visible" :type="[ form.data_source ]" @update:model-value="url_value_dialog_call_back" @close="url_value_close"></url-value-dialog>
|
<url-value-dialog v-model:dialog-visible="url_value_dialog_visible" :type="[form.data_source]" @update:model-value="url_value_dialog_call_back" @close="url_value_close"></url-value-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
@ -70,12 +70,12 @@ interface data_list {
|
||||||
name: string;
|
name: string;
|
||||||
field: string;
|
field: string;
|
||||||
type: string;
|
type: string;
|
||||||
};
|
}
|
||||||
interface data_source_content {
|
interface data_source_content {
|
||||||
name: string;
|
name: string;
|
||||||
data: data_list[];
|
data: data_list[];
|
||||||
type: string;
|
type: string;
|
||||||
};
|
}
|
||||||
const getCustominit = () => {
|
const getCustominit = () => {
|
||||||
CustomAPI.getCustominit().then((res) => {
|
CustomAPI.getCustominit().then((res) => {
|
||||||
const { data_source } = res.data;
|
const { data_source } = res.data;
|
||||||
|
|
@ -84,7 +84,7 @@ const getCustominit = () => {
|
||||||
// 数据处理
|
// 数据处理
|
||||||
processing_data(form.data_source);
|
processing_data(form.data_source);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
if (!data_source_store.is_data_source_api) {
|
if (!data_source_store.is_data_source_api) {
|
||||||
|
|
@ -97,13 +97,13 @@ onBeforeMount(() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 处理显示的图片和传递到下去的数据结构
|
// 处理显示的图片和传递到下去的数据结构
|
||||||
const model_data_source = ref<data_list[]>([])
|
const model_data_source = ref<data_list[]>([]);
|
||||||
const processing_data = (key: string) => {
|
const processing_data = (key: string) => {
|
||||||
const list = options.value.filter(item => item.type == key);
|
const list = options.value.filter((item) => item.type == key);
|
||||||
if (list.length > 0) {
|
if (list.length > 0) {
|
||||||
model_data_source.value = list[0].data;
|
model_data_source.value = list[0].data;
|
||||||
// 从中取出包含图片的内容
|
// 从中取出包含图片的内容
|
||||||
const field_list = list[0].data.filter(item => item.type == 'images');
|
const field_list = list[0].data.filter((item) => item.type == 'images');
|
||||||
// 取出图片的key
|
// 取出图片的key
|
||||||
if (field_list.length > 0) {
|
if (field_list.length > 0) {
|
||||||
form.img_key = field_list[0].field;
|
form.img_key = field_list[0].field;
|
||||||
|
|
@ -160,7 +160,7 @@ const changeDataSource = (key: string) => {
|
||||||
if (!isEmpty(key)) {
|
if (!isEmpty(key)) {
|
||||||
url_value_dialog_visible.value = true;
|
url_value_dialog_visible.value = true;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// 弹出框选择的内容
|
// 弹出框选择的内容
|
||||||
const url_value_dialog_call_back = (item: any[]) => {
|
const url_value_dialog_call_back = (item: any[]) => {
|
||||||
|
|
@ -175,13 +175,13 @@ const url_value_close = () => {
|
||||||
if (isEmpty(form.data_source_content)) {
|
if (isEmpty(form.data_source_content)) {
|
||||||
form.data_source = '';
|
form.data_source = '';
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
// 替换数据
|
// 替换数据
|
||||||
const replace_data = () => {
|
const replace_data = () => {
|
||||||
if (!isEmpty(form.data_source)) {
|
if (!isEmpty(form.data_source)) {
|
||||||
url_value_dialog_visible.value = true;
|
url_value_dialog_visible.value = true;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
//#endregion
|
//#endregion
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
@ -206,20 +206,20 @@ const replace_data = () => {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
.el-dialog__header {
|
.el-dialog__header {
|
||||||
padding: 3rem;
|
padding: 2.3rem 2rem;
|
||||||
.el-dialog__title {
|
.el-dialog__title {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
.el-dialog__headerbtn {
|
.el-dialog__headerbtn {
|
||||||
font-size: 2.4rem;
|
font-size: 2.4rem;
|
||||||
padding: 3rem;
|
padding: 2rem;
|
||||||
height: auto;
|
height: auto;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.el-dialog__body {
|
.el-dialog__body {
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
height: calc(100% - 16.4rem);
|
height: calc(100% - 15rem);
|
||||||
}
|
}
|
||||||
.el-dialog__footer {
|
.el-dialog__footer {
|
||||||
padding: 2.4rem 3rem;
|
padding: 2.4rem 3rem;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue