xc-app/pages/mine/noticeDetail.vue

121 lines
2.8 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="notice-detail-page">
<NavCom title="我的公告"></NavCom>
<image src="@/static/mine/lb.png" mode="" class="bg"></image>
<scroll-view @scrolltolower="lowerBottom" scroll-y="true" class="main" >
<view class="title">{{detailData.title}}</view>
<view class="time">发布时间{{formatDateTime(detailData.createdAt)}}</view>
<view class="contents">
<view class="ql-snow">
<view class="ql-editor content" v-html="detailData.content"></view>
</view>
</view>
</scroll-view>
<!-- 所有页面的弹框 -->
<page-popup page="/pages/mine/noticeDetail"></page-popup>
</view>
</template>
<script>
import { myMixins } from "@/mixins/mixins.js";
import { noticeDetail } from '@/API/user.js'
import NavCom from '@/pages/components/nav.vue'
import uParse from '@/components/u-parse/u-parse.vue'
export default {
mixins: [myMixins],
data(){
return{
id:"",
detailData:{}
}
},
components:{uParse,NavCom},
onLoad(opation) {
this.id = opation.id
this.getDetail()
},
mounted() {
},
methods:{
formatDateTime(value) {
if (!value) return '';
const date = new Date(value);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
navigate(href, e) {
//比如点击a标签打开某个webview并传输url
location.href= href
// uni.navigateTo({
// url: '/pages/goodsDetail/webView?url=' + href
// })
},
getDetail(){
uni.showLoading()
noticeDetail(this.id,{id:this.id}).then(res => {
uni.hideLoading()
if(res.code === 200){
console.log(res)
this.detailData = res.data
}else{
this.$api.msg(res.message)
}
}).catch(err => {
uni.hideLoading()
})
}
}
}
</script>
<style>
@import url('@/static/quill.snow.css');
</style>
<style lang="scss">
page{
background-image: url('@/static/index/bg.png');
background-size: 100%;
}
.notice-detail-page{
.bg{
position: fixed;top: 0;
right: 0;
width: 174rpx;
height: 167rpx;
z-index: 1;
}
.main{
padding-top: 130rpx;
.title{
font-weight: bold;
font-size: 26rpx;
color: #333333;
padding: 0 55rpx;
}
.time{
font-size: 20rpx;
color: #888888;
padding: 0 55rpx;
margin-top: 22rpx;
}
.contents{
padding: 0 55rpx;
margin-top: 30rpx;
.content{
padding: 0;
overflow: hidden;
}
}
}
}
</style>