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