@10yun/cv-mobile-ui 0.5.8 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extend/permission.js +1 -2
- package/package.json +1 -1
- package/plugins/uni-richText.js +1 -1
- package/plugins/uni-socket.js +6 -8
- package/ui-cv/cv-editor-parse/components/wxParseAudio.vue +14 -5
- package/ui-cv/cv-editor-parse/components/wxParseImg.vue +26 -36
- package/ui-cv/cv-editor-parse/components/wxParseTable.vue +7 -7
- package/ui-cv/cv-editor-parse/components/wxParseTemplate0.vue +105 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate1.vue +96 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate10.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate11.vue +84 -82
- package/ui-cv/cv-editor-parse/components/wxParseTemplate2.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate3.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate4.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate5.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate6.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate7.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate8.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseTemplate9.vue +95 -88
- package/ui-cv/cv-editor-parse/components/wxParseVideo.vue +15 -15
- package/ui-cv/cv-editor-parse/cv-editor-parse.vue +1 -3
- package/ui-cv/cv-editor-parse/libs/html2json.js +15 -18
- package/ui-cv/cv-editor-parse/libs/htmlparser.js +12 -5
- package/ui-cv/cv-editor-parse/libs/wxDiscode.js +1 -1
- package/ui-cv/cv-editor-parse/readme.md +6 -0
- package/ui-cv/cv-editor-parse/u-parse.css +52 -95
- package/ui-cv/cv-geo-local/cv-geo-local.vue +0 -1
- package/ui-cv/cv-layout-topbar/cv-layout-topbar.vue +238 -0
- package/ui-cv/cv-markdown-show/cv-markdown-show.vue +109 -0
- package/ui-cv/cv-markdown-show/lib/highlight/atom-one-dark.css +1 -0
- package/ui-cv/cv-markdown-show/lib/highlight/atom-one-light.css +1 -0
- package/ui-cv/cv-markdown-show/lib/highlight/github-dark.min.css +10 -0
- package/ui-cv/cv-markdown-show/lib/highlight/uni-highlight.min.js +9122 -0
- package/ui-cv/cv-markdown-show/lib/html-parser.js +352 -0
- package/ui-cv/cv-markdown-show/lib/markdown-it.min.js +2 -0
- package/ui-cv/cv-markdown-show/markdown.css +340 -0
- package/ui-cv/cv-markdown-show/package.json +18 -0
- package/ui-cv/cv-markdown-show/readme.md +45 -0
- package/ui-cv/cv-nav-col/cv-nav-col.vue +2 -1
- package/ui-sdks/sdk-app-update/img/logo.png +0 -0
- package/ui-sdks/sdk-app-update/img/update_bg.png +0 -0
- package/ui-sdks/sdk-app-update/img/update_bg_top.png +0 -0
- package/{ui-cv/cv-update-app/cv-update-app.vue → ui-sdks/sdk-app-update/sdk-app-update.vue} +2 -2
- package/ui-sdks/sdk-app-update/xxxx +62 -0
- package/ui-sdks/sdk-privacy-policy/sdk-privacy-policy.vue +113 -0
- package/ui-sdks/sdk-u-charts/app-echarts.min.js +23 -0
- package/ui-sdks/sdk-u-charts/config-echarts.js +420 -0
- package/ui-sdks/sdk-u-charts/config-ucharts.js +630 -0
- package/ui-sdks/sdk-u-charts/h5-echarts.min.js +23 -0
- package/ui-sdks/sdk-u-charts/u-charts.js +7398 -0
- package/ui-sdks/sdk-u-charts/u-charts.min.js +1 -0
- package/ui-sdks/sdk-webview-main/WebViewMain.vue +1 -0
- package/ui-sdks/sdk-webview-main/main.js +0 -0
- package/ui-sdks/sdk-webview-main/mixin.js +0 -0
- package/ui-uni/uParse/src/components/wxParseAudio.vue +26 -0
- package/ui-uni/uParse/src/components/wxParseImg.vue +94 -0
- package/ui-uni/uParse/src/components/wxParseTable.vue +55 -0
- package/ui-uni/uParse/src/components/wxParseTemplate0.vue +103 -0
- package/ui-uni/uParse/src/components/wxParseTemplate1.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate10.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate11.vue +86 -0
- package/ui-uni/uParse/src/components/wxParseTemplate2.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate3.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate4.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate5.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate6.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate7.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate8.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseTemplate9.vue +88 -0
- package/ui-uni/uParse/src/components/wxParseVideo.vue +15 -0
- package/ui-uni/uParse/src/editor.css +495 -0
- package/ui-uni/uParse/src/libs/html2json.js +261 -0
- package/ui-uni/uParse/src/libs/htmlparser.js +156 -0
- package/ui-uni/uParse/src/libs/wxDiscode.js +195 -0
- package/ui-uni/uParse/src/wxParse.css +270 -0
- package/ui-uni/uParse/src/wxParse.vue +206 -0
package/extend/permission.js
CHANGED
package/package.json
CHANGED
package/plugins/uni-richText.js
CHANGED
package/plugins/uni-socket.js
CHANGED
|
@@ -17,7 +17,7 @@ var pagelist = [];
|
|
|
17
17
|
//pagetype = ''; //msglist , chat
|
|
18
18
|
//chat_id = ''; //when chat
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const SocketClass = {
|
|
21
21
|
/**
|
|
22
22
|
* 主动关闭,监听端口
|
|
23
23
|
*/
|
|
@@ -49,8 +49,8 @@ const ctoSocketClass = {
|
|
|
49
49
|
console.log('尝试断线重连');
|
|
50
50
|
clearInterval(timer);
|
|
51
51
|
if (s_data.reconnet_times <= s_data.limit_times) {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
SocketClass.close_socket();
|
|
53
|
+
SocketClass.init();
|
|
54
54
|
s_data.reconnet_times++;
|
|
55
55
|
}
|
|
56
56
|
return;
|
|
@@ -81,7 +81,7 @@ const ctoSocketClass = {
|
|
|
81
81
|
s_data.reconnet_times = 0;
|
|
82
82
|
console.log('WebSocket已打开!');
|
|
83
83
|
console.log('connect success', successRes);
|
|
84
|
-
|
|
84
|
+
SocketClass.xintiaoFunc();
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
});
|
|
@@ -103,7 +103,7 @@ const ctoSocketClass = {
|
|
|
103
103
|
setTimeout(function () {
|
|
104
104
|
console.log('监听socket失败 尝试重新连接');
|
|
105
105
|
if (s_data.reconnet_times <= s_data.limit_times) {
|
|
106
|
-
|
|
106
|
+
SocketClass.init();
|
|
107
107
|
s_data.reconnet_times++;
|
|
108
108
|
}
|
|
109
109
|
return;
|
|
@@ -171,6 +171,4 @@ function receive_data(data) {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
ctoSocketClass: ctoSocketClass
|
|
176
|
-
};
|
|
174
|
+
export default SocketClass;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- '<audio/>' 组件不再维护,建议使用能力更强的 'uni.createInnerAudioContext' 接口 有时间再改-->
|
|
3
3
|
<!--增加audio标签支持-->
|
|
4
|
-
<audio
|
|
5
|
-
:
|
|
4
|
+
<audio
|
|
5
|
+
:id="node.attr.id"
|
|
6
|
+
:class="node.classStr"
|
|
7
|
+
:style="node.styleStr"
|
|
8
|
+
:src="node.attr.src"
|
|
9
|
+
:loop="node.attr.loop"
|
|
10
|
+
:poster="node.attr.poster"
|
|
11
|
+
:name="node.attr.name"
|
|
12
|
+
:author="node.attr.author"
|
|
13
|
+
controls
|
|
14
|
+
></audio>
|
|
6
15
|
</template>
|
|
7
16
|
|
|
8
17
|
<script>
|
|
@@ -13,8 +22,8 @@ export default {
|
|
|
13
22
|
type: Object,
|
|
14
23
|
default() {
|
|
15
24
|
return {};
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
19
28
|
};
|
|
20
29
|
</script>
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<image
|
|
3
|
-
:
|
|
2
|
+
<image
|
|
3
|
+
:mode="node.attr.mode"
|
|
4
|
+
:lazy-load="node.attr.lazyLoad"
|
|
5
|
+
:class="node.classStr"
|
|
6
|
+
:style="newStyleStr || node.styleStr"
|
|
7
|
+
:data-src="node.attr.src"
|
|
8
|
+
:src="node.attr.src"
|
|
9
|
+
@tap="wxParseImgTap"
|
|
10
|
+
@load="wxParseImgLoad"
|
|
11
|
+
/>
|
|
4
12
|
</template>
|
|
5
13
|
|
|
6
14
|
<script>
|
|
@@ -9,7 +17,7 @@ export default {
|
|
|
9
17
|
data() {
|
|
10
18
|
return {
|
|
11
19
|
newStyleStr: '',
|
|
12
|
-
preview: true
|
|
20
|
+
preview: true
|
|
13
21
|
};
|
|
14
22
|
},
|
|
15
23
|
props: {
|
|
@@ -17,60 +25,42 @@ export default {
|
|
|
17
25
|
type: Object,
|
|
18
26
|
default() {
|
|
19
27
|
return {};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
22
30
|
},
|
|
23
31
|
methods: {
|
|
24
32
|
wxParseImgTap(e) {
|
|
25
33
|
if (!this.preview) return;
|
|
26
|
-
const {
|
|
27
|
-
src
|
|
28
|
-
} = e.currentTarget.dataset;
|
|
34
|
+
const { src } = e.currentTarget.dataset;
|
|
29
35
|
if (!src) return;
|
|
30
36
|
let parent = this.$parent;
|
|
31
|
-
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
37
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
38
|
+
// TODO 遍历获取父节点执行方法
|
|
32
39
|
parent = parent.$parent;
|
|
33
40
|
}
|
|
34
41
|
parent.preview(src, e);
|
|
35
42
|
},
|
|
36
43
|
// 图片视觉宽高计算函数区
|
|
37
44
|
wxParseImgLoad(e) {
|
|
38
|
-
const {
|
|
39
|
-
src
|
|
40
|
-
} = e.currentTarget.dataset;
|
|
45
|
+
const { src } = e.currentTarget.dataset;
|
|
41
46
|
if (!src) return;
|
|
42
|
-
const {
|
|
43
|
-
width,
|
|
44
|
-
height
|
|
45
|
-
} = e.mp.detail;
|
|
47
|
+
const { width, height } = e.mp.detail;
|
|
46
48
|
const recal = this.wxAutoImageCal(width, height);
|
|
47
|
-
const {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} = recal;
|
|
51
|
-
const {
|
|
52
|
-
padding,
|
|
53
|
-
mode
|
|
54
|
-
} = this.node.attr;
|
|
55
|
-
const {
|
|
56
|
-
styleStr
|
|
57
|
-
} = this.node;
|
|
49
|
+
const { imageheight, imageWidth } = recal;
|
|
50
|
+
const { padding, mode } = this.node.attr;
|
|
51
|
+
const { styleStr } = this.node;
|
|
58
52
|
const imageHeightStyle = mode === 'widthFix' ? '' : `height: ${imageheight}px;`;
|
|
59
53
|
this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px; padding: 0 ${+padding}px;`;
|
|
60
54
|
},
|
|
61
55
|
// 计算视觉优先的图片宽高
|
|
62
56
|
wxAutoImageCal(originalWidth, originalHeight) {
|
|
63
57
|
// 获取图片的原始长宽
|
|
64
|
-
const {
|
|
65
|
-
|
|
66
|
-
} = this.node.attr;
|
|
67
|
-
const windowWidth = this.node.$screen.width - (2 * padding);
|
|
58
|
+
const { padding } = this.node.attr;
|
|
59
|
+
const windowWidth = this.node.$screen.width - 2 * padding;
|
|
68
60
|
const results = {};
|
|
69
61
|
|
|
70
62
|
if (originalWidth < 60 || originalHeight < 60) {
|
|
71
|
-
const {
|
|
72
|
-
src
|
|
73
|
-
} = this.node.attr;
|
|
63
|
+
const { src } = this.node.attr;
|
|
74
64
|
let parent = this.$parent;
|
|
75
65
|
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
76
66
|
parent = parent.$parent;
|
|
@@ -91,7 +81,7 @@ export default {
|
|
|
91
81
|
}
|
|
92
82
|
|
|
93
83
|
return results;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
96
86
|
};
|
|
97
87
|
</script>
|
|
@@ -10,8 +10,8 @@ export default {
|
|
|
10
10
|
type: Object,
|
|
11
11
|
default() {
|
|
12
12
|
return {};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
15
|
},
|
|
16
16
|
data() {
|
|
17
17
|
return {
|
|
@@ -30,21 +30,21 @@ export default {
|
|
|
30
30
|
let t = {
|
|
31
31
|
name: children.tag,
|
|
32
32
|
attrs: {
|
|
33
|
-
class: children.classStr
|
|
33
|
+
class: children.classStr
|
|
34
34
|
// style: children.styleStr,
|
|
35
35
|
},
|
|
36
36
|
children: children.nodes ? this.loadNode(children.nodes) : []
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
|
|
39
|
-
obj.push(t)
|
|
39
|
+
obj.push(t);
|
|
40
40
|
} else if (children.node == 'text') {
|
|
41
41
|
obj.push({
|
|
42
42
|
type: 'text',
|
|
43
43
|
text: children.text
|
|
44
|
-
})
|
|
44
|
+
});
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
return obj
|
|
47
|
+
return obj;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
};
|
|
@@ -1,88 +1,105 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</block>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view>
|
|
3
|
+
<!--判断是否是标签节点-->
|
|
4
|
+
<block v-if="node.node == 'element'">
|
|
5
|
+
<block v-if="node.tag == 'button'">
|
|
6
|
+
<button type="default" size="mini">
|
|
7
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
8
|
+
<wx-parse-template :node="node" />
|
|
9
|
+
</block>
|
|
10
|
+
</button>
|
|
11
|
+
</block>
|
|
12
|
+
|
|
13
|
+
<!--li类型-->
|
|
14
|
+
<block v-else-if="node.tag == 'li'">
|
|
15
|
+
<view :class="node.classStr" :style="node.styleStr">
|
|
16
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
17
|
+
<wx-parse-template :node="node" />
|
|
18
|
+
</block>
|
|
19
|
+
</view>
|
|
20
|
+
</block>
|
|
21
|
+
|
|
22
|
+
<!--video类型-->
|
|
23
|
+
<block v-else-if="node.tag == 'video'">
|
|
24
|
+
<wx-parse-video :node="node" />
|
|
25
|
+
</block>
|
|
26
|
+
|
|
27
|
+
<!--audio类型-->
|
|
28
|
+
<block v-else-if="node.tag == 'audio'">
|
|
29
|
+
<wx-parse-audio :node="node" />
|
|
30
|
+
</block>
|
|
31
|
+
|
|
32
|
+
<!--img类型-->
|
|
33
|
+
<block v-else-if="node.tag == 'img'">
|
|
34
|
+
<wx-parse-img :node="node" />
|
|
35
|
+
</block>
|
|
36
|
+
|
|
37
|
+
<!--a类型-->
|
|
38
|
+
<block v-else-if="node.tag == 'a'">
|
|
39
|
+
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
|
40
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
41
|
+
<wx-parse-template :node="node" />
|
|
42
|
+
</block>
|
|
43
|
+
</view>
|
|
44
|
+
</block>
|
|
45
|
+
|
|
46
|
+
<!--table类型-->
|
|
47
|
+
<block v-else-if="node.tag == 'table'">
|
|
48
|
+
<view :class="node.classStr" class="table" :style="node.styleStr">
|
|
49
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
50
|
+
<wx-parse-template :node="node" />
|
|
51
|
+
</block>
|
|
52
|
+
</view>
|
|
53
|
+
</block>
|
|
54
|
+
|
|
55
|
+
<!--br类型-->
|
|
56
|
+
<block v-else-if="node.tag == 'br'">
|
|
57
|
+
<text>\n</text>
|
|
58
|
+
</block>
|
|
59
|
+
|
|
60
|
+
<!--其他标签-->
|
|
61
|
+
<block v-else>
|
|
62
|
+
<view :class="node.classStr" :style="node.styleStr">
|
|
63
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
64
|
+
<wx-parse-template :node="node" />
|
|
65
|
+
</block>
|
|
66
|
+
</view>
|
|
67
|
+
</block>
|
|
68
|
+
</block>
|
|
69
|
+
|
|
70
|
+
<!--判断是否是文本节点-->
|
|
71
|
+
<block v-else-if="node.node == 'text'">{{ node.text }}</block>
|
|
72
|
+
</view>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script>
|
|
76
|
+
import wxParseTemplate from './wxParseTemplate1';
|
|
77
|
+
import wxParseImg from './wxParseImg';
|
|
78
|
+
import wxParseVideo from './wxParseVideo';
|
|
79
|
+
import wxParseAudio from './wxParseAudio';
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
name: 'wxParseTemplate0',
|
|
83
|
+
props: {
|
|
84
|
+
node: {}
|
|
85
|
+
},
|
|
86
|
+
components: {
|
|
87
|
+
wxParseTemplate,
|
|
88
|
+
wxParseImg,
|
|
89
|
+
wxParseVideo,
|
|
90
|
+
wxParseAudio
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
wxParseATap(e) {
|
|
94
|
+
const { href } = e.currentTarget.dataset; // TODO currentTarget才有dataset
|
|
95
|
+
if (!href) return;
|
|
96
|
+
let parent = this.$parent;
|
|
97
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
98
|
+
// TODO 遍历获取父节点执行方法
|
|
99
|
+
parent = parent.$parent;
|
|
100
|
+
}
|
|
101
|
+
parent.navigate(href, e);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
@@ -1,88 +1,96 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="node.tag == 'li' ? node.classStr : node.node === 'text' ? 'text' : ''">
|
|
3
|
+
<!--判断是否是标签节点-->
|
|
4
|
+
<block v-if="node.node == 'element'">
|
|
5
|
+
<block v-if="node.tag == 'button'">
|
|
6
|
+
<button type="default" size="mini">
|
|
7
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
8
|
+
<wx-parse-template :node="node" />
|
|
9
|
+
</block>
|
|
10
|
+
</button>
|
|
11
|
+
</block>
|
|
12
|
+
|
|
13
|
+
<!--li类型-->
|
|
14
|
+
<block v-else-if="node.tag == 'li'">
|
|
15
|
+
<!-- <view :class="node.classStr" :style="node.styleStr"> -->
|
|
16
|
+
<view :style="node.styleStr">
|
|
17
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
18
|
+
<wx-parse-template :node="node" />
|
|
19
|
+
</block>
|
|
20
|
+
</view>
|
|
21
|
+
</block>
|
|
22
|
+
|
|
23
|
+
<!--video类型-->
|
|
24
|
+
<block v-else-if="node.tag == 'video'">
|
|
25
|
+
<wx-parse-video :node="node" />
|
|
26
|
+
</block>
|
|
27
|
+
|
|
28
|
+
<!--audio类型-->
|
|
29
|
+
<block v-else-if="node.tag == 'audio'">
|
|
30
|
+
<wx-parse-audio :node="node" />
|
|
31
|
+
</block>
|
|
32
|
+
|
|
33
|
+
<!--img类型-->
|
|
34
|
+
<block v-else-if="node.tag == 'img'">
|
|
35
|
+
<wx-parse-img :node="node" />
|
|
36
|
+
</block>
|
|
37
|
+
|
|
38
|
+
<!--a类型-->
|
|
39
|
+
<block v-else-if="node.tag == 'a'">
|
|
40
|
+
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
|
41
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
42
|
+
<wx-parse-template :node="node" />
|
|
43
|
+
</block>
|
|
44
|
+
</view>
|
|
45
|
+
</block>
|
|
46
|
+
|
|
47
|
+
<!--br类型-->
|
|
48
|
+
<block v-else-if="node.tag == 'br'">
|
|
49
|
+
<text>\n</text>
|
|
50
|
+
</block>
|
|
51
|
+
|
|
52
|
+
<!--其他标签-->
|
|
53
|
+
<block v-else>
|
|
54
|
+
<view :class="node.classStr" :style="node.styleStr">
|
|
55
|
+
<block v-for="(node, index) of node.nodes" :key="index">
|
|
56
|
+
<wx-parse-template :node="node" />
|
|
57
|
+
</block>
|
|
58
|
+
</view>
|
|
59
|
+
</block>
|
|
60
|
+
</block>
|
|
61
|
+
|
|
62
|
+
<!--判断是否是文本节点-->
|
|
63
|
+
<block v-else-if="node.node == 'text'">{{ node.text }}</block>
|
|
64
|
+
</view>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script>
|
|
68
|
+
import wxParseTemplate from './wxParseTemplate2';
|
|
69
|
+
import wxParseImg from './wxParseImg';
|
|
70
|
+
import wxParseVideo from './wxParseVideo';
|
|
71
|
+
import wxParseAudio from './wxParseAudio';
|
|
72
|
+
|
|
73
|
+
export default {
|
|
74
|
+
name: 'wxParseTemplate1',
|
|
75
|
+
props: {
|
|
76
|
+
node: {}
|
|
77
|
+
},
|
|
78
|
+
components: {
|
|
79
|
+
wxParseTemplate,
|
|
80
|
+
wxParseImg,
|
|
81
|
+
wxParseVideo,
|
|
82
|
+
wxParseAudio
|
|
83
|
+
},
|
|
84
|
+
methods: {
|
|
85
|
+
wxParseATap(e) {
|
|
86
|
+
const { href } = e.currentTarget.dataset;
|
|
87
|
+
if (!href) return;
|
|
88
|
+
let parent = this.$parent;
|
|
89
|
+
while (!parent.preview || typeof parent.preview !== 'function') {
|
|
90
|
+
parent = parent.$parent;
|
|
91
|
+
}
|
|
92
|
+
parent.navigate(href, e);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
</script>
|