Commit 6b8b2485 authored by Facius's avatar Facius

Merge branch 'dev-v1.0.0' of https://git.banshouhui.com/wuzhenzhe/study into dev-v1.0.0

parents 283ea2c5 e6cf9504
...@@ -37,6 +37,9 @@ let userApiFun = function(vm) { ...@@ -37,6 +37,9 @@ let userApiFun = function(vm) {
apiUrl + '/rest/question/query/allStudentQuestionWarehouse', apiUrl + '/rest/question/query/allStudentQuestionWarehouse',
params params
) )
//获取用户刷题量
let getUserDoQuestionNum = async (params = {}) =>
await vm.$u.get(apiUrl + '/rest/question/total/question/count', params)
const userApi = { const userApi = {
updateUserInfo, updateUserInfo,
...@@ -49,6 +52,7 @@ let userApiFun = function(vm) { ...@@ -49,6 +52,7 @@ let userApiFun = function(vm) {
getCertFromOut, getCertFromOut,
getCertifyInfoByType, getCertifyInfoByType,
getUserQuestionWareHouse, getUserQuestionWareHouse,
getUserDoQuestionNum,
} }
return userApi return userApi
} }
......
...@@ -59,7 +59,6 @@ export default { ...@@ -59,7 +59,6 @@ export default {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
/* #endif */ /* #endif */
background-color: $uni-bg-color;
position: relative; position: relative;
flex-direction: column; flex-direction: column;
} }
......
...@@ -143,20 +143,16 @@ export default { ...@@ -143,20 +143,16 @@ export default {
color: transparent; color: transparent;
display: none; display: none;
} }
page {
background-color: #2953ff;
}
.begin-answer { .begin-answer {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-size: 100% 920rpx; background-size: 100% 920rpx;
background-repeat: no-repeat; background-repeat: no-repeat;
height: 100vh; background-color: #2953ff;
position: absolute; position: absolute;
top: 0; top: 0;
width: 100%; width: 100%;
} }
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -164,7 +160,6 @@ page { ...@@ -164,7 +160,6 @@ page {
justify-content: center; justify-content: center;
padding: 30rpx 24rpx 50rpx 24rpx; padding: 30rpx 24rpx 50rpx 24rpx;
} }
.cert-body { .cert-body {
width: 100%; width: 100%;
background-color: #ffffff; background-color: #ffffff;
......
...@@ -109,6 +109,7 @@ export default { ...@@ -109,6 +109,7 @@ export default {
'workUnit', 'workUnit',
], ],
student: {}, student: {},
shauTiCount: 0,
} }
}, },
computed: { computed: {
...@@ -129,10 +130,14 @@ export default { ...@@ -129,10 +130,14 @@ export default {
return this.userInfo.nickName != undefined return this.userInfo.nickName != undefined
}, },
loginTips() { loginTips() {
return (this.student && this.student.consumeAmount) || 0 return this.shauTiCount || 0
}, },
avatar() { avatar() {
return (this.userInfo && this.userInfo.avatarUrl) || this.pic return (
(this.student && this.student.avatarPath) ||
(this.userInfo && this.userInfo.avatarUrl) ||
this.pic
)
}, },
nikeName() { nikeName() {
return (this.userInfo && this.userInfo.nickName) || '点击登录' return (this.userInfo && this.userInfo.nickName) || '点击登录'
...@@ -157,6 +162,9 @@ export default { ...@@ -157,6 +162,9 @@ export default {
this.$u.api.getUserInfo().then((res) => { this.$u.api.getUserInfo().then((res) => {
this.student = res this.student = res
getApp().globalData.student = res getApp().globalData.student = res
this.$u.api.getUserDoQuestionNum().then((ret) => {
this.shauTiCount = ret || 0
})
}) })
} }
}, },
......
This diff is collapsed.
...@@ -139,8 +139,25 @@ function initAnswerCardList(total, vm) { ...@@ -139,8 +139,25 @@ function initAnswerCardList(total, vm) {
} }
} }
const diffTime = function diffTime(startDate, endDate) {
let diff = endDate.getTime() - startDate //.getTime();//时间差的毫秒数
//计算出相差天数
let days = Math.floor(diff / (24 * 3600 * 1000))
//计算出小时数
let leave1 = diff % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
let hours = Math.floor(leave1 / (3600 * 1000))
//计算相差分钟数
let leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
let minutes = Math.floor(leave2 / (60 * 1000))
//计算相差秒数
let leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
let seconds = Math.round(leave3 / 1000)
return seconds
}
module.exports = { module.exports = {
TOTAL: TOTAL, TOTAL: TOTAL,
diffTime: diffTime,
request: request, request: request,
requestMulti: requestMulti, requestMulti: requestMulti,
getInitcurrentPage: getInitcurrentPage, getInitcurrentPage: getInitcurrentPage,
......
...@@ -24,12 +24,7 @@ ...@@ -24,12 +24,7 @@
></u-image> ></u-image>
</view> </view>
</u-cell-item> </u-cell-item>
<u-cell-item <u-cell-item title="证件照" @click="changeCertPhoto">
title="证件照"
@click="changeCertPhoto"
:arrow="false"
:hover-class="none"
>
<view slot="right-icon"> <view slot="right-icon">
<u-image <u-image
v-if="headCertPhoto" v-if="headCertPhoto"
...@@ -40,13 +35,12 @@ ...@@ -40,13 +35,12 @@
<text v-else style="color:#2953FF">去上传</text> <text v-else style="color:#2953FF">去上传</text>
</view> </view>
</u-cell-item> </u-cell-item>
<u-cell-item title="手机号" :arrow="false" :hover-class="none"> <u-cell-item title="手机号">
<view slot="right-icon"> <view slot="right-icon">
<button <button
hover-class="none"
class="mobile-button"
open-type="getPhoneNumber" open-type="getPhoneNumber"
@getphonenumber="getPhonenumber" @getphonenumber="getPhonenumber"
style="background: none;font-size: 26rpx;padding-right: 0;"
> >
<text v-if="getMobile">{{ getMobile }}</text> <text v-if="getMobile">{{ getMobile }}</text>
<text v-else class="empty-value">去绑定</text> <text v-else class="empty-value">去绑定</text>
......
...@@ -21,32 +21,32 @@ ...@@ -21,32 +21,32 @@
></u-search> ></u-search>
</view> </view>
<view v-if="lists.length > 0"> <view v-if="lists.length > 0" class="results">
<view class="title" <view class="title"
>共找到含有<text>“{{ keyword }}”</text>相关试题<text>{{ count }}</text>道</view >共找到含有<text>“{{ keyword }}”</text>相关试题<text>{{ count }}</text
>道</view
> >
<view class="result"> <view class="result">
<u-collapse :item-style="itemStyle" event-type="close">
<uni-list :border="false"> <uni-list :border="false">
<u-collapse-item <view
:ref="`collapse${index}`" v-for="item in lists"
:index="index" :key="item.id"
@change="itemChange" @click.stop="itemChange(item.id)"
v-for="(item, index) in lists" class="list-item"
:key="index" >
<view
:class="['u-flex', 'head', { selected: item.id === arrIndex }]"
> >
<view slot="title-all" :class="['u-flex','head', {'selected': index === arrIndex}]">
<view class="titles"> <view class="titles">
<text>{{ item.type }}</text <text>{{ item.type }}</text
>{{ item.title }} >{{ item.title }}
</view> </view>
<view class="u-flex arrow" v-show="index !== arrIndex"> <view class="u-flex arrow" v-show="item.id !== arrIndex">
<text>展开</text> <text>展开</text>
<u-icon name="arrow-down" color="#9EA5BB"></u-icon> <u-icon name="arrow-down" color="#9EA5BB"></u-icon>
</view> </view>
</view> </view>
<view class="u-flex subject"> <view class="u-flex subject" v-show="item.id === arrIndex">
<view class="content"> <view class="content">
<answer-sheet <answer-sheet
ref="answerSheet" ref="answerSheet"
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
></answer-explanation> ></answer-explanation>
</view> </view>
</view> </view>
<view class="u-flex opera"> <view class="u-flex opera" v-show="item.id === arrIndex">
<view class="opera-list" @click="collection(item)"> <view class="opera-list" @click="collection(item)">
<u-image <u-image
:src="collectImg" :src="collectImg"
...@@ -76,15 +76,14 @@ ...@@ -76,15 +76,14 @@
/> />
<text>{{ collectionFlag ? '已收藏' : '收藏' }}</text> <text>{{ collectionFlag ? '已收藏' : '收藏' }}</text>
</view> </view>
<view class="opera-list" @click="arrowUp(index)"> <view class="opera-list" @click.stop="arrowUp(index)">
<text>收起</text> <text>收起</text>
<u-icon name="arrow-up" color="#9EA5BB"></u-icon> <u-icon name="arrow-up" color="#9EA5BB"></u-icon>
</view> </view>
</view> </view>
</u-collapse-item> </view>
</uni-list> </uni-list>
</u-collapse> <u-loadmore :status="loadStatus" :margin-bottom="40" />
</view> </view>
</view> </view>
...@@ -107,7 +106,7 @@ export default { ...@@ -107,7 +106,7 @@ export default {
components: { components: {
answerSheet, answerSheet,
answerExplanation, answerExplanation,
uniList uniList,
}, },
data() { data() {
return { return {
...@@ -115,11 +114,15 @@ export default { ...@@ -115,11 +114,15 @@ export default {
background: '#fff', background: '#fff',
padding: '0rpx 20rpx', padding: '0rpx 20rpx',
margin: '10rpx 0', margin: '10rpx 0',
'border-radius': '30rpx 30rpx 0 0' 'border-radius': '30rpx 30rpx 0 0',
}, },
keyword: '', keyword: '',
lists: [], lists: [],
arrIndex: null, arrIndex: '',
currentPage: 1,
pageSize: 10,
loadStatus: 'loadmore',
isLoadMore: false, //是否加载中
} }
}, },
onLoad(e) { onLoad(e) {
...@@ -134,36 +137,50 @@ export default { ...@@ -134,36 +137,50 @@ export default {
return this.lists.length return this.lists.length
}, },
collectImg() { collectImg() {
const info = this.lists.find(v => v.index === this.arrIndex) const info = this.lists.find((v) => v.index === this.arrIndex)
const name = info?.collectionFlag ? 'collected.png' : 'collect.png' const name = info?.collectionFlag ? 'collected.png' : 'collect.png'
return process.uniEnv.qn_base_url + name return process.uniEnv.qn_base_url + name
}, },
collectionFlag() { collectionFlag() {
const info = this.lists.find(v => v.index === this.arrIndex) const info = this.lists.find((v) => v.index === this.arrIndex)
return info ? info.collectionFlag : false return info ? info.collectionFlag : false
},
},
onReachBottom() {
//上拉触底函数
if (!this.isLoadMore) {
//此处判断,上锁,防止重复请求
this.isLoadMore = true
this.currentPage += 1
this.init()
} }
}, },
methods: { methods: {
init() { init() {
const data = { const data = {
questionWarehouseId: this.questionWarehouseId, questionWarehouseId: this.questionWarehouseId,
keyWord: this.keyword keyword: this.keyword,
current: this.currentPage,
size: this.pageSize,
} }
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中',
}) })
this.$u.api.searchQuestion(data).then(res => { this.loadStatus = 'loading'
this.$u.api.searchQuestion(data).then((res) => {
uni.hideLoading() uni.hideLoading()
this.lists = res.length > 0 ? res.map((v, i) => { const lists =
res?.records.length > 0
? res?.records.map((v, i) => {
const rightKey = v.answer.split(',') const rightKey = v.answer.split(',')
const content = JSON.parse(v.content) const content = JSON.parse(v.content)
const answerList = content.choiceList.map(item => { const answerList = content.choiceList.map((item) => {
return { return {
sort: item.value, sort: item.value,
text: item.label, text: item.label,
checked: rightKey.includes(item.value), checked: rightKey.includes(item.value),
confirm: rightKey.includes(item.value) confirm: rightKey.includes(item.value),
} }
}) })
...@@ -177,18 +194,30 @@ export default { ...@@ -177,18 +194,30 @@ export default {
explain: v.analysis, explain: v.analysis,
rightKey: rightKey, rightKey: rightKey,
collectionFlag: v.collectionFlag, collectionFlag: v.collectionFlag,
submitStatus: true submitStatus: true,
} }
}) : [] })
: []
this.lists = this.lists.concat(lists)
if (res.records.length < this.pageSize) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true
this.loadStatus = 'nomore'
} else {
this.isLoadMore = false
}
this.status = 'nomore'
}) })
}, },
itemChange(e) { itemChange(e) {
this.arrIndex = e.show ? e.index : null this.arrIndex = e
}, },
search(val) { search(val) {
if (val){ if (val) {
this.keyword = val this.keyword = val
let history = this.searchHistory.filter(v => v !== val) let history = this.searchHistory.filter((v) => v !== val)
history.unshift(val) history.unshift(val)
if (history.length > 9) { if (history.length > 9) {
history.splice(9, 1) history.splice(9, 1)
...@@ -199,17 +228,17 @@ export default { ...@@ -199,17 +228,17 @@ export default {
}, },
collection(item) { collection(item) {
const action = item.collectionFlag ? 'removeCollection' : 'joinCollection' const action = item.collectionFlag ? 'removeCollection' : 'joinCollection'
this.$u.api[action]({questionId: item.id}).then(res => { this.$u.api[action]({ questionId: item.id }).then((res) => {
if(res) { if (res) {
const msg = item.collectionFlag ? '取消收藏成功' : '收藏成功' const msg = item.collectionFlag ? '取消收藏成功' : '收藏成功'
this.$u.toast(msg) this.$u.toast(msg)
item.collectionFlag = !item.collectionFlag item.collectionFlag = !item.collectionFlag
} }
}) })
}, },
arrowUp(index) { arrowUp() {
this.$refs[`collapse${index}`][0].headClick() this.arrIndex = ''
} },
}, },
} }
</script> </script>
...@@ -237,9 +266,17 @@ export default { ...@@ -237,9 +266,17 @@ export default {
color: #2953ff; color: #2953ff;
} }
} }
.results {
width: 100%;
}
.result { .result {
margin-top: 30rpx; margin-top: 30rpx;
width: 100%; width: 100%;
.list-item {
background: #fff;
padding: 30rpx 20rpx;
margin: 10rpx 0;
border-radius: 30rpx 30rpx 0 0;
.head { .head {
width: 100%; width: 100%;
height: 60rpx; height: 60rpx;
...@@ -263,6 +300,7 @@ export default { ...@@ -263,6 +300,7 @@ export default {
} }
.arrow { .arrow {
padding-left: 20rpx; padding-left: 20rpx;
margin-top: -10rpx;
text { text {
color: #2953ff; color: #2953ff;
font-size: 28rpx; font-size: 28rpx;
...@@ -295,7 +333,7 @@ export default { ...@@ -295,7 +333,7 @@ export default {
} }
} }
.opera { .opera {
padding: 30rpx 0; padding-top: 30rpx;
justify-content: space-between; justify-content: space-between;
color: #5a6073; color: #5a6073;
font-size: 28rpx; font-size: 28rpx;
...@@ -315,12 +353,13 @@ export default { ...@@ -315,12 +353,13 @@ export default {
} }
} }
} }
}
.default { .default {
flex-flow: column; flex-flow: column;
flex: 1; flex: 1;
justify-content: center; justify-content: center;
.no-result { .no-result {
color: #9EA5BB; color: #9ea5bb;
font-size: 28rpx; font-size: 28rpx;
} }
} }
......
...@@ -53,6 +53,7 @@ const store = new Vuex.Store({ ...@@ -53,6 +53,7 @@ const store = new Vuex.Store({
: '1414854649273384960', // 科目ID : '1414854649273384960', // 科目ID
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式 // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_version: '1.0.0', vuex_version: '1.0.0',
beginTime: null // 考试开始时间
}, },
mutations: { mutations: {
$uStore(state, payload) { $uStore(state, payload) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment