mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-14 13:26:44 +08:00
案例随机
This commit is contained in:
@@ -393,7 +393,7 @@ export default {
|
|||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
// orderField: "excellent",
|
// orderField: "excellent",
|
||||||
majorType: '', //专业分类code
|
majorType: '', //专业分类code
|
||||||
orderAsc: false,
|
// orderAsc: false,
|
||||||
// isTop: true,
|
// isTop: true,
|
||||||
excellent: true,
|
excellent: true,
|
||||||
keyWord: '',
|
keyWord: '',
|
||||||
@@ -406,7 +406,11 @@ export default {
|
|||||||
parent: '',
|
parent: '',
|
||||||
children: [],
|
children: [],
|
||||||
name: '',
|
name: '',
|
||||||
years: []
|
years: [],
|
||||||
|
// 随机
|
||||||
|
notInIds: [],//重复的id
|
||||||
|
orderField: "id",
|
||||||
|
orderAsc: false,//排序
|
||||||
},
|
},
|
||||||
keyWord: "",
|
keyWord: "",
|
||||||
anking: 2,
|
anking: 2,
|
||||||
@@ -487,6 +491,49 @@ export default {
|
|||||||
return !this.speciData.some(item => item.fielclass);
|
return !this.speciData.some(item => item.fielclass);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
(() => {
|
||||||
|
const allArr = [0, 1, 2, 3]
|
||||||
|
let recordsArr = JSON.parse(sessionStorage.getItem("recordsArr")) || [];
|
||||||
|
let arr3 = allArr.filter(item => recordsArr.includes(item))
|
||||||
|
let difference = allArr.filter(element => !arr3.includes(element));
|
||||||
|
if (recordsArr.length === allArr.length) {
|
||||||
|
difference = [...allArr]
|
||||||
|
recordsArr = []
|
||||||
|
}
|
||||||
|
let random = Math.floor(Math.random() * difference.length)
|
||||||
|
difference.forEach((item, index) => {
|
||||||
|
if (index == random) {
|
||||||
|
random = item
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
recordsArr.push(random)
|
||||||
|
sessionStorage.setItem("recordsArr", JSON.stringify(recordsArr))
|
||||||
|
switch (random) {
|
||||||
|
case 1:
|
||||||
|
console.log('hhahahaha1');
|
||||||
|
this.queryCondition.orderField = "id"
|
||||||
|
this.queryCondition.orderAsc = true
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
console.log('hahahhaha2');
|
||||||
|
this.queryCondition.orderField = "title"
|
||||||
|
this.queryCondition.orderAsc = true
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
console.log('hahahhaha3');
|
||||||
|
this.queryCondition.orderField = "title"
|
||||||
|
this.queryCondition.orderAsc = false
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log('hahahhaha0');
|
||||||
|
this.queryCondition.orderField = "id"
|
||||||
|
this.queryCondition.orderAsc = false
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let $this = this;
|
let $this = this;
|
||||||
// if(this.speciData.length==0){
|
// if(this.speciData.length==0){
|
||||||
|
|||||||
Reference in New Issue
Block a user