|
@@ -1,16 +1,11 @@
|
|
|
<template>
|
|
|
- <view class="container">
|
|
|
- <view class="pay-wall">
|
|
|
+ <view class="container" :class="{noscroll: buyShow}">
|
|
|
+ <view class="pay-wall" v-show="loginShow">
|
|
|
<view class="title">
|
|
|
{{ report.title }}
|
|
|
</view>
|
|
|
- <button @click="toBuy">点击购买</button>
|
|
|
</view>
|
|
|
- <!-- <web-view id="webview" :src="report.sourceFile">
|
|
|
- <cover-view class="close-view">
|
|
|
- <button>22222</button>
|
|
|
- </cover-view>
|
|
|
- </web-view> -->
|
|
|
+ <u-parse :html="report.content"></u-parse>
|
|
|
<view class="bottom-box">
|
|
|
<view class="menu-box">
|
|
|
<button class="menu-item" @click="changeApplaud">
|
|
@@ -30,6 +25,35 @@
|
|
|
</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <u-popup v-model="buyShow"
|
|
|
+ :mask="false" :closeable='false'
|
|
|
+ mode="bottom" :mask-close-able='false'
|
|
|
+ safe-area-inset-bottom>
|
|
|
+ <view style="height: 70vh;padding: 40rpx;position: relative;">
|
|
|
+ <view style="text-align: center;color: #cccccc;margin: 50rpx 0;">正文需付费后才可阅读</view>
|
|
|
+ <view style="text-align: center;">
|
|
|
+ <u-button size="medium" type="error" @click="toBuy">¥{{ payForm.amount }} 阅读全部</u-button>
|
|
|
+ </view>
|
|
|
+ <view style="text-align: center;
|
|
|
+ color: #ff0000;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 20%;
|
|
|
+ left: 50%;
|
|
|
+ width: 80%;
|
|
|
+ transform: translateX(-50%);" @click="toJoin">个人会员或单位会员免费,点击现在入会></view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
+ <u-popup v-model="loginShow"
|
|
|
+ :mask="false" :closeable='false'
|
|
|
+ mode="bottom" :mask-close-able='false'
|
|
|
+ safe-area-inset-bottom>
|
|
|
+ <view style="height: 70vh;padding: 40rpx;position: relative;">
|
|
|
+ <!-- <view style="text-align: center;color: #cccccc;margin: 50rpx 0;">正文需付费后才可阅读</view> -->
|
|
|
+ <view style="text-align: center;margin: 70rpx 0;">
|
|
|
+ <u-button size="medium" type="error" @click="toLogin">登录阅读原文</u-button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -63,14 +87,17 @@
|
|
|
useAuthStore
|
|
|
} from '@/store/authStore'
|
|
|
const authStore = useAuthStore();
|
|
|
- const isMember = computed(()=>{
|
|
|
+ const isMember = computed(() => {
|
|
|
authStore.loadUserInfo()
|
|
|
return authStore.userInfo.isMember == '0' ? false : true
|
|
|
})
|
|
|
- const openid = computed(()=>{
|
|
|
+ const openid = computed(() => {
|
|
|
authStore.loadOpenid()
|
|
|
+ console.log(authStore.openid, 1111)
|
|
|
return authStore.openid
|
|
|
})
|
|
|
+ const buyShow = ref(false)
|
|
|
+ const loginShow = ref(true)
|
|
|
const webview = ref();
|
|
|
const id = ref()
|
|
|
const title = ref()
|
|
@@ -138,6 +165,12 @@
|
|
|
"openid": ""
|
|
|
})
|
|
|
|
|
|
+ function parseLoaded() {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.uReadMore1.init();
|
|
|
+ }, 10);
|
|
|
+ }
|
|
|
+
|
|
|
function changeFavi() {
|
|
|
if (report.value.hasFavi) {
|
|
|
cancelReportFavi(id.value).then(res => {
|
|
@@ -171,12 +204,12 @@
|
|
|
}
|
|
|
|
|
|
function toBuy() {
|
|
|
+ // console.log("点击购买")
|
|
|
// 修改一下,如果是会员,用会员价格,
|
|
|
// 如果不是会员就用普通价格
|
|
|
- payForm.value.amount = isMember.value? report.value.priceMember : report.value.price
|
|
|
payForm.value.openid = openid.value
|
|
|
- payReport(payForm.value).then(res=>{
|
|
|
- if(res && res.code===0){
|
|
|
+ payReport(payForm.value).then(res => {
|
|
|
+ if (res && res.code === 0) {
|
|
|
const params = res.data
|
|
|
wx.requestPayment({
|
|
|
nonceStr: params.nonceStr,
|
|
@@ -184,25 +217,59 @@
|
|
|
paySign: params.paySign,
|
|
|
signType: params.signType,
|
|
|
timeStamp: params.timeStamp,
|
|
|
- success(res){
|
|
|
+ success(res) {
|
|
|
+ buyShow.value = false
|
|
|
msgSuccess("支付成功")
|
|
|
},
|
|
|
- fail(res){
|
|
|
+ fail(res) {
|
|
|
+ buyShow.value = true
|
|
|
msgError("支付失败")
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ function toLogin(){
|
|
|
+ let url = {
|
|
|
+ url: '/pages/reportDetail/reportDetail',
|
|
|
+ id: id.value,
|
|
|
+ title: title.value
|
|
|
+ }
|
|
|
+ uni.navigateTo({
|
|
|
+ url:`/pages/login/login?redirect=${JSON.stringify(url)}`
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const toJoin = () =>{
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/joinClub/joinClub'
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
function init(id) {
|
|
|
+ // 测试图片
|
|
|
getReportDetail(id).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
report.value = res.data
|
|
|
payForm.value.id = res.data.id
|
|
|
payForm.value.title = res.data.title
|
|
|
payForm.value.desc = res.data.title
|
|
|
-
|
|
|
+ payForm.value.amount = isMember.value ? report.value.priceMember : report.value.price
|
|
|
+ report.value.content = ""
|
|
|
+ if(!report.value.hasBuy){
|
|
|
+ buyShow.value = true
|
|
|
+ }
|
|
|
+ if(res.data.imgData){
|
|
|
+ const path = res.data.imgData.path
|
|
|
+ const type = res.data.imgData.type
|
|
|
+ const size = res.data.imgData.size
|
|
|
+ for(let i=1;i <= size;i++){
|
|
|
+ let image = `${path}/${i}.${type}`
|
|
|
+ report.value.content = report.value.content + `<img src='${image}'></img>`
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ report.value.content = ''
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -210,7 +277,14 @@
|
|
|
if (load.id) {
|
|
|
id.value = load.id
|
|
|
title.value = load.title
|
|
|
- init(id.value)
|
|
|
+ // console.log(openid.value, 2222)
|
|
|
+ if(openid.value){
|
|
|
+ init(id.value)
|
|
|
+ loginShow.value = false
|
|
|
+ }else{
|
|
|
+ loginShow.value = true
|
|
|
+ }
|
|
|
+ // loginShow.value = true
|
|
|
}
|
|
|
uni.setNavigationBarTitle({
|
|
|
title: title.value
|
|
@@ -227,7 +301,7 @@
|
|
|
}
|
|
|
return {
|
|
|
title: '研究报告',
|
|
|
- path: `/pages/reportDetail/reportDetail?id=${id.value}`,
|
|
|
+ path: `/pages/reportDetail/reportDetail?id=${id.value}&title=${title.value}`,
|
|
|
imageUrl: imgurl.value
|
|
|
};
|
|
|
})
|
|
@@ -235,12 +309,27 @@
|
|
|
onShareTimeline(() => {
|
|
|
return {
|
|
|
title: '朋友圈标题-研究报告',
|
|
|
- query: `id=${id.value}`,
|
|
|
+ query: `id=${id.value}&title=${title.value}`,
|
|
|
imageUrl: imgurl.value
|
|
|
};
|
|
|
})
|
|
|
</script>
|
|
|
-
|
|
|
+<style>
|
|
|
+/* 新增样式 */
|
|
|
+.noscroll {
|
|
|
+ height: 100vh;
|
|
|
+ overflow: hidden;
|
|
|
+ position: fixed;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+/* 兼容H5和小程序 */
|
|
|
+/* #ifdef H5 */
|
|
|
+.noscroll {
|
|
|
+ touch-action: none;
|
|
|
+}
|
|
|
+/* #endif */
|
|
|
+</style>
|
|
|
<style lang="scss" scoped>
|
|
|
.container {
|
|
|
height: 100vh;
|