Commit b3bd3150 authored by 刘用法's avatar 刘用法
parents fbe34a6b f842eb02
...@@ -413,7 +413,7 @@ ...@@ -413,7 +413,7 @@
} }
.popBtnView { .popBtnView {
margin-top: 110rpx; margin-top: 65rpx;
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
......
...@@ -52,7 +52,9 @@ ...@@ -52,7 +52,9 @@
dx: 0, dx: 0,
}; };
}, },
onLoad() {}, onLoad() {
this.$refs.tabs.setFinishCurrent(current);
},
computed: { computed: {
swiperList() { swiperList() {
let list = this.currentItem.images || [] let list = this.currentItem.images || []
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</cover-view> </cover-view>
<canvas canvas-id="canvas" id="photoCanvas" class="canvas" <canvas canvas-id="canvas" id="photoCanvas" class="canvas"
:style="{'width':750 + 'rpx','height': cameraHeight + 'rpx'}"></canvas> :style="{'width':750 + 'rpx','height': cameraHeight + 'rpx'}"></canvas>
<view v-show="standardShow" class="page-mask" :z-index="10000"> <view v-if="standardShow" class="page-mask" :z-index="10000">
<photo-standard :currentItem="currentItem" /> <photo-standard :currentItem="currentItem" />
<view class="btn-close"> <view class="btn-close">
<image @click="closeShadow" class="icon icon-close" mode="aspectFit" src="/static/photo/icon-close.png"></image> <image @click="closeShadow" class="icon icon-close" mode="aspectFit" src="/static/photo/icon-close.png"></image>
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
<text class="title-view">学习</text> <text class="title-view">学习</text>
</u-navbar> </u-navbar>
<image :src="bannerImage" mode="" class="banner"></image> <image :src="bannerImage" mode="" class="banner"></image>
<u-tabs-swiper bg-color="#F4F5F7" inactive-color="#999999" font-size="28" ref="uTabs" :list="tabs" <u-tabs-swiper bg-color="#F4F5F7" 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>
:current="current" @change="tabsChange" :is-scroll="false" :bar-width="52" swiperWidth="750"></u-tabs-swiper>
<swiper class="swiper_group" :current="swiperCurrent" @animationfinish="animationfinish"> <swiper class="swiper_group" :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item @touchmove.stop.prevent="stopTouchMove" v-show="current == 0"> <swiper-item @touchmove.stop.prevent="stopTouchMove" v-show="current == 0">
<scroll-view scroll-y style="height:100%;width:100%;"> <scroll-view scroll-y style="height:100%;width:100%;">
...@@ -23,10 +22,7 @@ ...@@ -23,10 +22,7 @@
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
<swiper-item @touchmove.stop.prevent="stopTouchMove" v-show="current == 1"> <swiper-item @touchmove.stop.prevent="stopTouchMove" v-show="current == 1">
<scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onReachBottom" <scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onReachBottom" scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100" @refresherpulling="onPulling" @refresherrefresh="onRefresh" @refresherrestore="onRestore" @refresherabort="onAbort">
scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered"
:refresher-threshold="100" @refresherpulling="onPulling" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" @refresherabort="onAbort">
<view v-for="item in list" :key="item.id" class="notice" @click="bbb(item)"> <view v-for="item in list" :key="item.id" class="notice" @click="bbb(item)">
<view class="n-head"> <view class="n-head">
{{item.title}} {{item.title}}
...@@ -61,11 +57,9 @@ ...@@ -61,11 +57,9 @@
</view> </view>
</view> </view>
<view class="line-percent u-margin-top-35"> <view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[0].percent" <u-line-progress active-color="#2979ff" :percent="courselist[0].percent" :show-percent="false">
:show-percent="false">
</u-line-progress> </u-line-progress>
<text class="font-default-color" :class="{'font-active-color':courselist[0].percent}" <text class="font-default-color" :class="{'font-active-color':courselist[0].percent}" v-text="courselist[0].status"></text>
v-text="courselist[0].status"></text>
</view> </view>
</view> </view>
<view class="learn-class1 u-margin-left-30" @click="goPlay(courselist[1])"> <view class="learn-class1 u-margin-left-30" @click="goPlay(courselist[1])">
...@@ -80,11 +74,9 @@ ...@@ -80,11 +74,9 @@
</view> </view>
</view> </view>
<view class="line-percent u-margin-top-35"> <view class="line-percent u-margin-top-35">
<u-line-progress active-color="#2979ff" :percent="courselist[1].percent" <u-line-progress active-color="#2979ff" :percent="courselist[1].percent" :show-percent="false">
:show-percent="false">
</u-line-progress> </u-line-progress>
<text class="font-default-color" :class="{'font-active-color':courselist[1].percent}" <text class="font-default-color" :class="{'font-active-color':courselist[1].percent}" v-text="courselist[1].status"></text>
v-text="courselist[1].status"></text>
</view> </view>
</view> </view>
</view> </view>
...@@ -101,13 +93,10 @@ ...@@ -101,13 +93,10 @@
{{ courselist[2].desc }} {{ courselist[2].desc }}
</view> </view>
</view> </view>
<view class="line-percent u-margin-top-35" <view class="line-percent u-margin-top-35" style="display:flex;justify-content: space-between;">
style="display:flex;justify-content: space-between;"> <u-line-progress active-color="#2979ff" :percent="courselist[2].percent" :show-percent="false">
<u-line-progress active-color="#2979ff" :percent="courselist[2].percent"
:show-percent="false">
</u-line-progress> </u-line-progress>
<text class="font-default-color" :class="{'font-active-color':courselist[2].percent}" <text class="font-default-color" :class="{'font-active-color':courselist[2].percent}" v-text="courselist[2].status"></text>
v-text="courselist[2].status"></text>
</view> </view>
</view> </view>
</view> </view>
...@@ -128,8 +117,7 @@ ...@@ -128,8 +117,7 @@
</view> </view>
<view class="u-font-24" style="display:flex;justify-content: space-between;"> <view class="u-font-24" style="display:flex;justify-content: space-between;">
<text class="font-color-999999">{{ examList[0].condition }}</text> <text class="font-color-999999">{{ examList[0].condition }}</text>
<text class="font-default-exam-color" <text class="font-default-exam-color" :class="{'font-active-color':examList[0].isComplete}">
:class="{'font-active-color':examList[0].isComplete}">
{{ examList[0].status }} {{ examList[0].status }}
</text> </text>
</view> </view>
...@@ -146,8 +134,7 @@ ...@@ -146,8 +134,7 @@
</view> </view>
<view class="u-font-24" style="display:flex;justify-content: space-between;"> <view class="u-font-24" style="display:flex;justify-content: space-between;">
<text class="font-color-999999">{{ examList[1].condition }}</text> <text class="font-color-999999">{{ examList[1].condition }}</text>
<text class="font-default-exam-color" <text class="font-default-exam-color" :class="{'font-active-color':examList[1].isComplete}">
:class="{'font-active-color':examList[1].isComplete}">
{{ examList[1].status }}</text> {{ examList[1].status }}</text>
</view> </view>
</view> </view>
...@@ -160,340 +147,421 @@ ...@@ -160,340 +147,421 @@
</template> </template>
<script> <script>
var json = { var json = {
"dev": [{ dev: [
"title": "服务规范", {
"desc": "为用户提供更好服务,自己赚更多钱", title: "服务规范",
"pic": process.uniEnv.qn_base_url + "fwgf-3x.png", desc: "为用户提供更好服务,自己赚更多钱",
"percent": 0, pic: process.uniEnv.qn_base_url + "fwgf-3x.png",
"status": "", percent: 0,
"id": 173, status: "",
"sectionId": "" id: 173,
}, sectionId: "",
{ },
"title": "接单规范", {
"desc": "快速学习,使用APP 接单、抢单", title: "接单规范",
"pic": process.uniEnv.qn_base_url + "jdgf-3x.png", desc: "快速学习,使用APP 接单、抢单",
"percent": 0, pic: process.uniEnv.qn_base_url + "jdgf-3x.png",
"status": "", percent: 0,
"id": 173, status: "",
"sectionId": "" id: 173,
}, sectionId: "",
{ },
"title": "从0-1学习充电桩安装服务", {
"desc": "让你全面了解充电桩市场及服务规范", title: "从0-1学习充电桩安装服务",
"pic": process.uniEnv.qn_base_url + "cdz-3x.png", desc: "让你全面了解充电桩市场及服务规范",
"percent": 0, pic: process.uniEnv.qn_base_url + "cdz-3x.png",
"status": "", percent: 0,
"id": 173, status: "",
"sectionId": "" id: 173,
} sectionId: "",
], },
"test": [{ ],
"title": "服务规范", test: [
"desc": "为用户提供更好服务,自己赚更多钱", {
"pic": process.uniEnv.qn_base_url + "fwgf-3x.png", title: "服务规范",
"percent": 0, desc: "为用户提供更好服务,自己赚更多钱",
"status": "", pic: process.uniEnv.qn_base_url + "fwgf-3x.png",
"id": 150, percent: 0,
"sectionId": "" status: "",
}, id: 150,
{ sectionId: "",
"title": "接单规范", },
"desc": "快速学习,使用APP 接单、抢单", {
"pic": process.uniEnv.qn_base_url + "jdgf-3x.png", title: "接单规范",
"percent": 0, desc: "快速学习,使用APP 接单、抢单",
"status": "", pic: process.uniEnv.qn_base_url + "jdgf-3x.png",
"id": 149, percent: 0,
"sectionId": "" status: "",
}, id: 149,
{ sectionId: "",
"title": "从0-1学习充电桩安装服务", },
"desc": "让你全面了解充电桩市场及服务规范", {
"pic": process.uniEnv.qn_base_url + "cdz-3x.png", title: "从0-1学习充电桩安装服务",
"percent": 0, desc: "让你全面了解充电桩市场及服务规范",
"status": "", pic: process.uniEnv.qn_base_url + "cdz-3x.png",
"id": 151, percent: 0,
"sectionId": "" status: "",
} id: 151,
], sectionId: "",
"prod": [{ },
"title": "服务规范", ],
"desc": "为用户提供更好服务,自己赚更多钱", prod: [
"pic": process.uniEnv.qn_base_url + "fwgf-3x.png", {
"percent": 0, title: "服务规范",
"status": "", desc: "为用户提供更好服务,自己赚更多钱",
"sectionId": "" pic: process.uniEnv.qn_base_url + "fwgf-3x.png",
}, percent: 0,
{ status: "",
"title": "接单规范", sectionId: "",
"desc": "快速学习,使用APP 接单、抢单", },
"pic": process.uniEnv.qn_base_url + "jdgf-3x.png", {
"percent": 0, title: "接单规范",
"status": "", desc: "快速学习,使用APP 接单、抢单",
"sectionId": "" pic: process.uniEnv.qn_base_url + "jdgf-3x.png",
}, percent: 0,
{ status: "",
"title": "从0-1学习充电桩安装服务", sectionId: "",
"desc": "让你全面了解充电桩市场及服务规范", },
"pic": process.uniEnv.qn_base_url + "cdz-3x.png", {
"percent": 0, title: "从0-1学习充电桩安装服务",
"status": "", desc: "让你全面了解充电桩市场及服务规范",
"sectionId": "" pic: process.uniEnv.qn_base_url + "cdz-3x.png",
} percent: 0,
] status: "",
} sectionId: "",
},
var examJson = { ],
"dev": [{ };
title: '服务规范',
desc: '通过本认证,是接单的必要条件', var examJson = {
condition: '随机20题,及格20题', dev: [
status: '', {
pic: process.uniEnv.qn_base_url + "fwgf-3x.png", title: "服务规范",
id: 2, desc: "通过本认证,是接单的必要条件",
examId: '', condition: "随机20题,及格20题",
examStatus: '', status: "",
isComplete: false pic: process.uniEnv.qn_base_url + "fwgf-3x.png",
}, id: 2,
{ examId: "",
title: '接单操作', examStatus: "",
desc: '快速认证,是否具备接单操作能力', isComplete: false,
condition: '随机20题,及格16题', },
status: '', {
pic: process.uniEnv.qn_base_url + "jdgf-e-3x.png", title: "接单操作",
id: 2, desc: "快速认证,是否具备接单操作能力",
examId: '', condition: "随机20题,及格16题",
examStatus: '', status: "",
isComplete: false pic: process.uniEnv.qn_base_url + "jdgf-e-3x.png",
} id: 2,
], examId: "",
"test": [{ examStatus: "",
title: '服务规范', isComplete: false,
desc: '通过本认证,是接单的必要条件', },
condition: '随机10题,及格10题', ],
status: '', test: [
pic: process.uniEnv.qn_base_url + "fwgf-e-3x.png", {
id: 3, title: "服务规范",
examId: '', desc: "通过本认证,是接单的必要条件",
examStatus: '', condition: "随机10题,及格10题",
isComplete: false status: "",
pic: process.uniEnv.qn_base_url + "fwgf-e-3x.png",
id: 3,
examId: "",
examStatus: "",
isComplete: false,
},
{
title: "交付规范",
desc: "快速认证,是否具备接单操作能力",
condition: "随机5题,及格5题",
status: "",
pic: process.uniEnv.qn_base_url + "jdgf-e-3x.png",
id: 4,
examId: "",
examStatus: "",
isComplete: false,
},
],
prod: [
{
title: "服务规范",
desc: "通过本认证,是接单的必要条件",
condition: "随机20题,及格20题",
status: "",
pic: process.uniEnv.qn_base_url + "fwgf-e-3x.png",
id: 3,
examId: "",
examStatus: "",
isComplete: false,
},
{
title: "接单操作",
desc: "快速认证,是否具备接单操作能力",
condition: "随机20题,及格16题",
status: "",
pic: process.uniEnv.qn_base_url + "jdgf-e-3x.png",
id: 4,
examId: "",
examStatus: "",
isComplete: false,
},
],
};
let env = process.uniEnv.node_env;
let courseListJson = json[env];
let examListJson = examJson[env];
export default {
data() {
return {
tabs: [
{
name: "交付规范",
},
{
name: "培训通知",
},
{
name: "在线学习",
},
{
name: "考核认证",
},
],
bofang: process.uniEnv.qn_base_url + "bofang@3x.png",
current: 0,
swiperCurrent: 0,
params: {
start: 0,
}, },
{ list: [],
title: '交付规范', rule: {
desc: '快速认证,是否具备接单操作能力', pic: process.uniEnv.qn_base_url + "guifan@3x.png",
condition: '随机4题,及格4题',
status: '',
pic: process.uniEnv.qn_base_url + "jdgf-e-3x.png",
id: 4,
examId: '',
examStatus: '',
isComplete: false
}
],
"prod": [{
title: '服务规范',
desc: '通过本认证,是接单的必要条件',
condition: '随机20题,及格20题',
status: '',
pic: process.uniEnv.qn_base_url + "fwgf-e-3x.png",
id: 3,
examId: '',
examStatus: '',
isComplete: false
}, },
{ courselist: [
title: '接单操作', {
desc: '快速认证,是否具备接单操作能力', title: courseListJson[0].title,
condition: '随机20题,及格16题', desc: courseListJson[0].desc,
status: '', percent: courseListJson[0].percent,
pic: process.uniEnv.qn_base_url + "jdgf-e-3x.png", status: courseListJson[0].status,
id: 4, pic: courseListJson[0].pic,
examId: '', id: courseListJson[0].id,
examStatus: '', sectionId: courseListJson[0].sectionId,
isComplete: false
}
]
}
let env = process.uniEnv.node_env;
let courseListJson = json.[env];
let examListJson = examJson[env];
export default {
data() {
return {
tabs: [{
name: "交付规范",
},
{
name: "培训通知",
},
{
name: "在线学习",
},
{
name: "考核认证",
},
],
bofang: process.uniEnv.qn_base_url + "bofang@3x.png",
current: 0,
swiperCurrent: 0,
params: {
start: 0,
}, },
list: [], {
rule: { title: courseListJson[1].title,
pic: process.uniEnv.qn_base_url + "guifan@3x.png" desc: courseListJson[1].desc,
percent: courseListJson[1].percent,
status: courseListJson[1].status,
pic: courseListJson[1].pic,
id: courseListJson[1].id,
sectionId: courseListJson[1].sectionId,
}, },
courselist: [{ {
title: courseListJson[0].title, title: courseListJson[2].title,
desc: courseListJson[0].desc, desc: courseListJson[2].desc,
percent: courseListJson[0].percent, percent: courseListJson[2].percent,
status: courseListJson[0].status, status: courseListJson[2].status,
pic: courseListJson[0].pic, pic: courseListJson[2].pic,
id: courseListJson[0].id, id: courseListJson[2].id,
sectionId: courseListJson[0].sectionId sectionId: courseListJson[2].sectionId,
}, },
{ ],
title: courseListJson[1].title, examList: [
desc: courseListJson[1].desc, {
percent: courseListJson[1].percent, title: examListJson[0].title,
status: courseListJson[1].status, desc: examListJson[0].desc,
pic: courseListJson[1].pic, condition: examListJson[0].condition,
id: courseListJson[1].id, status: examListJson[0].status,
sectionId: courseListJson[1].sectionId pic: examListJson[0].pic,
}, id: examListJson[0].id,
{ examId: examListJson[0].examId,
title: courseListJson[2].title, examStatus: examListJson[0].examStatus,
desc: courseListJson[2].desc, isComplete: examListJson[0].isComplete,
percent: courseListJson[2].percent, },
status: courseListJson[2].status, {
pic: courseListJson[2].pic, title: examListJson[1].title,
id: courseListJson[2].id, desc: examListJson[1].desc,
sectionId: courseListJson[2].sectionId, condition: examListJson[1].condition,
} status: examListJson[1].status,
], pic: examListJson[1].pic,
examList: [{ id: examListJson[1].id,
title: examListJson[0].title, examId: examListJson[1].examId,
desc: examListJson[0].desc, examStatus: examListJson[1].examStatus,
condition: examListJson[0].condition, isComplete: examListJson[1].isComplete,
status: examListJson[0].status, },
pic: examListJson[0].pic, ],
id: examListJson[0].id, loadStatus: "loading",
examId: examListJson[0].examId, isLoadMore: false,
examStatus: examListJson[0].examStatus, exam: null,
isComplete: examListJson[0].isComplete jianBianImg: process.uniEnv.qn_base_url + "jianbian@3x_bak1.png",
}, isReflesh: true,
{ triggered: false,
title: examListJson[1].title, _freshing: false,
desc: examListJson[1].desc, };
condition: examListJson[1].condition, },
status: examListJson[1].status, onLoad(param) {
pic: examListJson[1].pic, var that = this;
id: examListJson[1].id, try {
examId: examListJson[1].examId, if (param.tabs) {
examStatus: examListJson[1].examStatus, this.current = param.tabs;
isComplete: examListJson[1].isComplete this.swiperCurrent = param.tabs;
}
],
loadStatus: "loading",
isLoadMore: false,
exam: null,
jianBianImg: process.uniEnv.qn_base_url + "jianbian@3x_bak1.png",
isReflesh: true,
triggered: false,
_freshing: false,
} }
} catch (e) {}
},
computed: {
bannerImage() {
return process.uniEnv.qn_base_url + "banner-xx@3x.png";
}, },
onLoad(param) { },
var that = this; onShow: function (param) {
try { if (this.current == 2 || this.current == 3) {
if (param.tabs) { this.tabsChange(this.current);
this.current = param.tabs; }
this.swiperCurrent = param.tabs; },
} methods: {
} catch (e) {} stopPull() {
let that = this;
setTimeout(function () {
that.triggered = false;
that._freshing = false;
}, 1000);
}, },
computed: { onPulling(e) {
bannerImage() { return true;
return process.uniEnv.qn_base_url + "banner-xx@3x.png"; console.log("onpulling", e);
}, },
onRefresh() {
if (this._freshing) return;
this.triggered = true;
this._freshing = true;
this.isLoadMore = false;
this.loadStatus = "loading";
this.loadNews();
},
onRestore() {
this.triggered = "restore"; // 需要重置
console.log("onRestore");
}, },
onShow: function(param) { onAbort() {
if(this.current == 2 || this.current == 3){ console.log("onAbort");
this.tabsChange(this.current); },
//scroll-view到底部加载更多
onReachBottom() {
//上拉触底函数
if (!this.isLoadMore) {
this.isLoadMore = true;
this.params.start += 5;
if (this.loadStatus !== "nomore") {
this.getNoticeList();
}
} }
}, },
methods: { stopTouchMove() {
stopPull() { return false;
let that = this; },
setTimeout(function(){ getNoticeList() {
that.triggered = false; let that = this;
that._freshing = false; this.$u.api
}, 1000) .getTrainingNoticeList(this.params)
}, .then((res) => {
onPulling(e) { that.stopPull();
return true if (res.code != 200) {
console.log("onpulling", e); uni.showToast({
}, title: res.message,
onRefresh() { icon: "none",
if (this._freshing) return; });
this.triggered = true; that.isLoadMore = false;
this._freshing = true; if (that.params.start > 0) {
this.isLoadMore = false; that.page -= 5;
this.loadStatus = "loading"; }
this.loadNews(); }
}, if (res.data) {
onRestore() { let length = res.data.length;
this.triggered = 'restore'; // 需要重置 for (let i = 0; i < length; i++) {
console.log("onRestore"); res.data[i].create_at = this.timeFormat(
}, res.data[i].create_at,
onAbort() { "yyyy.MM.dd hh:mm"
console.log("onAbort"); );
}, }
//scroll-view到底部加载更多 that.list = that.list.concat(res.data);
onReachBottom() { }
//上拉触底函数 if (res.data.length >= 5) {
if (!this.isLoadMore) { that.isLoadMore = false;
this.isLoadMore = true; } else {
this.params.start += 5; that.isLoadMore = true;
if (this.loadStatus !== "nomore") { that.loadStatus = "nomore";
this.getNoticeList(); }
})
.catch((err) => {
uni.showToast({
title: err,
icon: "none",
});
that.isLoadMore = false;
if (that.params.start > 0) {
that.page -= 5;
} }
});
},
timeFormat(time, format, fromMysql = true) {
let rate = fromMysql ? 1000 : 1;
let dataFmt = format || "yyyy-MM-dd hh:mm:ss"; // 需要格式化的规则
time = typeof time == "number" ? time : new Date(time * rate); // 处理传入的time
let fmt = {
"y+": time.getFullYear(), // 年份
"M+": time.getMonth() + 1, // 月份
"d+": time.getDate(), // 日
"h+": time.getHours(), // 小时
"m+": time.getMinutes(), // 分钟
"s+": time.getSeconds(), // 秒
};
for (let i in fmt) {
if (new RegExp("(" + i + ")").test(dataFmt)) {
dataFmt = dataFmt.replace(
RegExp.$1,
fmt[i].toString().length <= 1 ? "0" + fmt[i] : fmt[i]
);
} }
}, }
stopTouchMove() { return dataFmt;
return false; },
}, getTypeName(percent) {
getNoticeList() { if (percent == 0) {
let that = this; return "未开始";
} else if (percent == "100") {
return "已完成";
} else {
return "继续";
}
},
//在线学习通用课程信息
getCourseList() {
let courseLength = this.courselist.length;
for (let i = 0; i < courseLength; i++) {
let param = {
course_id: this.courselist[i].id,
};
this.$u.api this.$u.api
.getTrainingNoticeList(this.params) .CourseList(param)
.then((res) => { .then((res) => {
that.stopPull(); if (res.code != 200) {
if(res.code != 200){
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
icon: "none", icon: "none",
}); });
that.isLoadMore = false;
if (that.params.start > 0) {
that.page -= 5;
}
} }
if (res.data) { if (res.data) {
let length = res.data.length; res.data.learnedInfo.learnPercent *= 100;
for (let i = 0; i < length; i++) { this.courselist[i].status = this.getTypeName(
res.data[i].create_at = this.timeFormat(res.data[i].create_at, res.data.learnedInfo.learnPercent
'yyyy.MM.dd hh:mm'); );
} this.courselist[i].percent =
that.list = that.list.concat(res.data); res.data.learnedInfo.learnPercent;
} this.courselist[i].sectionId =
if(res.data.length >= 5){ res.data.learnedInfo.nextLearnedSectionId;
that.isLoadMore = false;
}else{
that.isLoadMore = true;
that.loadStatus = "nomore";
} }
}) })
.catch((err) => { .catch((err) => {
...@@ -501,504 +569,452 @@ ...@@ -501,504 +569,452 @@
title: err, title: err,
icon: "none", icon: "none",
}); });
that.isLoadMore = false;
if (that.params.start > 0) {
that.page -= 5;
}
}); });
}, }
timeFormat(time, format, fromMysql = true) { },
let rate = fromMysql ? 1000 : 1; //tabs通知swiper切换
let dataFmt = format || 'yyyy-MM-dd hh:mm:ss' // 需要格式化的规则 tabsChange(index) {
time = typeof(time) == 'number' ? time : new Date(time * rate) // 处理传入的time this.swiperCurrent = index;
let fmt = { switch (index) {
'y+': time.getFullYear(), // 年份 case 1:
'M+': time.getMonth() + 1, // 月份 this.loadNews();
'd+': time.getDate(), // 日 break;
'h+': time.getHours(), // 小时 case 2:
'm+': time.getMinutes(), // 分钟 this.getCourseList();
's+': time.getSeconds() // 秒 break;
} case 3:
this.getUserExamInfo();
for (let i in fmt) { break;
if (new RegExp('(' + i + ')').test(dataFmt)) { }
dataFmt = dataFmt.replace(RegExp.$1, fmt[i].toString().length <= 1 ? '0' + fmt[i] : fmt[i]) },
} loadNews() {
} this.params.start = 0;
return dataFmt; this.list = [];
}, this.getNoticeList();
getTypeName(percent) { },
if (percent == 0) { animationfinish(e) {
return '未开始'; let current = e.detail.current;
} else if (percent == '100') { this.$refs.uTabs.setFinishCurrent(current);
return '已完成'; this.swiperCurrent = current;
} else { this.current = current;
return '继续'; },
} //跳转到拍照小程序首页
}, goToPrint() {
//在线学习通用课程信息 uni.navigateToMiniProgram({
getCourseList() { appId: "wxd1d6eede324b0465",
let courseLength = this.courselist.length; path: "/pages/photo/index",
for (let i = 0; i < courseLength; i++) { success(res) {
let param = { //打开成功
course_id: this.courselist[i].id console.log("success", res);
}; },
this.$u.api fail(err) {
.CourseList(param) console.log("err", err);
.then((res) => { },
if (res.code != 200) { });
uni.showToast({ },
title: res.message, //考核认证,通用认证,考试通过or未通过查询接口请求
icon: "none", getUserExamInfo() {
}); uni.showLoading({
} title: "请稍候",
if (res.data) { });
res.data.learnedInfo.learnPercent *= 100;
this.courselist[i].status = this.getTypeName(res.data.learnedInfo.learnPercent); let that = this;
this.courselist[i].percent = res.data.learnedInfo.learnPercent; let token = that.vuex_token;
this.courselist[i].sectionId = res.data.learnedInfo.nextLearnedSectionId; let length = this.examList.length;
} for (let i = 0; i < length; i++) {
}) let examId = this.examList[i].id;
.catch((err) => { this.$u.api
uni.showToast({ .getExamResult(examId)
title: err, .then((res) => {
icon: "none", if (res.code != 200) {
}); console.log("getUserExamInfo 200 err");
});
}
},
//tabs通知swiper切换
tabsChange(index) {
this.swiperCurrent = index;
switch (index) {
case 1:
this.loadNews()
break;
case 2:
this.getCourseList();
break;
case 3:
this.getUserExamInfo();
break;
}
},
loadNews() {
this.params.start = 0;
this.list = [];
this.getNoticeList();
},
animationfinish(e) {
let current = e.detail.current;
this.$refs.uTabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
},
//跳转到拍照小程序首页
goToPrint() {
console.log("111111");
uni.navigateToMiniProgram({
appId: "wxd1d6eede324b0465",
success(res) {
//打开成功
console.log("success", res);
},
fail(err) {
console.log("err", err);
},
});
},
//考核认证,通用认证,考试通过or未通过查询接口请求
getUserExamInfo() {
uni.showLoading({
title: "请稍候",
});
let that = this;
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){
console.log('getUserExamInfo 200 err');
uni.showToast({
icon: "none",
title: '获取考试信息失败',
});
}
this.examList[i].examId = res.data.id;
this.examList[i].examStatus = res.data.examStatus; //i;//
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");
return;
}
if (res.data.examStatus == 1) {
console.log("examStatus " + i + " 1");
that.examList[i].isComplete = this.examList[i].status == '通过';
that.examScore = res.data.examScore;
return;
}
if (res.data.examStatus == 0) {
console.log("examStatus " + i + " 0");
that.userExamId = res.data.id;
}
})
.catch((err) => {
console.log('getUserExamInfo err' + err);
uni.hideLoading();
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: "获取考试信息失败", title: "获取考试信息失败",
}); });
}
this.examList[i].examId = res.data.id;
this.examList[i].examStatus = res.data.examStatus; //i;//
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");
return;
}
if (res.data.examStatus == 1) {
console.log("examStatus " + i + " 1");
that.examList[i].isComplete =
this.examList[i].status == "通过";
that.examScore = res.data.examScore;
return;
}
if (res.data.examStatus == 0) {
console.log("examStatus " + i + " 0");
that.userExamId = res.data.id;
}
})
.catch((err) => {
console.log("getUserExamInfo err" + err);
uni.hideLoading();
uni.showToast({
icon: "none",
title: "获取考试信息失败",
}); });
} });
}, }
//跳转到assessment页面 },
aaa(index) { //跳转到assessment页面
//examStatus 用户考试状态 0考试中 1考试完成 2未参与 aaa(index) {
//考试完成分成通过、未通过 //examStatus 用户考试状态 0考试中 1考试完成 2未参与
var examInfo = this.examList[index]; //考试完成分成通过、未通过
if (examInfo.examStatus == 0) { var examInfo = this.examList[index];
console.log("这是试卷id", examInfo.id); if (examInfo.examStatus == 0) {
console.log("这是试卷id", examInfo.id);
wx.navigateTo({
url: "/pages/learn/answer?examId=" + examInfo.id,
});
} else if (examInfo.examStatus == 1) {
// examInfo.status = '通过';
if (examInfo.status == "通过") {
wx.navigateTo({ wx.navigateTo({
url: "/pages/learn/answer?examId=" + examInfo.id, url:
"/pages/learn/exam-pass?userExamId=" +
examInfo.examId,
}); });
} else if (examInfo.examStatus == 1) { } else {
// examInfo.status = '通过';
if (examInfo.status == '通过') {
wx.navigateTo({
url: "/pages/learn/exam-pass?userExamId=" + examInfo.examId,
});
} else {
wx.navigateTo({
url: "/pages/learn/result?userExamId=" + examInfo.examId + "&examId=" + examInfo.id,
});
}
} else if (examInfo.examStatus == 2) {
wx.navigateTo({ wx.navigateTo({
url: "/pages/learn/assessment?examId=" + examInfo.id, url:
"/pages/learn/result?userExamId=" +
examInfo.examId +
"&examId=" +
examInfo.id,
}); });
} }
}, } else if (examInfo.examStatus == 2) {
//跳转到播放
goPlay(info) {
uni.navigateTo({
url: "/pages/learn/section?section_id=" + info.sectionId + "&course_id=" + info.id,
});
},
//跳转到
bbb(e) {
var news = {
body: e.body,
title: e.title
};
let that = this;
wx.navigateTo({ wx.navigateTo({
url: '/pages/learn/news-details', url: "/pages/learn/assessment?examId=" + examInfo.id,
success: function(res) {
res.eventChannel.emit('acceptDataFromLearn', news)
}
}); });
}, }
},
//跳转到播放
goPlay(info) {
uni.navigateTo({
url:
"/pages/learn/section?section_id=" +
info.sectionId +
"&course_id=" +
info.id,
});
},
//跳转到
bbb(e) {
var news = {
body: e.body,
title: e.title,
};
let that = this;
wx.navigateTo({
url: "/pages/learn/news-details",
success: function (res) {
res.eventChannel.emit("acceptDataFromLearn", news);
},
});
}, },
}; },
};
</script> </script>
<style> <style>
.study { .study {
height: 100vh; height: 100vh;
background-color: #f4f5f7; background-color: #f4f5f7;
padding: 0rpx 30rpx 0 30rpx; padding: 0rpx 30rpx 0 30rpx;
} }
.title-view { .title-view {
color: #333333; color: #333333;
font-weight: bold; font-weight: bold;
font-size: 40rpx; font-size: 40rpx;
} }
.banner { .banner {
width: 690rpx; width: 690rpx;
height: 240rpx; height: 240rpx;
margin-top: 10rpx; margin-top: 10rpx;
} }
/* 交付规范 */ /* 交付规范 */
.standard { .standard {
width: 690rpx; width: 690rpx;
height: 180rpx; height: 180rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
/* border-bottom: 1rpx solid #82848a; */ /* border-bottom: 1rpx solid #82848a; */
/* padding: 0 34rpx; */ /* padding: 0 34rpx; */
/* margin: 72rpx auto; */ /* margin: 72rpx auto; */
border-radius: 12rpx; border-radius: 12rpx;
padding: 30rpx; padding: 30rpx;
margin-top: 30rpx; margin-top: 30rpx;
background-color: #FFFFFF; background-color: #ffffff;
} }
/* 培训通知 */ /* 培训通知 */
.notice { .notice {
/* border: #808080 solid 2rpx; */ /* border: #808080 solid 2rpx; */
width: 100%; width: 100%;
min-height: 370rpx; min-height: 370rpx;
margin-top: 36rpx; margin-top: 36rpx;
overflow: hidden; overflow: hidden;
background-color: #ffffff; background-color: #ffffff;
border-radius: 12rpx; border-radius: 12rpx;
padding: 30rpx; padding: 30rpx;
} }
.n-head { .n-head {
text-align: left; text-align: left;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
} }
.news { .news {
height: 168rpx; height: 168rpx;
overflow: hidden; overflow: hidden;
margin-top: 30rpx; margin-top: 30rpx;
font-size: 24rpx; font-size: 24rpx;
color: #666666; color: #666666;
line-height: 34rpx; line-height: 34rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
/* 在线学习 */ /* 在线学习 */
.currency-class { .currency-class {
width: 100%; width: 100%;
background: #ffffff; background: #ffffff;
padding: 30rpx; padding: 30rpx;
border-radius: 12rpx; border-radius: 12rpx;
} }
.learn-currency-class { .learn-currency-class {
width: 100%; width: 100%;
border-radius: 12rpx; border-radius: 12rpx;
display: flex; display: flex;
} }
.jf-currency-class { .jf-currency-class {
width: 100%; width: 100%;
height: 180rpx; height: 180rpx;
position: absolute; position: absolute;
border-radius: 12rpx; border-radius: 12rpx;
margin-top: 60rpx; margin-top: 60rpx;
} }
.title { .title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
font-family: PingFang-SC-Bold, PingFang-SC; font-family: PingFang-SC-Bold, PingFang-SC;
} }
.class1 { .class1 {
display: -webkit-box; display: -webkit-box;
display: -webkit-flex; display: -webkit-flex;
display: flex; display: flex;
-webkit-box-pack: justify; -webkit-box-pack: justify;
-webkit-justify-content: space-between; -webkit-justify-content: space-between;
justify-content: space-between; justify-content: space-between;
} }
.learn-class1 { .learn-class1 {
display: -webkit-box; display: -webkit-box;
display: -webkit-flex; display: -webkit-flex;
display: block; display: block;
-webkit-box-pack: justify; -webkit-box-pack: justify;
-webkit-justify-content: space-between; -webkit-justify-content: space-between;
justify-content: space-between; justify-content: space-between;
width: 330rpx; width: 330rpx;
height: 420rpx; height: 420rpx;
background-color: #ffffff; background-color: #ffffff;
position: relative; position: relative;
border-radius: 12rpx; border-radius: 12rpx;
} }
.img { .img {
width: 160rpx; width: 160rpx;
height: 120rpx; height: 120rpx;
} }
.learn-img { .learn-img {
width: 330rpx; width: 330rpx;
height: 194rpx; height: 194rpx;
} }
.jf-img { .jf-img {
width: 160rpx; width: 160rpx;
height: 200rpx; height: 200rpx;
position: absolute; position: absolute;
top: -45rpx; top: -45rpx;
left: 30rpx; left: 30rpx;
} }
.right { .right {
width: 434rpx; width: 434rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
} }
.intro { .intro {
color: #9999a6; color: #9999a6;
} }
.tab { .tab {
background: #fff; background: #fff;
height: 82rpx; height: 82rpx;
margin: 0 0; margin: 0 0;
} }
.text { .text {
margin: 0 40rpx; margin: 0 40rpx;
line-height: 82rpx; line-height: 82rpx;
color: #667eb5; color: #667eb5;
} }
.content { .content {
margin: 5px 0; margin: 5px 0;
height: 485rpx; height: 485rpx;
background: #fff; background: #fff;
} }
swiper { swiper {
height: 70vh; height: 70vh;
} }
.line-percent { .line-percent {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 24rpx; font-size: 24rpx;
color: #999999; color: #999999;
margin: 20rpx; margin: 20rpx;
margin-top: 25rpx; margin-top: 25rpx;
} }
.jf-line { .jf-line {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
width: 120rpx; width: 120rpx;
height: 52rpx; height: 52rpx;
border-radius: 26rpx; border-radius: 26rpx;
background-color: #ffffff; background-color: #ffffff;
color: #2272FF; color: #2272ff;
text-align: center; text-align: center;
padding-left: 20rpx; padding-left: 20rpx;
padding-top: 6rpx; padding-top: 6rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
.u-progress { .u-progress {
width: 160rpx !important; width: 160rpx !important;
height: 12rpx !important; height: 12rpx !important;
background-color: #ececec; background-color: #ececec;
} }
.font-bold { .font-bold {
font-weight: bold; font-weight: bold;
} }
.font-default-color { .font-default-color {
color: #999999; color: #999999;
} }
.font-default-exam-color { .font-default-exam-color {
color: #FA5A49; color: #fa5a49;
} }
.font-active-color { .font-active-color {
color: #2272FF; color: #2272ff;
} }
.font-color-999999 { .font-color-999999 {
color: #999999; color: #999999;
} }
.standard-img { .standard-img {
width: 160rpx; width: 160rpx;
height: 120rpx; height: 120rpx;
} }
.standard-body { .standard-body {
height: 120rpx; height: 120rpx;
display: flex; display: flex;
} }
.standard-body-title { .standard-body-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
}
}
.jf-right {
.jf-right { padding-left: 190rpx;
padding-left: 190rpx; width: 460rpx;
width: 460rpx; color: #ffffff;
color: #ffffff; }
}
.notice-bottom {
.notice-bottom { margin-top: 20rpx;
margin-top: 20rpx; display: block;
display: block; position: relative;
position: relative; }
}
.notice-bottom-left {
.notice-bottom-left { font-size: 24rpx;
font-size: 24rpx; color: #999999;
color: #999999; float: left;
float: left; }
}
.notice-bottom-right {
.notice-bottom-right { font-size: 24rpx;
font-size: 24rpx; color: #2272ff;
color: #2272FF; float: right;
float: right; }
}
.bofang {
.bofang { width: 60rpx;
width: 60rpx; height: 60rpx;
height: 60rpx; position: absolute;
position: absolute; left: 130rpx;
left: 130rpx; top: 70rpx;
top: 70rpx; }
}
.learn-desc {
.learn-desc { height: 138rpx;
height: 138rpx; margin-top: -10rpx;
margin-top: -10rpx; padding-top: 20rpx;
padding-top: 20rpx; padding-left: 20rpx;
padding-left: 20rpx; padding-right: 20rpx;
padding-right: 20rpx; }
}
.learn-intro {
.learn-intro { color: #999999;
color: #999999; margin-top: 20rpx;
margin-top: 20rpx; font-size: 20rpx;
font-size: 20rpx; }
}
.h48 {
.h48 { height: 48rpx;
height: 48rpx; }
}
.current-img {
.current-img { width: 100%;
width: 100%; height: 100%;
height: 100%; position: absolute;
position: absolute; }
}
.load-more {
.load-more { padding-top: 50rpx;
padding-top: 50rpx; padding-bottom: 200rpx;
padding-bottom: 200rpx; }
}
</style> </style>
...@@ -136,7 +136,7 @@ export default { ...@@ -136,7 +136,7 @@ export default {
//判断是否通过,通过去成功页,失败去失败页 //判断是否通过,通过去成功页,失败去失败页
let examInfo = this.examInfo; let examInfo = this.examInfo;
let examId = this.examId; let examId = this.examId;
let status = examInfo.examLevelResult == "通过"; let status = examInfo.examLevelResult == "已通过";
if (status) { if (status) {
wx.navigateTo({ wx.navigateTo({
url: url:
...@@ -332,7 +332,8 @@ export default { ...@@ -332,7 +332,8 @@ export default {
"&questionId=" + "&questionId=" +
questionId + questionId +
"&userAnswerIds=" + "&userAnswerIds=" +
(this.userAnswerIds || "9999"), // 9999超时自动下一题 (this.userAnswerIds || "9999") +
",", // 9999超时自动下一题
method: "POST", method: "POST",
data: { data: {
// userExamId:this.userExamId, // userExamId:this.userExamId,
......
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