| | |
| | | */ |
| | | onLoad(options) { |
| | | // 在此进行是否购买的查询 |
| | | const questionId = options.listId; |
| | | const bookId = options.bookId |
| | | const bookName = options.bookName |
| | | const formPath = options.formPath |
| | | const questionName = options.listName |
| | | this.setData({ |
| | | questuionName: questionName |
| | | }); |
| | | const isEmption = questionName.includes('-评审') |
| | | if (isEmption) { |
| | | this.initialize() |
| | | } else { |
| | | const questionList = pastData.postData.list |
| | | var listIndex = 0 |
| | | for (let index = 0; index < questionList.length; index++) { |
| | | const item = questionList[index]; |
| | | if (item.name == questionName) { |
| | | listIndex = index |
| | | } |
| | | } |
| | | const indexof = listIndex |
| | | const questionId = questionList[indexof].id; |
| | | const bookId = questionList[indexof].bookId; |
| | | const bookName = "大学生心理健康(第3版)(融媒体版)" |
| | | const formPath = "questionBank" |
| | | const query = { |
| | | "cmsItemId": Number(questionId) |
| | | }; |
| | |
| | | }); |
| | | return; // 直接返回,避免执行后续代码 |
| | | } |
| | | |
| | | // 其他逻辑 |
| | | const questuionName = options.listName; |
| | | this.setData({ |
| | | questionName: questuionName |
| | | }); |
| | | |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = |
| | | (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度 |
| | | |
| | | const token = wx.getStorageSync(app.config.tokenKey); |
| | | if (!token) { |
| | | loginInfo(app, (data) => { |
| | | if (data) { |
| | | this.init(); |
| | | } else { |
| | | this.init(); |
| | | } |
| | | }); |
| | | } else { |
| | | this.init(); |
| | | } |
| | | this.initialize() |
| | | }) |
| | | .catch((err) => { |
| | | console.error('检查题库失败:', err); |
| | |
| | | title: '加载失败,请重试' |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | |
| | |
| | | } |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | |
| | | } |
| | | }, |
| | | |
| | | initialize() { |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = |
| | | (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度 |
| | | const token = wx.getStorageSync(app.config.tokenKey); |
| | | if (!token) { |
| | | loginInfo(app, (data) => { |
| | | if (data) { |
| | | this.init(); |
| | | } else { |
| | | this.init(); |
| | | } |
| | | }); |
| | | } else { |
| | | this.init(); |
| | | } |
| | | }, |
| | | |
| | | count(timeStr) { |
| | | const data = { |
| | | appRefCode: app.config.appRefCode, |