作者 卢胜

bug

要显示太多修改。

为保证性能只显示 28 of 28+ 个文件。

1 <script> 1 <script>
2 - var wx = require('jweixin-module')  
3 import { 2 import {
4 authorization, 3 authorization,
5 getOpenid 4 getOpenid
@@ -12,9 +11,9 @@ @@ -12,9 +11,9 @@
12 11
13 if (!openId && !e.query.code) { 12 if (!openId && !e.query.code) {
14 console.log('获取code'); 13 console.log('获取code');
15 - getApp().authorization() 14 + // getApp().authorization()
16 } else if (e.query.code) { 15 } else if (e.query.code) {
17 - getApp().getOpenid(e.query.code) 16 + // getApp().getOpenid(e.query.code)
18 } 17 }
19 // else { 18 // else {
20 // uni.showModal({ 19 // uni.showModal({
@@ -26,11 +25,14 @@ @@ -26,11 +25,14 @@
26 console.log('App Launch') 25 console.log('App Launch')
27 }, 26 },
28 onShow: function() { 27 onShow: function() {
29 - console.log('App Show') 28 + console.log('App')
30 }, 29 },
31 onHide: function() { 30 onHide: function() {
32 console.log('App Hide') 31 console.log('App Hide')
33 }, 32 },
  33 + watch:{
  34 +
  35 + },
34 methods: { 36 methods: {
35 // 拿code 37 // 拿code
36 async authorization() { 38 async authorization() {
@@ -54,3 +54,6 @@ export const sort_all = (keyword) => request({url: 'product/sort_all',method: ' @@ -54,3 +54,6 @@ export const sort_all = (keyword) => request({url: 'product/sort_all',method: '
54 54
55 //搜索弹窗分类 55 //搜索弹窗分类
56 export const sort_search = (keyword) => request({url: 'product/sort_search',method: 'post',data: {keyword}}) 56 export const sort_search = (keyword) => request({url: 'product/sort_search',method: 'post',data: {keyword}})
  57 +
  58 +//获取jssdk数据
  59 +export const get_jssdk = (url) => request({url: 'common/get_jssdk',method: 'post',data: {url}})
1 -import App from './App'  
2 -  
3 -// #ifndef VUE3 1 +import App from './App'
  2 +import {Shares} from '@/utils/share.js'
  3 +// #ifndef VUE3
4 import Vue from 'vue' 4 import Vue from 'vue'
5 -import uView from "uview-ui";  
6 -Vue.use(uView); 5 +import uView from "uview-ui";
  6 +Vue.use(uView);
7 Vue.config.productionTip = false 7 Vue.config.productionTip = false
  8 +Vue.prototype.$wxH5Share = Shares
8 App.mpType = 'app' 9 App.mpType = 'app'
9 const app = new Vue({ 10 const app = new Vue({
10 - ...App 11 + ...App
11 }) 12 })
12 -app.$mount()  
13 -// #endif  
14 -  
15 -// #ifdef VUE3  
16 -import { createSSRApp } from 'vue'  
17 -export function createApp() {  
18 - const app = createSSRApp(App)  
19 - return {  
20 - app  
21 - } 13 +app.$mount()
  14 +// #endif
  15 +// router.beforeEach((to, from, next) => {
  16 +// var u = navigator.userAgent;
  17 +// var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
  18 +// if (isiOS && to.path !== location.pathname) {
  19 +// location.assign(to.fullPath)
  20 +// } else {
  21 +// next();
  22 +// }
  23 +// })
  24 +
  25 +// #ifdef VUE3
  26 +import {
  27 + createSSRApp
  28 +} from 'vue'
  29 +export function createApp() {
  30 + const app = createSSRApp(App)
  31 + return {
  32 + app
  33 + }
22 } 34 }
23 -// #endif  
  35 +// #endif
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<module type="WEB_MODULE" version="4">
  3 + <component name="NewModuleRootManager">
  4 + <content url="file://$MODULE_DIR$" />
  5 + <orderEntry type="inheritedJdk" />
  6 + <orderEntry type="sourceFolder" forTests="false" />
  7 + </component>
  8 +</module>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="JavaScriptSettings">
  4 + <option name="languageLevel" value="ES6" />
  5 + </component>
  6 +</project>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="ProjectModuleManager">
  4 + <modules>
  5 + <module fileurl="file://$PROJECT_DIR$/.idea/jweixin-js-sdk.iml" filepath="$PROJECT_DIR$/.idea/jweixin-js-sdk.iml" />
  6 + </modules>
  7 + </component>
  8 +</project>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="VcsDirectoryMappings">
  4 + <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
  5 + <mapping directory="$PROJECT_DIR$" vcs="Git" />
  6 + </component>
  7 +</project>
  1 + Apache License
  2 + Version 2.0, January 2004
  3 + http://www.apache.org/licenses/
  4 +
  5 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
  6 +
  7 + 1. Definitions.
  8 +
  9 + "License" shall mean the terms and conditions for use, reproduction,
  10 + and distribution as defined by Sections 1 through 9 of this document.
  11 +
  12 + "Licensor" shall mean the copyright owner or entity authorized by
  13 + the copyright owner that is granting the License.
  14 +
  15 + "Legal Entity" shall mean the union of the acting entity and all
  16 + other entities that control, are controlled by, or are under common
  17 + control with that entity. For the purposes of this definition,
  18 + "control" means (i) the power, direct or indirect, to cause the
  19 + direction or management of such entity, whether by contract or
  20 + otherwise, or (ii) ownership of fifty percent (50%) or more of the
  21 + outstanding shares, or (iii) beneficial ownership of such entity.
  22 +
  23 + "You" (or "Your") shall mean an individual or Legal Entity
  24 + exercising permissions granted by this License.
  25 +
  26 + "Source" form shall mean the preferred form for making modifications,
  27 + including but not limited to software source code, documentation
  28 + source, and configuration files.
  29 +
  30 + "Object" form shall mean any form resulting from mechanical
  31 + transformation or translation of a Source form, including but
  32 + not limited to compiled object code, generated documentation,
  33 + and conversions to other media types.
  34 +
  35 + "Work" shall mean the work of authorship, whether in Source or
  36 + Object form, made available under the License, as indicated by a
  37 + copyright notice that is included in or attached to the work
  38 + (an example is provided in the Appendix below).
  39 +
  40 + "Derivative Works" shall mean any work, whether in Source or Object
  41 + form, that is based on (or derived from) the Work and for which the
  42 + editorial revisions, annotations, elaborations, or other modifications
  43 + represent, as a whole, an original work of authorship. For the purposes
  44 + of this License, Derivative Works shall not include works that remain
  45 + separable from, or merely link (or bind by name) to the interfaces of,
  46 + the Work and Derivative Works thereof.
  47 +
  48 + "Contribution" shall mean any work of authorship, including
  49 + the original version of the Work and any modifications or additions
  50 + to that Work or Derivative Works thereof, that is intentionally
  51 + submitted to Licensor for inclusion in the Work by the copyright owner
  52 + or by an individual or Legal Entity authorized to submit on behalf of
  53 + the copyright owner. For the purposes of this definition, "submitted"
  54 + means any form of electronic, verbal, or written communication sent
  55 + to the Licensor or its representatives, including but not limited to
  56 + communication on electronic mailing lists, source code control systems,
  57 + and issue tracking systems that are managed by, or on behalf of, the
  58 + Licensor for the purpose of discussing and improving the Work, but
  59 + excluding communication that is conspicuously marked or otherwise
  60 + designated in writing by the copyright owner as "Not a Contribution."
  61 +
  62 + "Contributor" shall mean Licensor and any individual or Legal Entity
  63 + on behalf of whom a Contribution has been received by Licensor and
  64 + subsequently incorporated within the Work.
  65 +
  66 + 2. Grant of Copyright License. Subject to the terms and conditions of
  67 + this License, each Contributor hereby grants to You a perpetual,
  68 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  69 + copyright license to reproduce, prepare Derivative Works of,
  70 + publicly display, publicly perform, sublicense, and distribute the
  71 + Work and such Derivative Works in Source or Object form.
  72 +
  73 + 3. Grant of Patent License. Subject to the terms and conditions of
  74 + this License, each Contributor hereby grants to You a perpetual,
  75 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  76 + (except as stated in this section) patent license to make, have made,
  77 + use, offer to sell, sell, import, and otherwise transfer the Work,
  78 + where such license applies only to those patent claims licensable
  79 + by such Contributor that are necessarily infringed by their
  80 + Contribution(s) alone or by combination of their Contribution(s)
  81 + with the Work to which such Contribution(s) was submitted. If You
  82 + institute patent litigation against any entity (including a
  83 + cross-claim or counterclaim in a lawsuit) alleging that the Work
  84 + or a Contribution incorporated within the Work constitutes direct
  85 + or contributory patent infringement, then any patent licenses
  86 + granted to You under this License for that Work shall terminate
  87 + as of the date such litigation is filed.
  88 +
  89 + 4. Redistribution. You may reproduce and distribute copies of the
  90 + Work or Derivative Works thereof in any medium, with or without
  91 + modifications, and in Source or Object form, provided that You
  92 + meet the following conditions:
  93 +
  94 + (a) You must give any other recipients of the Work or
  95 + Derivative Works a copy of this License; and
  96 +
  97 + (b) You must cause any modified files to carry prominent notices
  98 + stating that You changed the files; and
  99 +
  100 + (c) You must retain, in the Source form of any Derivative Works
  101 + that You distribute, all copyright, patent, trademark, and
  102 + attribution notices from the Source form of the Work,
  103 + excluding those notices that do not pertain to any part of
  104 + the Derivative Works; and
  105 +
  106 + (d) If the Work includes a "NOTICE" text file as part of its
  107 + distribution, then any Derivative Works that You distribute must
  108 + include a readable copy of the attribution notices contained
  109 + within such NOTICE file, excluding those notices that do not
  110 + pertain to any part of the Derivative Works, in at least one
  111 + of the following places: within a NOTICE text file distributed
  112 + as part of the Derivative Works; within the Source form or
  113 + documentation, if provided along with the Derivative Works; or,
  114 + within a display generated by the Derivative Works, if and
  115 + wherever such third-party notices normally appear. The contents
  116 + of the NOTICE file are for informational purposes only and
  117 + do not modify the License. You may add Your own attribution
  118 + notices within Derivative Works that You distribute, alongside
  119 + or as an addendum to the NOTICE text from the Work, provided
  120 + that such additional attribution notices cannot be construed
  121 + as modifying the License.
  122 +
  123 + You may add Your own copyright statement to Your modifications and
  124 + may provide additional or different license terms and conditions
  125 + for use, reproduction, or distribution of Your modifications, or
  126 + for any such Derivative Works as a whole, provided Your use,
  127 + reproduction, and distribution of the Work otherwise complies with
  128 + the conditions stated in this License.
  129 +
  130 + 5. Submission of Contributions. Unless You explicitly state otherwise,
  131 + any Contribution intentionally submitted for inclusion in the Work
  132 + by You to the Licensor shall be under the terms and conditions of
  133 + this License, without any additional terms or conditions.
  134 + Notwithstanding the above, nothing herein shall supersede or modify
  135 + the terms of any separate license agreement you may have executed
  136 + with Licensor regarding such Contributions.
  137 +
  138 + 6. Trademarks. This License does not grant permission to use the trade
  139 + names, trademarks, service marks, or product names of the Licensor,
  140 + except as required for reasonable and customary use in describing the
  141 + origin of the Work and reproducing the content of the NOTICE file.
  142 +
  143 + 7. Disclaimer of Warranty. Unless required by applicable law or
  144 + agreed to in writing, Licensor provides the Work (and each
  145 + Contributor provides its Contributions) on an "AS IS" BASIS,
  146 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  147 + implied, including, without limitation, any warranties or conditions
  148 + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
  149 + PARTICULAR PURPOSE. You are solely responsible for determining the
  150 + appropriateness of using or redistributing the Work and assume any
  151 + risks associated with Your exercise of permissions under this License.
  152 +
  153 + 8. Limitation of Liability. In no event and under no legal theory,
  154 + whether in tort (including negligence), contract, or otherwise,
  155 + unless required by applicable law (such as deliberate and grossly
  156 + negligent acts) or agreed to in writing, shall any Contributor be
  157 + liable to You for damages, including any direct, indirect, special,
  158 + incidental, or consequential damages of any character arising as a
  159 + result of this License or out of the use or inability to use the
  160 + Work (including but not limited to damages for loss of goodwill,
  161 + work stoppage, computer failure or malfunction, or any and all
  162 + other commercial damages or losses), even if such Contributor
  163 + has been advised of the possibility of such damages.
  164 +
  165 + 9. Accepting Warranty or Additional Liability. While redistributing
  166 + the Work or Derivative Works thereof, You may choose to offer,
  167 + and charge a fee for, acceptance of support, warranty, indemnity,
  168 + or other liability obligations and/or rights consistent with this
  169 + License. However, in accepting such obligations, You may act only
  170 + on Your own behalf and on Your sole responsibility, not on behalf
  171 + of any other Contributor, and only if You agree to indemnify,
  172 + defend, and hold each Contributor harmless for any liability
  173 + incurred by, or claims asserted against, such Contributor by reason
  174 + of your accepting any such warranty or additional liability.
  175 +
  176 + END OF TERMS AND CONDITIONS
  177 +
  178 + APPENDIX: How to apply the Apache License to your work.
  179 +
  180 + To apply the Apache License to your work, attach the following
  181 + boilerplate notice, with the fields enclosed by brackets "[]"
  182 + replaced with your own identifying information. (Don't include
  183 + the brackets!) The text should be enclosed in the appropriate
  184 + comment syntax for the file format. We also recommend that a
  185 + file or class name and description of purpose be included on the
  186 + same "printed page" as the copyright notice for easier
  187 + identification within third-party archives.
  188 +
  189 + Copyright [yyyy] [name of copyright owner]
  190 +
  191 + Licensed under the Apache License, Version 2.0 (the "License");
  192 + you may not use this file except in compliance with the License.
  193 + You may obtain a copy of the License at
  194 +
  195 + http://www.apache.org/licenses/LICENSE-2.0
  196 +
  197 + Unless required by applicable law or agreed to in writing, software
  198 + distributed under the License is distributed on an "AS IS" BASIS,
  199 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  200 + See the License for the specific language governing permissions and
  201 + limitations under the License.
  1 +!(function (e, n) {
  2 + module.exports = n(e)
  3 +}(window, function (o, e) {
  4 + if (!o.jWeixin) {
  5 + var n;
  6 + var c = {
  7 + config: 'preVerifyJSAPI',
  8 + onMenuShareTimeline: 'menu:share:timeline',
  9 + onMenuShareAppMessage: 'menu:share:appmessage',
  10 + onMenuShareQQ: 'menu:share:qq',
  11 + onMenuShareWeibo: 'menu:share:weiboApp',
  12 + onMenuShareQZone: 'menu:share:QZone',
  13 + previewImage: 'imagePreview',
  14 + getLocation: 'geoLocation',
  15 + openProductSpecificView: 'openProductViewWithPid',
  16 + addCard: 'batchAddCard',
  17 + openCard: 'batchViewCard',
  18 + chooseWXPay: 'getBrandWCPayRequest',
  19 + openEnterpriseRedPacket: 'getRecevieBizHongBaoRequest',
  20 + startSearchBeacons: 'startMonitoringBeacons',
  21 + stopSearchBeacons: 'stopMonitoringBeacons',
  22 + onSearchBeacons: 'onBeaconsInRange',
  23 + consumeAndShareCard: 'consumedShareCard',
  24 + openAddress: 'editAddress'
  25 + };
  26 + var a = (function () {
  27 + var e = {};
  28 + for (var n in c) e[c[n]] = n;
  29 + return e
  30 + }());
  31 + var i = o.document;
  32 + var t = i.title;
  33 + var r = navigator.userAgent.toLowerCase();
  34 + var s = navigator.platform.toLowerCase();
  35 + var d = !(!s.match('mac') && !s.match('win'));
  36 + var u = r.indexOf('wxdebugger') != -1;
  37 + var l = r.indexOf('micromessenger') != -1;
  38 + var p = r.indexOf('android') != -1;
  39 + var f = r.indexOf('iphone') != -1 || r.indexOf('ipad') != -1;
  40 + var m = (n = r.match(/micromessenger\/(\d+\.\d+\.\d+)/) || r.match(/micromessenger\/(\d+\.\d+)/)) ? n[1] : '';
  41 + var g = {initStartTime: L(), initEndTime: 0, preVerifyStartTime: 0, preVerifyEndTime: 0};
  42 + var h = {
  43 + version: 1,
  44 + appId: '',
  45 + initTime: 0,
  46 + preVerifyTime: 0,
  47 + networkType: '',
  48 + isPreVerifyOk: 1,
  49 + systemType: f ? 1 : p ? 2 : -1,
  50 + clientVersion: m,
  51 + url: encodeURIComponent(location.href)
  52 + };
  53 + var v = {};
  54 + var S = {_completes: []};
  55 + var y = {state: 0, data: {}};
  56 + O(function () {
  57 + g.initEndTime = L()
  58 + });
  59 + var I = !1;
  60 + var _ = [];
  61 + var w = {
  62 + config: function (e) {
  63 + B('config', v = e);
  64 + var t = !1 !== v.check;
  65 + O(function () {
  66 + if (t) M(c.config, {
  67 + verifyJsApiList: C(v.jsApiList),
  68 + verifyOpenTagList: C(v.openTagList)
  69 + }, (function () {
  70 + S._complete = function (e) {
  71 + g.preVerifyEndTime = L(), y.state = 1, y.data = e
  72 + }, S.success = function (e) {
  73 + h.isPreVerifyOk = 0
  74 + }, S.fail = function (e) {
  75 + S._fail ? S._fail(e) : y.state = -1
  76 + };
  77 + var t = S._completes;
  78 + return t.push(function () {
  79 + !(function () {
  80 + if (!(d || u || v.debug || m < '6.0.2' || h.systemType < 0)) {
  81 + var i = new Image();
  82 + h.appId = v.appId, h.initTime = g.initEndTime - g.initStartTime, h.preVerifyTime = g.preVerifyEndTime - g.preVerifyStartTime, w.getNetworkType({
  83 + isInnerInvoke: !0,
  84 + success: function (e) {
  85 + h.networkType = e.networkType;
  86 + var n = 'https://open.weixin.qq.com/sdk/report?v=' + h.version + '&o=' + h.isPreVerifyOk + '&s=' + h.systemType + '&c=' + h.clientVersion + '&a=' + h.appId + '&n=' + h.networkType + '&i=' + h.initTime + '&p=' + h.preVerifyTime + '&u=' + h.url;
  87 + i.src = n
  88 + }
  89 + })
  90 + }
  91 + }())
  92 + }), S.complete = function (e) {
  93 + for (var n = 0, i = t.length; n < i; ++n) t[n]();
  94 + S._completes = []
  95 + }, S
  96 + }())), g.preVerifyStartTime = L(); else {
  97 + y.state = 1;
  98 + for (var e = S._completes, n = 0, i = e.length; n < i; ++n) e[n]();
  99 + S._completes = []
  100 + }
  101 + }), w.invoke || (w.invoke = function (e, n, i) {
  102 + o.WeixinJSBridge && WeixinJSBridge.invoke(e, x(n), i)
  103 + }, w.on = function (e, n) {
  104 + o.WeixinJSBridge && WeixinJSBridge.on(e, n)
  105 + })
  106 + },
  107 + signurl: function() {
  108 + return h.url
  109 + },
  110 + ready: function (e) {
  111 + y.state != 0 ? e() : (S._completes.push(e), !l && v.debug && e())
  112 + }, error: function (e) {
  113 + m < '6.0.2' || (y.state == -1 ? e(y.data) : S._fail = e)
  114 + }, checkJsApi: function (e) {
  115 + M('checkJsApi', {jsApiList: C(e.jsApiList)}, (e._complete = function (e) {
  116 + if (p) {
  117 + var n = e.checkResult;
  118 + n && (e.checkResult = JSON.parse(n))
  119 + }
  120 + e = (function (e) {
  121 + var n = e.checkResult;
  122 + for (var i in n) {
  123 + var t = a[i];
  124 + t && (n[t] = n[i], delete n[i])
  125 + }
  126 + return e
  127 + }(e))
  128 + }, e))
  129 + }, onMenuShareTimeline: function (e) {
  130 + P(c.onMenuShareTimeline, {
  131 + complete: function () {
  132 + M('shareTimeline', {
  133 + title: e.title || t,
  134 + desc: e.title || t,
  135 + img_url: e.imgUrl || '',
  136 + link: e.link || location.href,
  137 + type: e.type || 'link',
  138 + data_url: e.dataUrl || ''
  139 + }, e)
  140 + }
  141 + }, e)
  142 + }, onMenuShareAppMessage: function (n) {
  143 + P(c.onMenuShareAppMessage, {
  144 + complete: function (e) {
  145 + e.scene === 'favorite' ? M('sendAppMessage', {
  146 + title: n.title || t,
  147 + desc: n.desc || '',
  148 + link: n.link || location.href,
  149 + img_url: n.imgUrl || '',
  150 + type: n.type || 'link',
  151 + data_url: n.dataUrl || ''
  152 + }) : M('sendAppMessage', {
  153 + title: n.title || t,
  154 + desc: n.desc || '',
  155 + link: n.link || location.href,
  156 + img_url: n.imgUrl || '',
  157 + type: n.type || 'link',
  158 + data_url: n.dataUrl || ''
  159 + }, n)
  160 + }
  161 + }, n)
  162 + }, onMenuShareQQ: function (e) {
  163 + P(c.onMenuShareQQ, {
  164 + complete: function () {
  165 + M('shareQQ', {
  166 + title: e.title || t,
  167 + desc: e.desc || '',
  168 + img_url: e.imgUrl || '',
  169 + link: e.link || location.href
  170 + }, e)
  171 + }
  172 + }, e)
  173 + }, onMenuShareWeibo: function (e) {
  174 + P(c.onMenuShareWeibo, {
  175 + complete: function () {
  176 + M('shareWeiboApp', {
  177 + title: e.title || t,
  178 + desc: e.desc || '',
  179 + img_url: e.imgUrl || '',
  180 + link: e.link || location.href
  181 + }, e)
  182 + }
  183 + }, e)
  184 + }, onMenuShareQZone: function (e) {
  185 + P(c.onMenuShareQZone, {
  186 + complete: function () {
  187 + M('shareQZone', {
  188 + title: e.title || t,
  189 + desc: e.desc || '',
  190 + img_url: e.imgUrl || '',
  191 + link: e.link || location.href
  192 + }, e)
  193 + }
  194 + }, e)
  195 + }, updateTimelineShareData: function (e) {
  196 + M('updateTimelineShareData', {title: e.title, link: e.link, imgUrl: e.imgUrl}, e)
  197 + }, updateAppMessageShareData: function (e) {
  198 + M('updateAppMessageShareData', {title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl}, e)
  199 + }, startRecord: function (e) {
  200 + M('startRecord', {}, e)
  201 + }, stopRecord: function (e) {
  202 + M('stopRecord', {}, e)
  203 + }, onVoiceRecordEnd: function (e) {
  204 + P('onVoiceRecordEnd', e)
  205 + }, playVoice: function (e) {
  206 + M('playVoice', {localId: e.localId}, e)
  207 + }, pauseVoice: function (e) {
  208 + M('pauseVoice', {localId: e.localId}, e)
  209 + }, stopVoice: function (e) {
  210 + M('stopVoice', {localId: e.localId}, e)
  211 + }, onVoicePlayEnd: function (e) {
  212 + P('onVoicePlayEnd', e)
  213 + }, uploadVoice: function (e) {
  214 + M('uploadVoice', {localId: e.localId, isShowProgressTips: e.isShowProgressTips == 0 ? 0 : 1}, e)
  215 + }, downloadVoice: function (e) {
  216 + M('downloadVoice', {serverId: e.serverId, isShowProgressTips: e.isShowProgressTips == 0 ? 0 : 1}, e)
  217 + }, translateVoice: function (e) {
  218 + M('translateVoice', {localId: e.localId, isShowProgressTips: e.isShowProgressTips == 0 ? 0 : 1}, e)
  219 + }, chooseImage: function (e) {
  220 + M('chooseImage', {
  221 + scene: '1|2',
  222 + count: e.count || 9,
  223 + sizeType: e.sizeType || ['original', 'compressed'],
  224 + sourceType: e.sourceType || ['album', 'camera']
  225 + }, (e._complete = function (e) {
  226 + if (p) {
  227 + var n = e.localIds;
  228 + try {
  229 + n && (e.localIds = JSON.parse(n))
  230 + } catch (e) {
  231 + }
  232 + }
  233 + }, e))
  234 + }, getLocation: function (e) {
  235 + }, previewImage: function (e) {
  236 + M(c.previewImage, {current: e.current, urls: e.urls}, e)
  237 + }, uploadImage: function (e) {
  238 + M('uploadImage', {localId: e.localId, isShowProgressTips: e.isShowProgressTips == 0 ? 0 : 1}, e)
  239 + }, downloadImage: function (e) {
  240 + M('downloadImage', {serverId: e.serverId, isShowProgressTips: e.isShowProgressTips == 0 ? 0 : 1}, e)
  241 + }, getLocalImgData: function (e) {
  242 + !1 === I ? (I = !0, M('getLocalImgData', {localId: e.localId}, (e._complete = function (e) {
  243 + if (I = !1, _.length > 0) {
  244 + var n = _.shift();
  245 + wx.getLocalImgData(n)
  246 + }
  247 + }, e))) : _.push(e)
  248 + }, getNetworkType: function (e) {
  249 + M('getNetworkType', {}, (e._complete = function (e) {
  250 + e = (function (e) {
  251 + var n = e.errMsg;
  252 + e.errMsg = 'getNetworkType:ok';
  253 + var i = e.subtype;
  254 + if (delete e.subtype, i) e.networkType = i; else {
  255 + var t = n.indexOf(':');
  256 + var o = n.substring(t + 1);
  257 + switch (o) {
  258 + case 'wifi':
  259 + case 'edge':
  260 + case 'wwan':
  261 + e.networkType = o;
  262 + break;
  263 + default:
  264 + e.errMsg = 'getNetworkType:fail'
  265 + }
  266 + }
  267 + return e
  268 + }(e))
  269 + }, e))
  270 + }, openLocation: function (e) {
  271 + M('openLocation', {
  272 + latitude: e.latitude,
  273 + longitude: e.longitude,
  274 + name: e.name || '',
  275 + address: e.address || '',
  276 + scale: e.scale || 28,
  277 + infoUrl: e.infoUrl || ''
  278 + }, e)
  279 + }, getLocation: function (e) {
  280 + M(c.getLocation, {type: (e = e || {}).type || 'wgs84'}, (e._complete = function (e) {
  281 + delete e.type
  282 + }, e))
  283 + }, hideOptionMenu: function (e) {
  284 + M('hideOptionMenu', {}, e)
  285 + }, showOptionMenu: function (e) {
  286 + M('showOptionMenu', {}, e)
  287 + }, closeWindow: function (e) {
  288 + M('closeWindow', {}, e = e || {})
  289 + }, hideMenuItems: function (e) {
  290 + M('hideMenuItems', {menuList: e.menuList}, e)
  291 + }, showMenuItems: function (e) {
  292 + M('showMenuItems', {menuList: e.menuList}, e)
  293 + }, hideAllNonBaseMenuItem: function (e) {
  294 + M('hideAllNonBaseMenuItem', {}, e)
  295 + }, showAllNonBaseMenuItem: function (e) {
  296 + M('showAllNonBaseMenuItem', {}, e)
  297 + }, scanQRCode: function (e) {
  298 + M('scanQRCode', {
  299 + needResult: (e = e || {}).needResult || 0,
  300 + scanType: e.scanType || ['qrCode', 'barCode']
  301 + }, (e._complete = function (e) {
  302 + if (f) {
  303 + var n = e.resultStr;
  304 + if (n) {
  305 + var i = JSON.parse(n);
  306 + e.resultStr = i && i.scan_code && i.scan_code.scan_result
  307 + }
  308 + }
  309 + }, e))
  310 + }, openAddress: function (e) {
  311 + M(c.openAddress, {}, (e._complete = function (e) {
  312 + e = (function (e) {
  313 + return e.postalCode = e.addressPostalCode, delete e.addressPostalCode, e.provinceName = e.proviceFirstStageName, delete e.proviceFirstStageName, e.cityName = e.addressCitySecondStageName, delete e.addressCitySecondStageName, e.countryName = e.addressCountiesThirdStageName, delete e.addressCountiesThirdStageName, e.detailInfo = e.addressDetailInfo, delete e.addressDetailInfo, e
  314 + }(e))
  315 + }, e))
  316 + }, openProductSpecificView: function (e) {
  317 + M(c.openProductSpecificView, {pid: e.productId, view_type: e.viewType || 0, ext_info: e.extInfo}, e)
  318 + }, addCard: function (e) {
  319 + for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
  320 + var r = n[t];
  321 + var a = {card_id: r.cardId, card_ext: r.cardExt};
  322 + i.push(a)
  323 + }
  324 + M(c.addCard, {card_list: i}, (e._complete = function (e) {
  325 + var n = e.card_list;
  326 + if (n) {
  327 + for (var i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) {
  328 + var o = n[i];
  329 + o.cardId = o.card_id, o.cardExt = o.card_ext, o.isSuccess = !!o.is_succ, delete o.card_id, delete o.card_ext, delete o.is_succ
  330 + }
  331 + e.cardList = n, delete e.card_list
  332 + }
  333 + }, e))
  334 + }, chooseCard: function (e) {
  335 + M('chooseCard', {
  336 + app_id: v.appId,
  337 + location_id: e.shopId || '',
  338 + sign_type: e.signType || 'SHA1',
  339 + card_id: e.cardId || '',
  340 + card_type: e.cardType || '',
  341 + card_sign: e.cardSign,
  342 + time_stamp: e.timestamp + '',
  343 + nonce_str: e.nonceStr
  344 + }, (e._complete = function (e) {
  345 + e.cardList = e.choose_card_info, delete e.choose_card_info
  346 + }, e))
  347 + }, openCard: function (e) {
  348 + for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
  349 + var r = n[t];
  350 + var a = {card_id: r.cardId, code: r.code};
  351 + i.push(a)
  352 + }
  353 + M(c.openCard, {card_list: i}, e)
  354 + }, consumeAndShareCard: function (e) {
  355 + M(c.consumeAndShareCard, {consumedCardId: e.cardId, consumedCode: e.code}, e)
  356 + }, chooseWXPay: function (e) {
  357 + M(c.chooseWXPay, V(e), e)
  358 + }, openEnterpriseRedPacket: function (e) {
  359 + M(c.openEnterpriseRedPacket, V(e), e)
  360 + }, startSearchBeacons: function (e) {
  361 + M(c.startSearchBeacons, {ticket: e.ticket}, e)
  362 + }, stopSearchBeacons: function (e) {
  363 + M(c.stopSearchBeacons, {}, e)
  364 + }, onSearchBeacons: function (e) {
  365 + P(c.onSearchBeacons, e)
  366 + }, openEnterpriseChat: function (e) {
  367 + M('openEnterpriseChat', {useridlist: e.userIds, chatname: e.groupName}, e)
  368 + }, launchMiniProgram: function (e) {
  369 + M('launchMiniProgram', {
  370 + targetAppId: e.targetAppId, path: (function (e) {
  371 + if (typeof e === 'string' && e.length > 0) {
  372 + var n = e.split('?')[0];
  373 + var i = e.split('?')[1];
  374 + return n += '.html', void 0 !== i ? n + '?' + i : n
  375 + }
  376 + }(e.path)), envVersion: e.envVersion
  377 + }, e)
  378 + }, openBusinessView: function (e) {
  379 + M('openBusinessView', {
  380 + businessType: e.businessType,
  381 + queryString: e.queryString || '',
  382 + envVersion: e.envVersion
  383 + }, (e._complete = function (n) {
  384 + if (p) {
  385 + var e = n.extraData;
  386 + if (e) try {
  387 + n.extraData = JSON.parse(e)
  388 + } catch (e) {
  389 + n.extraData = {}
  390 + }
  391 + }
  392 + }, e))
  393 + }, miniProgram: {
  394 + navigateBack: function (e) {
  395 + e = e || {}, O(function () {
  396 + M('invokeMiniProgramAPI', {name: 'navigateBack', arg: {delta: e.delta || 1}}, e)
  397 + })
  398 + }, navigateTo: function (e) {
  399 + O(function () {
  400 + M('invokeMiniProgramAPI', {name: 'navigateTo', arg: {url: e.url}}, e)
  401 + })
  402 + }, redirectTo: function (e) {
  403 + O(function () {
  404 + M('invokeMiniProgramAPI', {name: 'redirectTo', arg: {url: e.url}}, e)
  405 + })
  406 + }, switchTab: function (e) {
  407 + O(function () {
  408 + M('invokeMiniProgramAPI', {name: 'switchTab', arg: {url: e.url}}, e)
  409 + })
  410 + }, reLaunch: function (e) {
  411 + O(function () {
  412 + M('invokeMiniProgramAPI', {name: 'reLaunch', arg: {url: e.url}}, e)
  413 + })
  414 + }, postMessage: function (e) {
  415 + O(function () {
  416 + M('invokeMiniProgramAPI', {name: 'postMessage', arg: e.data || {}}, e)
  417 + })
  418 + }, getEnv: function (e) {
  419 + O(function () {
  420 + e({miniprogram: o.__wxjs_environment === 'miniprogram'})
  421 + })
  422 + }
  423 + }
  424 + };
  425 + var T = 1;
  426 + var k = {};
  427 + return i.addEventListener('error', function (e) {
  428 + if (!p) {
  429 + var n = e.target;
  430 + var i = n.tagName;
  431 + var t = n.src;
  432 + if (i == 'IMG' || i == 'VIDEO' || i == 'AUDIO' || i == 'SOURCE') if (t.indexOf('wxlocalresource://') != -1) {
  433 + e.preventDefault(), e.stopPropagation();
  434 + var o = n['wx-id'];
  435 + if (o || (o = T++, n['wx-id'] = o), k[o]) return;
  436 + k[o] = !0, wx.ready(function () {
  437 + wx.getLocalImgData({
  438 + localId: t, success: function (e) {
  439 + n.src = e.localData
  440 + }
  441 + })
  442 + })
  443 + }
  444 + }
  445 + }, !0), i.addEventListener('load', function (e) {
  446 + if (!p) {
  447 + var n = e.target;
  448 + var i = n.tagName;
  449 + n.src;
  450 + if (i == 'IMG' || i == 'VIDEO' || i == 'AUDIO' || i == 'SOURCE') {
  451 + var t = n['wx-id'];
  452 + t && (k[t] = !1)
  453 + }
  454 + }
  455 + }, !0), e && (o.wx = o.jWeixin = w), w
  456 + }
  457 +
  458 + function M(n, e, i) {
  459 + o.WeixinJSBridge ? WeixinJSBridge.invoke(n, x(e), function (e) {
  460 + A(n, e, i)
  461 + }) : B(n, i)
  462 + }
  463 +
  464 + function P(n, i, t) {
  465 + o.WeixinJSBridge ? WeixinJSBridge.on(n, function (e) {
  466 + t && t.trigger && t.trigger(e), A(n, e, i)
  467 + }) : B(n, t || i)
  468 + }
  469 +
  470 + function x(e) {
  471 + return (e = e || {}).appId = v.appId, e.verifyAppId = v.appId, e.verifySignType = 'sha1', e.verifyTimestamp = v.timestamp + '', e.verifyNonceStr = v.nonceStr, e.verifySignature = v.signature, e
  472 + }
  473 +
  474 + function V(e) {
  475 + return {
  476 + timeStamp: e.timestamp + '',
  477 + nonceStr: e.nonceStr,
  478 + package: e.package,
  479 + paySign: e.paySign,
  480 + signType: e.signType || 'SHA1'
  481 + }
  482 + }
  483 +
  484 + function A(e, n, i) {
  485 + e != 'openEnterpriseChat' && e !== 'openBusinessView' || (n.errCode = n.err_code), delete n.err_code, delete n.err_desc, delete n.err_detail;
  486 + var t = n.errMsg;
  487 + t || (t = n.err_msg, delete n.err_msg, t = (function (e, n) {
  488 + var i = e;
  489 + var t = a[i];
  490 + t && (i = t);
  491 + var o = 'ok';
  492 + if (n) {
  493 + var r = n.indexOf(':');
  494 + (o = n.substring(r + 1)) == 'confirm' && (o = 'ok'), o == 'failed' && (o = 'fail'), o.indexOf('failed_') != -1 && (o = o.substring(7)), o.indexOf('fail_') != -1 && (o = o.substring(5)), (o = (o = o.replace(/_/g, ' ')).toLowerCase()) != 'access denied' && o != 'no permission to execute' || (o = 'permission denied'), i == 'config' && o == 'function not exist' && (o = 'ok'), o == '' && (o = 'fail')
  495 + }
  496 + return n = i + ':' + o
  497 + }(e, t)), n.errMsg = t), (i = i || {})._complete && (i._complete(n), delete i._complete), t = n.errMsg || '', v.debug && !i.isInnerInvoke && alert(JSON.stringify(n));
  498 + var o = t.indexOf(':');
  499 + switch (t.substring(o + 1)) {
  500 + case 'ok':
  501 + i.success && i.success(n);
  502 + break;
  503 + case 'cancel':
  504 + i.cancel && i.cancel(n);
  505 + break;
  506 + default:
  507 + i.fail && i.fail(n)
  508 + }
  509 + i.complete && i.complete(n)
  510 + }
  511 +
  512 + function C(e) {
  513 + if (e) {
  514 + for (var n = 0, i = e.length; n < i; ++n) {
  515 + var t = e[n];
  516 + var o = c[t];
  517 + o && (e[n] = o)
  518 + }
  519 + return e
  520 + }
  521 + }
  522 +
  523 + function B(e, n) {
  524 + if (!(!v.debug || n && n.isInnerInvoke)) {
  525 + var i = a[e];
  526 + i && (e = i), n && n._complete && delete n._complete, console.log('"' + e + '",', n || '')
  527 + }
  528 + }
  529 +
  530 + function L() {
  531 + return (new Date()).getTime()
  532 + }
  533 +
  534 + function O(e) {
  535 + l && (o.WeixinJSBridge ? e() : i.addEventListener && i.addEventListener('WeixinJSBridgeReady', e, !1))
  536 + }
  537 +}))
  1 +!(function(e, n) { typeof define === 'function' && (define.amd || define.cmd) ? define(function() { return n(e) }) : n(e, !0) }(window, function(o, e) { if (!o.jWeixin) { var n; var c = { config: 'preVerifyJSAPI', onMenuShareTimeline: 'menu:share:timeline', onMenuShareAppMessage: 'menu:share:appmessage', onMenuShareQQ: 'menu:share:qq', onMenuShareWeibo: 'menu:share:weiboApp', onMenuShareQZone: 'menu:share:QZone', previewImage: 'imagePreview', getLocation: 'geoLocation', openProductSpecificView: 'openProductViewWithPid', addCard: 'batchAddCard', openCard: 'batchViewCard', chooseWXPay: 'getBrandWCPayRequest', openEnterpriseRedPacket: 'getRecevieBizHongBaoRequest', startSearchBeacons: 'startMonitoringBeacons', stopSearchBeacons: 'stopMonitoringBeacons', onSearchBeacons: 'onBeaconsInRange', consumeAndShareCard: 'consumedShareCard', openAddress: 'editAddress' }; var a = (function() { var e = {}; for (var n in c)e[c[n]] = n; return e }()); var i = e.document; var t = i.title; var r = navigator.userAgent.toLowerCase(); var s = navigator.platform.toLowerCase(); var d = !(!s.match('mac') && !s.match('win')); var u = r.indexOf('wxdebugger') != -1; var l = r.indexOf('micromessenger') != -1; var p = r.indexOf('android') != -1; var f = r.indexOf('iphone') != -1 || r.indexOf('ipad') != -1; var m = (n = r.match(/micromessenger\/(\d+\.\d+\.\d+)/) || r.match(/micromessenger\/(\d+\.\d+)/)) ? n[1] : ''; var g = { initStartTime: L(), initEndTime: 0, preVerifyStartTime: 0, preVerifyEndTime: 0 }; var h = { version: 1, appId: '', initTime: 0, preVerifyTime: 0, networkType: '', isPreVerifyOk: 1, systemType: f ? 1 : p ? 2 : -1, clientVersion: m, url: encodeURIComponent(location.href) }; var v = {}; var S = { _completes: [] }; var y = { state: 0, data: {} }; O(function() { g.initEndTime = L() }); var I = !1; var _ = []; var w = { config: function(e) { B('config', v = e); var t = !1 !== v.check; O(function() { if (t)M(c.config, { verifyJsApiList: C(v.jsApiList), verifyOpenTagList: C(v.openTagList) }, (function() { S._complete = function(e) { g.preVerifyEndTime = L(), y.state = 1, y.data = e }, S.success = function(e) { h.isPreVerifyOk = 0 }, S.fail = function(e) { S._fail ? S._fail(e) : y.state = -1 }; var t = S._completes; return t.push(function() { !(function() { if (!(d || u || v.debug || m < '6.0.2' || h.systemType < 0)) { var i = new Image(); h.appId = v.appId, h.initTime = g.initEndTime - g.initStartTime, h.preVerifyTime = g.preVerifyEndTime - g.preVerifyStartTime, w.getNetworkType({ isInnerInvoke: !0, success: function(e) { h.networkType = e.networkType; var n = 'https://open.weixin.qq.com/sdk/report?v=' + h.version + '&o=' + h.isPreVerifyOk + '&s=' + h.systemType + '&c=' + h.clientVersion + '&a=' + h.appId + '&n=' + h.networkType + '&i=' + h.initTime + '&p=' + h.preVerifyTime + '&u=' + h.url; i.src = n } }) } }()) }), S.complete = function(e) { for (var n = 0, i = t.length; n < i; ++n)t[n](); S._completes = [] }, S }())), g.preVerifyStartTime = L(); else { y.state = 1; for (var e = S._completes, n = 0, i = e.length; n < i; ++n)e[n](); S._completes = [] } }), w.invoke || (w.invoke = function(e, n, i) { o.WeixinJSBridge && WeixinJSBridge.invoke(e, x(n), i) }, w.on = function(e, n) { o.WeixinJSBridge && WeixinJSBridge.on(e, n) }) }, ready: function(e) { y.state != 0 ? e() : (S._completes.push(e), !l && v.debug && e()) }, error: function(e) { m < '6.0.2' || (y.state == -1 ? e(y.data) : S._fail = e) }, checkJsApi: function(e) { M('checkJsApi', { jsApiList: C(e.jsApiList) }, (e._complete = function(e) { if (p) { var n = e.checkResult; n && (e.checkResult = JSON.parse(n)) }e = (function(e) { var n = e.checkResult; for (var i in n) { var t = a[i]; t && (n[t] = n[i], delete n[i]) } return e }(e)) }, e)) }, onMenuShareTimeline: function(e) { P(c.onMenuShareTimeline, { complete: function() { M('shareTimeline', { title: e.title || t, desc: e.title || t, img_url: e.imgUrl || '', link: e.link || location.href, type: e.type || 'link', data_url: e.dataUrl || '' }, e) } }, e) }, onMenuShareAppMessage: function(n) { P(c.onMenuShareAppMessage, { complete: function(e) { e.scene === 'favorite' ? M('sendAppMessage', { title: n.title || t, desc: n.desc || '', link: n.link || location.href, img_url: n.imgUrl || '', type: n.type || 'link', data_url: n.dataUrl || '' }) : M('sendAppMessage', { title: n.title || t, desc: n.desc || '', link: n.link || location.href, img_url: n.imgUrl || '', type: n.type || 'link', data_url: n.dataUrl || '' }, n) } }, n) }, onMenuShareQQ: function(e) { P(c.onMenuShareQQ, { complete: function() { M('shareQQ', { title: e.title || t, desc: e.desc || '', img_url: e.imgUrl || '', link: e.link || location.href }, e) } }, e) }, onMenuShareWeibo: function(e) { P(c.onMenuShareWeibo, { complete: function() { M('shareWeiboApp', { title: e.title || t, desc: e.desc || '', img_url: e.imgUrl || '', link: e.link || location.href }, e) } }, e) }, onMenuShareQZone: function(e) { P(c.onMenuShareQZone, { complete: function() { M('shareQZone', { title: e.title || t, desc: e.desc || '', img_url: e.imgUrl || '', link: e.link || location.href }, e) } }, e) }, updateTimelineShareData: function(e) { M('updateTimelineShareData', { title: e.title, link: e.link, imgUrl: e.imgUrl }, e) }, updateAppMessageShareData: function(e) { M('updateAppMessageShareData', { title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl }, e) }, startRecord: function(e) { M('startRecord', {}, e) }, stopRecord: function(e) { M('stopRecord', {}, e) }, onVoiceRecordEnd: function(e) { P('onVoiceRecordEnd', e) }, playVoice: function(e) { M('playVoice', { localId: e.localId }, e) }, pauseVoice: function(e) { M('pauseVoice', { localId: e.localId }, e) }, stopVoice: function(e) { M('stopVoice', { localId: e.localId }, e) }, onVoicePlayEnd: function(e) { P('onVoicePlayEnd', e) }, uploadVoice: function(e) { M('uploadVoice', { localId: e.localId, isShowProgressTips: e.isShowProgressTips == 0 ? 0 : 1 }, e) }, downloadVoice: function(e) { M('downloadVoice', { serverId: e.serverId, isShowProgressTips: e.isShowProgressTips == 0 ? 0 : 1 }, e) }, translateVoice: function(e) { M('translateVoice', { localId: e.localId, isShowProgressTips: e.isShowProgressTips == 0 ? 0 : 1 }, e) }, chooseImage: function(e) { M('chooseImage', { scene: '1|2', count: e.count || 9, sizeType: e.sizeType || ['original', 'compressed'], sourceType: e.sourceType || ['album', 'camera'] }, (e._complete = function(e) { if (p) { var n = e.localIds; try { n && (e.localIds = JSON.parse(n)) } catch (e) {} } }, e)) }, getLocation: function(e) {}, previewImage: function(e) { M(c.previewImage, { current: e.current, urls: e.urls }, e) }, uploadImage: function(e) { M('uploadImage', { localId: e.localId, isShowProgressTips: e.isShowProgressTips == 0 ? 0 : 1 }, e) }, downloadImage: function(e) { M('downloadImage', { serverId: e.serverId, isShowProgressTips: e.isShowProgressTips == 0 ? 0 : 1 }, e) }, getLocalImgData: function(e) { !1 === I ? (I = !0, M('getLocalImgData', { localId: e.localId }, (e._complete = function(e) { if (I = !1, _.length > 0) { var n = _.shift(); wx.getLocalImgData(n) } }, e))) : _.push(e) }, getNetworkType: function(e) { M('getNetworkType', {}, (e._complete = function(e) { e = (function(e) { var n = e.errMsg; e.errMsg = 'getNetworkType:ok'; var i = e.subtype; if (delete e.subtype, i)e.networkType = i; else { var t = n.indexOf(':'); var o = n.substring(t + 1); switch (o) { case 'wifi':case 'edge':case 'wwan':e.networkType = o; break; default:e.errMsg = 'getNetworkType:fail' } } return e }(e)) }, e)) }, openLocation: function(e) { M('openLocation', { latitude: e.latitude, longitude: e.longitude, name: e.name || '', address: e.address || '', scale: e.scale || 28, infoUrl: e.infoUrl || '' }, e) }, getLocation: function(e) { M(c.getLocation, { type: (e = e || {}).type || 'wgs84' }, (e._complete = function(e) { delete e.type }, e)) }, hideOptionMenu: function(e) { M('hideOptionMenu', {}, e) }, showOptionMenu: function(e) { M('showOptionMenu', {}, e) }, closeWindow: function(e) { M('closeWindow', {}, e = e || {}) }, hideMenuItems: function(e) { M('hideMenuItems', { menuList: e.menuList }, e) }, showMenuItems: function(e) { M('showMenuItems', { menuList: e.menuList }, e) }, hideAllNonBaseMenuItem: function(e) { M('hideAllNonBaseMenuItem', {}, e) }, showAllNonBaseMenuItem: function(e) { M('showAllNonBaseMenuItem', {}, e) }, scanQRCode: function(e) { M('scanQRCode', { needResult: (e = e || {}).needResult || 0, scanType: e.scanType || ['qrCode', 'barCode'] }, (e._complete = function(e) { if (f) { var n = e.resultStr; if (n) { var i = JSON.parse(n); e.resultStr = i && i.scan_code && i.scan_code.scan_result } } }, e)) }, openAddress: function(e) { M(c.openAddress, {}, (e._complete = function(e) { e = (function(e) { return e.postalCode = e.addressPostalCode, delete e.addressPostalCode, e.provinceName = e.proviceFirstStageName, delete e.proviceFirstStageName, e.cityName = e.addressCitySecondStageName, delete e.addressCitySecondStageName, e.countryName = e.addressCountiesThirdStageName, delete e.addressCountiesThirdStageName, e.detailInfo = e.addressDetailInfo, delete e.addressDetailInfo, e }(e)) }, e)) }, openProductSpecificView: function(e) { M(c.openProductSpecificView, { pid: e.productId, view_type: e.viewType || 0, ext_info: e.extInfo }, e) }, addCard: function(e) { for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) { var r = n[t]; var a = { card_id: r.cardId, card_ext: r.cardExt }; i.push(a) }M(c.addCard, { card_list: i }, (e._complete = function(e) { var n = e.card_list; if (n) { for (var i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) { var o = n[i]; o.cardId = o.card_id, o.cardExt = o.card_ext, o.isSuccess = !!o.is_succ, delete o.card_id, delete o.card_ext, delete o.is_succ }e.cardList = n, delete e.card_list } }, e)) }, chooseCard: function(e) { M('chooseCard', { app_id: v.appId, location_id: e.shopId || '', sign_type: e.signType || 'SHA1', card_id: e.cardId || '', card_type: e.cardType || '', card_sign: e.cardSign, time_stamp: e.timestamp + '', nonce_str: e.nonceStr }, (e._complete = function(e) { e.cardList = e.choose_card_info, delete e.choose_card_info }, e)) }, openCard: function(e) { for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) { var r = n[t]; var a = { card_id: r.cardId, code: r.code }; i.push(a) }M(c.openCard, { card_list: i }, e) }, consumeAndShareCard: function(e) { M(c.consumeAndShareCard, { consumedCardId: e.cardId, consumedCode: e.code }, e) }, chooseWXPay: function(e) { M(c.chooseWXPay, V(e), e) }, openEnterpriseRedPacket: function(e) { M(c.openEnterpriseRedPacket, V(e), e) }, startSearchBeacons: function(e) { M(c.startSearchBeacons, { ticket: e.ticket }, e) }, stopSearchBeacons: function(e) { M(c.stopSearchBeacons, {}, e) }, onSearchBeacons: function(e) { P(c.onSearchBeacons, e) }, openEnterpriseChat: function(e) { M('openEnterpriseChat', { useridlist: e.userIds, chatname: e.groupName }, e) }, launchMiniProgram: function(e) { M('launchMiniProgram', { targetAppId: e.targetAppId, path: (function(e) { if (typeof e === 'string' && e.length > 0) { var n = e.split('?')[0]; var i = e.split('?')[1]; return n += '.html', void 0 !== i ? n + '?' + i : n } }(e.path)), envVersion: e.envVersion }, e) }, openBusinessView: function(e) { M('openBusinessView', { businessType: e.businessType, queryString: e.queryString || '', envVersion: e.envVersion }, (e._complete = function(n) { if (p) { var e = n.extraData; if (e) try { n.extraData = JSON.parse(e) } catch (e) { n.extraData = {} } } }, e)) }, miniProgram: { navigateBack: function(e) { e = e || {}, O(function() { M('invokeMiniProgramAPI', { name: 'navigateBack', arg: { delta: e.delta || 1 } }, e) }) }, navigateTo: function(e) { O(function() { M('invokeMiniProgramAPI', { name: 'navigateTo', arg: { url: e.url } }, e) }) }, redirectTo: function(e) { O(function() { M('invokeMiniProgramAPI', { name: 'redirectTo', arg: { url: e.url } }, e) }) }, switchTab: function(e) { O(function() { M('invokeMiniProgramAPI', { name: 'switchTab', arg: { url: e.url } }, e) }) }, reLaunch: function(e) { O(function() { M('invokeMiniProgramAPI', { name: 'reLaunch', arg: { url: e.url } }, e) }) }, postMessage: function(e) { O(function() { M('invokeMiniProgramAPI', { name: 'postMessage', arg: e.data || {} }, e) }) }, getEnv: function(e) { O(function() { e({ miniprogram: o.__wxjs_environment === 'miniprogram' }) }) } } }; var T = 1; var k = {}; return i.addEventListener('error', function(e) { if (!p) { var n = e.target; var i = n.tagName; var t = n.src; if (i == 'IMG' || i == 'VIDEO' || i == 'AUDIO' || i == 'SOURCE') if (t.indexOf('wxlocalresource://') != -1) { e.preventDefault(), e.stopPropagation(); var o = n['wx-id']; if (o || (o = T++, n['wx-id'] = o), k[o]) return; k[o] = !0, wx.ready(function() { wx.getLocalImgData({ localId: t, success: function(e) { n.src = e.localData } }) }) } } }, !0), i.addEventListener('load', function(e) { if (!p) { var n = e.target; var i = n.tagName; n.src; if (i == 'IMG' || i == 'VIDEO' || i == 'AUDIO' || i == 'SOURCE') { var t = n['wx-id']; t && (k[t] = !1) } } }, !0), e && (o.wx = o.jWeixin = w), w } function M(n, e, i) { o.WeixinJSBridge ? WeixinJSBridge.invoke(n, x(e), function(e) { A(n, e, i) }) : B(n, i) } function P(n, i, t) { o.WeixinJSBridge ? WeixinJSBridge.on(n, function(e) { t && t.trigger && t.trigger(e), A(n, e, i) }) : B(n, t || i) } function x(e) { return (e = e || {}).appId = v.appId, e.verifyAppId = v.appId, e.verifySignType = 'sha1', e.verifyTimestamp = v.timestamp + '', e.verifyNonceStr = v.nonceStr, e.verifySignature = v.signature, e } function V(e) { return { timeStamp: e.timestamp + '', nonceStr: e.nonceStr, package: e.package, paySign: e.paySign, signType: e.signType || 'SHA1' } } function A(e, n, i) { e != 'openEnterpriseChat' && e !== 'openBusinessView' || (n.errCode = n.err_code), delete n.err_code, delete n.err_desc, delete n.err_detail; var t = n.errMsg; t || (t = n.err_msg, delete n.err_msg, t = (function(e, n) { var i = e; var t = a[i]; t && (i = t); var o = 'ok'; if (n) { var r = n.indexOf(':'); (o = n.substring(r + 1)) == 'confirm' && (o = 'ok'), o == 'failed' && (o = 'fail'), o.indexOf('failed_') != -1 && (o = o.substring(7)), o.indexOf('fail_') != -1 && (o = o.substring(5)), (o = (o = o.replace(/_/g, ' ')).toLowerCase()) != 'access denied' && o != 'no permission to execute' || (o = 'permission denied'), i == 'config' && o == 'function not exist' && (o = 'ok'), o == '' && (o = 'fail') } return n = i + ':' + o }(e, t)), n.errMsg = t), (i = i || {})._complete && (i._complete(n), delete i._complete), t = n.errMsg || '', v.debug && !i.isInnerInvoke && alert(JSON.stringify(n)); var o = t.indexOf(':'); switch (t.substring(o + 1)) { case 'ok':i.success && i.success(n); break; case 'cancel':i.cancel && i.cancel(n); break; default:i.fail && i.fail(n) }i.complete && i.complete(n) } function C(e) { if (e) { for (var n = 0, i = e.length; n < i; ++n) { var t = e[n]; var o = c[t]; o && (e[n] = o) } return e } } function B(e, n) { if (!(!v.debug || n && n.isInnerInvoke)) { var i = a[e]; i && (e = i), n && n._complete && delete n._complete, console.log('"' + e + '",', n || '') } } function L() { return (new Date()).getTime() } function O(e) { l && (o.WeixinJSBridge ? e() : i.addEventListener && i.addEventListener('WeixinJSBridgeReady', e, !1)) } }))
  1 +{
  2 + "_from": "jweixin-1.6.0",
  3 + "_id": "jweixin-1.6.0@1.0.0",
  4 + "_inBundle": false,
  5 + "_integrity": "sha512-QH69Y/j4h8p9dy6wqIplXmhjLy67AGJswvrjwWUD84HUdB22QyHaX1PmV7oJFbsYL+Vn9Qe1uIx/2NFKkD51Bg==",
  6 + "_location": "/jweixin-1.6.0",
  7 + "_phantomChildren": {},
  8 + "_requested": {
  9 + "type": "tag",
  10 + "registry": true,
  11 + "raw": "jweixin-1.6.0",
  12 + "name": "jweixin-1.6.0",
  13 + "escapedName": "jweixin-1.6.0",
  14 + "rawSpec": "",
  15 + "saveSpec": null,
  16 + "fetchSpec": "latest"
  17 + },
  18 + "_requiredBy": [
  19 + "#USER",
  20 + "/"
  21 + ],
  22 + "_resolved": "https://registry.npmjs.org/jweixin-1.6.0/-/jweixin-1.6.0-1.0.0.tgz",
  23 + "_shasum": "d65ec53e738a95b5c54cd5f42a3f34f0e82e29d5",
  24 + "_spec": "jweixin-1.6.0",
  25 + "_where": "F:\\minigroup\\Bitcoin",
  26 + "author": {
  27 + "name": "luquan基于微信官方jdk"
  28 + },
  29 + "bugs": {
  30 + "url": "https://github.com/luquan22/jweixin-js-sdk/issues"
  31 + },
  32 + "bundleDependencies": false,
  33 + "deprecated": false,
  34 + "description": "基于官方1.6.0制作",
  35 + "homepage": "https://github.com/luquan22/jweixin-js-sdk#readme",
  36 + "keywords": [
  37 + "jweixin"
  38 + ],
  39 + "license": "ISC",
  40 + "main": "index.js",
  41 + "name": "jweixin-1.6.0",
  42 + "repository": {
  43 + "type": "git",
  44 + "url": "git+https://github.com/luquan22/jweixin-js-sdk.git"
  45 + },
  46 + "scripts": {
  47 + "test": "echo \"Error: no test specified\" && exit 1"
  48 + },
  49 + "version": "1.0.0"
  50 +}
@@ -2,6 +2,11 @@ @@ -2,6 +2,11 @@
2 "requires": true, 2 "requires": true,
3 "lockfileVersion": 1, 3 "lockfileVersion": 1,
4 "dependencies": { 4 "dependencies": {
  5 + "jweixin-1.6.0": {
  6 + "version": "1.0.0",
  7 + "resolved": "https://registry.npmjs.org/jweixin-1.6.0/-/jweixin-1.6.0-1.0.0.tgz",
  8 + "integrity": "sha512-QH69Y/j4h8p9dy6wqIplXmhjLy67AGJswvrjwWUD84HUdB22QyHaX1PmV7oJFbsYL+Vn9Qe1uIx/2NFKkD51Bg=="
  9 + },
5 "jweixin-module": { 10 "jweixin-module": {
6 "version": "1.6.0", 11 "version": "1.6.0",
7 "resolved": "https://registry.npmmirror.com/jweixin-module/-/jweixin-module-1.6.0.tgz", 12 "resolved": "https://registry.npmmirror.com/jweixin-module/-/jweixin-module-1.6.0.tgz",
@@ -48,6 +48,8 @@ @@ -48,6 +48,8 @@
48 }, 48 },
49 onLoad() { 49 onLoad() {
50 this.sort_all() 50 this.sort_all()
  51 + let URL=window.location.href
  52 + this.$wxH5Share.get_jssdk("分类",URL)
51 }, 53 },
52 methods: { 54 methods: {
53 //返回 55 //返回
@@ -8,7 +8,8 @@ @@ -8,7 +8,8 @@
8 </view> 8 </view>
9 <image src="../../static/ic_fenxiang.png" mode="" @click="shareModel=true"></image> 9 <image src="../../static/ic_fenxiang.png" mode="" @click="shareModel=true"></image>
10 </view> 10 </view>
11 - <rich-text :nodes="detail.content"></rich-text> 11 + <mp-html :content="detail.content" />
  12 + <!-- <rich-text :nodes="detail.content"></rich-text> -->
12 </view> 13 </view>
13 <view class="share" v-if="shareModel" @click="shareModel=false"> 14 <view class="share" v-if="shareModel" @click="shareModel=false">
14 <image src="/static/detailShare.png" mode=""></image> 15 <image src="/static/detailShare.png" mode=""></image>
@@ -23,8 +24,9 @@ @@ -23,8 +24,9 @@
23 import { 24 import {
24 arc_detail 25 arc_detail
25 } from '@/api/index.js' 26 } from '@/api/index.js'
26 - var jweixin = require('jweixin-module');  
27 - console.log(jweixin, "000") 27 + // import wx from 'jweixin-1.6.0'
  28 + // var jweixin = require('jweixin-module');
  29 + // console.log(jweixin, "000")
28 export default { 30 export default {
29 data() { 31 data() {
30 return { 32 return {
@@ -36,16 +38,26 @@ @@ -36,16 +38,26 @@
36 }, 38 },
37 shareModel: false, 39 shareModel: false,
38 Images: "http://yuanjie.n.broing.cn/assets/img/share_logo.jpg", 40 Images: "http://yuanjie.n.broing.cn/assets/img/share_logo.jpg",
39 - jssdk:{}, 41 + jssdk: {},
40 } 42 }
41 }, 43 },
  44 +
42 onLoad(options) { 45 onLoad(options) {
43 this.id = options.id 46 this.id = options.id
44 let title = uni.getStorageSync("deltitle") 47 let title = uni.getStorageSync("deltitle")
45 uni.setNavigationBarTitle({ 48 uni.setNavigationBarTitle({
46 title: title //这是修改后的导航栏文字 49 title: title //这是修改后的导航栏文字
47 }) 50 })
  51 + let URL=window.location.href
  52 + this.$wxH5Share.get_jssdk(title,URL)
48 this.arc_detail() 53 this.arc_detail()
  54 + // console.log(!(uni.getSystemInfoSync().platform == 'android'))
  55 + // if (!(uni.getSystemInfoSync().platform == 'android')) {
  56 + // if (location.href.indexOf("#reloaded") == -1) {
  57 + // location.href = location.href + "#reloaded";
  58 + // location.reload();
  59 + // }
  60 + // }
49 }, 61 },
50 onUnload() { 62 onUnload() {
51 uni.removeStorageSync("deltitle") 63 uni.removeStorageSync("deltitle")
@@ -55,9 +67,10 @@ @@ -55,9 +67,10 @@
55 async arc_detail() { 67 async arc_detail() {
56 try { 68 try {
57 const res = await arc_detail(this.id, window.location.href) 69 const res = await arc_detail(this.id, window.location.href)
  70 +
58 this.detail = res.detail 71 this.detail = res.detail
59 this.jssdk = res.jssdk 72 this.jssdk = res.jssdk
60 - this.share() 73 + // this.share()
61 console.log('arc_detail', res) 74 console.log('arc_detail', res)
62 // 保存数据 75 // 保存数据
63 } catch (err) { 76 } catch (err) {
@@ -68,83 +81,6 @@ @@ -68,83 +81,6 @@
68 console.log('arc_detail', err) 81 console.log('arc_detail', err)
69 } 82 }
70 }, 83 },
71 - share() {  
72 - let that = this;  
73 - jweixin.config({  
74 - debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。  
75 - appId: that.jssdk.appId, // 必填,公众号的唯一标识  
76 - timestamp: that.jssdk.timestamp, // 必填,生成签名的时间戳  
77 - nonceStr: that.jssdk.nonceStr, // 必填,生成签名的随机串  
78 - signature: that.jssdk.signature, // 必填,签名  
79 - jsApiList: that.jssdk.jsApiList // 必填,需要使用的JS接口列表  
80 - })  
81 - jweixin.error(function(res) {  
82 - console.log(res, '错误')  
83 - });  
84 - console.log('分享了', that.jssdk.signature);  
85 - jweixin.ready(function() {  
86 -  
87 - //分享给朋友  
88 - jweixin.onMenuShareAppMessage({  
89 - title: that.detail.title, // 分享标题  
90 - link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致  
91 - desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",  
92 - imgUrl: that.Images, // 分享图标  
93 - success: function() {  
94 - // 用户点击了分享后执行的回调函数  
95 - uni.showToast({  
96 - title: '分享成功',  
97 - duration: 2000  
98 - });  
99 - },  
100 - cancel: function(res) {  
101 - console.log('取消分享')  
102 - }  
103 - });  
104 - jweixin.updateAppMessageShareData({  
105 - title: that.detail.title, // 分享标题  
106 - link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致  
107 - desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",  
108 - imgUrl: that.Images, // 分享图标  
109 - success: function() {  
110 - console.log('设置分享给朋友成功')  
111 - },  
112 - cancel: function(res) {  
113 - console.log('取消分享')  
114 - }  
115 - });  
116 - //分享到朋友圈  
117 - jweixin.onMenuShareTimeline({  
118 - title: that.detail.title, // 分享标题  
119 - link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致  
120 - desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",  
121 - imgUrl: that.Images, // 分享图标  
122 - success: function() {  
123 - // 用户点击了分享后执行的回调函数  
124 - uni.showToast({  
125 - title: '分享成功',  
126 - duration: 2000  
127 - });  
128 - },  
129 - cancel: function(res) {  
130 - console.log('取消分享')  
131 - }  
132 - });  
133 - jweixin.updateTimelineShareData({  
134 - title: that.detail.title, // 分享标题  
135 - link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致  
136 - desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",  
137 - imgUrl: that.Images, // 分享图标  
138 - success: function() {  
139 - console.log('设置分享到朋友圈成功')  
140 - },  
141 - cancel: function(res) {  
142 - console.log('取消分享')  
143 - }  
144 - });  
145 - });  
146 - },  
147 -  
148 } 84 }
149 } 85 }
150 </script> 86 </script>
1 -<template>  
2 - <view class="Detail">  
3 - <view class="topbg">  
4 - <view class="bgimage">  
5 - <u-swiper :list="list1" @change="change" @click="onclick" :height="375"></u-swiper>  
6 - </view>  
7 - <view class="topmain">  
8 - <view class="toptitle">  
9 - <view class="money">  
10 - <text>¥</text>{{detail.price}}  
11 - </view>  
12 - <view class="topgroup">  
13 - <image src="../../static/heart.png" mode="" v-if="detail.is_fav==0" @click="product_favorite">  
14 - </image>  
15 - <image src="../../static/1.png" mode="" v-else @click="product_favorite"></image>  
16 - <image src="../../static/share.png" @click="shareModel=true" mode=""></image>  
17 - <image src="../../static/result.png" mode="" @click="show = true"></image>  
18 - </view>  
19 - </view>  
20 - <view class="topcommit">  
21 - {{detail.name}}  
22 - </view>  
23 - <view class="toptype">  
24 - <view class="type">  
25 - 所属分类:{{detail.sort.name}}  
26 - </view>  
27 - <view class="time">  
28 - 发布于:{{detail.publishtime}}  
29 - </view>  
30 - </view>  
31 - </view>  
32 - </view>  
33 - <view class="mainmiss">  
34 - <view class="misstop">  
35 - <view class="tip">  
36 -  
37 - </view>  
38 - <text>卖家信息</text>  
39 - </view>  
40 - <view class="missbar flexA">  
41 - <view class="name">  
42 - 姓名  
43 - </view>  
44 - <view class="namelast">  
45 - {{detail.seller_name}}  
46 - </view>  
47 - </view>  
48 - <view class="missbar flexA">  
49 - <view class="name">  
50 - 联系电话:  
51 - </view>  
52 - <view class="namelast">  
53 - {{detail.seller_mobile}} 1 +<template>
  2 + <view class="Detail">
  3 + <view class="topbg">
  4 + <view class="bgimage">
  5 + <u-swiper :list="list1" @change="change" @click="onclick" :height="375"></u-swiper>
  6 + </view>
  7 + <view class="topmain">
  8 + <view class="toptitle">
  9 + <view class="money">
  10 + <text>¥</text>{{detail.price}}
  11 + </view>
  12 + <view class="topgroup">
  13 + <image src="../../static/heart.png" mode="" v-if="detail.is_fav==0" @click="product_favorite">
  14 + </image>
  15 + <image src="../../static/1.png" mode="" v-else @click="product_favorite"></image>
  16 + <image src="../../static/share.png" @click="shareModel=true" mode=""></image>
  17 + <image src="../../static/result.png" mode="" @click="show = true"></image>
  18 + </view>
  19 + </view>
  20 + <view class="topcommit">
  21 + {{detail.name}}
  22 + </view>
  23 + <view class="toptype">
  24 + <view class="type">
  25 + 所属分类:{{detail.sort.name}}
  26 + </view>
  27 + <view class="time">
  28 + 发布于:{{detail.publishtime}}
  29 + </view>
  30 + </view>
  31 + </view>
  32 + </view>
  33 + <view class="mainmiss">
  34 + <view class="misstop">
  35 + <view class="tip">
  36 +
  37 + </view>
  38 + <text>卖家信息</text>
  39 + </view>
  40 + <view class="missbar flexA">
  41 + <view class="name">
  42 + 姓名
  43 + </view>
  44 + <view class="namelast">
  45 + {{detail.seller_name}}
  46 + </view>
  47 + </view>
  48 + <view class="missbar flexA">
  49 + <view class="name">
  50 + 联系电话:
  51 + </view>
  52 + <view class="namelast">
  53 + {{detail.seller_mobile}}
54 </view> 54 </view>
55 <view style=" margin-left:8rpx; font-size: 26rpx; color: deepskyblue;" v-if="detail.seller_mobile"> 55 <view style=" margin-left:8rpx; font-size: 26rpx; color: deepskyblue;" v-if="detail.seller_mobile">
56 - <a :href="'tel:' + detail.seller_mobile" >拨号</a>  
57 - </view>  
58 - </view>  
59 - <view class="missbar flexA" >  
60 - <view class="name">  
61 - 钱包地址:  
62 - </view>  
63 - <view class="namelast">  
64 - {{detail.package_add}} 56 + <a :href="'tel:' + detail.seller_mobile">拨号</a>
65 </view> 57 </view>
66 - <view @click="copy(detail.package_add)" style=" margin-left:8rpx; font-size: 26rpx; color: deepskyblue;"> 58 + </view>
  59 + <view class="missbar flexA">
  60 + <view class="name">
  61 + 钱包地址:
  62 + </view>
  63 + <view class="namelast">
  64 + {{detail.package_add}}
  65 + </view>
  66 + <view @click="copy(detail.package_add)"
  67 + style=" margin-left:8rpx; font-size: 26rpx; color: deepskyblue;">
67 复制 68 复制
68 - </view>  
69 - </view>  
70 - <view class="missbar flexA">  
71 - <view class="name">  
72 - 微信号:  
73 - </view>  
74 - <view class="namelast">  
75 - {{detail.wechat_num}} 69 + </view>
  70 + </view>
  71 + <view class="missbar flexA">
  72 + <view class="name">
  73 + 微信号:
  74 + </view>
  75 + <view class="namelast">
  76 + {{detail.wechat_num}}
76 </view> 77 </view>
77 <view @click="copy(detail.wechat_num)" style=" margin-left:8rpx; font-size: 26rpx; color: deepskyblue;"> 78 <view @click="copy(detail.wechat_num)" style=" margin-left:8rpx; font-size: 26rpx; color: deepskyblue;">
78 复制 79 复制
79 - </view>  
80 - </view>  
81 - </view>  
82 - <view class="contail">  
83 - <view class="misstop">  
84 - <view class="tip">  
85 -  
86 - </view>  
87 - <text>商品详情</text>  
88 - </view>  
89 - <view class="showcontant">  
90 - {{detail.description}}  
91 - </view>  
92 - </view>  
93 - <view class="btn">  
94 - <view class="paybtn" :class="detail.status==2?'sold':''" @click="product_buy">  
95 - {{detail.status==2?'已售出':'立即购买'}}  
96 - </view>  
97 - </view>  
98 - <!-- <u-picker :show="resurtshow" :columns="columns"></u-picker> -->  
99 - <u-popup :show="show" @close="close" @open="open" mode="center" :round="12">  
100 - <view class="popshow">  
101 - <view class="title">  
102 - 举报  
103 - </view>  
104 - <view class="showbar">  
105 - <view class="name">  
106 - 举报原因  
107 - </view>  
108 - <view class="select" @click.stop="showbox">  
109 - <text>{{isshowname}}</text>  
110 -  
111 - <image src="../../static/ic-arrow2.png" mode=""></image>  
112 - </view>  
113 - </view>  
114 - <view class="showarear">  
115 - <view class="showtltle">  
116 - 详细描述  
117 - </view>  
118 - <view class="showcont">  
119 - <textarea name="" v-model="content" id="" cols="30" rows="10" placeholder="请输入"></textarea>  
120 - </view>  
121 - </view>  
122 - <view class="btngroup">  
123 - <view class="concle" @click="close">  
124 - 取消  
125 - </view>  
126 - <view class="requt" @click="product_report">  
127 - 提交  
128 - </view>  
129 - </view>  
130 - <view class="boxsel" v-if="isshow">  
131 - <scroll-view scroll-y="true" style="200rpx">  
132 - <view class="selbar" v-for="(item,index) in range" :key="index"  
133 - @click="choosritem(item.name,item.id)">{{item.name}} </view>  
134 - </scroll-view>  
135 - </view>  
136 - </view> 80 + </view>
  81 + </view>
  82 + </view>
  83 + <view class="contail">
  84 + <view class="misstop">
  85 + <view class="tip">
  86 +
  87 + </view>
  88 + <text>商品详情</text>
  89 + </view>
  90 + <view class="showcontant">
  91 + {{detail.description}}
  92 + </view>
  93 + </view>
  94 + <view class="btn">
  95 + <view class="paybtn" :class="detail.status==2?'sold':''" @click="product_buy">
  96 + {{detail.status==2?'已售出':'立即购买'}}
  97 + </view>
  98 + </view>
  99 + <!-- <u-picker :show="resurtshow" :columns="columns"></u-picker> -->
  100 + <u-popup :show="show" @close="close" @open="open" mode="center" :round="12">
  101 + <view class="popshow">
  102 + <view class="title">
  103 + 举报
  104 + </view>
  105 + <view class="showbar">
  106 + <view class="name">
  107 + 举报原因
  108 + </view>
  109 + <view class="select" @click.stop="showbox">
  110 + <text>{{isshowname}}</text>
  111 +
  112 + <image src="../../static/ic-arrow2.png" mode=""></image>
  113 + </view>
  114 + </view>
  115 + <view class="showarear">
  116 + <view class="showtltle">
  117 + 详细描述
  118 + </view>
  119 + <view class="showcont">
  120 + <textarea name="" v-model="content" id="" cols="30" rows="10" placeholder="请输入"></textarea>
  121 + </view>
  122 + </view>
  123 + <view class="btngroup">
  124 + <view class="concle" @click="close">
  125 + 取消
  126 + </view>
  127 + <view class="requt" @click="product_report">
  128 + 提交
  129 + </view>
  130 + </view>
  131 + <view class="boxsel" v-if="isshow">
  132 + <scroll-view scroll-y="true" style="200rpx">
  133 + <view class="selbar" v-for="(item,index) in range" :key="index"
  134 + @click="choosritem(item.name,item.id)">{{item.name}} </view>
  135 + </scroll-view>
  136 + </view>
  137 + </view>
137 </u-popup> 138 </u-popup>
138 <image class="goTop" @click="goTop" src="/static/top.png" mode=""></image> 139 <image class="goTop" @click="goTop" src="/static/top.png" mode=""></image>
139 <image class="home" @click="goHome" src="/static/home.png" mode=""></image> 140 <image class="home" @click="goHome" src="/static/home.png" mode=""></image>
@@ -142,73 +143,80 @@ @@ -142,73 +143,80 @@
142 <view class=""> 143 <view class="">
143 点击这里进行分享 144 点击这里进行分享
144 </view> 145 </view>
145 - </view>  
146 - </view>  
147 -</template>  
148 - 146 + </view>
  147 + </view>
  148 +</template>
  149 +
149 <script> 150 <script>
150 - var jweixin = require('jweixin-module');  
151 - import {  
152 - product_detail,  
153 - product_favorite,  
154 - report_list,  
155 - product_report  
156 - } from '@/api/index.js'  
157 - import {  
158 - toa  
159 - } from '@/utils/toast.js'  
160 - export default {  
161 -  
162 - data() {  
163 - return {  
164 - id: "",  
165 - String: "",  
166 - show: false,  
167 - value: 0,  
168 - detail: {  
169 - sort: {  
170 - name: ""  
171 - } 151 + var jweixin = require('jweixin-module');
  152 + import {
  153 + product_detail,
  154 + product_favorite,
  155 + report_list,
  156 + product_report
  157 + } from '@/api/index.js'
  158 + import {
  159 + toa
  160 + } from '@/utils/toast.js'
  161 + export default {
  162 +
  163 + data() {
  164 + return {
  165 + id: "",
  166 + String: "",
  167 + show: false,
  168 + value: 0,
  169 + detail: {
  170 + sort: {
  171 + name: ""
  172 + }
172 }, 173 },
173 - jssdk:{},  
174 - list1: [], //轮播图  
175 - range: [{  
176 - value: 0,  
177 - text: "篮球"  
178 - },  
179 - {  
180 - value: 1,  
181 - text: "足球"  
182 - },  
183 - {  
184 - value: 2,  
185 - text: "游泳"  
186 - },  
187 - ],  
188 - //举报弹窗  
189 - isshow: false,  
190 - isshowname: "请选择",  
191 - isid: "", 174 + jssdk: {},
  175 + list1: [], //轮播图
  176 + range: [{
  177 + value: 0,
  178 + text: "篮球"
  179 + },
  180 + {
  181 + value: 1,
  182 + text: "足球"
  183 + },
  184 + {
  185 + value: 2,
  186 + text: "游泳"
  187 + },
  188 + ],
  189 + //举报弹窗
  190 + isshow: false,
  191 + isshowname: "请选择",
  192 + isid: "",
192 content: "", 193 content: "",
193 - shareModel:false  
194 - } 194 + shareModel: false
  195 + }
195 }, 196 },
196 onShow() { 197 onShow() {
197 - 198 +
198 }, 199 },
199 - onLoad(options) {  
200 - this.id = options.id  
201 - this.product_detail() 200 + onLoad(options) {
  201 + this.id = options.id
  202 + this.product_detail()
202 this.report_list() 203 this.report_list()
203 - }, 204 + // console.log(!(uni.getSystemInfoSync().platform == 'android'))
  205 + // if (!(uni.getSystemInfoSync().platform == 'android')) {
  206 + // if (location.href.indexOf("#reloaded") == -1) {
  207 + // location.href = location.href + "#reloaded";
  208 + // location.reload();
  209 + // }
  210 + // }
  211 + },
204 methods: { 212 methods: {
205 - onclick(index){ 213 + onclick(index) {
206 uni.previewImage({ 214 uni.previewImage({
207 current: index, 215 current: index,
208 urls: this.list1, 216 urls: this.list1,
209 }); 217 });
210 }, 218 },
211 - goTop(){ 219 + goTop() {
212 uni.pageScrollTo({ 220 uni.pageScrollTo({
213 scrollTop: 0 221 scrollTop: 0
214 }); 222 });
@@ -225,502 +233,506 @@ @@ -225,502 +233,506 @@
225 } 233 }
226 }); 234 });
227 }, 235 },
228 - goHome(){ 236 + goHome() {
229 uni.reLaunch({ 237 uni.reLaunch({
230 - url:'/pages/index/index' 238 + url: '/pages/index/index'
231 }) 239 })
232 }, 240 },
233 - share(){ 241 + share() {
234 let that = this; 242 let that = this;
235 jweixin.config({ 243 jweixin.config({
236 - debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。  
237 - appId: that.jssdk.appId, // 必填,公众号的唯一标识  
238 - timestamp: that.jssdk.timestamp, // 必填,生成签名的时间戳  
239 - nonceStr: that.jssdk.nonceStr, // 必填,生成签名的随机串  
240 - signature: that.jssdk.signature, // 必填,签名  
241 - jsApiList: that.jssdk.jsApiList // 必填,需要使用的JS接口列表  
242 - })  
243 - jweixin.error(function(res) {  
244 - console.log(res, '错误')  
245 - });  
246 - console.log('分享了',that.jssdk.signature);  
247 - jweixin.ready(function() {  
248 -  
249 - //分享给朋友  
250 - jweixin.onMenuShareAppMessage({  
251 - title: that.detail.name, // 分享标题  
252 - link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致  
253 - desc:"【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",  
254 - imgUrl: that.detail.images_preview[0], // 分享图标  
255 - success: function() {  
256 - // 用户点击了分享后执行的回调函数  
257 - uni.showToast({  
258 - title: '分享成功',  
259 - duration: 2000  
260 - });  
261 - },  
262 - cancel: function(res) {  
263 - console.log('取消分享')  
264 - }  
265 - });  
266 - jweixin.updateAppMessageShareData({  
267 - title: that.detail.name, // 分享标题  
268 - link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致  
269 - desc:"【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",  
270 - imgUrl: that.detail.images_preview[0], // 分享图标  
271 - success: function() {  
272 - console.log('设置分享给朋友成功')  
273 - },  
274 - cancel: function(res) {  
275 - console.log('取消分享')  
276 - }  
277 - });  
278 - //分享到朋友圈  
279 - jweixin.onMenuShareTimeline({  
280 - title: that.detail.name, // 分享标题  
281 - link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致  
282 - desc:"【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",  
283 - imgUrl: that.detail.images_preview[0], // 分享图标  
284 - success: function() {  
285 - // 用户点击了分享后执行的回调函数  
286 - uni.showToast({  
287 - title: '分享成功',  
288 - duration: 2000  
289 - });  
290 - },  
291 - cancel: function(res) {  
292 - console.log('取消分享')  
293 - } 244 + debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  245 + appId: that.jssdk.appId, // 必填,公众号的唯一标识
  246 + timestamp: that.jssdk.timestamp, // 必填,生成签名的时间戳
  247 + nonceStr: that.jssdk.nonceStr, // 必填,生成签名的随机串
  248 + signature: that.jssdk.signature, // 必填,签名
  249 + jsApiList: that.jssdk.jsApiList // 必填,需要使用的JS接口列表
  250 + })
  251 + jweixin.error(function(res) {
  252 + console.log(res, '错误')
  253 + });
  254 + console.log('分享了', that.jssdk.signature);
  255 + jweixin.ready(function() {
  256 +
  257 + //分享给朋友
  258 + jweixin.onMenuShareAppMessage({
  259 + title: that.detail.name, // 分享标题
  260 + link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  261 + desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
  262 + imgUrl: that.detail.images_preview[0], // 分享图标
  263 + success: function() {
  264 + // 用户点击了分享后执行的回调函数
  265 + uni.showToast({
  266 + title: '分享成功',
  267 + duration: 2000
294 }); 268 });
295 - jweixin.updateTimelineShareData({  
296 - title: that.detail.name, // 分享标题  
297 - link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致  
298 - desc:"【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",  
299 - imgUrl: that.detail.images_preview[0], // 分享图标  
300 - success: function() {  
301 - console.log('设置分享到朋友圈成功')  
302 - },  
303 - cancel: function(res) {  
304 - console.log('取消分享')  
305 - } 269 + },
  270 + cancel: function(res) {
  271 + console.log('取消分享')
  272 + }
  273 + });
  274 + jweixin.updateAppMessageShareData({
  275 + title: that.detail.name, // 分享标题
  276 + link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  277 + desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
  278 + imgUrl: that.detail.images_preview[0], // 分享图标
  279 + success: function() {
  280 + console.log('设置分享给朋友成功')
  281 + },
  282 + cancel: function(res) {
  283 + console.log('取消分享')
  284 + }
  285 + });
  286 + //分享到朋友圈
  287 + jweixin.onMenuShareTimeline({
  288 + title: that.detail.name, // 分享标题
  289 + link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  290 + desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
  291 + imgUrl: that.detail.images_preview[0], // 分享图标
  292 + success: function() {
  293 + // 用户点击了分享后执行的回调函数
  294 + uni.showToast({
  295 + title: '分享成功',
  296 + duration: 2000
306 }); 297 });
  298 + },
  299 + cancel: function(res) {
  300 + console.log('取消分享')
  301 + }
  302 + });
  303 + jweixin.updateTimelineShareData({
  304 + title: that.detail.name, // 分享标题
  305 + link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  306 + desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
  307 + imgUrl: that.detail.images_preview[0], // 分享图标
  308 + success: function() {
  309 + console.log('设置分享到朋友圈成功')
  310 + },
  311 + cancel: function(res) {
  312 + console.log('取消分享')
  313 + }
  314 + });
307 }); 315 });
308 - },  
309 - showbox() {  
310 - this.isshow = !this.isshow  
311 - },  
312 - open() {},  
313 - close() {  
314 - this.show = false  
315 - },  
316 - change(e) {  
317 - // console.log("e:", e);  
318 - },  
319 - //选中效果  
320 - choosritem(name, id) {  
321 - this.isshowname = name  
322 - this.isid = id  
323 - this.isshow = false  
324 - },  
325 - // 举报原因  
326 - async report_list() {  
327 -  
328 - try {  
329 - const res = await report_list()  
330 - console.log('report_list', res)  
331 - this.range = res.list  
332 -  
333 - // 保存数据  
334 - } catch (err) {  
335 - uni.showToast({  
336 - title: err,  
337 - icon: 'none'  
338 - })  
339 - console.log('report_list', err)  
340 - }  
341 - },  
342 - // 举报  
343 - async product_report() {  
344 - if (!this.isid) return toa.toast('请选择举报原因')  
345 - if (!this.content) return toa.toast('请填写举报信息')  
346 -  
347 - let obj = {  
348 - product_id: this.id,  
349 - report_id: this.isid,  
350 - content: this.content,  
351 - }  
352 - try {  
353 - const res = await product_report(obj)  
354 - console.log('product_report', res)  
355 - toa.toast('举报成功')  
356 - this.show = false  
357 - // 保存数据  
358 - } catch (err) {  
359 - uni.showToast({  
360 - title: err,  
361 - icon: 'none'  
362 - })  
363 - console.log('product_report', err)  
364 - }  
365 - },  
366 - //收藏、取消收藏  
367 - async product_favorite() {  
368 - try {  
369 - const res = await product_favorite(this.id)  
370 - console.log('product_favorite', res)  
371 - this.product_detail()  
372 - // 保存数据  
373 - } catch (err) {  
374 - uni.showToast({  
375 - title: err,  
376 - icon: 'none'  
377 - })  
378 - console.log('product_favorite', err)  
379 - }  
380 - },  
381 - //详情 316 + },
  317 + showbox() {
  318 + this.isshow = !this.isshow
  319 + },
  320 + open() {},
  321 + close() {
  322 + this.show = false
  323 + },
  324 + change(e) {
  325 + // console.log("e:", e);
  326 + },
  327 + //选中效果
  328 + choosritem(name, id) {
  329 + this.isshowname = name
  330 + this.isid = id
  331 + this.isshow = false
  332 + },
  333 + // 举报原因
  334 + async report_list() {
  335 +
  336 + try {
  337 + const res = await report_list()
  338 + console.log('report_list', res)
  339 + this.range = res.list
  340 +
  341 + // 保存数据
  342 + } catch (err) {
  343 + uni.showToast({
  344 + title: err,
  345 + icon: 'none'
  346 + })
  347 + console.log('report_list', err)
  348 + }
  349 + },
  350 + // 举报
  351 + async product_report() {
  352 + if (!this.isid) return toa.toast('请选择举报原因')
  353 + if (!this.content) return toa.toast('请填写举报信息')
  354 +
  355 + let obj = {
  356 + product_id: this.id,
  357 + report_id: this.isid,
  358 + content: this.content,
  359 + }
  360 + try {
  361 + const res = await product_report(obj)
  362 + console.log('product_report', res)
  363 + toa.toast('举报成功')
  364 + this.show = false
  365 + // 保存数据
  366 + } catch (err) {
  367 + uni.showToast({
  368 + title: err,
  369 + icon: 'none'
  370 + })
  371 + console.log('product_report', err)
  372 + }
  373 + },
  374 + //收藏、取消收藏
  375 + async product_favorite() {
  376 + try {
  377 + const res = await product_favorite(this.id)
  378 + console.log('product_favorite', res)
  379 + this.product_detail()
  380 + // 保存数据
  381 + } catch (err) {
  382 + uni.showToast({
  383 + title: err,
  384 + icon: 'none'
  385 + })
  386 + console.log('product_favorite', err)
  387 + }
  388 + },
  389 + //详情
382 async product_detail() { 390 async product_detail() {
383 - try {  
384 - const res = await product_detail(this.id,window.location.href)  
385 - console.log('product_detail', res) 391 + try {
  392 + const res = await product_detail(this.id, window.location.href)
  393 + console.log('product_detail', res)
386 this.detail = res.detail 394 this.detail = res.detail
387 - this.jssdk = res.jssdk 395 + this.jssdk = res.jssdk
388 this.list1 = res.detail.images_preview 396 this.list1 = res.detail.images_preview
389 - this.share()  
390 - // 保存数据  
391 - } catch (err) {  
392 - uni.showToast({  
393 - title: err,  
394 - icon: 'none'  
395 - })  
396 - console.log('product_detail', err)  
397 - }  
398 - },  
399 - //下单跳转 397 + this.share()
  398 + // 保存数据
  399 + } catch (err) {
  400 + uni.showToast({
  401 + title: err,
  402 + icon: 'none'
  403 + })
  404 + console.log('product_detail', err)
  405 + }
  406 + },
  407 + //下单跳转
400 async product_buy() { 408 async product_buy() {
401 - if(this.detail.status==2) return  
402 - uni.navigateTo({  
403 - url: "/pages/index/buy?id=" + this.id  
404 - }) 409 + if (this.detail.status == 2) return
  410 + uni.navigateTo({
  411 + url: "/pages/index/buy?id=" + this.id
  412 + })
405 }, 413 },
406 -  
407 - },  
408 - }  
409 -</script>  
410 -  
411 -<style lang="scss">  
412 - page {  
413 - background-color: #f0f0f0;  
414 - }  
415 -  
416 - .Detail {  
417 - padding-bottom: 160rpx;  
418 -  
419 - .topbg {  
420 - .bgimage {  
421 - width: 750rpx;  
422 - height: 750rpx;  
423 - }  
424 -  
425 - .topmain {  
426 - padding: 32rpx;  
427 - background-color: #ffffff;  
428 -  
429 - .toptitle {  
430 - display: flex;  
431 - align-items: center;  
432 - justify-content: space-between;  
433 -  
434 - .money {  
435 - font-size: 52rpx;  
436 - font-weight: 500;  
437 - font-family: "PingFang SC";  
438 - color: rgba(248, 83, 23, 1);  
439 -  
440 - text {  
441 - color: rgba(248, 83, 23, 1);  
442 - font-size: 32rpx;  
443 - font-weight: 500;  
444 - font-family: "PingFang SC";  
445 - }  
446 - }  
447 -  
448 - .topgroup {  
449 - display: flex;  
450 - align-items: center;  
451 -  
452 - image {  
453 - margin-right: 32rpx;  
454 - width: 40rpx;  
455 - height: 40rpx;  
456 - }  
457 - }  
458 - }  
459 -  
460 - .topcommit {  
461 - margin-top: 16rpx;  
462 - color: rgba(0, 0, 0, 1);  
463 - font-size: 36rpx;  
464 - font-weight: 600;  
465 - font-family: "PingFang SC";  
466 - text-align: left;  
467 - }  
468 -  
469 - .toptype {  
470 - margin-top: 24rpx;  
471 - display: flex;  
472 - align-items: center;  
473 - color: rgba(0, 0, 0, 0.4);  
474 - font-size: 26rpx;  
475 - font-weight: 400;  
476 - font-family: "PingFang SC";  
477 - justify-content: space-between;  
478 - }  
479 - }  
480 - }  
481 -  
482 - .mainmiss {  
483 - margin-top: 24rpx;  
484 - background-color: #ffffff;  
485 - border-radius: 24rpx;  
486 - padding: 32rpx;  
487 - box-sizing: border-box;  
488 -  
489 - .misstop {  
490 - display: flex;  
491 - align-items: center;  
492 - color: rgba(0, 0, 0, 0.9);  
493 - font-size: 32rpx;  
494 - font-weight: 600;  
495 - font-family: "PingFang SC";  
496 -  
497 - .tip {  
498 - margin-right: 8rpx;  
499 - width: 4rpx;  
500 - height: 24rpx;  
501 - border-radius: 18rpx;  
502 - opacity: 1;  
503 - background: rgba(254, 208, 0, 1);  
504 - }  
505 - }  
506 -  
507 - .showcontant {  
508 - margin-top: 24rpx;  
509 - color: rgba(0, 0, 0, 0.4);  
510 - font-size: 24rpx;  
511 - font-weight: 400; 414 +
  415 + },
  416 + }
  417 +</script>
  418 +
  419 +<style lang="scss">
  420 + page {
  421 + background-color: #f0f0f0;
  422 + }
  423 +
  424 + .Detail {
  425 + padding-bottom: 160rpx;
  426 +
  427 + .topbg {
  428 + .bgimage {
  429 + width: 750rpx;
  430 + height: 750rpx;
  431 + }
  432 +
  433 + .topmain {
  434 + padding: 32rpx;
  435 + background-color: #ffffff;
  436 +
  437 + .toptitle {
  438 + display: flex;
  439 + align-items: center;
  440 + justify-content: space-between;
  441 +
  442 + .money {
  443 + font-size: 52rpx;
  444 + font-weight: 500;
  445 + font-family: "PingFang SC";
  446 + color: rgba(248, 83, 23, 1);
  447 +
  448 + text {
  449 + color: rgba(248, 83, 23, 1);
  450 + font-size: 32rpx;
  451 + font-weight: 500;
  452 + font-family: "PingFang SC";
  453 + }
  454 + }
  455 +
  456 + .topgroup {
  457 + display: flex;
  458 + align-items: center;
  459 +
  460 + image {
  461 + margin-right: 32rpx;
  462 + width: 40rpx;
  463 + height: 40rpx;
  464 + }
  465 + }
  466 + }
  467 +
  468 + .topcommit {
  469 + margin-top: 16rpx;
  470 + color: rgba(0, 0, 0, 1);
  471 + font-size: 36rpx;
  472 + font-weight: 600;
  473 + font-family: "PingFang SC";
  474 + text-align: left;
  475 + }
  476 +
  477 + .toptype {
  478 + margin-top: 24rpx;
  479 + display: flex;
  480 + align-items: center;
  481 + color: rgba(0, 0, 0, 0.4);
  482 + font-size: 26rpx;
  483 + font-weight: 400;
  484 + font-family: "PingFang SC";
  485 + justify-content: space-between;
  486 + }
  487 + }
  488 + }
  489 +
  490 + .mainmiss {
  491 + margin-top: 24rpx;
  492 + background-color: #ffffff;
  493 + border-radius: 24rpx;
  494 + padding: 32rpx;
  495 + box-sizing: border-box;
  496 +
  497 + .misstop {
  498 + display: flex;
  499 + align-items: center;
  500 + color: rgba(0, 0, 0, 0.9);
  501 + font-size: 32rpx;
  502 + font-weight: 600;
512 font-family: "PingFang SC"; 503 font-family: "PingFang SC";
513 - }  
514 -  
515 - .missbar {  
516 - margin-top: 24rpx;  
517 -  
518 - .name {  
519 - color: rgba(0, 0, 0, 0.6);  
520 - font-size: 28rpx;  
521 - font-weight: 400;  
522 - font-family: "PingFang SC";  
523 - width: 168rpx;  
524 - }  
525 - 504 +
  505 + .tip {
  506 + margin-right: 8rpx;
  507 + width: 4rpx;
  508 + height: 24rpx;
  509 + border-radius: 18rpx;
  510 + opacity: 1;
  511 + background: rgba(254, 208, 0, 1);
  512 + }
  513 + }
  514 +
  515 + .showcontant {
  516 + margin-top: 24rpx;
  517 + color: rgba(0, 0, 0, 0.4);
  518 + font-size: 24rpx;
  519 + font-weight: 400;
  520 + font-family: "PingFang SC";
  521 + }
  522 +
  523 + .missbar {
  524 + margin-top: 24rpx;
  525 +
  526 + .name {
  527 + color: rgba(0, 0, 0, 0.6);
  528 + font-size: 28rpx;
  529 + font-weight: 400;
  530 + font-family: "PingFang SC";
  531 + width: 168rpx;
  532 + }
  533 +
526 .namelast { 534 .namelast {
527 width: 420rpx; 535 width: 420rpx;
528 - word-break: break-all;  
529 - color: rgba(0, 0, 0, 1);  
530 - font-size: 28rpx;  
531 - font-weight: 400;  
532 - font-family: "PingFang SC"; 536 + word-break: break-all;
  537 + color: rgba(0, 0, 0, 1);
  538 + font-size: 28rpx;
  539 + font-weight: 400;
  540 + font-family: "PingFang SC";
533 } 541 }
534 - a{ 542 +
  543 + a {
535 text-decoration: none; 544 text-decoration: none;
536 color: deepskyblue; 545 color: deepskyblue;
537 - }  
538 - }  
539 - }  
540 -  
541 - .contail {  
542 - margin-top: 24rpx;  
543 - background-color: #ffffff;  
544 - border-radius: 24rpx;  
545 - padding: 32rpx;  
546 - box-sizing: border-box;  
547 - white-space: pre-wrap;  
548 - .misstop {  
549 - display: flex;  
550 - align-items: center;  
551 - color: rgba(0, 0, 0, 0.9);  
552 - font-size: 32rpx;  
553 - font-weight: 600;  
554 - font-family: "PingFang SC";  
555 -  
556 - .tip {  
557 - margin-right: 8rpx;  
558 - width: 4rpx;  
559 - height: 24rpx;  
560 - border-radius: 18rpx;  
561 - opacity: 1;  
562 - background: rgba(254, 208, 0, 1);  
563 - }  
564 - }  
565 -  
566 - }  
567 -  
568 - .btn {  
569 - position: fixed;  
570 - bottom: 0;  
571 - left: 0;  
572 - width: 100%;  
573 - height: 128rpx;  
574 - padding: 16rpx 32rpx;  
575 - box-sizing: border-box;  
576 - opacity: 1;  
577 - background: rgba(255, 255, 255, 1);  
578 -  
579 - .paybtn {  
580 - width: 100%;  
581 - height: 96rpx;  
582 - line-height: 96rpx;  
583 - text-align: center;  
584 - border-radius: 28rpx;  
585 - opacity: 1;  
586 - color: rgba(0, 0, 0, 0.9);  
587 - font-size: 32rpx;  
588 - font-weight: 600;  
589 - font-family: "PingFang SC";  
590 - background: linear-gradient(134.8deg, rgba(255, 232, 100, 1) 0%, rgba(255, 216, 0, 1) 100%);  
591 - }  
592 - }  
593 -  
594 - .popshow {  
595 - border-radius: 32rpx;  
596 - width: 622rpx;  
597 - padding: 48rpx;  
598 - box-sizing: border-box;  
599 -  
600 - .title {  
601 - color: rgba(0, 0, 0, 1);  
602 - font-size: 28rpx;  
603 - font-weight: 600;  
604 - font-family: "PingFang SC";  
605 - text-align: center;  
606 - }  
607 -  
608 - .showbar {  
609 - padding: 24rpx 0;  
610 - display: flex;  
611 - align-items: center;  
612 - justify-content: space-between;  
613 - box-sizing: border-box;  
614 - border-bottom: 1px solid #f0f0f0;  
615 - color: rgba(0, 0, 0, 0.9);  
616 - font-size: 28rpx;  
617 - font-weight: 400;  
618 -  
619 - .name {  
620 -  
621 - font-family: "PingFang SC";  
622 - }  
623 -  
624 - .select {  
625 - display: flex;  
626 - align-items: center;  
627 -  
628 - image {  
629 - width: 24rpx;  
630 - height: 16rpx;  
631 - }  
632 - }  
633 -  
634 - }  
635 -  
636 - .showarear {  
637 - text-align: left;  
638 -  
639 - .showtltle {  
640 - margin-top: 32rpx;  
641 - color: rgba(0, 0, 0, 1);  
642 - font-size: 28rpx;  
643 - font-weight: 400;  
644 - font-family: "PingFang SC";  
645 - }  
646 -  
647 - .showcont {  
648 - color: rgba(0, 0, 0, 0.4);  
649 - font-size: 24rpx;  
650 - font-weight: 400;  
651 - font-family: "PingFang SC";  
652 - text-align: left;  
653 - }  
654 -  
655 - textarea {  
656 - margin-top: 12rpx;  
657 - box-sizing: border-box;  
658 - padding: 24rpx;  
659 - width: 526rpx;  
660 - height: 252rpx;  
661 - border: 2rpx solid rgba(0.9407999515533447, 0.9475764036178589, 0.9599999785423279, .1);  
662 - }  
663 - }  
664 -  
665 - .btngroup {  
666 - margin-top: 80rpx;  
667 - display: flex;  
668 - align-items: center;  
669 - justify-content: space-between;  
670 -  
671 - .concle {  
672 - width: 240rpx;  
673 - height: 76rpx;  
674 - border-radius: 16rpx;  
675 - opacity: 1;  
676 - line-height: 76rpx;  
677 - color: rgba(0, 0, 0, 0.9);  
678 - font-size: 28rpx;  
679 - font-weight: 500;  
680 - font-family: "PingFang SC";  
681 - text-align: center;  
682 - background: rgba(246, 246, 246, 1);  
683 - }  
684 -  
685 - .requt {  
686 - width: 240rpx;  
687 - height: 76rpx;  
688 - color: rgba(0, 0, 0, 0.9);  
689 - font-size: 28rpx;  
690 - font-weight: 500;  
691 - font-family: "PingFang SC";  
692 - text-align: center;  
693 - line-height: 76rpx;  
694 - border-radius: 16rpx;  
695 - opacity: 1;  
696 - background: rgba(254, 208, 0, 1);  
697 - }  
698 - }  
699 -  
700 - .boxsel {  
701 - position: absolute;  
702 - top: 75px;  
703 - right: 26px;  
704 - border: 1px solid #f0f0f0;  
705 - padding: 6px;  
706 - color: rgba(0, 0, 0, 1);  
707 - font-size: 24rpx;  
708 - font-weight: 400;  
709 - background-color: #ffffff;  
710 -  
711 - .selbar {  
712 - padding: 6px;  
713 - }  
714 - }  
715 - } 546 + }
  547 + }
  548 + }
  549 +
  550 + .contail {
  551 + margin-top: 24rpx;
  552 + background-color: #ffffff;
  553 + border-radius: 24rpx;
  554 + padding: 32rpx;
  555 + box-sizing: border-box;
  556 + white-space: pre-wrap;
  557 +
  558 + .misstop {
  559 + display: flex;
  560 + align-items: center;
  561 + color: rgba(0, 0, 0, 0.9);
  562 + font-size: 32rpx;
  563 + font-weight: 600;
  564 + font-family: "PingFang SC";
  565 +
  566 + .tip {
  567 + margin-right: 8rpx;
  568 + width: 4rpx;
  569 + height: 24rpx;
  570 + border-radius: 18rpx;
  571 + opacity: 1;
  572 + background: rgba(254, 208, 0, 1);
  573 + }
  574 + }
  575 +
  576 + }
  577 +
  578 + .btn {
  579 + position: fixed;
  580 + bottom: 0;
  581 + left: 0;
  582 + width: 100%;
  583 + height: 128rpx;
  584 + padding: 16rpx 32rpx;
  585 + box-sizing: border-box;
  586 + opacity: 1;
  587 + background: rgba(255, 255, 255, 1);
  588 +
  589 + .paybtn {
  590 + width: 100%;
  591 + height: 96rpx;
  592 + line-height: 96rpx;
  593 + text-align: center;
  594 + border-radius: 28rpx;
  595 + opacity: 1;
  596 + color: rgba(0, 0, 0, 0.9);
  597 + font-size: 32rpx;
  598 + font-weight: 600;
  599 + font-family: "PingFang SC";
  600 + background: linear-gradient(134.8deg, rgba(255, 232, 100, 1) 0%, rgba(255, 216, 0, 1) 100%);
  601 + }
  602 + }
  603 +
  604 + .popshow {
  605 + border-radius: 32rpx;
  606 + width: 622rpx;
  607 + padding: 48rpx;
  608 + box-sizing: border-box;
  609 +
  610 + .title {
  611 + color: rgba(0, 0, 0, 1);
  612 + font-size: 28rpx;
  613 + font-weight: 600;
  614 + font-family: "PingFang SC";
  615 + text-align: center;
  616 + }
  617 +
  618 + .showbar {
  619 + padding: 24rpx 0;
  620 + display: flex;
  621 + align-items: center;
  622 + justify-content: space-between;
  623 + box-sizing: border-box;
  624 + border-bottom: 1px solid #f0f0f0;
  625 + color: rgba(0, 0, 0, 0.9);
  626 + font-size: 28rpx;
  627 + font-weight: 400;
  628 +
  629 + .name {
  630 +
  631 + font-family: "PingFang SC";
  632 + }
  633 +
  634 + .select {
  635 + display: flex;
  636 + align-items: center;
  637 +
  638 + image {
  639 + width: 24rpx;
  640 + height: 16rpx;
  641 + }
  642 + }
  643 +
  644 + }
  645 +
  646 + .showarear {
  647 + text-align: left;
  648 +
  649 + .showtltle {
  650 + margin-top: 32rpx;
  651 + color: rgba(0, 0, 0, 1);
  652 + font-size: 28rpx;
  653 + font-weight: 400;
  654 + font-family: "PingFang SC";
  655 + }
  656 +
  657 + .showcont {
  658 + color: rgba(0, 0, 0, 0.4);
  659 + font-size: 24rpx;
  660 + font-weight: 400;
  661 + font-family: "PingFang SC";
  662 + text-align: left;
  663 + }
  664 +
  665 + textarea {
  666 + margin-top: 12rpx;
  667 + box-sizing: border-box;
  668 + padding: 24rpx;
  669 + width: 526rpx;
  670 + height: 252rpx;
  671 + border: 2rpx solid rgba(0.9407999515533447, 0.9475764036178589, 0.9599999785423279, .1);
  672 + }
  673 + }
  674 +
  675 + .btngroup {
  676 + margin-top: 80rpx;
  677 + display: flex;
  678 + align-items: center;
  679 + justify-content: space-between;
  680 +
  681 + .concle {
  682 + width: 240rpx;
  683 + height: 76rpx;
  684 + border-radius: 16rpx;
  685 + opacity: 1;
  686 + line-height: 76rpx;
  687 + color: rgba(0, 0, 0, 0.9);
  688 + font-size: 28rpx;
  689 + font-weight: 500;
  690 + font-family: "PingFang SC";
  691 + text-align: center;
  692 + background: rgba(246, 246, 246, 1);
  693 + }
  694 +
  695 + .requt {
  696 + width: 240rpx;
  697 + height: 76rpx;
  698 + color: rgba(0, 0, 0, 0.9);
  699 + font-size: 28rpx;
  700 + font-weight: 500;
  701 + font-family: "PingFang SC";
  702 + text-align: center;
  703 + line-height: 76rpx;
  704 + border-radius: 16rpx;
  705 + opacity: 1;
  706 + background: rgba(254, 208, 0, 1);
  707 + }
  708 + }
  709 +
  710 + .boxsel {
  711 + position: absolute;
  712 + top: 75px;
  713 + right: 26px;
  714 + border: 1px solid #f0f0f0;
  715 + padding: 6px;
  716 + color: rgba(0, 0, 0, 1);
  717 + font-size: 24rpx;
  718 + font-weight: 400;
  719 + background-color: #ffffff;
  720 +
  721 + .selbar {
  722 + padding: 6px;
  723 + }
  724 + }
  725 + }
716 } 726 }
  727 +
