فهرست منبع

颜选美学v1.3线上bug修改

yuwenjun1997 2 سال پیش
والد
کامیت
1b53232da4

+ 1 - 1
common/storage.js

@@ -1,7 +1,7 @@
 import { encrypt, decrypt } from '@/common/crypto.js'
 
 // 在开发环境下不需要加密数据
-const encryptFlag = process.env.NODE_ENV === 'production'
+const encryptFlag = false
 
 // 预设字段头
 const prefix = 'HEHE_'

+ 1 - 0
components/views/cm-cart-product/cm-cart-product.vue

@@ -25,6 +25,7 @@
                     </text>
                 </view>
                 <cm-number-box class="numberbox" v-model="productInfo.num" @change="change"></cm-number-box>
+                <!-- <uni-number-box class="numberbox" v-model="productInfo.num" @change="change" :min="1"></uni-number-box> -->
             </template>
         </view>
     </view>

+ 2 - 2
components/views/cm-floor-template/cm-floor-template.vue

@@ -1,6 +1,6 @@
 <template>
     <view class="floor-template" v-if="floorData">
-        <cm-floor-title :title="floorData.title" @click="$emit('more', floorData)"></cm-floor-title>
+        <cm-floor-title :title="floorData.title" @click="$emit('more', floorData)" :sub-title="floorData.detail"></cm-floor-title>
         <!-- banner区域 -->
         <view class="floor-banner-area" :class="'template-' + templateType" v-if="templateType !== '8'">
             <view
