12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- //index.js
- const util = require("../../utils/util")
- //获取应用实例
- const app = getApp()
- Page({
- data: {
- spinShow: false,
- buyModel:false,
- code_url:'',
- info:{},
- system: "",
- groups: [],
- pushPaper: [],
- timeLimitPaper: [],
- userInfo:{},
- taskList: [],
- departments:[]
- },
- onLoad: function(){
- let that = this
- wx.getSystemInfo({
- success: function(res) {
- that.setData({system: res.system})
- }
- })
- app.getDepartments( departments=>{
- this.setData({departments})
- })
- },
- onShow: function(){
- app.getUserInfo( userInfo =>{
- this.setData({userInfo})
- // 已经实名认证
- if( userInfo.identify ){
- this.indexLoad()
- }
- })
- },
- onPullDownRefresh() {
- if (!this.loading) {
- this.indexLoad( this.stopPullDownRefresh )
- }
- },
- stopPullDownRefresh(){
- wx.stopPullDownRefresh()
- },
- indexLoad: function( cb ) {
- let _this = this
- app.formPost('Exam.index', {}).then(res => {
- if (res.code === 200) {
- _this.setData({
- groups: res.data.groups
- });
- cb&&cb()
- }
- })
- },
- downloadFile: function(){
- let url = this.data.info.code_url
- util.downloadFile( url, res=>{
- this.setData({buyModel:false, code_url:''})
- } )
- },
- gotoHistory: function(){
- wx.navigateTo({
- url: '/pages/exam/record/index',
- })
- },
- gotoExam:function( e ){
- let groupId = e.currentTarget.dataset.id
- wx.navigateTo({
- url: `/pages/exam/do/index?id=${groupId}`
- })
- },
- gotoCollection(){
- wx.navigateTo({
- url: '/pages/exam/collection/index',
- })
- },
- onShareAppMessage: function(){
- },
- gotoError: function(){
- wx.navigateTo({
- url: '/pages/exam/error/index',
- })
- }
- })
|