Commit ed4b4d77 authored by Facius's avatar Facius

Merge branch 'dev-v1.0.0' into test

parents a957c6aa f7dc9a02
;(function() { ;(function() {
let NODE_ENV = 'test' // dev:开发环境 | test:测试环境 | prod:生产环境 let NODE_ENV = 'test' // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null let ENV_VAR = null
let VERSION = 'v1.0.0'
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
if (NODE_ENV === 'dev') { if (NODE_ENV === 'dev') {
ENV_VAR = require('./.env.dev.js') ENV_VAR = require('./.env.dev.js')
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
if (ENV_VAR) { if (ENV_VAR) {
process.uniEnv = {} process.uniEnv = {}
process.uniEnv['node_env'] = NODE_ENV process.uniEnv['node_env'] = NODE_ENV
process.uniEnv['version'] = VERSION
for (let key in ENV_VAR) { for (let key in ENV_VAR) {
process.uniEnv[key] = ENV_VAR[key] process.uniEnv[key] = ENV_VAR[key]
} }
......
...@@ -7,12 +7,12 @@ export default { ...@@ -7,12 +7,12 @@ export default {
questionList: [] questionList: []
}, },
onLaunch: function(options) { onLaunch: function(options) {
this.$u.vuex('orgId', options?.query?.orgId || -1)
// 版本更新 // 版本更新
this.updateApp() this.updateApp()
}, },
onShow: function() { onShow: function(options) {
console.log('App Show') console.log("options", options)
this.updateOrgId(options)
}, },
onHide: function() { onHide: function() {
console.log('App Hide') console.log('App Hide')
...@@ -76,6 +76,39 @@ export default { ...@@ -76,6 +76,39 @@ export default {
}) })
} }
}, },
// 更新机构ID
updateOrgId(options) {
const orgId = options?.query?.orgId
// 需要更新机构ID的场景,详细可参考 https://developers.weixin.qq.com/miniprogram/dev/reference/scene-list.html
const scene = [1005, 1006, 1011, 1012, 1013, 1026, 1035, 1047, 1048, 1049, 1053, 1058, 1067, 1091, 1145, 1135, 1183, 1017]
if (!this.orgId) { // 没有机构ID,更新
this.$u.vuex('orgId', orgId || -1)
} else {
if (scene.includes(options.scene)) { // 如果需要更新机构ID
if (!orgId) { // 针对重新载入小程序 安卓的query参数会清空
// 如果没有参数,需要重置为平台的场景
const platformScene = [1005, 1006, 1026, 1053, 1145, 1183, 1017]
if (platformScene.includes(options.scene)) {
this.$u.vuex('orgId', -1)
}
return
}
if (orgId && orgId !== this.orgId) {
this.logout()
this.$u.vuex('orgId', orgId)
}
}
}
},
logout() {
this.$u.vuex('vuex_token', '')
this.$u.vuex('orgId', '')
this.$u.vuex('openId', '')
this.$u.vuex('userInfo', {})
this.$u.vuex('questionList', {})
this.$u.vuex('lastIndex', {})
this.$u.vuex('answerCount', {})
}
}, },
} }
</script> </script>
......
...@@ -40,33 +40,33 @@ function openSetting() { ...@@ -40,33 +40,33 @@ function openSetting() {
//吊起设备原生相机相册取得文件,并自动上传七牛,返回七牛key,domain,本地file信息 //吊起设备原生相机相册取得文件,并自动上传七牛,返回七牛key,domain,本地file信息
function getPhoto(type, token) { function getPhoto(type, token) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
hasPermissionOfCamera().then((r) => { // hasPermissionOfCamera().then((r) => {
if (!r) { // if (!r) {
reject(false) // reject(false)
} // }
let sourceType = type == 1 ? ['album'] : ['album', 'camera'] let sourceType = type == 1 ? ['album'] : ['album', 'camera']
uni.chooseImage({ uni.chooseImage({
count: 1, //默认9 count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: sourceType, //从相册选择 sourceType: sourceType, //从相册选择
success: function(res) { success: function(res) {
//上传七牛 //上传七牛
let filePath = res.tempFiles[0].path //为需要上传的文件 let filePath = res.tempFiles[0].path //为需要上传的文件
upload(filePath, token) upload(filePath, token)
.then((msg) => { .then((msg) => {
//最后七牛返回的key //最后七牛返回的key
resolve({ resolve({
key: msg, key: msg,
files: res.tempFiles, files: res.tempFiles,
})
}) })
.catch((msg) => { })
console.error(msg) .catch((msg) => {
reject(msg) console.error(msg)
}) reject(msg)
}, })
}) },
}) })
// })
}) })
} }
......
<template> <template>
<view class="question-bank-cell"> <view class="question-bank-cell">
<view class="label-normal"> <view class="label-normal">
<view>{{ info.label || info.title }}</view> <view class="title-view">{{ info.label || info.title }}</view>
<view class="type-view" v-if="!isAdd">{{
provinceName + '-' + examTypeText
}}</view>
<view class="label-text"> <view class="label-text">
共 共
<text class="label-blue">{{ info.number }}</text <text class="label-blue">{{ info.number || 0 }}</text
>道精编试题,通过率 >道精编试题,通过率
<text class="label-blue">{{ info.pass || $u.random(95, 99) }}%</text> <text class="label-blue">{{ info.pass || $u.random(95, 99) }}%</text>
</view> </view>
...@@ -40,6 +43,16 @@ export default { ...@@ -40,6 +43,16 @@ export default {
return {} return {}
}, },
computed: { computed: {
examTypeText() {
return this.info.echoMap && this.info.echoMap.type
},
provinceName() {
return (
this.info.echoMap &&
this.info.echoMap.provinceId &&
this.info.echoMap.provinceId.fullName
)
},
isAdd() { isAdd() {
return this.type == 'add' return this.type == 'add'
}, },
...@@ -90,12 +103,20 @@ export default { ...@@ -90,12 +103,20 @@ export default {
align-items: center; align-items: center;
.label-normal { .label-normal {
width: 470rpx; width: 470rpx;
font-size: 36rpx;
color: #191c27;
font-weight: bold;
word-break: break-all; word-break: break-all;
.title-view {
font-size: 36rpx;
color: #191c27;
font-weight: bold;
margin-bottom: 12rpx;
}
.type-view {
font-size: 28rpx;
color: #5a6073;
font-weight: bold;
}
.label-text { .label-text {
margin-top: 24rpx; margin-top: 12rpx;
font-size: 26rpx; font-size: 26rpx;
color: #5a6073; color: #5a6073;
.label-blue { .label-blue {
......
<template> <template>
<view class="record-cell"> <view class="record-cell" @click="$u.throttle(handleClick, 500)">
<view class="time-view">{{ timeText }}</view> <view class="time-view">{{ timeText }}</view>
<view class="detail-view"> <view class="detail-view">
<view v-for="(value, key) in labels" :key="key" class="item-view"> <view v-for="(value, key) in labels" :key="key" class="item-view">
...@@ -79,7 +79,11 @@ export default { ...@@ -79,7 +79,11 @@ export default {
return this.passed ? '及格' : '不及格' return this.passed ? '及格' : '不及格'
}, },
}, },
methods: {}, methods: {
handleClick() {
this.$emit('click', this.info.id)
},
},
} }
</script> </script>
......
...@@ -124,7 +124,7 @@ export default { ...@@ -124,7 +124,7 @@ export default {
position: absolute; position: absolute;
z-index: -1; z-index: -1;
height: 472rpx; height: 472rpx;
width: 702rpx; width: 100%;
} }
.content-view { .content-view {
padding: 40rpx 30rpx; padding: 40rpx 30rpx;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@change="swiperChange" @change="swiperChange"
circular circular
> >
<swiper-item v-for="(item, i) in swiperList" :key="i"> <swiper-item v-for="(item, i) in swiperList" :key="i" class="swiper-items">
<view class="u-flex subject"> <view class="u-flex subject">
<view class="title" v-if="item.title"><text class="title-type">{{ titleType[item.type - 1] }}</text>{{ item.title }}</view> <view class="title" v-if="item.title"><text class="title-type">{{ titleType[item.type - 1] }}</text>{{ item.title }}</view>
<view class="content" v-if="item.answerList"> <view class="content" v-if="item.answerList">
...@@ -269,7 +269,7 @@ export default { ...@@ -269,7 +269,7 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.swiper-items { .swiper-items {
overflow: auto; overflow-y: auto;
} }
.subject { .subject {
flex-flow: column; flex-flow: column;
......
...@@ -85,14 +85,9 @@ export default { ...@@ -85,14 +85,9 @@ export default {
type: null, type: null,
certName: '', certName: '',
topImage: process.uniEnv.qn_base_url + 'xueshitoubu@2x.png', topImage: process.uniEnv.qn_base_url + 'xueshitoubu@2x.png',
workPlace: ''
} }
}, },
onLoad(){ onLoad(){
this.$u.api.getUserInfo().then((res) => {
this.workPlace =
res && res.workUnit || null
})
}, },
onShow: function() { onShow: function() {
this.formatDataByType() this.formatDataByType()
...@@ -124,7 +119,7 @@ export default { ...@@ -124,7 +119,7 @@ export default {
return this.learnData.idCard || ' ' return this.learnData.idCard || ' '
}, },
company() { company() {
return this.workPlace || ' ' return this.learnData.company || ' '
}, },
subjectName() { subjectName() {
return this.learnData.subjectName || ' ' return this.learnData.subjectName || ' '
...@@ -169,18 +164,16 @@ export default { ...@@ -169,18 +164,16 @@ export default {
background-color: #2953ff; background-color: #2953ff;
background-size: 100% 920rpx; background-size: 100% 920rpx;
background-repeat: no-repeat; background-repeat: no-repeat;
height: 120vh; height: 100vh;
position: absolute; position: absolute;
top: 0; top: 0;
width: 100%; width: 100%;
} }
.content { .content {
display: flex; padding: 30rpx 24rpx 50rpx 24rpx;
flex-direction: column; height: 100%;
align-items: center; overflow: auto;
justify-content: center;
padding: 30rpx 24rpx 0rpx 24rpx;
} }
.cert-body { .cert-body {
......
...@@ -171,6 +171,9 @@ export default { ...@@ -171,6 +171,9 @@ export default {
} }
}, },
onLoad() { onLoad() {
this.checkType = '特种作业操作证查询'
},
onShow: function(param) {
if (!this.vuex_token) { if (!this.vuex_token) {
this.$u.toast('请先登录') this.$u.toast('请先登录')
let that = this let that = this
...@@ -180,9 +183,6 @@ export default { ...@@ -180,9 +183,6 @@ export default {
}) })
}, 1000) }, 1000)
} }
this.checkType = '特种作业操作证查询'
},
onShow: function(param) {
// try { // try {
// if (param.tabs) { // if (param.tabs) {
// this.current = param.tabs // this.current = param.tabs
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
<view <view
v-for="(item, index) in marks" v-for="(item, index) in marks"
:key="index" :key="index"
class="list-view" :class="['list-view', { first: index == 0 }]"
@click="handleClickExam(index)" @click="handleClickExam(index)"
> >
<image class="exam-image" :src="item.image"></image> <image class="exam-image" :src="item.image"></image>
...@@ -319,6 +319,14 @@ export default { ...@@ -319,6 +319,14 @@ export default {
this.$u.api this.$u.api
.queryMyQuestionWarehouseDetail(id) .queryMyQuestionWarehouseDetail(id)
.then((res) => { .then((res) => {
if (!res) {
// 题库过期
this.loading = false
this.detail = { questionWarehouse: {} }
this.data = { questionWarehouse: {} }
this.selected = {}
return
}
this.detail = res || { questionWarehouse: {} } this.detail = res || { questionWarehouse: {} }
// this.relationId = res.questionWarehouse.id // this.relationId = res.questionWarehouse.id
if (res.questionWarehouse.id) { if (res.questionWarehouse.id) {
...@@ -441,6 +449,7 @@ export default { ...@@ -441,6 +449,7 @@ export default {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '暂未选题库', title: '暂未选题库',
type: 'warning', type: 'warning',
duration: 1500,
}) })
} }
}, },
...@@ -689,14 +698,18 @@ export default { ...@@ -689,14 +698,18 @@ export default {
.exam-mark { .exam-mark {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; // justify-content: space-between;
.list-view { .list-view {
width: 330rpx; width: calc((100% - 22rpx) / 2);
height: 136rpx; height: 136rpx;
border-radius: 16rpx; border-radius: 16rpx;
flex-shrink: 0;
display: flex; display: flex;
align-items: center; align-items: center;
background-color: #ffffff; background-color: #ffffff;
&.first {
margin-right: 22rpx;
}
.exam-image { .exam-image {
width: 96rpx; width: 96rpx;
height: 96rpx; height: 96rpx;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</view> </view>
</view> </view>
<view class="u-m-r-10 avatar"> <view class="u-m-r-10 avatar">
<u-avatar class="avatar-iamge" :src="avatar" size="140"></u-avatar> <u-avatar class="avatar-iamge" :src="avatar" size="160"></u-avatar>
</view> </view>
</view> </view>
<view class=""> <view class="">
...@@ -258,6 +258,6 @@ page { ...@@ -258,6 +258,6 @@ page {
} }
} }
::v-deep u-cell-item .u-cell { ::v-deep u-cell-item .u-cell {
padding: 35rpx 32rpx !important; padding: 50rpx 32rpx !important;
} }
</style> </style>
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
<view class="u-flex default" v-if="total === 0 && [3, 4].includes(type)"> <view class="u-flex default" v-if="total === 0 && [3, 4].includes(type)">
<view> <view>
<image :src="defaultImg" /> <u-image :src="defaultImg" width="374" height="322" :fade="false" />
</view> </view>
<view class="no-result"> <view class="no-result">
{{ type === 4 ? '当前暂无错题记录' : '当前暂无收藏题目' }} {{ type === 4 ? '当前暂无错题记录' : '当前暂无收藏题目' }}
...@@ -174,7 +174,7 @@ export default { ...@@ -174,7 +174,7 @@ export default {
current: 0, current: 0,
// 仅仅记录swiper的位置 // 仅仅记录swiper的位置
currentIndex: 0, currentIndex: 0,
swiperDuration: '500', swiperDuration: '800',
// 分页数据 // 分页数据
currentPage: 1, currentPage: 1,
pageSize: 100, pageSize: 100,
...@@ -278,6 +278,8 @@ export default { ...@@ -278,6 +278,8 @@ export default {
this.$u.vuex(`answerCount.${this.questionWarehouseId}`, 0) this.$u.vuex(`answerCount.${this.questionWarehouseId}`, 0)
this.$u.vuex(`questionList.${this.questionWarehouseId}`, []) this.$u.vuex(`questionList.${this.questionWarehouseId}`, [])
} }
} else if (this.source === 3) {
this.title = '考试'
} else if (this.source === 4) { } else if (this.source === 4) {
this.title = '收藏的题' this.title = '收藏的题'
} else if (this.source === 5) { } else if (this.source === 5) {
...@@ -299,7 +301,7 @@ export default { ...@@ -299,7 +301,7 @@ export default {
// 列表总长度,一定要在第一次请求列表数据前明确该值 // 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据 // 否则无法知道下一页是否还有数据
let total = parseInt(res) || 0 let total = parseInt(res) || 0
if (total > 0) { // if (total > 0) {
// 考试 // 考试
if (this.type === 2) { if (this.type === 2) {
this.pageSize = this.totalPoint this.pageSize = this.totalPoint
...@@ -315,7 +317,7 @@ export default { ...@@ -315,7 +317,7 @@ export default {
let index = let index =
this.source === 1 ? this.lastIndex[this.questionWarehouseId] || 0 : 0 this.source === 1 ? this.lastIndex[this.questionWarehouseId] || 0 : 0
this.refresh(i ? i : index) this.refresh(i ? i : index)
} // }
}) })
}, },
// 切换 // 切换
...@@ -493,6 +495,9 @@ export default { ...@@ -493,6 +495,9 @@ export default {
if (this.count === this.total) { if (this.count === this.total) {
this.$nextTick(() => { this.$nextTick(() => {
this.$u.vuex(`answerCount.${this.questionWarehouseId}`, 0)
this.$u.vuex(`lastIndex.${this.questionWarehouseId}`, 0)
this.$u.vuex(`questionList.${this.questionWarehouseId}`, [])
return this.$u.toast('您已经答完全部试题') return this.$u.toast('您已经答完全部试题')
}) })
} }
......
...@@ -22,9 +22,10 @@ ...@@ -22,9 +22,10 @@
input-align="center" input-align="center"
placeholder="请输入卡号" placeholder="请输入卡号"
:placeholder-style="placeplaceholderStyle" :placeholder-style="placeplaceholderStyle"
cursor-spacing="140" cursor-spacing="272"
:focus="focus" :focus="focus"
adjust-position adjust-position
hold-keyboard
/> />
</view> </view>
<view class="field-title">学习卡密码</view> <view class="field-title">学习卡密码</view>
...@@ -38,6 +39,10 @@ ...@@ -38,6 +39,10 @@
:placeholder-style="placeplaceholderStyle" :placeholder-style="placeplaceholderStyle"
cursor-spacing="140" cursor-spacing="140"
adjust-position adjust-position
hold-keyboard
:password-icon="false"
@focus="handleFocus"
confirm-hold
/> />
</view> </view>
</view> </view>
...@@ -71,7 +76,7 @@ export default { ...@@ -71,7 +76,7 @@ export default {
return { return {
code: '', code: '',
password: '', password: '',
focus: true, focus: false,
loading: false, loading: false,
// relationId: 0, // relationId: 0,
} }
...@@ -147,6 +152,9 @@ export default { ...@@ -147,6 +152,9 @@ export default {
this.loading = false this.loading = false
}) })
}, },
handleFocus() {
this.password = ''
},
setPageInfo() { setPageInfo() {
var pages = getCurrentPages() var pages = getCurrentPages()
if (pages.length >= 2) { if (pages.length >= 2) {
...@@ -163,6 +171,7 @@ export default { ...@@ -163,6 +171,7 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
min-width: 70rpx;
// background-color: green; // background-color: green;
} }
.u-input__right-icon__item { .u-input__right-icon__item {
......
...@@ -78,9 +78,22 @@ ...@@ -78,9 +78,22 @@
:chartData="chartData" :chartData="chartData"
:canvas2d="true" :canvas2d="true"
:inScrollView="true" :inScrollView="true"
fontColor="#9EA5BB"
canvasId="scroll-viewid" canvasId="scroll-viewid"
:pageScrollTop="pageScrollTop" :pageScrollTop="pageScrollTop"
background="none" background="none"
:opts="{
enableScroll: true,
xAxis: {
enableScroll: true,
scrollShow: true,
itemCount: 3,
disableGrid: true,
boundaryGap: 'center',
},
}"
:ontouch="true"
:disableScroll="true"
/> />
</view> </view>
</view> </view>
...@@ -92,6 +105,7 @@ ...@@ -92,6 +105,7 @@
v-for="(item, index) in lists" v-for="(item, index) in lists"
:key="index" :key="index"
:info="item" :info="item"
@click="handleClickRecord"
></RecordCell> ></RecordCell>
<!-- <view class="show-more" @click="showAll = true" v-if="!showAll"> <!-- <view class="show-more" @click="showAll = true" v-if="!showAll">
...@@ -149,7 +163,20 @@ export default { ...@@ -149,7 +163,20 @@ export default {
}, },
chartData: { chartData: {
categories: [], categories: [],
series: [], series: [
{
name: '答题数',
pointShape: 'circle',
legendShape: 'circle',
data: [],
},
{
name: '正确数',
pointShape: 'circle',
legendShape: 'circle',
data: [],
},
],
}, },
} }
}, },
...@@ -174,39 +201,10 @@ export default { ...@@ -174,39 +201,10 @@ export default {
// }, 500) // }, 500)
}) })
} }
this.chartInit() this.studyRecord(this.nearlySevenDays())
this.queryExamRecord() this.queryExamRecord()
}, },
methods: { methods: {
chartInit() {
this.chartData.series = [
{
name: '答题数',
pointShape: 'circle',
legendShape: 'circle',
data: [
[10000, 55], // 【日期, 数值】
[30000, 25],
[50000, 55],
[70000, 25],
[90000, 55],
],
},
{
name: '正确率',
pointShape: 'circle',
legendShape: 'circle',
data: [
[0, 25],
[20000, 55],
[40000, 25],
[60000, 55],
[80000, 25],
],
},
]
this.studyRecord()
},
// 每日一练统计 // 每日一练统计
everyTaskList(year, month) { everyTaskList(year, month) {
var params = { var params = {
...@@ -232,31 +230,27 @@ export default { ...@@ -232,31 +230,27 @@ export default {
}) })
}, },
// 练习分析 // 练习分析
studyRecord(start, end) { studyRecord(params) {
var params = {}
if (!start || !end) {
// 近七天
end = new Date().getTime()
start = new Date().setDate(new Date().getDay() - 6)
}
console.log(
'---------start---------',
start,
'---------start---------',
end
)
params = {
startDate: this.$u.timeFormat(start, 'yyyy-mm-dd'),
endDate: this.$u.timeFormat(end, 'yyyy-mm-dd'),
}
this.$u.api this.$u.api
.studyRecord(this.questionWarehouseId, params) .studyRecord(this.questionWarehouseId, params)
.then((res) => { .then((res) => {
console.log('----------studyRecord------------', res) this.chartData.series[0].data = []
// this.days = [] this.chartData.series[1].data = []
// for (var item of res) { this.chartData.categories = []
// this.days.push(item.time.replace(/\-0/g, '\-'))
// } let keys = []
Object.keys(res).forEach((v) => {
keys.push(v)
})
keys.sort()
for (let index = 0; index < keys.length; index++) {
const ele = keys[index]
console.log('ele', ele)
this.chartData.categories.push(ele.replace(/\-/g, '.'))
this.chartData.series[0].data.push(res[ele].totalCount)
this.chartData.series[1].data.push(res[ele].rightCount)
}
}) })
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
...@@ -294,24 +288,42 @@ export default { ...@@ -294,24 +288,42 @@ export default {
handleChangeMonth(e) { handleChangeMonth(e) {
this.everyTaskList(e.year, e.month) this.everyTaskList(e.year, e.month)
}, },
handleClick() {},
handleClickRange(index) { handleClickRange(index) {
for (var item of this.items) { for (var item of this.items) {
item.selected = false item.selected = false
} }
this.items[index].selected = true this.items[index].selected = true
if (index == 2) { this.showSelect = index == 2
this.showSelect = true var param = {}
} else { if (index == 0) {
this.showSelect = false param = this.nearlySevenDays()
// 修改图表 } else if (index == 1) {
// ... param = this.nearlyThirtyDays()
} else if (index == 2) {
console.log(this.rangeDay0, this.rangeDay1)
param = {
startDate: this.rangeDay0,
endDate: this.rangeDay1,
}
} }
this.studyRecord(param)
},
handleClickRecord(id) {
this.$u.route({
url: '/pages/learn/score',
params: {
id: id,
},
})
}, },
handleConform(e, index) { handleConform(e, index) {
this['rangeDay' + index] = e.target.value this['rangeDay' + index] = e.target.value
console.log(this.rangeDay0, this.rangeDay1)
// 修改图表 // 修改图表
// ... this.studyRecord({
startDate: this.rangeDay0,
endDate: this.rangeDay1,
})
}, },
getDate() { getDate() {
return this.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd') return this.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd')
...@@ -321,6 +333,21 @@ export default { ...@@ -321,6 +333,21 @@ export default {
this.currentLoadStatus == 'loading' this.currentLoadStatus == 'loading'
this.queryExamRecord() this.queryExamRecord()
}, },
nearlySevenDays() {
return this.nearlyDays(5)
},
nearlyThirtyDays() {
return this.nearlyDays(28)
},
nearlyDays(day) {
var end = new Date().getTime()
var start = new Date().setDate(new Date().getDay() - day)
var params = {
startDate: this.$u.timeFormat(start, 'yyyy-mm-dd'),
endDate: this.$u.timeFormat(end, 'yyyy-mm-dd'),
}
return params
},
}, },
} }
</script> </script>
...@@ -392,6 +419,7 @@ export default { ...@@ -392,6 +419,7 @@ export default {
.range-view { .range-view {
display: flex; display: flex;
margin: 40rpx 30rpx 40rpx 30rpx; margin: 40rpx 30rpx 40rpx 30rpx;
align-items: center;
.range-title { .range-title {
font-size: 28rpx; font-size: 28rpx;
color: #9ea5bb; color: #9ea5bb;
...@@ -447,6 +475,7 @@ export default { ...@@ -447,6 +475,7 @@ export default {
} }
.list-view { .list-view {
padding-bottom: 44rpx; padding-bottom: 44rpx;
min-height: 960rpx;
.list-content { .list-content {
padding: 0 30rpx 20rpx 30rpx; padding: 0 30rpx 20rpx 30rpx;
min-height: 44rpx; min-height: 44rpx;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<CircleProgress <CircleProgress
class="progress-view" class="progress-view"
active-color="#FFFFFF" active-color="#FFFFFF"
:percent="info.score" :percent="(info.score / info.pageTotalPoint) * 100"
inactive-color="rgba(255, 255, 255, 0.3)" inactive-color="rgba(255, 255, 255, 0.3)"
width="240" width="240"
border-width="8" border-width="8"
...@@ -55,7 +55,12 @@ ...@@ -55,7 +55,12 @@
<view class="detail-view"> <view class="detail-view">
<view class="name-view">{{ info.category }}</view> <view class="name-view">{{ info.category }}</view>
<view class="type-view">{{ info.type }}</view> <view class="type-view">{{ info.type }}</view>
<image class="qrcode-image" :src="info.institutionLogo"></image> <u-image
width="160rpx"
height="160rpx"
class="qrcode-image"
:src="info.institutionLogo"
></u-image>
</view> </view>
</view> </view>
<view class="bottom-view"> <view class="bottom-view">
...@@ -127,10 +132,10 @@ export default { ...@@ -127,10 +132,10 @@ export default {
} }
}, },
isFull() { isFull() {
return this.info.score >= 100 return this.info.score >= this.info.pageTotalPoint
}, },
isPass() { isPass() {
return this.info.score >= 60 return this.info.score >= this.info.pageTotalPoint * 0.6
}, },
resultText() { resultText() {
return this.isPass ? '合格' : '不合格' return this.isPass ? '合格' : '不合格'
...@@ -162,11 +167,17 @@ export default { ...@@ -162,11 +167,17 @@ export default {
var random = [94, 99] var random = [94, 99]
if (this.info.score < 60) { if (this.info.score < 60) {
random = [55, 65] random = [55, 65]
} else if (this.info.score >= 60 && this.info.score < 80) { } else if (
this.info.score >= this.info.pageTotalPoint * 0.6 &&
this.info.score < this.info.pageTotalPoint * 0.8
) {
random = [66, 85] random = [66, 85]
} else if (this.info.score >= 80 && this.info.score < 90) { } else if (
this.info.score >= this.info.pageTotalPoint * 0.8 &&
this.info.score < this.info.pageTotalPoint * 0.9
) {
random = [86, 93] random = [86, 93]
} else if (this.info.score >= 90) { } else if (this.info.score >= this.info.pageTotalPoint * 0.9) {
random = [94, 99] random = [94, 99]
} }
...@@ -176,7 +187,7 @@ export default { ...@@ -176,7 +187,7 @@ export default {
onShareAppMessage(res) { onShareAppMessage(res) {
return { return {
title: '模考大师', title: '模考大师',
path: `/pages/learn/score?id=${this.id}` path: `/pages/learn/score?id=${this.id}`,
} }
}, },
onLoad(options) { onLoad(options) {
...@@ -186,7 +197,7 @@ export default { ...@@ -186,7 +197,7 @@ export default {
let option = wx.getLaunchOptionsSync() let option = wx.getLaunchOptionsSync()
this.id = option.query.id this.id = option.query.id
} }
if (!this.id) { if (!this.id) {
this.$u.route({ this.$u.route({
url: 'pages/index/index', url: 'pages/index/index',
...@@ -213,6 +224,7 @@ export default { ...@@ -213,6 +224,7 @@ export default {
image: echoMap.studentId.avatarPath, image: echoMap.studentId.avatarPath,
score: res.point, score: res.point,
time: res.endDatetime, time: res.endDatetime,
pageTotalPoint: res.pageTotalPoint,
category: echoMap.questionWarehouseId.title, category: echoMap.questionWarehouseId.title,
type: '模拟考试', type: '模拟考试',
} }
...@@ -347,6 +359,10 @@ export default { ...@@ -347,6 +359,10 @@ export default {
.detail-view { .detail-view {
padding: 20rpx 0; padding: 20rpx 0;
text-align: center; text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.name-view { .name-view {
font-size: 36rpx; font-size: 36rpx;
font-weight: bold; font-weight: bold;
......
...@@ -35,6 +35,7 @@ export default { ...@@ -35,6 +35,7 @@ export default {
return { return {
title: '微信授权登录', title: '微信授权登录',
host: '', //配置为自己的额服务器即可 host: '', //配置为自己的额服务器即可
back: false, //跳回页面
} }
}, },
computed: { computed: {
...@@ -42,7 +43,11 @@ export default { ...@@ -42,7 +43,11 @@ export default {
return process.uniEnv.qn_base_url + 'LOGO@3x.png' return process.uniEnv.qn_base_url + 'LOGO@3x.png'
}, },
}, },
onShow() {}, onLoad(params) {
if (params && params.back) {
this.back = true
}
},
methods: { methods: {
wxLogin() { wxLogin() {
// 获取code 小程序专有,用户登录凭证。 // 获取code 小程序专有,用户登录凭证。
...@@ -68,6 +73,12 @@ export default { ...@@ -68,6 +73,12 @@ export default {
}) })
this.$u.api.loginWechatAuth(data).then((res) => { this.$u.api.loginWechatAuth(data).then((res) => {
uni.hideLoading() uni.hideLoading()
if (this.back) {
this.$u.route({
type: 'back',
})
return
}
this.$u.vuex('vuex_token', res.token) this.$u.vuex('vuex_token', res.token)
this.$u.vuex('openId', res.openId) this.$u.vuex('openId', res.openId)
this.$u.vuex('userInfo', userInfo) this.$u.vuex('userInfo', userInfo)
......
...@@ -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"> <view class="content" v-if="lists.length > 0">
<!-- <text class="title">{{ title }}</text> --> <!-- <text class="title">{{ title }}</text> -->
<my-subject <my-subject
class="subject-item" class="subject-item"
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ 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: null, lists: [],
} }
}, },
onLoad() { onLoad() {
...@@ -107,18 +107,19 @@ export default { ...@@ -107,18 +107,19 @@ export default {
case 15: case 15:
status = '已失效' status = '已失效'
data[i].statusStyle = { color: '#9EA5BB' } data[i].statusStyle = { color: '#9EA5BB' }
data[i].subtitle = '题库已失效' data[i].subtitle = '题库已过期'
break break
default: default:
break break
} }
data[i].status = status data[i].status = status
this.lists.push(data[i])
} }
if (data.length > 0) { // if (data.length > 0) {
this.lists = data // this.lists = data
console.log('tiku data', data) console.log('tiku data', this.lists)
} // }
}) })
}, },
getTodayDate() { getTodayDate() {
......
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
<text class="line-1" <text class="line-1"
>请上传您的:<text class="name">身份证</text> >请上传您的:<text class="name">身份证</text>
</text> </text>
<text class="line-2">请按照下面提示依次点击上传身份证正反面</text> <view style="margin: 24rpx 0;">
<text class="line-2">请按照下面提示依次点击上传身份证正反面</text>
</view>
<view class="upload-image"> <view class="upload-image">
<image <image
class="cert-image" class="cert-image"
...@@ -77,7 +79,8 @@ export default { ...@@ -77,7 +79,8 @@ export default {
data() { data() {
return { return {
student: {}, student: {},
token: '', qiToken: '',
vToken: null,
} }
}, },
computed: { computed: {
...@@ -116,7 +119,11 @@ export default { ...@@ -116,7 +119,11 @@ export default {
}, },
onLoad() { onLoad() {
this.student = getApp().globalData.student this.student = getApp().globalData.student
this.token = getApp().globalData.qiNiuToken this.qiToken = getApp().globalData.qiNiuToken
this.vToken = this.vuex_token
},
onUnload() {
uni.hideLoading()
}, },
methods: { methods: {
submit() { submit() {
...@@ -146,36 +153,49 @@ export default { ...@@ -146,36 +153,49 @@ export default {
}) })
}, },
getFront() { getFront() {
let that = this
//身份证正面图片识别 //身份证正面图片识别
upload.getPhoto(2, this.token).then((res) => { upload.getPhoto(2, this.qiToken).then((res) => {
this.student.identityFrontPath = res.key this.student.identityFrontPath = res.key
uni.showLoading({
title: '识别中,请稍后',
})
this.$u.api this.$u.api
.getCertifyInfoByType('front', { .getCertifyInfoByType('front', {
url: process.uniEnv.qn_asset_url + res.key, url: process.uniEnv.qn_asset_url + res.key,
}) })
.then((res) => { .then((res) => {
console.log('识别结果', res) uni.hideLoading()
this.student.name = res.name this.student.name = res.name
this.student.identityNumber = res.number this.student.identityNumber = res.number
}) })
.catch((data) => { .catch((data) => {
uni.hideLoading()
this.student.name = ''
this.student.identityNumber = ''
this.$u.toast('识别身份证信息错误') this.$u.toast('识别身份证信息错误')
}) })
}) })
}, },
getBack() { getBack() {
//身份证反面图片识别 //身份证反面图片识别
upload.getPhoto(2, this.token).then((res) => { upload.getPhoto(2, this.qiToken).then((res) => {
this.student.identityBackPath = res.key this.student.identityBackPath = res.key
uni.showLoading({
title: '识别中,请稍后',
})
this.$u.api this.$u.api
.getCertifyInfoByType('back', { .getCertifyInfoByType('back', {
url: process.uniEnv.qn_asset_url + res.key, url: process.uniEnv.qn_asset_url + res.key,
}) })
.then((res) => { .then((res) => {
uni.hideLoading()
console.log('识别结果', res) console.log('识别结果', res)
this.student.certificateValidityDate = res.expire this.student.certificateValidityDate = res.expire
}) })
.catch((data) => { .catch((data) => {
uni.hideLoading()
this.student.certificateValidityDate = ''
this.$u.toast('识别身份证信息错误') this.$u.toast('识别身份证信息错误')
}) })
}) })
...@@ -201,17 +221,14 @@ page { ...@@ -201,17 +221,14 @@ page {
background-color: #f7f9fc; background-color: #f7f9fc;
background-size: 100% 920rpx; background-size: 100% 920rpx;
background-repeat: no-repeat; background-repeat: no-repeat;
height: 120vh; height: 100vh;
position: absolute;
top: 0;
width: 100%; width: 100%;
overflow-x: hidden;
} }
.content { .content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%; width: 100%;
height: 100%;
overflow: auto;
} }
.upload-image { .upload-image {
padding: 0 28rpx; padding: 0 28rpx;
......
...@@ -40,9 +40,16 @@ ...@@ -40,9 +40,16 @@
<button <button
open-type="getPhoneNumber" open-type="getPhoneNumber"
@getphonenumber="getPhonenumber" @getphonenumber="getPhonenumber"
style="background: none;font-size: 26rpx;padding-right: 0;" style="
background: none;
font-size: 26rpx;
padding-right: 0;
padding-right: 0;
text-align: right;
width: 300rpx;
height: 150rpx;"
> >
<text v-if="getMobile">{{ getMobile }}</text> <text v-if="getMobile" class="fill-value">{{ getMobile }}</text>
<text v-else class="empty-value">去绑定</text> <text v-else class="empty-value">去绑定</text>
</button> </button>
</view> </view>
...@@ -79,8 +86,9 @@ export default { ...@@ -79,8 +86,9 @@ export default {
student: { student: {
isCertify: false, isCertify: false,
}, },
token: null, qiToken: null,
code: '', code: '',
count: 0,
} }
}, },
computed: { computed: {
...@@ -118,7 +126,7 @@ export default { ...@@ -118,7 +126,7 @@ export default {
.getQiNiuToken({ bucketName: 'banshou-userprofile' }) .getQiNiuToken({ bucketName: 'banshou-userprofile' })
.then((res) => { .then((res) => {
console.log('chushihua token', res) console.log('chushihua token', res)
this.token = res //token为七牛云的token一般由后台接口提供 this.qiToken = res //token为七牛云的token一般由后台接口提供
getApp().globalData.qiNiuToken = res getApp().globalData.qiNiuToken = res
}) })
this.$u.api.getUserInfo().then((res) => { this.$u.api.getUserInfo().then((res) => {
...@@ -150,51 +158,83 @@ export default { ...@@ -150,51 +158,83 @@ export default {
}) })
}, },
getPhonenumber(e) { getPhonenumber(e) {
var that = this console.log('eeeee', e)
login.appLogin().then((res) => { let params = {}
that.code = res.code if (e && e.detail) {
var code = that.code if (e.detail.errMsg.indexOf('user deny') > -1) {
if (e && e.detail) { //拒绝授权
if (e.detail.errMsg.indexOf('user deny') > -1) { return
//拒绝授权 } else if (e.detail.encryptedData && e.detail.iv) {
} else if (e.detail.encryptedData && e.detail.iv) { //允许授权-解析-更新手机号
//允许授权-解析-更新手机号 params = {
let params = { encryptedData: e.detail.encryptedData,
encryptedData: e.detail.encryptedData, iv: e.detail.iv,
iv: e.detail.iv,
}
uni.checkSession({
success(ccc) {
//session_key 未过期,并且在本生命周期一直有效
params.code = code
that.$u.api.loginWechatAuth(params).then((res) => {
that.student.phoneNumber = res.phoneNumber
that.$u.api.updateUserInfo({
phoneNumber: res.phoneNumber,
})
})
},
fail() {
// session_key 已经失效,需要重新执行登录流程
that.toLogin()
},
})
} else {
this.$u.toast(e.detail.errMsg)
} }
} else { } else {
this.$u.toast('授权失败,请重新授权') this.$u.toast(e.detail.errMsg)
return
} }
}) } else {
this.$u.toast('授权失败,请重新授权')
return
}
this.syncUserinfo(params)
}, },
toLogin() { syncUserinfo(params) {
uni.navigateTo({ let that = this
url: 'pages/login/index', uni.checkSession({
success() {
console.log('走的第一个1')
//session_key 未过期,并且在本生命周期一直有效
uni.login({
provider: 'weixin',
success: (code_res) => {
//获取code
if (code_res.errMsg == 'login:ok') {
console.log('走的第一个2')
params.code = code_res.code
//传参到服务器解析
that.sendInfo(params)
}
},
})
},
fail() {
console.log('走的第二个1', params)
// session_key 已经失效,需要重新执行登录流程
setTimeout(() => {
uni.navigateTo({
url: 'pages/login/index',
})
}, 800)
},
}) })
}, },
sendInfo(params) {
this.$u.api
.loginWechatAuth(params)
.then((res) => {
this.student.phoneNumber = res.phoneNumber
this.$u.api
.updateUserInfo({
phoneNumber: res.phoneNumber,
})
.then((ret) => {
this.$u.toast('绑定成功!')
})
})
.catch((err) => {
this.$u.route({
url: 'pages/login/index',
params: {
back: true,
},
})
})
},
changeHead() { changeHead() {
//获取图片 //获取图片
upload.getPhoto(2, this.token).then((res) => { upload.getPhoto(2, this.qiToken).then((res) => {
this.student.avatarPath = process.uniEnv.qn_asset_url + res.key this.student.avatarPath = process.uniEnv.qn_asset_url + res.key
this.$u.api.updateUserInfo({ this.$u.api.updateUserInfo({
avatarPath: this.student.avatarPath, avatarPath: this.student.avatarPath,
...@@ -203,7 +243,7 @@ export default { ...@@ -203,7 +243,7 @@ export default {
}, },
changeCertPhoto() { changeCertPhoto() {
//获取图片 //获取图片
upload.getPhoto(2, this.token).then((res) => { upload.getPhoto(2, this.qiToken).then((res) => {
//显示 //显示
this.student.certificatePhotoPath = this.student.certificatePhotoPath =
process.uniEnv.qn_asset_url + res.key process.uniEnv.qn_asset_url + res.key
...@@ -307,8 +347,18 @@ button::after { ...@@ -307,8 +347,18 @@ button::after {
border-right-width: 0; border-right-width: 0;
border-top-width: 0; border-top-width: 0;
} }
.fill-value {
color: #191c27;
line-height: 150rpx;
}
.empty-value { .empty-value {
color: #2953ff; color: #2953ff;
line-height: 150rpx;
}
::v-deep u-cell-item .u-cell {
padding: 50rpx 0rpx !important;
}
::v-deep u-cell-item:nth-child(3) .u-cell {
padding: 0 !important;
} }
</style> </style>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<u-cell-group class="cell-group" :border="false"> <u-cell-group class="cell-group" :border="false">
<u-cell-item <u-cell-item
title="版本更新" title="版本更新"
value="当前版本v1.1.0" :value="newVersion"
:border-bottom="false" :border-bottom="false"
@tap="upgrade" @tap="upgrade"
></u-cell-item> ></u-cell-item>
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
<script> <script>
export default { export default {
data() { data() {
return {} return {
newVersion: '当前版本' + process.uniEnv.version,
}
}, },
computed: {}, computed: {},
onLoad() {}, onLoad() {},
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<view class="u-flex default" v-if="lists.length === 0"> <view class="u-flex default" v-if="lists.length === 0">
<view> <view>
<image :src="defaultImg" /> <u-image :src="defaultImg" width="374" height="256" :fade="false" />
</view> </view>
<view class="no-result"> <view class="no-result">
当前暂无搜索结果 当前暂无搜索结果
...@@ -142,7 +142,6 @@ export default { ...@@ -142,7 +142,6 @@ export default {
end: this.lists.length, end: this.lists.length,
}) })
this.arrId = this.lists[0].id this.arrId = this.lists[0].id
if (records.length < this.pageSize) { if (records.length < this.pageSize) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页 //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true this.isLoadMore = true
...@@ -163,8 +162,8 @@ export default { ...@@ -163,8 +162,8 @@ export default {
} }
this.$u.vuex('searchHistory', history) this.$u.vuex('searchHistory', history)
this.currentPage = 1 this.currentPage = 1
this.lists = []
setList([]) setList([])
this.lists = getList()
this.section = [] this.section = []
this.arrId = '' this.arrId = ''
this.init() this.init()
......
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