158 lines
3.0 KiB
Vue
158 lines
3.0 KiB
Vue
<template>
|
|
<view class="container">
|
|
<z-nav-bar :title="prescriptDetail.title" bgColor="#5188e5" fontColor="#fff"></z-nav-bar>
|
|
<view
|
|
class="contentBox"
|
|
v-if="prescriptDetail.content && prescriptDetail.contentType == 1"
|
|
>
|
|
<view class="content">
|
|
<view class="item title-center">
|
|
{{ prescriptDetail.title }}
|
|
</view>
|
|
<view class="item" v-html="prescriptDetail.content"> </view>
|
|
</view>
|
|
</view>
|
|
<view class="fullscreen-webview" v-else>
|
|
<web-view :src="prescriptDetail.url"> </web-view>
|
|
</view>
|
|
<music-play :playData="playData"></music-play>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import musicPlay from "@/components/music.vue";
|
|
import $http from "@/config/requestConfig.js";
|
|
export default {
|
|
data() {
|
|
return {
|
|
playData: {},
|
|
prescriptDetail: {
|
|
images: [],
|
|
},
|
|
id: null,
|
|
indicatorDots: true,
|
|
autoplay: true,
|
|
interval: 5000,
|
|
duration: 500,
|
|
};
|
|
},
|
|
onLoad(e) {
|
|
this.id = e.id;
|
|
},
|
|
onShow() {
|
|
this.getDetail();
|
|
},
|
|
methods: {
|
|
// 放大图片
|
|
previewImage(url) {
|
|
console.log(url);
|
|
uni.previewImage({
|
|
urls: [url],
|
|
longPressActions: {
|
|
itemList: ["很抱歉,暂不支持保存图片到本地"],
|
|
success: function (res) {
|
|
// console.log(res,'+++++')
|
|
},
|
|
},
|
|
});
|
|
},
|
|
// 方剂详情
|
|
getDetail() {
|
|
$http
|
|
.request({
|
|
url: "book/generalArticle/getArticleById?id=" + this.id,
|
|
method: "POST",
|
|
data: {
|
|
|
|
},
|
|
header: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
})
|
|
.then((res) => {
|
|
console.log(res, "内容获取成功");
|
|
if (res.code == 0) {
|
|
this.prescriptDetail = res.result;
|
|
if (
|
|
this.prescriptDetail.content &&
|
|
this.prescriptDetail.contentType == 1
|
|
) {
|
|
this.prescriptDetail.content = res.result.content.replace(
|
|
/<img/g,
|
|
'<img style="max-width: 100%;"'
|
|
);
|
|
}
|
|
}
|
|
})
|
|
.catch((e) => {
|
|
console.log(e);
|
|
});
|
|
},
|
|
},
|
|
components: {
|
|
musicPlay,
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.contentBox {
|
|
padding-bottom: 20rpx;
|
|
}
|
|
.contentBoxwebwiew {
|
|
height: 100%;
|
|
}
|
|
.fullscreen-webview {
|
|
width: 100%;
|
|
height: 100%;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
}
|
|
|
|
.mb-10 {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.content {
|
|
font-size: 28rpx;
|
|
}
|
|
|
|
.swiper-item {
|
|
image {
|
|
margin: 0 auto;
|
|
height: 250rpx;
|
|
}
|
|
}
|
|
|
|
.uni-margin-wrap {
|
|
margin-bottom: 20rpx;
|
|
padding-top: 20rpx;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.container {
|
|
|
|
.item {
|
|
// color: #666;
|
|
padding: 10rpx 20rpx;
|
|
padding-bottom: 20rpx;
|
|
line-height: 46rpx;
|
|
}
|
|
.title-center {
|
|
text-align: center;
|
|
font-size: 32rpx;
|
|
font-weight: 700 !important;
|
|
}
|
|
}
|
|
|
|
.flexbox {
|
|
display: flex;
|
|
}
|
|
|
|
/deep/ .uni-section-header__decoration.line {
|
|
background-color: #18bc37;
|
|
}
|
|
</style> |