| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <template>
- <view>
- <u-toast ref="uToast"/>
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
- <view @click="goDetail(item)" class="card" v-for="(item,index) in dataList" :key="index">
- <view class="title">
- <view class="text-cut-1">
- <text class="text-bold">标题:</text>
- <text class="">{{item.title}}</text>
- </view>
- <view class="time">
- <text class="cuIcon-time padding-right-10"></text>
- <text>{{new Date(item.createTime).getTime() | date('yyyy-mm-dd') }}</text>
- </view>
- </view>
- <view class="content ">
- <text class="text-cut-2">{{item.notice | formatHtml}}</text>
- </view>
- <view class="bottom">
- <view @click.stop="delItem(item)" class="cu-btn line-red round sm">
- <u-icon top="-1" name="trash-fill" size="25"></u-icon>
- <text class="padding-left-10">删除公告</text>
- </view>
- </view>
- </view>
- </mescroll-body>
- <!-- <view @click="add" style="position: fixed;bottom: 25%;right: 20rpx;">
- <view class="cuIcon cu-btn base-bg-color" style="width: 80rpx;height: 80rpx;">
- <text class="cuIcon-add" style="font-size: 60rpx;"></text>
- </view>
- </view> -->
- <wm-list-add ref="add" @clickAdd="add"/>
- </view>
- </template>
- <script>
- import wmListAdd from '@/components/wm-list-add/wm-list-add';
- import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
- export default {
- mixins:[MescrollMixin],
- components:{
- wmListAdd
- },
- data() {
- return {
- agencyId:'',
- isFirst:false,
-
- dataList:[],
- downOption: {
- use: true,
- auto: false
- },
- upOption: {
- auto: false,
- page: {
- page: 0,
- size: 10
- },
- noMoreSize: 3,
- empty: {
- tip: '暂无相关数据'
- }
- },
- }
- },
- filters: {
- formatHtml (str) {
- return str.replace(/<[^>]+>/g, "");
- }
- },
- onShow() {
- this.mescroll.resetUpScroll()
- },
- onLoad() {
- },
- methods: {
- goDetail(item){
- getApp().globalData.noticeDetail=item
- uni.navigateTo({
- url:"/pages/index/notice/detail",
- })
- },
- delItem(item){
- this.$showModel('确定要删除该公告吗?').then(res=>{
- this.$api.notice.remove(item.id).then(res=>{
- if (res.success) {
- this.$showToast('删除成功')
- setTimeout(()=>{
- this.mescroll.resetUpScroll()
- },500)
- }
- })
- })
- },
- add(){
- uni.navigateTo({
- url:"/pages/index/notice/add"
- })
- },
- /**
- * 下拉回调
- */
- downCallback(){
- setTimeout(()=>{
- this.mescroll.resetUpScroll()
- },1500)
- },
- /**
- * 上拉回调
- * @param {Object} mescroll
- */
- upCallback(mescroll) {
- try{
- let params={
- agencyId:this.$cache.get('agencyId'),
- current:mescroll.num,
- size:mescroll.size
- }
- this.$api.notice.page(params).then(res=>{
- let data=res.data.records
- let length=data.length
- let total=res.data.total
- mescroll.endBySize(length, total);
- if(mescroll.num == 1) this.dataList = [];
- this.dataList=this.dataList.concat(data);
- })
- }catch(e){
- mescroll.endErr();
- }
- },
- }
- }
- </script>
- <style lang="scss">
- .line-red{
- border: 1rpx solid #dc0000;
- color: #dc0000;
- }
-
- .card{
- background-color: #FFFFFF;
- border-radius: 20rpx;
- margin: 20rpx;
- .title{
- display: flex;
- justify-content: space-between;
- padding: 20rpx;
- font-size: 30rpx;
- border-bottom: 0.5rpx solid #e6e5e8;
-
- .time{
- padding-top: 8rpx;
- font-size: 28rpx;
- color: #8d8d8d;
- }
- }
- .content{
- color: #737373;
- height: 150rpx;
- padding:30rpx 20rpx;
- border-bottom: 1rpx dashed #e6e5e8;
- }
-
- .bottom{
- padding: 20rpx;
- display: flex;
- justify-content: flex-end;
- }
- }
- </style>
|