|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <template>
- <view id="notice" class="page">
- <l-upload-file
- v-if="fileList.length"
- :value="fileList"
- readonly
- title="附件"
- />
- <view class="padding text-lg">
- <u-parse v-if="ready&&contentType == 1" :imageProp="{ domain: apiRoot }" :content="content"></u-parse>
- <iframe v-if="ready&&contentType == 2" style="width: 100%;height: calc(100vh - 150px - 158px);" :src="CONFIG('webHost')+'/Utility/ListContentView?keyValue='+keyValue" frameborder="0"></iframe>
- </view>
- <view class="padding-sm text-grey notice-info">
- <view class="text-right">信息来源: {{ f_sourcename }}</view>
- <view class="text-right">本页内容发布于 {{ time }}</view>
- <view class="text-right">{{ date }}</view>
- </view>
- </view>
- </template>
-
- <script>
- import moment from 'moment'
-
- export default {
- data() {
- return {
- ready: false,
- content: '',
- time: '',
- classdata:new Array(),
- f_sourcename:'',
- date: '',
- contentType:'',
- keyValue:'',
- fileList:[],
- }
- },
-
- async onLoad() {
- await this.init()
- },
-
- methods: {
- async init() {
- this.LOADING('加载中…')
- const noticeItem = this.GET_PARAM()
- this.keyValue = noticeItem.f_id
- if(noticeItem.f_category){
- this.contentType = 2
- }else{
- this.contentType = 1
- }
- this.content = this.CONVERT_HTML(noticeItem.f_content)
- this.time = moment(noticeItem.f_time).format('HH : mm')
- this.date = moment(noticeItem.f_time).format('YYYY年 M月 D日')
- this.FETCH_DATASOURCE('classdata').then(data => {
- this.classdata = data.data.map(t => ({
- text: t.name,
- value: t.id
- }));
- const obj=this.classdata.find(t=>t.value==noticeItem.f_sourcename);
- this.f_sourcename=obj?obj.text:'';
- })
-
- this.SET_TITLE(noticeItem.f_title)
-
- this.ready = true
- this.HIDE_LOADING()
- let _postData = {
- newsId: noticeItem.f_id,
- }
- this.HTTP_POST('learun/news/newsRead',_postData, '加载数据时出错');
- // 加载附件信息
- this.initUpload(noticeItem.f_newsimage)
- },
- async initUpload(foldId){
- if(!foldId)return
- let res = await this.getFileListById(foldId)
- this.fileList = res || []
- }
- }
- }
- </script>
|