Compare commits
4 Commits
072cdf6fdc
...
0999e92241
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0999e92241 | ||
|
|
9823758d07 | ||
|
|
fa7774fba1 | ||
|
|
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,13 +46,16 @@
|
||||
<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 filterable
|
||||
remote remote-show-suffix :remote-method="remoteMethod" style="width: 60%;" >
|
||||
<el-option v-for="item in options" :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" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="计时时间(秒)" :label-width="formLabelWidth" prop="tirm_set" v-if="FormData.is_turn_timer==1" >
|
||||
<span style="margin-right: 5px;">单选题</span><el-input v-model="question_times.type1" style="width: 100px;" type="number" />
|
||||
<span style="margin-right: 5px;margin-left: 32px;">多选题</span><el-input v-model="question_times.type2" style="width: 100px;" type="number" />
|
||||
@ -226,9 +229,13 @@ const rules = reactive({
|
||||
}]
|
||||
|
||||
})
|
||||
const repeat_qa_id=ref([])
|
||||
const qaList=ref([])
|
||||
const options = ref([])
|
||||
const dialogImageUrl = ref("");
|
||||
const dialogVisiblei = ref(false);
|
||||
const feihua = ref(false);
|
||||
const suffix = ref(true);
|
||||
const question_times=ref(
|
||||
{
|
||||
type1:'',
|
||||
@ -257,6 +264,9 @@ FormData: {
|
||||
action_type:{
|
||||
type:String,
|
||||
default:"1"//0修改密码//1增加数据//2修改数据//3规则//4链接//5选择题目类型
|
||||
},
|
||||
qa_id:{
|
||||
type:String
|
||||
}
|
||||
})
|
||||
const content = ref('');
|
||||
@ -288,13 +298,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 +312,19 @@ const handleCloseDialog=() => {
|
||||
base_token_item.value=[]
|
||||
question_times.value=[]
|
||||
isfirst.value=true
|
||||
repeat_qa_id.value=[]
|
||||
emits("closeDialog");
|
||||
}
|
||||
const postQaList=()=>{
|
||||
request.postQaList().then((res) => {
|
||||
const newList = res.data.data.filter(item => item.qa_id !== props.qa_id);
|
||||
qaList.value =[]
|
||||
qaList.value = [...newList]
|
||||
options.value = qaList.value
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const open = (titles, spans) => {
|
||||
|
||||
@ -446,6 +467,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 +506,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) => {
|
||||
|
||||
@ -652,6 +695,20 @@ request.getOssSign({
|
||||
feihua.value=false
|
||||
}
|
||||
}
|
||||
|
||||
const remoteMethod = (query) => {
|
||||
if (query) {
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
options.value = qaList.value.filter((item) => {
|
||||
return item.qa_name.toLowerCase().includes(query.toLowerCase())
|
||||
})
|
||||
}, 200)
|
||||
} else {
|
||||
options.value = qaList.value
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
::v-deep input::-webkit-outer-spin-button,
|
||||
|
||||
@ -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,14 @@
|
||||
<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 filterable
|
||||
remote remote-show-suffix :remote-method="remoteMethod" style="width: 60%;" >
|
||||
<el-option v-for="item in options" :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" />
|
||||
@ -285,6 +286,9 @@ FormData: {
|
||||
feihua3:{
|
||||
type: Boolean,
|
||||
default: false //是否是知识问答3
|
||||
},
|
||||
qa_id:{
|
||||
type:String
|
||||
}
|
||||
})
|
||||
const content = ref('');
|
||||
@ -301,6 +305,9 @@ 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 options = ref([])
|
||||
const qaList=ref([])
|
||||
function onSubmit() {
|
||||
if(quantitynumber.value<props.FormData.token_num)
|
||||
{
|
||||
@ -315,13 +322,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 +337,7 @@ const handleCloseDialog=() => {
|
||||
question_types.value=[]
|
||||
base_token_item.value=[]
|
||||
question_times.value=[]
|
||||
repeat_qa_id.value=[]
|
||||
emits("closeDialog");
|
||||
}
|
||||
|
||||
@ -503,6 +511,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 +546,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 +588,7 @@ const initLabel = () => {
|
||||
tokenlist.value = res.data.data
|
||||
|
||||
})
|
||||
|
||||
// postQaList()
|
||||
}
|
||||
|
||||
|
||||
@ -681,6 +715,28 @@ request.getOssSign({
|
||||
})
|
||||
}
|
||||
|
||||
const postQaList=()=>{
|
||||
request.postQaList().then((res) => {
|
||||
|
||||
const newList = res.data.data.filter(item => item.qa_id !== props.qa_id);
|
||||
qaList.value =[]
|
||||
qaList.value = [...newList]
|
||||
options.value = qaList.value
|
||||
})
|
||||
}
|
||||
const remoteMethod = (query) => {
|
||||
if (query) {
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
options.value = qaList.value.filter((item) => {
|
||||
return item.qa_name.toLowerCase().includes(query.toLowerCase())
|
||||
})
|
||||
}, 200)
|
||||
} else {
|
||||
options.value = qaList.value
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
::v-deep input::-webkit-outer-spin-button,
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
:dialogWidth="dialogWidth" @save-click="save" @closeDialog="closeDialog" :links="links" ></DiaglogView>
|
||||
|
||||
<bank :dialogVisible="dialogVisibles" :FormData=FoData :formLabelWidth="formLabelWidth" :action_type="action_type"
|
||||
:fileList=fileList @save-click="saves" @closeDialog="closeDialogs" ></bank>
|
||||
:fileList=fileList @save-click="saves" @closeDialog="closeDialogs" :qa_id="qa_id" ></bank>
|
||||
</div>
|
||||
|
||||
<subject :dialogVisibled="dialogVisibled" :qa_id="qa_id" @closeDialog="closeDialogd" />
|
||||
@ -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,7 +468,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()
|
||||
})
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
:dialogWidth="dialogWidth" @save-click="save" @closeDialog="closeDialog" :links="links" ></DiaglogView>
|
||||
|
||||
<bank :dialogVisible="dialogVisibles" :FormData=FoData :formLabelWidth="formLabelWidth" :action_type="action_type" :feihua3="true"
|
||||
:fileList=fileList @save-click="saves" @closeDialog="closeDialogs" ></bank>
|
||||
:fileList=fileList @save-click="saves" @closeDialog="closeDialogs" :qa_id="qa_id" ></bank>
|
||||
</div>
|
||||
|
||||
<subject :dialogVisibled="dialogVisibled" :qa_id="qa_id" @closeDialog="closeDialogd" />
|
||||
@ -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()
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
:dialogWidth="dialogWidth" @save-click="save" @closeDialog="closeDialog" :links="links" ></DiaglogView>
|
||||
|
||||
<bank :dialogVisible="dialogVisibles" :FormData=FoData :formLabelWidth="formLabelWidth" :action_type="action_type"
|
||||
:fileList=fileList @save-click="saves" @closeDialog="closeDialogs" ></bank>
|
||||
:fileList=fileList @save-click="saves" @closeDialog="closeDialogs" :qa_id="qa_id" ></bank>
|
||||
</div>
|
||||
|
||||
<subject :dialogVisibled="dialogVisibled" :qa_id="qa_id" @closeDialog="closeDialogd" />
|
||||
@ -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