Commit b2d898b7 authored by zhengzy's avatar zhengzy

消息通知栏

parent 9d504117
; ;
(function() { (function () {
let NODE_ENV = 'prod'; // dev:开发环境 | test:测试环境 | prod:生产环境 let NODE_ENV = 'test'; // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null; let ENV_VAR = null;
let VERSION_NUMBER = '1.3.1';//版本号 let VERSION_NUMBER = '1.3.1';//版本号
//小程序是否审核通过,参数配置在ucenter库version表,对应版本号的is_audit设置为1,将显示学习视频 //小程序是否审核通过,参数配置在ucenter库version表,对应版本号的is_audit设置为1,将显示学习视频
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
if (NODE_ENV === 'dev') { if (NODE_ENV === 'dev') {
ENV_VAR = require('./.env.dev.js'); ENV_VAR = require('./.env.dev.js');
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
} }
if (ENV_VAR) { if (ENV_VAR) {
process.uniEnv = {}; process.uniEnv = {};
process.uniEnv['node_env'] = NODE_ENV; process.uniEnv['node_env'] = NODE_ENV;
process.uniEnv['version_number'] = VERSION_NUMBER; process.uniEnv['version_number'] = VERSION_NUMBER;
for (let key in ENV_VAR) { for (let key in ENV_VAR) {
process.uniEnv[key] = ENV_VAR[key]; process.uniEnv[key] = ENV_VAR[key];
} }
......
...@@ -24,16 +24,13 @@ ...@@ -24,16 +24,13 @@
<swiper-item @touchmove.stop.prevent="stopTouchMove"> <swiper-item @touchmove.stop.prevent="stopTouchMove">
<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-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">
<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="notice-bottom-left">{{item.create_at}}</view>
{{item.title}} <view class="notice-content">
</view> <img :src="item.img" alt="" style="width:690rpx;height:260rpx;display:block">
<view class="news" v-html="item.body"> <view class="notice-content-bottom">
<u-parse :html="item.body"></u-parse> <view class="n-head">{{item.title}}</view>
</view> <view class="news">{{item.text}}</view>
<u-line color="#F4F5F7" /> </view>
<view class="notice-bottom">
<view class="notice-bottom-left">{{ item.create_at }}</view>
<view class="notice-bottom-right">查看详情</view>
</view> </view>
</view> </view>
<view v-shou="isLoadMore" class="load-more"> <view v-shou="isLoadMore" class="load-more">
...@@ -429,8 +426,7 @@ export default { ...@@ -429,8 +426,7 @@ export default {
pic: courseListJson[2].pic, pic: courseListJson[2].pic,
id: courseListJson[2].id, id: courseListJson[2].id,
sectionId: courseListJson[2].sectionId, sectionId: courseListJson[2].sectionId,
} },
,
{ {
title: courseListJson[3].title, title: courseListJson[3].title,
desc: courseListJson[3].desc, desc: courseListJson[3].desc,
...@@ -478,7 +474,7 @@ export default { ...@@ -478,7 +474,7 @@ export default {
}; };
}, },
onLoad(param) { onLoad(param) {
getApp().trackPage('学习首页') getApp().trackPage("学习首页");
var that = this; var that = this;
try { try {
if (param.tabs) { if (param.tabs) {
...@@ -490,7 +486,7 @@ export default { ...@@ -490,7 +486,7 @@ export default {
}, },
computed: { computed: {
bannerImage() { bannerImage() {
return process.uniEnv.qn_base_url + "banner-xx@3x.png"; return process.uniEnv.qn_base_url + "xuexibanner.png";
}, },
}, },
onShow: function (param) { onShow: function (param) {
...@@ -512,14 +508,12 @@ export default { ...@@ -512,14 +508,12 @@ export default {
.getVersionInfo(version) .getVersionInfo(version)
.then((res) => { .then((res) => {
let data = res.data; let data = res.data;
if(data.hasOwnProperty('is_audit') && data.is_audit == 0){ if (data.hasOwnProperty("is_audit") && data.is_audit == 0) {
that.tabs = that.tabs2; that.tabs = that.tabs2;
that.version = false that.version = false;
} }
}) })
.catch((err) => { .catch((err) => {});
});
}, },
stopPull() { stopPull() {
let that = this; let that = this;
...@@ -564,6 +558,24 @@ export default { ...@@ -564,6 +558,24 @@ export default {
stopTouchMove() { stopTouchMove() {
return false; return false;
}, },
//取文本第一张图片
imgUrlFun(str) {
var data = "";
str.replace(
/<img [^>]*src=['"]([^'"]+)[^>]*>/,
function (match, capture) {
data = capture;
}
);
return data;
},
//取文本信息
getText(str) {
return str
.replace(/<[^<>]+>/g, "")
.replace(/&nbsp;/gi, "")
.replace(/(\n)/g, "");
},
getNoticeList() { getNoticeList() {
let that = this; let that = this;
this.$u.api this.$u.api
...@@ -587,8 +599,11 @@ export default { ...@@ -587,8 +599,11 @@ export default {
res.data[i].create_at, res.data[i].create_at,
"yyyy.MM.dd hh:mm" "yyyy.MM.dd hh:mm"
); );
res.data[i].img = this.imgUrlFun(res.data[i].body);
res.data[i].text = this.getText(res.data[i].body);
} }
that.list = that.list.concat(res.data); that.list = that.list.concat(res.data);
console.log("消息列表", that.list);
} }
if (res.data.length >= 5) { if (res.data.length >= 5) {
that.isLoadMore = false; that.isLoadMore = false;
...@@ -718,69 +733,69 @@ export default { ...@@ -718,69 +733,69 @@ export default {
//考核认证,通用认证,考试通过or未通过查询接口请求 //考核认证,通用认证,考试通过or未通过查询接口请求
getUserExamInfo() { getUserExamInfo() {
uni.hideLoading(); uni.hideLoading();
let that = this; let that = this;
let token = that.vuex_token; let token = that.vuex_token;
let length = this.examList.length; let length = this.examList.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let examId = this.examList[i].id; let examId = this.examList[i].id;
this.$u.api.getExamResult(examId) this.$u.api
.then((res) => { .getExamResult(examId)
if (res.code != 200) { .then((res) => {
console.log("getUserExamInfo 200 err"); 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;//
this.examList[i].questionTime = res.data.questionTime;
let examResult = res.data.examLevelResult;
this.examList[i].status =
examResult != "" ? examResult : "未通过";
//动态获取条件
let ruleDisc = res.data.ruleDisc;
let targetIndex = ruleDisc.indexOf("(");
if (targetIndex) {
this.examList[i].condition = ruleDisc
.substr(targetIndex + 1)
.replace(")", "");
}
// examStatus 用户考试状态 0考试中 1考试完成 2未参与
that.exam = res.data;
if (res.data.examStatus == 2) {
return;
}
if (res.data.examStatus == 1) {
that.examList[i].isComplete =
this.examList[i].status == "已通过";
that.examScore = res.data.examScore;
return;
}
if (res.data.examStatus == 0) {
that.userExamId = res.data.id;
}
})
.catch((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;//
this.examList[i].questionTime = res.data.questionTime;
let examResult = res.data.examLevelResult;
this.examList[i].status =
examResult != "" ? examResult : "未通过";
//动态获取条件
let ruleDisc = res.data.ruleDisc;
let targetIndex = ruleDisc.indexOf("(");
if (targetIndex) {
this.examList[i].condition = ruleDisc
.substr(targetIndex + 1)
.replace(")", "");
}
// examStatus 用户考试状态 0考试中 1考试完成 2未参与
that.exam = res.data;
if (res.data.examStatus == 2) {
return;
}
if (res.data.examStatus == 1) {
that.examList[i].isComplete =
this.examList[i].status == "已通过";
that.examScore = res.data.examScore;
return;
}
if (res.data.examStatus == 0) {
that.userExamId = res.data.id;
}
})
.catch((err) => {
uni.hideLoading();
uni.showToast({
icon: "none",
title: "获取考试信息失败",
}); });
});
} }
}, },
//跳转到assessment页面 //跳转到assessment页面
aaa(index) { aaa(index) {
//examStatus 用户考试状态 0考试中 1考试完成 2未参与 //examStatus 用户考试状态 0考试中 1考试完成 2未参与
//考试完成分成通过、未通过 //考试完成分成通过、未通过
getApp().globalData.questionTime = this.examList[ getApp().globalData.questionTime =
index this.examList[index].questionTime;
].questionTime;
var examInfo = this.examList[index]; var examInfo = this.examList[index];
wx.navigateTo({ wx.navigateTo({
url: "/pages/learn/assessment?examId=" + examInfo.id, url: "/pages/learn/assessment?examId=" + examInfo.id,
...@@ -801,6 +816,7 @@ export default { ...@@ -801,6 +816,7 @@ export default {
var news = { var news = {
body: e.body, body: e.body,
title: e.title, title: e.title,
create_at: e.create_at,
}; };
let that = this; let that = this;
wx.navigateTo({ wx.navigateTo({
...@@ -828,7 +844,7 @@ export default { ...@@ -828,7 +844,7 @@ export default {
.banner { .banner {
width: 690rpx; width: 690rpx;
height: 240rpx; height: 220rpx;
margin-top: 10rpx; margin-top: 10rpx;
} }
...@@ -854,26 +870,40 @@ export default { ...@@ -854,26 +870,40 @@ export default {
min-height: 370rpx; min-height: 370rpx;
margin-top: 36rpx; margin-top: 36rpx;
overflow: hidden; overflow: hidden;
background-color: #ffffff;
border-radius: 12rpx; border-radius: 12rpx;
padding: 30rpx;
} }
.notice-content {
background: #ffffff;
width: 100%;
border-radius: 12rpx;
overflow: hidden;
}
.notice-content-bottom {
height: 150rpx;
padding: 0 30rpx;
overflow: hidden;
}
.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;
margin-top: 30rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
.news { .news {
height: 168rpx;
overflow: hidden; overflow: hidden;
margin-top: 30rpx; /* margin-top: 30rpx; */
white-space: nowrap;
text-overflow: ellipsis;
font-size: 24rpx; font-size: 24rpx;
color: #666666; color: #666666;
line-height: 34rpx; line-height: 34rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
margin-top: 16rpx;
} }
/* 在线学习 */ /* 在线学习 */
...@@ -1056,8 +1086,10 @@ swiper { ...@@ -1056,8 +1086,10 @@ swiper {
.notice-bottom-left { .notice-bottom-left {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500;
color: #999999; color: #999999;
float: left; text-align: center;
margin-bottom: 20rpx;
} }
.notice-bottom-right { .notice-bottom-right {
......
<template> <template>
<view> <view>
<u-navbar <u-navbar back-icon-color="#000000" :background="background" title-color="#000000" :border-bottom="false">
back-icon-color="#000000" </u-navbar>
:background="background" <view class="title">
title-color="#000000" {{ title }}
:border-bottom="false"> </view>
</u-navbar> <view class="creat_at">
<view class="title"> {{create_at}}
{{ title }}
</view> </view>
<view class="u-content"> <view class="u-content">
<u-parse :html="body" :tag-style="style"></u-parse> <u-parse :html="body" :tag-style="style"></u-parse>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
title: '', title: "",
body: '' body: "",
} create_at: "",
}, };
onLoad() { },
getApp().trackPage('消息通知详情页') onLoad() {
var that = this; getApp().trackPage("消息通知详情页");
const eventChannel = this.getOpenerEventChannel() var that = this;
eventChannel.on('acceptDataFromLearn', function(data) { const eventChannel = this.getOpenerEventChannel();
that.title = data.title; eventChannel.on("acceptDataFromLearn", function (data) {
that.body = data.body; that.title = data.title;
}) that.body = data.body;
this.$u.mpShare.path = '' that.create_at = data.create_at;
}, console.log(data);
} });
</script> this.$u.mpShare.path = "";
},
<style> };
.title{ </script>
font-size: 32rpx;
font-weight: bold; <style>
margin-left: 30rpx; .title {
margin-top: 30rpx; font-size: 32rpx;
} font-weight: bold;
.u-content{ margin-left: 30rpx;
font-size: 24rpx; margin-top: 30rpx;
line-height: 36rpx; }
color: #666666; .u-content {
margin-left: 30rpx; font-size: 24rpx;
margin-top: 30rpx; line-height: 36rpx;
margin-right: 30rpx; color: #666666;
} margin-left: 30rpx;
</style> margin-right: 30rpx;
}
.creat_at {
font-size: 24rpx;
color: #999999;
margin-left: 30rpx;
margin-top: 20rpx;
}
rich-text {
margin-top: 40rpx;
display: block;
}
</style>
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