update
This commit is contained in:
@@ -20,11 +20,20 @@ const visible = ref(false);
|
||||
watch(
|
||||
() => visible.value,
|
||||
(val) => {
|
||||
if (val) Object.assign(form, detail);
|
||||
if (val) {
|
||||
Object.assign(form, detail);
|
||||
if (form.single_id === 0) form.single_id = null;
|
||||
if (form.pop_type === 0) form.pop_type = 1;
|
||||
}
|
||||
}
|
||||
)
|
||||
const form = reactive({
|
||||
file: null,
|
||||
files: [],
|
||||
pop_images: [],
|
||||
pop_video: [],
|
||||
single_id: null,
|
||||
pop_type: 1,
|
||||
type: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -16,6 +16,11 @@ const form = reactive({
|
||||
title: null,
|
||||
content: null,
|
||||
type: null,
|
||||
files: [],
|
||||
pop_images: [],
|
||||
pop_video: [],
|
||||
single_id: null,
|
||||
pop_type: 1,
|
||||
url: null,
|
||||
id: null,
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import {reactive, ref, watch} from 'vue';
|
||||
import XSelect from "../../../../../../../components/XSelect/index.vue";
|
||||
import Api from "../../../../../../../api/index.js";
|
||||
import {Message} from "@arco-design/web-vue";
|
||||
import UploadAvatar from "../../../../../../../components/upload/UploadAvatar.vue";
|
||||
|
||||
const emits = defineEmits(['success']);
|
||||
const {pid, detail} = defineProps({
|
||||
@@ -20,6 +21,11 @@ const visible = ref(false);
|
||||
|
||||
const form = reactive({
|
||||
type: null,
|
||||
files: [],
|
||||
pop_images: [],
|
||||
pop_video: [],
|
||||
single_id: null,
|
||||
pop_type: 1,
|
||||
title: null,
|
||||
category_id: null,
|
||||
content: null,
|
||||
@@ -28,7 +34,11 @@ const form = reactive({
|
||||
watch(
|
||||
() => visible.value,
|
||||
(val) => {
|
||||
if (val) Object.assign(form, detail);
|
||||
if (val) {
|
||||
Object.assign(form, detail);
|
||||
if (form.single_id === 0) form.single_id = null;
|
||||
if (form.pop_type === 0) form.pop_type = 1;
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -58,7 +68,7 @@ const success = async () => {
|
||||
|
||||
<a-modal
|
||||
@ok="success"
|
||||
title="新增常见问题"
|
||||
:title="`${detail.id ? '编辑' : '新增'}基础教学`"
|
||||
title-align="start"
|
||||
v-model:visible="visible">
|
||||
<a-form
|
||||
@@ -67,11 +77,18 @@ const success = async () => {
|
||||
<a-form-item label="二级分类">
|
||||
<XSelect
|
||||
v-model:model-value="form.category_id"
|
||||
:init="true"
|
||||
:api="Api.admin.getArticleCategoryList2"
|
||||
:api-po="{pid}"
|
||||
placeholder="请选择二级分类">
|
||||
</XSelect>
|
||||
</a-form-item>
|
||||
<a-form-item label="封面">
|
||||
<UploadAvatar
|
||||
:multiple="false"
|
||||
v-model:files="form.files">
|
||||
</UploadAvatar>
|
||||
</a-form-item>
|
||||
<a-form-item label="标题">
|
||||
<a-input v-model:model-value="form.title" placeholder="请输入标题"></a-input>
|
||||
</a-form-item>
|
||||
|
||||
@@ -56,7 +56,7 @@ const success = async () => {
|
||||
|
||||
<a-modal
|
||||
@ok="success"
|
||||
title="新增常见问题"
|
||||
title="新增"
|
||||
title-align="start"
|
||||
v-model:visible="visible">
|
||||
<a-form
|
||||
@@ -65,6 +65,7 @@ const success = async () => {
|
||||
<a-form-item label="二级分类">
|
||||
<XSelect
|
||||
v-model:model-value="form.category_id"
|
||||
:init="true"
|
||||
:api="Api.admin.getArticleCategoryList2"
|
||||
:api-po="{pid}"
|
||||
placeholder="请选择二级分类">
|
||||
|
||||
@@ -13,6 +13,10 @@ const {maxClass, pid, detail} = defineProps({
|
||||
detail: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
maxClass: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
}
|
||||
});
|
||||
|
||||
@@ -30,19 +34,17 @@ watch(
|
||||
)
|
||||
|
||||
const getData = async () => {
|
||||
return new Promise((resolve) => {
|
||||
resolve({
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
name: '常见问题',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '基础教学',
|
||||
},
|
||||
]
|
||||
});
|
||||
return Promise.resolve({
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
name: '常见问题',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '基础教学',
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -86,11 +88,13 @@ const success = async () => {
|
||||
:model="form">
|
||||
<a-form-item label="一级分类">
|
||||
<XSelect
|
||||
:init="true"
|
||||
:default-value="maxClass"
|
||||
:api="getData"
|
||||
placeholder="请选择二级分类"
|
||||
:disabled="true">
|
||||
</XSelect>
|
||||
{{ maxClass }}
|
||||
</a-form-item>
|
||||
<a-form-item label="二级分类名称">
|
||||
<a-input v-model:model-value="form.name" placeholder="请输入二级分类名称"></a-input>
|
||||
|
||||
@@ -40,8 +40,8 @@ const success = () => {
|
||||
<a-input-number v-model:model-value="po.retention_time" placeholder="请输入保留时间" :min="1"
|
||||
:max="60"></a-input-number>
|
||||
<a-radio-group v-model:model-value="po.retention_type" type="button" class="ml-[10px] flex-shrink-0">
|
||||
<a-radio :value="0">分钟</a-radio>
|
||||
<a-radio :value="1">小时</a-radio>
|
||||
<a-radio :value="1">分钟</a-radio>
|
||||
<a-radio :value="2">小时</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
||||
@@ -49,8 +49,8 @@ const success = () => {
|
||||
<a-input-number v-model:model-value="po.check_time" placeholder="请输入保留时间" :min="1"
|
||||
:max="60"></a-input-number>
|
||||
<a-radio-group v-model:model-value="po.check_type" type="button" class="ml-[10px] flex-shrink-0">
|
||||
<a-radio :value="0">分钟</a-radio>
|
||||
<a-radio :value="1">小时</a-radio>
|
||||
<a-radio :value="1">分钟</a-radio>
|
||||
<a-radio :value="2">小时</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
||||
@@ -71,8 +71,8 @@ const success = () => {
|
||||
<a-input v-model:model-value="po.back_time" placeholder="请说入时间"></a-input>
|
||||
<a-radio-group v-model:model-value="po.back_type" type="button"
|
||||
class="ml-[10px] flex-shrink-0">
|
||||
<a-radio :value="0">分钟</a-radio>
|
||||
<a-radio :value="1">小时</a-radio>
|
||||
<a-radio :value="1">分钟</a-radio>
|
||||
<a-radio :value="2">小时</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
Reference in New Issue
Block a user