717 .share { 728 .share {
718 position: fixed; 729 position: fixed;
719 left: 0; 730 left: 0;
720 top: 0; 731 top: 0;
721 width: 100%; 732 width: 100%;
722 height: 100%; 733 height: 100%;
723 - background: rgba(0,0,0,.6); 734 + background: rgba(0, 0, 0, .6);
  735 +
724 image { 736 image {
725 position: fixed; 737 position: fixed;
726 right: 80rpx; 738 right: 80rpx;
@@ -728,15 +740,17 @@ @@ -728,15 +740,17 @@
728 width: 188rpx; 740 width: 188rpx;
729 height: 262rpx; 741 height: 262rpx;
730 } 742 }
  743 +
731 view { 744 view {
732 position: fixed; 745 position: fixed;
733 right: 80rpx; 746 right: 80rpx;
734 top: 300rpx; 747 top: 300rpx;
735 - color: rgba(255,255,255,1);  
736 - font-size: 36rpx;  
737 - font-weight: 700; 748 + color: rgba(255, 255, 255, 1);
  749 + font-size: 36rpx;
  750 + font-weight: 700;
738 } 751 }
739 } 752 }
  753 +
740 .home { 754 .home {
741 width: 96rpx; 755 width: 96rpx;
742 height: 96rpx; 756 height: 96rpx;
@@ -744,6 +758,7 @@ @@ -744,6 +758,7 @@
744 right: 28rpx; 758 right: 28rpx;
745 bottom: 320rpx; 759 bottom: 320rpx;
746 } 760 }
  761 +
