完成了登录模块
This commit is contained in:
52
pages/projectModule/projectNotice/projectNotice.js
Normal file
52
pages/projectModule/projectNotice/projectNotice.js
Normal file
@ -0,0 +1,52 @@
|
||||
const { baseUrl } = require('../../../request');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
title: '',
|
||||
createTime: '',
|
||||
content: '',
|
||||
id: null
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
// 1. 获取跳转传来的 id
|
||||
const id = options.id;
|
||||
this.setData({ id });
|
||||
|
||||
// 2. 拉取通知详情
|
||||
this.fetchNotificationDetail(id);
|
||||
},
|
||||
|
||||
fetchNotificationDetail(id) {
|
||||
const token = wx.getStorageSync('token');
|
||||
wx.request({
|
||||
url: baseUrl + '/projectNotification/mini/query/id', // 用你的实际接口
|
||||
method: 'POST',
|
||||
header: {
|
||||
Authorization: token
|
||||
},
|
||||
data: { id },
|
||||
success: (res) => {
|
||||
if (res.data.code === 1) {
|
||||
const detail = res.data.data || {};
|
||||
this.setData({
|
||||
title: detail.notificationTitle || '',
|
||||
createTime: detail.createTime || '',
|
||||
content: detail.notificationContent || ''
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.data.message || '获取通知失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
3
pages/projectModule/projectNotice/projectNotice.json
Normal file
3
pages/projectModule/projectNotice/projectNotice.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
7
pages/projectModule/projectNotice/projectNotice.wxml
Normal file
7
pages/projectModule/projectNotice/projectNotice.wxml
Normal file
@ -0,0 +1,7 @@
|
||||
<view class="flex-col page">
|
||||
<text class="self-start text">{{title}}</text>
|
||||
<text class="self-start text_2 mt-17">{{createTime}}</text>
|
||||
<view class="self-stretch section mt-17">
|
||||
<rich-text class="notification-content mt-17" nodes="{{content}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
25
pages/projectModule/projectNotice/projectNotice.wxss
Normal file
25
pages/projectModule/projectNotice/projectNotice.wxss
Normal file
@ -0,0 +1,25 @@
|
||||
.mt-17 {
|
||||
margin-top: 31.88rpx;
|
||||
}
|
||||
.page {
|
||||
padding: 45rpx 30rpx 978.75rpx;
|
||||
background-color: #ffffff;
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
.text {
|
||||
color: #000000;
|
||||
font-size: 30rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 27.99rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.text_2 {
|
||||
color: #969696;
|
||||
font-size: 22.5rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 26.25rpx;
|
||||
width: 256.25rpx;
|
||||
}
|
Reference in New Issue
Block a user