| | |
| | | title: options.name, |
| | | }) |
| | | this.getBookInfo(options.id); |
| | | this.getResourceClass(); // 获取资源所属分类 |
| | | // this.getResourceClass(); // 获取资源所属分类 |
| | | const token = wx.getStorageSync(app.config.tokenKey); |
| | | if (token) { |
| | | this.getShoppingCartProductGet(); |
| | |
| | | this.getSubTtem(); |
| | | // 获取图书分类 |
| | | if (res.datas.bookClassification) { |
| | | let classData = [] |
| | | const bookClassification = JSON.parse(res.datas.bookClassification); |
| | | if (Array.isArray(bookClassification) && bookClassification.length) { |
| | | for (let index = 0; index < bookClassification.length; index++) { |
| | | const element = bookClassification[index]; |
| | | const iconType = element[0]; |
| | | const classType = element[1]; |
| | | await this.getBookClass(iconType, classType); |
| | | classData.push({ |
| | | iconType, |
| | | classType |
| | | }) |
| | | } |
| | | await this.getBookClass(classData); |
| | | } |
| | | } |
| | | |
| | |
| | | }); |
| | | }, |
| | | // 获取图书分类 |
| | | async getBookClass(iconType, classType) { |
| | | async getBookClass(list) { |
| | | let name = ""; |
| | | const query = { |
| | | refCodes: ["bookClassification"], |
| | | }; |
| | | await app.MG.store.getProductTypeField(query).then((res) => { |
| | | JSON.parse(res[0].config).option.forEach((item) => { |
| | | if (item.value == iconType) { |
| | | item.child.forEach((citem) => { |
| | | if (citem.value == classType) { |
| | | const flag = this.data.bookClass.findIndex((ditem) => ditem == citem.name) |
| | | if (flag == -1) { |
| | | let list = this.data.bookClass |
| | | list.push(citem.name) |
| | | this.setData({ |
| | | bookClass: list |
| | | }) |
| | | } |
| | | for (let aindex = 0; aindex < list.length; aindex++) { |
| | | const aitem = list[aindex]; |
| | | const iconType = aitem.iconType |
| | | const classType = aitem.classType |
| | | JSON.parse(res[0].config).option.forEach((item) => { |
| | | if (item.value == iconType) { |
| | | if (item.child && item.child.length) { |
| | | item.child.forEach((citem) => { |
| | | if (citem.value == classType) { |
| | | const flag = this.data.bookClass.findIndex((ditem) => ditem == citem.name) |
| | | if (flag == -1) { |
| | | let list = this.data.bookClass |
| | | list.push(citem.name) |
| | | this.setData({ |
| | | bookClass: list |
| | | }) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | }, |
| | | // 收藏 |
| | |
| | | const checkData = this.data.cmsDatas.find( |
| | | (item) => item.refCode == e.detail.value |
| | | ); |
| | | |
| | | if (!this.data.resourceClassList.length) this.getResourceClass() |
| | | if (checkData) { |
| | | if (e.detail.value == "jsek_cloudLearning") { |
| | | this.setData({ |
| | |
| | | questionDataList: questionList, |
| | | cardList: cardUpdatedList, |
| | | }); |
| | | console.log( |
| | | '题目', this.data.questionDataList |
| | | ); |
| | | }); |
| | | }); |
| | | } |
| | |
| | | bookList: [], |
| | | loading: false, |
| | | listLoding: false, |
| | | stairListLoading: false, |
| | | rowCol: [{ |
| | | width: '50%', |
| | | }, |
| | | { |
| | | width: '100%' |
| | | }, |
| | | { |
| | | width: '80%' |
| | | }, |
| | | { |
| | | width: '100%' |
| | | }, { |
| | | width: '100%' |
| | | }, |
| | | { |
| | | width: '100%' |
| | | }, |
| | | { |
| | | width: '50%' |
| | | }, |
| | | { |
| | | width: '100%' |
| | | }, |
| | | { |
| | | width: '80%' |
| | | }, |
| | | { |
| | | width: '100%' |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | /** |
| | |
| | | getAssortList() { |
| | | this.setData({ |
| | | loading: true, |
| | | listLoding: true, |
| | | }); |
| | | const query = { |
| | | path: "*", |
| | |
| | | // 获取一级分类 |
| | | getStairList(path) { |
| | | this.setData({ |
| | | listLoding: true, |
| | | stairListLoading: true, |
| | | startList: [] |
| | | }); |
| | | const query = { |
| | | path, |
| | |
| | | (item.icon = getPublicImage(item.icon, 500)) : |
| | | (item.icon = item.icon); |
| | | item.children = await this.getSecondList(item); |
| | | |
| | | } |
| | | // 一级分类赋值 |
| | | this.setData({ |
| | | startList: res.datas, |
| | | listLoding: false, |
| | | stairListLoading: false, |
| | | "startCheck.id": res.datas[0].id, |
| | | "startCheck..code": "", |
| | | }); |
| | |
| | | "t-radio-group": "tdesign-miniprogram/radio-group/radio-group", |
| | | "t-button": "tdesign-miniprogram/button/button", |
| | | "t-loading": "tdesign-miniprogram/loading/loading", |
| | | "t-image": "tdesign-miniprogram/image/image" |
| | | "t-image": "tdesign-miniprogram/image/image", |
| | | "t-skeleton": "tdesign-miniprogram/skeleton/skeleton" |
| | | } |
| | | } |
| | |
| | | class="class-list" |
| | | scroll-into-view="{{ 'list' + startCheck.id}}" |
| | | > |
| | | <view wx:if="{{listLoading}}"> |
| | | <t-loading |
| | | theme="spinner" |
| | | size="400rpx" |
| | | loading="{{listLoading}}" |
| | | ></t-loading> |
| | | </view> |
| | | <view |
| | | wx:for="{{startList}}" |
| | | wx:for-item="item" |
| | | wx:key="id" |
| | | id="{{ 'list' + item.id}}" |
| | | class="class-box" |
| | | wx:if="{{!listLoading}}" |
| | | wx:if="{{!stairListLoading}}" |
| | | > |
| | | <view class="class-name">{{item.name}}</view> |
| | | <view class="class-content"> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view |
| | | wx:if="{{stairListLoading}}" |
| | | style="width: 100%; height: min-content" |
| | | > |
| | | <t-skeleton |
| | | row-col="{{rowCol}}" |
| | | theme="paragraph" |
| | | animation="gradient" |
| | | loading="{{stairListLoading}}" |
| | | ></t-skeleton> |
| | | </view> |
| | | <view class="bottom-box"> </view> |
| | | </scroll-view> |
| | | </view> |
| | |
| | | height: 80rpx; |
| | | font-size: 28rpx; |
| | | --td-loading-color: #ff6c00 |
| | | } |
| | | |
| | | .stairList-skeleton { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |