通知公告详情、我的

This commit is contained in:
itgaojian 2023-12-08 11:30:29 +08:00
parent 41c8e18d3f
commit 0ff44afa1e
28 changed files with 256 additions and 70 deletions

View File

@ -12,7 +12,8 @@
"pages/chooseArea/chooseArea", "pages/chooseArea/chooseArea",
"pages/censusDetail/censusDetail", "pages/censusDetail/censusDetail",
"pages/censusEdit/censusEdit", "pages/censusEdit/censusEdit",
"pages/caseHistory/caseHistory" "pages/caseHistory/caseHistory",
"pages/newsDetail/newsDetail"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",

8
components/mp-html/index.js Executable file
View File

@ -0,0 +1,8 @@
"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}/*!
* mp-html v2.4.2
* https://github.com/jin-yufeng/mp-html
*
* Released under the MIT license
* Author: Jin Yufeng
*/
var t=require("./parser"),n=[];Component({data:{nodes:[]},properties:{containerStyle:String,content:{type:String,value:"",observer:function(e){this.setContent(e)}},copyLink:{type:Boolean,value:!0},domain:String,errorImg:String,lazyLoad:Boolean,loadingImg:String,pauseVideo:{type:Boolean,value:!0},previewImg:{type:Boolean,value:!0},scrollTable:Boolean,selectable:null,setTitle:{type:Boolean,value:!0},showImgMenu:{type:Boolean,value:!0},tagStyle:Object,useAnchor:null},created:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this))},detached:function(){this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var i=this;return new Promise(function(o,r){if(!i.data.useAnchor)return void r(Error("Anchor is disabled"));var a=wx.createSelectorQuery().in(i._in?i._in.page:i).select((i._in?i._in.selector:"._root")+(t?"".concat(">>>","#").concat(t):"")).boundingClientRect();i._in?a.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])return void r(Error("Label not found"));var a=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(i.data.useAnchor)||0);i._in?i._in.page.setData(e({},i._in.scrollTop,a)):wx.pageScrollTo({scrollTop:a,duration:300}),o()})})},getText:function(e){var t="";return function e(n){for(var i=0;i<n.length;i++){var o=n[i];if("text"===o.type)t+=o.text.replace(/&amp;/g,"&");else if("br"===o.name)t+="\n";else{var r="p"===o.name||"div"===o.name||"tr"===o.name||"li"===o.name||"h"===o.name[0]&&o.name[1]>"0"&&o.name[1]<"7";r&&t&&"\n"!==t[t.length-1]&&(t+="\n"),o.children&&e(o.children),r&&"\n"!==t[t.length-1]?t+="\n":"td"!==o.name&&"th"!==o.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){var e=this;return new Promise(function(t,n){wx.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e){return e[0]?t(e[0]):n(Error("Root label not found"))})})},pauseMedia:function(){for(var e=(this._videos||[]).length;e--;)this._videos[e].pause()},setPlaybackRate:function(e){this.playbackRate=e;for(var t=(this._videos||[]).length;t--;)this._videos[t].playbackRate(e)},setContent:function(e,n){var i=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var o={},r=new t(this).parse(e);if(n)for(var a=this.data.nodes.length,s=r.length;s--;)o["nodes[".concat(a+s,"]")]=r[s];else o.nodes=r;if(this.setData(o,function(){i._hook("onLoad"),i.triggerEvent("load")}),this.data.lazyLoad||this.imgList._unloadimgs<this.imgList.length/2){var l=0,c=function e(t){t&&t.height||(t={}),t.height===l?i.triggerEvent("ready",t):(l=t.height,setTimeout(function(){i.getRect().then(e).catch(e)},350))};this.getRect().then(c).catch(c)}else this.imgList._unloadimgs||this.getRect().then(function(e){i.triggerEvent("ready",e)}).catch(function(){i.triggerEvent("ready",{})})},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.detail.root=this}}});

1
components/mp-html/index.json Executable file
View File

@ -0,0 +1 @@
{"component":true,"usingComponents":{"node":"./node/node"}}

1
components/mp-html/index.wxml Executable file
View File

@ -0,0 +1 @@
<view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}"><slot wx:if="{{!nodes[0]}}"/><node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}" catchadd="_add"/></view>

1
components/mp-html/index.wxss Executable file
View File

@ -0,0 +1 @@
._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text}

View File

@ -0,0 +1 @@
"use strict";function t(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}Component({data:{ctrl:{},isiOS:wx.getSystemInfoSync().system.includes("iOS")},properties:{childs:Array,opts:Array},options:{addGlobalClass:!0},attached:function(){this.triggerEvent("add",this,{bubbles:!0,composed:!0})},methods:{noop:function(){},getNode:function(t){try{for(var e=t.split("_"),i=this.data.childs[e[0]],r=1;r<e.length;r++)i=i.children[e[r]];return i}catch(t){return{text:"",attrs:{},children:[]}}},play:function(t){if(this.root.triggerEvent("play"),this.root.data.pauseVideo){for(var e=!1,i=t.target.id,r=this.root._videos.length;r--;)this.root._videos[r].id===i?e=!0:this.root._videos[r].pause();if(!e){var o=wx.createVideoContext(i,this);o.id=i,this.root.playbackRate&&o.playbackRate(this.root.playbackRate),this.root._videos.push(o)}}},imgTap:function(t){var e=this.getNode(t.target.dataset.i);if(e.a)return this.linkTap(e.a);if(!e.attrs.ignore&&(this.root.triggerEvent("imgtap",e.attrs),this.root.data.previewImg)){var i=this.root.imgList[e.i];wx.previewImage({showmenu:this.root.data.showImgMenu,current:i,urls:this.root.imgList})}},imgLoad:function(e){var i,r=e.target.dataset.i,o=this.getNode(r);o.w?(this.data.opts[1]&&!this.data.ctrl[r]||-1===this.data.ctrl[r])&&(i=1):i=e.detail.width,i&&this.setData(t({},"ctrl."+r,i)),this.checkReady()},checkReady:function(){var t=this;this.root.data.lazyLoad||(this.root.imgList._unloadimgs-=1,this.root.imgList._unloadimgs||setTimeout(function(){t.root.getRect().then(function(e){t.root.triggerEvent("ready",e)}).catch(function(){t.root.triggerEvent("ready",{})})},350))},linkTap:function(t){var e=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},i=e.attrs||t,r=i.href;this.root.triggerEvent("linktap",Object.assign({innerText:this.root.getText(e.children||[])},i)),r&&("#"===r[0]?this.root.navigateTo(r.substring(1)).catch(function(){}):r.split("?")[0].includes("://")?this.root.data.copyLink&&wx.setClipboardData({data:r,success:function(){return wx.showToast({title:"链接已复制"})}}):wx.navigateTo({url:r,fail:function(){wx.switchTab({url:r,fail:function(){}})}}))},mediaError:function(e){var i=e.target.dataset.i,r=this.getNode(i);if("video"===r.name||"audio"===r.name){var o=(this.data.ctrl[i]||0)+1;if(o>r.src.length&&(o=0),o<r.src.length)return this.setData(t({},"ctrl."+i,o))}else"img"===r.name&&(this.data.opts[2]&&this.setData(t({},"ctrl."+i,-1)),this.checkReady());this.root&&this.root.triggerEvent("error",{source:r.name,attrs:r.attrs,errMsg:e.detail.errMsg})}}});

View File

@ -0,0 +1 @@
{"component":true,"usingComponents":{"node":"./node"}}

View File

@ -0,0 +1 @@
<wxs module="isInline">var e={abbr:!0,b:!0,big:!0,code:!0,del:!0,em:!0,i:!0,ins:!0,label:!0,q:!0,small:!0,span:!0,strong:!0,sub:!0,sup:!0};module.exports=function(n,i){return e[n]||-1!==(i||"").indexOf("inline")};</wxs><template name="el"><block wx:if="{{n.name==='img'}}"><rich-text wx:if="{{n.t}}" style="display:{{n.t}}" nodes="<img class='_img' style='{{n.attrs.style}}' src='{{n.attrs.src}}'>" data-i="{{i}}" catchtap="imgTap"/><block wx:else><image wx:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]===-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{!n.h?'widthFix':(!n.w?'heightFix':'')}}" lazy-load="{{opts[0]}}" webp="{{n.webp}}" show-menu-by-longpress="{{opts[3]&&!n.attrs.ignore}}" data-i="{{i}}" bindload="imgLoad" binderror="mediaError" catchtap="imgTap" bindlongpress="noop"/></block></block><text wx:elif="{{n.text}}" user-select="{{opts[4]=='force'&&isiOS}}" decode>{{n.text}}</text><text wx:elif="{{n.name==='br'}}">\n</text><view wx:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"><node childs="{{n.children}}" opts="{{opts}}" style="display:inherit"/></view><video wx:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><audio wx:elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><rich-text wx:else id="{{n.attrs.id}}" style="{{n.f}}" user-select="{{opts[4]}}" nodes="{{[n]}}"/></template><block wx:for="{{childs}}" wx:for-item="n1" wx:for-index="i1" wx:key="i1"><template wx:if="{{!n1.c&&(!n1.children||n1.name==='a'||!isInline(n1.name,n1.attrs.style))}}" is="el" data="{{n:n1,i:''+i1,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n1.attrs.id}}" class="_{{n1.name}} {{n1.attrs.class}}" style="{{n1.attrs.style}}"><block wx:for="{{n1.children}}" wx:for-item="n2" wx:for-index="i2" wx:key="i2"><template wx:if="{{!n2.c&&(!n2.children||n2.name==='a'||!isInline(n2.name,n2.attrs.style))}}" is="el" data="{{n:n2,i:i1+'_'+i2,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n2.attrs.id}}" class="_{{n2.name}} {{n2.attrs.class}}" style="{{n2.attrs.style}}"><block wx:for="{{n2.children}}" wx:for-item="n3" wx:for-index="i3" wx:key="i3"><template wx:if="{{!n3.c&&(!n3.children||n3.name==='a'||!isInline(n3.name,n3.attrs.style))}}" is="el" data="{{n:n3,i:i1+'_'+i2+'_'+i3,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n3.attrs.id}}" class="_{{n3.name}} {{n3.attrs.class}}" style="{{n3.attrs.style}}"><block wx:for="{{n3.children}}" wx:for-item="n4" wx:for-index="i4" wx:key="i4"><template wx:if="{{!n4.c&&(!n4.children||n4.name==='a'||!isInline(n4.name,n4.attrs.style))}}" is="el" data="{{n:n4,i:i1+'_'+i2+'_'+i3+'_'+i4,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n4.attrs.id}}" class="_{{n4.name}} {{n4.attrs.class}}" style="{{n4.attrs.style}}"><block wx:for="{{n4.children}}" wx:for-item="n5" wx:for-index="i5" wx:key="i5"><template wx:if="{{!n5.c&&(!n5.children||n5.name==='a'||!isInline(n5.name,n5.attrs.style))}}" is="el" data="{{n:n5,i:i1+'_'+i2+'_'+i3+'_'+i4+'_'+i5,opts:opts,ctrl:ctrl}}"/><node wx:else id="{{n5.attrs.id}}" class="_{{n5.name}} {{n5.attrs.class}}" style="{{n5.attrs.style}}" childs="{{n5.children}}" opts="{{opts}}"/></block></view></block></view></block></view></block></view></block>

View File

@ -0,0 +1 @@
._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline}._blockquote,._div,._p{display:block}

1
components/mp-html/parser.js Executable file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@ var ModeItem;
const DATE_MODES = ['year', 'month', 'date']; const DATE_MODES = ['year', 'month', 'date'];
const TIME_MODES = ['hour', 'minute', 'second']; const TIME_MODES = ['hour', 'minute', 'second'];
const FULL_MODES = [...DATE_MODES, ...TIME_MODES]; const FULL_MODES = [...DATE_MODES, ...TIME_MODES];
const DEFAULT_MIN_DATE = dayjs('1930-01-01 00:00:00'); const DEFAULT_MIN_DATE = dayjs('2000-01-01 00:00:00');
const DEFAULT_MAX_DATE = dayjs('2030-12-31 23:59:59'); const DEFAULT_MAX_DATE = dayjs('2030-12-31 23:59:59');
let DateTimePicker = class DateTimePicker extends SuperComponent { let DateTimePicker = class DateTimePicker extends SuperComponent {
constructor() { constructor() {

6
package-lock.json generated
View File

@ -9,6 +9,7 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"mp-html": "^2.4.2",
"tdesign-miniprogram": "^1.2.4" "tdesign-miniprogram": "^1.2.4"
} }
}, },
@ -17,6 +18,11 @@
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
}, },
"node_modules/mp-html": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/mp-html/-/mp-html-2.4.2.tgz",
"integrity": "sha512-MSfJh5ckuaI2uibeO4qiUl2e/j5fpXy6cmW/ZzSkb+U3rTJfMSNzODqrDwG0YWOd8BVI+tD9/jLZiBhJbMupUg=="
},
"node_modules/tdesign-miniprogram": { "node_modules/tdesign-miniprogram": {
"version": "1.2.4", "version": "1.2.4",
"resolved": "https://registry.npmjs.org/tdesign-miniprogram/-/tdesign-miniprogram-1.2.4.tgz", "resolved": "https://registry.npmjs.org/tdesign-miniprogram/-/tdesign-miniprogram-1.2.4.tgz",

View File

@ -13,6 +13,7 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"mp-html": "^2.4.2",
"tdesign-miniprogram": "^1.2.4" "tdesign-miniprogram": "^1.2.4"
} }
} }

View File

@ -77,6 +77,12 @@ Page({
list: _self.data.list.concat(data.rows) list: _self.data.list.concat(data.rows)
}) })
} }
}, (code, error) => {
wx.hideLoading()
wx.showToast({
title: '加载失败',
icon: 'error'
})
}); });
}, },
onScrollRefresh() { onScrollRefresh() {

View File

@ -137,5 +137,11 @@ Page({
wx.navigateTo({ wx.navigateTo({
url: '/pages/caseHistory/caseHistory', url: '/pages/caseHistory/caseHistory',
}) })
} },
goNewDetail(e) {
var id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '/pages/newsDetail/newsDetail?id=' + id,
})
},
}) })

View File

@ -37,7 +37,7 @@
<text class="notice-title">通知公告</text> <text class="notice-title">通知公告</text>
<scroll-view scroll-y class="scroll-content" style="height: {{scrollHeight}}px;" refresher-enabled="{{true}}" refresher-threshold="{{100}}" refresher-default-style="black" refresher-background="white" refresher-triggered="{{triggered}}" bindrefresherrefresh="onScrollRefresh" enhanced="true" show-scrollbar="false" bindscrolltolower="onLoadMore"> <scroll-view scroll-y class="scroll-content" style="height: {{scrollHeight}}px;" refresher-enabled="{{true}}" refresher-threshold="{{100}}" refresher-default-style="black" refresher-background="white" refresher-triggered="{{triggered}}" bindrefresherrefresh="onScrollRefresh" enhanced="true" show-scrollbar="false" bindscrolltolower="onLoadMore">
<block wx:if="{{list.length>0}}"> <block wx:if="{{list.length>0}}">
<view class="notice-item" wx:for="{{list}}" wx:for-index="index" wx:for-item="listItem" wx:key="index"> <view class="notice-item" wx:for="{{list}}" wx:for-index="index" wx:for-item="listItem" wx:key="index" data-id="{{listItem.newsId}}" bind:tap="goNewDetail">
<view class="news-title">{{listItem.newsTitle}}</view> <view class="news-title">{{listItem.newsTitle}}</view>
<view class="news-desc"> <view class="news-desc">
<view class="news-desc-source">{{listItem.newsAuthor}}</view> <view class="news-desc-source">{{listItem.newsAuthor}}</view>

View File

@ -58,7 +58,7 @@ page {
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-top: 47px; margin-top: 50px;
width: 93%; width: 93%;
align-self: center; align-self: center;
} }

View File

@ -1,66 +1,37 @@
// pages/mine.js // pages/mine.js
const app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
token: '',
userName: '微信用户',
userIcon: '/images/default-avatar.png'
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
var _self = this;
wx.getUserInfo({
success: res => {
_self.setData({
userIcon: res.userInfo.avatarUrl,
})
}
});
}, },
goReport() {
/** wx.navigateTo({
* 生命周期函数--监听页面初次渲染完成 url: '/pages/caseHistory/caseHistory',
*/ })
onReady() {
}, },
goCheck() {
/** wx.navigateTo({
* 生命周期函数--监听页面显示 url: '/pages/waitCheck/waitCheck',
*/ })
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
} }
}) })

View File

@ -1,2 +1,13 @@
<!--pages/mine.wxml--> <!--pages/mine.wxml-->
<text>pages/mine.wxml</text> <view class="title-box">
<image src="{{userIcon}}"></image>
<view class="name">{{userName}}</view>
</view>
<view class="row first" bind:tap="goReport" >
<image src="/images/ic_report_item_icon.png" mode="aspectFill"></image>
<view class="text">上报历史</view>
</view>
<view class="row" bind:tap="goCheck">
<image src="/images/ic_check_item_icon.png" mode="aspectFill"></image>
<view class="text">待检查</view>
</view>

View File

@ -1 +1,50 @@
/* pages/mine.wxss */ /* pages/mine.wxss */
page {
background: #FFFFFF;
}
.title-box {
width: 100%;
height: 120px;
background-color: #4985f8;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
padding: 0px 20px;
}
.title-box image {
width: 64px;
height: 64px;
border-radius: 50%;
}
.title-box .name {
color: #FFFFFF;
margin-left: 15px;
}
.row {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
padding: 10px;
}
.first {
border-bottom-color: #f2f1f6;
border-bottom-width: 1px;
border-bottom-style: solid;
margin-top: 20px;
}
.row image {
width: 23px;
height: 23px;
}
.row .text {
margin-left: 5px;
}

View File

@ -0,0 +1,56 @@
// pages/newsDetail/newsDetail.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
token: '',
id: '',
bean: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var _self = this;
_self.setData({
id: options.id
})
wx.getStorage({
key: 'token',
success: function (res) {
_self.setData({
token: res.data
})
_self.getNewsDetail();
}
})
},
getNewsDetail() {
var _self = this;
wx.showLoading({
title: '加载中...',
})
app.restAjax.get(app.restAjax.path('{reqesutUrl}app/news/get/' + _self.data.id, [app.requestUrl]), null, {
headers: {
token: _self.data.token
}
}, function (code, data) {
wx.hideLoading();
_self.setData({
bean: data
})
}, (code, error) => {
wx.hideLoading();
wx.showToast({
title: '加载失败',
icon: 'error'
})
});
}
})

View File

@ -0,0 +1,8 @@
{
"usingComponents": {
"mp-html": "/components/mp-html/index"
},
"navigationBarBackgroundColor": "#4583FE",
"navigationBarTitleText": "通知公告",
"navigationBarTextStyle": "white"
}

View File

@ -0,0 +1,12 @@
<view class="container-box">
<view class="news-title-box">
<view>{{bean.newsTitle}}</view>
<view class="news-title-desc">
<view>发布人:{{bean.newsAuthor}}</view>
<view>发布时间:{{bean.newsTime}}</view>
</view>
</view>
<view class="content-box">
<mp-html content="{{bean.newsContent}}"></mp-html>
</view>
</view>

View File

@ -0,0 +1,41 @@
/* pages/newsDetail/newsDetail.wxss */
page {
background-color: #EFEFEF;
}
.container-box {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
margin-top: 5px;
}
.news-title-box {
background-color: #FFFFFF;
width: 89%;
padding: 10px;
border-radius: 10px;
}
.news-title-desc {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
font-size: 12px;
color: #999999;
margin-top: 10px;
}
.content-box {
background-color: #FFFFFF;
width: 89%;
padding: 10px;
border-radius: 10px;
margin-top: 10px;
font-size: 14px;
color: #6C6C6C;
}

View File

@ -25,6 +25,8 @@
"useMultiFrameRuntime": true, "useMultiFrameRuntime": true,
"useApiHook": true, "useApiHook": true,
"useApiHostProcess": true, "useApiHostProcess": true,
"ignoreDevUnusedFiles": false,
"ignoreUploadUnusedFiles": false,
"babelSetting": { "babelSetting": {
"ignore": [], "ignore": [],
"disablePlugins": [], "disablePlugins": [],