提交 2bfe284b authored 作者: GOD_ZYX's avatar GOD_ZYX

小程序 题目顺序也要修改

上级 9b3d94c0
......@@ -23,7 +23,7 @@
"navigationBarTitleText": "MBA学习系统"
},
"tabBar": {
"borderStyle": "#dcdcdc",
"borderStyle": "white",
"color": "#313131",
"backgroundColor": "#ffffff",
"selectedColor": "#b49441",
......
......@@ -40,6 +40,29 @@ Page({
startTime: '',
/* 记录所有题目是否都答过 */
recordAll: [],
arrRandomSort: function (arr) {
/* 对json.questions 进行一次乱序排列 */
let tmpJson = null
tmpJson = arr.shift()
arr.push(tmpJson)
tmpJson = arr.shift()
arr.push(tmpJson)
tmpJson = arr.shift()
arr.push(tmpJson)
},
unArrRandomSort: function (arr) {
/* 取消乱序排列,恢复原顺序 */
let tmpJson = null
tmpJson = arr.pop()
arr.unshift(tmpJson)
tmpJson = arr.pop()
arr.unshift(tmpJson)
tmpJson = arr.pop()
arr.unshift(tmpJson)
},
/**
* 将返回值 - 对照到对应 data上
*/
......@@ -54,6 +77,7 @@ Page({
score: 0
}
this.startTime = new Date().getTime()
this.arrRandomSort(json.questions)
let _data = {
id: json.id,
semester_id: json.semester_id,
......@@ -182,6 +206,7 @@ Page({
options: group[i].arr
})
}
this.unArrRandomSort(arr)
this.param.work_contents = JSON.stringify(arr)
this.param.score = (score/total*100).toFixed(1)
wx.showLoading({ title: '提交中...', mask: true })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论