Explorar o código

1.添加图片比例适应
2.添加提现判断展示
3.处理富文本图片展示问题
4.后台添加帮助详情接口
5.分销资格现在是点击申请,后台审核通过后,小程序又变成了点击申请状态

zizhong.wang %!s(int64=6) %!d(string=hai) anos
pai
achega
3d7b3f3c6c

+ 6 - 3
components/gaoyia-parse/components/wxParseImg.vue

@@ -58,15 +58,16 @@ export default {
 			const { styleStr } = this.node;
 			const imageHeightStyle = mode === 'widthFix' ? '' : `height: ${imageheight}px;`;
 
-			this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px; padding: 0 ${+padding}px;`;//删除padding
+			//this.newStyleStr = ` padding: 0 ${+padding}px;`;//删除默认u安           
+			this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px; padding: 0 ${+padding}px; margin: 0 auto;`;//删除padding
 			// this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px;`;
 		},
 		// 计算视觉优先的图片宽高
 		wxAutoImageCal(originalWidth, originalHeight) {
 			// 获取图片的原始长宽
-			const windowWidth = this.parseWidth.value;
+			// const windowWidth = this.parseWidth.value;
+			const { windowWidth, windowHeight } = uni.getSystemInfoSync();	
 			const results = {};
-
 			if (originalWidth < 60 || originalHeight < 60) {
 				const { src } = this.node.attr;
 				let parent = this.$parent;
@@ -82,6 +83,8 @@ export default {
 				// 在图片width大于手机屏幕width时候
 				results.imageWidth = windowWidth;
 				results.imageheight = windowWidth * (originalHeight / originalWidth);
+				// results.imageWidth = originalWidth;
+				// results.imageheight = originalHeight;
 			} else {
 				// 否则展示原来的数据
 				results.imageWidth = originalWidth;

+ 23 - 15
components/gaoyia-parse/parse.css

@@ -33,14 +33,13 @@
   margin: 0;
   padding: 0;
 }
+
 .wxParse .div {
   margin: 0;
   padding: 0;
   display: block;
 }
-.p:empty{
-	display: none;
-}
+
 .wxParse .h1{
   font-size: 2em;
   line-height: 1.2em;
@@ -85,8 +84,7 @@
   font-style: italic;
 }
 .wxParse .spaceshow{
-	display: none!important;
-	  /* white-space: pre; */
+	  white-space: pre;
 }
 .wxParse .pre,
 .wxParse .tt,
@@ -136,6 +134,8 @@
 }
 
 .wxParse .strong,
+.wxParse .text,
+.wxParse .span,
 .wxParse .s {
   display: inline;
 }
@@ -155,12 +155,12 @@
 .wxParse .uni-image{
 	max-width: 100%;
 }
-/* .wxParse .img {
+.wxParse .img {
   display: block;
   max-width: 100%;
   margin-bottom: 0em;/* //与p标签底部padding同时修改 */
-  /* overflow: hidden; */
-
+  overflow: hidden;
+}
 
 .wxParse .blockquote {
   margin: 10upx 0;
@@ -213,12 +213,20 @@
 .wxParse .figure {
   overflow: hidden;
 }
-.wxParse .table .table{
+.wxParse .tablebox{
+	overflow: auto;
+	background-color: #f5f5f5;
+	background: #f5f5f5;
+	font-size: 13px;
+	padding: 8px;
+}
+.wxParse .table .table,.wxParse .table{
 	border-collapse:collapse;
 	box-sizing: border-box;
 	/* 内边框 */
-	border: 1px solid #dadada;
-	width: 100%;
+	/* width: 100%; */
+	overflow: auto;
+	white-space: pre;
 }
 .wxParse .tbody{
 	border-collapse:collapse;
@@ -226,20 +234,20 @@
 	/* 内边框 */
 	border: 1px solid #dadada;
 }
-.wxParse .thead, .wxParse .tfoot, .wxParse .th{
+.wxParse .table  .thead, .wxParse  .table .tfoot, .wxParse  .table .th{
 	border-collapse:collapse;
 	box-sizing: border-box;
 	background: #ececec;
 	font-weight: 40;
 }
-.wxParse .tr {
+.wxParse  .table .tr {
 	border-collapse:collapse;
 	box-sizing: border-box;
 	/* border: 2px solid #F0AD4E; */
 	overflow:auto;
 }
-.wxParse .th,
-.wxParse .td{
+.wxParse  .table .th,
+.wxParse  .table .td{
 	border-collapse:collapse;
 	box-sizing: border-box;
 	border: 2upx solid #dadada;

+ 14 - 5
components/gaoyia-parse/parse.vue

@@ -19,9 +19,10 @@
 </template>
 
 <script>
-	import HtmlToJson from './libs/html2json';
-	import wxParseTemplate from './components/wxParseTemplate0';
+import HtmlToJson from './libs/html2json';
+import wxParseTemplate from './components/wxParseTemplate0';
 
+	
 	export default {
 		name: 'wxParse',
 		props: {
@@ -109,6 +110,7 @@
 		},
 		computed: {},
 		mounted() {
+			this.setHtml()
 		},
 		methods: {
 			setHtml() {
@@ -133,6 +135,8 @@
 
 				this.imageUrls = results.imageUrls;
 				// this.nodes = results.nodes;
+				
+				
 				this.nodes = [];
 				results.nodes.forEach((item) => {
 					setTimeout(() => {
@@ -156,9 +160,14 @@
 						).exec();
 					// #endif
 					// #ifdef MP-BAIDU
-					swan.createSelectorQuery().select('.wxParse').boundingClientRect(function(rect) {
-						rect[0].width
-					}).exec()
+					const query = swan.createSelectorQuery();
+					query.select('.wxParse').boundingClientRect();
+					query.exec(obj => {
+						const rect = obj[0]
+						if (rect) {
+							res(rect.width);
+						}
+					});
 					// #endif
 					// #ifdef MP-ALIPAY
 					my.createSelectorQuery()

+ 14 - 3
pages/index/detailPage/index.vue

@@ -3,7 +3,7 @@
 	<view class="content">
 		<image class="logo" :src="detailObj.picture" mode='aspectFill'></image>
 		<view class="detail-title">
-			<text style="margin-left: 5%;">{{detailObj.desc}}</text>
+			<text class="detail-font">{{detailObj.desc}}</text>
 		    <text class="price-style">¥{{detailObj.money}}</text> 
 		</view>
 		
@@ -139,10 +139,10 @@
 		width: 100%;
 	}
 	.detail-title {
-		padding: 10px;
+		padding: 5px;
 		margin-bottom: 2%;
 		width: 100%;
-		height: 150rpx;
+		height: 160rpx;
 		display: flex;
 		flex-direction: column;
 		justify-content: space-around;
@@ -150,6 +150,17 @@
 		background: #fff;
 		font-size: 30rpx;
 	}
+	.detail-font {
+		display: -webkit-box;
+		overflow: hidden;
+		text-overflow: ellipsis;
+		word-wrap: break-word;
+		white-space: normal !important;
+		-webkit-line-clamp: 3;
+		-webkit-box-orient: vertical;
+		font-size: 14px;
+		margin-left: 5%;
+	}
 	
 	.price-style {
 		/* margin-right: 75%; */

+ 32 - 12
pages/index/index.vue

@@ -34,7 +34,7 @@
 				<view class="product-box" v-for="item in productList" :key="item.id"  @click="goDetail(item.id)">
 					<image :src="item.picture" mode='aspectFill'></image>
 					<view class="detail-box">
-						<view>{{item.desc || '-'}}</view>
+						<view class='product-font'>{{item.desc || '-'}}</view>
 						<view style="color: #999;">¥{{item.money || '-'}}</view>
 					</view>
 				</view>
@@ -256,16 +256,25 @@
 				});
 			},
 			 copyCode(){
-				 let that = this;
-				uni.setClipboardData({
-					data:that.pageInfo.copycontent,
-					success() {
-						uni.showToast({
-							icon:'none',
-							title:'复制成功'
-						})
-					}
-				})
+				let that = this;
+				 if(!that.isAuth){
+				 	uni.navigateTo({
+				 		url: '../auth/index',
+				 		success: res => {},
+				 		fail: () => {},
+				 		complete: () => {}
+				 	});
+				 }else {
+				 	uni.setClipboardData({
+				 	data:that.pageInfo.copycontent,
+				 	success() {
+				 		uni.showToast({
+				 			icon:'none',
+				 			title:'复制成功'
+				 		})
+				 	}
+				 })
+				 }
 			},
 			refresh () {
 			  this.$nextTick(() => {
@@ -340,6 +349,16 @@
 		margin-top: 5%;
 		margin-bottom: 1%;
 	}
+	.product-font {
+		display: -webkit-box;
+		overflow: hidden;
+		text-overflow: ellipsis;
+		word-wrap: break-word;
+		white-space: normal !important;
+		-webkit-line-clamp: 3;
+		-webkit-box-orient: vertical;
+		font-size: 14px;
+	}
 	.recommend-box {
 		width: 95%;
 		display: flex;
@@ -358,11 +377,12 @@
 		margin-bottom: 2%;
 	}
 	.product-box image {
-		width: 40%;
+		width: 40%!important;
 		height: 180rpx;
 		margin-right: 5%;
 	}
 	.detail-box {
+		width: 60%!important;
 		display: flex;
 		flex-direction: column;
 		justify-content: space-between;

+ 24 - 2
pages/selfCenter/helpPage/helpDetail/index.vue

@@ -15,6 +15,7 @@
 </template>
 
 <script>
+	 var md5 = require('../../../../common/md5.js')
 	import uParse from '@/components/gaoyia-parse/parse.vue'
 		export default {
 		components: {
@@ -26,10 +27,31 @@
 			}
 		},
 		onLoad(options) {
-	         console.log(options.qId)
-			 this.helpHtmlParse = options.qId
+	         this.getDetail(options.qId)
 		},
 		methods: {
+			getDetail(id){
+					 let  that = this;
+				uni.request({
+					url: getApp().globalData.shareUrl, //需要设置为全局
+					method: 'POST',
+					header: {
+						'content-type': 'application/x-www-form-urlencoded'
+					},
+					data: {
+						method: 'getHelpInfo',
+						timestamp: getApp().globalData.globalTimestamp, //Date.now()
+						sign: md5('getHelpInfo' + getApp().globalData.globalTimestamp),
+						id:id,
+					},
+					success: res => {
+						if (res.data.code === 200) {
+							that.helpHtmlParse = res.data.msg.content
+							console.log(res.data.msg)
+						}
+					}
+				});
+			}
 		}
 	}
 </script>

+ 3 - 4
pages/selfCenter/helpPage/index.vue

@@ -1,6 +1,6 @@
 <template>
 		<view class="list-box">
-		<view class="list-content" v-for="item in helpList" :key='item.id' @click="goHelpDetail(item.content)">
+		<view class="list-content" v-for="item in helpList" :key='item.id' @click="goHelpDetail(item.id)">
 			<text class="margin-left5">{{item.title}}</text>
 			<view class="apply-box">
 				<text style="color: #999;visibility: hidden;">点击申请</text>
@@ -45,10 +45,9 @@
 	       this.getHelpList();
 		},
 		methods: {
-	     goHelpDetail(content){
-			 console.log(content)
+	     goHelpDetail(id){
 			 uni.navigateTo({
-			 	url: '/pages/selfCenter/helpPage/helpDetail/index?qId='+content,
+			 	url: '/pages/selfCenter/helpPage/helpDetail/index?qId='+id,
 			 	success: res => {},
 			 	fail: () => {},
 			 	complete: () => {}

+ 1 - 1
pages/selfCenter/index.vue

@@ -101,7 +101,6 @@ export default {
 	onLoad() {
 	},
 	onShow() {
-		this.switchUserStatus(getApp().globalData.user_status)
 		this.getUserInfo();
 	},
 	methods: {
@@ -146,6 +145,7 @@ export default {
 						that.userInfoObj = res.data.msg;
 						that.isAuth = res.data.msg.auth_status === '1';
 						that.isAuthPhone = res.data.msg.phone;
+						that.switchUserStatus(res.data.msg.status)
 						if(that.isAuth){
 							that.userName  = getApp().globalData.user_name;
 							that.userHead = getApp().globalData.user_headUrl;