feat(合并代码): 云测试
云测试
BREAKING CHANGE: 云测试
| | |
| | | --td-button-primary-bg-color: #fff; |
| | | --td-button-primary-border-color: #FF6C00; |
| | | --td-button-primary-color: #ff6c00; |
| | | --td-button-primary-active-bg-color: #fff0e6; |
| | | --td-button-primary-active-border-color: #ff6c00; |
| | | padding: 0; |
| | | display: flex; |
| | | align-items: center; |
New file |
| | |
| | | // pages/bookServices/detail/components/note/note.js |
| | | Component({ |
| | | /** |
| | | * 组件的属性列表 |
| | | */ |
| | | properties: { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 组件的初始数据 |
| | | */ |
| | | data: { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 组件的方法列表 |
| | | */ |
| | | methods: { |
| | | |
| | | } |
| | | }) |
New file |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "t-button": "tdesign-miniprogram/button/button", |
| | | "t-collapse": "tdesign-miniprogram/collapse/collapse", |
| | | "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel" |
| | | } |
| | | } |
New file |
| | |
| | | <!--pages/bookServices/detail/components/note/note.wxml--> |
| | | <view class="note"> |
| | | <view class="note-btn"> |
| | | <t-button theme="primary" class="make-note">记笔记</t-button> |
| | | </view> |
| | | <view class="note-content"> |
| | | <view class="wrapper"> |
| | | <t-collapse value="{{activeValues}}" bind:change="handleChange"> |
| | | <t-collapse-panel header="折叠面板标题" value="{{0}}" expandIcon> |
| | | 此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容此处可自定义内容 |
| | | </t-collapse-panel> |
| | | </t-collapse> |
| | | </view> |
| | | </view> |
| | | </view> |
New file |
| | |
| | | /* pages/bookServices/detail/components/note/note.wxss */ |
| | | .note {} |
| | | |
| | | .note-btn { |
| | | height: 140rpx; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | align-items: center; |
| | | border-bottom: 1px solid #EFF0F1; |
| | | --td-button-primary-bg-color: #fff; |
| | | --td-button-primary-border-color: #ff6c00; |
| | | --td-button-primary-color: #ff6c00; |
| | | --td-button-primary-active-bg-color: #fff0e6; |
| | | } |
| | | |
| | | .make-note { |
| | | margin: 0; |
| | | margin-right: 40rpx; |
| | | } |
| | |
| | | // pages/bookServices/detail/components/suggest/suggest.js |
| | | const app = getApp() |
| | | Component({ |
| | | /** |
| | | * 组件的属性列表 |
| | | */ |
| | | properties: { |
| | | |
| | | bookIcon: { |
| | | type: String, |
| | | value: '' |
| | | }, |
| | | bookName: { |
| | | type: String, |
| | | value: '' |
| | | } |
| | | }, |
| | | |
| | | data: { |
| | |
| | | inputvalue: '', |
| | | textvalue: '', |
| | | ratevalue: 0, |
| | | phoneError: false, |
| | | textError: false, |
| | | }, |
| | | methods: { |
| | | showDialog(e) { |
| | |
| | | |
| | | closeDialog() { |
| | | this.setData({ |
| | | showWithInput: false |
| | | showWithInput: false, |
| | | ratevalue: 0, |
| | | inputvalue: '', |
| | | textvalue: '' |
| | | }) |
| | | }, |
| | | // 评分改变 |
| | | onChangeRate(e) { |
| | | const { value } = e.detail; |
| | | console.log(e.detail); |
| | | this.setData({ |
| | | ratevalue: value |
| | | ratevalue: e.detail.value |
| | | }); |
| | | }, |
| | | // 输入框改变 |
| | | inputChange(e) { |
| | | this.setData({ |
| | | inputvalue: e.detail.value |
| | | }) |
| | | const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e.detail.value); |
| | | if (this.data.phoneError === isPhoneNumber) { |
| | | this.setData({ |
| | | phoneError: !isPhoneNumber, |
| | | }); |
| | | } |
| | | }, |
| | | // 文本框改变 |
| | | textareaChange(e) { |
| | | this.setData({ |
| | | textvalue: e.detail.value |
| | | }) |
| | | }, |
| | | feedBack() { |
| | | const token = wx.getStorageSync('jsek-token') |
| | | if (!token) { |
| | | // return wx.showToast({ |
| | | // icon: 'error', |
| | | // title: '请先登录', |
| | | // }) |
| | | return wx.getUserProfile({ |
| | | desc: '用户登录', |
| | | success: (res) => { |
| | | console.log(res); |
| | | } |
| | | }) |
| | | } |
| | | let content = { |
| | | source: this.data.ratevalue, |
| | | phone: this.data.inputvalue, |
| | | content: this.data.textvalue, |
| | | icon: this.properties.bookIcon |
| | | } |
| | | let query = { |
| | | topicIdOrRefCode: 'bookOpinion', |
| | | name: this.properties.bookName, |
| | | content: JSON.stringify(content), |
| | | type: 'ProductComment', |
| | | cmsTypeRefCode: '', |
| | | newDataListRequest: [] |
| | | } |
| | | |
| | | app.MG.ugc.newTopicMessage(query).then((res) => { |
| | | wx.showToast({ |
| | | title: '提交成功', |
| | | icon: 'success', |
| | | duration: 2000 |
| | | }) |
| | | this.closeDialog() |
| | | }) |
| | | }, |
| | | // 确定 |
| | | confirmSuggest() { |
| | | if (!this.data.inputvalue) { |
| | | return this.setData({ |
| | | phoneError: true |
| | | }) |
| | | } |
| | | this.feedBack() |
| | | } |
| | | }, |
| | | }) |
| | |
| | | <t-dialog visible="{{showWithInput}}" title="我要建议" confirm-btn="确定" cancel-btn="取消" bind:confirm="closeDialog" bind:cancel="closeDialog" class="suggest-dialog"> |
| | | <t-dialog visible="{{showWithInput}}" title="我要建议" confirm-btn="确定" cancel-btn="取消" bind:confirm="confirmSuggest" bind:cancel="closeDialog" class="suggest-dialog"> |
| | | <view slot="content"> |
| | | <view class="demo-rate"> |
| | | <view class="demo-rate__title">实心评分</view> |
| | | <t-rate value="{{ratevalue}}" bind:change="onChangeRate" /> |
| | | <t-rate value="{{ratevalue}}" catch:change="onChangeRate" /> |
| | | </view> |
| | | <t-input clearable value="{{inputvalue}}" slot="content" label="联系方式" placeholder="请输入联系方式" placeholder-class="placeholder" /> |
| | | <t-textarea value="{{textvalue}}" t-class="external-class" label="标签文字" placeholder="设置最大字符个数,一个汉字表示两个字符" maxcharacter="200" disableDefaultPadding="{{true}}" indicator /> |
| | | <t-input clearable value="{{inputvalue}}" slot="content" label="联系方式" placeholder="请输入联系方式" placeholder-class="placeholder" bind:change="inputChange" type="number" maxlength="{{11}}" tips="{{phoneError ? '手机号输入不正确' : ''}}" /> |
| | | <t-textarea value="{{textvalue}}" t-class="external-class" label="标签文字" placeholder="设置最大字符个数,一个汉字表示两个字符" maxcharacter="200" disableDefaultPadding="{{true}}" indicator bind:change="textareaChange" /> |
| | | </view> |
| | | </t-dialog> |
| | |
| | | height: 400px; |
| | | } |
| | | |
| | | .t-button--text { |
| | | color: #333 |
| | | } |
| | | |
| | | .wrapper { |
| | | margin-bottom: 32rpx; |
| | |
| | | --td-button-primary-bg-color: #fff; |
| | | --td-button-primary-border-color: #FF6C00; |
| | | --td-button-primary-color: #ff6c00; |
| | | --td-button-primary-active-bg-color: #fff0e6; |
| | | --td-button-primary-active-border-color: #ff6c00; |
| | | } |
| | | |
| | | .teach-btn image { |
| | |
| | | --td-button-border-radius: 10rpx; |
| | | --td-button-primary-bg-color: #ff6c00; |
| | | --td-button-primary-border-color: #FF6C00; |
| | | --td-button-primary-text-active-bg-color: #000; |
| | | --td-button-primary-active-bg-color: #ff984d; |
| | | --td-button-primary-active-border-color: #ff984d; |
| | | } |
| | | |
| | | .rejectBtn { |
New file |
| | |
| | | // pages/bookServices/detail/components/testResource/testResource.js |
| | | Component({ |
| | | /** |
| | | * 组件的属性列表 |
| | | */ |
| | | properties: { |
| | | list: { |
| | | type: Array, |
| | | value: [] |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 组件的初始数据 |
| | | */ |
| | | data: { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 组件的方法列表 |
| | | */ |
| | | methods: { |
| | | |
| | | } |
| | | }) |
New file |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "t-button": "tdesign-miniprogram/button/button", |
| | | "t-image": "tdesign-miniprogram/image/image" |
| | | } |
| | | } |
New file |
| | |
| | | <!--pages/bookServices/detail/components/testResource/testResource.wxml--> |
| | | <view class="test-resource"> |
| | | <view class="top-btn"> |
| | | <t-button class="practice-btn" theme="primary" size="medium">练习</t-button> |
| | | <t-button class="paper-btn" theme="default" size="medium">组卷</t-button> |
| | | <t-button class="error-btn" theme="default" size="medium">我的错题</t-button> |
| | | <t-button class="collect-btn" theme="default" size="medium">我的收藏</t-button> |
| | | </view> |
| | | <view class="resource-list" wx:for="{{list}}" wx:key="item.id"> |
| | | <view class="list-title"> |
| | | <t-image src="/static/images/bookService/detail/test-icon.png"></t-image> |
| | | <text>{{item.name}}</text> |
| | | </view> |
| | | <view class="practice"> |
| | | <t-image src="/static/images/bookService/detail/lianxi-icon.png"></t-image> |
| | | </view> |
| | | </view> |
| | | </view> |
New file |
| | |
| | | /* pages/bookServices/detail/components/testResource/testResource.wxss */ |
| | | .test-resource { |
| | | padding-top: 20rpx; |
| | | } |
| | | |
| | | .resource-list { |
| | | height: 80rpx; |
| | | margin: 20rpx; |
| | | padding: 0 20rpx; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | |
| | | .list-title image { |
| | | width: 34rpx; |
| | | height: 38rpx; |
| | | } |
| | | |
| | | .practice image { |
| | | width: 26rpx; |
| | | height: 30rpx; |
| | | } |
| | | |
| | | .list-title text { |
| | | margin-left: 10rpx; |
| | | color: #333; |
| | | } |
| | | |
| | | .top-btn { |
| | | display: flex; |
| | | justify-content: space-evenly; |
| | | } |
| | | |
| | | .practice-btn { |
| | | --td-button-primary-bg-color: #ff6c00; |
| | | --td-button-primary-border-color: #ff6c00; |
| | | --td-button-primary-active-bg-color: #ff984d; |
| | | --td-button-primary-active-border-color: #ff984d; |
| | | } |
| | | |
| | | .paper-btn, |
| | | .error-btn, |
| | | .collect-btn { |
| | | --td-button-default-bg-color: #fff; |
| | | --td-button-default-color: #ff6c00; |
| | | --td-button-default-active-bg-color: #fff0e6; |
| | | --td-button-medium-font-size: 28rpx |
| | | } |
| | |
| | | </view> |
| | | </view> |
| | | <!-- // 判断 不是商品 有子项 递归组件 --> |
| | | <tree wx:else treeList="{{[citem]}}" itemId="{{itemId}}"></tree> |
| | | <tree wx:else treeList="{{[citem]}}" itemId="{{itemId}}" tab="{{tab}}"></tree> |
| | | </view> |
| | | <view class="listItems" wx:if="{{children.length <= 0 && !loading}}"> |
| | | 暂无数据 |
| | |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | bookId: '', |
| | | barHeight: '', |
| | | navBarHeight: '', |
| | | options: { |
| | |
| | | teachResources: [], |
| | | teach: [], |
| | | learn: [], |
| | | test: [], |
| | | openTeachids: [], |
| | | openLearnids: [], |
| | | openTestids: [], |
| | | resourceClassList: [], // 资源所属分类 |
| | | applyState: "", // 教学资源申请状态 |
| | | deadline: "", // 教学资源申请有效日期 |
| | |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度 |
| | | this.setData({ |
| | | bookId: options.id, |
| | | barHeight: systInfo.statusBarHeight, |
| | | navBarHeight: navBarHeight, |
| | | }); |
| | |
| | | this.getBookInfo(options.id); |
| | | this.getResourceClass() // 获取资源所属分类 |
| | | this.getApplyInfo(options.id) |
| | | if (wx.getAccountInfoSync('jsek-token')) { |
| | | const token = wx.getStorageSync('jsek-token') |
| | | if (token) { |
| | | this.getShoppingCartProductGet() |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | } |
| | | console.log('切换', this.data.tabValue); |
| | | }, |
| | | // 获取资源所属分类 |
| | | getResourceClass() { |
| | |
| | | const data = res.datas.cmsDatas[0].datas.filter( |
| | | (item) => item.refCode == 'jsek_questionBank' |
| | | ) |
| | | if (data.length) return getResourceData(data[0]) |
| | | if (data.length) return this.getResourceData(data[0]) |
| | | } |
| | | //教学资源 云学习 |
| | | if (type.refCode == 'jsek_teachingResources' || type.refCode == 'jsek_cloudLearning') { |
| | |
| | | }) |
| | | const list = await this.getAllResource(res.datas.cmsDatas[0].datas) |
| | | this.setData({ |
| | | teachResources: list, |
| | | teach: list |
| | | }) |
| | | this.findChildIds(this.data.teachResources, this.data.openTeachids = []) |
| | | this.findChildIds(this.data.teach, this.data.openTeachids = []) |
| | | } else if (type.refCode == 'jsek_cloudLearning') { |
| | | const list = await this.getAllResource(res.datas.cmsDatas[0].datas) |
| | | this.setData({ |
| | | learn: list |
| | | }) |
| | | console.log('云学习', this.data.learn); |
| | | this.findChildIds(this.data.teachResources, this.data.openLearnids = []) |
| | | this.findChildIds(this.data.learn, this.data.openLearnids = []) |
| | | } |
| | | } else { |
| | | // 无数据 |
| | | } |
| | | } else if (type.refCode == 'jsek_questionBank') { |
| | | console.log('云测试'); |
| | | // const list = await this.getAllResource(res.datas.cmsDatas[0].datas) |
| | | this.setData({ |
| | | test: res.datas.cmsDatas[0].datas |
| | | }) |
| | | // this.findChildIds(this.data.test, this.data.openTestids = []) |
| | | console.log('云测试', this.data.test); |
| | | } else { |
| | | console.log('其他'); |
| | | } |
| | |
| | | .catch((e) => { |
| | | console.log(e) |
| | | }) |
| | | console.log('信息', this.data); |
| | | }, |
| | | // 获取tag下所有资源 |
| | | async getAllResource(data) { |
| | |
| | | return false |
| | | } |
| | | }, |
| | | // 获取已购买商品 |
| | | getShoppingCartProductGet() { |
| | | let query = { |
| | | start: 0, |
| | |
| | | } else { |
| | | return false |
| | | } |
| | | }, |
| | | // 遍历树结构转换为数组方法 |
| | | handleTreeData(array) { |
| | | const flattenedArray = [] |
| | | array.forEach((node) => { |
| | | // 将当前节点添加到展开的数组中 |
| | | flattenedArray.push(node) |
| | | // 递归处理子节点 |
| | | if (node.children && node.children.length > 0) { |
| | | const childrenArray = handleTreeData(node.children) |
| | | flattenedArray.push(...childrenArray) |
| | | } |
| | | }) |
| | | return flattenedArray.filter((item) => item.sysType == 'CmsItem') |
| | | }, |
| | | // 云学习一键领取 |
| | | async getFreeResource() { |
| | | // if (!localStorage.getItem('jsek-token')) { |
| | | // return logIn() |
| | | // } |
| | | let arr = handleTreeData(this.data.learn).filter((item) => resourceIsBuy(item)) |
| | | let freeIds = arr.filter((item) => { |
| | | return item.saleMethod[0].Price == 0 |
| | | }) |
| | | if (!freeIds.length) return console.log('暂无免费资源') |
| | | btnLoading.freeBtn = true |
| | | let requests = [] |
| | | freeIds.forEach((item, index) => { |
| | | if (resourceIsBuy(item)) { |
| | | requests.push({ |
| | | saleMethodId: item.saleMethod[0].Id, |
| | | count: 1 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let query = { |
| | | remarks: '云学习', |
| | | requests, |
| | | } |
| | | try { |
| | | const initOrderRes = await app.MG.store.initOrder(query) |
| | | let parameter = { |
| | | orderNum: initOrderRes.orderNumber |
| | | } |
| | | // 确认订单 |
| | | const confirmOrderRes = await MG.store.confirmOrder(parameter) |
| | | if (confirmOrderRes.orderNumber) { |
| | | // btnLoading.freeBtn = false |
| | | console.log('领取成共'); |
| | | this.getBookInfo(this.data.bookId) |
| | | } |
| | | } catch (error) { |
| | | console.log(error) |
| | | } |
| | | } |
| | | }) |
| | |
| | | "book-brief": "/pages/bookServices/detail/components/brief/index", |
| | | "teach-resource": "/pages/bookServices/detail/components/teachResource/index", |
| | | "learn-resource": "/pages/bookServices/detail/components/learnResource/learnResource", |
| | | "test-resource": "/pages/bookServices/detail/components/testResource/testResource", |
| | | "note": "/pages/bookServices/detail/components/note/note", |
| | | "tree": "/pages/bookServices/detail/components/tree/index", |
| | | "suggest": "/pages/bookServices/detail/components/suggest/suggest", |
| | | "t-loading": "tdesign-miniprogram/loading/loading" |
| | |
| | | <learn-resource></learn-resource> |
| | | <tree tab="{{tabValue}}" treeList="{{learn}}" buyIds="{{buyIdList}}"></tree> |
| | | </t-tab-panel> |
| | | <t-tab-panel label="云测试" value="questionBank" style="{{tabPanelstyle}}">选项四内容</t-tab-panel> |
| | | <t-tab-panel label="云测试" value="questionBank" style="{{tabPanelstyle}}"> |
| | | <test-resource list="{{test}}"></test-resource> |
| | | </t-tab-panel> |
| | | <t-tab-panel label="云笔记" value="note" style="{{tabPanelstyle}}"> |
| | | <note></note> |
| | | </t-tab-panel> |
| | | </t-tabs> |
| | | </view> |
| | | <!-- 购买按钮 --> |
| | |
| | | </view> |
| | | </scroll-view> |
| | | <!-- 我要建议弹窗 --> |
| | | <suggest class="suggest-component" id="suggest-component"></suggest> |
| | | <suggest class="suggest-component" id="suggest-component" bookIcon="{{bookDetail.icon}}" bookName="{{bookDetail.name}}"></suggest> |