|
@@ -25,10 +25,8 @@
|
|
</button> -->
|
|
</button> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <u-popup v-model="buyShow"
|
|
|
|
- :mask="false" :closeable='false'
|
|
|
|
- mode="bottom" :mask-close-able='false'
|
|
|
|
- safe-area-inset-bottom>
|
|
|
|
|
|
+ <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="height: 70vh;padding: 40rpx;position: relative;">
|
|
<view style="text-align: center;color: #cccccc;margin: 50rpx 0;">正文需付费后才可阅读</view>
|
|
<view style="text-align: center;color: #cccccc;margin: 50rpx 0;">正文需付费后才可阅读</view>
|
|
<view style="text-align: center;">
|
|
<view style="text-align: center;">
|
|
@@ -43,10 +41,8 @@
|
|
transform: translateX(-50%);" @click="toJoin">个人会员或单位会员免费,点击现在入会></view>
|
|
transform: translateX(-50%);" @click="toJoin">个人会员或单位会员免费,点击现在入会></view>
|
|
</view>
|
|
</view>
|
|
</u-popup>
|
|
</u-popup>
|
|
- <u-popup v-model="loginShow"
|
|
|
|
- :mask="false" :closeable='false'
|
|
|
|
- mode="bottom" :mask-close-able='false'
|
|
|
|
- safe-area-inset-bottom>
|
|
|
|
|
|
+ <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="height: 70vh;padding: 40rpx;position: relative;">
|
|
<!-- <view style="text-align: center;color: #cccccc;margin: 50rpx 0;">正文需付费后才可阅读</view> -->
|
|
<!-- <view style="text-align: center;color: #cccccc;margin: 50rpx 0;">正文需付费后才可阅读</view> -->
|
|
<view style="text-align: center;margin: 70rpx 0;">
|
|
<view style="text-align: center;margin: 70rpx 0;">
|
|
@@ -54,6 +50,8 @@
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</u-popup>
|
|
</u-popup>
|
|
|
|
+ <canvas style="position: absolute; top: -1000px; left: -1000px; width: 875px; height: 700px; background: #fff;"
|
|
|
|
+ canvas-id="canvas"></canvas>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -231,7 +229,8 @@
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- function toLogin(){
|
|
|
|
|
|
+
|
|
|
|
+ function toLogin() {
|
|
let url = {
|
|
let url = {
|
|
url: '/pages/reportDetail/reportDetail',
|
|
url: '/pages/reportDetail/reportDetail',
|
|
id: id.value,
|
|
id: id.value,
|
|
@@ -240,11 +239,11 @@
|
|
// const decodedRedirect = decodeURIComponent(url);
|
|
// const decodedRedirect = decodeURIComponent(url);
|
|
uni.setStorageSync("redirect", url)
|
|
uni.setStorageSync("redirect", url)
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url:`/pages/login/login`
|
|
|
|
|
|
+ url: `/pages/login/login`
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
- const toJoin = () =>{
|
|
|
|
|
|
+
|
|
|
|
+ const toJoin = () => {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
url: '/pages/joinClub/joinClub'
|
|
url: '/pages/joinClub/joinClub'
|
|
})
|
|
})
|
|
@@ -260,36 +259,80 @@
|
|
payForm.value.desc = res.data.title
|
|
payForm.value.desc = res.data.title
|
|
payForm.value.amount = isMember.value ? report.value.priceMember : report.value.price
|
|
payForm.value.amount = isMember.value ? report.value.priceMember : report.value.price
|
|
report.value.content = ""
|
|
report.value.content = ""
|
|
- if(!report.value.hasBuy && res.data.viewMode === '3'){
|
|
|
|
|
|
+ if (!report.value.hasBuy && res.data.viewMode === '3') {
|
|
buyShow.value = true
|
|
buyShow.value = true
|
|
- }else if(!report.value.hasBuy && !isMember.value && res.data.viewMode === '2' ){
|
|
|
|
|
|
+ } else if (!report.value.hasBuy && !isMember.value && res.data.viewMode === '2') {
|
|
buyShow.value = true
|
|
buyShow.value = true
|
|
}
|
|
}
|
|
// console.log(report.value.hasBuy, res.data.viewMode, buyShow.value, 100)
|
|
// console.log(report.value.hasBuy, res.data.viewMode, buyShow.value, 100)
|
|
- if(res.data.imgData){
|
|
|
|
|
|
+ if (res.data.imgData) {
|
|
const path = res.data.imgData.path
|
|
const path = res.data.imgData.path
|
|
const type = res.data.imgData.type
|
|
const type = res.data.imgData.type
|
|
const size = res.data.imgData.size
|
|
const size = res.data.imgData.size
|
|
- for(let i=1;i <= size;i++){
|
|
|
|
|
|
+ for (let i = 1; i <= size; i++) {
|
|
let image = `${path}/${i}.${type}`
|
|
let image = `${path}/${i}.${type}`
|
|
report.value.content = report.value.content + `<img src='${image}'></img>`
|
|
report.value.content = report.value.content + `<img src='${image}'></img>`
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
report.value.content = ''
|
|
report.value.content = ''
|
|
}
|
|
}
|
|
imgurl.value = report.value.cover
|
|
imgurl.value = report.value.cover
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ function cutShareImg(imgUrl) {
|
|
|
|
+ return new Promise((resolve) => {
|
|
|
|
+ wx.getImageInfo({
|
|
|
|
+ src: imgUrl, // 原图路径
|
|
|
|
+ success: (res) => {
|
|
|
|
+ let ctx = wx.createCanvasContext("canvas")
|
|
|
|
+ let canvasW = 0
|
|
|
|
+ let canvasH = res.height
|
|
|
|
+ // 把比例设置为 宽比高 5:4
|
|
|
|
+ canvasW = (res.height * 5) / 4
|
|
|
|
+ // 为画框设置背景色,注意要放在画图前,图会覆盖在背景色上
|
|
|
|
+ ctx.fillStyle = "#fff"
|
|
|
|
+ ctx.fillRect(0, 0, canvasW, canvasH)
|
|
|
|
+ // ctx.drawImage(res.path, (res.width - canvasW) / 2, 0, canvasW, canvasH, 0, 0, canvasW, canvasH)
|
|
|
|
+ ctx.drawImage(
|
|
|
|
+ res.path,
|
|
|
|
+ 0,
|
|
|
|
+ 0,
|
|
|
|
+ canvasW,
|
|
|
|
+ canvasH,
|
|
|
|
+ (canvasW - res.width) / 2, // 宽度从中间向两边填充
|
|
|
|
+ 0,
|
|
|
|
+ canvasW,
|
|
|
|
+ canvasH
|
|
|
|
+ )
|
|
|
|
+ ctx.draw(false, () => {
|
|
|
|
+ wx.canvasToTempFilePath({
|
|
|
|
+ width: canvasW,
|
|
|
|
+ height: canvasH,
|
|
|
|
+ destWidth: 750, // 标准的iphone6尺寸的两倍,生成高清图
|
|
|
|
+ destHeight: 600,
|
|
|
|
+ canvasId: "canvas",
|
|
|
|
+ fileType: "jpg", // 注意jpg默认背景为透明
|
|
|
|
+ success: (res) => {
|
|
|
|
+ // 设置分享图片路径
|
|
|
|
+ resolve(res.tempFilePath)
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
onLoad((load) => {
|
|
onLoad((load) => {
|
|
if (load.id) {
|
|
if (load.id) {
|
|
id.value = load.id
|
|
id.value = load.id
|
|
title.value = load.title
|
|
title.value = load.title
|
|
// console.log(openid.value, 2222)
|
|
// console.log(openid.value, 2222)
|
|
- if(openid.value){
|
|
|
|
|
|
+ if (openid.value) {
|
|
init(id.value)
|
|
init(id.value)
|
|
loginShow.value = false
|
|
loginShow.value = false
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
loginShow.value = true
|
|
loginShow.value = true
|
|
}
|
|
}
|
|
// loginShow.value = true
|
|
// loginShow.value = true
|
|
@@ -303,7 +346,7 @@
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
- onShareAppMessage((res) => {
|
|
|
|
|
|
+ onShareAppMessage(async (res) => {
|
|
// if (res.from === 'button') {
|
|
// if (res.from === 'button') {
|
|
// console.log('来自按钮分享');
|
|
// console.log('来自按钮分享');
|
|
// }
|
|
// }
|
|
@@ -311,34 +354,35 @@
|
|
return {
|
|
return {
|
|
title: title.value,
|
|
title: title.value,
|
|
path: `/pages/reportDetail/reportDetail?id=${id.value}&title=${title.value}`,
|
|
path: `/pages/reportDetail/reportDetail?id=${id.value}&title=${title.value}`,
|
|
- imageUrl: imgurl.value
|
|
|
|
|
|
+ imageUrl: await cutShareImg(imgurl.value)
|
|
};
|
|
};
|
|
})
|
|
})
|
|
|
|
|
|
- onShareTimeline(() => {
|
|
|
|
|
|
+ onShareTimeline(async () => {
|
|
// console.log(imgurl.value)
|
|
// console.log(imgurl.value)
|
|
return {
|
|
return {
|
|
title: title.value,
|
|
title: title.value,
|
|
query: `id=${id.value}&title=${title.value}`,
|
|
query: `id=${id.value}&title=${title.value}`,
|
|
- imageUrl: imgurl.value
|
|
|
|
|
|
+ imageUrl: await cutShareImg(imgurl.value)
|
|
};
|
|
};
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
<style>
|
|
<style>
|
|
-/* 新增样式 */
|
|
|
|
-.noscroll {
|
|
|
|
- height: 100vh;
|
|
|
|
- overflow: hidden;
|
|
|
|
- position: fixed;
|
|
|
|
- width: 100%;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/* 兼容H5和小程序 */
|
|
|
|
-/* #ifdef H5 */
|
|
|
|
-.noscroll {
|
|
|
|
- touch-action: none;
|
|
|
|
-}
|
|
|
|
-/* #endif */
|
|
|
|
|
|
+ /* 新增样式 */
|
|
|
|
+ .noscroll {
|
|
|
|
+ height: 100vh;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ position: fixed;
|
|
|
|
+ width: 100%;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* 兼容H5和小程序 */
|
|
|
|
+ /* #ifdef H5 */
|
|
|
|
+ .noscroll {
|
|
|
|
+ touch-action: none;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* #endif */
|
|
</style>
|
|
</style>
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
.container {
|
|
.container {
|