Commit a2db2129 authored by 林文清's avatar 林文清

fix:学习考试模块 各种页面跳转返回错误

parent 822f205a
......@@ -153,7 +153,7 @@ var json = {
{
title: "服务规范",
desc: "为用户提供更好服务,自己赚更多钱",
pic: process.uniEnv.qn_base_url + "fwgf-3x.png",
pic: process.uniEnv.qn_base_url + "fwgf-3x-v2.png",
percent: 0,
status: "",
id: 173,
......@@ -162,7 +162,7 @@ var json = {
{
title: "接单规范",
desc: "快速学习,使用APP 接单、抢单",
pic: process.uniEnv.qn_base_url + "jdgf-3x.png",
pic: process.uniEnv.qn_base_url + "jdgf-3x-v2.png",
percent: 0,
status: "",
id: 173,
......@@ -171,7 +171,7 @@ var json = {
{
title: "从0-1学习充电桩安装服务",
desc: "让你全面了解充电桩市场及服务规范",
pic: process.uniEnv.qn_base_url + "cdz-3x.png",
pic: process.uniEnv.qn_base_url + "cdz-3x-v2.png",
percent: 0,
status: "",
id: 173,
......@@ -182,7 +182,7 @@ var json = {
{
title: "服务规范",
desc: "为用户提供更好服务,自己赚更多钱",
pic: process.uniEnv.qn_base_url + "fwgf-3x.png",
pic: process.uniEnv.qn_base_url + "fwgf-3x-v2.png",
percent: 0,
status: "",
id: 150,
......@@ -191,7 +191,7 @@ var json = {
{
title: "接单规范",
desc: "快速学习,使用APP 接单、抢单",
pic: process.uniEnv.qn_base_url + "jdgf-3x.png",
pic: process.uniEnv.qn_base_url + "jdgf-3x-v2.png",
percent: 0,
status: "",
id: 149,
......@@ -200,7 +200,7 @@ var json = {
{
title: "从0-1学习充电桩安装服务",
desc: "让你全面了解充电桩市场及服务规范",
pic: process.uniEnv.qn_base_url + "cdz-3x.png",
pic: process.uniEnv.qn_base_url + "cdz-3x-v2.png",
percent: 0,
status: "",
id: 151,
......@@ -211,7 +211,7 @@ var json = {
{
title: "服务规范",
desc: "为用户提供更好服务,自己赚更多钱",
pic: process.uniEnv.qn_base_url + "fwgf-3x.png",
pic: process.uniEnv.qn_base_url + "fwgf-3x-v2.png",
percent: 0,
status: "",
sectionId: "",
......@@ -219,7 +219,7 @@ var json = {
{
title: "接单规范",
desc: "快速学习,使用APP 接单、抢单",
pic: process.uniEnv.qn_base_url + "jdgf-3x.png",
pic: process.uniEnv.qn_base_url + "jdgf-3x-v2.png",
percent: 0,
status: "",
sectionId: "",
......@@ -227,7 +227,7 @@ var json = {
{
title: "从0-1学习充电桩安装服务",
desc: "让你全面了解充电桩市场及服务规范",
pic: process.uniEnv.qn_base_url + "cdz-3x.png",
pic: process.uniEnv.qn_base_url + "cdz-3x-v2.png",
percent: 0,
status: "",
sectionId: "",
......@@ -242,7 +242,7 @@ var examJson = {
desc: "通过本认证,是接单的必要条件",
condition: "随机20题,及格20题",
status: "",
pic: process.uniEnv.qn_base_url + "fwgf-3x.png",
pic: process.uniEnv.qn_base_url + "fwgf-e-3x.png",
id: 2,
examId: "",
examStatus: "",
......@@ -425,6 +425,12 @@ export default {
},
},
onShow: function (param) {
try {
if (param.tabs) {
this.current = param.tabs;
this.swiperCurrent = param.tabs;
}
} catch (e) {}
if (this.current == 2 || this.current == 3) {
this.tabsChange(this.current);
}
......@@ -588,8 +594,8 @@ export default {
},
//tabs通知swiper切换
tabsChange(index) {
this.swiperCurrent = index;
switch (index) {
this.swiperCurrent = Number(index);
switch (this.swiperCurrent) {
case 1:
this.loadNews();
break;
......@@ -705,25 +711,24 @@ export default {
var examInfo = this.examList[index];
if (examInfo.examStatus == 0) {
wx.navigateTo({
// url: "/pages/learn/answer?examId=" + examInfo.id,
url: "/pages/learn/assessment?examId=" + examInfo.id,
});
} else if (examInfo.examStatus == 1) {
let url = '';
if (examInfo.status == "已通过") {
wx.navigateTo({
url:
"/pages/learn/exam-pass?userExamId=" +
examInfo.examId,
});
url = "/pages/learn/exam-pass?userExamId=" +
examInfo.examId +
"&examId=" +
examInfo.id;
} else {
wx.navigateTo({
url:
"/pages/learn/result?userExamId=" +
url = "/pages/learn/result?userExamId=" +
examInfo.examId +
"&examId=" +
examInfo.id,
});
examInfo.id
}
wx.navigateTo({
url: url,
});
} else if (examInfo.examStatus == 2) {
wx.navigateTo({
url: "/pages/learn/assessment?examId=" + examInfo.id,
......
......@@ -136,25 +136,22 @@ export default {
toSubmit() {
//判断是否通过,通过去成功页,失败去失败页
let examInfo = this.examInfo;
let examId = this.examId;
let status = examInfo.examLevelResult == "已通过";
let url = '';
if (status) {
wx.navigateTo({
url:
"/pages/learn/exam-pass?userExamId=" +
url = "/pages/learn/exam-pass?userExamId=" +
this.userExamId +
"&examId=" +
examId,
});
this.examId;
} else {
wx.navigateTo({
url:
"/pages/learn/result?userExamId=" +
url = "/pages/learn/result?userExamId=" +
this.userExamId +
"&examId=" +
examId,
});
this.examId
}
wx.redirectTo({
url: url,
});
},
contentFilter(txt) {
if (!txt) {
......@@ -172,7 +169,12 @@ export default {
this.getUserExamInfo();
},
gotoLogin() {
uni.navigateTo({
url: "/pages/login/wxlogin",
});
return;
},
//获取考试信息
getUserExamInfo: function () {
uni.showLoading({
......@@ -201,10 +203,12 @@ export default {
return;
}
if (res.data.code == 401 || res.data.code == 403) {
uni.navigateTo({
url: "/pages/login/wxlogin",
//提示 提交结果失败 请再次提交
uni.showToast({
icon: "none",
title: "获取考试结果失败,请再次尝试提交",
});
return;
return
}
if (res.data.code == 200) {
//examStatus 用户考试状态 0考试中 1考试完成 2未参与
......@@ -264,10 +268,8 @@ export default {
success: (res) => {
uni.hideLoading();
if (res.statusCode == 401) {
uni.navigateTo({
url: "/pages/login/wxlogin",
});
return;
this.gotoLogin();
return
}
if (res.data.code == 200) {
......@@ -347,11 +349,16 @@ export default {
success: (res) => {
uni.hideLoading();
if (res.statusCode == 401) {
uni.navigateTo({
url: "/pages/login/wxlogin",
});
this.gotoLogin()
return;
}
if(res.statusCode == 403){
uni.showToast({
icon: "none",
title: "获取考试结果失败,请再次尝试提交",
});
return
}
if (res.data.code == 200) {
that.currentItem = res.data.data;
console.log(that.currentItem);
......@@ -496,55 +503,6 @@ export default {
this.handleAnswer();
//this.getNext()
},
//上传考试结果
postResult: function () {
uni.showLoading({
title: "请稍候",
});
let that = this;
uni.request({
url:
ucenterApiUrl +
"/v1/settled/update-settled-exam-score" +
"?access-token=" +
that.vuex_token,
method: "POST",
data: {
score: this.examScore || 0,
},
success: (res) => {
uni.hideLoading();
if (res.statusCode == 401) {
uni.navigateTo({
url: "/pages/login/wxlogin",
});
return;
}
if (res.statusCode == 200) {
// uni.navigateTo({
// url: '/pages/settle/prompt'
// })
} else {
uni.showToast({
icon: "none",
title: "上传考试结果失败",
});
}
},
fail: (e) => {
uni.hideLoading();
uni.showToast({
icon: "none",
title: "上传考试结果失败",
});
},
});
},
//所选答案
handleAnswer: function () {
/*
......
......@@ -31,7 +31,7 @@ export default {
data() {
return {
text: "",
examId: 2,
examId: null,
result: null,
is_pass: false,
score: 0,
......@@ -39,54 +39,44 @@ export default {
};
},
onLoad(a) {
this.examId = a.examId;
this.userExamId = a.userExamId;
console.log("userExamId是", this.userExamId);
this.nextClick();
this.getCourseResult();
},
onUnload() {
this.toIndex()
},
// onUnload() {
// wx.reLaunch({
// url: "./index",
// });
// },
methods: {
//考试结果
nextClick: function () {
console.log("wwwwwwwwww");
uni.request({
url:
process.uniEnv.systemUrl.apiUrl +
"/wxh-worker-rest/rest/exam" +
"/serviceRule/next/" +
this.vuex_token +
"?userExamId=" +
this.userExamId,
method: "POST",
header: {
"Content-Type": "application/x-www-form-urlencoded",
},
success: (res) => {
this.result = res.data.data;
this.text = res.data.data.examLevelResult;
getCourseResult: function () {
this.$u.api
.getExamResult(this.examId)
.then((res) => {
if (res.code != 200) {
console.log("getUserExamInfo 200 err");
uni.showToast({
icon: "none",
title: "获取考试结果失败",
});
}
this.result = res.data;
this.text = res.data.examLevelResult;
this.score = this.result.examScore;
this.is_pass = this.result.result == '通过';
console.log("标识符55", this.result);
},
});
},
//再次考试
getAgain: function () {
wx.navigateTo({
url: "/pages/learn/assessment",
});
})
.catch((err) => {
console.log("getUserExamInfo err" + err);
uni.hideLoading();
uni.showToast({
icon: "none",
title: "获取考试信息失败",
});
});
},
//下次再考跳转到学习主界面页面
toIndex: function () {
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
let length = routes.length
uni.navigateBack({
delta: length - 1
uni.switchTab({
url: '/pages/index/learn'
});
},
},
......
......@@ -46,52 +46,50 @@ export default {
this.userExamId = a.userExamId;
this.examId = a.examId;
console.log("userExamId是", this.userExamId);
this.nextClick();
this.getCourseResult();
},
onUnload() {
this.toIndex()
},
// onUnload() {
// wx.reLaunch({
// url: "./index",
// });
// },
methods: {
//考试结果
nextClick: function () {
console.log("wwwwwwwwww");
uni.request({
url:
process.uniEnv.systemUrl.apiUrl +
"/wxh-worker-rest/rest/exam" +
"/serviceRule/next/" +
this.vuex_token +
"?userExamId=" +
this.userExamId,
method: "POST",
header: {
"Content-Type": "application/x-www-form-urlencoded",
},
success: (res) => {
this.result = res.data.data;
this.text = res.data.data.examLevelResult;
getCourseResult: function () {
this.$u.api
.getExamResult(this.examId)
.then((res) => {
if (res.code != 200) {
console.log("getUserExamInfo 200 err");
uni.showToast({
icon: "none",
title: "获取考试结果失败",
});
}
this.result = res.data;
this.text = res.data.examLevelResult;
this.score = this.result.examScore;
console.log("标识符55", this.result);
},
});
})
.catch((err) => {
console.log("getUserExamInfo err" + err);
uni.hideLoading();
uni.showToast({
icon: "none",
title: "获取考试信息失败",
});
});
},
//再次考试
getAgain: function () {
let examId = this.examId;
wx.navigateTo({
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
console.log(routes.length);
uni.navigateTo({
url: "/pages/learn/assessment?examId=" + examId,
});
},
//下次再考跳转到学习主界面页面
toIndex: function () {
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
let length = routes.length
uni.navigateBack({
delta: length - 1
uni.switchTab({
url: '/pages/index/learn'
});
},
},
......
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