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

学习首页

parent ba6c9632
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
<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 :list="tabs" :is-scroll="false" :current="current" @change="change"></u-tabs> -->
<view> <view>
<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" swiperWidth="750"></u-tabs-swiper> :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
...@@ -41,7 +40,7 @@ ...@@ -41,7 +40,7 @@
<view class="currency-class"> <view class="currency-class">
<view class="title">通用课程</view> <view class="title">通用课程</view>
<view class="class1" @click=ccc(courselist[0].id)> <view class="class1" @click=ccc(courselist[0].id)>
<image class="img" :src=courselist[0].pic mode=""></image> <image class="img" :src="courselist[0].pic" mode=""></image>
<view class="right"> <view class="right">
<view class=""> <view class="">
{{ courselist[0].title }} {{ courselist[0].title }}
...@@ -50,15 +49,15 @@ ...@@ -50,15 +49,15 @@
{{ courselist[0].desc }} {{ courselist[0].desc }}
</view> </view>
<view class="" style="display:flex;justify-content: space-between;"> <view class="" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff" <u-line-progress active-color="#2979ff" :percent=courselist[0].percent
:percent=courselist[0].percent style="width:54%;"> style="width:54%;">
</u-line-progress> </u-line-progress>
<text v-text="courselist[0].status"></text> <text v-text="courselist[0].status"></text>
</view> </view>
</view> </view>
</view> </view>
<view class="class1" @click=ccc(courselist[1].id)> <view class="class1" @click=ccc(courselist[1].id)>
<image class="img" :src=courselist[1].pic mode=""></image> <image class="img" :src="courselist[1].pic" mode=""></image>
<view class="right"> <view class="right">
<view class=""> <view class="">
{{ courselist[1].title }} {{ courselist[1].title }}
...@@ -67,8 +66,8 @@ ...@@ -67,8 +66,8 @@
{{ courselist[1].desc }} {{ courselist[1].desc }}
</view> </view>
<view class="" style="display:flex;justify-content: space-between;"> <view class="" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff" <u-line-progress active-color="#2979ff" :percent="courselist[1].percent"
:percent="courselist[1].percent" style="width:54%;"> style="width:54%;">
</u-line-progress> </u-line-progress>
<text v-text="courselist[1].status"></text> <text v-text="courselist[1].status"></text>
</view> </view>
...@@ -78,7 +77,7 @@ ...@@ -78,7 +77,7 @@
<view class="currency-class"> <view class="currency-class">
<view class="title">技能课程</view> <view class="title">技能课程</view>
<view class="class1" @click=ccc(courselist[2].id)> <view class="class1" @click=ccc(courselist[2].id)>
<image class="img" :src=courselist[2].pic mode=""></image> <image class="img" :src="courselist[2].pic" mode=""></image>
<view class="right"> <view class="right">
<view class=""> <view class="">
{{ courselist[2].title }} {{ courselist[2].title }}
...@@ -87,8 +86,8 @@ ...@@ -87,8 +86,8 @@
{{ courselist[2].desc }} {{ courselist[2].desc }}
</view> </view>
<view class="" style="display:flex;justify-content: space-between;"> <view class="" style="display:flex;justify-content: space-between;">
<u-line-progress active-color="#2979ff" <u-line-progress active-color="#2979ff" :percent="courselist[2].percent"
:percent="courselist[2].percent" style="width:54%;"> style="width:54%;">
</u-line-progress> </u-line-progress>
<text v-text="courselist[2].status"></text> <text v-text="courselist[2].status"></text>
</view> </view>
...@@ -160,16 +159,14 @@ ...@@ -160,16 +159,14 @@
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
</view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
msg: "赣南吴彦祖", msg: "赣南吴彦祖",
tabs: [ tabs: [{
{
name: "交付规范", name: "交付规范",
}, },
{ {
...@@ -188,7 +185,31 @@ export default { ...@@ -188,7 +185,31 @@ export default {
start: 0, start: 0,
}, },
list: [], list: [],
courselist: null, courselist: [{
title: '服务规范',
desc: '为用户提供更好服务,自己赚更多钱',
percent: 0,
status: '',
pic: process.uniEnv.qn_base_url + "guifan1@3x.png",
id: 173
},
{
title: '接单操作',
desc: '快速学习,使用APP 接单、抢单',
percent: 0,
status: '',
pic: process.uniEnv.qn_base_url + "guifan2@3x.png",
id: 173
},
{
title: '从0-1学习充电桩安装服务',
desc: '让你全面了解充电桩市场及服务规范',
percent: 0,
status: '',
pic: process.uniEnv.qn_base_url + "kecehng1@3x.png",
id: 173
}
],
loadStatus: "loading", //加载样式:loadMore-加载前样式,loading-加载加载中样式,nomore-没有数据样式 loadStatus: "loading", //加载样式:loadMore-加载前样式,loading-加载加载中样式,nomore-没有数据样式
isLoadMore: false, //是否加载中 isLoadMore: false, //是否加载中
course_id: "course_id_=173", course_id: "course_id_=173",
...@@ -202,7 +223,7 @@ export default { ...@@ -202,7 +223,7 @@ export default {
}, },
computed: { computed: {
bannerImage() { bannerImage() {
return process.uniEnv.qn_base_url + "banner-xx.png"; return process.uniEnv.qn_base_url + "banner-xx@3x.png";
}, },
}, },
methods: { methods: {
...@@ -247,36 +268,29 @@ export default { ...@@ -247,36 +268,29 @@ export default {
} }
}); });
}, },
getTypeName(percent) {
if (percent == 0) {
return '未开始';
} else if (percent == '100') {
return '已完成';
} else {
return '继续';
}
},
//在线学习通用课程信息 //在线学习通用课程信息
getCourseList() { 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
.CourseList() .CourseList(param)
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (res.data) { if (res.data) {
this.courselist = res.data; this.courselist[i].status = this.getTypeName(res.data.learnedInfo.learnPercent);
console.log("--------"); this.courselist[i].percent = res.data.learnedInfo.learnPercent;
console.log(this.courselist);
if (res.data.length < 5) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true;
this.loadStatus = "nomore";
} else {
this.isLoadMore = false;
}
} else {
this.isLoadMore = true;
this.loadStatus = "nomore";
}
} else {
//接口请求失败的处理
uni.showToast({
title: res.message,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
} }
} }
}) })
...@@ -285,22 +299,21 @@ export default { ...@@ -285,22 +299,21 @@ export default {
title: err, title: err,
icon: "none", icon: "none",
}); });
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
}
}); });
}
}, },
//tabs通知swiper切换 //tabs通知swiper切换
tabsChange(index) { tabsChange(index) {
this.swiperCurrent = index; this.swiperCurrent = index;
switch (index) { switch (index) {
case 1: case 1:
this.params.start = 0;
this.list = [];
this.getList(); this.getList();
break; break;
case 2: case 2:
this.getCourseList(); this.getCourseList();
console.log("重新加载学习进度"); console.log('重新加载学习进度');
break; break;
case 3: case 3:
this.getUserExamInfo(); this.getUserExamInfo();
...@@ -396,11 +409,10 @@ export default { ...@@ -396,11 +409,10 @@ export default {
let that = this; let that = this;
uni.request({ uni.request({
url: url: "http://192.168.1.22" +
"http://192.168.1.22" +
"/wxh-worker-rest/rest/exam" + "/wxh-worker-rest/rest/exam" +
"/serviceRule/userExamInfo/" + "/serviceRule/userExamInfo/" +
this.vuex_token + getApp().globalData.token +
"?examId=" + "?examId=" +
2, 2,
method: "POST", method: "POST",
...@@ -411,6 +423,7 @@ export default { ...@@ -411,6 +423,7 @@ export default {
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
}, },
success: (res) => { success: (res) => {
console.log(res.data);
uni.hideLoading(); uni.hideLoading();
if (!res.data) { if (!res.data) {
return; return;
...@@ -426,6 +439,26 @@ export default { ...@@ -426,6 +439,26 @@ export default {
//examStatus 用户考试状态 0考试中 1考试完成 2未参与 //examStatus 用户考试状态 0考试中 1考试完成 2未参与
that.exam = res.data.data; that.exam = res.data.data;
console.log(that.exam); 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();
}
} else {
uni.showToast({
icon: "none",
title: res.data.message,
});
} }
}, },
fail: (e) => { fail: (e) => {
...@@ -438,111 +471,114 @@ export default { ...@@ -438,111 +471,114 @@ export default {
}); });
}, },
}, },
}; };
</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-left: -15rpx; */ margin-top: 10rpx;
} }
/* //交付规范 */ /* //交付规范 */
.standard { .standard {
width: 656rpx; width: 656rpx;
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;
} }
/* //培训通知 */ /* //培训通知 */
.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;
} }
.n-head { .n-head {
text-align: center; text-align: center;
margin: 32rpx 0; margin: 32rpx 0;
} }
/* //在线学习 */
.currency-class { .news {}
/* //在线学习 */
.currency-class {
width: 100%; width: 100%;
background: #ffffff; background: #ffffff;
padding: 18rpx; padding: 18rpx;
margin-bottom: 11px; margin-bottom: 11px;
border-radius: 12rpx; border-radius: 12rpx;
} }
.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: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding-top: 22rpx; padding-top: 22rpx;
margin-top: 28rpx; margin-top: 28rpx;
border-top: 1rpx solid #808080; border-top: 1rpx solid #808080;
} }
.img { .img {
width: 201rpx; width: 201rpx;
height: 201rpx; height: 201rpx;
display: block; display: block;
margin-right: 0rpx; margin-right: 0rpx;
} }
.right { .right {
width: 428rpx; width: 428rpx;
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: 691rpx; height: 691rpx;
} }
</style> </style>
\ No newline at end of file
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