This commit is contained in:
Lx 2025-04-17 10:01:13 +08:00
parent f4e040e0a8
commit 6fb394ef18
4 changed files with 434 additions and 398 deletions

View File

@ -1,272 +1,289 @@
<template> <template>
<view class="container"> <view class="container">
<VNavigationBar background-color="#fff" title-color="#333" title="消息中心" :showClear="showClear" @clearNoRead="clearNoReadFun"></VNavigationBar> <VNavigationBar background-color="#fff" title-color="#333" title="消息中心" :showClear="showClear"
<view class="body"> @clearNoRead="clearNoReadFun"></VNavigationBar>
<view class="messageList"> <view class="body">
<scroll-view scroll-y="true" class="itemContent" @scrolltolower="onReachBottomCus" <view class="messageList">
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered"> <scroll-view scroll-y="true" class="itemContent" @scrolltolower="onReachBottomCus" refresher-enabled
<view v-for="(item, index) in messageList" :key="index" class="messageItem" @click="readNotice(item)"> @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<image class="messageIcon" src="@/static/imgs/message-icon1.png" mode="aspectFit"></image> <view v-for="(item, index) in messageList" :key="index" class="messageItem"
<view class="messageContent"> @click="readNotice(item)">
<view :class="{'messageTitle':item.readStatus,'noReadTitle':!item.readStatus}" >系统通知</view> <image class="messageIcon" src="@/static/imgs/message-icon1.png" mode="aspectFit"></image>
<view class="messageContent_content">{{item.templateContent}}</view> <view class="messageContent">
<view class="messageContent_content" style="text-align: right">{{formatTime(item.createTime)}}</view> <view :class="{'messageTitle':item.readStatus,'noReadTitle':!item.readStatus}">系统通知</view>
</view> <view class="messageContent_content">{{item.templateContent}}</view>
</view> <view class="messageContent_content" style="text-align: right">
<view style="text-align: center" v-if="messageList.length==0"> {{formatTime(item.createTime)}}</view>
<image class="" src="@/static/imgs/nothing.png"></image> </view>
</view> </view>
</scroll-view> <view style="text-align: center" v-if="messageList.length==0">
</view> <image class="" src="@/static/imgs/nothing.png"></image>
</view> </view>
<!-- 普通弹窗 --> </scroll-view>
<uni-popup ref="popup" background-color="#fff" > </view>
<view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }"> </view>
<text class="text popup-content-text">{{ nowReadItem.templateContent }}</text> <!-- 普通弹窗 -->
<button class="button popup-info" @click="dialogToggle"><text <uni-popup ref="popup" background-color="#fff">
class="button-text info-text">知道了</text></button> <view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }">
</view> <text class="text popup-content-text">{{ nowReadItem.templateContent }}</text>
</uni-popup> <button class="button popup-info" @click="dialogToggle"><text
</view> class="button-text info-text">知道了</text></button>
</view>
</uni-popup>
</view>
</template> </template>
<script> <script>
import VNavigationBar from '@/components/tabbar/VNavigationBar.vue' import VNavigationBar from '@/components/tabbar/VNavigationBar.vue'
import request from '@/utils/request.js' import request from '@/utils/request.js'
// import {formatTimestamp} from "@/utils/utils"; // import {formatTimestamp} from "@/utils/utils";
export default { export default {
components: { components: {
VNavigationBar, VNavigationBar,
}, },
data() { data() {
return { return {
type:"center", type: "center",
messageList: [], messageList: [],
pageNo: 1, pageNo: 1,
pageSize: 15, pageSize: 15,
total: 0, total: 0,
// //
isTriggered:false, isTriggered: false,
// //
showClear:true, showClear: true,
nowReadItem:{}, nowReadItem: {},
systemCode: 'jiaxiao', systemCode: 'jiaxiao',
}; };
}, },
onLoad(){ onLoad() {
}, },
onShow(){ onShow() {
this.getList() this.getList()
}, },
methods:{ methods: {
/** /**
* 点击阅读消息 * 点击阅读消息
*/ */
async readNotice(item) { async readNotice(item) {
this.nowReadItem = item this.nowReadItem = item
// open uni-popup type // open uni-popup type
this.$refs.popup.open(this.type) this.$refs.popup.open(this.type)
// //
await request({ await request({
url: "/app-api/system/notify-message/update-read", url: "/app-api/system/notify-message/update-read",
method: "PUT", method: "PUT",
params:{ids:this.nowReadItem.id}, params: {
tenantIdFlag:false ids: this.nowReadItem.id
}).then((res) => { },
if(res.code==200){ tenantIdFlag: false
this.onRefresherrefresh() }).then((res) => {
} if (res.code == 200) {
}) this.onRefresherrefresh()
}, }
/** })
* 消息设置为已读 },
*/ /**
dialogToggle(){ * 消息设置为已读
this.$refs.popup.close() */
}, dialogToggle() {
/** this.$refs.popup.close()
* 一键清空未读消息 },
*/ /**
async clearNoReadFun(){ * 一键清空未读消息
console.log("清空了") */
await request({ async clearNoReadFun() {
url: "/app-api/system/notify-message/update-all-read", console.log("清空了")
method: "PUT", await request({
tenantIdFlag:false url: "/app-api/system/notify-message/update-all-read",
}).then((res) => { method: "PUT",
if(res.code==200){ tenantIdFlag: false
uni.showToast({ }).then((res) => {
title: '操作成功', if (res.code == 200) {
icon: 'none' uni.showToast({
}) title: '操作成功',
setTimeout(()=>{ icon: 'none'
this.onRefresherrefresh() })
},500) setTimeout(() => {
} this.onRefresherrefresh()
}) }, 500)
}, }
formatTime(value){ })
// Date },
const date = new Date(value); formatTime(value) {
// // Date
const year = date.getFullYear(); const date = new Date(value);
const month = (date.getMonth() + 1).toString().padStart(2, '0'); //
const day = date.getDate().toString().padStart(2, '0'); const year = date.getFullYear();
const hours = date.getHours().toString().padStart(2, '0'); const month = (date.getMonth() + 1).toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0');
const seconds = date.getSeconds().toString().padStart(2, '0'); const hours = date.getHours().toString().padStart(2, '0');
// const minutes = date.getMinutes().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; const seconds = date.getSeconds().toString().padStart(2, '0');
}, //
/** return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
* 上滑加载数据 },
*/ /**
onReachBottomCus() { * 上滑加载数据
// * */
if (this.pageNo * this.pageSize >= this.total) { onReachBottomCus() {
uni.$u.toast('没有更多数据了') // *
return if (this.pageNo * this.pageSize >= this.total) {
} uni.$u.toast('没有更多数据了')
//+1, return
this.pageNo++ }
// //+1,
this.getList() this.pageNo++
}, //
/** this.getList()
* 下拉刷新数据 },
*/ /**
onRefresherrefresh(){ * 下拉刷新数据
this.isTriggered = true */
this.pageNo = 1 onRefresherrefresh() {
this.total = 0 this.isTriggered = true
this.messageList = [] this.pageNo = 1
this.getList() this.total = 0
}, this.messageList = []
/** this.getList()
* 分页查询 },
*/ /**
async getList(){ * 分页查询
await request({ */
url: "/app-api/system/notify-message/my-page", async getList() {
method: "GET", await request({
params:{ url: "/app-api/system/notify-message/my-page",
pageNo:this.pageNo, method: "GET",
pageSize:this.pageSize, params: {
systemCode: this.systemCode, pageNo: this.pageNo,
}, pageSize: this.pageSize,
tenantIdFlag:false systemCode: this.systemCode,
}).then((res) => { },
// concat n tenantIdFlag: false
if (this.pageNo != 1) { }).then((res) => {
this.messageList = this.messageList.concat(res.data.list) // concat n
} else { if (this.pageNo != 1) {
this.messageList = res.data.list this.messageList = this.messageList.concat(res.data.list)
} } else {
// this.messageList = res.data.list
this.total = res.data.total }
this.isTriggered = false //
}) this.total = res.data.total
}, this.isTriggered = false
} })
},
}
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.container { .container {
height: 100vh; height: 100vh;
display: flex;
flex-direction: column;
.body {
flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden;
}
.messageList {
flex: 1;
display: flex;
flex-direction: column;
.itemContent {
flex: 1; // scroll-view
display: flex;
flex-direction: column;
padding: 0 20rpx;
box-sizing: border-box;
}
}
.messageItem {
padding: 30rpx 0;
display: flex;
align-items: center;
column-gap: 20rpx;
border-bottom: 1rpx solid #EEEEEE;
.messageIcon { .body {
width: 80rpx;
height: 80rpx;
}
.noReadTitle {
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.noReadTitle:after{
content: "*";
color: red;
display: block; /* 或者其他的块级显示类型,比如 inline-block, table 等 */
position: absolute; /* 或者 absolute 或者 fixed取决于你的布局需求 */
z-index: 1; /* 确保它在元素的上方 */
right: 0;
}
.messageContent {
flex: 1; flex: 1;
width: 0; display: flex;
} flex-direction: column;
.messageTitle {
font-size: 32rpx;
color: #333333;
}
.messageContent_content {
font-weight: 500;
font-size: 28rpx;
color: #858BA0;
overflow: hidden; overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-top: 20rpx;
} }
}
.popup-content {
padding: 15px;
height: auto;
margin: auto;
width: 80%;
background-color: #fff;
}
.popup-content-text {
display: flex;
align-items: center;
justify-content: center;
}
.text { .messageList {
color: #333; flex: 1;
} display: flex;
flex-direction: column;
.popup-info { .itemContent {
margin-top: 30rpx; flex: 1; // scroll-view
color: #fff; display: flex;
background-color: #f2f6fc; flex-direction: column;
} padding: 0 20rpx;
box-sizing: border-box;
.info-text { }
color: #909399; }
}
} .messageItem {
</style> padding: 30rpx 0;
display: flex;
align-items: center;
column-gap: 20rpx;
border-bottom: 1rpx solid #EEEEEE;
.messageIcon {
width: 80rpx;
height: 80rpx;
}
.noReadTitle {
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.noReadTitle:after {
content: "*";
color: red;
display: block;
/* 或者其他的块级显示类型,比如 inline-block, table 等 */
position: absolute;
/* 或者 absolute 或者 fixed取决于你的布局需求 */
z-index: 1;
/* 确保它在元素的上方 */
right: 0;
}
.messageContent {
flex: 1;
width: 0;
}
.messageTitle {
font-size: 32rpx;
color: #333333;
}
.messageContent_content {
font-weight: 500;
font-size: 28rpx;
color: #858BA0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-top: 20rpx;
}
}
.popup-content {
padding: 15px;
height: auto;
margin: auto;
width: 80%;
background-color: #fff;
}
.popup-content-text {
display: flex;
align-items: center;
justify-content: center;
}
.text {
color: #333;
}
.popup-info {
margin-top: 30rpx;
color: #fff;
background-color: #f2f6fc;
}
.info-text {
color: #909399;
}
}
</style>

View File

@ -55,6 +55,7 @@
getCoachId, getCoachId,
getInviteId, getInviteId,
getLocalUserInfo, getLocalUserInfo,
getStaffType,
getToken, getToken,
removeCoachId, removeCoachId,
removeInviteId, removeInviteId,
@ -150,6 +151,8 @@
if (res.data != null) { if (res.data != null) {
this.qTenantId = res.data.tenantId this.qTenantId = res.data.tenantId
this.qCoachId = res.data.userId this.qCoachId = res.data.userId
console.log('tenantId', this.qTenantId)
console.log('coachId', this.qCoachId)
setTenantId(res.data.tenantId) setTenantId(res.data.tenantId)
this.getList() this.getList()
if (res.data.type == 'jl') { if (res.data.type == 'jl') {
@ -160,6 +163,8 @@
setCoachId(res.data.userId) setCoachId(res.data.userId)
setStaffType('01') setStaffType('01')
} }
console.log('getCoachId', getCoachId())
console.log('getStaffType', getStaffType())
} }
}) })
}, },

