| | |
| | | mockList: [] // 用户组卷提交信息 |
| | | }, |
| | | flag: true, |
| | | applyResourceLoading: false |
| | | applyResourceLoading: false, |
| | | noResources: false |
| | | }, |
| | | |
| | | |
| | |
| | | }, |
| | | onTabsChange(e) { |
| | | this.setData({ |
| | | tabValue: e.detail.value |
| | | tabValue: e.detail.value, |
| | | noResources: false |
| | | }) |
| | | if (e.detail.label == '教学资源' || e.detail.label == '云学习' || e.detail.label == '云测试') { |
| | | const checkData = this.data.cmsDatas.find(item => item.refCode == e.detail.value) |
| | |
| | | || (e.detail.value == 'questionBank' && !this.data.test.length)) { |
| | | this.getResourceData(checkData) |
| | | } |
| | | |
| | | } else { |
| | | this.setData({ |
| | | noResources: true |
| | | }) |
| | | } |
| | | } else if (e.detail.label == '云笔记') { |
| | | const token = wx.getStorageSync('jsek-token') |
| | |
| | | // 获取教学资源 云学习 云测试 |
| | | getResourceData(type) { |
| | | this.setData({ |
| | | loading: true |
| | | loading: true, |
| | | noResources: false |
| | | }) |
| | | let query = { |
| | | path: '*', |
| | |
| | | app.MG.store |
| | | .getProductDetail(query) |
| | | .then(async (res) => { |
| | | if (!res.datas.cmsDatas[0].datas.length) { |
| | | return this.setData({ |
| | | noResources: true, |
| | | loading: false |
| | | }) |
| | | } |
| | | // 云测试,递归请求里层数据 |
| | | if (type.refCode == 'questionBank') { |
| | | const data = res.datas.cmsDatas[0].datas.filter( |
| | |
| | | teach: list, |
| | | loading: false |
| | | }) |
| | | console.log('教学资源', this.data.teach); |
| | | this.findChildIds(this.data.teach, this.data.openTeachids = []) |
| | | } else if (type.refCode == 'jsek_cloudLearning') { |
| | | res.datas.cmsDatas[0].datas.forEach(item => { |
| | | item.checked = false |
| | | }) |
| | | const list = await this.getAllResource(res.datas.cmsDatas[0].datas) |
| | | console.log(list, 'list'); |
| | | this.setData({ |
| | | learn: list, |
| | | loading: false |
| | |
| | | |
| | | // 图书添加购物车 |
| | | async addBookShopcCar() { |
| | | |
| | | const token = wx.getStorageSync('jsek-token') |
| | | if (!token) { |
| | | return wx.getUserProfile({ |
| | | desc: '用户登录', |
| | | success: (res) => { |
| | | console.log(res); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const shoppingCartGetId = [] |
| | | |
| | | let query = { |
| | |
| | | async allAddShoppiingCar() { |
| | | const child = this.selectComponent('#learn-resource') |
| | | const token = wx.getStorageSync('jsek-token') |
| | | // if (!token) { |
| | | // return wx.getUserProfile({ |
| | | // desc: '用户登录', |
| | | // success: (res) => { |
| | | // console.log(res); |
| | | // } |
| | | // }) |
| | | // } |
| | | if (!token) { |
| | | return wx.getUserProfile({ |
| | | desc: '用户登录', |
| | | success: (res) => { |
| | | console.log(res); |
| | | } |
| | | }) |
| | | } |
| | | let shopList = this.handleTreeData(this.data.learn).filter((item) => this.resourceIsBuy(item)) |
| | | this.getShoppingCartProductGet() |
| | | if (!shopList.length) return wx.showToast({ |
| | |
| | | } |
| | | else if (this.data.tabValue == 'jsek_cloudLearning') { |
| | | const tree = this.selectComponent('#tree') |
| | | |
| | | |
| | | tree.onCloudShoppingCart() |
| | | |
| | | |