Commit fb334a21 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 bc7f6b93 6b2e55e9
const UNI_APP = { const UNI_APP = {
apiUrl: 'http://192.168.0.208:8760', apiUrl: 'http://192.168.0.204:8760',
qn_base_url: 'https://qn-static.banshouhui.com/study/', qn_base_url: 'https://qn-static.banshouhui.com/study/',
qn_asset_url: 'http://deudn.c.pp.cc/', qn_asset_url: 'http://deudn.c.pp.cc/',
uUrl: 'http://rest-u.yunya.com/', uCenterUrl: 'http://192.168.0.5:8093/',//'http://rest-u.yunya.com/'
argoDebugMode: 1, argoDebugMode: 1,
version: 'v1.0.0', version: 'v1.0.0',
} }
......
...@@ -2,7 +2,7 @@ const UNI_APP = { ...@@ -2,7 +2,7 @@ const UNI_APP = {
apiUrl: 'https://system.banshouhui.com', apiUrl: 'https://system.banshouhui.com',
qn_base_url: 'https://qn-static.banshouhui.com/study/', qn_base_url: 'https://qn-static.banshouhui.com/study/',
qn_asset_url: 'https://img2.banshouhui.com/', qn_asset_url: 'https://img2.banshouhui.com/',
uUrl: 'http://rest-u.banshouhui.com/', uCenterUrl: 'http://rest-u.banshouhui.com/',
argoDebugMode: 1, argoDebugMode: 1,
version: 'v1.0.0', version: 'v1.0.0',
} }
......
...@@ -2,7 +2,7 @@ const UNI_APP = { ...@@ -2,7 +2,7 @@ const UNI_APP = {
apiUrl: 'https://system.dev.banshouhui.com', apiUrl: 'https://system.dev.banshouhui.com',
qn_base_url: 'https://qn-static.banshouhui.com/study/', qn_base_url: 'https://qn-static.banshouhui.com/study/',
qn_asset_url: 'https://img2.banshouhui.com/', qn_asset_url: 'https://img2.banshouhui.com/',
uUrl: 'http://rest-u.test.ibanshou.cn/', uCenterUrl: 'http://rest-u.test.ibanshou.cn/',
argoDebugMode: 1, argoDebugMode: 1,
version: 'v1.0.0', version: 'v1.0.0',
} }
......
let commonApiFun = function(vm) { let commonApiFun = function(vm) {
const globalUrl = process.uniEnv || {} const globalUrl = process.uniEnv || {}
let ucenterApiUrl = globalUrl.uUrl let uCenterApiUrl = globalUrl.uCenterUrl
let loginWechatAuth = async (params = {}) => let loginWechatAuth = async (params = {}) =>
await vm.$u.post('/wxapp/unify/authorization', params) await vm.$u.post('/wxapp/unify/authorization', params)
let payOrder = async (params = {}) => await vm.$u.post('/pay/order', params) let payOrder = async (params = {}) => await vm.$u.post('/pay/order', params)
let payQuery = async (params = {}) => await vm.$u.get('/pay/query', params) let payQuery = async (params = {}) => await vm.$u.get('/pay/query', params)
let getQiNiuToken = async (params = {}) => let getQiNiuToken = async (params = {}) =>
await vm.$u.post(ucenterApiUrl + 'v1/tokens', params) await vm.$u.post(uCenterApiUrl + 'v1/tokens', params)
const commonApi = { const commonApi = {
loginWechatAuth, loginWechatAuth,
payOrder, payOrder,
......
import { commonApiFun } from './common.js' import { commonApiFun } from './common.js'
import { learnApiFun } from './learn.js' import { learnApiFun } from './learn.js'
import { userApiFun } from './user.js'
const apiFun = function(vm) { const apiFun = function(vm) {
let commonApi = commonApiFun(vm) let commonApi = commonApiFun(vm)
let learnApi = learnApiFun(vm) let learnApi = learnApiFun(vm)
let userApi = userApiFun(vm)
let apiUrl = { let apiUrl = {
...commonApi, ...commonApi,
...learnApi ...learnApi,
...userApi,
} }
return apiUrl return apiUrl
} }
......
const globalUrl = process.uniEnv || {}
const apiUrl = globalUrl.apiUrl
const uCenterUrl = globalUrl.uCenterUrl
let userApiFun = function(vm) {
/* 更新学员信息 */
let updateUserInfo = async (params = {}) =>
await vm.$u.post(apiUrl + '/student/update', params)
//获取学员信息
let getUserInfo = async (params = {}) =>
await vm.$u.get(apiUrl + '/student/get', params)
//验证身份证正面
let checkIdCardFront = async (params = {}) =>
await vm.$u.post(uCenterUrl + 'v1/settled/card-front', params)
//验证身份证反面
let checkIdCardBack = async (params = {}) =>
await vm.$u.post(uCenterUrl + 'v1/settled/card-back', params)
const userApi = {
updateUserInfo,
getUserInfo,
checkIdCardFront,
checkIdCardBack,
}
return userApi
}
module.exports = {
userApiFun,
}
...@@ -11,6 +11,7 @@ const install = (Vue, vm) => { ...@@ -11,6 +11,7 @@ const install = (Vue, vm) => {
'content-type': 'application/json; charset=utf-8', 'content-type': 'application/json; charset=utf-8',
}, },
loadingTime: 800, loadingTime: 800,
showLoading: false,
originalData: true, originalData: true,
}) })
......
function appLogin() {
return new Promise(function(resolve, reject) {
uni.login({
success(res) {
if (!res.code) {
uni.hideLoading()
uni.showModal({
content: res.errMsg,
showCancel: false,
})
}
resolve(res)
},
fail() {
uni.hideLoading()
uni.showModal({
content: '小程序登录失败',
showCancel: false,
})
reject()
},
})
})
}
export default {
appLogin,
}
...@@ -44,34 +44,36 @@ function getPhoto(type, token) { ...@@ -44,34 +44,36 @@ function getPhoto(type, token) {
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: 6, //默认9
count: 6, //默认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) => {
.catch((msg) => { console.error(msg)
console.error(msg) reject(msg)
reject(msg) })
}) },
}, })
}) })
}) })
} }
//上传七牛 //上传七牛
function upload(filePath, token) { function upload(filePath, token) {
console.log('filePath', filePath)
console.log('token', token)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let key = let key =
new Date().getTime() + Math.random(1000) + filePath.split('/').pop() //key为自定义文件名 new Date().getTime() + Math.random(1000) + filePath.split('/').pop() //key为自定义文件名
......
...@@ -69,6 +69,7 @@ export default { ...@@ -69,6 +69,7 @@ export default {
lists: [], lists: [],
// 答案对错 // 答案对错
answer: '', answer: '',
userAnswer: ''
} }
}, },
watch: { watch: {
...@@ -98,6 +99,8 @@ export default { ...@@ -98,6 +99,8 @@ export default {
v.confirm = false // 确认答案 v.confirm = false // 确认答案
}) })
this.$set(this.lists[index], 'confirm', true) this.$set(this.lists[index], 'confirm', true)
// 用户选的答案
this.userAnswer = this.lists[index].sort
// 判断所选答案是否正确 // 判断所选答案是否正确
this.answer = this.rightKey.includes(this.lists[index].sort) this.answer = this.rightKey.includes(this.lists[index].sort)
? 'pass' ? 'pass'
...@@ -114,6 +117,9 @@ export default { ...@@ -114,6 +117,9 @@ export default {
if (num.length > 1) { if (num.length > 1) {
// 判断所选答案是否正确 // 判断所选答案是否正确
const checkedList = num.map((v) => v.sort) const checkedList = num.map((v) => v.sort)
// 用户选的答案
this.userAnswer = checkedList.join(',')
// 判断所选答案是否正确
this.answer = equar(checkedList, this.rightKey) ? 'pass' : 'fail' this.answer = equar(checkedList, this.rightKey) ? 'pass' : 'fail'
// 处理显示逻辑 // 处理显示逻辑
this.lists.forEach((v) => { this.lists.forEach((v) => {
...@@ -124,7 +130,7 @@ export default { ...@@ -124,7 +130,7 @@ export default {
} }
}, },
submitAnswer() { submitAnswer() {
this.$emit('change', this.answer, this.lists) this.$emit('change', this.answer, this.lists, this.userAnswer)
}, },
}, },
} }
......
...@@ -125,10 +125,10 @@ export default { ...@@ -125,10 +125,10 @@ export default {
this.swiperIndex = current this.swiperIndex = current
this.swiperCurrent = current this.swiperCurrent = current
}, },
answerChange(status, lists) { answerChange(status, lists, userAnswer) {
this.$set(this.swiperList[this.swiperIndex], 'errShow', this.type === 2 ? true : status === 'fail') this.$set(this.swiperList[this.swiperIndex], 'errShow', this.type === 2 ? true : status === 'fail')
this.$set(this.swiperList[this.swiperIndex], 'submitStatus', true) this.$set(this.swiperList[this.swiperIndex], 'submitStatus', true)
this.$emit("answerChange", status, lists) this.$emit("answerChange", status, lists, userAnswer)
}, },
clear () { clear () {
this.list = [] this.list = []
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
"name": "mine", "name": "mine",
"style": { "style": {
"navigationBarTitleText": "个人中心", "navigationBarTitleText": "个人中心",
"navigationStyle": "custom",
"disableScroll": true "disableScroll": true
} }
} }
...@@ -254,6 +255,33 @@ ...@@ -254,6 +255,33 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"disableScroll": true "disableScroll": true
} }
},
{
"path": "address",
"name": "mineAddress",
"style": {
"navigationBarTitleText": "工作单位",
"enablePullDownRefresh": false,
"disableScroll": true
}
},
{
"path": "certify",
"name": "mineCertify",
"style": {
"navigationBarTitleText": "实名认证",
"enablePullDownRefresh": false,
"disableScroll": true
}
},
{
"path": "setting",
"name": "mineSetting",
"style": {
"navigationBarTitleText": "设置",
"enablePullDownRefresh": false,
"disableScroll": true
}
} }
] ]
} }
......
<template> <template>
<view class="content"> <view class="content">
<view> <view>
<text class="title">{{title}}</text> <u-tabs-swiper
</view> bg-color="#F4F5F7"
</view> inactive-color="#999999"
font-size="28"
ref="uTabs"
:list="tabs"
:current="current"
@change="tabsChange"
:is-scroll="false"
:bar-width="52"
swiperWidth="750"
></u-tabs-swiper>
<swiper
class="swiper_group"
:current="swiperCurrent"
@transition="transition"
@animationfinish="animationfinish"
>
<swiper-item @touchmove.stop.prevent="stopTouchMove">
<u-form-item label="证件类型"
><u-input v-model="form.type"
/></u-form-item>
<u-form-item label="身份证"><u-input v-model="form.id"/></u-form-item>
<u-form-item label="姓名"><u-input v-model="form.name"/></u-form-item>
</swiper-item>
<swiper-item @touchmove.stop.prevent="stopTouchMove"> </swiper-item>
</swiper>
</view>
</view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
title: '证书' title: '证书',
} tabs: [
}, {
onLoad() { name: '证书查询',
},
{
name: '我的证书',
},
],
}
},
onLoad() {},
methods: {},
}
</script>
}, <style>
methods: { .content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
margin-top: 180rpx;
}
} /* .swiper_group{
} margin-top: ;
</script> } */
</style>
<template> <template>
<view> <view>
<view <u-navbar
class="u-flex user-box u-p-l-30 u-p-t-30 u-p-r-20 u-p-b-30" back-icon-color="#333333"
@tap="login" background="transparent"
> title=" "
<view class="u-m-r-10"> titleColor="#191C27"
<u-avatar :src="avatar" size="140"></u-avatar> :border-bottom="false"
title-bold
:is-back="false"
></u-navbar>
<view class="top"
><image class="background-image" :src="backgroundImage"></image>
<view
class="u-flex user-box u-p-l-30 u-p-t-30 u-p-r-20 u-p-b-30"
@tap="login"
>
<view class="u-flex-1">
<view class="u-font-18 u-p-b-20 nick-name">{{ nikeName }}</view>
<view class="login-tip">
<text v-if="isLogin"
>累计刷题量<text style="color:#2953FF">{{ loginTips }}</text
>次</text
>
<text v-else>登录可查看答题信息</text>
</view>
</view>
<view class="u-m-r-10 avatar">
<u-avatar class="avatar-iamge" :src="avatar" size="140"></u-avatar>
</view>
</view> </view>
<view class="u-flex-1">
<view class="u-font-18 u-p-b-20">{{ nikeName }}</view>
<view class="u-font-14 u-tips-color">累计刷题俩999次</view>
</view>
</view>
<view class="u-m-t-20"> <view class="">
<u-cell-group> <u-cell-group :border="false">
<u-cell-item <u-cell-item
icon="star" :border-bottom="false"
title="个人信息" title="个人信息"
value="完善度40%" @tap="toUrl('pages/mine/info')"
@tap="toUrl('pages/mine/info')" :value="completeness"
></u-cell-item> :title-style="cellTitleStyle"
<u-cell-item :value-style="{ color: '#2953FF', 'font-size': '26rpx' }"
icon="photo" >
title="我的题库" <u-image
@tap="toUrl('pages/mine/bank')" slot="icon"
></u-cell-item> width="36rpx"
<u-cell-item height="40rpx"
icon="coupon" :src="infoIcon"
title="联系客服" ></u-image>
@tap="toUrl('pages/mine/customer')" </u-cell-item>
></u-cell-item> <u-cell-item
<u-cell-item icon="coupon" title="退出登录" @tap="logout"></u-cell-item> :border-bottom="false"
</u-cell-group> title="我的题库"
:title-style="cellTitleStyle"
@tap="toUrl('pages/mine/bank')"
>
<u-image
slot="icon"
width="36rpx"
height="40rpx"
:src="questionIcon"
></u-image>
</u-cell-item>
<u-cell-item
:border-bottom="false"
title="联系客服"
:title-style="cellTitleStyle"
@tap="toUrl('pages/mine/customer')"
>
<u-image
slot="icon"
width="36rpx"
height="40rpx"
:src="serviceIcon"
></u-image>
</u-cell-item>
<u-cell-item
:border-bottom="false"
title="设置"
:title-style="cellTitleStyle"
@tap="toUrl('pages/mine/setting')"
>
<u-image
slot="icon"
width="36rpx"
height="40rpx"
:src="settingIcon"
></u-image>
</u-cell-item>
</u-cell-group>
</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -41,21 +96,84 @@ ...@@ -41,21 +96,84 @@
export default { export default {
data() { data() {
return { return {
pic: 'https://uviewui.com/common/logo.png', pic: process.uniEnv.qn_base_url + '/xitongtouxiang.png',
show: true, show: true,
countItem: [
'avatarPath',
'certificatePhotoPath',
'identityNumber',
'nickname',
'phoneNumber',
'workUnit',
],
student: {},
} }
}, },
computed: { computed: {
infoIcon() {
return process.uniEnv.qn_base_url + '/gerenxinxi@3x.png'
},
questionIcon() {
return process.uniEnv.qn_base_url + '/wodetiku@3x.png'
},
serviceIcon() {
return process.uniEnv.qn_base_url + '/lianxikefu@3x.png'
},
settingIcon() {
return process.uniEnv.qn_base_url + '/shezhi@3x.png'
},
isLogin() {
console.log('is login', this.userInfo.nickName)
return this.userInfo.nickName != undefined
},
loginTips() {
return this.student.consumeAmount || 0
},
avatar() { avatar() {
return this.userInfo.avatarUrl || this.pic return (this.userInfo && this.userInfo.avatarUrl) || this.pic
}, },
nikeName() { nikeName() {
return this.userInfo.nickName || '未登录' return (this.userInfo && this.userInfo.nickName) || '点击登录'
},
backgroundImage() {
return process.uniEnv.qn_base_url + 'wodetop@3x.png'
},
completeness() {
if (this.userInfo && this.userInfo.nickName) {
return '完善度' + this.asumeCount() + '%'
} else {
return ''
}
},
cellTitleStyle() {
return { 'font-size': '32rpx', coloe: '#191C27', 'margin-left': '26rpx' }
}, },
}, },
onLoad() {}, onLoad() {},
onShow() {
if (this.userInfo.nickName) {
this.$u.api.getUserInfo().then((res) => {
this.student = res
getApp().globalData.student
})
}
},
methods: { methods: {
asumeCount() {
//计算完善度
let length = this.countItem.length
let count = 0
for (let key in this.student) {
if (this.countItem.indexOf(key) != -1 && this.student[key]) {
count = count + 1
}
}
return parseInt((count / length) * 100)
},
login() { login() {
if (this.userInfo.nickName) {
return
}
this.$u.route({ this.$u.route({
url: 'pages/login/index', url: 'pages/login/index',
}) })
...@@ -65,18 +183,13 @@ export default { ...@@ -65,18 +183,13 @@ export default {
url: url, url: url,
}) })
}, },
logout() {
this.$u.vuex('vuex_token', '')
this.$u.vuex('openId', '')
this.$u.vuex('userInfo', {})
},
}, },
} }
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background-color: #ededed; background-color: #ffffff;
} }
.camera { .camera {
width: 54px; width: 54px;
...@@ -88,5 +201,40 @@ page { ...@@ -88,5 +201,40 @@ page {
} }
.user-box { .user-box {
background-color: #fff; background-color: #fff;
margin-top: 380rpx;
border-top-left-radius: 30rpx;
border-top-right-radius: 30rpx;
}
.top {
width: 750rpx;
position: absolute;
top: 0;
.background-image {
position: absolute;
z-index: -1;
width: 750rpx;
height: 562rpx;
}
}
.nick-name {
font-size: 48rpx;
font-weight: bold;
color: #191c27;
}
.login-tip {
font-size: 26rpx;
color: #5a6073;
}
.avatar {
position: relative;
image {
position: absolute;
top: -70rpx;
/* 登录加外边框,未登录不加边框 */
/* padding: 5rpx;
background-color: white; */
}
} }
</style> </style>
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
:numberList="complete.result" :numberList="complete.result"
:type="complete.type" :type="complete.type"
:visible.sync="complete.visible" :visible.sync="complete.visible"
:timeout="complete.timeout"
@cancel="cancel" @cancel="cancel"
@submit="submit" @submit="submit"
> >
...@@ -151,6 +152,7 @@ export default { ...@@ -151,6 +152,7 @@ export default {
type: 'pass', type: 'pass',
result: [], result: [],
visible: false, visible: false,
timeout: false
}, },
timestamp: 60 * 60, timestamp: 60 * 60,
list: [], list: [],
...@@ -215,12 +217,11 @@ export default { ...@@ -215,12 +217,11 @@ export default {
this.type = 1 this.type = 1
break; break;
} }
// 第一次进入,显示提示 // 第一次进入,显示提示
if (this.questionList.length === 0) { if (this.questionList.length === 0) {
this.show = true this.show = true
} }
this.init() this.init()
}, },
methods: { methods: {
...@@ -234,7 +235,13 @@ export default { ...@@ -234,7 +235,13 @@ export default {
// 列表总长度,一定要在第一次请求列表数据前明确该值 // 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据 // 否则无法知道下一页是否还有数据
let total = parseInt(res) || 0 let total = parseInt(res) || 0
// 考试
if (this.type === 2) {
this.pageSize = 100
total = 100
}
this.total = total this.total = total
// 练习模式-初始化答题卡列表 // 练习模式-初始化答题卡列表
if (this.type === 1) Utils.initAnswerCardList(total, this) if (this.type === 1) Utils.initAnswerCardList(total, this)
this.cachePageDataMap = new Map() this.cachePageDataMap = new Map()
...@@ -353,35 +360,43 @@ export default { ...@@ -353,35 +360,43 @@ export default {
this.model = i this.model = i
}, },
timeEnd() { timeEnd() {
this.complete.timeout = true
this.handPapers()
}, },
// 作答完毕 // 作答完毕
answerChange(status, lists) { answerChange(status, lists, userAnswer) {
// 保存答题状态 // 保存答题状态
const item = this.list.find(v => v.index === this.currentIndex) const item = this.list.find(v => v.index === this.currentIndex)
item.submitStatus = true item.submitStatus = true
item.answerList = lists item.answerList = lists
item.result = status item.result = status
item.errShow = this.type === 2 ? true : status === 'fail' item.errShow = this.type === 2 ? true : status === 'fail'
item.userAnswer = userAnswer
if(this.model === 1) this.saveAnswer(item)
// 更新答题卡 // 更新答题卡
this.questionList[this.currentIndex] = item if (this.type === 1){
this.$u.vuex('questionList', this.questionList) this.questionList[this.currentIndex] = item
this.$u.vuex('lastIndex', this.currentIndex) this.$u.vuex('questionList', this.questionList)
this.$u.vuex('lastIndex', this.currentIndex)
// 每日一练数量统计 // 每日一练数量统计
if (this.type === 1 && this.daily.status) { if (this.daily.status) {
if (this.daily.count < 9) this.daily.count++ if (this.daily.count < 9) this.daily.count++
if (this.daily.count === 9) { if (this.daily.count === 9) {
this.daily.visible = true this.daily.visible = true
this.daily.status = false this.daily.status = false
return return
}
} }
} }
// 如果回答错误或者是考试模式,自动进入下一题 // 如果回答错误或者是考试模式,自动进入下一题
if ((status === 'pass' && this.model !== 2)|| this.type === 2) { if ((status === 'pass' && this.model !== 2) || this.type === 2) {
if (this.currentIndex + 1 > this.total - 1) { if (this.currentIndex + 1 > this.total - 1) { // 最后一题回答后
if (this.type === 2) {
this.handPapers(1)
this.submit()
}
return return
} }
this.$nextTick(() => { this.$nextTick(() => {
...@@ -389,19 +404,32 @@ export default { ...@@ -389,19 +404,32 @@ export default {
}) })
} }
}, },
// 交卷 // 保存答案
handPapers() { saveAnswer(info) {
const params = {
answer: info.userAnswer,
answerRight: info.result === 'pass',
questionId: info.id,
questionWarehouseId: this.questionWarehouseId,
recordId: this.recordId,
source: this.source
}
this.$u.api.answer([params])
},
// 统计分数
handPapers(type) {
const fail = this.list.filter((v) => v.result === 'fail').length // 错题数 const fail = this.list.filter((v) => v.result === 'fail').length // 错题数
const noStart = this.list.filter((v) => !v.result).length // 未做题数 const noStart = this.list.filter((v) => !v.result).length // 未做题数
const fraction = 0 // 分数 const fraction = this.total - noStart - fail// 分数
this.complete.result = [fail, noStart, fraction] this.complete.result = [fail, noStart, fraction]
this.complete.type = 'pass' this.complete.type = fraction < 60 ? 'fail' : 'pass'
this.complete.visible = true if (!type) this.complete.visible = true
}, },
// 考试成绩弹框确认 // 考试成绩弹框确认
submit() { submit() {
// 提前交卷 // 提前交卷
this.$u.route({ this.$u.route({
type: 'redirect',
url: '/pages/learn/score', url: '/pages/learn/score',
}) })
}, },
...@@ -415,7 +443,10 @@ export default { ...@@ -415,7 +443,10 @@ export default {
}, },
// 每日一练弹框取消 // 每日一练弹框取消
dailyCancel() { dailyCancel() {
this.$u.route('/pages/learn/record') this.$u.route({
type: 'redirect',
url: '/pages/learn/record',
})
}, },
// 收藏 // 收藏
collection() { collection() {
......
...@@ -135,6 +135,7 @@ function request({ currentPage, size, onSuccess, onFailed }, vm) { ...@@ -135,6 +135,7 @@ function request({ currentPage, size, onSuccess, onFailed }, vm) {
} }
let item = { let item = {
index: i + (currentPage - 1) * size, index: i + (currentPage - 1) * size,
id: info.id,
currentPage: currentPage, currentPage: currentPage,
total: data.total, total: data.total,
title: content.title, title: content.title,
......
<template>
<view class="content">
<view class="wrap">
<input
type="text"
placeholder="请输入工作单位"
v-model="student.workUnit"
/>
</view>
<button @click="submit">提交</button>
</view>
</template>
<script>
export default {
data() {
return {
student: {
workUnit: '',
},
}
},
computed: {},
onLoad() {
this.student = getApp().globalData.student
},
methods: {
submit() {
if (this.student.workUnit == '') {
this.$u.toast('请输入工作单位名称')
return
}
this.$u.api
.updateUserInfo({
workUnit: this.student.workUnit,
})
.then((res) => {
this.$u.toast('保存成功')
setTimeout(() => {
this.$u.route({
type: 'back',
})
}, 1500)
})
},
},
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}
.wrap {
display: flex;
}
</style>
<template>
<view class="content">
<u-cell-group>
<u-cell-item
title="实名认证"
:arrow="false"
:hover-class="none"
title-style="{'font':'bold','font-size':'40rpx'}"
>
<view slot="label" style="display:flex;flex-direction: column;">
<text>上传二代身份证照片,图片大小不大于2M</text>
<view class="upload-image">
<image
class="cert-image"
:src="certFront"
mode="widthFix"
lazy-load="false"
binderror=""
bindload=""
@click="getFront"
/>
<image
class="cert-image"
style="margin-left: 30rpx;"
:src="certBack"
mode="widthFix"
lazy-load="false"
binderror=""
bindload=""
@click="getBack"
/>
</view>
</view>
</u-cell-item>
<u-cell-item
:arrow="false"
:hover-class="none"
title="姓名"
:value="name"
></u-cell-item>
<u-cell-item
:arrow="false"
:hover-class="none"
title="身份证号"
:value="getIdCardNum"
></u-cell-item>
<u-cell-item
:arrow="false"
:hover-class="none"
title="有效期"
:value="expire"
></u-cell-item>
<u-cell-item :arrow="false" :hover-class="none">
<view slot="label" style="display:flex;flex-direction: column;">
<button @click="submit">确定</button>
</view>
</u-cell-item>
</u-cell-group>
</view>
</template>
<script>
import upload from '@/common/upload'
export default {
data() {
return {
student: {},
token: '',
}
},
computed: {
certFront() {
return this.student.identityFrontPath
? process.uniEnv.qn_asset_url + this.student.identityFrontPath
: 'https://qn-static.banshouhui.com/self-support/renxiang.png'
},
certBack() {
return this.student.identityBackPath
? process.uniEnv.qn_asset_url + this.student.identityBackPath
: 'https://qn-static.banshouhui.com/self-support/guohui.png'
},
name() {
return this.student.name || ''
},
expire() {
return this.student.certificateValidityDate || ''
},
getIdCardNum() {
return this.student.identityNumber || ''
},
},
onLoad() {
this.student = getApp().globalData.student
this.token = getApp().globalData.qiNiuToken
},
methods: {
submit() {
if (
!this.student.identityNumber ||
!this.student.certificateValidityDate
) {
this.$u.toast('请上传身份证正反面信息')
return
}
this.$u.api
.updateUserInfo({
identityFrontPath: this.student.identityFrontPath,
identityBackPath: this.student.identityBackPath,
identityNumber: this.student.identityNumber,
certificateValidityDate: this.student.certificateValidityDate,
name: this.student.name,
})
.then((res) => {
this.$u.toast('认证成功')
setTimeout(() => {
this.$u.route({
type: 'back',
})
}, 1500)
})
},
getFront() {
//身份证正面图片识别
upload.getPhoto(1, this.token).then((res) => {
this.student.identityFrontPath = res.key
this.$u.api
.checkIdCardFront({ id_card_front: res.key })
.then(() => {})
.catch((data) => {
if (data.errMsg == 'request:ok') {
this.student.name = data.data.id_card_name
this.student.identityNumber = data.data.id_card_number
} else {
this.$u.toast('识别身份证信息错误')
}
})
})
},
getBack() {
//身份证反面图片识别
upload.getPhoto(1, this.token).then((res) => {
this.student.identityBackPath = res.key
this.$u.api
.checkIdCardBack({ id_card_back: res.key })
.then(() => {})
.catch((data) => {
console.log('beimian', data)
if (data.errMsg == 'request:ok') {
this.student.certificateValidityDate = data.data.id_card_expire
} else {
this.$u.toast('识别身份证信息错误')
}
})
})
},
},
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}
.cert-image {
width: 300rpx;
height: 300rpx;
}
</style>
<template> <template>
<view class="content"> <view class="content">
<u-cell-group> <u-cell-group style="width: 100%;">
<u-cell-item title="头像" @click="changeHead"> <u-cell-item title="头像" @click="changeHead">
<view slot="right-icon"> <view slot="right-icon">
<u-image width="50rpx" height="50rpx" :src="headPhoto"></u-image> <u-image width="50rpx" height="50rpx" :src="headPhoto"></u-image>
...@@ -17,126 +17,159 @@ ...@@ -17,126 +17,159 @@
<text v-else style="color:blue;">未上传</text> <text v-else style="color:blue;">未上传</text>
</view> </view>
</u-cell-item> </u-cell-item>
<u-cell-item <u-cell-item title="手机号" :arrow="false" :hover-class="none">
title="手机号" <view slot="right-icon">
:arrow="false" <button
:hover-class="none" hover-class="none"
:value="getMobile" class="mobile-button"
></u-cell-item> open-type="getPhoneNumber"
@getphonenumber="getPhonenumber"
>
{{ getMobile }}
</button>
</view>
</u-cell-item>
<u-cell-item <u-cell-item
title="实名认证" title="实名认证"
:arrow="false" :arrow="false"
:hover-class="none" :hover-class="none"
title-style="{'font':'bold','font-size':'40rpx'}" title-style="{'font':'bold','font-size':'40rpx'}"
:value="getCertifyStatus"
@click="goCertify"
> >
<view slot="label" style="display:flex;flex-direction: column;">
<text>上传二代身份证照片,图片大小不大于2M</text>
<view class="upload-image">
<image
class="cert-image"
:src="certFront"
mode="widthFix"
lazy-load="false"
binderror=""
bindload=""
@click="getFront"
/>
<image
class="cert-image"
style="margin-left: 30rpx;"
:src="certBack"
mode="widthFix"
lazy-load="false"
binderror=""
bindload=""
@click="getBack"
/>
</view>
</view>
</u-cell-item> </u-cell-item>
<u-cell-item <u-cell-item
:arrow="false" title="工作单位"
:hover-class="none" :value="getCompany"
title="姓名" @click="goAddress"
:value="name"
></u-cell-item>
<u-cell-item
:arrow="false"
:hover-class="none"
title="身份证号"
:value="idCardNum"
></u-cell-item> ></u-cell-item>
<u-cell-item
:arrow="false"
:hover-class="none"
title="有效期"
:value="expire"
></u-cell-item>
<u-cell-item title="工作单位" :value="company"></u-cell-item>
</u-cell-group> </u-cell-group>
</view> </view>
</template> </template>
<script> <script>
import upload from '@/common/upload' import upload from '@/common/upload'
import login from '@/common/login'
export default { export default {
data() { data() {
return { return {
title: '个人信息', student: {},
headPhoto: 'https://qn-static.banshouhui.com/self-support/avatar.gif',
headCertPhoto: 'https://qn-static.banshouhui.com/self-support/avatar.gif',
certFront: 'https://qn-static.banshouhui.com/self-support/renxiang.png',
certBack: 'https://qn-static.banshouhui.com/self-support/guohui.png',
idCardNum: '1312315661651',
expire: '2020-12-01~2090-09-01',
mobile: '1773322111',
name: '阿斯达',
company: '深圳维修会科技有限公司',
token: null, token: null,
host: process.uniEnv.qn_asset_url, host: process.uniEnv.qn_asset_url,
code: '',
} }
}, },
computed: { computed: {
headPhoto() {
return this.student.avatarPath || this.userInfo.avatarUrl
},
headCertPhoto() {
return (
this.student.certificatePhotoPath ||
process.uniEnv.qn_base_url + 'xitongtouxiang.png'
)
},
isupLoadCertPhoto() { isupLoadCertPhoto() {
return true //this.member && this.member.certPhoto || false return this.student.identityNumber || false
}, },
getMobile() { getMobile() {
return this.mobile return this.student.phoneNumber || ''
},
getCompany() {
return this.student.workUnit || ''
},
getCertifyStatus() {
console.log(this.student.identityNumber)
return !this.student.identityNumber ? '去认证' : '已认证'
}, },
}, },
onLoad() { onLoad() {
this.$u.api.getQiNiuToken({ type: 'image' }).catch((data) => { this.$u.api.getQiNiuToken({ type: 'image' }).catch((data) => {
if (data.errMsg == 'request:ok') { if (data.errMsg == 'request:ok') {
this.token = data.data.token //token为七牛云的token一般由后台接口提供 this.token = data.data.token //token为七牛云的token一般由后台接口提供
getApp().globalData.qiNiuToken = data.data.token
} else { } else {
console.log('get token error', data) this.$u.toast('获取token失败')
} }
}) })
this.$u.api.getUserInfo().then((res) => {
this.student = res
console.log('stu', this.student)
})
}, },
methods: { methods: {
changeHead() { goCertify() {
//获取图片 getApp().globalData.student = this.student
upload.getPhoto(1, this.token).then((res) => { this.$u.route({
this.headPhoto = this.host + res.key url: 'pages/mine/certify',
}) })
}, },
changeCertPhoto() { goAddress() {
//获取图片 getApp().globalData.student = this.student
upload.getPhoto(2, this.token).then((res) => { this.$u.route({
//显示 url: 'pages/mine/address',
this.headCertPhoto = this.host + res.key })
},
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)
}
} else {
this.$u.toast('授权失败,请重新授权')
}
})
},
toLogin() {
uni.navigateTo({
url: 'pages/login/index',
}) })
}, },
getFront() { changeHead() {
//获取图片 //获取图片
upload.getPhoto(1, this.token).then((res) => { upload.getPhoto(1, this.token).then((res) => {
this.certFront = this.host + res.key this.student.avatarPath = this.host + res.key
this.$u.api.updateUserInfo({
avatarPath: this.student.avatarPath,
})
}) })
}, },
getBack() { changeCertPhoto() {
//获取图片 //获取图片
upload.getPhoto(1, this.token).then((res) => { upload.getPhoto(2, this.token).then((res) => {
this.certBack = this.host + res.key //显示
this.student.certificatePhotoPath = this.host + res.key
this.$u.api.updateUserInfo({
certificatePhotoPath: this.student.certificatePhotoPath,
})
}) })
}, },
toUrl(url) { toUrl(url) {
...@@ -185,4 +218,13 @@ export default { ...@@ -185,4 +218,13 @@ export default {
.upload-image { .upload-image {
margin-top: 30rpx; margin-top: 30rpx;
} }
.mobile-button {
width: 200px;
height: 30px;
}
button::after {
border: none;
background-color: none;
}
</style> </style>
<template>
<view class="content">
<u-cell-group class="cell-group" :border="false">
<u-cell-item
title="版本更新"
value="当前版本v1.1.0"
:border-bottom="false"
></u-cell-item>
</u-cell-group>
<view class="logout" @tap="logout">退出登录</view>
</view>
</template>
<script>
export default {
data() {
return {}
},
computed: {},
onLoad() {},
methods: {
logout() {
this.$u.vuex('vuex_token', '')
this.$u.vuex('openId', '')
this.$u.vuex('userInfo', {})
setTimeout(() => {
this.$u.route({
type: 'back',
})
}, 1000)
},
},
}
</script>
<style>
page {
background-color: #f7f9fc;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}
.cell-group {
width: 100%;
margin-top: 20rpx;
}
.logout {
width: 100%;
height: 100rpx;
margin-top: 16rpx;
background-color: white;
text-align: center;
line-height: 100rpx;
color: #fa5a49;
font-size: 32rp;
}
</style>
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