ZZ 2 hete
szülő
commit
2e4b41db47

+ 26 - 34
mer_uniapp/components/discoverDetails/index.vue

@@ -21,19 +21,19 @@
 			<view class="list_count">
 				<view class="imageBox">
 					<swiper v-if="noteDetails.type ===1 && noteDetails.image && noteDetails.image.split(',').length>1" :indicator-dots="indicatorDots"
-					 indicator-active-color="#e93323" :circular="circular" :interval="interval" :duration="duration" :style="{height:heightH + 'px'}">
+					 indicator-active-color="#e93323" :circular="circular" :interval="interval" :duration="duration" :style="{height:imageH + 'px'}">
 						<block v-for="(item,index) in noteDetails.image.split(',')" :key='index'>
 							<swiper-item class="cover">
 								<!-- <image class="w-full" show-menu-by-longpress :src="item"
 									:mode="isAuto ?  'aspectFill' : 'heightFix'" :style="{height:imageH + 'px'}"
 									@tap="proview(item)"></image> -->
-								<easy-loadimage mode="heightFix" :image-src="item" :style="{height:heightH + 'px'}"></easy-loadimage>
+								<easy-loadimage mode="heightFix" :image-src="item" :style="{height:imageH + 'px'}"></easy-loadimage>
 							</swiper-item>
 						</block>
 					</swiper>
 					<view v-if="noteDetails.type ===2 || (noteDetails.type ===1 &&noteDetails.image && noteDetails.image.split(',').length===1)">
-						<view class="cover" @click="goDetail(noteDetails)" :style="{height:heightH + 'px'}">
-							<easy-loadimage mode="heightFix" :image-src="noteDetails.cover" :style="{height:heightH + 'px'}"></easy-loadimage>
+						<view class="cover" @click="goDetail(noteDetails)" :style="{height:imageH + 'px'}">
+							<easy-loadimage mode="heightFix" :image-src="noteDetails.cover" :style="{height:imageH + 'px'}"></easy-loadimage>
 							<view v-if="noteDetails.type ===2" class="circle">
 								<text class="iconfont icon-24gf-play"></text>
 							</view>
@@ -45,7 +45,8 @@
 					<view class="product_info">
 						<view class="noteTitle flex-between-center">
 							<view>{{noteDetails.title}}</view>
-							<view v-if="dazi && noteDetails.authorId !== uid" class="dazi-info" @tap="onJoin">加入</view>
+							<view v-if="dazi && noteDetails.authorId !== uid && !noteDetails.userIsJoin" class="dazi-info" @tap="onJoin">加入</view>
+							<view v-if="dazi && noteDetails.authorId !== uid && noteDetails.userIsJoin" class="dazi-info" @tap="onJoinColse">取消</view>
 						</view>
 						<view>
 							<view class="text" v-if="noteDetails.isMore || (noteDetails.content && noteDetails.content.length<=70)">
@@ -152,7 +153,8 @@
 		<uni-popup type="bottom" ref="manageRef">
 			<view class="manage">
 				<popup-header title="内容管理" @close="closeManage"></popup-header>
-				<navigator hover-class="none" :url="'/pages/discover/discover_release/index?noteId='+noteDetails.id + '&dazi=' + dazi" class="items">
+				<navigator hover-class="none" :url="'/pages/discover/discover_release/index?noteId='+noteDetails.id + '&dazi=' + dazi"
+				 class="items">
 					<text>编辑</text>
 				</navigator>
 				<view class="items" @click.stop="deleteTopic(noteDetails)">
@@ -307,7 +309,6 @@
 							}
 						})
 					}
-					this.computedHeight()
 				}
 			}
 		},
@@ -547,27 +548,21 @@
 					});
 				}
 			},
-			// 计算图片高度
-			computedHeight() {
-				let that = this;
-				if (this.noteDetails.image) {
-					let windowWidth = uni.getSystemInfoSync().windowWidth;
-					uni.getImageInfo({
-						src: that.$util.setDomain(this.noteDetails.image.split(',')[0]),
-						success: (image) => {
-							let imageH = parseInt(image.height * windowWidth / image.width);
-							if (imageH > 500) {
-								this.heightH = 500;
-							} else {
-								this.heightH = imageH;
-							}
-						}
-					})
-				}
-			},
 			onJoin() {
 				this.$refs.joinDialog.open()
 			},
+			onJoinColse() {
+				myGameJoinIdApi(this.noteDetails.id).then(res => {
+					that.$util.Tips({
+						title: '取消成功'
+					});
+				}).catch(err => {
+					uni.showToast({
+						title: err,
+						icon: 'none'
+					})
+				});
+			},
 			handleInputClose() {
 				this.$refs.joinDialog.close()
 			},
