Commit ed4b4d77 authored by Facius's avatar Facius

Merge branch 'dev-v1.0.0' into test

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