Browse Source

修改:通知、动态、指引不要描述,详情页日期放中间

littleblue55 19 hours ago
parent
commit
8e6f880dfa

+ 2 - 2
pages/dynamic/dynamic/dynamic.vue

@@ -11,9 +11,9 @@
 						<view class="title">
 							{{item.title}}
 						</view>
-						<view class="text">
+						<!-- <view class="text">
 							{{item.desc}}
-						</view>
+						</view> -->
 					</view>
 					<view class="other-box">
 						<view class="date">

+ 1 - 1
pages/dynamic/dynamicDetail/dynamicDetail.vue

@@ -94,7 +94,7 @@
 	.date {
 		font-size: 14px;
 		color: #999;
-		text-align: right;
+		text-align: center;
 		/* 时间右对齐 */
 		margin-top: 10px;
 		/* 与内容分离 */

+ 1 - 1
pages/goOnEdu/course/courseDetail/courseDetail.vue

@@ -23,7 +23,7 @@
 				</view>
 			</view>
 			<view class="content" v-if="currentTab === 1" style="overflow: hidden;">
-				<view class="" style="margin-bottom: 140rpx;height: 100%;overflow: scroll;padding-left: 20rpx;padding-right: 20rpx;">
+				<view class="" style="margin-bottom: 140rpx;padding-bottom: 150rpx;height: 100%;overflow: scroll;padding-left: 20rpx;padding-right: 20rpx;">
 					<view v-for="(comment, index) in sortedCommentList" :key="index" class="comment-list-item">
 						<view class="comment-list-left">
 							<image :src="comment.icon" class="comment-list-avator"></image>

+ 2 - 1
pages/goOnEdu/course/courseHome/courseHome.vue

@@ -15,7 +15,7 @@
 			<view v-for="(course,index) in filterCourses" :key="course.id" @click="toPage(course)">
 				<view class="course-item">
 					<view class="course-item-image">
-						<image class="course-image" :src="course.cover" mode="aspectFill"></image>
+						<image class="course-image" :src="course.cover" mode="aspectFit"></image>
 					</view>
 					<view class="course-item-content">
 						<view class="course-title">
@@ -288,6 +288,7 @@
 
 			.course-image {
 				width: 100%;
+				    height: 100%;
 			}
 
 		}

+ 2 - 2
pages/guide/guide/guide.vue

@@ -12,9 +12,9 @@
 						<view class="title">
 							{{item.title}}
 						</view>
-						<view class="text">
+						<!-- <view class="text">
 							{{item.desc}}
-						</view>
+						</view> -->
 					</view>
 					<view class="other-box">
 						<view class="date">

+ 1 - 1
pages/guide/guideDetail/guideDetail.vue

@@ -94,7 +94,7 @@
 	.date {
 		font-size: 14px;
 		color: #999;
-		text-align: right;
+		text-align: center;
 		/* 时间右对齐 */
 		margin-top: 10px;
 		/* 与内容分离 */

+ 2 - 2
pages/notice/notice/notice.vue

@@ -20,9 +20,9 @@
 						<view class="title">
 							{{item.title}}
 						</view>
-						<view class="text">
+						<!-- <view class="text">
 							{{item.desc}}
-						</view>
+						</view> -->
 					</view>
 					<view class="other-box">
 						<view class="date">

+ 1 - 1
pages/notice/noticeDetail/noticeDetail.vue

@@ -94,7 +94,7 @@
 	.date {
 		font-size: 14px;
 		color: #999;
-		text-align: right;
+		text-align: center;
 		/* 时间右对齐 */
 		margin-top: 10px;
 		/* 与内容分离 */

+ 81 - 37
pages/reportDetail/reportDetail.vue

@@ -25,10 +25,8 @@
 				</button> -->
 			</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="text-align: center;color: #cccccc;margin: 50rpx 0;">正文需付费后才可阅读</view>
 				<view style="text-align: center;">
@@ -43,10 +41,8 @@
 					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>
+		<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;">
@@ -54,6 +50,8 @@
 				</view>
 			</view>
 		</u-popup>
+		<canvas style="position: absolute; top: -1000px; left: -1000px; width: 875px; height: 700px; background: #fff;"
+			canvas-id="canvas"></canvas>
 	</view>
 </template>
 
@@ -231,7 +229,8 @@
 			}
 		})
 	}
-	function toLogin(){
+
+	function toLogin() {
 		let url = {
 			url: '/pages/reportDetail/reportDetail',
 			id: id.value,
@@ -240,11 +239,11 @@
 		// const decodedRedirect = decodeURIComponent(url);
 		uni.setStorageSync("redirect", url)
 		uni.navigateTo({
-			url:`/pages/login/login`
+			url: `/pages/login/login`
 		})
 	}
-	
-	const toJoin = () =>{
+
+	const toJoin = () => {
 		uni.navigateTo({
 			url: '/pages/joinClub/joinClub'
 		})
@@ -260,36 +259,80 @@
 				payForm.value.desc = res.data.title
 				payForm.value.amount = isMember.value ? report.value.priceMember : report.value.price
 				report.value.content = ""
-				if(!report.value.hasBuy && res.data.viewMode === '3'){
+				if (!report.value.hasBuy && res.data.viewMode === '3') {
 					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
 				}
 				// 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 type = res.data.imgData.type
 					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}`
 						report.value.content = report.value.content + `<img src='${image}'></img>`
 					}
-				}else{
+				} else {
 					report.value.content = ''
 				}
 				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) => {
 		if (load.id) {
 			id.value = load.id
 			title.value = load.title
 			// console.log(openid.value, 2222)
-			if(openid.value){
+			if (openid.value) {
 				init(id.value)
 				loginShow.value = false
-			}else{
+			} else {
 				loginShow.value = true
 			}
 			// loginShow.value = true
@@ -303,7 +346,7 @@
 	})
 
 
-	onShareAppMessage((res) => {
+	onShareAppMessage(async (res) => {
 		// if (res.from === 'button') {
 		// 	console.log('来自按钮分享');
 		// }
@@ -311,34 +354,35 @@
 		return {
 			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)
 		return {
 			title: title.value,
 			query: `id=${id.value}&title=${title.value}`,
-			imageUrl: imgurl.value
+			imageUrl: await cutShareImg(imgurl.value)
 		};
 	})
 </script>
 <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 lang="scss" scoped>
 	.container {