Commit de3f032c 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 c8be89c0 4aa2743b
let commonApiFun = function(vm) {
const globalUrl = process.uniEnv || {}
let uCenterApiUrl = globalUrl.uCenterUrl
let apiUrl = globalUrl.apiUrl
let loginWechatAuth = async (params = {}) =>
await vm.$u.post('/wxapp/unify/authorization', params)
let payOrder = async (params = {}) => await vm.$u.post('/pay/order', params)
let payQuery = async (params = {}) => await vm.$u.get('/pay/query', params)
let getQiNiuToken = async (params = {}) =>
await vm.$u.post(uCenterApiUrl + 'v1/tokens', params)
await vm.$u.get(apiUrl + '/rest/file/token/get', params)
const commonApi = {
loginWechatAuth,
payOrder,
......
......@@ -46,7 +46,7 @@ function getPhoto(type, token) {
}
let sourceType = type == 1 ? ['album'] : ['album', 'camera']
uni.chooseImage({
count: 6, //默认9
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: sourceType, //从相册选择
success: function(res) {
......@@ -87,7 +87,7 @@ function upload(filePath, token) {
},
complete: (res) => {
if (res.statusCode === 200) {
resolve(JSON.parse(res.data).key)
resolve(JSON.parse(res.data).key || JSON.parse(res.data).src)
} else {
reject(res.errMsg)
}
......
......@@ -6,10 +6,10 @@
:current="swiperCurrent"
@change="swiperChange"
circular
>
<swiper-item v-for="(item, index) in swiperList" :key="index">
>
<swiper-item v-for="(item, i) in swiperList" :key="i">
<view class="u-flex subject">
<view class="title" v-if="item.title"><text>{{ 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">
<answer-sheet
ref="answerSheet"
......@@ -70,7 +70,7 @@ export default {
// 值为0禁止切换动画
swiperDuration: {
type: String,
default: "250"
default: '250'
},
// 分页需要传此数据
total: {
......@@ -86,7 +86,7 @@ export default {
// 此值控制swiper的位置
swiperCurrent: 0,
// 当前swiper渲染的items
swiperList: [],
swiperList: [1, 2, 3],
}
},
watch: {
......@@ -216,7 +216,6 @@ export default {
swiperList[current] = currentItem
swiperList[this.getLastSwiperChangeIndex(current)] = this.getLastSwiperNeedItem(currentItem, list)
swiperList[this.getNextSwiperChangeIndex(current)] = this.getNextSwiperNeedItem(currentItem, list)
console.log("swiperList", swiperList)
return swiperList;
},
/**
......@@ -262,7 +261,7 @@ export default {
height: 100%;
display: flex;
flex-direction: column;
swiper-item {
.swiper-items {
overflow: auto;
}
.subject {
......@@ -280,7 +279,7 @@ export default {
font-weight: bold;
width: 100%;
text-align: left;
text {
.title-type {
background: #9EA5BB;
color: #fff;
padding: 8rpx 20rpx;
......
......@@ -235,7 +235,10 @@ export default {
}
.u-tr ::v-deep .u-td {
font-size: 22rpx !important;
height: 70rpx;
height: 80rpx;
}
.u-tr ::v-deep .u-td .u-td {
padding: 5rpx 0 !important;
}
}
</style>
......@@ -69,7 +69,7 @@
</view>
</view>
<view class="foot">
<text>证书机构:中华人民共和国应急管理部</text>
<text>证书机构:模考大师</text>
<text style="padding-top: 28rpx;">更新时间:{{ nowDate }}</text>
</view>
</view>
......@@ -98,7 +98,7 @@ export default {
return (Today.getFullYear() + '.' + (m.length > 1 ? m : '0' + m) + '.' + (d.length > 1 ? d : '0' + d))
},
headPhoto(){
return this.learnData.photo || process.uniEnv.qn_base_url + 'xueshitoubu@2x.png'
return this.learnData.photo || (process.uniEnv.qn_base_url + 'xitongtouxiang.png')
},
startDate() {
return this.learnData.startDate || ' '
......@@ -119,7 +119,7 @@ export default {
return this.learnData.subjectName || ' '
},
institutionName() {
return this.learnData.institutionName || ' '
return this.learnData.institutionName || '模考大师'
},
maxpoint() {
return this.learnData.maxPoint || 0
......
......@@ -40,7 +40,7 @@
</view>
</view>
<scroll-view scroll-y style="width:100%;">
<scroll-view scroll-y style="width: 702rpx;padding: 0 24rpx;">
<view class=" form">
<view class="item">
<text class="title">选择查询证书类型</text>
......@@ -79,7 +79,7 @@
<swiper-item @touchmove.stop.prevent="stopTouchMove">
<scroll-view
scroll-y
style="height:100%;width:100%;"
style="width: 702rpx;padding: 0 24rpx;"
@scrolltolower="onreachBottom"
scroll-y="true"
refresher-enabled="true"
......@@ -90,7 +90,7 @@
@refresherrestore="onRestore"
@refresherabort="onAbort"
>
<view class="list-view">
<view v-if="hasData" class="list-view">
<view class="item" v-for="(item, key) in countryCertList" :key="key" @tap="goDetail(item)">
<u-image :src="item.bgImage" width="100%" height="100%" class="bg-image"></u-image>
<view class="name">
......@@ -104,6 +104,17 @@
</view>
</view>
</view>
<view v-else class="list-view empty-value">
<u-image
width="374rpx"
height="322rpx"
:src="nothing"
style="margin-top: 100rpx;"
></u-image>
<text style="margin-top: 20rpx;font-size: 28rpx;color: #9EA5BB;"
>当前暂无证书内容</text
>
</view>
</scroll-view>
</swiper-item>
</swiper>
......@@ -127,6 +138,7 @@ export default {
learnCertList: [],
countryCertImage: process.uniEnv.qn_base_url + 'zhengshubeijing@2x.png',
learnCertImage: process.uniEnv.qn_base_url + 'xueshizhengmingbeijing@2x.png',
nothing: process.uniEnv.qn_base_url + 'zanwucuoti@3x.png',
isEmptyList: true,//学时证和国家证都为空显示空
value: '',
type: 'select',
......@@ -160,7 +172,17 @@ export default {
_freshing: false,
}
},
computed: {},
computed: {
hasData(){
if(this.countryCertList && this.countryCertList.length > 0){
return true
}else if(this.learnCertList && this.learnCertList.length > 0){
return true
}else{
return false
}
}
},
onLoad() {
this.checkType = '特种作业操作证查询'
},
......@@ -390,7 +412,7 @@ export default {
console.log('goto param', param)
if(param.type == 'learn'){
console.log('点击学时证,请求详情,组装参数再传过去')
// this.$u.api.getlearnCertDetail(param.id).then((res)=>{
this.$u.api.getlearnCertDetail(param.id).then((res)=>{
// let res = {
// photo: "https://thirdwx.qlogo.cn/mmopen/vi_32/c20Wk8HTurnNnKJMmnAnib9CUtqicwKKIMCvzViaBn0icNnpmeOQbSiaRklWCcfUOlW7oqj2o7u65d6F3ZwmZtLVZaw/132",//头像,
// name: "阿三哥",//名字,
......@@ -409,9 +431,9 @@ export default {
this.$u.route({
url: 'pages/cert/detailLearn',
})
// }).catch(err => {
// console.log(err)
// })
}).catch(err => {
console.log(err)
})
}else{
console.log('点击国家证,直接参数带过去', param)
getApp().globalData.certItemData = param
......@@ -463,8 +485,6 @@ export default {
case 1:
let lifeData = uni.getStorageSync('lifeData')
if(lifeData.vuex_token){
let token = lifeData.vuex_token;
this.$u.vuex('vuex_token', 'Bearer test')
this.getCountryCert()
this.getLearnCert()
}
......@@ -509,7 +529,7 @@ page {
.study {
height: 100vh;
background: none;
padding: 0rpx 24rpx;
/* padding: 0rpx 24rpx; */
}
.form {
display: flex;
......@@ -522,7 +542,7 @@ page {
height: 100%;
}
.tips-top {
width: 702rpx;
width: 100%;
height: 72rpx;
line-height: 72rpx;
font-size: 24rpx;
......@@ -580,7 +600,7 @@ page {
}
.list-view {
width: 100%;
margin-bottom: 500rpx;
/* margin-bottom: 500rpx; */
.item {
width: 100%;
height: 444rpx;
......@@ -612,4 +632,12 @@ page {
}
}
}
.empty-value{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 30rpx;
text-align: center;
}
</style>
......@@ -58,7 +58,7 @@
<u-image
slot="icon"
width="36rpx"
height="40rpx"
height="42rpx"
:src="questionIcon"
></u-image>
</u-cell-item>
......@@ -71,7 +71,7 @@
<u-image
slot="icon"
width="36rpx"
height="40rpx"
height="36rpx"
:src="serviceIcon"
></u-image>
</u-cell-item>
......@@ -84,7 +84,7 @@
<u-image
slot="icon"
width="36rpx"
height="40rpx"
height="34rpx"
:src="settingIcon"
></u-image>
</u-cell-item>
......
......@@ -36,7 +36,6 @@
<view class="swiper">
<swiper-limited-load
ref="swiper"
:swiperHeight="500"
:swiperDuration="swiperDuration"
:list="list"
:current="current"
......@@ -179,7 +178,7 @@ export default {
current: 0,
// 仅仅记录swiper的位置
currentIndex: 0,
swiperDuration: '0',
swiperDuration: '1000',
// 分页数据
currentPage: 1,
pageSize: 100,
......@@ -197,9 +196,9 @@ export default {
computed: {
defaultImg() {
let name = ''
if (this.type === 4) {
if (this.source === 5) {
name = 'no-error.png'
} else if (this.type === 5) {
} else if (this.source === 4) {
name = 'no-collect.png'
}
return process.uniEnv.qn_base_url + name
......@@ -283,20 +282,22 @@ export default {
// 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据
let total = parseInt(res) || 0
// 考试
if (this.type === 2) {
this.pageSize = this.totalPoint
total = this.totalPoint
if (total > 0) {
// 考试
if (this.type === 2) {
this.pageSize = this.totalPoint
total = this.totalPoint
}
this.total = total
// 练习模式-初始化答题卡列表
if (this.source === 1) Utils.initAnswerCardList(total, this)
this.cachePageDataMap = new Map()
// 上次答到了第几题
let index = this.source === 1 ? (this.lastIndex[this.questionWarehouseId] || 0) : 0
this.refresh(index)
}
this.total = total
// 练习模式-初始化答题卡列表
if (this.source === 1) Utils.initAnswerCardList(total, this)
this.cachePageDataMap = new Map()
// 上次答到了第几题
let index = this.source === 1 ? (this.lastIndex[this.questionWarehouseId] || 0) : 0
this.refresh(index)
})
},
// 切换
......@@ -439,7 +440,7 @@ export default {
}
}
// 如果回答错误或者是考试模式,自动进入下一题
// 如果回答正确或者是考试模式,自动进入下一题
if ((status === 'pass' && this.model !== 2) || this.type === 2) {
if (this.currentIndex + 1 > this.total - 1) { // 最后一题回答后
if (this.type === 2) { // 统计分数,交卷
......@@ -448,9 +449,7 @@ export default {
}
return
}
this.$nextTick(() => {
this.current = this.currentIndex + 1
})
this.current = this.currentIndex + 1
}
},
// 保存答案
......@@ -524,10 +523,17 @@ export default {
},
// 每日一练弹框取消
dailyCancel() {
this.$u.route({
type: 'redirect',
url: '/pages/learn/record',
})
if (this.experience) {
this.$u.route({
type: 'tab',
url: '/pages/index/index',
})
} else {
this.$u.route({
type: 'redirect',
url: '/pages/learn/record',
})
}
},
// 收藏
collection() {
......@@ -536,6 +542,11 @@ export default {
const action = status ? 'removeCollection' : 'joinCollection'
this.$u.api[action]({questionId: info.id}).then(res => {
if(res) {
const msg = status ? '取消收藏成功' : '收藏成功'
this.$u.toast(msg)
if (status && this.source === 4) {
this.current = this.currentIndex + 1
}
info.collectionFlag = !status
if (this.source === 1) { //更新缓存数据
this.questionList[this.questionWarehouseId][this.currentIndex] = info
......
......@@ -32,6 +32,7 @@
binderror=""
bindload=""
@click="getBack"
style="margin-top: 30rpx"
/>
</view>
</view>
......
......@@ -29,12 +29,21 @@ export default {
return {
student: {
workUnit: '',
isNotSet: null,
},
}
},
computed: {},
onLoad() {
this.student = getApp().globalData.student
if (this.student.workUnit == '' || !this.student.workUnit) {
this.isNotSet = true
}
},
onUnload() {
if (this.isNotSet) {
this.student.workUnit = ''
}
},
methods: {
submit() {
......@@ -47,6 +56,7 @@ export default {
workUnit: this.student.workUnit,
})
.then((res) => {
this.isNotSet = false
this.$u.toast('保存成功')
setTimeout(() => {
this.$u.route({
......
......@@ -24,7 +24,12 @@
></u-image>
</view>
</u-cell-item>
<u-cell-item title="证件照" @click="changeCertPhoto">
<u-cell-item
title="证件照"
@click="changeCertPhoto"
:arrow="false"
:hover-class="none"
>
<view slot="right-icon">
<u-image
v-if="isupLoadCertPhoto"
......@@ -32,7 +37,7 @@
height="120rpx"
:src="headCertPhoto"
></u-image>
<text v-else style="color:blue;">未上传</text>
<text v-else style="color:#2953FF">去上传</text>
</view>
</u-cell-item>
<u-cell-item title="手机号" :arrow="false" :hover-class="none">
......@@ -43,7 +48,8 @@
open-type="getPhoneNumber"
@getphonenumber="getPhonenumber"
>
{{ getMobile }}
<text v-if="getMobile">{{ getMobile }}</text>
<text v-else class="empty-value">去绑定</text>
</button>
</view>
</u-cell-item>
......@@ -51,12 +57,18 @@
title="实名认证"
title-style="{'font':'bold','font-size':'40rpx'}"
:value="getCertifyStatus"
:value-style="{
color: getCertifyStatus == '去认证' ? '#2953FF' : '#191C27',
}"
@click="goCertify"
>
</u-cell-item>
<u-cell-item
title="工作单位"
:value="getCompany"
:value-style="{
color: getCompany == '去填写' ? '#2953FF' : '#191C27',
}"
@click="goCompany"
></u-cell-item>
</u-cell-group>
......@@ -91,29 +103,32 @@ export default {
return (this.student && this.student.identityNumber) || false
},
getMobile() {
return (this.student && this.student.phoneNumber) || ''
return (
(this.student &&
this.student.phoneNumber &&
this.student.phoneNumber.length > 5 &&
this.student.phoneNumber) ||
false
)
},
getCompany() {
return (this.student && this.student.workUnit) || ''
return (this.student && this.student.workUnit) || '去填写'
},
getCertifyStatus() {
return this.student && !this.student.isCertify ? '去认证' : '已认证'
return this.student && this.student.isCertify ? '已认证' : '去认证'
},
},
onLoad() {
this.$u.api.getQiNiuToken({ type: 'image' }).catch((data) => {
if (data.errMsg == 'request:ok') {
this.$u.api
.getQiNiuToken({ bucketName: 'banshou-userprofile' })
.then((res) => {
this.token = data.data.token //token为七牛云的token一般由后台接口提供
getApp().globalData.qiNiuToken = data.data.token
} else {
this.$u.toast('获取token失败')
}
})
})
this.$u.api.getUserInfo().then((res) => {
if (res && res.identityNumber) {
res.isCertify = true
this.student.isCertify = true
}
this.student = res
})
},
......@@ -268,8 +283,11 @@ page {
.mobile-button {
width: 115px;
height: 55rpx;
background: none;
font-size: 28rpx;
text-align: right;
padding-right: 0;
}
button::after {
border: none;
......@@ -290,7 +308,7 @@ button::after {
border-top-width: 0;
}
.content ::v-deep .u-cell__value {
color: #191c27;
.empty-value {
color: #2953ff;
}
</style>
......@@ -5,6 +5,7 @@
title="版本更新"
value="当前版本v1.1.0"
:border-bottom="false"
@tap="upgrade"
></u-cell-item>
</u-cell-group>
<view class="logout" @tap="logout">退出登录</view>
......@@ -19,6 +20,27 @@ export default {
computed: {},
onLoad() {},
methods: {
upgrade: function() {
wx.showToast({
title: '正在更新版本...',
icon: 'loading',
})
const um = wx.getUpdateManager()
um.onCheckForUpdate(function(res) {
if (res.hasUpdate) {
um.onUpdateReady(function() {
um.applyUpdate()
wx.showToast({
title: '更新完成',
})
})
} else {
wx.showToast({
title: '已是最新版本',
})
}
})
},
logout() {
this.$u.vuex('vuex_token', '')
this.$u.vuex('openId', '')
......
......@@ -200,7 +200,11 @@ export default {
collection(item) {
const action = item.collectionFlag ? 'removeCollection' : 'joinCollection'
this.$u.api[action]({questionId: item.id}).then(res => {
if(res) item.collectionFlag = !item.collectionFlag
if(res) {
const msg = item.collectionFlag ? '取消收藏成功' : '收藏成功'
this.$u.toast(msg)
item.collectionFlag = !item.collectionFlag
}
})
},
arrowUp(index) {
......
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