完善功能
This commit is contained in:
164
pages/wumen/xueshuwebView.vue
Normal file
164
pages/wumen/xueshuwebView.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<z-nav-bar :title="prescriptDetail.title" bgColor="#5188e5" fontColor="#fff"></z-nav-bar>
|
||||
<view class="fullscreen-webview">
|
||||
<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;
|
||||
// #ifdef APP-PLUS
|
||||
const pages = getCurrentPages()
|
||||
const page = pages[pages.length - 1];
|
||||
const currentWebview = page.$getAppWebview()
|
||||
currentWebview.setStyle({
|
||||
titleNView: {
|
||||
buttons: [{
|
||||
float: 'right',
|
||||
type: 'close',
|
||||
onclick: function() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}
|
||||
}]
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
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 {
|
||||
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>
|
||||
Reference in New Issue
Block a user