@@ -582,19 +577,16 @@
 					success: function(res) {
 						console.log('条码类型:' + res.scanType);
 						console.log('条码内容:' + res.result);
-						uni.navigateTo({
-							url: res.result
-						});
 						let that = this;
-						myGameJoinIdApi(noteDetails.id).then(res => {
+						setTimeout(function() {
+							uni.navigateTo({
+								url: res.result
+							});
+						}, 1000);
+						myGameJoinIdApi(that.noteDetails.id).then(res => {
 							that.$util.Tips({
 								title: '加入成功'
 							});
-							setTimeout(function() {
-								uni.redirectTo({
-									url: `/pages/discover/discover_user/index?dazi=${that.dazi}`
-								})
-							}, 1000);
 						}).catch(err => {
 							uni.showToast({
 								title: err,

+ 53 - 27
mer_uniapp/pages/discover/discover_details/index.vue

@@ -9,6 +9,7 @@
 		<view class='loadingicon acea-row row-center-wrapper' :hidden='loading==false'>
 			<text class='loading iconfont icon-jiazai'></text>
 		</view>
+		<image :src="noteDetail.image.split(',')[0]" @load="computedHeight" v-show="false"></image>
 
 		<view class="commen_details borderPad" id="myElement">
 			<view v-if="noteDetail.platReplySwitch" class="commen_count" id="commen_count">
@@ -26,7 +27,9 @@
 	import discoverDetails from '@/components/discoverDetails/index.vue'
 	import discoverComment from '@/components/discoverComment/index.vue'
 	import navBar from '@/components/navBar';
-	import { gameDetailApi } from '@/api/gameDazi.js';
+	import {
+		gameDetailApi
+	} from '@/api/gameDazi.js';
 	import {
 		noteDetailApi
 	} from '@/api/discover.js';
@@ -63,7 +66,8 @@
 				isShowCommentView: false, //评论列表是否出现
 				isClickBtn: false, //是否点击了评论按钮,
 				title: '内容详情',
-				dazi: ''
+				dazi: '',
+				imageStr: ''
 			}
 		},
 		onLoad: function(options) {
@@ -107,35 +111,57 @@
 		methods: {
 
 			// 计算图片高度
-			computedHeight() {
+			computedHeight(event) {
+				this.loading = true;
 				let that = this;
 				if (this.noteDetail.image) {
 					let windowWidth = uni.getSystemInfoSync().windowWidth;
-					uni.getImageInfo({
-						src: that.$util.setDomain(this.noteDetail.image.split(',')[0]),
-						success: (image) => {
-							let imageH = parseInt(image.height * windowWidth / image.width);
-							if (imageH > 500) {
-								this.isAuto = false;
-								this.imageH = 500;
+					let imageH = parseInt(event.mp.detail.height * windowWidth / event.mp.detail.width);
+					if (imageH > 500) {
+						this.isAuto = false;
+						this.imageH = 500;
+					} else {
+						this.imageH = imageH;
+					}
+					if (this.dazi) {
+						const arr = this.noteDetail.image.split(',');
+						let qrCode = '';
+						arr.forEach(item => {
+							if (this.noteDetail.cover !== item) {
+								qrCode = item;
 							} else {
-								this.imageH = imageH;
-							}
-							if (this.dazi) {
-								const arr = this.noteDetail.image.split(',');
-								let qrCode = '';
-								arr.forEach(item =>{
-									if (this.noteDetail.cover !== item) {
-										qrCode = item;
-									} else {
-										this.noteDetail.image = item;
-									}
-								});
-								this.noteDetail.qrCode = qrCode;
+								this.noteDetail.image = item;
 							}
-							console.log(this.imageH, 'inlailellelel')
-						}
-					})
+						});
+						this.noteDetail.qrCode = qrCode;
+					}
+					this.loading = false;
+					// uni.getImageInfo({
+					// 	src: that.$util.setDomain(this.noteDetail.image.split(',')[0]),
+					// 	success: (image) => {
+					// 		let imageH = parseInt(image.height * windowWidth / image.width);
+					// 		if (imageH > 500) {
+					// 			this.isAuto = false;
+					// 			this.imageH = 500;
+					// 		} else {
+					// 			this.imageH = imageH;
+					// 		}
+					// 		if (this.dazi) {
+					// 			const arr = this.noteDetail.image.split(',');
+					// 			let qrCode = '';
+					// 			arr.forEach(item =>{
+					// 				if (this.noteDetail.cover !== item) {
+					// 					qrCode = item;
+					// 				} else {
+					// 					this.noteDetail.image = item;
+					// 				}
+					// 			});
+					// 			this.noteDetail.qrCode = qrCode;
+					// 		}
+					// 		console.log(this.imageH, 'inlailellelel')
+					// 		console.log(this.noteDetail, '1111111111')
+					// 	}
+					// })
 				}
 			},
 			getReplyNum(n) {
@@ -171,7 +197,7 @@
 					this.loading = true;
 					this.noteDetail = res.data;
 					this.noteRecommendList = res.data;
-					this.computedHeight()
+					// this.computedHeight()
 					this.loading = false;
 				}).catch(err => {
 					this.loading = false;

+ 25 - 10
mer_uniapp/pages/discover/discover_release/index.vue

@@ -27,7 +27,8 @@
 			<view class="release_content">
 				<view class="release_item">
 					<view class="title mb30">
-						<input :placeholder="fair ? '填写好物名称' : dazi ? '填写标题' : '填写标题会有更多赞噢~'" name="title" placeholder-class='placeholder' v-model="formData.title" maxlength="20" />
+						<input :placeholder="fair ? '填写好物名称' : dazi ? '填写标题' : '填写标题会有更多赞噢~'" name="title" placeholder-class='placeholder'
+						 v-model="formData.title" maxlength="20" />
 					</view>
 					<view class="textarea">
 						<textarea :placeholder="fair ? '说说好物信息,入手渠道,转卖原因...' : dazi ? '填写简介' : formData.type == 1?'分享使用体验和心得,获得更多点赞和关注哦~(600字以内)':'分享使用体验和心得,获得更多点赞和关注哦~(200字以内)'"
@@ -123,7 +124,8 @@
 						<view class="select">
 							<view class="select_count">
 								<text class="select-input">¥</text>
-								<input class="text w-128 select-input" type="number" :maxlength="6" :placeholder="'价格'" placeholder-class="placeholder" v-model="formData.price" />
+								<input class="text w-128 select-input" type="number" :maxlength="6" :placeholder="'价格'" placeholder-class="placeholder"
+								 v-model="formData.price" />
 								<text @change="bindSexChange" class="iconfont icon-xiangyou"></text>
 							</view>
 						</view>
@@ -179,7 +181,11 @@
 	import {
 		setThemeColor
 	} from '@/utils/setTheme.js'
-	import { gameAddApi, gameUpdateApi, gameDetailApi } from '@/api/gameDazi.js';
+	import {
+		gameAddApi,
+		gameUpdateApi,
+		gameDetailApi
+	} from '@/api/gameDazi.js';
 	import {
 		noteDetailApi,
 		secondHandDetailApi,
@@ -334,7 +340,13 @@
 			//分类列表
 			getCommunityCategoryList() {
 				if (this.dazi) {
-					this.categoryList = [{id: 0, name: '游戏陪玩'}, {id: 1, name: '代练'}]
+					this.categoryList = [{
+						id: 0,
+						name: '游戏陪玩'
+					}, {
+						id: 1,
+						name: '代练'
+					}]
 				} else {
 					let categoryApi = this.fair ? getSecondHandInfo() : communityCategoryListApi();
 					categoryApi.then(res => {
@@ -538,7 +550,8 @@
 						icon: 'success'
 					});
 					setTimeout(function() {
-						let url = that.fair ? '/pages/trade_fair/trade_fair_user/index' : '/pages/discover/discover_user/index'
+						let url = that.fair ? '/pages/trade_fair/trade_fair_user/index' : this.dazi ?
+							`/pages/discover/discover_user/index?dazi=dazi` : '/pages/discover/discover_user/index'
 						uni.redirectTo({
 							url: url
 						})
@@ -555,7 +568,8 @@
 					});
 					uni.hideLoading()
 					setTimeout(function() {
-						let url = that.fair ? '/pages/trade_fair/trade_fair_user/index' : '/pages/discover/discover_user/index'
+						let url = that.fair ? '/pages/trade_fair/trade_fair_user/index' : this.dazi ?
+							`/pages/discover/discover_user/index?dazi=dazi` : '/pages/discover/discover_user/index'
 						uni.redirectTo({
 							url: url
 						})
@@ -878,7 +892,7 @@
 				align-items: center;
 				justify-content: flex-end;
 			}
-			
+
 			.select-input {
 				color: $bg-color-primary;
 			}
@@ -963,7 +977,7 @@
 			height: 500rpx;
 		}
 	}
-	
+
 	.address {
 		padding: 40rpx 24rpx;
 		background-color: #fff;
@@ -1020,17 +1034,18 @@
 		width: 100%;
 		margin: 0 auto;
 	}
-	
+
 	.line {
 		width: 100%;
 		height: 3rpx;
 	}
-	
+
 	.line image {
 		width: 100%;
 		height: 100%;
 		display: block;
 	}
+
 	.font_color {
 		@include main_color(theme);
 	}