Commit 30cd5f18 authored by Damon's avatar Damon

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

parents c3c1de25 41cda686
...@@ -156,15 +156,19 @@ export default { ...@@ -156,15 +156,19 @@ export default {
return { 'font-size': '32rpx', coloe: '#191C27', 'margin-left': '26rpx' } return { 'font-size': '32rpx', coloe: '#191C27', 'margin-left': '26rpx' }
}, },
}, },
onLoad() {},
onShow() { onShow() {
if (this.userInfo.nickName) { if (this.userInfo.nickName) {
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.$u.api
this.shauTiCount = ret || 0 .getUserDoQuestionNum()
}) .then((ret) => {
this.shauTiCount = ret || 0
})
.catch((err) => {
console.log(err)
})
}) })
} }
}, },
...@@ -174,7 +178,12 @@ export default { ...@@ -174,7 +178,12 @@ export default {
let length = this.countItem.length let length = this.countItem.length
let count = 0 let count = 0
for (let key in this.student) { for (let key in this.student) {
if (this.countItem.indexOf(key) != -1 && this.student[key]) { if (
this.countItem.indexOf(key) != -1 &&
this.student[key] &&
this.student[key] != ' '
) {
console.log('count key', key)
count = count + 1 count = count + 1
} }
} }
......
...@@ -158,7 +158,7 @@ export default { ...@@ -158,7 +158,7 @@ export default {
this.labels[key1][0].push(item) this.labels[key1][0].push(item)
} }
} }
for (var i = 0; i < this.labels[key1].length; i++) { for (var i = 0; i < this.labels[key1][0].length; i++) {
var data = this.labels[key1][0][i] var data = this.labels[key1][0][i]
this.labels[key2][i] = [] this.labels[key2][i] = []
for (var item of res) { for (var item of res) {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
:border-bottom="false" :border-bottom="false"
title-bold title-bold
></u-navbar> ></u-navbar>
<view class="content" v-if="lists.length > 0"> <view class="content" v-if="lists">
<!-- <text class="title">{{ title }}</text> --> <!-- <text class="title">{{ title }}</text> -->
<my-subject <my-subject
class="subject-item" class="subject-item"
...@@ -45,71 +45,79 @@ export default { ...@@ -45,71 +45,79 @@ export default {
return { return {
title: '我的题库', title: '我的题库',
nothing: process.uniEnv.qn_base_url + 'zanwucuoti@3x.png', nothing: process.uniEnv.qn_base_url + 'zanwucuoti@3x.png',
lists: [], lists: null,
} }
}, },
onLoad() { onLoad() {
this.$u.api.getUserQuestionWareHouse().then((res) => { this.getUserQuestionWareHouseList()
console.log('tiku list', res) },
let length = res.length methods: {
if (res.length <= 0) { getUserQuestionWareHouseList() {
this.lists = [] this.$u.api.getUserQuestionWareHouse().then((res) => {
} console.log('tiku list', res)
let data = [] let length = res.length
for (let i = 0; i < length; i++) { if (res.length <= 0) {
data[i] = {} return
if ( }
!res[i].echoMap || let data = []
!res[i].echoMap.questionWarehouseId || for (let i = 0; i < length; i++) {
!res[i].echoMap.cardId if (
) { !res[i].echoMap ||
continue !res[i].echoMap.questionWarehouseId ||
!res[i].echoMap.cardId
) {
continue
}
data[i] = {}
//绑卡或支付时间
data[i].title = res[i].echoMap.questionWarehouseId.title
data[i].time =
res[i].echoMap.cardId.bindingTime ||
res[i].echoMap.cardId.buyTime ||
''
let status = ''
switch (res[i].echoMap.cardId.cardStatus) {
case 0:
status = '未绑定'
data[i].statusStyle = { color: '#9EA5BB' }
data[i].subtitle = '请前往绑定'
break
case 5:
status = '已绑定'
data[i].statusStyle = { color: '#2953FF' }
data[i].subtitle = '请前往首页答题联系吧'
break
case 10:
status = '已激活'
data[i].statusStyle = { color: '#2953FF' }
let leaveDay = 0
if (
res[i].echoMap.cardId &&
res[i].echoMap.cardId.activationTime
) {
let diff = this.datedifference(sDate1, sDate2)
leaveDay = res[i].echoMap.cardId.effectiveDay - diff
leaveDay = leaveDay > 0 ? leaveDay : 0
}
data[i].subtitle = '题库将于' + leaveDay + '天后到期'
break
case 15:
status = '已失效'
data[i].statusStyle = { color: '#9EA5BB' }
data[i].subtitle = '题库已失效'
break
default:
break
}
data[i].status = status
} }
//绑卡或支付时间 if (data.length > 0) {
data[i].title = res[i].echoMap.questionWarehouseId.title this.lists = data
data[i].time = console.log('tiku data', data)
res[i].echoMap.cardId.bindingTime ||
res[i].echoMap.cardId.buyTime ||
''
let status = ''
switch (res[i].echoMap.cardId.cardStatus) {
case 0:
status = '未绑定'
data[i].statusStyle = { color: '#9EA5BB' }
data[i].subtitle = '请前往绑定'
break
case 5:
status = '已绑定'
data[i].statusStyle = { color: '#2953FF' }
data[i].subtitle = '请前往首页答题联系吧'
break
case 10:
status = '已激活'
data[i].statusStyle = { color: '#2953FF' }
let leaveDay = 0
if (res[i].echoMap.cardId && res[i].echoMap.cardId.activationTime) {
let diff = this.datedifference(sDate1, sDate2)
leaveDay = res[i].echoMap.cardId.effectiveDay - diff
leaveDay = leaveDay > 0 ? leaveDay : 0
}
data[i].subtitle = '题库将于' + leaveDay + '天后到期'
break
case 15:
status = '已失效'
data[i].statusStyle = { color: '#9EA5BB' }
data[i].subtitle = '题库已失效'
break
default:
break
} }
data[i].status = status })
} },
this.lists = data
console.log('tiku data', data)
})
},
methods: {
datedifference(sDate1, sDate2) { datedifference(sDate1, sDate2) {
//2021-01-01,2020-02-01,31 //2021-01-01,2020-02-01,31
var dateSpan, tempDate, iDays var dateSpan, tempDate, iDays
......
...@@ -123,11 +123,13 @@ export default { ...@@ -123,11 +123,13 @@ export default {
}) })
this.$u.api.getUserInfo().then((res) => { this.$u.api.getUserInfo().then((res) => {
console.log('huoqu userinfo', res) console.log('huoqu userinfo', res)
res.isCertify = if (res) {
res && res.identityNumber && res.identityNumber.length > 5 res.isCertify =
? true res && res.identityNumber && res.identityNumber.length > 5
: false ? true
this.student = res : false
this.student = res
}
}) })
}, },
onShow() { onShow() {
......
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