747 .goTop { 762 .goTop {
748 width: 96rpx; 763 width: 96rpx;
749 height: 96rpx; 764 height: 96rpx;
@@ -751,7 +766,8 @@ @@ -751,7 +766,8 @@
751 right: 28rpx; 766 right: 28rpx;
752 bottom: 186rpx; 767 bottom: 186rpx;
753 } 768 }
  769 +
754 .sold { 770 .sold {
755 - background: rgba(0,0,0,.2) !important;  
756 - } 771 + background: rgba(0, 0, 0, .2) !important;
  772 + }
757 </style> 773 </style>
@@ -116,6 +116,7 @@ @@ -116,6 +116,7 @@
116 } from '@/api/index' 116 } from '@/api/index'
117 import helangWaterfall from "@/uni_modules/custom-waterfalls-flow/components/custom-waterfalls-flow/custom-waterfalls-flow.vue" 117 import helangWaterfall from "@/uni_modules/custom-waterfalls-flow/components/custom-waterfalls-flow/custom-waterfalls-flow.vue"
118 import Botton from "@/components/Botton.vue" 118 import Botton from "@/components/Botton.vue"
  119 +
119 export default { 120 export default {
120 components: { 121 components: {
121 "custom-waterfalls-flow": helangWaterfall, 122 "custom-waterfalls-flow": helangWaterfall,
@@ -142,6 +143,8 @@ @@ -142,6 +143,8 @@
142 }, 143 },
143 onLoad(e) { 144 onLoad(e) {
144 this.product_list(true) 145 this.product_list(true)
  146 + let URL=window.location.href
  147 + this.$wxH5Share.get_jssdk("首页",URL)
145 }, 148 },
146 onReachBottom() { 149 onReachBottom() {
147 this.currentpage++ 150 this.currentpage++
@@ -57,6 +57,8 @@ @@ -57,6 +57,8 @@
57 uni.setNavigationBarTitle({ 57 uni.setNavigationBarTitle({
58 title: "产品" //这是修改后的导航栏文字 58 title: "产品" //这是修改后的导航栏文字
59 }) 59 })
  60 + let URL=window.location.href
  61 + this.$wxH5Share.get_jssdk("产品",URL)
60 } 62 }
61 if (options.sort_id) { 63 if (options.sort_id) {
62 this.sort_id = options.sort_id 64 this.sort_id = options.sort_id
@@ -65,6 +67,8 @@ @@ -65,6 +67,8 @@
65 uni.setNavigationBarTitle({ 67 uni.setNavigationBarTitle({
66 title: that.sort_name //这是修改后的导航栏文字 68 title: that.sort_name //这是修改后的导航栏文字
67 }) 69 })
  70 + let URL=window.location.href
  71 + this.$wxH5Share.get_jssdk(that.sort_name,URL)
68 } 72 }
69 this.product_list(true) 73 this.product_list(true)
70 }, 74 },
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <view class="bot flexA"> 21 <view class="bot flexA">
22 <view class="left flexA"> 22 <view class="left flexA">
23 <image :src="item.image_preview" mode=""></image> 23 <image :src="item.image_preview" mode=""></image>
24 - <view class=""> 24 + <view class="lefte">
25 <view class="title">{{item.title}}</view> 25 <view class="title">{{item.title}}</view>
26 <view class="time">发布时间:{{item.publishtime}}</view> 26 <view class="time">发布时间:{{item.publishtime}}</view>
27 </view> 27 </view>
@@ -56,6 +56,8 @@ @@ -56,6 +56,8 @@
56 uni.setNavigationBarTitle({ 56 uni.setNavigationBarTitle({
57 title: title //这是修改后的导航栏文字 57 title: title //这是修改后的导航栏文字
58 }) 58 })
  59 + let URL=window.location.href
  60 + this.$wxH5Share.get_jssdk(title,URL)