@@ -249,7 +249,7 @@ export default {
         // flex-wrap: wrap;
         display: grid;
         grid-template-columns: repeat(3, 1fr);
-        grid-template-rows: repeat(2, 1fr);
+        // grid-template-rows: repeat(2, 1fr);
         grid-row-gap: 16rpx;
 
         .product-item {

+ 31 - 16
components/views/cm-floor-title/cm-floor-title.vue

@@ -1,9 +1,13 @@
 <template>
     <view class="floor-title">
-        <text class="title" v-text="title"></text>
-        <view class="more" @click="$emit('click')">
-            <text v-text="moreText"></text> <text class="iconfont icon-chakangengduo"> </text>
+        <view class="row">
+            <text class="title" v-text="title"></text>
+            <view class="more" @click="$emit('click')">
+                <text v-text="moreText"></text>
+                <text class="iconfont icon-chakangengduo"></text>
+            </view>
         </view>
+        <view class="sub-title" v-if="subTitle"><text v-text="subTitle"></text></view>
     </view>
 </template>
 
@@ -15,6 +19,10 @@ export default {
             type: String,
             default: '标题'
         },
+        subTitle: {
+            type: String,
+            default: ''
+        },
         moreText: {
             type: String,
             default: '查看更多'
@@ -26,24 +34,31 @@ export default {
 <style lang="scss" scoped>
 // 楼层标题
 .floor-title {
-    @extend .cm-flex-between;
     padding: 24rpx;
 
-    .title {
-        @include ellipsis(1);
-        max-width: 600rpx;
-        font-size: 34rpx;
-        font-weight: 600;
-        color: #333333;
-    }
+    .row {
+        @extend .cm-flex-between;
+        .title {
+            @include ellipsis(1);
+            max-width: 600rpx;
+            font-size: 34rpx;
+            font-weight: 600;
+            color: #333333;
+        }
 
-    .more {
-        font-size: 26rpx;
-        color: #999999;
+        .more {
+            font-size: 26rpx;
+            color: #999999;
 
-        .iconfont {
-            font-size: 24rpx;
+            .iconfont {
+                font-size: 24rpx;
+            }
         }
     }
+    .sub-title {
+        font-size: 26rpx;
+        color: #999999;
+        margin-top: 8rpx;
+    }
 }
 </style>

+ 11 - 2
components/views/cm-share-popup/cm-share-popup.vue

@@ -35,7 +35,7 @@
         <!-- 海报 -->
         <view class="poster-container" v-show="visiable">
             <!-- 画布 -->
-            <image :src="posterUrl" class="poster-image"></image>
+            <image :src="posterUrl" class="poster-image" @load="onImageLoading"></image>
             <!-- 下载按钮 -->
             <view class="poster item" @click="savePoster" v-if="downType === 'fixed'">
                 <view class="icon-image"><image :src="staticUrl + 'icon-download.png'"></image></view>
@@ -83,6 +83,7 @@ export default {
             visiable: false,
             imageList: [],
             posterUrl: '',
+            isLoading: false,
             // 海报数据信息
             posterData: {
                 query: '', // 查询参数字符串
@@ -101,6 +102,12 @@ export default {
         ...mapGetters(['systemInfo'])
     },
     methods: {
+        onImageLoading() {
+            this.isLoading = false
+            console.log('123')
+            uni.hideLoading()
+        },
+
         // 绘制海报  初始化
         initDrawPoster() {
             this.downLoadImageTask()
@@ -218,7 +225,7 @@ export default {
                                 this.close()
                             }
                         },
-                        complete: () => {
+                        fail() {
                             uni.hideLoading()
                         }
                     },
@@ -345,6 +352,8 @@ export default {
         },
 
         async createPoster() {
+            if (this.isLoading) return
+            this.isLoading = true
             // 合并海报数据
             this.posterData = { ...this.posterData, ...this.data }
             try {

+ 6 - 1
pages/tabBar/category/category.vue

@@ -1,7 +1,7 @@
 <template>
     <view class="category">
         <tui-skeleton v-if="isRequest" :loadingType="3" :isLoading="true"></tui-skeleton>
-        <template v-else>
+        <template v-else-if="categories.length > 0">
             <!-- 侧边导航 -->
             <scroll-view class="slide-navbar" :scroll-y="true">
                 <template v-for="(item, index) in categories">
@@ -28,6 +28,11 @@
                 </view>
             </scroll-view>
         </template>
+        <template v-else>
+            <tui-no-data :imgUrl="staticUrl + 'icon-empty-address.png'" :imgHeight="230" :imgWidth="290">
+                <view class="empty-tip">暂无分类信息~</view>
+            </tui-no-data>
+        </template>
     </view>
 </template>
 

+ 158 - 0
pages/views/goods/components/jyf-Parser/CssHandler.js

@@ -0,0 +1,158 @@
+//CssHandler.js
+// #ifdef MP-WEIXIN
+const CanIUse = require('./api.js').versionHigherThan('2.7.1');
+// #endif
+function CssHandler(style, tagStyle) {
+	this._style = new CssTokenizer(style, tagStyle).parse();
+}
+CssHandler.prototype.match = function(name, attrs) {
+	let matched = this._style[name] ? (this._style[name] + ';') : '';
+	if (attrs.id)
+		matched += (this._style['#' + attrs.id] ? (this._style['#' + attrs.id] + ';') : '');
+	if (attrs.class)
+		for (var Class of attrs.class.split(' '))
+			matched += (this._style['.' + Class] ? (this._style['.' + Class] + ';') : '');
+	return matched;
+}
+
+function CssTokenizer(style = '', tagStyle = {}) {
+	this.res = this.initClass(tagStyle);
+	this._state = "SPACE";
+	this._buffer = style;
+	this._sectionStart = 0;
+	this._index = 0;
+	this._name = '';
+	this._content = '';
+	this._list = [];
+	this._comma = false;
+}
+CssTokenizer.prototype.initClass = function(tagStyle) {
+	let initStyle = JSON.parse(JSON.stringify(tagStyle));
+	initStyle.a = "display:inline;color:#366092;word-break:break-all;" + (initStyle.a || "");
+	initStyle.address = "font-style:italic;" + (initStyle.address || "");
+	initStyle.blockquote = initStyle.blockquote ||
+		'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px;';
+	initStyle.center = 'text-align:center;' + (initStyle.center || "");
+	initStyle.cite = "font-style:italic;" + (initStyle.cite || "");
+	initStyle.code = initStyle.code ||
+		'padding:0 1px 0 1px;margin-left:2px;margin-right:2px;background-color:#f8f8f8;border:1px solid #cccccc;border-radius:3px;';
+	initStyle.dd = "margin-left:40px;" + (initStyle.dd || "");
+	initStyle.img = "max-width:100%;" + (initStyle.img || "");
+	initStyle.mark = "display:inline;background-color:yellow;" + (initStyle.mark || "");
+	initStyle.pre = "overflow:scroll;" + (initStyle.pre || 'background-color:#f6f8fa;padding:5px;border-radius:5px;');
+	initStyle.s = "display:inline;text-decoration:line-through;" + (initStyle.s || "");
+	initStyle.u = "display:inline;text-decoration:underline;" + (initStyle.u || "");
+	// #ifdef MP-WEIXIN
+	//低版本兼容
+	if (!CanIUse) {
+		// #endif
+		initStyle.big = "display:inline;font-size:1.2em;" + (initStyle.big || "");
+		initStyle.small = "display:inline;font-size:0.8em;" + (initStyle.small || "");
+		initStyle.pre = "font-family:monospace;white-space:pre;" + initStyle.pre;
+		// #ifdef MP-WEIXIN
+	}
+	// #endif
+	return initStyle;
+}
+CssTokenizer.prototype.SPACE = function(c) {
+	if (/[a-zA-Z.#]/.test(c)) {
+		this._sectionStart = this._index;
+		this._state = "InName";
+	} else if (c == '@') this._state = "Ignore1";
+	else if (c == '/') this._state = "BeforeComment";
+};
+CssTokenizer.prototype.BeforeComment = function(c) {
+	if (c == '*') this._state = "InComment";
+	else {
+		this._index--;
+		this._state = "SPACE";
+	}
+};
+CssTokenizer.prototype.InComment = function(c) {
+	if (c == '*') this._state = "AfterComment";
+};
+CssTokenizer.prototype.AfterComment = function(c) {
+	if (c == '/') this._state = "SPACE";
+	else {
+		this._index--;
+		this._state = "InComment"
+	}
+};
+CssTokenizer.prototype.InName = function(c) {
+	if (c == '{') {
+		this._list.push(this._buffer.substring(this._sectionStart, this._index))
+		this._sectionStart = this._index + 1;
+		this._state = "InContent";
+	} else if (c == ',') {
+		this._list.push(this._buffer.substring(this._sectionStart, this._index));
+		this._sectionStart = this._index + 1;
+		this._comma = true;
+	} else if ((c == '.' || c == '#') && !this._comma) {
+		this._buffer = this._buffer.splice(this._index, 1, ' ');
+	} else if (/\s/.test(c)) {
+		this._name = this._buffer.substring(this._sectionStart, this._index);
+		this._state = "NameSpace";
+	} else if (/[>:\[]/.test(c)) {
+		if (this._list.length) this._state = "IgnoreName";
+		else this._state = "Ignore1";
+	} else this._comma = false;
+};
+CssTokenizer.prototype.NameSpace = function(c) {
+	if (c == '{') {
+		this._list.push(this._name);
+		this._sectionStart = this._index + 1;
+		this._state = "InContent";
+	} else if (c == ',') {
+		this._comma = true;
+		this._list.push(this._name);
+		this._sectionStart = this._index + 1;
+		this._state = "InName"
+	} else if (/\S/.test(c)) {
+		if (this._comma) {
+			this._sectionStart = this._index;
+			this._index--;
+			this._state = "InName";
+		} else if (this._list.length) this._state = "IgnoreName";
+		else this._state = "Ignore1"
+	}
+};
+CssTokenizer.prototype.InContent = function(c) {
+	if (c == '}') {
+		this._content = this._buffer.substring(this._sectionStart, this._index);
+		for (let item of this._list)
+			this.res[item] = (this.res[item] || '') + ";" + this._content;
+		this._list = [];
+		this._comma = false;
+		this._state = "SPACE";
+	}
+};
+CssTokenizer.prototype.IgnoreName = function(c) {
+	if (c == ',') {
+		this._sectionStart = this._index + 1;
+		this._state = "InName";
+	} else if (c == '{') {
+		this._sectionStart = this._index + 1;
+		this._state = "InContent";
+	}
+}
+CssTokenizer.prototype.Ignore1 = function(c) {
+	if (c == ';') {
+		this._state = "SPACE";
+		this._sectionStart = this._index + 1;
+	} else if (c == '{') this._state = "Ignore2";
+};
+CssTokenizer.prototype.Ignore2 = function(c) {
+	if (c == '}') {
+		this._state = "SPACE";
+		this._sectionStart = this._index + 1;
+	} else if (c == '{') this._state = "Ignore3";
+};
+CssTokenizer.prototype.Ignore3 = function(c) {
+	if (c == '}') this._state = "Ignore2";
+};
+CssTokenizer.prototype.parse = function() {
+	for (; this._index < this._buffer.length; this._index++)
+		this[this._state](this._buffer[this._index]);
+	return this.res;
+};
+module.exports = CssHandler;

+ 411 - 0
pages/views/goods/components/jyf-Parser/DomHandler.js

@@ -0,0 +1,411 @@
+//DomHandler.js
+var emoji; // 使用emoji补丁包时将此句改为 const emoji = require('./emoji.js');
+const CssHandler = require('./CssHandler.js');
+// #ifdef MP-WEIXIN
+const CanIUse = require('./api.js').versionHigherThan('2.7.1');
+// #endif
+const trustTag = {
+	a: 0,
+	abbr: 1,
+	ad: 0,
+	audio: 0,
+	b: 1,
+	blockquote: 1,
+	br: 0,
+	code: 1,
+	col: 0,
+	colgroup: 0,
+	dd: 1,
+	del: 1,
+	dl: 1,
+	dt: 1,
+	div: 1,
+	em: 1,
+	fieldset: 0,
+	font: 1,
+	h1: 0,
+	h2: 0,
+	h3: 0,
+	h4: 0,
+	h5: 0,
+	h6: 0,
+	hr: 0,
+	i: 1,
+	img: 1,
+	ins: 1,
+	label: 1,
+	legend: 0,
+	li: 0,
+	ol: 0,
+	p: 1,
+	q: 1,
+	source: 0,
+	span: 1,
+	strong: 1,
+	sub: 0,
+	sup: 0,
+	table: 0,
+	tbody: 0,
+	td: 0,
+	tfoot: 0,
+	th: 0,
+	thead: 0,
+	tr: 0,
+	u: 1,
+	ul: 0,
+	video: 1
+};
+const blockTag = {
+	address: true,
+	article: true,
+	aside: true,
+	body: true,
+	center: true,
+	cite: true,
+	footer: true,
+	header: true,
+	html: true,
+	nav: true,
+	pre: true,
+	section: true
+};
+const ignoreTag = {
+	area: true,
+	base: true,
+	basefont: true,
+	canvas: true,
+	circle: true,
+	command: true,
+	ellipse: true,
+	embed: true,
+	frame: true,
+	head: true,
+	iframe: true,
+	input: true,
+	isindex: true,
+	keygen: true,
+	line: true,
+	link: true,
+	map: true,
+	meta: true,
+	param: true,
+	path: true,
+	polygon: true,
+	polyline: true,
+	rect: true,
+	script: true,
+	stop: true,
+	textarea: true,
+	title: true,
+	track: true,
+	use: true,
+	wbr: true
+};
+// #ifdef MP-WEIXIN
+if (CanIUse) {
+	trustTag.bdi = 0;
+	trustTag.bdo = 0;
+	trustTag.caption = 0;
+	trustTag.rt = 0;
+	trustTag.ruby = 0;
+	ignoreTag.rp = true;
+	trustTag.big = 1;
+	trustTag.small = 1;
+	trustTag.pre = 0;
+	delete blockTag.pre;
+} else blockTag.caption = true;
+// #endif
+
+function randomId() {
+	var res = "";
+	for (var i = 0; i < 5; i++) {
+		let rand = parseInt(Math.random() * 52);
+		if (rand < 26)
+			res = res + String.fromCharCode(65 + rand);
+		else
+			res = res + String.fromCharCode(71 + rand);
+	}
+	return res;
+}
+
+function DomHandler(style, options) {
+	this.imgList = [];
+	this.imgIndex = 0;
+	this.nodes = [];
+	this.title = "";
+	this._CssHandler = new CssHandler(style, options.tagStyle);
+	this._tagStack = [];
+	this._videoNum = 0;
+	// #ifdef MP-BAIDU || MP-TOUTIAO || H5
+	this._imgMode = options.imgMode;
+	// #endif
+	this._whiteSpace = false;
+	this._domain = options.domain;
+	this._protocol = /:\/\//.test(options.domain) ? options.domain.split(/:\/\//)[0] : "http";
+	this._useAnchor = options.useAnchor;
+}
+DomHandler.prototype._addDomElement = function(element) {
+	if (element.name == 'pre' || (element.attrs && /white-space\s*:\s*pre/.test(element.attrs.style))) {
+		this._whiteSpace = true;
+		element.pre = true;
+	}
+	let parent = this._tagStack[this._tagStack.length - 1];
+	let siblings = parent ? parent.children : this.nodes;
+	siblings.push(element);
+};
+DomHandler.prototype._bubbling = function() {
+	for (let i = this._tagStack.length - 1; i >= 0; i--) {
+		if (trustTag[this._tagStack[i].name])
+			this._tagStack[i].continue = true;
+		else
+			return this._tagStack[i].name;
+	}
+}
+DomHandler.prototype.onopentag = function(name, attrs) {
+	let element = {
+		children: []
+	};
+	let matched = this._CssHandler.match(name, attrs, element);
+	//处理属性
+	switch (name) {
+		case 'div':
+		case 'p':
+			if (attrs.align) {
+				attrs.style += (';text-align:' + attrs.align);
+				delete attrs.align;
+			}
+			break;
+		case 'img':
+			if (attrs.width) {
+				attrs.style = 'width:' + attrs.width + (/[0-9]/.test(attrs.width[attrs.width.length - 1]) ? 'px' : '') + ';' +
+					attrs.style;
+				delete attrs.width;
+			}
+			if (attrs['data-src']) {
+				attrs.src = attrs.src || attrs['data-src'];
+				delete attrs['data-src'];
+			}
+			// #ifdef MP-BAIDU || MP-TOUTIAO || H5
+			if (this._imgMode == "widthFix") attrs.style += ";height:auto !important;";
+			// #endif
+			if (!attrs.hasOwnProperty('ignore') && attrs.src) {
+				if (this._bubbling() == 'a') {
+					attrs.ignore = "true"; // 图片在链接中不可预览
+					break;
+				}
+				var url = attrs.src;
+				// #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU || MP-TOUTIAO
+				// 去重,至多重试10次
+				for (let i = 0; this.imgList.indexOf(url) != -1 && i < 10; i++) {
+					// 网络链接
+					if (/^http/.test(url)) {
+						url = url.replace(/^(https*):\/\/([\S]+?)\//, function() {
+							var domain = "";
+							for (var c of arguments[2]) {
+								if (/[a-zA-Z]/.test(c))
+									domain += (Math.random() >= 0.5 ? c.toUpperCase() : c);
+								else domain += c;
+							}
+							return (arguments[1] + '://' + domain + '/');
+						})
+					}
+					// base64
+					else if (/base64/.test(url)) {
+						url = url.replace(/^data:(image\/\S+);base64,/, function() {
+							var head = "";
+							for (var c of arguments[1]) {
+								if (/[a-zA-Z]/.test(c))
+									head += (Math.random() >= 0.5 ? c.toUpperCase() : c);
+								else head += c;
+							}
+							return ('data:' + head + ';base64,');
+						})
+					} else break;
+				}
+				// #endif
+				element.current = this.imgList.length;
+				this.imgList.push(url);
+			} else
+				attrs.ignore = "true";
+			if (this._domain && attrs.src[0] == '/') {
+				if (attrs.src[1] == '/') attrs.src = this._protocol + ":" + attrs.src;
+				else attrs.src = this._domain + attrs.src;
+			}
+			break;
+		case 'font':
+			name = 'span';
+			if (attrs.color) {
+				attrs.style += (';color:' + attrs.color);
+				delete attrs.color;
+			}
+			if (attrs.face) {
+				attrs.style += (";font-family:" + attrs.face);
+				delete attrs.face;
+			}
+			if (attrs.size) {
+				var size = parseInt(attrs.size);
+				if (size < 1) size = 1;
+				else if (size > 7) size = 7;
+				let map = [10, 13, 16, 18, 24, 32, 48];
+				attrs.style += (";font-size:" + map[size - 1] + "px");
+				delete attrs.size;
+			}
+			break;
+		case 'a':
+		case 'ad':
+			this._bubbling();
+			break;
+		case 'video':
+		case 'audio':
+			attrs.loop = attrs.hasOwnProperty('loop');
+			attrs.controls = attrs.hasOwnProperty('controls');
+			attrs.autoplay = attrs.hasOwnProperty('autoplay');
+			if (name == 'video') {
+				attrs.muted = attrs.hasOwnProperty('muted');
+				if (attrs.width) {
+					attrs.style = 'width:' + parseFloat(attrs.width) + 'px;' + attrs.style;
+					delete attrs.width;
+				}
+				if (attrs.height) {
+					attrs.style = 'height:' + parseFloat(attrs.height) + 'px;' + attrs.style;
+					delete attrs.height;
+				}
+			}
+			attrs.id = randomId() + (name == 'video' ? ++this._videoNum : '');
+			attrs.source = [];
+			if (attrs.src) attrs.source.push(attrs.src);
+			if (!attrs.controls && !attrs.autoplay)
+				console.warn('存在没有controls属性的' + name + '标签,可能导致无法播放', attrs);
+			this._bubbling();
+			break;
+		case 'source':
+			let parent = this._tagStack[this._tagStack.length - 1];
+			if (parent && (parent.name == 'video' || parent.name == 'audio')) {
+				parent.attrs.source.push(attrs.src);
+				if (!parent.attrs.src) parent.attrs.src = attrs.src;
+			}
+			this._tagStack.push(element);
+			return;
+	}
+	if(this._useAnchor && attrs.id) this._bubbling();
+	attrs.style = matched + attrs.style;
+	if (blockTag[name]) name = 'div';
+	else if (!trustTag.hasOwnProperty(name)) name = 'span';
+	element.name = name;
+	element.attrs = attrs;
+	this._addDomElement(element);
+	this._tagStack.push(element);
+};
+DomHandler.prototype.ontext = function(data) {
+	if (!this._whiteSpace) {
+		if (!/\S/.test(data))
+			return;
+		data = data.replace(/\s+/g, " ");
+	}
+	// #ifndef MP-WEIXIN || MP-QQ || APP-PLUS || H5
+	let entities = {
+		lt: "<",
+		gt: ">",
+		nbsp: "\u00A0",
+		ensp: "\u2002",
+		emsp: "\u2003",
+		amp: "&",
+		apos: "'",
+		quot: '"',
+		ndash: "–",
+		mdash: "—",
+		middot: "·",
+		lsquo: "‘",
+		rsquo: "’",
+		ldquo: "“",
+		rdquo: "”",
+		bull: "•",
+		hellip: "…",
+		permil: "‰",
+		copy: "©",
+		reg: "®",
+		trade: "™",
+		times: "×",
+		divide: "÷",
+		cent: "¢",
+		pound: "£",
+		yen: "¥",
+		euro: "€",
+		sect: "§"
+	};
+	data = data.replace(/&(\S{1,8}?);/g, function() {
+		if (entities[arguments[1]]) return entities[arguments[1]];
+		return "";
+	});
+	// #endif
+	let element = {
+		type: 'text'
+	};
+	// #ifdef MP-WEIXIN || MP-QQ || H5 || APP-PLUS
+	data = data.replace(/&nbsp;/g, '&#xA0;'); // 解决连续&nbsp;失效问题
+	if (/&#*((?!sp|lt|gt).){2,8};/.test(data)) element.decode = true;
+	// #endif
+	if (emoji) data = emoji.parseEmoji(data);
+	element.text = data;
+	this._addDomElement(element);
+};
+DomHandler.prototype.onclosetag = function(name) {
+	let element = this._tagStack.pop();
+	let parent = this._tagStack.length ? this._tagStack[this._tagStack.length - 1].children : this.nodes;
+	if (ignoreTag[name]) {
+		if (name == 'title') {
+			try {
+				this.title = element.children[0].text;
+			} catch (e) {}
+		}
+		parent.pop();
+	}
+	// 设置表格的边框
+	if (name == 'table') {
+		if (element.attrs.border)
+			element.attrs.style += (";border:" + element.attrs.border + "px solid gray;");
+		if (element.attrs.hasOwnProperty("cellspacing"))
+			element.attrs.style += (";border-spacing:" + element.attrs.cellspacing + "px");
+
+		function setBorder(node) {
+			if (node.type == 'text') return;
+			if (node.name == 'th' || node.name == 'td') {
+				if (element.attrs.border)
+					node.attrs.style += ";border:" + element.attrs.border + "px solid gray;";
+				if (element.attrs.hasOwnProperty("cellpadding"))
+					node.attrs.style += ";padding:" + element.attrs.cellpadding + "px";
+			}
+			for (var child of node.children)
+				setBorder(child);
+		}
+		if (element.attrs.border || element.attrs.hasOwnProperty("cellpadding")) {
+			for (var child of element.children)
+				setBorder(child);
+		}
+	}
+	// 合并一些不必要的层,减小节点深度
+	if (element.children.length == 1 && element.name == 'div') {
+		let child = element.children[0];
+		if (child.name == 'div' && !(/padding/.test(element.attrs.style)) && !(/margin/.test(element.attrs.style) &&
+				/margin/.test(child.attrs.style)) && !(/display/.test(element.attrs.style)) && !(/display/.test(child.attrs.style)) &&
+			!(element.attrs.id && child.attrs.id) && !(element.attrs.class && child.attrs.class)) {
+			if (/padding/.test(child.attrs.style))
+				child.attrs.style = ";box-sizing:border-box;" + child.attrs.style;
+			child.attrs.style = element.attrs.style + ";" + child.attrs.style;
+			child.attrs.id = (child.attrs.id || "") + (element.attrs.id || "");
+			child.attrs.class = (child.attrs.class || "") + (element.attrs.class || "");
+			parent[parent.indexOf(element)] = child;
+		}
+	}
+	if (element.pre) {
+		this._whiteSpace = false;
+		for (var ele of this._tagStack)
+			if (ele.pre)
+				this._whiteSpace = true;
+		delete element.pre;
+	}
+	// 多层样式处理 
+	if (this._CssHandler.pop)
+		this._CssHandler.pop(element);
+};
+module.exports = DomHandler;

+ 240 - 0
pages/views/goods/components/jyf-Parser/Parser.js

@@ -0,0 +1,240 @@
+//Parser.js
+const Tokenizer = require("./Tokenizer.js");
+const DomHandler = require("./DomHandler.js");
+const trustAttrs = {
+	align: true,
+	alt: true,
+	// #ifdef MP-BAIDU
+	appid: true,
+	apid: true,
+	// #endif
+	author: true,
+	autoplay: true,
+	border: true,
+	cellpadding: true,
+	cellspacing: true,
+	class: true,
+	color: true,
+	colspan: true,
+	controls: true,
+	"data-src": true,
+	dir: true,
+	face: true,
+	height: true,
+	href: true,
+	id: true,
+	ignore: true,
+	loop: true,
+	muted: true,
+	name: true,
+	poster: true,
+	rowspan: true,
+	size: true,
+	span: true,
+	src: true,
+	start: true,
+	style: true,
+	type: true,
+	// #ifdef MP-WEIXIN || MP-QQ
+	"unit-id": true,
+	// #endif
+	width: true,
+};
+// #ifdef MP-BAIDU || MP-TOUTIAO || H5
+const textTag = {
+  abbr: true,
+  b: true,
+  big: true,
+  code: true,
+  del: true,
+  em: true,
+  font: true,
+  i: true,
+  ins: true,
+  label: true,
+  mark: true,
+  q: true,
+  s: true,
+  small: true,
+  span: true,
+  strong: true,
+  sub: true,
+  sup: true,
+  u: true
+}
+const _traverse = function(nodes) {
+	for (var element of nodes) {
+		if (element.type == "text")
+			continue;
+		if (!element.continue) {
+			// #ifdef H5
+			if(textTag[element.name]){
+				element.continue = true;
+				_traverse(element.children);
+				continue;
+			}
+			// #endif
+			var res = "";
+			var style = element.attrs.style;
+			var reg = /float\s*:\s*[^;]*/i;
+			if (reg.test(style)) res += reg.exec(style)[0];
+			reg = /margin[^;]*/gi;
+			var margin = reg.exec(style);
+			while (margin) {
+				res += (';' + margin[0]);
+				margin = reg.exec(style);
+			}
+			reg = /display\s*:\s*([^;]*)/i;
+			if (reg.test(style) && reg.exec(style)[1] != "flex") res += (';' + reg.exec(style)[0]);
+			// #ifdef MP-BAIDU || MP-TOUTIAO
+			else if(textTag[element.name]) res+=";display:inline";
+			// #endif
+			else res += (";display:" + (element.name == 'img' ? 'inline-block' : 'block'));
+			reg = /flex\s*:[^;]*/i;
+			if (reg.test(style)) res += (';' + reg.exec(style)[0]);
+			reg = /[^;\s]*width[^;]*/ig;
+			var width = reg.exec(style);
+			while (width) {
+				res += (';' + width[0]);
+				width = reg.exec(style);
+			}
+			element.attrs.containStyle = res;
+			if (/[^-]width[^pev;]+/.test(";" + style))
+				element.attrs.style += ";width:100%";
+			let addMargin = "";
+			if (/margin\s*:/.test(style)) addMargin = ';margin:0';
+			else if (/margin-top/.test(style)) addMargin = ';margin-top:0';
+			else if (/margin-bottom/.test(style)) addMargin = ';margin-bottom:0';
+			element.attrs.style = element.attrs.style.replace(/margin[^;]*/gi, "");
+			element.attrs.style += addMargin;
+		} else _traverse(element.children);
+	}
+};
+// #endif
+const voidTag = {
+	area: true,
+	base: true,
+	basefont: true,
+	br: true,
+	col: true,
+	circle: true,
+	command: true,
+	ellipse: true,
+	embed: true,
+	frame: true,
+	hr: true,
+	img: true,
+	input: true,
+	isindex: true,
+	keygen: true,
+	line: true,
+	link: true,
+	meta: true,
+	param: true,
+	path: true,
+	polygon: true,
+	polyline: true,
+	rect: true,
+	source: true,
+	stop: true,
+	track: true,
+	use: true,
+	wbr: true
+};
+
+function Parser(cbs, callback) {
+	this._cbs = cbs;
+	this._callback = callback;
+	this._tagname = "";
+	this._attribname = "";
+	this._attribvalue = "";
+	this._attribs = null;
+	this._stack = [];
+	this._tokenizer = new Tokenizer(this);
+}
+Parser.prototype.ontext = function(data) {
+	this._cbs.ontext(data);
+};
+Parser.prototype.onopentagname = function(name) {
+	name = name.toLowerCase();
+	this._tagname = name;
+	this._attribs = {
+		style: ''
+	};
+	if (!voidTag[name]) this._stack.push(name);
+};
+Parser.prototype.onopentagend = function() {
+	if (this._attribs) {
+		this._cbs.onopentag(this._tagname, this._attribs);
+		this._attribs = null;
+	}
+	if (voidTag[this._tagname]) this._cbs.onclosetag(this._tagname);
+	this._tagname = "";
+};
+Parser.prototype.onclosetag = function(name) {
+	name = name.toLowerCase();
+	if (this._stack.length && !voidTag[name]) {
+		var pos = this._stack.lastIndexOf(name);
+		if (pos !== -1) {
+			pos = this._stack.length - pos;
+			while (pos--) this._cbs.onclosetag(this._stack.pop());
+		} else if (name === "p") {
+			this.onopentagname(name);
+			this._closeCurrentTag();
+		}
+	} else if (name === "br" || name === "hr" || name === "p") {
+		this.onopentagname(name);
+		this._closeCurrentTag();
+	}
+};
+Parser.prototype._closeCurrentTag = function() {
+	let name = this._tagname;
+	this.onopentagend();
+	if (this._stack[this._stack.length - 1] === name) {
+		this._cbs.onclosetag(name);
+		this._stack.pop();
+	}
+};
+Parser.prototype.onattribend = function() {
+	this._attribvalue = this._attribvalue.replace(/&quot;/g, '"');
+	if (this._attribs && trustAttrs[this._attribname]) {
+		this._attribs[this._attribname] = this._attribvalue;
+	}
+	this._attribname = "";
+	this._attribvalue = "";
+};
+Parser.prototype.onend = function() {
+	for (
+		var i = this._stack.length; i > 0; this._cbs.onclosetag(this._stack[--i])
+	);
+	this._callback({
+		'nodes': this._cbs.nodes,
+		'title': this._cbs.title,
+		'imgList': this._cbs.imgList
+	});
+};
+Parser.prototype.write = function(chunk) {
+	this._tokenizer.parse(chunk);
+};
+
+function html2nodes(data, options) {
+	return new Promise(function(resolve, reject) {
+		try {
+			let style = '';
+			data = data.replace(/<style.*?>([\s\S]*?)<\/style>/gi, function() {
+				style += arguments[1];
+				return '';
+			});
+			let handler = new DomHandler(style, options);
+			new Parser(handler, (res) => {
+				// #ifdef MP-BAIDU || MP-TOUTIAO || H5
+				_traverse(res.nodes);
+				// #endif
+				return resolve(res);
+			}).write(data);
+		} catch (err) {
+			return reject(err);
+		}
+	})
+}
+module.exports = html2nodes;

+ 218 - 0
pages/views/goods/components/jyf-Parser/Tokenizer.js

@@ -0,0 +1,218 @@
+//Tokenizer.js
+function Tokenizer(cbs) {
+	this._state = "TEXT";
+	this._buffer = "";
+	this._sectionStart = 0;
+	this._index = 0;
+	this._cbs = cbs;
+}
+Tokenizer.prototype.TEXT = function(c) {
+	var index = this._buffer.indexOf("<", this._index);
+	if (index != -1) {
+		this._index = index;
+		this._cbs.ontext(this._getSection());
+		this._state = "BeforeTag";
+		this._sectionStart = this._index;
+	} else this._index = this._buffer.length;
+};
+Tokenizer.prototype.BeforeTag = function(c) {
+	switch (c) {
+		case "/":
+			this._state = "BeforeCloseTag";
+			break;
+		case "!":
+			this._state = "BeforeDeclaration";
+			break;
+		case "?":
+			let index = this._buffer.indexOf(">", this._index);
+			if (index != -1) {
+				this._index = index;
+				this._sectionStart = this._index + 1;
+			} else this._sectionStart = this._index = this._buffer.length;
+			this._state = "TEXT";
+			break;
+		case ">":
+			this._state = "TEXT";
+			break;
+		case "<":
+			this._cbs.ontext(this._getSection());
+			this._sectionStart = this._index;
+			break;
+		default:
+			if (/\s/.test(c)) this._state = "TEXT";
+			else {
+				this._state = "InTag";
+				this._sectionStart = this._index;
+			}
+	}
+};
+Tokenizer.prototype.InTag = function(c) {
+	if (c === "/" || c === ">" || /\s/.test(c)) {
+		this._cbs.onopentagname(this._getSection());
+		this._state = "BeforeAttrsName";
+		this._index--;
+	}
+};
+Tokenizer.prototype.BeforeAttrsName = function(c) {
+	if (c === ">") {
+		this._cbs.onopentagend();
+		this._state = "TEXT";
+		this._sectionStart = this._index + 1;
+	} else if (c === "/") {
+		this._state = "InSelfCloseTag";
+	} else if (!(/\s/.test(c))) {
+		this._state = "InAttrsName";
+		this._sectionStart = this._index;
+	}
+};
+Tokenizer.prototype.InAttrsName = function(c) {
+	if (c === "=" || c === "/" || c === ">" || /\s/.test(c)) {
+		this._cbs._attribname = this._getSection().toLowerCase();
+		this._sectionStart = -1;
+		this._state = "AfterAttrsName";
+		this._index--;
+	}
+};
+Tokenizer.prototype.AfterAttrsName = function(c) {
+	if (c === "=") {
+		this._state = "BeforeAttrsValue";
+	} else if (c === "/" || c === ">") {
+		this._cbs.onattribend();
+		this._state = "BeforeAttrsName";
+		this._index--;
+	} else if (!(/\s/.test(c))) {
+		this._cbs.onattribend();
+		this._state = "InAttrsName";
+		this._sectionStart = this._index;
+	}
+};
+Tokenizer.prototype.BeforeAttrsValue = function(c) {
+	if (c === '"') {
+		this._state = "InAttrsValueDQ";
+		this._sectionStart = this._index + 1;
+	} else if (c === "'") {
+		this._state = "InAttrsValueSQ";
+		this._sectionStart = this._index + 1;
+	} else if (!(/\s/.test(c))) {
+		this._state = "InAttrsValueNQ";
+		this._sectionStart = this._index;
+		this._index--;
+	}
+};
+Tokenizer.prototype.InAttrsValueDQ = function(c) {
+	if (c === '"') {
+		this._cbs._attribvalue += this._getSection();
+		this._cbs.onattribend();
+		this._state = "BeforeAttrsName";
+	}
+};
+Tokenizer.prototype.InAttrsValueSQ = function(c) {
+	if (c === "'") {
+		this._cbs._attribvalue += this._getSection();
+		this._cbs.onattribend();
+		this._state = "BeforeAttrsName";
+	}
+};
+Tokenizer.prototype.InAttrsValueNQ = function(c) {
+	if (/\s/.test(c) || c === ">") {
+		this._cbs._attribvalue += this._getSection();
+		this._cbs.onattribend();
+		this._state = "BeforeAttrsName";
+		this._index--;
+	}
+};
+Tokenizer.prototype.BeforeCloseTag = function(c) {
+	if (/\s/.test(c));
+	else if (c === ">") {
+		this._state = "TEXT";
+	} else {
+		this._state = "InCloseTag";
+		this._sectionStart = this._index;
+	}
+};
+Tokenizer.prototype.InCloseTag = function(c) {
+	if (c === ">" || /\s/.test(c)) {
+		this._cbs.onclosetag(this._getSection());
+		this._state = "AfterCloseTag";
+		this._index--;
+	}
+};
+Tokenizer.prototype.InSelfCloseTag = function(c) {
+	if (c === ">") {
+		this._cbs.onopentagend();
+		this._state = "TEXT";
+		this._sectionStart = this._index + 1;
+	} else if (!(/\s/.test(c))) {
+		this._state = "BeforeAttrsName";
+		this._index--;
+	}
+};
+Tokenizer.prototype.AfterCloseTag = function(c) {
+	if (c === ">") {
+		this._state = "TEXT";
+		this._sectionStart = this._index + 1;
+	}
+};
+Tokenizer.prototype.BeforeDeclaration = function(c) {
+	if (c == '-') this._state = "InComment";
+	else if (c == '[') this._state = "BeforeCDATA1";
+	else this._state = "InDeclaration";
+};
+Tokenizer.prototype.InDeclaration = function(c) {
+	var index = this._buffer.indexOf(">", this._index);
+	if (index != -1) {
+		this._index = index;
+		this._sectionStart = index + 1;
+	} else this._sectionStart = this._index = this._buffer.length;
+	this._state = "TEXT";
+};
+Tokenizer.prototype.InComment = function(c) {
+	let key = (c == '-' ? '-->' : '>');
+	let index = this._buffer.indexOf(key, this._index);
+	if (index != -1) {
+		this._index = index + key.length - 1;
+		this._sectionStart = this._index + 1;
+	} else this._sectionStart = this._index = this._buffer.length;
+	this._state = "TEXT";
+};
+Tokenizer.prototype.BeforeCDATA1 = function(c) {
+	if (c == 'C') this._state = "BeforeCDATA2";
+	else this._state = "InDeclaration";
+};
+Tokenizer.prototype.BeforeCDATA2 = function(c) {
+	if (c == 'D') this._state = "BeforeCDATA3";
+	else this._state = "InDeclaration";
+};
+Tokenizer.prototype.BeforeCDATA3 = function(c) {
+	if (c == 'A') this._state = "BeforeCDATA4";
+	else this._state = "InDeclaration";
+};
+Tokenizer.prototype.BeforeCDATA4 = function(c) {
+	if (c == 'T') this._state = "BeforeCDATA5";
+	else this._state = "InDeclaration";
+};
+Tokenizer.prototype.BeforeCDATA5 = function(c) {
+	if (c == 'A') this._state = "InCDATA";
+	else this._state = "InDeclaration";
+};
+Tokenizer.prototype.InCDATA = function(c) {
+	let key = (c == '[' ? ']]>' : '>');
+	let index = this._buffer.indexOf(key, this._index);
+	if (index != -1) {
+		this._index = index + key.length - 1;
+		this._sectionStart = this._index + 1;
+	} else this._sectionStart = this._index = this._buffer.length;
+	this._state = "TEXT";
+};
+Tokenizer.prototype.parse = function(chunk) {
+	this._buffer += chunk;
+	for (; this._index < this._buffer.length; this._index++)
+		this[this._state](this._buffer[this._index]);
+	if (this._state === "TEXT" && this._sectionStart !== this._index)
+		this._cbs.ontext(this._buffer.substr(this._sectionStart));
+	this._cbs.onend();
+};
+Tokenizer.prototype._getSection = function() {
+	return this._buffer.substring(this._sectionStart, this._index);
+};
+module.exports = Tokenizer;

+ 41 - 0
pages/views/goods/components/jyf-Parser/api.js

@@ -0,0 +1,41 @@
+String.prototype.splice = function(start = 0, deleteCount = 0, addStr = '') {
+	if (start < 0) start = this.length + start;
+	if (deleteCount < 0) deleteCount = 0;
+	return this.substring(0, start) + addStr + this.substring(start + deleteCount);
+}
+// #ifndef MP-ALIPAY || H5 || APP-PLUS 
+const SDKVersion = uni.getSystemInfoSync().SDKVersion;
+// #endif
+module.exports = {
+	// #ifndef MP-ALIPAY || H5 || APP-PLUS 
+	versionHigherThan(version = '') {
+		var v1 = SDKVersion.split('.');
+		var v2 = version.split('.');
+		const len = Math.max(v1.length, v2.length);
+		while (v1.length < len) {
+			v1.push('0');
+		}
+		while (v2.length < len) {
+			v2.push('0');
+		}
+		for (let i = 0; i < len; i++) {
+			const num1 = parseInt(v1[i]);
+			const num2 = parseInt(v2[i]);
+			if (num1 > num2) {
+				return true;
+			} else if (num1 < num2) {
+				return false;
+			}
+		}
+		return true;
+	},
+	// #endif
+	html2nodes(html, tagStyle) {
+		const Parser = require('./Parser.js');
+		return Parser(html, tagStyle);
+	},
+	css2object(style, tagStyle) {
+		const CssHandler = require('./CssHandler.js');
+		return new CssHandler(style, tagStyle)._style;
+	}
+}

+ 70 - 0
pages/views/goods/components/jyf-Parser/handler.sjs

@@ -0,0 +1,70 @@
+var textTag = {
+	abbr: true,
+	b: true,
+	big: true,
+	code: true,
+	del: true,
+	em: true,
+	font: true,
+	i: true,
+	ins: true,
+	label: true,
+	mark: true,
+	q: true,
+	s: true,
+	small: true,
+	span: true,
+	strong: true,
+	u: true
+}
+export default {
+	getStyle: function(style, display) {
+		var res = "";
+		var reg = getRegExp("float\s*:\s*[^;]*", "i");
+		if (reg.test(style)) res += reg.exec(style)[0];
+		reg = getRegExp("margin[^;]*", "gi");
+		var margin = reg.exec(style);
+		while (margin) {
+			res += (';' + margin[0]);
+			margin = reg.exec(style);
+		}
+		reg = getRegExp("display\s*:\s*([^;]*)", "i");
+		if (reg.test(style) && reg.exec(style)[1] != "flex") res += (';' + reg.exec(style)[0]);
+		else res += (';display:' + display);
+		reg = getRegExp("flex\s*:[^;]*", "i");
+		if (reg.test(style)) res += (';' + reg.exec(style)[0]);
+		reg = getRegExp("[^;\s]*width[^;]*", "ig");
+		var width = reg.exec(style);
+		while (width) {
+			res += (';' + width[0]);
+			width = reg.exec(style);
+		}
+		return res;
+	},
+	setImgStyle: function(item, imgMode) {
+		if (imgMode == "widthFix")
+			item.attrs.style += ";height:auto !important";
+		if (getRegExp("[^-]width[^pev;]+").test(";" + item.attrs.style))
+			item.attrs.style += ";width:100%";
+		item.attrs.style = item.attrs.style.replace(getRegExp('margin[^;]*', "gi"), "");
+		return [item];
+	},
+	setStyle: function(item) {
+		if (getRegExp("[^-]width[^pev;]+").test(";" + item.attrs.style))
+			item.attrs.style += ";width:100%";
+		if (getRegExp('margin').test(item.attrs.style)) {
+			item.attrs.style = item.attrs.style.replace(getRegExp('margin[^;]*', "gi"), "");
+			item.attrs.style += ';margin:0'
+		}
+		return [item];
+	},
+	isContinue: function(item) {
+		if (textTag[item.name])
+			return false;
+		if (!item["continue"])
+			return true;
+		else if (item.name == 'a')
+			return true;
+		return false;
+	}
+}

+ 72 - 0
pages/views/goods/components/jyf-Parser/handler.wxs

@@ -0,0 +1,72 @@
+// Parser/trees/cssHandler.wxs
+var textTag = {
+	abbr: true,
+	b: true,
+	big: true,
+	code: true,
+	del: true,
+	em: true,
+	font: true,
+	i: true,
+	ins: true,
+	label: true,
+	mark: true,
+	q: true,
+	s: true,
+	small: true,
+	span: true,
+	strong: true,
+	u: true
+}
+module.exports = {
+	getStyle: function(style, display) {
+		var res = "";
+		var reg = getRegExp("float\s*:\s*[^;]*", "i");
+		if (reg.test(style)) res += reg.exec(style)[0];
+		reg = getRegExp("margin[^;]*", "gi");
+		var margin = reg.exec(style);
+		while (margin) {
+			res += (';' + margin[0]);
+			margin = reg.exec(style);
+		}
+		reg = getRegExp("display\s*:\s*([^;]*)", "i");
+		if (reg.test(style) && reg.exec(style)[1] != "flex") res += (';' + reg.exec(style)[0]);
+		else res += (';display:' + display);
+		reg = getRegExp("flex\s*:[^;]*", "i");
+		if (reg.test(style)) res += (';' + reg.exec(style)[0]);
+		reg = getRegExp("[^;\s]*width[^;]*", "ig");
+		var width = reg.exec(style);
+		while (width) {
+			res += (';' + width[0]);
+			width = reg.exec(style);
+		}
+		return res;
+	},
+	setImgStyle: function(item, imgMode, imgLoad) {
+		if (imgMode == "widthFix")
+			item.attrs.style += ";height:auto !important";
+		if (getRegExp("[^-]width[^pev;]+").test(";" + item.attrs.style))
+			item.attrs.style += ";width:100%";
+		item.attrs.style = item.attrs.style.replace(getRegExp('margin[^;]*', "gi"), "");
+		if (!imgLoad) {
+			delete item.attrs.src;
+			item.attrs.style += ";width:5px !important;height:5px !important"
+		}
+		return [item];
+	},
+	setStyle: function(item) {
+		if (getRegExp("[^-]width[^pev;]+").test(";" + item.attrs.style))
+			item.attrs.style += ";width:100%";
+		item.attrs.style = item.attrs.style.replace(getRegExp('margin[^;]*', "gi"), "");
+		return [item];
+	},
+	isContinue: function(item) {
+		if (textTag[item.name])
+			return false;
+		if (!item["continue"])
+			return true;
+		else if (item.name == 'a')
+			return true;
+		return false;
+	}
+}

+ 405 - 0
pages/views/goods/components/jyf-Parser/index.vue

@@ -0,0 +1,405 @@
+<template>
+	<view>
+		<!--#ifdef H5-->
+		<slot v-if="!html"></slot>
+		<iframe id="contain" :style="'width:100%;'+(selectable?'user-select:text;-webkit-user-select:text':'')+(showWithAnimation?('opacity:0;'+showAnimation):'')"
+		 frameborder="0"></iframe>
+		<!--#endif-->
+		<!--#ifndef H5-->
+		<slot v-if="!(html.nodes||((html&&(html[0].name||html[0].type))?1:nodes.length))"></slot>
+		<!--#endif-->
+		<!--#ifdef MP-ALIPAY || H5-->
+		<view class="contain" :style="(showWithAnimation?'opacity:0;':'')+(selectable?'user-select:text;-webkit-user-select:text':'')"
+		 :animation="showAnimation">
+			<trees :nodes="html.nodes||((html&&(html[0].name||html[0].type))?html:nodes)" :imgMode="imgMode" />
+		</view>
+		<!--#endif-->
+		<!--#ifndef MP-ALIPAY || H5-->
+		<trees class="contain" :style="'display:block'+(showWithAnimation?'opacity:0;':'')+(selectable?'user-select:text;-webkit-user-select:text':'')"
+		 :animation="showAnimation" :nodes="html.nodes||((html[0].name||html[0].type)?html:nodes)" :imgMode="imgMode"
+		 :lazyLoad="lazyLoad" :loadVideo="loadVideo" />
+		<!--#endif-->
+	</view>
+</template>
+
+<script>
+	import trees from "./trees"
+	const html2nodes = require("./Parser.js");
+	// #ifdef MP-WEIXIN || MP-QQ
+	const CanIUseObserver = require("./api.js").versionHigherThan('1.9.3');
+	// #endif
+	// #ifdef APP-PLUS
+	const CanIUseObserver = true;
+	// #endif
+	var Document; // 使用document补丁包时将此句改为 const Document = require('./document.js');
+	export default {
+		name: 'parser',
+		data() {
+			return {
+				nodes: [],
+				showAnimation: {},
+				// #ifdef APP-PLUS
+				loadVideo: false,
+				// #endif
+			}
+		},
+		components: {
+			trees
+		},
+		props: {
+			'html': {
+				type: null,
+				default: ''
+			},
+			'autocopy': {
+				type: Boolean,
+				default: true
+			},
+			// #ifndef MP-ALIPAY
+			'autopause': {
+				type: Boolean,
+				default: true
+			},
+			// #endif
+			'autopreview': {
+				type: Boolean,
+				default: true
+			},
+			'autosetTitle': {
+				type: Boolean,
+				default: true
+			},
+			'domain': {
+				type: String,
+				default: ''
+			},
+			'imgMode': {
+				type: String,
+				default: 'default'
+			},
+			// #ifdef MP-WEIXIN || MP-QQ || APP-PLUS
+			'lazyLoad': {
+				type: Boolean,
+				default: false
+			},
+			// #endif
+			'selectable': {
+				type: Boolean,
+				default: false
+			},
+			'tagStyle': {
+				type: Object,
+				default: () => {
+					return {};
+				}
+			},
+			'showWithAnimation': {
+				type: Boolean,
+				default: false
+			},
+			'animationDuration': {
+				type: Number,
+				default: 400
+			},
+			'useAnchor': {
+				type: Boolean,
+				default: false
+			}
+		},
+		mounted() {
+			this.execHtml(this.html);
+			// #ifndef MP-ALIPAY || H5
+			this.videoContext = [];
+			// #endif
+			// #ifdef MP-BAIDU || MP-ALIPAY
+			this.anchors = [];
+			// #endif
+		},
+		methods: {
+			execHtml(html) {
+				// #ifdef H5
+				var iframe = document.getElementById("contain");
+				// 支持 iframe.srcdoc
+				if (typeof(iframe.srcdoc) == "string") {
+					var script =
+						'<script>"use strict";function calcPageHeight(t){var e=Math.max(t.body.clientHeight,t.documentElement.clientHeight),n=Math.max(t.body.scrollHeight,t.documentElement.scrollHeight);return Math.max(e,n)}document.addEventListener("DOMContentLoaded",function(){for(var t=document.getElementsByTagName("img"),e=[],n=0;n<t.length;n++){var r=t[n];r.style+=";max-width:100%",e.push(r.src),r.index=n,"A"!=r.parentElement.nodeName&&(r.onclick=function(){parent.document.previewEvent(this,e)}),r.onerror=function(){parent.document.errorEvent(this,"img")};var o=document.getElementsByTagName("a"),a=!0,i=!1,c=void 0;try{for(var u,l=o[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){u.value.onclick=function(t){if("#"==this.getAttribute("href")[0]){var e=document.getElementById(this.getAttribute("href").substring(1));return parent.document.tapEvent(this,e?e.offsetTop:-1)}return parent.document.tapEvent(this)}}}catch(t){i=!0,c=t}finally{try{!a&&l.return&&l.return()}finally{if(i)throw c}}var d=document.getElementsByTagName("video"),m=!0,h=!1,s=void 0;try{for(var v,y=d[Symbol.iterator]();!(m=(v=y.next()).done);m=!0){var f=v.value;f.style+=";max-width:100%",f.onerror=function(){parent.document.errorEvent(this,"video")},f.onplay=function(){parent.document.playEvent(this)}}}catch(t){h=!0,s=t}finally{try{!m&&y.return&&y.return()}finally{if(h)throw s}}parent.document.setVideoContext(d);var g=document.getElementsByTagName("audios"),p=!0,E=!1,x=void 0;try{for(var b,w=g[Symbol.iterator]();!(p=(b=w.next()).done);p=!0){b.value.onerror=function(t){parent.document.errorEvent(this,"audio")}}}catch(t){E=!0,x=t}finally{try{!p&&w.return&&w.return()}finally{if(E)throw x}}}},!1),window.onload=function(){var t=calcPageHeight(document);parent.document.getElementById("contain").style.height=t+"px",parent.document.setTitle(document.title)};<\/script>';
+					if (!html) return;
+					if (typeof html != 'string') {
+						if (typeof html == 'object') {
+							var str = "";
+							for (var node of (html.nodes || html))
+								str += this.Dom2Str(node);
+							html = str;
+						} else {
+							this.$emit('error', {
+								source: "parse",
+								errMsg: "传入的html格式不正确!"
+							});
+							return;
+						}
+					}
+					// 处理 rpx
+					if (/[0-9.]*?rpx/.test(html)) {
+						var rpx = uni.getSystemInfoSync().screenWidth / 750;
+						html = html.replace(/([0-9.]*?)rpx/g, function() {
+							return parseFloat(arguments[1]) * rpx + "px";
+						})
+					}
+					document.previewEvent = (img, imgList) => {
+						if (!img.hasAttribute('ignore')) {
+							var preview = true;
+							img.ignore = () => preview = false;
+							this.$emit('imgtap', img);
+							if (preview && this.autopreview) {
+								uni.previewImage({
+									current: img.index,
+									urls: imgList
+								});
+							}
+						}
+					}
+					document.tapEvent = (link, offsetTop) => {
+						var jump = true;
+						this.$emit('linkpress', {
+							href: link.getAttribute("href"),
+							ignore: () => jump = false
+						});
+						if (jump && link.getAttribute("href")) {
+							if (link.getAttribute("href")[0] == '#') {
+								if (this.useAnchor)
+									window.scrollTo(0, iframe.offsetTop + offsetTop);
+							} else if (/^http/.test(link.getAttribute("href"))) {
+								if (this.autocopy)
+									window.location.href = link.href;
+							} else {
+								uni.navigateTo({
+									url: link.getAttribute("href")
+								})
+							}
+						}
+						return false;
+					}
+					document.setTitle = (title) => {
+						if (title && this.autosetTitle) {
+							uni.setNavigationBarTitle({
+								title: title
+							})
+						}
+						if (html)
+							uni.createSelectorQuery().in(this).select("#contain").boundingClientRect(res => {
+								this.$emit('ready', res);
+							}).exec()
+					}
+					document.errorEvent = (target, source) => {
+						this.$emit('error', {
+							source,
+							target
+						});
+					}
+					document.setVideoContext = (videos) => {
+						this.videoContext = videos;
+					}
+					document.playEvent = (v) => {
+						if (this.autopause) {
+							for (var video of this.videoContext) {
+								if (video != v)
+									video.pause();
+							}
+						}
+					}
+					iframe.srcdoc = script + html;
+					this.showAnimation =
+						"opacity: 1; transition: opacity 400ms ease 0ms, -webkit-transform 400ms ease 0ms, transform 400ms ease 0ms; transform-origin: 50% 50% 0px;";
+					return;
+				}
+				// #endif
+				let showAnimation = {};
+				if (this.showWithAnimation) {
+					showAnimation = uni.createAnimation({
+						duration: this.animationDuration,
+						timingFunction: "ease"
+					}).opacity(1).step().export();
+				}
+				if (!html) {
+					this.nodes = [];
+				} else if (typeof html == 'string') {
+					html2nodes(html, this).then(res => {
+						// #ifdef APP-PLUS
+						this.loadVideo = false;
+						// #endif
+						this.nodes = res.nodes;
+						this.showAnimation = showAnimation;
+						this.imgList = res.imgList;
+						if (Document) this.document = new Document("nodes", res.nodes, this);
+						if (res.title && this.autosetTitle) {
+							uni.setNavigationBarTitle({
+								title: res.title
+							})
+						}
+						this.$emit('parser', res);
+						this.ready();
+					}).catch(err => {
+						this.$emit('error', {
+							source: "parse",
+							errMsg: err
+						});
+					})
+				} else if (html.constructor == Array) {
+					this.showAnimation = showAnimation;
+					this.imgList = [];
+					// #ifdef APP-PLUS
+					this.loadVideo = false;
+					// #endif
+					if (Document) this.document = new Document("html", html, this);
+					this.ready();
+				} else if (typeof html == 'object') {
+					if (!html.nodes || html.nodes.constructor != Array) {
+						if ((html.name && html.children && html.attrs) || (html.type == "text"))
+							return;
+						this.$emit('error', {
+							source: "parse",
+							errMsg: "传入的nodes数组格式不正确!应该传入的类型是array,实际传入的类型是:" + typeof html.nodes
+						});
+						return;
+					}
+					this.showAnimation = showAnimation;
+					this.imgList = html.imgList || [];
+					// #ifdef APP-PLUS
+					this.loadVideo = false;
+					// #endif
+					if (Document) this.document = new Document("html.nodes", html.nodes, this);
+					if (html.title && this.autosetTitle)
+						uni.setNavigationBarTitle({
+							title: html.title
+						})
+					this.ready();
+				} else {
+					this.$emit('error', {
+						source: "parse",
+						errMsg: "错误的html类型:" + typeof html
+					});
+				}
+			},
+			// #ifdef H5
+			Dom2Str(node) {
+				if (node.type == "text")
+					return node.text;
+				var elem = '<' + node.name;
+				for (var attr in node.attrs)
+					elem += (' ' + atts + '="' + node.attrs[attr] + '"');
+				elem += ">";
+				for (var child of node.children)
+					elem += Dom2Str(child);
+				elem += ("</" + node.name + ">");
+				return elem;
+			},
+			// #endif
+			// #ifndef H5
+			getContext(components) {
+				for (let component of components) {
+					let observered = false;
+					if (!component.nodes)
+						return this.getContext(component.$children);
+					for (let item of component.nodes) {
+						// #ifndef MP-ALIPAY
+						if (item.name == 'img' && !observered) {
+							observered = true;
+							if (component.lazyLoad && CanIUseObserver) {
+								component._observer = uni.createIntersectionObserver(component);
+								component._observer.relativeToViewport({
+									top: 1000,
+									bottom: 1000
+								}).observe('.img', res => {
+									component.imgLoad = true;
+									component._observer.disconnect();
+									component._observer = null;
+								})
+							} else
+								component.imgLoad = true;
+						} else if (item.name == 'video') {
+							this.videoContext.push({
+								id: item.attrs.id,
+								context: uni.createVideoContext(item.attrs.id, component)
+							});
+						}
+						// #endif
+						// #ifdef MP-BAIDU || MP-ALIPAY
+						if (item.attrs && item.attrs.id) {
+							this.anchors.push({
+								id: item.attrs.id,
+								node: component
+							})
+						}
+						// #endif
+					}
+					this.getContext(component.$children);
+				}
+			},
+			// #endif
+			ready() {
+				this.$nextTick(() => {
+					this.navigateTo = (obj) => {
+						obj.success = obj.success || function() {};
+						obj.fail = obj.fail || function() {};
+						var Scroll = (selector,component) => {
+							const query = uni.createSelectorQuery().in(component?component:this);
+							query.select(selector).boundingClientRect();
+							query.selectViewport().scrollOffset();
+							query.exec(res => {
+								if (!res || !res[0])
+									return obj.fail({
+										errMsg: "Label Not Found"
+									});
+								uni.pageScrollTo({
+									scrollTop: res[1].scrollTop + res[0].top,
+									success: obj.success,
+									fail: obj.fail
+								})
+							})
+						}
+						if (!obj.id) Scroll(".contain");
+						else {
+							// #ifndef MP-BAIDU || MP-ALIPAY
+							Scroll('.contain >>> #' + obj.id);
+							// #endif
+							// #ifdef MP-BAIDU || MP-ALIPAY
+							for (var anchor of this.anchors) {
+								if (anchor.id == obj.id) {
+									Scroll("#" + obj.id, anchor.node);
+								}
+							}
+							// #endif
+						}
+					}
+					uni.createSelectorQuery().in(this).select(".contain").boundingClientRect(res => {
+						this.$emit("ready", res);
+					}).exec()
+					// #ifndef H5
+					this.getContext(this.$children);
+					// #endif
+					// #ifdef APP-PLUS
+					setTimeout(() => {
+						this.loadVideo = true;
+					}, 2000);
+					// #endif
+				})
+			}
+		},
+		watch: {
+			html(html) {
+				this.execHtml(html);
+			}
+		}
+	}
+</script>
+
+<style>
+	/* #ifndef MP-BAIDU */
+	:host {
+		display: block;
+		overflow: scroll;
+		-webkit-overflow-scrolling: touch;
+	}
+
+	/* #endif */
+</style>

+ 363 - 0
pages/views/goods/components/jyf-Parser/trees.vue

@@ -0,0 +1,363 @@
+<template>
+	<view style="display: inherit;white-space: inherit;">
+		<block v-for='(item, index) in nodes' v-bind:key='index'>
+			<!--#ifdef MP-WEIXIN || MP-QQ || APP-PLUS || MP-ALIPAY-->
+			<block v-if="handler.isContinue(item)">
+				<!--#endif-->
+				<!--#ifdef MP-BAIDU || MP-TOUTIAO || H5-->
+				<block v-if="!item.continue">
+					<!--#endif-->
+					<!--图片-->
+					<!--#ifdef MP-WEIXIN || MP-QQ || APP-PLUS-->
+					<rich-text v-if="item.name=='img'" :id="item.attrs.id||''" class="img" :style="'text-indent:0;'+handler.getStyle(item.attrs.style,'inline-block')"
+					 :nodes='handler.setImgStyle(item,imgMode,imgLoad)' :data-ignore='item.attrs.ignore' :data-src='item.attrs.src'
+					 :data-current='item.current' @tap='previewEvent' />
+					<!--#endif-->
+					<!--#ifdef MP-ALIPAY-->
+					<rich-text v-if="item.name=='img'" :id="item.attrs.id||''" :style="'text-indent:0;'+handler.getStyle(item.attrs.style,'inline-block')"
+					 :nodes='handler.setImgStyle(item,imgMode)' :data-ignore='item.attrs.ignore' :data-src='item.attrs.src'
+					 :data-current='item.current' @tap='previewEvent' />
+					<!--#endif-->
+					<!--#ifdef MP-BAIDU || MP-TOUTIAO || H5-->
+					<rich-text v-if="item.name=='img'" :id="item.attrs.id||''" :style="'text-indent:0;'+item.attrs.containStyle" :nodes='[item]' :data-ignore='item.attrs.ignore'
+					 :data-src='item.attrs.src' :data-current='item.current' @tap='previewEvent' />
+					<!--#endif-->
+					<!--文本-->
+					<!--#ifdef MP-WEIXIN || MP-QQ || H5 || APP-PLUS-->
+					<block v-else-if="item.type=='text'">
+						<text v-if="!item.decode" decode>{{item.text}}</text>
+						<rich-text v-else style="display:inline-block" :nodes="[item]"></rich-text>
+					</block>
+					<!--#endif-->
+					<!--#ifdef MP-ALIPAY-->
+					<text v-else-if="item.type=='text'" decode>{{item.text}}</text>
+					<!--#endif-->
+					<text v-else-if="item.name=='br'">\n</text>
+					<!--视频-->
+					<block v-else-if="item.name=='video'">
+						<!--#ifdef APP-PLUS-->
+						<view v-if="(!loadVideo||item.attrs.id[item.attrs.id.length-1]>'3')&&(!controls[item.attrs.id]||!controls[item.attrs.id].play)"
+						 :class="'pvideo '+(item.attrs.class||'')" :style="item.attrs.style" :data-id="item.attrs.id" @tap="_loadVideo">
+							<view class="video-triangle"></view>
+						</view>
+						<!--#endif-->
+						<!--#ifndef APP-PLUS-->
+						<view v-if="item.attrs.id[item.attrs.id.length-1]>'3'&&(!controls[item.attrs.id]||!controls[item.attrs.id].play)"
+						 :class="'pvideo '+(item.attrs.class||'')" :style="item.attrs.style" :data-id="item.attrs.id" @tap="_loadVideo">
+							<view class="video-triangle"></view>
+						</view>
+						<!--#endif-->
+						<video v-else :src='controls[item.attrs.id]?item.attrs.source[controls[item.attrs.id].index]:item.attrs.src' :id="item.attrs.id||''"
+						 :loop='item.attrs.loop' :controls='item.attrs.controls' :autoplay="item.attrs.autoplay||(controls[item.attrs.id]&&controls[item.attrs.id].play)"
+						 :unit-id="item.attrs['unit-id']" :class="'v '+(item.attrs.class||'')" :muted="item.attrs.muted" :style="item.attrs.style"
+						 :data-id="item.attrs.id" :data-source="item.attrs.source" @play='playEvent' @error="videoError" />
+					</block>
+					<!--音频-->
+					<audio v-else-if="item.name=='audio'" :src='controls[item.attrs.id]?item.attrs.source[controls[item.attrs.id].index]:item.attrs.src'
+					 :id="item.attrs.id||''" :loop='item.attrs.loop' :controls='item.attrs.controls' :poster='item.attrs.poster' :name='item.attrs.name'
+					 :author='item.attrs.author' :class="item.attrs.class||''" :style="item.attrs.style" :data-id="item.attrs.id"
+					 :data-source="item.attrs.source" @error="audioError" />
+					<!--链接-->
+					<view v-else-if="item.name=='a'" :class="'a '+(item.attrs.class||'')" :style="item.attrs.style" :data-href='item.attrs.href'
+					 hover-class="navigator-hover" :hover-start-time="25" :hover-stay-time="300" @tap="tapEvent">
+						<!--#ifdef H5-->
+						<trees :nodes="item.children" :imgMode="imgMode" />
+						<!--#endif-->
+						<!--#ifndef H5-->
+						<trees :nodes="item.children" :imgMode="imgMode" :lazyLoad="lazyLoad" :loadVideo="loadVideo" />
+						<!--#endif-->
+					</view>
+					<!--广告-->
+					<!--#ifdef MP-WEIXIN || MP-QQ-->
+					<ad v-else-if="item.name=='ad'" :unit-id="item.attrs['unit-id']" :class="item.attrs.class||''" :style="item.attrs.style"
+					 @error="adError"></ad>
+					<!--#endif-->
+					<!--#ifdef MP-BAIDU-->
+					<ad v-else-if="item.name=='ad'" :appid="item.attrs.appid" :apid="item.attrs.apid" :type="item.attrs.type" :class="item.attrs.class||''"
+					 :style="item.attrs.style" @error="adError"></ad>
+					<!--#endif-->
+					<!--富文本-->
+					<!--#ifdef MP-WEIXIN || MP-QQ || MP-ALIPAY || APP-PLUS-->
+					<rich-text v-else :id="item.attrs.id||''" :class="item.name" :style="''+handler.getStyle(item.attrs.style,'block')" :nodes="handler.setStyle(item)" />
+					<!--#endif-->
+					<!--#ifdef MP-BAIDU || MP-TOUTIAO || H5-->
+					<rich-text v-else :id="item.attrs.id||''" :class="item.name" :style="item.attrs?item.attrs.containStyle:''" :nodes="[item]" />
+					<!--#endif-->
+				</block>
+				<!--#ifdef MP-ALIPAY || H5-->
+				<view v-else :id="item.attrs.id||''" :class="item.name+' '+(item.attrs.class||'')" :style="item.attrs.style">
+					<trees :nodes="item.children" :imgMode="imgMode" />
+				</view>
+				<!--#endif-->
+				<!--#ifndef MP-ALIPAY || H5-->
+				<trees v-else :id="item.attrs.id||''" :class="item.name+' '+(item.attrs.class||'')" :style="item.attrs.style" :nodes="item.children"
+				 :imgMode="imgMode" :lazyLoad="lazyLoad" :loadVideo="loadVideo" />
+				<!--#endif-->
+			</block>
+	</view>
+</template>
+<script module="handler" lang="wxs" src="./handler.wxs"></script>
+<script module="handler" lang="sjs" src="./handler.sjs"></script>
+<script>
+	import trees from "./trees"
+	export default {
+		components: {
+			trees
+		},
+		name: 'trees',
+		data() {
+			return {
+				controls: {},
+				// #ifdef MP-WEIXIN || MP-QQ || APP-PLUS
+				imgLoad: false
+				// #endif
+			}
+		},
+		props: {
+			nodes: {
+				type: Array,
+				default: []
+			},
+			// #ifdef MP-WEIXIN || MP-QQ || APP-PLUS
+			lazyLoad: {
+				type: Boolean,
+				default: false
+			},
+			// #endif
+			// #ifdef APP-PLUS
+			loadVideo: {
+				type: Boolean,
+				default: false
+			},
+			// #endif
+			imgMode: {
+				type: String,
+				default: "default"
+			}
+		},
+		mounted() {
+			// 获取顶层组件
+			this._top = this.$parent;
+			while (this._top.$options.name != 'parser') {
+				if (this._top._top) {
+					this._top = this._top._top;
+					break;
+				}
+				this._top = this._top.$parent;
+			}
+		},
+		// #ifdef MP-WEIXIN || MP-QQ || APP-PLUS
+		beforeDestroy() {
+			if (this._observer)
+				this._observer.disconnect();
+		},
+		// #endif
+		methods: {
+			// #ifndef MP-ALIPAY
+			playEvent(e) {
+				if (this._top.videoContext.length > 1 && this._top.autopause) {
+					for (let video of this._top.videoContext) {
+						if (video.id == e.currentTarget.dataset.id) continue;
+						video.context.pause();
+					}
+				}
+			},
+			// #endif
+			previewEvent(e) {
+				if (!e.currentTarget.dataset.ignore) {
+					var preview = true;
+					this._top.$emit('imgtap', {
+						id: e.target.id,
+						src: e.currentTarget.dataset.src,
+						ignore: () => preview = false
+					});
+					if (preview && this._top.autopreview) {
+						uni.previewImage({
+							current: parseInt(e.currentTarget.dataset.current),
+							urls: this._top.imgList.length ? this._top.imgList : [e.currentTarget.dataset.src]
+						});
+					}
+				}
+			},
+			tapEvent(e) {
+				var jump = true;
+				this._top.$emit('linkpress', {
+					href: e.currentTarget.dataset.href,
+					ignore: () => jump = false
+				});
+				if (jump && e.currentTarget.dataset.href) {
+					if (e.currentTarget.dataset.href[0]) {
+						if (this._top.useAnchor)
+							this._top.navigateTo({
+								id: e.currentTarget.dataset.href.substring(1)
+							})
+					} else if (/^http/.test(e.currentTarget.dataset.href)) {
+						if (this._top.autocopy) {
+							// #ifndef H5
+							uni.setClipboardData({
+								data: e.currentTarget.dataset.href,
+								success() {
+									uni.showToast({
+										title: '链接已复制'
+									});
+								}
+							});
+							// #endif
+							// #ifdef H5
+							window.location.href = e.currentTarget.dataset.href;
+							// #endif
+						}
+					} else
+						uni.navigateTo({
+							url: e.currentTarget.dataset.href
+						})
+				}
+			},
+			triggerError(source, target, errMsg, errCode) {
+				this._top.$emit('error', {
+					source,
+					target,
+					errMsg,
+					errCode
+				});
+			},
+			loadSource(currentTarget) {
+				if (!this.controls[currentTarget.id] && currentTarget.source.length > 1) {
+					this.$set(this.controls, currentTarget.id, {
+						play: false,
+						index: 1
+					})
+				} else if (this.controls[currentTarget.id] && currentTarget.source.length > this.controls[
+						currentTarget.id].index + 1) {
+					this.$set(this.controls[currentTarget.id], "index", this.controls[currentTarget.id].index + 1);
+				}
+			},
+			adError(e) {
+				this.triggerError("ad", e.currentTarget, "", e.detail.errorCode);
+			},
+			videoError(e) {
+				this.loadSource(e.currentTarget.dataset);
+				this.triggerError("video", e.currentTarget, e.detail.errMsg);
+			},
+			audioError(e) {
+				this.loadSource(e.currentTarget.dataset);
+				this.triggerError("audio", e.currentTarget, e.detail.errMsg);
+			},
+			_loadVideo(e) {
+				this.$set(this.controls, e.currentTarget.dataset.id, {
+					play: true,
+					index: 0
+				})
+			}
+		}
+	}
+</script>
+
+<style>
+	/* 可以在这里引入自定义的外部样式 */
+
+	/* 链接受到点击的hover-class,可自定义修改 */
+	.navigator-hover {
+		opacity: 0.7;
+		text-decoration: underline;
+	}
+
+	/* 以下内容不建议修改 */
+	:host {
+		display: inherit;
+		float: inherit;
+	}
+
+	.a {
+		display: inline;
+		color: #366092;
+	}
+
+	/* #ifdef MP-WEIXIN || MP-QQ || MP-ALIPAY */
+	.sub,
+	.sup,
+	.bdo,
+	.bdi,
+	.ruby,
+	.rt {
+		display: inline-block !important;
+	}
+
+	/* #endif */
+
+	.div,
+	.blockquote,
+	.p {
+		display: block;
+	}
+
+	.b,
+	.strong {
+		display: inline;
+		font-weight: bold;
+	}
+
+	.em,
+	.i {
+		display: inline;
+		font-style: italic;
+	}
+
+	.del {
+		display: inline;
+		text-decoration: line-through;
+	}
+
+	.ins {
+		display: inline;
+		text-decoration: underline;
+	}
+
+	.code {
+		display: inline;
+		font-family: monospace;
+	}
+
+	.big {
+		font-size: 1.2em;
+		display: inline;
+	}
+
+	.small {
+		font-size: 0.8em;
+		display: inline;
+	}
+
+	.q,
+	.span,
+	.label,
+	.abbr {
+		display: inline;
+	}
+
+	.q::before {
+		content: '"';
+	}
+
+	.q::after {
+		content: '"';
+	}
+
+	.pvideo {
+		background-color: black;
+		width: 300px;
+		height: 225px;
+		display: inline-block;
+		position: relative;
+	}
+
+	.video-triangle {
+		border-width: 15px 0 15px 30px;
+		border-style: solid;
+		border-color: transparent transparent transparent white;
+		position: absolute;
+		left: 50%;
+		top: 50%;
+		margin: -15px 0 0 -15px;
+	}
+</style>

+ 13 - 3
pages/views/goods/goods-detail.vue

@@ -45,11 +45,15 @@
         <!-- 商品详情 -->
         <view class="section detail">
             <view class="title">商品详情</view>
-            <view
-                v-if="productDetail && productDetail.detailInfo"
+            <!-- <view
+                v-if="productDetail.detailInfo"
                 v-html="productDetail.detailInfo"
                 style="overflow-x: hidden;"
-            ></view>
+            ></view> -->
+            <template v-if="productDetail && productDetail.detailInfo">
+                <!-- <parser :html="productDetail.detailInfo" :img-mode="widthFix"></parser> -->
+                <uParse :content="productDetail.detailInfo" />
+            </template>
             <!-- 空 -->
             <view class="section-empty" v-else>暂无商品详情</view>
         </view>
@@ -124,6 +128,9 @@
 <script>
 // 配置
 import { generateActivityType, generatePriceType, generateNavbarButtonText } from './commons/helper.js'
+// import Parser from '@/pages/views/goods/components/jyf-Parser/index.vue'//富文本处理
+// import marked from '@/components/uni/marked'
+import uParse from '@/components/uni/uParse/src/wxParse'
 import { debounce } from '@/common/utils.js'
 import { shareDataResult } from '@/common/share.helper.js'
 import { fetchProductDetail } from '@/services/api/goods.js'
@@ -131,6 +138,9 @@ import { fetchCouponListByProductId } from '@/services/api/coupon.js'
 import { queryStringify } from '@/common/utils.js'
 import { mapGetters, mapActions } from 'vuex'
 export default {
+    components: {
+        uParse
+    },
     data() {
         return {
             isRequest: true,

+ 2 - 2
services/config.env.js

@@ -2,8 +2,8 @@ export let APP_API_URI = ''
 if (process.env.NODE_ENV === 'development') {
     // 开发环境
     // APP_API_URI = 'http://192.168.2.68:8011'	 //本地联调地址
-    APP_API_URI = 'https://mall2c-b.caimei365.com'
-    // APP_API_URI = 'https://mall2c.caimei365.com'
+    // APP_API_URI = 'https://mall2c-b.caimei365.com'
+    APP_API_URI = 'https://mall2c.caimei365.com'
 } else {
     // 生产环境
     APP_API_URI = 'https://mall2c.caimei365.com'