58 lines
1.9 KiB
Vue
58 lines
1.9 KiB
Vue
<script setup lang="ts">
|
|
import { ref, onMounted } from "vue";
|
|
import RichText from '@/components/RichText/index.vue';
|
|
import { queryGiftList } from '@/api/modules/blindBox'
|
|
const ruleFormRef = ref();
|
|
const typeList = ref([])
|
|
const formRules = ref({
|
|
gift_id: [{ required: true, message: "请选择礼物", trigger: "change" }],
|
|
introd: [{ required: true, message: "请输入玩法介绍", trigger: "blur" }],
|
|
description: [{ required: true, message: "请输入说明", trigger: "blur" }]
|
|
});
|
|
const props = defineProps(["formInline"]);
|
|
const newFormInline = ref(
|
|
props.formInline
|
|
? props.formInline
|
|
: {
|
|
gift_id: "",
|
|
description: "",
|
|
introd: ""
|
|
}
|
|
);
|
|
function getRef() {
|
|
return ruleFormRef.value;
|
|
}
|
|
const getList = async () => {
|
|
const { data, code } = await queryGiftList()
|
|
typeList.value = code ? data : []
|
|
}
|
|
function chanageEditorValue(val) {
|
|
newFormInline.value.introd = val
|
|
}
|
|
onMounted(() => {
|
|
getList()
|
|
})
|
|
defineExpose({ getRef });
|
|
</script>
|
|
|
|
<template>
|
|
<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="120px">
|
|
<el-form-item label="绑定礼物ID" prop="gift_id">
|
|
<el-input placeholder="请输入绑定礼物ID" v-model="newFormInline.gift_id">
|
|
</el-input>
|
|
<!-- <el-select v-model="newFormInline.gift_id" placeholder="请选择礼物">
|
|
<el-option v-for="item in typeList" :key="item.gid" :label="item.gift_name" :value="item.gid">
|
|
</el-option>
|
|
</el-select> -->
|
|
</el-form-item>
|
|
<!-- <el-form-item label="说明" prop="description">
|
|
<el-input type="textarea" placeholder="请输入说明" v-model="newFormInline.description" maxlength="16" show-word-limit>
|
|
</el-input>
|
|
</el-form-item> -->
|
|
<el-form-item label="玩法介绍" prop="introd">
|
|
<RichText style="border: 1px solid #ccc;" :echoValue="newFormInline.introd" @changeValue="chanageEditorValue">
|
|
</RichText>
|
|
</el-form-item>
|
|
</el-form>
|
|
</template>
|