59 this.sort_list(true) 61 this.sort_list(true)
60 62
61 }, 63 },
@@ -230,17 +232,21 @@ @@ -230,17 +232,21 @@
230 } 232 }
231 233
232 .left { 234 .left {
233 - .title {  
234 - font-size: 28rpx;  
235 - font-weight: 700; 235 + .lefte{
  236 + flex: 1;
  237 + .title {
  238 + font-size: 28rpx;
  239 + font-weight: 700;
  240 + }
  241 +
  242 + .time {
  243 + margin-top: 32rpx;
  244 + color: rgba(0, 0, 0, 0.6);
  245 + font-size: 26rpx;
  246 + }
  247 +
236 } 248 }
237 -  
238 - .time {  
239 - margin-top: 32rpx;  
240 - color: rgba(0, 0, 0, 0.6);  
241 - font-size: 26rpx;  
242 - }  
243 - 249 +
244 } 250 }
245 251
246 } 252 }
@@ -29,7 +29,9 @@ @@ -29,7 +29,9 @@
29 ktext: "", 29 ktext: "",
30 }; 30 };
31 }, 31 },
32 - onLoad() { 32 + onLoad() {
  33 + let URL=window.location.href
  34 + this.$wxH5Share.get_jssdk("搜索",URL)
33 }, 35 },
34 onShow() { 36 onShow() {
35 this.search_list() 37 this.search_list()
@@ -35,6 +35,8 @@ @@ -35,6 +35,8 @@
35 }, 35 },
36 onLoad() { 36 onLoad() {
37 this.problemSort() 37 this.problemSort()
  38 + let URL=window.location.href
  39 + this.$wxH5Share.get_jssdk("意见反馈",URL)
38 }, 40 },
39 methods: { 41 methods: {
40 toItem(id) { 42 toItem(id) {
@@ -110,6 +110,10 @@ @@ -110,6 +110,10 @@
110 showLogin:false 110 showLogin:false
111 } 111 }
112 }, 112 },
  113 + onLoad() {
  114 + let URL=window.location.href
  115 + this.$wxH5Share.get_jssdk("我的",URL)
  116 + },
