增加挑战对自定义题库的自持
This commit is contained in:
parent
c9604e7130
commit
5e7a24af26
@ -19,6 +19,7 @@ export interface IExamData {
|
|||||||
icon?: string
|
icon?: string
|
||||||
banner?: string
|
banner?: string
|
||||||
qtypes: string[]
|
qtypes: string[]
|
||||||
|
shopCates: string[]
|
||||||
qcount: number
|
qcount: number
|
||||||
timeone: number
|
timeone: number
|
||||||
beginTime: number
|
beginTime: number
|
||||||
@ -40,6 +41,7 @@ export const defaultExamData: IExamData = {
|
|||||||
shop: '',
|
shop: '',
|
||||||
source: 0,
|
source: 0,
|
||||||
rewardInfo: [],
|
rewardInfo: [],
|
||||||
|
shopCates: [],
|
||||||
questions: []
|
questions: []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +137,9 @@ import Pagination from '@/components/Pagination/index.vue'
|
|||||||
import { getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
import { parseTime } from '@/utils'
|
import { parseTime } from '@/utils'
|
||||||
import { getAllCategory, getAllTags } from '@/api/question'
|
import { getAllCategory, getAllTags } from '@/api/question'
|
||||||
import { deleteActivity, getActivitys, publishActivity, IActivityData } from '@/api/activity'
|
import { deleteActivity, getActivitys, IActivityData, publishActivity } from '@/api/activity'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import { EVENT_ACTIVITY_UPDATE, EVENT_SHOP_PUZZLES_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_ACTIVITY_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ActivityList',
|
name: 'ActivityList',
|
||||||
|
@ -142,6 +142,24 @@
|
|||||||
>
|
>
|
||||||
<el-option :value="0" label="系统题库">系统题库</el-option>
|
<el-option :value="0" label="系统题库">系统题库</el-option>
|
||||||
<el-option :value="1" label="自定义题库">自定义题库</el-option>
|
<el-option :value="1" label="自定义题库">自定义题库</el-option>
|
||||||
|
<el-option :value="2" :label="$t('main.shop') + '题库'">{{$t('main.shop')}}题库</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="店铺分类" v-show="postForm.source === 2" prop="shopCates">
|
||||||
|
<el-select
|
||||||
|
v-model="postForm.shopCates"
|
||||||
|
placeholder="选择"
|
||||||
|
name="typeSelect"
|
||||||
|
required
|
||||||
|
class="w100"
|
||||||
|
multiple
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in shopCates"
|
||||||
|
:key="item"
|
||||||
|
:label="item"
|
||||||
|
:value="item"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
@ -320,6 +338,7 @@ import { defaultRewardData, IRewardData } from '@/api/activity'
|
|||||||
import PuzzleList from './components/PuzzleList.vue'
|
import PuzzleList from './components/PuzzleList.vue'
|
||||||
import UploadCorpImage from '@/components/UploadCorpImage/index.vue'
|
import UploadCorpImage from '@/components/UploadCorpImage/index.vue'
|
||||||
import { EVENT_COUPON_UPDATE, EVENT_EXAM_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_COUPON_UPDATE, EVENT_EXAM_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
import { getShopCategory } from '@/api/shoppuzzle'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ExamEditor',
|
name: 'ExamEditor',
|
||||||
@ -356,6 +375,7 @@ export default class extends Vue {
|
|||||||
private activeName = 'first'
|
private activeName = 'first'
|
||||||
|
|
||||||
private dataRange: Date[] = []
|
private dataRange: Date[] = []
|
||||||
|
private shopCates: string[] = []
|
||||||
|
|
||||||
private postForm = Object.assign({}, defaultExamData)
|
private postForm = Object.assign({}, defaultExamData)
|
||||||
private loading = false
|
private loading = false
|
||||||
@ -413,6 +433,7 @@ export default class extends Vue {
|
|||||||
} else {
|
} else {
|
||||||
this.postForm.shop = UserModule.department
|
this.postForm.shop = UserModule.department
|
||||||
await this.fetchMyShop()
|
await this.fetchMyShop()
|
||||||
|
await this.getRemoteShopCategory()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tempTagView = Object.assign({}, this.$route)
|
this.tempTagView = Object.assign({}, this.$route)
|
||||||
@ -523,6 +544,7 @@ export default class extends Vue {
|
|||||||
private onShopChange() {
|
private onShopChange() {
|
||||||
if (this.postForm.shop) {
|
if (this.postForm.shop) {
|
||||||
this.getCouponList(this.postForm.shop)
|
this.getCouponList(this.postForm.shop)
|
||||||
|
this.getRemoteShopCategory()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.postForm.qtypes?.length > 0) {
|
if (this.postForm.qtypes?.length > 0) {
|
||||||
@ -671,6 +693,15 @@ export default class extends Vue {
|
|||||||
this.postForm.banner = imgUrl
|
this.postForm.banner = imgUrl
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async getRemoteShopCategory() {
|
||||||
|
try {
|
||||||
|
const { data } = await getShopCategory(this.postForm.shop)
|
||||||
|
this.shopCates = data
|
||||||
|
this.$forceUpdate()
|
||||||
|
} catch (err) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ import { getAllCategory, getAllTags, IQuestionData } from '@/api/question'
|
|||||||
import { deleteExam, getExams } from '@/api/exam'
|
import { deleteExam, getExams } from '@/api/exam'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import { EVENT_EXAM_UPDATE, EVENT_SHOP_PUZZLES_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_EXAM_UPDATE, EVENT_SHOP_PUZZLES_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
import i18n from '@/lang'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ExamList',
|
name: 'ExamList',
|
||||||
@ -298,8 +299,15 @@ export default class extends Vue {
|
|||||||
return cellValue ? '是' : '否'
|
return cellValue ? '是' : '否'
|
||||||
}
|
}
|
||||||
|
|
||||||
private formatSource(row: number, column: number, cellValue: boolean) {
|
private formatSource(row: number, column: number, cellValue: number) {
|
||||||
return cellValue ? '自定义' : '系统'
|
switch (cellValue) {
|
||||||
|
case 0:
|
||||||
|
return '系统题库'
|
||||||
|
case 1:
|
||||||
|
return '自定义'
|
||||||
|
case 2:
|
||||||
|
return i18n.tc('main.shop') + '题库'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -107,7 +107,6 @@
|
|||||||
allow-create
|
allow-create
|
||||||
default-first-option
|
default-first-option
|
||||||
style="width: 50%"
|
style="width: 50%"
|
||||||
@change="tagChange"
|
|
||||||
placeholder="请选择">
|
placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in tagOptions"
|
v-for="item in tagOptions"
|
||||||
@ -159,7 +158,7 @@ import Sticky from '@/components/Sticky/index.vue'
|
|||||||
import Tinymce from '@/components/Tinymce/index.vue'
|
import Tinymce from '@/components/Tinymce/index.vue'
|
||||||
import UploadImage from '@/components/UploadImage/index.vue'
|
import UploadImage from '@/components/UploadImage/index.vue'
|
||||||
import { defaultQuestionData } from '@/api/question'
|
import { defaultQuestionData } from '@/api/question'
|
||||||
import { deleteShopQuestion, getShopQuestion, saveShopQuestion } from '@/api/shoppuzzle'
|
import { deleteShopQuestion, getShopCategory, getShopQuestion, saveShopQuestion } from '@/api/shoppuzzle'
|
||||||
import { EVENT_SHOP_PUZZLES_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_SHOP_PUZZLES_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -220,6 +219,7 @@ export default class extends Vue {
|
|||||||
this.fetchData(shop, id)
|
this.fetchData(shop, id)
|
||||||
}
|
}
|
||||||
this.tempTagView = Object.assign({}, this.$route)
|
this.tempTagView = Object.assign({}, this.$route)
|
||||||
|
this.getRemoteCategory()
|
||||||
}
|
}
|
||||||
|
|
||||||
private async fetchData(shop: string, id: string) {
|
private async fetchData(shop: string, id: string) {
|
||||||
@ -257,12 +257,12 @@ export default class extends Vue {
|
|||||||
|
|
||||||
private async tagChange(tags: string[]) {
|
private async tagChange(tags: string[]) {
|
||||||
console.log('tagchange: ', tags)
|
console.log('tagchange: ', tags)
|
||||||
for (const tag of tags) {
|
// for (const tag of tags) {
|
||||||
if (!this.tagSet.has(tag)) {
|
// if (!this.tagSet.has(tag)) {
|
||||||
this.tagSet.add(tag)
|
// this.tagSet.add(tag)
|
||||||
this.tagOptions.push(tag)
|
// this.tagOptions.push(tag)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private async submitForm() {
|
private async submitForm() {
|
||||||
@ -312,6 +312,15 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async getRemoteCategory() {
|
||||||
|
try {
|
||||||
|
const { data } = await getShopCategory(this.postForm.shop)
|
||||||
|
this.tagOptions = data
|
||||||
|
this.$forceUpdate()
|
||||||
|
} catch (err) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async onCancel() {
|
private async onCancel() {
|
||||||
try {
|
try {
|
||||||
await this.$confirm('确认不保存当前记录?', 'Warning', {
|
await this.$confirm('确认不保存当前记录?', 'Warning', {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user