View File

@ -3,7 +3,7 @@
{ {
"path": "newPages/newIndex/index", "path": "newPages/newIndex/index",
"style": { "style": {
"enablePullDownRefresh": true, "enablePullDownRefresh": false,
"navigationBarTitleText": "首页", "navigationBarTitleText": "首页",
"navigationStyle": "custom" "navigationStyle": "custom"
} }

View File

@ -1,157 +1,171 @@
<template> <template>
<view class="page flex-col"> <view class="page flex-col">
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;"> <view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
<headers titles="课程详情"> <headers titles="课程详情">
<uni-icons type="left" color="#000000" size="22px"></uni-icons> <uni-icons type="left" color="#000000" size="22px"></uni-icons>
</headers> </headers>
</view> </view>
<view class="group_3 flex-col"> <scroll-view :style="{ height: scrollHeight + 'px' }" scroll-y="true" class="scroll-view">
<image <view class="group_3 flex-col">
style="width: 100%; height: 100%;" <image style="width: 100%; height: 100%;" :src="imagesUrl + '/' + courseDetails.photo" />
:src="imagesUrl + '/' + courseDetails.photo" </view>
/> <view class="group_4 flex-col">
</view> <view class="section_2 flex-row justify-between">
<view class="group_4 flex-col"> <view class="text-wrapper_1">
<view class="section_2 flex-row justify-between"> <text class="text_3"></text>
<view class="text-wrapper_1"> <text class="text_4">{{ courseDetails.price ? courseDetails.price.toFixed(2) : '--' }}</text>
<text class="text_3"></text> </view>
<text class="text_4">{{ courseDetails.price ? courseDetails.price.toFixed(2) : '--' }}</text> <!-- <text class="text_5">3000.00</text>-->
</view> </view>
<!-- <text class="text_5">3000.00</text>--> <text class="text_6">{{ courseDetails.name }}</text>
</view> <view class="section_3 flex-row justify-between">
<text class="text_6">{{ courseDetails.name }}</text> <view class="text-wrapper_2 flex-col">
<view class="section_3 flex-row justify-between"> <text class="text_7">{{ courseDetails.tittle }}</text>
<view class="text-wrapper_2 flex-col"> </view>
<text class="text_7">{{ courseDetails.tittle }}</text> <view class="text-wrapper_3 flex-col">
</view> <text class="text_8">{{ courseDetails.type }}</text>
<view class="text-wrapper_3 flex-col"> </view>
<text class="text_8">{{ courseDetails.type }}</text> </view>
</view> <text class="text_9">周一至周日&nbsp;08:00-18:00</text>
</view> </view>
<text class="text_9">周一至周日&nbsp;08:00-18:00</text> <view class="group_5 flex-col">
</view> <view class="section_4 flex-row justify-between">
<view class="group_5 flex-col"> <view class="block_3 flex-col"></view>
<view class="section_4 flex-row justify-between"> <text class="text_10">课程介绍</text>
<view class="block_3 flex-col"></view> </view>
<text class="text_10">课程介绍</text> <view class="u-content" v-if="courseDetails.remark">
</view> <u-parse :content="courseDetails.remark"></u-parse>
<view class="u-content" v-if="courseDetails.remark"> </view>
<u-parse :content="courseDetails.remark"></u-parse> <view class="u-content" v-else>
</view> <u-empty mode="list" text="该课程没有简介...">
<view class="u-content" v-else> </u-empty>
<u-empty </view>
mode="list" </view>
text="该课程没有简介..." </scroll-view>
> <view class="group_6 flex-row">
</u-empty> <view class="image-text_1 flex-col justify-between" @click="zxkf()">
</view> <image class="label_2" referrerpolicy="no-referrer"
</view> src="/static/lanhu_kechengxiangqing/FigmaDDSSlicePNG283b4603035848d5dcc7209d10653327.png" />
<view class="group_6 flex-row"> <text class="text-group_1">咨询客服</text>
<view class="image-text_1 flex-col justify-between" @click="zxkf()"> </view>
<image <view class="text-wrapper_4 flex-col" @click="goRegisterNow()">
class="label_2" <text class="text_11">立即报名</text>
referrerpolicy="no-referrer" </view>
src="/static/lanhu_kechengxiangqing/FigmaDDSSlicePNG283b4603035848d5dcc7209d10653327.png" </view>
/> </view>
<text class="text-group_1">咨询客服</text>
</view>
<view class="text-wrapper_4 flex-col" @click="goRegisterNow()">
<text class="text_11">立即报名</text>
</view>
</view>
</view>
</template> </template>
<script> <script>
import request from "@/utils/request"; import request from "@/utils/request";
import config from "@/config.js" import config from "@/config.js"
import {getLocalUserInfo, getUserInfo, getToken} from "@/utils/auth"; import {
import headers from "@/components/header/headers.vue"; getLocalUserInfo,
getUserInfo,
getToken
} from "@/utils/auth";
import headers from "@/components/header/headers.vue";
export default { export default {
components: {headers}, components: {
data() { headers
return { },
courseId: undefined, data() {
tenantId: undefined, return {
courseDetails: [], courseId: undefined,
driveSchoolPhone: [], tenantId: undefined,
imagesUrl: config.imagesUrl, courseDetails: [],
userDetails: [], driveSchoolPhone: [],
}; imagesUrl: config.imagesUrl,
}, userDetails: [],
onLoad(options) { scrollHeight: 0,
this.courseId = options.courseId; };
this.tenantId = options.tenantId; },
this.getCourseDetails(); onLoad(options) {
this.userDetails = getLocalUserInfo(); this.courseId = options.courseId;
this.getServicePhone() this.tenantId = options.tenantId;
}, this.getCourseDetails();
methods: { this.userDetails = getLocalUserInfo();
goBack() { this.getServicePhone()
uni.navigateBack({ },
delta: 1 onReady() {
}); //
}, this.calculateScrollHeight();
getCourseDetails() { },
request({ methods: {
url: '/app-api/dl-drive-school-course-small/get', goBack() {
method: 'GET', uni.navigateBack({
params: { delta: 1
id: this.courseId, });
tenantId: this.tenantId, },
}, getCourseDetails() {
tenantIdFlag: false request({
}).then(res => { url: '/app-api/dl-drive-school-course-small/get',
this.courseDetails = res.data; method: 'GET',
}) params: {
}, id: this.courseId,
zxkf() { tenantId: this.tenantId,
uni.makePhoneCall({ },
phoneNumber: this.driveSchoolPhone.phone tenantIdFlag: false
}); }).then(res => {
}, this.courseDetails = res.data;
getServicePhone() { })
request({ },
url: '/app-api/dl-drive-school-course-small/getServicePhone', zxkf() {
method: 'GET', uni.makePhoneCall({
params: { phoneNumber: this.driveSchoolPhone.phone
tenantId: this.tenantId, });
} },
}).then(res => { getServicePhone() {
this.driveSchoolPhone = res.data request({
}) url: '/app-api/dl-drive-school-course-small/getServicePhone',
}, method: 'GET',
params: {
tenantId: this.tenantId,
}
}).then(res => {
this.driveSchoolPhone = res.data
})
},
goRegisterNow() { calculateScrollHeight() {
console.log('token',getToken()) //
if (!getToken()) { const screenHeight = uni.getSystemInfoSync().windowHeight;
uni.showModal({ //
title: '未登录', const topHeight = 166;
content: '请先登录', //
confirmText: '去登录', this.scrollHeight = screenHeight - topHeight;
success: (res) => { },
if (res.confirm) {
uni.navigateTo({ goRegisterNow() {
url: '/pages/login/login' console.log('token', getToken())
}); if (!getToken()) {
uni.showModal({
title: '未登录',
content: '请先登录',
confirmText: '去登录',
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: '/pages/login/login'
});
}
}
});
return;
} }
} uni.navigateTo({
}); url: `/pagesA/register/index?courseId=${this.courseDetails.id}&userId=${this.userDetails.id}&tenantId=${this.tenantId}`,
return; // url: '/pages/index/bmPage'
});
},
} }
uni.navigateTo({ };
url: `/pagesA/register/index?courseId=${this.courseDetails.id}&userId=${this.userDetails.id}&tenantId=${this.tenantId}`,
// url: '/pages/index/bmPage'
});
},
}
};
</script> </script>
<style lang='scss'> <style lang='scss'>
@import '../common/common.scss'; @import '../common/common.scss';
@import './assets/style/index.rpx.scss'; @import './assets/style/index.rpx.scss';
.u-content{
margin-top: 20rpx; .u-content {
padding: 10rpx; margin-top: 20rpx;
} padding: 10rpx;
</style> }
</style>