init version kelfy-mini for new gitea
This commit is contained in:
151
pages/message/message.js
Normal file
151
pages/message/message.js
Normal file
@@ -0,0 +1,151 @@
|
||||
// pages/message/message.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
content:'',
|
||||
id:'',
|
||||
msgList:'',
|
||||
state:'',
|
||||
ImgMsg:'',
|
||||
url:'',
|
||||
},
|
||||
getList(){
|
||||
wx.request({
|
||||
url:'https://fy.btlsoln.com:8443/findMedicalGuideById?medical_guide_id',
|
||||
// url:'http://sayetest.f3322.org:5000/findMedicalGuideById?medical_guide_id',
|
||||
method:"GET",
|
||||
data:{
|
||||
medical_guide_id:this.data.id
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res)=> {
|
||||
let data = res.data
|
||||
data.map((item,index) => {
|
||||
console.log(item,'item')
|
||||
let str = item.CONTENT
|
||||
var html = str.replaceAll("/showFile",'https://fy.btlsoln.com:8443/showFile')
|
||||
var html2 = html.replaceAll("<img",'<img class="img"')
|
||||
item.CONTENT = html2
|
||||
return data
|
||||
})
|
||||
this.setData({
|
||||
msgList:res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getImgMsg(){
|
||||
wx.request({
|
||||
url:'https://fy.btlsoln.com:8443/findHospitalNotice?hos_notice_id',
|
||||
// url:'http://sayetest.f3322.org:5000/findMedicalGuideById?medical_guide_id',
|
||||
method:"GET",
|
||||
data:{
|
||||
hos_notice_id:this.data.imgId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res)=> {
|
||||
// console.log(res.data,"图片说明")
|
||||
let data = res.data
|
||||
data.map((item,index) => {
|
||||
let str = item.CONTENT
|
||||
|
||||
var html = str.replaceAll("/showFile",'https://fy.btlsoln.com:8443/showFile')
|
||||
// var html2 = html.replaceAll("<img",'<img class="img"')
|
||||
var html2 = html.replaceAll(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;margin:10px 0;"')
|
||||
item.CONTENT = html2
|
||||
console.log(str,"图片说明")
|
||||
return data
|
||||
})
|
||||
|
||||
// console.log(data,"1111111111")
|
||||
this.setData({
|
||||
ImgMsg:res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
console.log(options)
|
||||
this.setData({
|
||||
url:app.globalData.url2,
|
||||
})
|
||||
this.setData({
|
||||
state:options.state
|
||||
})
|
||||
if(options.state == 0){
|
||||
this.setData({
|
||||
content:options.content,
|
||||
})
|
||||
}else if(options.state == 1){
|
||||
this.setData({
|
||||
id:options.id
|
||||
})
|
||||
this.getList()
|
||||
}else if(options.state == 3){
|
||||
this.setData({
|
||||
imgId:options.imgId
|
||||
})
|
||||
this.getImgMsg()
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
3
pages/message/message.json
Normal file
3
pages/message/message.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
17
pages/message/message.wxml
Normal file
17
pages/message/message.wxml
Normal file
@@ -0,0 +1,17 @@
|
||||
<!--pages/notification/notification.wxml-->
|
||||
<view class="main">
|
||||
<view class="content" wx:if="{{state == 0}}">
|
||||
<view class="wrap"> {{content}}</view>
|
||||
</view>
|
||||
<view class="content" wx:elif="{{state == 1}}">
|
||||
<view wx:for="{{msgList}}" wx:key="item">
|
||||
<rich-text nodes="{{item.CONTENT}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content" wx:elif="{{state == 3}}">
|
||||
<view wx:for="{{ImgMsg}}" wx:key="item">
|
||||
<image src="{{url}}{{item.IMG}}" class="img"></image>
|
||||
<rich-text nodes="{{item.CONTENT}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
42
pages/message/message.wxss
Normal file
42
pages/message/message.wxss
Normal file
@@ -0,0 +1,42 @@
|
||||
/* pages/notification/notification.wxss */
|
||||
.main{
|
||||
margin: 30rpx 0;
|
||||
width: 750rpx;
|
||||
}
|
||||
.content{
|
||||
height: 100%;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.wrap{
|
||||
height: 150rpx;
|
||||
width: 100%;
|
||||
border-radius: 5rpx;
|
||||
margin: 40rpx auto;
|
||||
box-shadow:0px 0px 15rpx #e2e2e2;
|
||||
padding:0 30rpx;
|
||||
box-sizing: border-box;
|
||||
color: #333;
|
||||
font-size: 33rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.img{
|
||||
height: 350rpx;
|
||||
width: 100%;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
.imgWrap{
|
||||
height: 350rpx;
|
||||
width: 100%;
|
||||
margin: 20rpx auto;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
.text{
|
||||
width: 100%;
|
||||
margin-top: 20rpx;
|
||||
color: #555;
|
||||
font-size: 35rpx;
|
||||
line-height: 180%
|
||||
}
|
||||
Reference in New Issue
Block a user