113 onShow() { 117 onShow() {
114 this.token = uni.getStorageSync('token') || '' 118 this.token = uni.getStorageSync('token') || ''
115 this.userInfo = uni.getStorageSync('userInfo') || '' 119 this.userInfo = uni.getStorageSync('userInfo') || ''
@@ -47,6 +47,10 @@ @@ -47,6 +47,10 @@
47 lastPage:1 47 lastPage:1
48 } 48 }
49 }, 49 },
  50 + onLoad() {
  51 + let URL=window.location.href
  52 + this.$wxH5Share.get_jssdk("收藏",URL)
  53 + },
50 onShow() { 54 onShow() {
51 this.page = 1 55 this.page = 1
52 this.list= [ ] 56 this.list= [ ]
@@ -82,6 +82,8 @@ @@ -82,6 +82,8 @@
82 onLoad() { 82 onLoad() {
83 that = this 83 that = this
84 this.myProduct() 84 this.myProduct()
  85 + let URL=window.location.href
  86 + this.$wxH5Share.get_jssdk("发布",URL)
85 }, 87 },
86 methods: { 88 methods: {
87 async myProduct(f){ 89 async myProduct(f){
1 <template> 1 <template>
2 - <view class="">  
3 - <rich-text :nodes="detail"></rich-text> 2 + <view class="" style="padding: 24rpx;">
  3 + <mp-html :content="detail" />
4 </view> 4 </view>
5 </template> 5 </template>
6 6
  1 +## news
  2 +1. 欢迎加入 `QQ` 交流群:`699734691`
  3 + ![group](https://6874-html-foe72-1259071903.tcb.qcloud.la/assets/group.jpg?sign=558401bccbd56b01debe1bfac6a3b55e&t=1648801090)
  4 +2. 示例微信小程序 `富文本插件` 添加 `获取组件包` 功能 [详细](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart?id=mp)
  5 + ![富文本插件](https://6874-html-foe72-1259071903.tcb.qcloud.la/assets/case/%E5%AF%8C%E6%96%87%E6%9C%AC%E6%8F%92%E4%BB%B6.jpg?sign=200e28d06f36049c18d42cdd46270c35&t=1648801110)
  6 +
  7 +## 功能介绍
  8 +- 全端支持(含 `v3、NVUE`
  9 +- 支持丰富的标签(包括 `table`、`video`、`svg` 等)
  10 +- 支持丰富的事件效果(自动预览图片、链接处理等)
  11 +- 支持设置占位图(加载中、出错时、预览时)
  12 +- 支持锚点跳转、长按复制等丰富功能
  13 +- 支持大部分 *html* 实体
  14 +- 丰富的插件(关键词搜索、内容 **编辑** 等)
  15 +- 效率高、容错性强且轻量化
  16 +
  17 +查看 [功能介绍](https://jin-yufeng.gitee.io/mp-html/#/overview/feature) 了解更多
  18 +
  19 +## 使用方法
  20 +- `uni_modules` 方式
  21 + 1. 点击右上角的 `使用 HBuilder X 导入插件` 按钮直接导入项目或点击 `下载插件 ZIP` 按钮下载插件包并解压到项目的 `uni_modules/mp-html` 目录下
  22 + 2. 在需要使用页面的 `(n)vue` 文件中添加
  23 + ```html
  24 + <!-- 不需要引入,可直接使用 -->
  25 + <mp-html :content="html" />
  26 + ```
  27 + ```javascript
  28 + export default {
  29 + data() {
  30 + return {
  31 + html: '<div>Hello World!</div>'
  32 + }
  33 + }
  34 + }
  35 + ```
  36 + 3. 需要更新版本时在 `HBuilder X` 中右键 `uni_modules/mp-html` 目录选择 `从插件市场更新` 即可
  37 +
  38 +- 源码方式
  39 + 1.[github](https://github.com/jin-yufeng/mp-html/tree/master/dist/uni-app)[gitee](https://gitee.com/jin-yufeng/mp-html/tree/master/dist/uni-app) 下载源码
  40 + 插件市场的 **非 uni_modules 版本** 无法更新,不建议从插件市场获取
  41 + 2. 在需要使用页面的 `(n)vue` 文件中添加
  42 + ```html
  43 + <mp-html :content="html" />
  44 + ```
  45 + ```javascript
  46 + import mpHtml from '@/components/mp-html/mp-html'
  47 + export default {
  48 + // HBuilderX 2.5.5+ 可以通过 easycom 自动引入
  49 + components: {
  50 + mpHtml
  51 + },
  52 + data() {
  53 + return {
  54 + html: '<div>Hello World!</div>'
  55 + }
  56 + }
  57 + }
  58 + ```
  59 +
  60 +- npm 方式
  61 + 1. 在项目根目录下执行
  62 + ```bash
  63 + npm install mp-html
  64 + ```
  65 + 2. 在需要使用页面的 `(n)vue` 文件中添加
  66 + ```html
  67 + <mp-html :content="html" />
  68 + ```
  69 + ```javascript
  70 + import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html'
  71 + export default {
  72 + // 不可省略
  73 + components: {
  74 + mpHtml
  75 + },
  76 + data() {
  77 + return {
  78 + html: '<div>Hello World!</div>'
  79 + }
  80 + }
  81 + }
  82 + ```
  83 + 3. 需要更新版本时执行以下命令即可
  84 + ```bash
  85 + npm update mp-html
  86 + ```
  87 +
  88 + 使用 *cli* 方式运行的项目,通过 *npm* 方式引入时,需要在 *vue.config.js* 中配置 *transpileDependencies*,详情可见 [#330](https://github.com/jin-yufeng/mp-html/issues/330#issuecomment-913617687)
  89 + 如果在 **nvue** 中使用还要将 `dist/uni-app/static` 目录下的内容拷贝到项目的 `static` 目录下,否则无法运行
  90 +
  91 +查看 [快速开始](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart) 了解更多
  92 +
  93 +## 组件属性
  94 +
  95 +| 属性 | 类型 | 默认值 | 说明 |
  96 +|:---:|:---:|:---:|---|
  97 +| container-style | String | | 容器的样式([2.1.0+](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog#v210)) |
  98 +| content | String | | 用于渲染的 html 字符串 |
  99 +| copy-link | Boolean | true | 是否允许外部链接被点击时自动复制 |
  100 +| domain | String | | 主域名(用于链接拼接) |
  101 +| error-img | String | | 图片出错时的占位图链接 |
  102 +| lazy-load | Boolean | false | 是否开启图片懒加载 |
  103 +| loading-img | String | | 图片加载过程中的占位图链接 |
  104 +| pause-video | Boolean | true | 是否在播放一个视频时自动暂停其他视频 |
  105 +| preview-img | Boolean | true | 是否允许图片被点击时自动预览 |
  106 +| scroll-table | Boolean | false | 是否给每个表格添加一个滚动层使其能单独横向滚动 |
  107 +| selectable | Boolean | false | 是否开启文本长按复制 |
  108 +| set-title | Boolean | true | 是否将 title 标签的内容设置到页面标题 |
  109 +| show-img-menu | Boolean | true | 是否允许图片被长按时显示菜单 |
  110 +| tag-style | Object | | 设置标签的默认样式 |
  111 +| use-anchor | Boolean | false | 是否使用锚点链接 |
  112 +
  113 +查看 [属性](https://jin-yufeng.gitee.io/mp-html/#/basic/prop) 了解更多
  114 +
  115 +## 组件事件
  116 +
  117 +| 名称 | 触发时机 |
  118 +|:---:|---|
  119 +| load | dom 树加载完毕时 |
  120 +| ready | 图片加载完毕时 |
  121 +| error | 发生渲染错误时 |
  122 +| imgtap | 图片被点击时 |
  123 +| linktap | 链接被点击时 |
  124 +
  125 +查看 [事件](https://jin-yufeng.gitee.io/mp-html/#/basic/event) 了解更多
  126 +
  127 +## api
  128 +组件实例上提供了一些 `api` 方法可供调用
  129 +
  130 +| 名称 | 作用 |
  131 +|:---:|---|
  132 +| in | 将锚点跳转的范围限定在一个 scroll-view 内 |
  133 +| navigateTo | 锚点跳转 |
  134 +| getText | 获取文本内容 |
  135 +| getRect | 获取富文本内容的位置和大小 |
  136 +| setContent | 设置富文本内容 |
  137 +| imgList | 获取所有图片的数组 |
  138 +
  139 +查看 [api](https://jin-yufeng.gitee.io/mp-html/#/advanced/api) 了解更多
  140 +
  141 +## 插件扩展
  142 +除基本功能外,本组件还提供了丰富的扩展,可按照需要选用
  143 +
  144 +| 名称 | 作用 |
  145 +|:---:|---|
  146 +| audio | 音乐播放器 |
  147 +| editable | 富文本 **编辑**[示例项目](https://6874-html-foe72-1259071903.tcb.qcloud.la/editable.zip?sign=cc0017be203fb3dbca62d33a0c15792e&t=1608447445)) |
  148 +| emoji | 解析 emoji |
  149 +| highlight | 代码块高亮显示 |
  150 +| markdown | 渲染 markdown |
  151 +| search | 关键词搜索 |
  152 +| style | 匹配 style 标签中的样式 |
  153 +| txv-video | 使用腾讯视频 |
  154 +| img-cache | 图片缓存 by [@PentaTea](https://github.com/PentaTea) |
  155 +
  156 +从插件市场导入的包中 **不含有** 扩展插件,需要使用插件参考以下方法:
  157 +1. 获取完整组件包
  158 + ```bash
  159 + npm install mp-html
  160 + ```
  161 +2. 编辑 `tools/config.js` 中的 `plugins` 项,选择需要的插件
  162 +3. 生成新的组件包
  163 +`node_modules/mp-html` 目录下执行
  164 + ```bash
  165 + npm install
  166 + npm run build:uni-app
  167 + ```
  168 +4. 拷贝 `dist/uni-app` 中的内容到项目根目录
  169 +
  170 +查看 [插件](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin) 了解更多
  171 +
  172 +## 关于 nvue
  173 +`nvue` 使用原生渲染,不支持部分 `css` 样式,为实现和 `html` 相同的效果,组件内部通过 `web-view` 进行渲染,性能上差于原生,根据 `weex` 官方建议,`web` 标签仅应用在非常规的降级场景。因此,如果通过原生的方式(如 `richtext`)能够满足需要,则不建议使用本组件,如果有较多的富文本内容,则可以直接使用 `vue` 页面
  174 +由于渲染方式与其他端不同,有以下限制:
  175 +1. 不支持 `lazy-load` 属性
  176 +2. 视频不支持全屏播放
  177 +
  178 +`nvue` 模式下,[此问题](https://ask.dcloud.net.cn/question/119678) 修复前,不支持通过 `uni_modules` 引入,需要本地引入(将 [dist/uni-app](https://github.com/jin-yufeng/mp-html/tree/master/dist/uni-app) 中的内容拷贝到项目根目录下)
  179 +
  180 +## 问题反馈
  181 +遇到问题时,请先查阅 [常见问题](https://jin-yufeng.gitee.io/mp-html/#/question/faq)[issue](https://github.com/jin-yufeng/mp-html/issues) 中是否已有相同的问题
  182 +可通过 [issue](https://github.com/jin-yufeng/mp-html/issues/new/choose) 、插件问答或发送邮件到 [mp_html@126.com](mailto:mp_html@126.com) 提问,不建议在评论区提问(不方便回复)
  183 +提问请严格按照 [issue 模板](https://github.com/jin-yufeng/mp-html/issues/new/choose) ,描述清楚使用环境、`html` 内容或可复现的 `demo` 项目以及复现方式,对于 **描述不清****无法复现** 或重复的问题将不予回复
  184 +
  185 +查看 [问题反馈](https://jin-yufeng.gitee.io/mp-html/#/question/feedback) 了解更多
  1 +## v2.3.1(2022-05-20)
  2 +1. `U` `app` 端支持使用本地图片
  3 +2. `U` 优化了微信小程序 `selectable` 属性在 `ios` 端的处理 [详细](https://jin-yufeng.gitee.io/mp-html/#/basic/prop#selectable)
  4 +3. `F` 修复了 `editable` 插件不在顶部时 `tooltip` 位置可能错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/430)
  5 +4. `F` 修复了 `vue3` 运行到微信小程序可能报错丢失内容的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/414)
  6 +5. `F` 修复了 `vue3` 部分标签可能被错误换行的问题
  7 +6. `F` 修复了 `editable` 插件 `app` 端插入视频无法预览的问题
  8 +## v2.3.0(2022-04-01)
  9 +1. `A` 增加了 `play` 事件,音视频播放时触发,可用于与页面其他音视频进行互斥播放 [详细](basic/event#play)
  10 +2. `U` `show-img-menu` 属性支持控制预览时是否长按弹出菜单
  11 +3. `U` 优化 `wxs` 处理,提高渲染性能 [详细](https://developers.weixin.qq.com/community/develop/article/doc/0006cc2b204740f601bd43fa25a413)
  12 +4. `U` `video` 标签支持 `object-fit` 属性
  13 +5. `U` 增加支持一些常用实体编码 [详细](https://github.com/jin-yufeng/mp-html/issues/418)
  14 +6. `F` 修复了图片仅设置高度可能不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/410)
  15 +7. `F` 修复了 `video` 标签高度设置为 `auto` 不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/411)
  16 +8. `F` 修复了使用 `grid` 布局时可能样式错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/413)
  17 +9. `F` 修复了含有合并单元格的表格部分情况下显示异常的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/417)
  18 +10. `F` 修复了 `editable` 插件连续插入内容时顺序不正确的问题
  19 +11. `F` 修复了 `uni-app` 包 `vue3` 使用 `audio` 插件报错的问题
  20 +12. `F` 修复了 `uni-app` 包 `highlight` 插件使用自定义的 `prism.min.js` 报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/416)
  21 +## v2.2.2(2022-02-26)
  22 +1. `A` 增加了 [pauseMedia](https://jin-yufeng.gitee.io/mp-html/#/advanced/api#pauseMedia) 的 `api`,可用于暂停播放音视频 [详细](https://github.com/jin-yufeng/mp-html/issues/317)
  23 +2. `U` 优化了长内容的加载速度
  24 +3. `U` 适配 `vue3` [#389](https://github.com/jin-yufeng/mp-html/issues/389)[#398](https://github.com/jin-yufeng/mp-html/pull/398) by [@zhouhuafei](https://github.com/zhouhuafei)[#400](https://github.com/jin-yufeng/mp-html/issues/400)
  25 +4. `F` 修复了小程序端图片高度设置为百分比时可能不显示的问题
  26 +5. `F` 修复了 `highlight` 插件部分情况下可能显示不完整的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/403)
  27 +## v2.2.1(2021-12-24)
  28 +1. `A` `editable` 插件增加上下移动标签功能
  29 +2. `U` `editable` 插件支持在文本中间光标处插入内容
  30 +3. `F` 修复了 `nvue` 端设置 `margin` 后可能导致高度不正确的问题
  31 +4. `F` 修复了 `highlight` 插件使用压缩版的 `prism.css` 可能导致背景失效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/367)
  32 +5. `F` 修复了编辑状态下使用 `emoji` 插件内容为空时可能报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/371)
  33 +6. `F` 修复了使用 `editable` 插件后将 `selectable` 属性设置为 `force` 不生效的问题
  34 +## v2.2.0(2021-10-12)
  35 +1. `A` 增加 `customElements` 配置项,便于添加自定义功能性标签 [详细](https://github.com/jin-yufeng/mp-html/issues/350)
  36 +2. `A` `editable` 插件增加切换音视频自动播放状态的功能 [详细](https://github.com/jin-yufeng/mp-html/pull/341) by [@leeseett](https://github.com/leeseett)
  37 +3. `A` `editable` 插件删除媒体标签时触发 `remove` 事件,便于删除已上传的文件
  38 +4. `U` `editable` 插件 `insertImg` 方法支持同时插入多张图片 [详细](https://github.com/jin-yufeng/mp-html/issues/342)
  39 +5. `U` `editable` 插入图片和音视频时支持拼接 `domian` 主域名
  40 +6. `F` 修复了内部链接参数中包含 `://` 时被认为是外部链接的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/356)
  41 +7. `F` 修复了部分 `svg` 标签名或属性名大小写不正确时不生效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/351)
  42 +8. `F` 修复了 `nvue` 页面运行到非 `app` 平台时可能样式错误的问题
  43 +## v2.1.5(2021-08-13)
  44 +1. `A` 增加支持标签的 `dir` 属性
  45 +2. `F` 修复了 `ruby` 标签文字与拼音没有居中对齐的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/325)
  46 +3. `F` 修复了音视频标签内有 `a` 标签时可能无法播放的问题
  47 +4. `F` 修复了 `externStyle` 中的 `class` 名包含下划线或数字时可能失效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/326)
  48 +5. `F` 修复了 `h5` 端引入 `externStyle` 可能不生效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/326)
  49 +## v2.1.4(2021-07-14)
  50 +1. `F` 修复了 `rt` 标签无法设置样式的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/318)
  51 +2. `F` 修复了表格中有单元格同时合并行和列时可能显示不正确的问题
  52 +3. `F` 修复了 `app` 端无法关闭图片长按菜单的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/322)
  53 +4. `F` 修复了 `editable` 插件只能添加图片链接不能修改的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/312) by [@leeseett](https://github.com/leeseett)
  54 +## v2.1.3(2021-06-12)
  55 +1. `A` `editable` 插件增加 `insertTable` 方法
  56 +2. `U` `editable` 插件支持编辑表格中的空白单元格 [详细](https://github.com/jin-yufeng/mp-html/issues/310)
  57 +3. `F` 修复了 `externStyle` 中使用伪类可能失效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/298)
  58 +4. `F` 修复了多个组件同时使用时 `tag-style` 属性时可能互相影响的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/305) by [@woodguoyu](https://github.com/woodguoyu)
  59 +5. `F` 修复了包含 `linearGradient` 的 `svg` 可能无法显示的问题
  60 +6. `F` 修复了编译到头条小程序时可能报错的问题
  61 +7. `F` 修复了 `nvue` 端不触发 `click` 事件的问题
  62 +8. `F` 修复了 `editable` 插件尾部插入时无法撤销的问题
  63 +9. `F` 修复了 `editable` 插件的 `insertHtml` 方法只能在末尾插入的问题
  64 +10. `F` 修复了 `editable` 插件插入音频不显示的问题
  65 +## v2.1.2(2021-04-24)
  66 +1. `A` 增加了 [img-cache](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#img-cache) 插件,可以在 `app` 端缓存图片 [详细](https://github.com/jin-yufeng/mp-html/issues/292) by [@PentaTea](https://github.com/PentaTea)
  67 +2. `U` 支持通过 `container-style` 属性设置 `white-space` 来保留连续空格和换行符 [详细](https://jin-yufeng.gitee.io/mp-html/#/question/faq#space)
  68 +3. `U` 代码风格符合 [standard](https://standardjs.com) 标准
  69 +4. `U` `editable` 插件编辑状态下支持预览视频 [详细](https://github.com/jin-yufeng/mp-html/issues/286)
  70 +5. `F` 修复了 `svg` 标签内嵌 `svg` 时无法显示的问题
  71 +6. `F` 修复了编译到支付宝和头条小程序时部分区域不可复制的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/291)
  72 +## v2.1.1(2021-04-09)
  73 +1. 修复了对 `p` 标签设置 `tag-style` 可能不生效的问题
  74 +2. 修复了 `svg` 标签中的文本无法显示的问题
  75 +3. 修复了使用 `editable` 插件编辑表格时可能报错的问题
  76 +4. 修复了使用 `highlight` 插件运行到头条小程序时可能没有样式的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/280)
  77 +5. 修复了使用 `editable` 插件 `editable` 属性为 `false` 时会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/284)
  78 +6. 修复了 `style` 插件连续子选择器失效的问题
  79 +7. 修复了 `editable` 插件无法修改图片和字体大小的问题
  80 +## v2.1.0.2(2021-03-21)
  81 +修复了 `nvue` 端使用可能报错的问题
  82 +## v2.1.0(2021-03-20)
  83 +1. `A` 增加了 [container-style](https://jin-yufeng.gitee.io/mp-html/#/basic/prop#container-style) 属性 [详细](https://gitee.com/jin-yufeng/mp-html/pulls/1)
  84 +2. `A` 增加支持 `strike` 标签
  85 +3. `A` `editable` 插件增加 `placeholder` 属性 [详细](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#editable)
  86 +4. `A` `editable` 插件增加 `insertHtml` 方法 [详细](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#editable)
  87 +5. `U` 外部样式支持标签名选择器 [详细](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart#setting)
  88 +6. `F` 修复了 `nvue` 端部分情况下可能不显示的问题
  89 +## v2.0.5(2021-03-12)
  90 +1. `U` [linktap](https://jin-yufeng.gitee.io/mp-html/#/basic/event#linktap) 事件增加返回内部文本内容 `innerText` [详细](https://github.com/jin-yufeng/mp-html/issues/271)
  91 +2. `U` [selectable](https://jin-yufeng.gitee.io/mp-html/#/basic/prop#selectable) 属性设置为 `force` 时能够在微信 `iOS` 端生效(文本块会变成 `inline-block`[详细](https://github.com/jin-yufeng/mp-html/issues/267)
  92 +3. `F` 修复了部分情况下竖向无法滚动的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/182)
  93 +4. `F` 修复了多次修改富文本数据时部分内容可能不显示的问题
  94 +5. `F` 修复了 [腾讯视频](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#txv-video) 插件可能无法播放的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/265)
  95 +6. `F` 修复了 [highlight](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#highlight) 插件没有设置高亮语言时没有应用默认样式的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/276) by [@fuzui](https://github.com/fuzui)
  1 +<template>
  2 + <view id="_root" :class="(selectable?'_select ':'')+'_root'" :style="containerStyle">
  3 + <slot v-if="!nodes[0]" />
  4 + <!-- #ifndef APP-PLUS-NVUE -->
  5 + <node v-else :childs="nodes" :opts="[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]" name="span" />
  6 + <!-- #endif -->
  7 + <!-- #ifdef APP-PLUS-NVUE -->
  8 + <web-view ref="web" src="/uni_modules/mp-html/static/app-plus/mp-html/local.html" :style="'margin-top:-2px;height:' + height + 'px'" @onPostMessage="_onMessage" />
  9 + <!-- #endif -->
  10 + </view>
  11 +</template>
  12 +
  13 +<script>
  14 +/**
  15 + * mp-html v2.3.1
  16 + * @description 富文本组件
  17 + * @tutorial https://github.com/jin-yufeng/mp-html
  18 + * @property {String} container-style 容器的样式
  19 + * @property {String} content 用于渲染的 html 字符串
  20 + * @property {Boolean} copy-link 是否允许外部链接被点击时自动复制
  21 + * @property {String} domain 主域名,用于拼接链接
  22 + * @property {String} error-img 图片出错时的占位图链接
  23 + * @property {Boolean} lazy-load 是否开启图片懒加载
  24 + * @property {string} loading-img 图片加载过程中的占位图链接
  25 + * @property {Boolean} pause-video 是否在播放一个视频时自动暂停其他视频
  26 + * @property {Boolean} preview-img 是否允许图片被点击时自动预览
  27 + * @property {Boolean} scroll-table 是否给每个表格添加一个滚动层使其能单独横向滚动
  28 + * @property {Boolean | String} selectable 是否开启长按复制
  29 + * @property {Boolean} set-title 是否将 title 标签的内容设置到页面标题
  30 + * @property {Boolean} show-img-menu 是否允许图片被长按时显示菜单
  31 + * @property {Object} tag-style 标签的默认样式
  32 + * @property {Boolean | Number} use-anchor 是否使用锚点链接
  33 + * @event {Function} load dom 结构加载完毕时触发
  34 + * @event {Function} ready 所有图片加载完毕时触发
  35 + * @event {Function} imgtap 图片被点击时触发
  36 + * @event {Function} linktap 链接被点击时触发
  37 + * @event {Function} play 音视频播放时触发
  38 + * @event {Function} error 媒体加载出错时触发
  39 + */
  40 +// #ifndef APP-PLUS-NVUE
  41 +import node from './node/node'
  42 +// #endif
  43 +import Parser from './parser'
  44 +const plugins=[]
  45 +// #ifdef APP-PLUS-NVUE
  46 +const dom = weex.requireModule('dom')
  47 +// #endif
  48 +export default {
  49 + name: 'mp-html',
  50 + data () {
  51 + return {
  52 + nodes: [],
  53 + // #ifdef APP-PLUS-NVUE
  54 + height: 3
  55 + // #endif
  56 + }
  57 + },
  58 + props: {
  59 + containerStyle: {
  60 + type: String,
  61 + default: ''
  62 + },
  63 + content: {
  64 + type: String,
  65 + default: ''
  66 + },
  67 + copyLink: {
  68 + type: [Boolean, String],
  69 + default: true
  70 + },
  71 + domain: String,
  72 + errorImg: {
  73 + type: String,
  74 + default: ''
  75 + },
  76 + lazyLoad: {
  77 + type: [Boolean, String],
  78 + default: false
  79 + },
  80 + loadingImg: {
  81 + type: String,
  82 + default: ''
  83 + },
  84 + pauseVideo: {
  85 + type: [Boolean, String],
  86 + default: true
  87 + },
  88 + previewImg: {
  89 + type: [Boolean, String],
  90 + default: true
  91 + },
  92 + scrollTable: [Boolean, String],
  93 + selectable: [Boolean, String],
  94 + setTitle: {
  95 + type: [Boolean, String],
  96 + default: true
  97 + },
  98 + showImgMenu: {
  99 + type: [Boolean, String],
  100 + default: true
  101 + },
  102 + tagStyle: Object,
  103 + useAnchor: [Boolean, Number]
  104 + },
  105 + // #ifdef VUE3
  106 + emits: ['load', 'ready', 'imgtap', 'linktap', 'play', 'error'],
  107 + // #endif
  108 + // #ifndef APP-PLUS-NVUE
  109 + components: {
  110 + node
  111 + },
  112 + // #endif
  113 + watch: {
  114 + content (content) {
  115 + this.setContent(content)
  116 + }
  117 + },
  118 + created () {
  119 + this.plugins = []
  120 + for (let i = plugins.length; i--;) {
  121 + this.plugins.push(new plugins[i](this))
  122 + }
  123 + },
  124 + mounted () {
  125 + if (this.content && !this.nodes.length) {
  126 + this.setContent(this.content)
  127 + }
  128 + },
  129 + beforeDestroy () {
  130 + this._hook('onDetached')
  131 + clearInterval(this._timer)
  132 + },
  133 + methods: {
  134 + /**
  135 + * @description 将锚点跳转的范围限定在一个 scroll-view 内
  136 + * @param {Object} page scroll-view 所在页面的示例
  137 + * @param {String} selector scroll-view 的选择器
  138 + * @param {String} scrollTop scroll-view scroll-top 属性绑定的变量名
  139 + */
  140 + in (page, selector, scrollTop) {
  141 + // #ifndef APP-PLUS-NVUE
  142 + if (page && selector && scrollTop) {
  143 + this._in = {
  144 + page,
  145 + selector,
  146 + scrollTop
  147 + }
  148 + }
  149 + // #endif
  150 + },
  151 +
  152 + /**
  153 + * @description 锚点跳转
  154 + * @param {String} id 要跳转的锚点 id
  155 + * @param {Number} offset 跳转位置的偏移量
  156 + * @returns {Promise}
  157 + */
  158 + navigateTo (id, offset) {
  159 + return new Promise((resolve, reject) => {
  160 + if (!this.useAnchor) {
  161 + reject(Error('Anchor is disabled'))
  162 + return
  163 + }
  164 + offset = offset || parseInt(this.useAnchor) || 0
  165 + // #ifdef APP-PLUS-NVUE
  166 + if (!id) {
  167 + dom.scrollToElement(this.$refs.web, {
  168 + offset
  169 + })
  170 + resolve()
  171 + } else {
  172 + this._navigateTo = {
  173 + resolve,
  174 + reject,
  175 + offset
  176 + }
  177 + this.$refs.web.evalJs('uni.postMessage({data:{action:"getOffset",offset:(document.getElementById(' + id + ')||{}).offsetTop}})')
  178 + }
  179 + // #endif
  180 + // #ifndef APP-PLUS-NVUE
  181 + let deep = ' '
  182 + // #ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO
  183 + deep = '>>>'
  184 + // #endif
  185 + const selector = uni.createSelectorQuery()
  186 + // #ifndef MP-ALIPAY
  187 + .in(this._in ? this._in.page : this)
  188 + // #endif
  189 + .select((this._in ? this._in.selector : '._root') + (id ? `${deep}#${id}` : '')).boundingClientRect()
  190 + if (this._in) {
  191 + selector.select(this._in.selector).scrollOffset()
  192 + .select(this._in.selector).boundingClientRect()
  193 + } else {
  194 + // 获取 scroll-view 的位置和滚动距离
  195 + selector.selectViewport().scrollOffset() // 获取窗口的滚动距离
  196 + }
  197 + selector.exec(res => {
  198 + if (!res[0]) {
  199 + reject(Error('Label not found'))
  200 + return
  201 + }
  202 + const scrollTop = res[1].scrollTop + res[0].top - (res[2] ? res[2].top : 0) + offset
  203 + if (this._in) {
  204 + // scroll-view 跳转
  205 + this._in.page[this._in.scrollTop] = scrollTop
  206 + } else {
  207 + // 页面跳转
  208 + uni.pageScrollTo({
  209 + scrollTop,
  210 + duration: 300
  211 + })
  212 + }
  213 + resolve()
  214 + })
  215 + // #endif
  216 + })
  217 + },
  218 +
  219 + /**
  220 + * @description 获取文本内容
  221 + * @return {String}
  222 + */
  223 + getText (nodes) {
  224 + let text = '';
  225 + (function traversal (nodes) {
  226 + for (let i = 0; i < nodes.length; i++) {
  227 + const node = nodes[i]
  228 + if (node.type === 'text') {
  229 + text += node.text.replace(/&amp;/g, '&')
  230 + } else if (node.name === 'br') {
  231 + text += '\n'
  232 + } else {
  233 + // 块级标签前后加换行
  234 + const isBlock = node.name === 'p' || node.name === 'div' || node.name === 'tr' || node.name === 'li' || (node.name[0] === 'h' && node.name[1] > '0' && node.name[1] < '7')
  235 + if (isBlock && text && text[text.length - 1] !== '\n') {
  236 + text += '\n'
  237 + }
  238 + // 递归获取子节点的文本
  239 + if (node.children) {
  240 + traversal(node.children)
  241 + }
  242 + if (isBlock && text[text.length - 1] !== '\n') {
  243 + text += '\n'
  244 + } else if (node.name === 'td' || node.name === 'th') {
  245 + text += '\t'
  246 + }
  247 + }
  248 + }
  249 + })(nodes || this.nodes)
  250 + return text
  251 + },
  252 +
  253 + /**
  254 + * @description 获取内容大小和位置
  255 + * @return {Promise}
  256 + */
  257 + getRect () {
  258 + return new Promise((resolve, reject) => {
  259 + uni.createSelectorQuery()
  260 + // #ifndef MP-ALIPAY
  261 + .in(this)
  262 + // #endif
  263 + .select('#_root').boundingClientRect().exec(res => res[0] ? resolve(res[0]) : reject(Error('Root label not found')))
  264 + })
  265 + },
  266 +
  267 + /**
  268 + * @description 暂停播放媒体
  269 + */
  270 + pauseMedia () {
  271 + for (let i = (this._videos || []).length; i--;) {
  272 + this._videos[i].pause()
  273 + }
  274 + // #ifdef APP-PLUS
  275 + const command = 'for(var e=document.getElementsByTagName("video"),i=e.length;i--;)e[i].pause()'
  276 + // #ifndef APP-PLUS-NVUE
  277 + let page = this.$parent
  278 + while (!page.$scope) page = page.$parent
  279 + page.$scope.$getAppWebview().evalJS(command)
  280 + // #endif
  281 + // #ifdef APP-PLUS-NVUE
  282 + this.$refs.web.evalJs(command)
  283 + // #endif
  284 + // #endif
  285 + },
  286 +
  287 + /**
  288 + * @description 设置内容
  289 + * @param {String} content html 内容
  290 + * @param {Boolean} append 是否在尾部追加
  291 + */
  292 + setContent (content, append) {
  293 + if (!append || !this.imgList) {
  294 + this.imgList = []
  295 + }
  296 + const nodes = new Parser(this).parse(content)
  297 + // #ifdef APP-PLUS-NVUE
  298 + if (this._ready) {
  299 + this._set(nodes, append)
  300 + }
  301 + // #endif
  302 + this.$set(this, 'nodes', append ? (this.nodes || []).concat(nodes) : nodes)
  303 +
  304 + // #ifndef APP-PLUS-NVUE
  305 + this._videos = []
  306 + this.$nextTick(() => {
  307 + this._hook('onLoad')
  308 + this.$emit('load')
  309 + })
  310 +
  311 + // 等待图片加载完毕
  312 + let height
  313 + clearInterval(this._timer)
  314 + this._timer = setInterval(() => {
  315 + this.getRect().then(rect => {
  316 + // 350ms 总高度无变化就触发 ready 事件
  317 + if (rect.height === height) {
  318 + this.$emit('ready', rect)
  319 + clearInterval(this._timer)
  320 + }
  321 + height = rect.height
  322 + }).catch(() => { })
  323 + }, 350)
  324 + // #endif
  325 + },
  326 +
  327 + /**
  328 + * @description 调用插件钩子函数
  329 + */
  330 + _hook (name) {
  331 + for (let i = plugins.length; i--;) {
  332 + if (this.plugins[i][name]) {
  333 + this.plugins[i][name]()
  334 + }
  335 + }
  336 + },
  337 +
  338 + // #ifdef APP-PLUS-NVUE
  339 + /**
  340 + * @description 设置内容
  341 + */
  342 + _set (nodes, append) {
  343 + this.$refs.web.evalJs('setContent(' + JSON.stringify(nodes) + ',' + JSON.stringify([this.containerStyle.replace(/(?:margin|padding)[^;]+/g, ''), this.errorImg, this.loadingImg, this.pauseVideo, this.scrollTable, this.selectable]) + ',' + append + ')')
  344 + },
  345 +
  346 + /**
  347 + * @description 接收到 web-view 消息
  348 + */
  349 + _onMessage (e) {
  350 + const message = e.detail.data[0]
  351 + switch (message.action) {
  352 + // web-view 初始化完毕
  353 + case 'onJSBridgeReady':
  354 + this._ready = true
  355 + if (this.nodes) {
  356 + this._set(this.nodes)
  357 + }
  358 + break
  359 + // 内容 dom 加载完毕
  360 + case 'onLoad':
  361 + this.height = message.height
  362 + this._hook('onLoad')
  363 + this.$emit('load')
  364 + break
  365 + // 所有图片加载完毕
  366 + case 'onReady':
  367 + this.getRect().then(res => {
  368 + this.$emit('ready', res)
  369 + }).catch(() => { })
  370 + break
  371 + // 总高度发生变化
  372 + case 'onHeightChange':
  373 + this.height = message.height
  374 + break
  375 + // 图片点击
  376 + case 'onImgTap':
  377 + this.$emit('imgtap', message.attrs)
  378 + if (this.previewImg) {
  379 + uni.previewImage({
  380 + current: parseInt(message.attrs.i),
  381 + urls: this.imgList
  382 + })
  383 + }
  384 + break
  385 + // 链接点击
  386 + case 'onLinkTap': {
  387 + const href = message.attrs.href
  388 + this.$emit('linktap', message.attrs)
  389 + if (href) {
  390 + // 锚点跳转
  391 + if (href[0] === '#') {
  392 + if (this.useAnchor) {
  393 + dom.scrollToElement(this.$refs.web, {
  394 + offset: message.offset
  395 + })
  396 + }
  397 + } else if (href.includes('://')) {
  398 + // 打开外链
  399 + if (this.copyLink) {
  400 + plus.runtime.openWeb(href)
  401 + }
  402 + } else {
  403 + uni.navigateTo({
  404 + url: href,
  405 + fail () {
  406 + uni.switchTab({
  407 + url: href
  408 + })
  409 + }
  410 + })
  411 + }
  412 + }
  413 + break
  414 + }
  415 + case 'onPlay':
  416 + this.$emit('play')
  417 + break
  418 + // 获取到锚点的偏移量
  419 + case 'getOffset':
  420 + if (typeof message.offset === 'number') {
  421 + dom.scrollToElement(this.$refs.web, {
  422 + offset: message.offset + this._navigateTo.offset
  423 + })
  424 + this._navigateTo.resolve()
  425 + } else {
  426 + this._navigateTo.reject(Error('Label not found'))
  427 + }
  428 + break
  429 + // 点击
  430 + case 'onClick':
  431 + this.$emit('tap')
  432 + this.$emit('click')
  433 + break
  434 + // 出错
  435 + case 'onError':
  436 + this.$emit('error', {
  437 + source: message.source,
  438 + attrs: message.attrs
  439 + })
  440 + }
  441 + }
  442 + // #endif
  443 + }
  444 +}
  445 +</script>
  446 +
  447 +<style>
  448 +/* #ifndef APP-PLUS-NVUE */
  449 +/* 根节点样式 */
  450 +._root {
  451 + padding: 1px 0;
  452 + overflow-x: auto;
  453 + overflow-y: hidden;
  454 + --webkit-overflow-scrolling: touch;
  455 +}
  456 +
  457 +/* 长按复制 */
  458 +._select {
  459 + user-select: text;
  460 +}
  461 +/* #endif */
  462 +</style>
  1 +<template>
  2 + <view :id="attrs.id" :class="'_block _'+name+' '+attrs.class" :style="attrs.style">
  3 + <block v-for="(n, i) in childs" v-bind:key="i">
  4 + <!-- 图片 -->
  5 + <!-- 占位图 -->
  6 + <image v-if="n.name==='img'&&((opts[1]&&!ctrl[i])||ctrl[i]<0)" class="_img" :style="n.attrs.style" :src="ctrl[i]<0?opts[2]:opts[1]" mode="widthFix" />
  7 + <!-- 显示图片 -->
  8 + <!-- #ifdef H5 || (APP-PLUS && VUE2) -->
  9 + <img v-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
  10 + <!-- #endif -->
  11 + <!-- #ifndef H5 || APP-PLUS -->
  12 + <image v-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;height:1px;'+n.attrs.style" :src="n.attrs.src" :mode="!n.h?'widthFix':(!n.w?'heightFix':'')" :lazy-load="opts[0]" :webp="n.webp" :show-menu-by-longpress="opts[3]&&!n.attrs.ignore" :image-menu-prevent="!opts[3]||n.attrs.ignore" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
  13 + <!-- #endif -->
  14 + <!-- #ifdef APP-PLUS && VUE3 -->
  15 + <image v-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':'')" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
  16 + <!-- #endif -->
  17 + <!-- 文本 -->
  18 + <!-- #ifndef MP-BAIDU || MP-ALIPAY || MP-TOUTIAO -->
  19 + <text v-else-if="n.text" :user-select="opts[4]" decode>{{n.text}}</text>
  20 + <!-- #endif -->
  21 + <text v-else-if="n.name==='br'">\n</text>
  22 + <!-- 链接 -->
  23 + <view v-else-if="n.name==='a'" :id="n.attrs.id" :class="(n.attrs.href?'_a ':'')+n.attrs.class" hover-class="_hover" :style="'display:inline;'+n.attrs.style" :data-i="i" @tap.stop="linkTap">
  24 + <node name="span" :childs="n.children" :opts="opts" style="display:inherit" />
  25 + </view>
  26 + <!-- 视频 -->
  27 + <!-- #ifdef APP-PLUS -->
  28 + <view v-else-if="n.html" :id="n.attrs.id" :class="'_video '+n.attrs.class" :style="n.attrs.style" v-html="n.html" @vplay.stop="play" />
  29 + <!-- #endif -->
  30 + <!-- #ifndef APP-PLUS -->
  31 + <video v-else-if="n.name==='video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :object-fit="n.attrs['object-fit']" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" />
  32 + <!-- #endif -->
  33 + <!-- #ifdef H5 || APP-PLUS -->
  34 + <iframe v-else-if="n.name==='iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen" :frameborder="n.attrs.frameborder" :src="n.attrs.src" />
  35 + <embed v-else-if="n.name==='embed'" :style="n.attrs.style" :src="n.attrs.src" />
  36 + <!-- #endif -->
  37 + <!-- #ifndef MP-TOUTIAO || ((H5 || APP-PLUS) && VUE3) -->
  38 + <!-- 音频 -->
  39 + <audio v-else-if="n.name==='audio'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author" :controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" />
  40 + <!-- #endif -->
  41 + <view v-else-if="(n.name==='table'&&n.c)||n.name==='li'" :id="n.attrs.id" :class="'_'+n.name+' '+n.attrs.class" :style="n.attrs.style">
  42 + <node v-if="n.name==='li'" :childs="n.children" :opts="opts" />
  43 + <view v-else v-for="(tbody, x) in n.children" v-bind:key="x" :class="'_'+tbody.name+' '+tbody.attrs.class" :style="tbody.attrs.style">
  44 + <node v-if="tbody.name==='td'||tbody.name==='th'" :childs="tbody.children" :opts="opts" />
  45 + <block v-else v-for="(tr, y) in tbody.children" v-bind:key="y">
  46 + <view v-if="tr.name==='td'||tr.name==='th'" :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style">
  47 + <node :childs="tr.children" :opts="opts" />
  48 + </view>
  49 + <view v-else :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style">
  50 + <view v-for="(td, z) in tr.children" v-bind:key="z" :class="'_'+td.name+' '+td.attrs.class" :style="td.attrs.style">
  51 + <node :childs="td.children" :opts="opts" />
  52 + </view>
  53 + </view>
  54 + </block>
  55 + </view>
  56 + </view>
  57 +
  58 + <!-- 富文本 -->
  59 + <!-- #ifdef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
  60 + <rich-text v-else-if="!n.c&&!handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" />
  61 + <!-- #endif -->
  62 + <!-- #ifndef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
  63 + <rich-text v-else-if="!n.c" :id="n.attrs.id" :style="n.f+';display:inline'" :preview="false" :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" />
  64 + <!-- #endif -->
  65 + <!-- 继续递归 -->
  66 + <view v-else-if="n.c===2" :id="n.attrs.id" :class="'_block _'+n.name+' '+n.attrs.class" :style="n.f+';'+n.attrs.style">
  67 + <node v-for="(n2, j) in n.children" v-bind:key="j" :style="n2.f" :name="n2.name" :attrs="n2.attrs" :childs="n2.children" :opts="opts" />
  68 + </view>
  69 + <node v-else :style="n.f" :name="n.name" :attrs="n.attrs" :childs="n.children" :opts="opts" />
  70 + </block>
  71 + </view>
  72 +</template>
  73 +<script module="handler" lang="wxs">
  74 +// 行内标签列表
  75 +var inlineTags = {
  76 + abbr: true,
  77 + b: true,
  78 + big: true,
  79 + code: true,
  80 + del: true,
  81 + em: true,
  82 + i: true,
  83 + ins: true,
  84 + label: true,
  85 + q: true,
  86 + small: true,
  87 + span: true,
  88 + strong: true,
  89 + sub: true,
  90 + sup: true
  91 +}
  92 +/**
  93 + * @description 判断是否为行内标签
  94 + */
  95 +module.exports = {
  96 + isInline: function (tagName, style) {
  97 + return inlineTags[tagName] || (style || '').indexOf('display:inline') !== -1
  98 + }
  99 +}
  100 +</script>
  101 +<script>
  102 +
  103 +import node from './node'
  104 +export default {
  105 + name: 'node',
  106 + options: {
  107 + // #ifdef MP-WEIXIN
  108 + virtualHost: true,
  109 + // #endif
  110 + // #ifdef MP-TOUTIAO
  111 + addGlobalClass: false
  112 + // #endif
  113 + },
  114 + data () {
  115 + return {
  116 + ctrl: {}
  117 + }
  118 + },
  119 + props: {
  120 + name: String,
  121 + attrs: {
  122 + type: Object,
  123 + default () {
  124 + return {}
  125 + }
  126 + },
  127 + childs: Array,
  128 + opts: Array
  129 + },
  130 + components: {
  131 +
  132 + // #ifndef H5 && VUE3
  133 + node
  134 + // #endif
  135 + },
  136 + mounted () {
  137 + this.$nextTick(() => {
  138 + for (this.root = this.$parent; this.root.$options.name !== 'mp-html'; this.root = this.root.$parent);
  139 + })
  140 + // #ifdef H5 || APP-PLUS
  141 + if (this.opts[0]) {
  142 + let i
  143 + for (i = this.childs.length; i--;) {
  144 + if (this.childs[i].name === 'img') break
  145 + }
  146 + if (i !== -1) {
  147 + this.observer = uni.createIntersectionObserver(this).relativeToViewport({
  148 + top: 500,
  149 + bottom: 500
  150 + })
  151 + this.observer.observe('._img', res => {
  152 + if (res.intersectionRatio) {
  153 + this.$set(this.ctrl, 'load', 1)
  154 + this.observer.disconnect()
  155 + }
  156 + })
  157 + }
  158 + }
  159 + // #endif
  160 + },
  161 + beforeDestroy () {
  162 + // #ifdef H5 || APP-PLUS
  163 + if (this.observer) {
  164 + this.observer.disconnect()
  165 + }
  166 + // #endif
  167 + },
  168 + methods:{
  169 + // #ifdef MP-WEIXIN
  170 + toJSON () { },
  171 + // #endif
  172 + /**
  173 + * @description 播放视频事件
  174 + * @param {Event} e
  175 + */
  176 + play (e) {
  177 + this.root.$emit('play')
  178 + // #ifndef APP-PLUS
  179 + if (this.root.pauseVideo) {
  180 + let flag = false
  181 + const id = e.target.id
  182 + for (let i = this.root._videos.length; i--;) {
  183 + if (this.root._videos[i].id === id) {
  184 + flag = true
  185 + } else {
  186 + this.root._videos[i].pause() // 自动暂停其他视频
  187 + }
  188 + }
  189 + // 将自己加入列表
  190 + if (!flag) {
  191 + const ctx = uni.createVideoContext(id
  192 + // #ifndef MP-BAIDU
  193 + , this
  194 + // #endif
  195 + )
  196 + ctx.id = id
  197 + this.root._videos.push(ctx)
  198 + }
  199 + }
  200 + // #endif
  201 + },
  202 +
  203 + /**
  204 + * @description 图片点击事件
  205 + * @param {Event} e
  206 + */
  207 + imgTap (e) {
  208 + const node = this.childs[e.currentTarget.dataset.i]
  209 + if (node.a) {
  210 + this.linkTap(node.a)
  211 + return
  212 + }
  213 + if (node.attrs.ignore) return
  214 + // #ifdef H5 || APP-PLUS
  215 + node.attrs.src = node.attrs.src || node.attrs['data-src']
  216 + // #endif
  217 + this.root.$emit('imgtap', node.attrs)
  218 + // 自动预览图片
  219 + if (this.root.previewImg) {
  220 + uni.previewImage({
  221 + // #ifdef MP-WEIXIN
  222 + showmenu: this.root.showImgMenu,
  223 + // #endif
  224 + // #ifdef MP-ALIPAY
  225 + enablesavephoto: this.root.showImgMenu,
  226 + enableShowPhotoDownload: this.root.showImgMenu,
  227 + // #endif
  228 + current: parseInt(node.attrs.i),
  229 + urls: this.root.imgList
  230 + })
  231 + }
  232 + },
  233 +
  234 + /**
  235 + * @description 图片长按
  236 + */
  237 + imgLongTap (e) {
  238 + // #ifdef APP-PLUS
  239 + const attrs = this.childs[e.currentTarget.dataset.i].attrs
  240 + if (this.opts[3] && !attrs.ignore) {
  241 + uni.showActionSheet({
  242 + itemList: ['保存图片'],
  243 + success: () => {
  244 + const save = path => {
  245 + uni.saveImageToPhotosAlbum({
  246 + filePath: path,
  247 + success () {
  248 + uni.showToast({
  249 + title: '保存成功'
  250 + })
  251 + }
  252 + })
  253 + }
  254 + if (this.root.imgList[attrs.i].startsWith('http')) {
  255 + uni.downloadFile({
  256 + url: this.root.imgList[attrs.i],
  257 + success: res => save(res.tempFilePath)
  258 + })
  259 + } else {
  260 + save(this.root.imgList[attrs.i])
  261 + }
  262 + }
  263 + })
  264 + }
  265 + // #endif
  266 + },
  267 +
  268 + /**
  269 + * @description 图片加载完成事件
  270 + * @param {Event} e
  271 + */
  272 + imgLoad (e) {
  273 + const i = e.currentTarget.dataset.i
  274 + /* #ifndef H5 || (APP-PLUS && VUE2) */
  275 + if (!this.childs[i].w) {
  276 + // 设置原宽度
  277 + this.$set(this.ctrl, i, e.detail.width)
  278 + } else /* #endif */ if ((this.opts[1] && !this.ctrl[i]) || this.ctrl[i] === -1) {
  279 + // 加载完毕,取消加载中占位图
  280 + this.$set(this.ctrl, i, 1)
  281 + }
  282 + },
  283 +
  284 + /**
  285 + * @description 链接点击事件
  286 + * @param {Event} e
  287 + */
  288 + linkTap (e) {
  289 + const node = e.currentTarget ? this.childs[e.currentTarget.dataset.i] : {}
  290 + const attrs = node.attrs || e
  291 + const href = attrs.href
  292 + this.root.$emit('linktap', Object.assign({
  293 + innerText: this.root.getText(node.children || []) // 链接内的文本内容
  294 + }, attrs))
  295 + if (href) {
  296 + if (href[0] === '#') {
  297 + // 跳转锚点
  298 + this.root.navigateTo(href.substring(1)).catch(() => { })
  299 + } else if (href.split('?')[0].includes('://')) {
  300 + // 复制外部链接
  301 + if (this.root.copyLink) {
  302 + // #ifdef H5
  303 + window.open(href)
  304 + // #endif
  305 + // #ifdef MP
  306 + uni.setClipboardData({
  307 + data: href,
  308 + success: () =>
  309 + uni.showToast({
  310 + title: '链接已复制'
  311 + })
  312 + })
  313 + // #endif
  314 + // #ifdef APP-PLUS
  315 + plus.runtime.openWeb(href)
  316 + // #endif
  317 + }
  318 + } else {
  319 + // 跳转页面
  320 + uni.navigateTo({
  321 + url: href,
  322 + fail () {
  323 + uni.switchTab({
  324 + url: href,
  325 + fail () { }
  326 + })
  327 + }
  328 + })
  329 + }
  330 + }
  331 + },
  332 +
  333 + /**
  334 + * @description 错误事件
  335 + * @param {Event} e
  336 + */
  337 + mediaError (e) {
  338 + const i = e.currentTarget.dataset.i
  339 + const node = this.childs[i]
  340 + // 加载其他源
  341 + if (node.name === 'video' || node.name === 'audio') {
  342 + let index = (this.ctrl[i] || 0) + 1
  343 + if (index > node.src.length) {
  344 + index = 0
  345 + }
  346 + if (index < node.src.length) {
  347 + this.$set(this.ctrl, i, index)
  348 + return
  349 + }
  350 + } else if (node.name === 'img') {
  351 + // #ifdef H5 && VUE3
  352 + if (this.opts[0] && !this.ctrl.load) return
  353 + // #endif
  354 + // 显示错误占位图
  355 + if (this.opts[2]) {
  356 + this.$set(this.ctrl, i, -1)
  357 + }
  358 + }
  359 + if (this.root) {
  360 + this.root.$emit('error', {
  361 + source: node.name,
  362 + attrs: node.attrs,
  363 + // #ifndef H5 && VUE3
  364 + errMsg: e.detail.errMsg
  365 + // #endif
  366 + })
  367 + }
  368 + }
  369 + }
  370 +}
  371 +</script>
  372 +<style>
  373 +/* a 标签默认效果 */
  374 +._a {
  375 + padding: 1.5px 0 1.5px 0;
  376 + color: #366092;
  377 + word-break: break-all;
  378 +}
  379 +
  380 +/* a 标签点击态效果 */
  381 +._hover {
  382 + text-decoration: underline;
  383 + opacity: 0.7;
  384 +}
  385 +
  386 +/* 图片默认效果 */
  387 +._img {
  388 + max-width: 100%;
  389 + -webkit-touch-callout: none;
  390 +}
  391 +
  392 +/* 内部样式 */
  393 +
  394 +._block {
  395 + display: block;
  396 +}
  397 +
  398 +._b,
  399 +._strong {
  400 + font-weight: bold;
  401 +}
  402 +
  403 +._code {
  404 + font-family: monospace;
  405 +}
  406 +
  407 +._del {
  408 + text-decoration: line-through;
  409 +}
  410 +
  411 +._em,
  412 +._i {
  413 + font-style: italic;
  414 +}
  415 +
  416 +._h1 {
  417 + font-size: 2em;
  418 +}
  419 +
  420 +._h2 {
  421 + font-size: 1.5em;
  422 +}
  423 +
  424 +._h3 {
  425 + font-size: 1.17em;
  426 +}
  427 +
  428 +._h5 {
  429 + font-size: 0.83em;
  430 +}
  431 +
  432 +._h6 {
  433 + font-size: 0.67em;
  434 +}
  435 +
  436 +._h1,
  437 +._h2,
  438 +._h3,
  439 +._h4,
  440 +._h5,
  441 +._h6 {
  442 + display: block;
  443 + font-weight: bold;
  444 +}
  445 +
  446 +._image {
  447 + height: 1px;
  448 +}
  449 +
  450 +._ins {
  451 + text-decoration: underline;
  452 +}
  453 +
  454 +._li {
  455 + display: list-item;
  456 +}
  457 +
  458 +._ol {
  459 + list-style-type: decimal;
  460 +}
  461 +
  462 +._ol,
  463 +._ul {
  464 + display: block;
  465 + padding-left: 40px;
  466 + margin: 1em 0;
  467 +}
  468 +
  469 +._q::before {
  470 + content: '"';
  471 +}
  472 +
  473 +._q::after {
  474 + content: '"';
  475 +}
  476 +
  477 +._sub {
  478 + font-size: smaller;
  479 + vertical-align: sub;
  480 +}
  481 +
  482 +._sup {
  483 + font-size: smaller;
  484 + vertical-align: super;
  485 +}
  486 +
  487 +._thead,
  488 +._tbody,
  489 +._tfoot {
  490 + display: table-row-group;
  491 +}
  492 +
  493 +._tr {
  494 + display: table-row;
  495 +}
  496 +
  497 +._td,
  498 +._th {
  499 + display: table-cell;
  500 + vertical-align: middle;
  501 +}
  502 +
  503 +._th {
  504 + font-weight: bold;
  505 + text-align: center;
  506 +}
  507 +
  508 +._ul {
  509 + list-style-type: disc;
  510 +}
  511 +
  512 +._ul ._ul {
  513 + margin: 0;
  514 + list-style-type: circle;
  515 +}
  516 +
  517 +._ul ._ul ._ul {
  518 + list-style-type: square;
  519 +}
  520 +
  521 +._abbr,
  522 +._b,
  523 +._code,
  524 +._del,
  525 +._em,
  526 +._i,
  527 +._ins,
  528 +._label,
  529 +._q,
  530 +._span,
  531 +._strong,
  532 +._sub,
  533 +._sup {
  534 + display: inline;
  535 +}
  536 +
  537 +/* #ifdef APP-PLUS */
  538 +._video {
  539 + width: 300px;
  540 + height: 225px;
  541 +}
  542 +/* #endif */
  543 +</style>