Commit 03cdef0b authored by Damon's avatar Damon
parents 534d6fe9 8d78ae70
const globalUrl = process.uniEnv || {} const globalUrl = process.uniEnv || {}
const ucenterApiUrl = globalUrl.ucenterUrl.apiUrl const ucenterApiUrl = globalUrl.ucenterUrl.apiUrl
const collegeApiUrl = globalUrl.ucenterUrl.xueUrl const collegeApiUrl = globalUrl.ucenterUrl.xueUrl
const sysApiUrl = globalUrl.systemUrl.apiUrl
let learnApiFun = function(vm){ let learnApiFun = function(vm){
/* 通知消息基本信息 */ /* 通知消息基本信息 */
...@@ -14,8 +15,11 @@ let learnApiFun = function(vm){ ...@@ -14,8 +15,11 @@ let learnApiFun = function(vm){
let CourseSection = async (params = {}) => await vm.$u.get(collegeApiUrl+'/v1/section-details',params); let CourseSection = async (params = {}) => await vm.$u.get(collegeApiUrl+'/v1/section-details',params);
/* 更新学习情况*/ /* 更新学习情况*/
let updateLearnCourses = async (params = {}) => await vm.$u.post(collegeApiUrl+'/v1/update-learn-courses',params); let updateLearnCourses = async (params = {}) => await vm.$u.post(collegeApiUrl+'/v1/update-learn-courses',params);
/* 获取考试结果 */
let getExamResult = async (examId, params = {}) => await vm.$u.post(sysApiUrl + '/wxh-worker-rest/rest/exam/serviceRule/userExamInfo/' + vm.vuex_token + '?examId=' + examId, params);
const learnApi = { const learnApi = {
getTrainingNoticeList,CourseList,ChapterDetails,CourseSection,updateLearnCourses getTrainingNoticeList,CourseList,ChapterDetails,CourseSection,updateLearnCourses,getExamResult
} }
return learnApi return learnApi
} }
......
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
<view class="bottom-view"> <view class="bottom-view">
<view> <view>
<view v-if="showCountTime" class="bottom-left-view"> <view v-if="showCountTime" class="bottom-left-view">
<view :class="['bottom-tag-view', {'will': orderData.currentWillOverTime}]">{{tagText}}</view> <view :class="['bottom-tag-view', {'timeout': timeout}]"><text>{{tagText}}</text></view>
<u-count-down :timestamp="orderData.currentWillOverTime || orderData.currentOverTime" font-size="44" <u-count-down :timestamp="timestamp" font-size="44"
color="#FF930D" @change="handleChange" ref="order-count-down"></u-count-down> :color="timeout ? '#FA5A49' : '#FF930D'" @change="handleChange" ref="order-count-down"></u-count-down>
</view> </view>
<view v-else-if="showTime"> <view v-else-if="showTime">
<text>{{timeTitle}}</text> <text>{{timeTitle}}</text>
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
orderStatus: 0, // 工单状态 orderStatus: 0, // 工单状态
appointmentDatetime: '', // 预约时间 appointmentDatetime: '', // 预约时间
currentWillOverTime: 10000, // 剩余时间 currentWillOverTime: 10000, // 剩余时间
currentOverTime: 0, // 超过时间 currentOverTime: new Date().getTime() + 10000, // 超过时间点
auditDatetime: '2021.04.19 12:45:09', // 审核时间 auditDatetime: '2021.04.19 12:45:09', // 审核时间
submissionTime: '2021.04.19 16:24:48', // 提交时间 submissionTime: '2021.04.19 16:24:48', // 提交时间
auditResults: {}, // 审核结果 auditResults: {}, // 审核结果
...@@ -97,7 +97,8 @@ ...@@ -97,7 +97,8 @@
}, },
data() { data() {
return { return {
timeout: false,
timestamp: 0,
}; };
}, },
computed: { computed: {
...@@ -204,7 +205,7 @@ ...@@ -204,7 +205,7 @@
return this.orderData.orderServiceType == '安装' return this.orderData.orderServiceType == '安装'
}, },
tagText() { tagText() {
return this.orderData.currentWillOverTime ? '剩' : '超' return this.timeout ? '超' : '剩'
}, },
timeText() { timeText() {
return this.orderType == 4 ? this.orderData.submissionTime : this.orderData.auditDatetime return this.orderType == 4 ? this.orderData.submissionTime : this.orderData.auditDatetime
...@@ -233,6 +234,10 @@ ...@@ -233,6 +234,10 @@
return this.types[this.type] return this.types[this.type]
} }
}, },
created() {
this.timeout = this.orderData.currentOverTime < new Date().getTime()
this.timestamp = Math.round(Math.abs(this.orderData.currentOverTime - new Date().getTime()) / 1000)
},
methods: { methods: {
handleClick() { handleClick() {
if (this.buttonDisabled) return if (this.buttonDisabled) return
...@@ -242,7 +247,14 @@ ...@@ -242,7 +247,14 @@
this.$emit('click') this.$emit('click')
}, },
handleChange(timestamp) { handleChange(timestamp) {
if (this.orderData.currentOverTime) this.$refs['order-count-down'].seconds += 2 console.log(timestamp)
if (this.timeout) this.$refs['order-count-down'].seconds += 2
if (timestamp == 0 && !this.timeout) {
setTimeout(()=> {
this.timestamp = 1
this.timeout = true
}, 1000)
}
}, },
getDistance(Latitud, Longitud) { getDistance(Latitud, Longitud) {
return this.distance(Latitud, Longitud, this.location[0], this.location[1]) return this.distance(Latitud, Longitud, this.location[0], this.location[1])
...@@ -389,18 +401,19 @@ ...@@ -389,18 +401,19 @@
align-items: center; align-items: center;
.bottom-tag-view { .bottom-tag-view {
text-align: center;
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
border-radius: 26rpx; border-radius: 26rpx;
line-height: 56rpx;
color: #FFFFFF; color: #FFFFFF;
font-size: 26rpx; font-size: 26rpx;
background-color: #FA5A49; background-color: #FF930D;
margin-right: 20rpx; margin-right: 20rpx;
display: flex;
justify-content: center;
align-items: center;
&.will { &.timeout {
background-color: #FF930D; background-color: #FA5A49;
} }
} }
} }
......
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
《{{item.title}}》 《{{item.title}}》
</view> </view>
<view class="news" v-html="item.body"> <view class="news" v-html="item.body">
{{item.body}} <u-parse :html="item.body"></u-parse>
</view> </view>
<u-line color="#F4F5F7" class="content-line"/>
</view> </view>
<view v-shou="isLoadMore"> <view v-shou="isLoadMore">
<u-loadmore :status="loadStatus" /> <u-loadmore :status="loadStatus" />
...@@ -110,51 +111,58 @@ ...@@ -110,51 +111,58 @@
<view class="top"> <view class="top">
<view class="title u-margin-top-10 u-margin-bottom-30">通用认证</view> <view class="title u-margin-top-10 u-margin-bottom-30">通用认证</view>
<view class="currency-class"> <view class="currency-class">
<view class="class1" @click="aaa"> <view class="class1" @click="aaa(0)">
<image class="img" src="../../static/logo.png" mode=""></image> <image class="img" :src="examList[0].pic" mode=""></image>
<view class="right"> <view class="right">
<view class="u-font-32 font-bold"> <view class="u-font-32 font-bold">
服务规范 {{ examList[0].title }}
</view> </view>
<view class="u-font-24"> <view class="u-font-24">
通过本认证,是接单的前提条件 {{ examList[0].desc }}
</view> </view>
<view class="" style="display:flex;justify-content: space-between;"> <view class="u-font-24" style="display:flex;justify-content: space-between;">
<text style="color: #a69999;">随机20题,及格20题</text> <text class="font-color-999999">{{ examList[0].condition }}</text>
<text>通过</text> <text class="font-default-exam-color"
:class="{'font-active-color':examList[0].isComplete}">
{{ examList[0].status }}
</text>
</view> </view>
</view> </view>
</view> </view>
<view class="class1 u-margin-top-40" @click="aaa"> <view class="class1 u-margin-top-40" @click="aaa(1)">
<image class="img" src="../../static/logo.png" mode=""></image> <image class="img" :src="examList[1].pic" mode=""></image>
<view class="right"> <view class="right">
<view class="u-font-32 font-bold"> <view class="u-font-32 font-bold">
接单操作 {{examList[1].title}}
</view> </view>
<view class="u-font-24"> <view class="u-font-24">
快速认证,是否具备接单操作能力 {{ examList[1].desc }}
</view> </view>
<view class="" style="display:flex;justify-content: space-between;"> <view class="u-font-24" style="display:flex;justify-content: space-between;">
<text style="color: #a69999">随机20题,及格16题</text> <text class="font-color-999999">{{ examList[1].condition }}</text>
<text>未通过</text> <text class="font-default-exam-color"
:class="{'font-active-color':examList[1].isComplete}">
{{ examList[1].status }}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="title u-margin-top-50 u-margin-bottom-30">技能认证</view> <view class="title u-margin-top-50 u-margin-bottom-30">技能认证</view>
<view class="currency-class"> <view class="currency-class">
<view class="class1" @click="aaa"> <view class="class1" @click="aaa(2)">
<image class="img" src="../../static/logo.png" mode=""></image> <image class="img" :src="examList[2].pic" mode=""></image>
<view class="right"> <view class="right">
<view class="u-font-32 font-bold"> <view class="u-font-32 font-bold">
从0-1学习充电桩安装服务 {{ examList[2].title }}
</view> </view>
<view class="u-font-24"> <view class="u-font-24">
通过本认证后,可接充电桩业务单 {{ examList[2].desc }}
</view> </view>
<view class="" style="display:flex;justify-content: space-between;"> <view class="u-font-24" style="display:flex;justify-content: space-between;">
<text style="color: #a69999;">随机30题,及格25题</text> <text class="font-color-999999">{{ examList[2].condition }}</text>
<text>未通过</text> <text class="font-default-exam-color"
:class="{'font-active-color':examList[2].isComplete}">
{{ examList[2].status }}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -216,6 +224,40 @@ ...@@ -216,6 +224,40 @@
id: 173 id: 173
} }
], ],
examList: [{
title: '服务规范',
desc: '通过本认证,是接单的必要条件',
condition: '随机20题,及格20题',
status: '',
pic: process.uniEnv.qn_base_url + "guifan1@3x.png",
id: 2,
examId: '',
examStatus: '',
isComplete: false
},
{
title: '接单操作',
desc: '快速认证,是否具备接单操作能力',
condition: '随机20题,及格16题',
status: '',
pic: process.uniEnv.qn_base_url + "guifan2@3x.png",
id: 2,
examId: '',
examStatus: '',
isComplete: false
},
{
title: '从0-1学习充电桩安装服务',
desc: '通过本认证后,可接充电桩业务单',
condition: '随机30题,及格25题',
status: '',
pic: process.uniEnv.qn_base_url + "kecehng1@3x.png",
id: 2,
examId: '',
examStatus: '',
isComplete: false
}
],
loadStatus: "loading", //加载样式:loadMore-加载前样式,loading-加载加载中样式,nomore-没有数据样式 loadStatus: "loading", //加载样式:loadMore-加载前样式,loading-加载加载中样式,nomore-没有数据样式
isLoadMore: false, //是否加载中 isLoadMore: false, //是否加载中
course_id: "course_id_=173", course_id: "course_id_=173",
...@@ -339,19 +381,19 @@ ...@@ -339,19 +381,19 @@
this.current = current; this.current = current;
}, },
//跳转到assessment页面 //跳转到assessment页面
aaa() { aaa(index) {
var id = this.exam.id; var examInfo = this.examList[index];
if (this.exam.examStatus == 0) { if (examInfo.examStatus == 0) {
console.log("这是个标识符", this.exam.id); console.log("这是申请的考试id", examInfo.examId);
wx.navigateTo({ wx.navigateTo({
url: "./answer?userExamId=" + id, url: "./answer?userExamId=" + examInfo.examId,
}); });
} else if (this.exam.examStatus == 1) { } else if (examInfo.examStatus == 1) {
wx.navigateTo({ wx.navigateTo({
url: "./result?userExamId=" + id, url: "./result?userExamId=" + examInfo.examId,
}); });
} else if (this.exam.examStatus == 2) { } else if (examInfo.examStatus == 2) {
wx.navigateTo({ wx.navigateTo({
url: "./assessment", url: "./assessment",
}); });
...@@ -415,69 +457,56 @@ ...@@ -415,69 +457,56 @@
}); });
let that = this; let that = this;
let token = uni.getStorageSync('lifeData').vuex_token; let token = that.vuex_token;
uni.request({ let length = this.examList.length;
url: "http://192.168.1.22" + for (let i = 0; i < length; i++) {
"/wxh-worker-rest/rest/exam" + let examId = this.examList[i].id;
"/serviceRule/userExamInfo/" + this.$u.api
token + .getExamResult(examId)
"?examId=" + .then((res) => {
2, if (res.code == 200) {
method: "POST", this.examList[i].examId = res.data.id;
data: { let examResult = res.data.examLevelResult;
//examId:this.examId, this.examList[i].status = examResult != '' ? examResult : '未通过';
}, // examStatus 用户考试状态 0考试中 1考试完成 2未参与
header: { that.exam = res.data;
"Content-Type": "application/x-www-form-urlencoded",
},
success: (res) => {
console.log(res.data);
uni.hideLoading();
if (!res.data) {
return;
}
if (res.data.code == 401 || res.data.code == 403) {
// uni.navigateTo({
// url: '/pages/login/wxlogin'
// })
// return
console.log("洪塘张学友");
}
if (res.data.code == 200) {
//examStatus 用户考试状态 0考试中 1考试完成 2未参与
that.exam = res.data.data;
console.log(that.exam); console.log(that.exam);
if (res.data.data.examStatus == 2) { if (res.data.examStatus == 2) {
console.log("examStatus " + i + " 2");
that.applyExam(); that.applyExam();
return; return;
} }
if (res.data.data.examStatus == 1) { if (res.data.examStatus == 1) {
console.log("111111111111111111111111111"); console.log("examStatus " + i + " 1");
that.isComplete = true; that.examList[i].isComplete = true;
that.examScore = res.data.data.examScore; that.examScore = res.data.examScore;
that.postResult(); that.postResult();
return; return;
} }
if (res.data.data.examStatus == 0) { if (res.data.examStatus == 0) {
that.userExamId = res.data.data.id; console.log("examStatus " + i + " 0");
that.getNext(); that.userExamId = res.data.id;
// that.getNext();
} }
} else { } else {
console.log('getUserExamInfo 200 err');
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: res.data.message, title: '获取考试信息失败',
}); });
} }
}, })
fail: (e) => { .catch((err) => {
console.log('getUserExamInfo err' + err);
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: "获取考试信息失败", title: "获取考试信息失败",
}); });
},
}); });
},
}
}
}, },
}; };
</script> </script>
...@@ -513,19 +542,26 @@ ...@@ -513,19 +542,26 @@
/* //培训通知 */ /* //培训通知 */
.notice { .notice {
border: #808080 solid 2rpx; /* border: #808080 solid 2rpx; */
width: 100%; width: 100%;
height: 400rpx; height: 400rpx;
margin-top: 36rpx; margin-top: 36rpx;
overflow: hidden; overflow: hidden;
background-color: #ffffff;
border-radius: 12rpx;
} }
.n-head { .n-head {
text-align: center; text-align: left;
margin: 32rpx 0; /* margin: 30rpx 30rpx 0 30rpx;
*/ margin-left: 30rpx;
} }
.news {} .news {
height: 168rpx;
overflow: hidden;
/* margin: 30rpx 30rpx 0 30rpx; */
}
/* //在线学习 */ /* //在线学习 */
.currency-class { .currency-class {
...@@ -614,7 +650,19 @@ ...@@ -614,7 +650,19 @@
color: #999999; color: #999999;
} }
.font-default-exam-color {
color: #FA5A49;
}
.font-active-color { .font-active-color {
color: #2272FF; color: #2272FF;
} }
.font-color-999999 {
color: #99999;
}
.content-line {
margin-top: 30rpx;
}
</style> </style>
...@@ -420,7 +420,7 @@ ...@@ -420,7 +420,7 @@
margin-right:-24rpx; margin-right:-24rpx;
.txt-item{ .txt-item{
border-radius: 12rpx; border-radius: 12rpx;
padding:24rpx 38rpx; padding:24rpx 24rpx;
width: 196rpx; width: 196rpx;
height: 72rpx; height: 72rpx;
text-align: center; text-align: center;
......
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