Files
medicine_app/pages/news/news.vue
@fawn-nine 92df12db8e 微调
2024-05-29 15:54:19 +08:00

82 lines
1.6 KiB
Vue

<template>
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="消息详情"></z-nav-bar>
<view class="box">
<view class="title">
{{news.title}}
</view>
<view class="content" v-html="news.content"></view>
</view>
<music-play :playData="playData"></music-play>
</view>
</template>
<script>
import musicPlay from '@/components/music.vue'
import $http from '@/config/requestConfig.js';
var clear;
import {
mapState
} from 'vuex';
export default {
data() {
return {
playData: {},
newsId: null,
news: {
content: '',
title: ''
}
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
this.newsId = e.newsid
console.log(e, '------')
},
computed: {
...mapState(['userInfo'])
},
//页面显示
onShow() {
// 隐藏原生的tabbar
uni.hideTabBar();
this.getData();
},
components: {
musicPlay
},
//方法
methods: {
getData() {
this.$http
.post('common/message/getMessageById?id=' + this.newsId)
.then(res => {
if (res.code == 0) {
this.news.content = res.result.content
this.news.title = res.result.title
}
}).catch(e => {
console.log(e, '获取新闻详情报错')
});
}
},
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.box {
background-color: #fff;
@include pleft_right(10px);
min-height: calc(100vh - 70rpx);
}
.title{font-size: 32rpx; font-weight: bold; display: block; text-align: center;}
.content { font-size: 26rpx; line-height: 48rpx; margin-top: 10rpx;}
</style>