图书列表,详情页、答题器样式修改,代码合并上传测试服
| | |
| | | <t-tab-bar value="{{active}}" bindchange="onChange" split="{{false}}"> |
| | | <t-tab-bar-item wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="{{item.id}}"> |
| | | <t-tab-bar-item wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="id"> |
| | | <view class="custom-tab-bar-wrapper"> |
| | | <!-- <t-icon prefix="wr" name="{{item.icon}}" size="48rpx" /> |
| | | <view class="text">{{ item.text }}</view> --> |
| | |
| | | noteList: [], |
| | | activeValues: 0, |
| | | loading: false, |
| | | noList: false, |
| | | }, |
| | | /** |
| | | * 组件的方法列表 |
| | |
| | | }, |
| | | // 获取笔记列表 |
| | | async getNoteList() { |
| | | // this.setData({ |
| | | // loading: true |
| | | // }) |
| | | this.setData({ |
| | | loading: true, |
| | | noList: false |
| | | }) |
| | | console.log(this.properties.bookInfo.id, 'this.properties.bookInfo.id'); |
| | | let topicId |
| | | await app.MG.ugc |
| | |
| | | topicIdOrRefCode: topicId + '' |
| | | } |
| | | await app.MG.ugc.getTopicMessageList(query).then((res) => { |
| | | if (!res.datas.length) { |
| | | return this.setData({ |
| | | noList: true, |
| | | loading: false, |
| | | noteList: res.datas, |
| | | }) |
| | | } |
| | | // notePage.value.total = res.totalSize |
| | | res.datas.forEach((item) => { |
| | | item.compliceHover = false |
| | |
| | | noteList: res.datas, |
| | | loading: false |
| | | }) |
| | | console.log('笔记列表', res.datas); |
| | | }) |
| | | }, |
| | | // 新建笔记接口 |
| | |
| | | "t-input": "tdesign-miniprogram/input/input", |
| | | "t-loading": "tdesign-miniprogram/loading/loading", |
| | | "t-popup": "tdesign-miniprogram/popup/popup", |
| | | "t-icon": "tdesign-miniprogram/icon/icon" |
| | | "t-icon": "tdesign-miniprogram/icon/icon", |
| | | "t-empty": "tdesign-miniprogram/empty/empty" |
| | | } |
| | | } |
| | |
| | | <!--pages/bookServices/detail/components/note/note.wxml--> |
| | | <view class="note" wx:if="{{!loading && noteList.length}}"> |
| | | <view class="note"> |
| | | <view class="note-btn"> |
| | | <t-button theme="primary" class="make-note" bind:tap="openDialog" style="width: 240rpx;"> |
| | | <view slot="content"> |
| | |
| | | </view> |
| | | <view class="note-content"> |
| | | |
| | | <t-collapse value="{{activeValues}}" bind:change="handleChange"> |
| | | <t-collapse value="{{activeValues}}" bind:change="handleChange" wx:if="{{!loading && noteList.length}}"> |
| | | <t-collapse-panel value="{{item.id}}" expandIcon wx:for="{{noteList}}"> |
| | | <view slot="header" class="collapse-header"> |
| | | <t-image class="note-icon" src="/static/images/bookService/detail/note-icon.png"></t-image> |
| | |
| | | </view> |
| | | </t-collapse-panel> |
| | | </t-collapse> |
| | | |
| | | <view wx:if="{{noList}}" class="noData"> |
| | | <t-empty icon="folder-open" description="暂无数据" /> |
| | | </view> |
| | | </view> |
| | | <view class="bottom-box"> |
| | | <t-loading wx:if="{{isMore == true}}"></t-loading> |
| | | <text wx:if="{{isMore == false}}">没有更多了</text> |
| | | </view> |
| | | </view> |
| | | <view class="loading-box" wx:if="{{loading}}"> |
| | | <view class="loading-box" wx:if="{{loading}}" > |
| | | <t-loading loading="{{loading}}" size="60rpx"></t-loading> |
| | | </view> |
| | | |
| | |
| | | <!--pages/bookServices/detail/components/testResource/testResource.wxml--> |
| | | <view class="test-resource"> |
| | | <view class="top-btn"> |
| | | <t-radio-group class="test-radio" t-class="horizontal-box" value="{{radioItem}}" bind:change="onRadioChange" style="margin: 0px"> |
| | | <t-radio-group class="test-radio" t-class="horizontal-box" value="{{radioItem}}" bind:change="onRadioChange" style="margin: 0 10rpx 0 0"> |
| | | <view class="card {{radioItem == 'test' ? 'card--active' : ''}}"> |
| | | <t-radio value="test" icon="none" borderless style="height: 80rpx"> |
| | | <view class="radio-content" slot="content"> |
| | |
| | | </t-radio> |
| | | </view> |
| | | <view class="card {{radioItem == 'mock' ? 'card--active' : ''}}"> |
| | | <t-radio value="mock" icon="none" borderless> |
| | | <t-radio value="mock" icon="none" borderless style="height: 74rpx"> |
| | | <view class="radio-content" slot="content"> |
| | | <t-image src="{{ radioItem == 'mock' ? '/static/images/bookService/detail/checkpaper.png' : '/static/images/bookService/detail/zujuan.png'}}"></t-image> |
| | | <text style="color: {{radioItem == 'mock' ? '#fff':''}};"> |
| | | 组卷</text> |
| | | <text style="color: {{radioItem == 'mock' ? '#fff':''}};">组卷</text> |
| | | </view> |
| | | </t-radio> |
| | | </view> |
| | |
| | | </t-button> |
| | | </view> |
| | | <!-- 练习列表 --> |
| | | <view class="resource-list" wx:for="{{list}}" wx:key="item.id" wx:if="{{radioItem == 'test'}}"> |
| | | <view class="resource-list" wx:for="{{list}}" wx:key="id" wx:if="{{radioItem == 'test'}}"> |
| | | <view class="list-title"> |
| | | <t-image src="/static/images/bookService/detail/test-icon.png"></t-image> |
| | | <text>{{item.name}}</text> |
| | |
| | | <view wx:if="{{mockData.mockList.length}}"> |
| | | <view class="mack-num">已组卷{{mockData.mockList.length}}次</view> |
| | | <view class="mock-list"> |
| | | <view class="mock-list-box" wx:for="{{mockData.mockList}}" data-item="{{item}}" bind:tap="goMackPaper"> |
| | | <view class="mock-list-box" wx:for="{{mockData.mockList}}" wx:key="id" data-item="{{item}}" bind:tap="goMackPaper"> |
| | | <view class="mock-title">{{item.name}}</view> |
| | | <view class="mock-message"> |
| | | <view class="message-box"> |
| | |
| | | .top-btn { |
| | | display: flex; |
| | | justify-content: space-evenly; |
| | | align-items: center; |
| | | padding: 0 0 20rpx 15rpx; |
| | | border-bottom: 1px solid #EFF0F1; |
| | | } |
| | |
| | | |
| | | .practice-btn text { |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | .error-btn { |
| | | margin-left: 10rpx; |
| | | } |
| | | |
| | | .paper-btn, |
| | |
| | | align-items: center; |
| | | } |
| | | |
| | | .mack-state { |
| | | width: 94rpx; |
| | | height: 42rpx; |
| | | } |
| | | |
| | | .mock-score { |
| | | font-size: 28rpx; |
| | | color: #ff6c00; |
| | |
| | | } |
| | | |
| | | .state-pad { |
| | | width: 80rpx; |
| | | white-space: nowrap; |
| | | width: 90rpx; |
| | | border-radius: 10rpx; |
| | | display: inline-block; |
| | | padding: 10rpx; |
| | | text-align: center; |
| | | } |
| | | |
| | | .complete { |
| | |
| | | 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 |
| | |
| | | } |
| | | else if (this.data.tabValue == 'jsek_cloudLearning') { |
| | | const tree = this.selectComponent('#tree') |
| | | |
| | | |
| | | tree.onCloudShoppingCart() |
| | | |
| | | |
| | |
| | | 电子书 |
| | | </t-tab-panel> |
| | | <t-tab-panel label="教学资源" value="jsek_teachingResources" class="{{loading ? 'loading': ''}}"> |
| | | <view wx:if="{{!loading && teach.length}}"> |
| | | <view wx:if="{{!loading && teach.length && !noResources}}"> |
| | | <teach-resource applyState="{{applyState}}" rejectCause="{{rejectCause}}" bind:applyResource="applyResource" applyResourceLoading="{{applyResourceLoading}}"></teach-resource> |
| | | <tree bookInfo="{{bookDetail}}" treeList="{{teach}}" tab="{{tabValue}}" applyState="{{applyState}}" bind:downloadTeach="downloadTeach" openTeachids="{{openTeachids}}" wx:if="{{teach.length}}"></tree> |
| | | </view> |
| | | <t-loading theme="circular" size="60rpx" class="loading" loading="{{loading}}" /> |
| | | <!-- <view wx:if="{{!teach.length && !loading}}" class="noData"> |
| | | <view wx:if="{{noResources}}" class="noData"> |
| | | <t-empty icon="folder-open" description="暂无数据" /> |
| | | </view> --> |
| | | </view> |
| | | </t-tab-panel> |
| | | <t-tab-panel label="云学习" value="jsek_cloudLearning" style="{{tabPanelstyle}}"> |
| | | <view wx:if="{{!loading && learn.length}}"> |
| | | <learn-resource bind:getFreeResource="getFreeResource" bind:allAddShoppiingCar="allAddShoppiingCar" id="learn-resource"></learn-resource> |
| | | <tree id="tree" bookInfo="{{bookDetail}}" tab="{{tabValue}}" treeList="{{learn}}" buyIds="{{buyIdList}}" openLearnids="{{openLearnids}}"></tree> |
| | | </view> |
| | | <view wx:if="{{noResources}}" class="noData"> |
| | | <t-empty icon="folder-open" description="暂无数据" /> |
| | | </view> |
| | | </t-tab-panel> |
| | | <t-tab-panel label="云测试" value="questionBank" style="{{tabPanelstyle}}"> |
| | | <view wx:if="{{!loading && test.length}}"> |
| | | <test-resource list="{{test}}" bookInfo="{{bookDetail}}" mockData="{{mockData}}"></test-resource> |
| | | </view> |
| | | <view wx:if="{{noResources}}" class="noData"> |
| | | <t-empty icon="folder-open" description="暂无数据" /> |
| | | </view> |
| | | </t-tab-panel> |
| | | <t-tab-panel label="云笔记" value="jesk_note" style="{{tabPanelstyle}}"> |
| | | <note bookInfo="{{bookDetail}}" id="note" class="note-list" bind:changeLoaidng="changeLoaidng"></note> |
| | |
| | | |
| | | /* 图书资源 */ |
| | | .book-resource { |
| | | min-height: 640rpx; |
| | | /* min-height: 640rpx; */ |
| | | min-height: calc(100vh - 960rpx); |
| | | margin-top: 20rpx; |
| | | background-color: #fff !important; |
| | | } |
| | |
| | | } |
| | | |
| | | .noData { |
| | | /* width: 500rpx; |
| | | height: 500rpx; */ |
| | | height: 100%; |
| | | } |
| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | // wx.enableAlertBeforeUnload({ |
| | | // message: "未提交,是否退出答题?", |
| | | // success: function (res) { |
| | | // console.log('确定', res); |
| | | // }, |
| | | // fail: function (err) { |
| | | // console.log("失败:", err); |
| | | // }, |
| | | // }); |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度 |
| | |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | * 生命周期函数--监听页面隐藏 |
| | | */ |
| | | onHide() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload() { |
| | | onUnload(e) { |
| | | if (this.data.countdownInterval !== null) { |
| | | clearInterval(this.data.countdownInterval) |
| | | } |
| | |
| | | */ |
| | | onShareAppMessage() { |
| | | }, |
| | | |
| | | // 监听watch |
| | | watch(context, variableName, callback) { |
| | | let value = context.data[variableName]; // 获取被监听属性的当前值 |
| | | |
| | | // 使用 Object.defineProperty 方法在数据对象上定义属性的 getter 和 setter |
| | | Object.defineProperty(context.data, variableName, { |
| | | configurable: true, // 可配置 |
| | | enumerable: true, // 可枚举 |
| | | get: function () { |
| | | return value; // 返回属性的当前值 |
| | | }, |
| | | set: function (newVal) { |
| | | const oldVal = value; // 记录属性的旧值 |
| | | value = newVal; // 更新属性的值 |
| | | callback.call(context, newVal, oldVal); // 调用回调函数,传递新值和旧值 |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 返回 |
| | | goBack() { |
| | | console.log(this.data.submitStatus); |
| | | wx.navigateBack(); |
| | | }, |
| | | //设置背景色 |
| | |
| | | this.setData({ |
| | | currentIndex: e.detail.index |
| | | }) |
| | | let index = e.detail.index - 1 >= 0 ? e.detail.index - 1 : 0 |
| | | let flag = this.isHaveAnswer(this.data.questionDataList[index].userAnswer) |
| | | if (flag) this.handleQuestion(e.detail.index) |
| | | |
| | | if (this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') { |
| | | let index = e.detail.index - 1 >= 0 ? e.detail.index - 1 : 0 |
| | | let flag = this.isHaveAnswer(this.data.questionDataList[index].userAnswer) |
| | | if (flag) this.handleQuestion(e.detail.index) |
| | | } |
| | | }, |
| | | // 点击答题卡跳转题目 |
| | | goQuestion(e) { |
| | |
| | | }, |
| | | // 提交逻辑 |
| | | submitPaper() { |
| | | // 关闭退出页面监听 |
| | | wx.disableAlertBeforeUnload() |
| | | this.setData({ |
| | | submitStatus: true |
| | | }) |
| | |
| | | let value = JSON.parse(res[0].value) |
| | | // 有答题记录,得分赋值 |
| | | if (value) { |
| | | wx.disableAlertBeforeUnload() |
| | | this.setData({ |
| | | submitStatus: true |
| | | }) |
| | |
| | | this.setData({ |
| | | currentIndex: value.currentIndex |
| | | }) |
| | | console.log(this.data.submitStatus); |
| | | // 携带答题记录 获取题目 |
| | | await this.getQuestionList(value.dataList) |
| | | } else { |
| | |
| | | <question-list |
| | | wx:if="{{!loading}}" |
| | | isNight="{{isNight}}" |
| | | answerType="{{answerType}}" |
| | | currentIndex="{{currentIndex}}" |
| | | questionList="{{questionDataList}}" |
| | | submitStatus="{{submitStatus}}" |
| | |
| | | isNight:{ |
| | | type:Boolean, |
| | | value:false |
| | | }, |
| | | answerType:{ |
| | | type:Boolean, |
| | | value:'' |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | methods: { |
| | | // 切换题目 |
| | | changeSwiper(e) { |
| | | console.log(e); |
| | | this.setData({ |
| | | showIndex: e.detail.current |
| | | }) |
| | |
| | | </view> |
| | | <!-- 题目列表 --> |
| | | <swiper class="swiper" bind:change="changeSwiper" current="{{currentIndex}}"> |
| | | <swiper-item wx:for="{{questionList}}" wx:key="{{item.id}}"> |
| | | <swiper-item wx:for="{{questionList}}" wx:key="{{id}}"> |
| | | <!-- 题干 --> |
| | | <view class="question-stem title-score" style="color: {{isNight ? '#fff' : '#000'}};"> |
| | | <!-- 题号 --> |
| | |
| | | <t-radio-group wx:if="{{item.questionType == 'singleChoice' || item.questionType == 'judge'}}" defaultValue="{{item.userAnswer}}" disabled="{{item.isComplete}}" bind:change="onChangeRadio" class="radio-group" data-value="{{item.option}}" data-id="{{item.id}}"> |
| | | <view wx:for="{{item.option}}" wx:for-item="contentItem" wx:for-index="contentIndex" wx:key="contentIndex"> |
| | | <t-radio value="{{contentItem.value}}" icon="none" placement="right" borderless> |
| | | <view class="radio-item {{item.answer == contentItem.value && item.answer == item.userAnswer ? 'radio-correct' : item.userAnswer == contentItem.value && item.userAnswer != item.answer ?'radio-error' :''}}"> |
| | | <view class="radio-item {{item.userAnswer == contentItem.value ? 'radio-active' : ''}} {{(answerType == 'collectQuestion' || answerType == 'errorQuestion') && (item.answer == contentItem.value && item.answer == item.userAnswer ? 'radio-correct' : item.userAnswer == contentItem.value && item.userAnswer != item.answer ?'radio-error' :'')}}"> |
| | | <!-- 仅文字 --> |
| | | <text wx:if="{{item.optionStyle == 'Txt'}}">{{contentItem.value}}、{{contentItem.txt}}</text> |
| | | <!-- 仅图片 --> |
| | |
| | | <text>{{contentItem.value}}、</text> |
| | | <rich-text nodes="{{contentItem.txt}}"></rich-text> |
| | | </view> |
| | | <text wx:if="{{item.answer == contentItem.value && item.answer == item.userAnswer}}">对</text> |
| | | <text wx:if="{{item.userAnswer == contentItem.value && item.userAnswer != item.answer}}">错</text> |
| | | <text wx:if="{{(answerType == 'collectQuestion' || answerType == 'errorQuestion') && (item.answer == contentItem.value && item.answer == item.userAnswer)}}">对</text> |
| | | <text wx:if="{{(answerType == 'collectQuestion' || answerType == 'errorQuestion') && (item.userAnswer == contentItem.value && item.userAnswer != item.answer)}}">错</text> |
| | | </view> |
| | | </t-radio> |
| | | </view> |
| | |
| | | background-color: #F9F9F9; |
| | | } |
| | | |
| | | .radio-active { |
| | | background-color: #ff6c00; |
| | | } |
| | | |
| | | .radio-correct { |
| | | background-color: #EAF7EE; |
| | | } |