|
@@ -6,12 +6,19 @@
|
|
<span class="filter-title">题目来源 : </span>
|
|
<span class="filter-title">题目来源 : </span>
|
|
<div class="filter-content">
|
|
<div class="filter-content">
|
|
<CheckboxGroup v-model="filterOrigin">
|
|
<CheckboxGroup v-model="filterOrigin">
|
|
- <Checkbox label="private">个人题库</Checkbox>
|
|
|
|
- <Checkbox label="school">校本题库</Checkbox>
|
|
|
|
|
|
+ <Checkbox label="private" v-if="!isSchoolPaper" :disabled="filterOrigin.length === 1 && filterOrigin[0] === 'private'">个人题库</Checkbox>
|
|
|
|
+ <Checkbox label="school" :disabled="filterOrigin.length === 1 && filterOrigin[0] === 'school'">校本题库</Checkbox>
|
|
</CheckboxGroup>
|
|
</CheckboxGroup>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="filter-wrap-item animated fadeIn" v-if="includeSchool">
|
|
<div class="filter-wrap-item animated fadeIn" v-if="includeSchool">
|
|
|
|
+ <span class="filter-title">校本占比 : </span>
|
|
|
|
+ <div class="filter-content">
|
|
|
|
+ <InputNumber :max="100" :min="0" :step="10" v-model="schoolRate"></InputNumber>
|
|
|
|
+ <span style="margin-left: 10px;"> %</span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="filter-wrap-item animated fadeIn" v-if="includeSchool">
|
|
<span class="filter-title">选择学段 : </span>
|
|
<span class="filter-title">选择学段 : </span>
|
|
<div class="filter-content">
|
|
<div class="filter-content">
|
|
<Select v-model="periodCode" >
|
|
<Select v-model="periodCode" >
|
|
@@ -41,7 +48,7 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="auto-btn-wrap">
|
|
<div class="auto-btn-wrap">
|
|
- <Button type="info" @click="doAutoCreate">开始组题</Button>
|
|
|
|
|
|
+ <Button type="info" :loading="isLoading" @click="doAutoCreate">开始组题</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -51,11 +58,13 @@
|
|
name:'AutoCreate',
|
|
name:'AutoCreate',
|
|
data(){
|
|
data(){
|
|
return {
|
|
return {
|
|
|
|
+ isLoading:false,
|
|
filterOrigin:['private'],
|
|
filterOrigin:['private'],
|
|
periodList:[],
|
|
periodList:[],
|
|
periodCode:'',
|
|
periodCode:'',
|
|
subjectList:[],
|
|
subjectList:[],
|
|
subjectCode:'',
|
|
subjectCode:'',
|
|
|
|
+ schoolRate:50,
|
|
quInfos:[{
|
|
quInfos:[{
|
|
type:'single',
|
|
type:'single',
|
|
label:'单选题',
|
|
label:'单选题',
|
|
@@ -156,11 +165,71 @@
|
|
/* 开始组题 */
|
|
/* 开始组题 */
|
|
doAutoCreate(){
|
|
doAutoCreate(){
|
|
console.log(this.quInfos)
|
|
console.log(this.quInfos)
|
|
|
|
+ console.log(this.filterOrigin)
|
|
|
|
+ this.isLoading = true
|
|
|
|
+ let params = []
|
|
|
|
+ let copyInfos = JSON.parse(JSON.stringify(this.quInfos))
|
|
|
|
+ this.filterOrigin.forEach(scope => {
|
|
|
|
+ if(scope === 'private'){
|
|
|
|
+ params.push({
|
|
|
|
+ code:'Item-' + this.$store.state.userInfo.TEAMModelId,
|
|
|
|
+ scope: scope,
|
|
|
|
+ period: '',
|
|
|
|
+ points:[],
|
|
|
|
+ quInfos: copyInfos.map(i => {
|
|
|
|
+ i.count = (i.count - Math.round(i.count * this.schoolRate * 0.01))
|
|
|
|
+ return i
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ params.push({
|
|
|
|
+ code:'Item-' + this.$store.state.userInfo.schoolCode,
|
|
|
|
+ scope: scope,
|
|
|
|
+ period: '',
|
|
|
|
+ points:[],
|
|
|
|
+ quInfos: this.quInfos.map(i => {
|
|
|
|
+ i.count = Math.round(i.count * this.schoolRate * 0.01)
|
|
|
|
+ return i
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // 访问API获取随机题目
|
|
|
|
+ this.$api.learnActivity.Automatic(params).then(
|
|
|
|
+ res => {
|
|
|
|
+ if (res.length > 0) {
|
|
|
|
+ console.log('组题成功', res)
|
|
|
|
+ this.isLoading = false
|
|
|
|
+ } else {
|
|
|
|
+ this.$Message.error('未能匹配满足条件的题目!')
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.isLoading = false
|
|
|
|
+ }, 1000)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ err => {
|
|
|
|
+ this.$Message.error('API ERROR!')
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.isLoading = false
|
|
|
|
+ }, 1000)
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ console.log(params)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ if(this.isSchoolPaper){
|
|
|
|
+ this.filterOrigin = ['school']
|
|
|
|
+ this.schoolRate = 100
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed:{
|
|
computed:{
|
|
includeSchool(){
|
|
includeSchool(){
|
|
return this.filterOrigin.indexOf('school') > -1
|
|
return this.filterOrigin.indexOf('school') > -1
|
|
|
|
+ },
|
|
|
|
+ isSchoolPaper(){
|
|
|
|
+ return this.$route.name === 'newSchoolPaper'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|