更新接口
This commit is contained in:
parent
072cdf6fdc
commit
b497b15ce4
@ -57,6 +57,9 @@ const getCount = (data) => {
|
||||
const postQa = (data) => {
|
||||
return http.post("/admin/qa", data,"application/json");
|
||||
};
|
||||
const postQaList = (data) => {
|
||||
return http.post("/admin/qa/list", data,"application/json");
|
||||
};
|
||||
const putQa = (id,data) => {
|
||||
return http.put("/admin/qa/"+id ,data,"application/json");
|
||||
};
|
||||
@ -157,6 +160,7 @@ export default {
|
||||
updatePassword,
|
||||
getCount,
|
||||
postQa,
|
||||
postQaList,
|
||||
putQa,
|
||||
putRule,
|
||||
postQaitem,
|
||||
|
||||
@ -46,8 +46,10 @@
|
||||
<el-form-item label="密码" :label-width="formLabelWidth" prop="qa_password">
|
||||
<el-input v-model="FormData.qa_password" style="width: 60%;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否允许重复" :label-width="formLabelWidth" prop="is_repeat">
|
||||
<el-switch v-model="FormData.is_repeat" :active-value="1" :inactive-value="0" />
|
||||
<el-form-item label="是否允许重复" :label-width="formLabelWidth" prop="is_repeat" >
|
||||
<el-select v-model="repeat_qa_id" placeholder="请选择" multiple >
|
||||
<el-option v-for="item in qaList" :key="item.qa_id" :label="item.qa_name" :value="item.qa_id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启计时器" :label-width="formLabelWidth" prop="is_turn_timer">
|
||||
<el-switch v-model="FormData.is_turn_timer" :active-value="1" :inactive-value="0" />
|
||||
@ -226,6 +228,8 @@ const rules = reactive({
|
||||
}]
|
||||
|
||||
})
|
||||
const repeat_qa_id=ref([])
|
||||
const qaList=ref([])
|
||||
const dialogImageUrl = ref("");
|
||||
const dialogVisiblei = ref(false);
|
||||
const feihua = ref(false);
|
||||
@ -288,13 +292,13 @@ console.log(question_times.value)
|
||||
if(props.action_type=="1")
|
||||
{
|
||||
|
||||
emits("save-click",props.action_type,'',content.value,base_token_item.value,question_times.value);
|
||||
emits("save-click",props.action_type,'',content.value,base_token_item.value,question_times.value,repeat_qa_id.value);
|
||||
}
|
||||
|
||||
else if(props.action_type=='2')
|
||||
{
|
||||
// console.log(base_token_item.value)
|
||||
emits("save-click",props.action_type,action.value,content.value,base_token_item.value,question_times.value);
|
||||
emits("save-click",props.action_type,action.value,content.value,base_token_item.value,question_times.value,repeat_qa_id.value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,8 +306,17 @@ const handleCloseDialog=() => {
|
||||
base_token_item.value=[]
|
||||
question_times.value=[]
|
||||
isfirst.value=true
|
||||
repeat_qa_id.value=[]
|
||||
emits("closeDialog");
|
||||
}
|
||||
const postQaList=()=>{
|
||||
request.postQaList().then((res) => {
|
||||
|
||||
qaList.value = res.data.data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const open = (titles, spans) => {
|
||||
|
||||
@ -446,6 +459,25 @@ watch(() => props.FormData.question_qa_timer, (newVal, oldVal) => {
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => props.FormData.repeat_qa_id, (newVal, oldVal) => {
|
||||
|
||||
|
||||
initqa()
|
||||
|
||||
})
|
||||
const initqa = () => {
|
||||
|
||||
repeat_qa_id.value=[]
|
||||
if(props.FormData.repeat_qa_id!=null&&props.FormData.repeat_qa_id.length>0)
|
||||
{
|
||||
|
||||
props.FormData.repeat_qa_id.forEach((item,index)=>{
|
||||
repeat_qa_id.value.push(item.qa_id)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
watch(() => props.FormData.base_token_item, (newVal, oldVal) => {
|
||||
|
||||
|
||||
@ -466,7 +498,10 @@ const inittoken = () => {
|
||||
const dialogVisibles=ref(false)
|
||||
watch(() => props.dialogVisible, (newVal, oldVal) => {
|
||||
dialogVisibles.value=props.dialogVisible
|
||||
|
||||
if(dialogVisibles.value)
|
||||
{
|
||||
postQaList()
|
||||
}
|
||||
})
|
||||
watch(()=> props.fileList, (newVal, oldVal) => {
|
||||
|
||||
|
||||
@ -25,11 +25,6 @@
|
||||
<el-form-item label="飞花令数" :label-width="formLabelWidth" prop="token_nums" v-else >
|
||||
<el-input v-model="FormData.token_num" style="width: 60%;" type="number" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="呈现类型" :label-width="formLabelWidth" prop="qa_display_type">
|
||||
<el-select v-model="FormData.qa_display_type" placeholder="请选择" @change="changeDisplayType" >
|
||||
<el-option v-for="item in optionstype" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="飞花令类型" :label-width="formLabelWidth" prop="feihua_type" >
|
||||
<el-select v-model="base_token_item" placeholder="请选择" multiple >
|
||||
<el-option v-for="item in tokenlist" :key="item.token_id" :label="item.token_name" :value="item.token_id" />
|
||||
@ -55,8 +50,13 @@
|
||||
<el-form-item label="密码" :label-width="formLabelWidth" prop="qa_password">
|
||||
<el-input v-model="FormData.qa_password" style="width: 60%;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否允许重复" :label-width="formLabelWidth" prop="is_repeat">
|
||||
<!-- <el-form-item label="是否允许重复" :label-width="formLabelWidth" prop="is_repeat">
|
||||
<el-switch v-model="FormData.is_repeat" :active-value="1" :inactive-value="0" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="是否允许重复" :label-width="formLabelWidth" prop="is_repeat" >
|
||||
<el-select v-model="repeat_qa_id" placeholder="请选择" multiple >
|
||||
<el-option v-for="item in qaList" :key="item.qa_id" :label="item.qa_name" :value="item.qa_id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启计时器" :label-width="formLabelWidth" prop="is_turn_timer">
|
||||
<el-switch v-model="FormData.is_turn_timer" :active-value="1" :inactive-value="0" />
|
||||
@ -301,6 +301,8 @@ const emits = defineEmits(["save-click","closeDialog"]);
|
||||
const action=ref(1)
|
||||
const isfirst=ref(true)
|
||||
const base_token_item=ref([])
|
||||
const repeat_qa_id=ref([])
|
||||
const qaList=ref([])
|
||||
function onSubmit() {
|
||||
if(quantitynumber.value<props.FormData.token_num)
|
||||
{
|
||||
@ -315,13 +317,13 @@ function onSubmit() {
|
||||
if(props.action_type=="1")
|
||||
{
|
||||
|
||||
emits("save-click",props.action_type,'',content.value,base_token_item.value,question_types.value,question_times.value);
|
||||
emits("save-click",props.action_type,'',content.value,base_token_item.value,question_types.value,question_times.value,repeat_qa_id.value);
|
||||
}
|
||||
|
||||
else if(props.action_type=='2')
|
||||
{
|
||||
console.log(base_token_item.value)
|
||||
emits("save-click",props.action_type,action.value,content.value,base_token_item.value,question_types.value,question_times.value);
|
||||
emits("save-click",props.action_type,action.value,content.value,base_token_item.value,question_types.value,question_times.value,repeat_qa_id.value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,6 +332,7 @@ const handleCloseDialog=() => {
|
||||
question_types.value=[]
|
||||
base_token_item.value=[]
|
||||
question_times.value=[]
|
||||
repeat_qa_id.value=[]
|
||||
emits("closeDialog");
|
||||
}
|
||||
|
||||
@ -503,6 +506,27 @@ watch(() => props.FormData.base_token_item, (newVal, oldVal) => {
|
||||
inittoken()
|
||||
|
||||
})
|
||||
|
||||
watch(() => props.FormData.repeat_qa_id, (newVal, oldVal) => {
|
||||
|
||||
|
||||
initqa()
|
||||
|
||||
})
|
||||
|
||||
const initqa = () => {
|
||||
|
||||
repeat_qa_id.value=[]
|
||||
if(props.FormData.repeat_qa_id!=null&&props.FormData.repeat_qa_id.length>0)
|
||||
{
|
||||
|
||||
props.FormData.repeat_qa_id.forEach((item,index)=>{
|
||||
repeat_qa_id.value.push(item.qa_id)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const inittoken = () => {
|
||||
|
||||
base_token_item.value=[]
|
||||
@ -517,6 +541,11 @@ const inittoken = () => {
|
||||
const dialogVisibles=ref(false)
|
||||
watch(() => props.dialogVisible, (newVal, oldVal) => {
|
||||
dialogVisibles.value=props.dialogVisible
|
||||
if(dialogVisibles.value)
|
||||
{
|
||||
postQaList()
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
watch(()=> props.fileList, (newVal, oldVal) => {
|
||||
@ -554,7 +583,7 @@ const initLabel = () => {
|
||||
tokenlist.value = res.data.data
|
||||
|
||||
})
|
||||
|
||||
// postQaList()
|
||||
}
|
||||
|
||||
|
||||
@ -681,6 +710,13 @@ request.getOssSign({
|
||||
})
|
||||
}
|
||||
|
||||
const postQaList=()=>{
|
||||
request.postQaList().then((res) => {
|
||||
|
||||
qaList.value = res.data.data
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
::v-deep input::-webkit-outer-spin-button,
|
||||
|
||||
@ -198,8 +198,8 @@
|
||||
|
||||
// },
|
||||
]
|
||||
,
|
||||
is_repeat:0
|
||||
,
|
||||
repeat_qa_id:[]
|
||||
})
|
||||
|
||||
|
||||
@ -261,7 +261,7 @@ const closeDialogs=() => {
|
||||
|
||||
dialogVisibles.value = false
|
||||
}
|
||||
const saves = (action_type,action,content,base_token_item,question_times) => {
|
||||
const saves = (action_type,action,content,base_token_item,question_times,repeat_qa_id) => {
|
||||
FoData.value.question_qa_timer=[]
|
||||
if(FoData.value.is_turn_timer=='1')
|
||||
{
|
||||
@ -300,7 +300,21 @@ if(question_times.type4!='')
|
||||
|
||||
}
|
||||
|
||||
if(repeat_qa_id.length>0)
|
||||
{
|
||||
FoData.value.repeat_qa_id=[]
|
||||
repeat_qa_id.forEach((item,index)=>{
|
||||
FoData.value.repeat_qa_id.push({
|
||||
qa_id:item,
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
FoData.value.repeat_qa_id=null
|
||||
}
|
||||
|
||||
|
||||
if(FoData.value.qa_display_type==2)
|
||||
@ -430,7 +444,6 @@ const ItemViewshow = (item) => {
|
||||
FoData.value.qa_password=res.data.data.qa_password
|
||||
FoData.value.image=res.data.data.image
|
||||
FoData.value.is_turn_timer=res.data.data.is_turn_timer
|
||||
FoData.value.is_repeat=res.data.data.is_repeat
|
||||
fileList.value=[]
|
||||
fileList.value.push({url:FoData.value.image})
|
||||
FoData.value.question_qa_item=[]
|
||||
@ -455,6 +468,14 @@ const ItemViewshow = (item) => {
|
||||
FoData.value.question_qa_timer=res.data.data.question_qa_timer
|
||||
}
|
||||
|
||||
if(res.data.data.repeat_qa_id==null)
|
||||
{
|
||||
FoData.value.repeat_qa_id=[]
|
||||
}
|
||||
else
|
||||
{
|
||||
FoData.value.repeat_qa_id=res.data.data.repeat_qa_id
|
||||
}
|
||||
|
||||
|
||||
dialogVisibleShows()
|
||||
|
||||
@ -198,6 +198,7 @@
|
||||
|
||||
// },
|
||||
]
|
||||
, repeat_qa_id:[]
|
||||
})
|
||||
|
||||
|
||||
@ -259,7 +260,7 @@ const closeDialogs=() => {
|
||||
|
||||
dialogVisibles.value = false
|
||||
}
|
||||
const saves = (action_type,action,content,base_token_item,question_types,question_times) => {
|
||||
const saves = (action_type,action,content,base_token_item,question_types,question_times,repeat_qa_id) => {
|
||||
FoData.value.question_qa_timer=[]
|
||||
if(FoData.value.is_turn_timer=='1')
|
||||
{
|
||||
@ -319,6 +320,21 @@ if(question_types.type4!='')
|
||||
}
|
||||
|
||||
|
||||
if(repeat_qa_id.length>0)
|
||||
{
|
||||
FoData.value.repeat_qa_id=[]
|
||||
repeat_qa_id.forEach((item,index)=>{
|
||||
FoData.value.repeat_qa_id.push({
|
||||
qa_id:item,
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
FoData.value.repeat_qa_id=null
|
||||
}
|
||||
if(FoData.value.qa_display_type==2)
|
||||
{
|
||||
if(base_token_item.length>0)
|
||||
@ -466,7 +482,7 @@ const ItemViewshow = (item) => {
|
||||
FoData.value.base_token_item=res.data.data.base_token_item
|
||||
}
|
||||
FoData.value.is_turn_timer=res.data.data.is_turn_timer
|
||||
FoData.value.is_repeat=res.data.data.is_repeat
|
||||
// FoData.value.is_repeat=res.data.data.is_repeat
|
||||
if(res.data.data.question_qa_timer==null)
|
||||
{
|
||||
FoData.value.question_qa_timer=[]
|
||||
@ -475,6 +491,15 @@ const ItemViewshow = (item) => {
|
||||
{
|
||||
FoData.value.question_qa_timer=res.data.data.question_qa_timer
|
||||
}
|
||||
if(res.data.data.repeat_qa_id==null)
|
||||
{
|
||||
FoData.value.repeat_qa_id=[]
|
||||
}
|
||||
else
|
||||
{
|
||||
FoData.value.repeat_qa_id=res.data.data.repeat_qa_id
|
||||
}
|
||||
|
||||
|
||||
|
||||
dialogVisibleShows()
|
||||
|
||||
@ -199,7 +199,7 @@
|
||||
// },
|
||||
]
|
||||
,
|
||||
is_repeat:0
|
||||
repeat_qa_id:[]
|
||||
})
|
||||
|
||||
|
||||
@ -261,7 +261,7 @@ const closeDialogs=() => {
|
||||
|
||||
dialogVisibles.value = false
|
||||
}
|
||||
const saves = (action_type,action,content,base_token_item,question_types,question_times) => {
|
||||
const saves = (action_type,action,content,base_token_item,question_types,question_times,repeat_qa_id) => {
|
||||
FoData.value.question_qa_timer=[]
|
||||
if(FoData.value.is_turn_timer=='1')
|
||||
{
|
||||
@ -315,8 +315,23 @@ if(question_types.type4!='')
|
||||
|
||||
}
|
||||
|
||||
console.log('repeat_qa_id'+repeat_qa_id)
|
||||
|
||||
if(repeat_qa_id.length>0)
|
||||
{
|
||||
FoData.value.repeat_qa_id=[]
|
||||
repeat_qa_id.forEach((item,index)=>{
|
||||
FoData.value.repeat_qa_id.push({
|
||||
qa_id:item,
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
FoData.value.repeat_qa_id=null
|
||||
}
|
||||
|
||||
if(FoData.value.qa_display_type==2)
|
||||
{
|
||||
@ -465,7 +480,7 @@ const ItemViewshow = (item) => {
|
||||
FoData.value.base_token_item=res.data.data.base_token_item
|
||||
}
|
||||
FoData.value.is_turn_timer=res.data.data.is_turn_timer
|
||||
FoData.value.is_repeat=res.data.data.is_repeat
|
||||
|
||||
if(res.data.data.question_qa_timer==null)
|
||||
{
|
||||
FoData.value.question_qa_timer=[]
|
||||
@ -474,6 +489,16 @@ const ItemViewshow = (item) => {
|
||||
{
|
||||
FoData.value.question_qa_timer=res.data.data.question_qa_timer
|
||||
}
|
||||
if(res.data.data.repeat_qa_id==null)
|
||||
{
|
||||
FoData.value.repeat_qa_id=[]
|
||||
}
|
||||
else
|
||||
{
|
||||
FoData.value.repeat_qa_id=res.data.data.repeat_qa_id
|
||||
}
|
||||
|
||||
|
||||
console.log(FoData.value.question_qa_timer)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user