.vscode/settings.json
@@ -32,7 +32,7 @@ }, "editor.tabSize": 2, "[wxml]": { "editor.defaultFormatter": "wechat.miniprogram.wxml-language-features" "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[css]": { "editor.defaultFormatter": "HookyQR.beautify" assets/js/login.js
@@ -46,10 +46,10 @@ if (res && res.status == "Ok") { // 储存token wx.setStorageSync(app.config.tokenKey, res.token); // 记录登录统计 setSessionGuid() // 获取用户信息 getUserInfo(app, callback, res.token) // 记录登录统计 // setSessionGuid() } else { console.log(res); callback(false) assets/js/userAction.js
@@ -6,7 +6,7 @@ var SnIp = null; try { // eslint-disable-next-line SnIp = window.returnCitySN; // SnIp = window.returnCitySN; } catch (error) { SnIp = null; console.log(error); packageBookService/pages/bookServices/detail/components/suggest/suggest.js
@@ -97,23 +97,25 @@ }, // 确定 async confirmSuggest() { 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(this.data.inputvalue); const telephoneCheck = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/ const istelePhone = telephoneCheck.test(this.data.inputvalue) const textvalue = this.data.textvalue.trim() if (!this.data.ratevalue) { return wx.showToast({ icon: "error", title: '请选择评分', }) } else if (!this.data.inputvalue) { } else if (!this.data.inputvalue.length) { return wx.showToast({ icon: "error", title: '请填写联系方式', }) } else if (!isPhoneNumber) { } else if (!istelePhone) { return wx.showToast({ icon: "error", title: '请输入正确联系方式', }) } else if (!this.data.textvalue) { } else if (!textvalue.length) { return wx.showToast({ icon: 'error', title: '请输入反馈反馈内容', packageBookService/pages/bookServices/detail/index.js
@@ -1428,7 +1428,7 @@ recordBuyMock() { const num = this.data.mockData.mockList.length const id = tool.uuid(8) const createDate = new Date().getTime() const createDate = this.DateFormat(new Date().getTime(), 'yyyy-MM-dd') const mockList = this.data.mockData.mockList mockList.push({ id, createDate, name: `第${num + 1}套试卷`, state: '0' }) this.setData({ packageBookService/pages/bookServices/examination/examination.js
@@ -246,10 +246,11 @@ this.setData({ currentIndex: 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) const item = this.data.questionDataList[index] if ((this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') && !item.isComplete) { let flag = this.isHaveAnswer(item.userAnswer) if (flag) this.handleQuestion(index) } }, // 点击答题卡跳转题目 @@ -269,21 +270,47 @@ const id = e.detail.value.currentTarget.dataset.id const radioChecked = e.detail.value.detail.value const questionList = this.data.questionDataList questionList.forEach(item => { if (item.id == id) { // 我的错题和我的收藏模式下,单选题选择了直接批改 for (let index = 0; index < questionList.length; index++) { const item = questionList[index]; if (item.id == id && !item.isComplete) { item.userAnswer = radioChecked item.isUserAnswer = this.isHaveAnswer(radioChecked) if ((item.questionType == 'singleChoice' || item.questionType == 'judge') && (this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') && !item.isComplete) { debugger let index = this.data.currentIndex - 1 >= 0 ? this.data.currentIndex - 1 : 0 this.handleQuestion(index) } }) } } // questionList.forEach(item => { // if (item.id == id && !item.isComplete) { // item.userAnswer = radioChecked // item.isUserAnswer = this.isHaveAnswer(radioChecked) // if ((item.questionType == 'singleChoice' || item.questionType == 'judge') && (this.data.answerType == 'collectQuestion' || this.data.answerType == 'errorQuestion') && !item.isComplete) { // this.handleQuestion(this.data.currentIndex) // } // } // }) const cardListUpdata = this.data.cardList cardListUpdata.forEach(item => { item.infoList.forEach(citem => { if (citem.id == id) { for (let index = 0; index < cardListUpdata.length; index++) { const item = cardListUpdata[index]; for (let cindex = 0; cindex < item.infoList.length; cindex++) { const citem = item.infoList[cindex]; if (citem.id == id && !citem.isComplete) { citem.userAnswer = radioChecked citem.isUserAnswer = this.isHaveAnswer(radioChecked) } }) }) } } // cardListUpdata.forEach(item => { // item.infoList.forEach(citem => { // if (citem.id == id && !citem.isComplete) { // citem.userAnswer = radioChecked // citem.isUserAnswer = this.isHaveAnswer(radioChecked) // } // }) // }) this.setData({ questionDataList: questionList, cardList: cardListUpdata @@ -375,7 +402,7 @@ const qustionList = this.data.questionDataList for (let index = 0; index < qustionList.length; index++) { const item = qustionList[index]; if (!item.isComplete) this.handleQuestion(index + 1) if (!item.isComplete) this.handleQuestion(index) } } if (this.data.answerType == 'option') { @@ -472,7 +499,6 @@ } if (mocklist.length && this.data.uuid) { const oldMockData = mocklist.find((mockItem) => mockItem.id == this.data.uuid) debugger this.setData({ 'mockData.state': oldMockData.state, 'mockData.score': oldMockData.score, @@ -802,7 +828,7 @@ // 批改题目 (练习,我的错题,我的收藏,,组卷) handleQuestion(num) { const questionList = this.data.questionDataList const index = num - 1 >= 0 ? num - 1 : 0 const index = num if (questionList[index].isComplete) { // 题目已完成,跳过 return true packageBookService/pages/bookServices/examination/questionList/index.json
@@ -9,6 +9,7 @@ "t-radio-group": "tdesign-miniprogram/radio-group/radio-group", "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group", "t-textarea": "tdesign-miniprogram/textarea/textarea" "t-textarea": "tdesign-miniprogram/textarea/textarea", "t-empty": "tdesign-miniprogram/empty/empty" } } packageBookService/pages/bookServices/examination/questionList/index.wxml
@@ -67,7 +67,7 @@ data-value="{{item.option}}" data-id="{{item.id}}" data-index="{{inputItem.num}}" class="title-input" class="title-input {{isNight ? 'input-night-color' : ''}}" style="border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx;background-color:{{isNight ? '#000' : '#fff'}}; " placeholder-style="{{placeholderstyle}}" wx:if="{{inputItem.data == 'input'}}" @@ -107,7 +107,7 @@ > <view style="font-size: {{sliderValue || 32}}rpx;" class="radio-item {{(answerType == 'option' || answerType == 'mock' ) && !submitStatus && item.userAnswer == contentItem.value ? 'radio-active' : isNight ? 'night' :''}} {{ (item.answer == contentItem.value && item.answer == item.userAnswer && submitStatus) ? 'radio-correct' : (item.userAnswer == contentItem.value && item.userAnswer != item.answer && submitStatus) ?'radio-error' :'' }}" class="radio-item {{(answerType == 'option' || answerType == 'mock' ) && !submitStatus && item.userAnswer == contentItem.value ? 'radio-active' : isNight ? 'night' :''}} {{item.userAnswer == contentItem.value && submitStatus ? item.isRight ? 'radio-correct' : 'radio-error' :''}}" > <!-- 仅文字 --> <text wx:if="{{item.optionStyle == 'Txt'}}" @@ -211,7 +211,7 @@ bind:change="onChangeRadio" data-value="{{item.option}}" data-id="{{item.id}}" class="option-textarea" class="option-textarea {{isNight ? 'textarea-night-color' :''}}" wx:elif="{{item.questionType == 'shortAnswer'}}" t-class="external-class" placeholder="请输入文字" @@ -328,8 +328,15 @@ </view> </view> </swiper-item> <swiper-item wx:if="{{answerType !== 'collectQuestion'}}"> <swiper-item wx:if="{{answerType !== 'collectQuestion' && questionList.length}}" > <text>没有更多了。。。</text> </swiper-item> <swiper-item wx:if="{{!questionList.length}}"> <view class="noData"> <t-empty icon="folder-open" description="暂无数据" /> </view> </swiper-item> </swiper> </view> packageBookService/pages/bookServices/examination/questionList/index.wxss
@@ -182,3 +182,19 @@ display: flex; justify-content: center; } .input-night-color { --td-input-default-text-color: #fff; } .textarea-night-color { --td-textarea-text-color: rgba(255, 255, 255, 1); } .noData { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; } packageBookService/pages/bookServices/list/index.js
@@ -1,4 +1,5 @@ const app = getApp(); import { loginInfo } from '../../../../assets/js/login'; Page({ /** * 页面的初始数据 pages/bindInfo/index.js
@@ -56,10 +56,10 @@ if (res && res.status == "Ok") { // 储存token wx.setStorageSync(app.config.tokenKey, res.token); // 记录登录统计 setSessionGuid() // 获取用户信息 this.getUserInfo() // 记录登录统计 // setSessionGuid() } else { wx.showToast({ icon: "error", @@ -93,7 +93,7 @@ } wx.setStorageSync(app.config.userInfoKey, JSON.stringify(defaultUser)); } wx.switchTab({ wx.navigateTo({ url: this.data.redirectPage ? this.data.redirectPage : '/pages/home/home' }) }); pages/bookServices/assort/index.js
@@ -140,7 +140,7 @@ // 获取二级分类 for (let index = 0; index < res.datas.length; index++) { const item = res.datas[index]; item.icon ? item.icon = getPublicImage(item.icon, 58, 72) : item.icon = item.icon item.icon ? item.icon = getPublicImage(item.icon, 500) : item.icon = item.icon item.children = await this.getSecondList(item); } console.log(res.datas); @@ -166,6 +166,9 @@ field: 'state' } ], coverSize: { width: 500 }, queryType: '\\', searchList: [], size: '30', @@ -177,7 +180,7 @@ for (let index = 0; index < res.datas.length; index++) { const element = res.datas[index]; if (element.icon) element.icon = getPublicImage(element.icon, 58, 72) element.icon = getPublicImage(element.icon, 500) } datas = res.datas; pages/bookServices/assort/index.wxss
@@ -142,6 +142,7 @@ .assort-img { display: flex; align-items: center; width: 152rpx; height: 186rpx; box-shadow: 0px 3px 6px 1px rgba(0, 0, 0, 0.16); pages/home/home.js
@@ -49,19 +49,19 @@ // 首页测试登录功能,后续注释 // 检查登录状态 const token = wx.getStorageSync(app.config.tokenKey) if (!token) { loginInfo(app, (data) => { // 如果不是第一次登录,会执行回调 if (data) { // 登录成功,自动记录token和用户信息,并返回true } else { // 出现错误,返回false } }) } else { // 如果是第一次登录,会跳转至绑定用户信息页面,填写完用户信息后进行登录并储存token和用户信息,结束后跳转回当前页面(携带页面参数) } // const token = wx.getStorageSync(app.config.tokenKey) // if (!token) { // loginInfo(app, (data) => { // // 如果不是第一次登录,会执行回调 // if (data) { // // 登录成功,自动记录token和用户信息,并返回true // } else { // // 出现错误,返回false // } // }) // } else { // // 如果是第一次登录,会跳转至绑定用户信息页面,填写完用户信息后进行登录并储存token和用户信息,结束后跳转回当前页面(携带页面参数) // } this.init(); }, static/images/bookService/assort/book-img.png