From cbf7c00399fc9627b6b8b2cedf4d3aef5e9c2ab5 Mon Sep 17 00:00:00 2001 From: itgaojian163 Date: Mon, 24 Mar 2025 18:05:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 5 +- app.wxss | 75 +-- components/ad-popup/ad-popup.wxml | 2 +- components/ad-popup/ad-popup.wxss | 2 +- .../container-loading/container-loading.js | 30 + .../container-loading/container-loading.json | 4 + .../container-loading/container-loading.wxml | 9 + .../container-loading/container-loading.wxss | 60 ++ components/content-loading/loading.js | 24 + components/content-loading/loading.json | 4 + components/content-loading/loading.wxml | 4 + components/content-loading/loading.wxss | 54 ++ components/empty/empty.js | 23 + components/empty/empty.json | 4 + components/empty/empty.wxml | 5 + components/empty/empty.wxss | 24 + .../fui-bottom-popup/fui-bottom-popup.js | 40 ++ .../fui-bottom-popup/fui-bottom-popup.json | 3 + .../fui-bottom-popup/fui-bottom-popup.wxml | 5 + .../fui-bottom-popup/fui-bottom-popup.wxss | 36 ++ components/loading/pageloading.js | 23 + components/loading/pageloading.json | 4 + components/loading/pageloading.wxml | 5 + components/loading/pageloading.wxss | 24 + components/mp-html/index.js | 152 +++++ components/mp-html/index.json | 1 + components/mp-html/index.wxml | 4 + components/mp-html/index.wxss | 11 + components/mp-html/node/node.js | 147 +++++ components/mp-html/node/node.json | 1 + components/mp-html/node/node.wxml | 34 ++ components/mp-html/node/node.wxss | 157 +++++ components/mp-html/parser.js | 537 ++++++++++++++++++ components/page-loading/page-loading.js | 24 + components/page-loading/page-loading.json | 4 + components/page-loading/page-loading.wxml | 4 + components/page-loading/page-loading.wxss | 55 ++ pages/copyright/createBuy/createBuy.js | 10 +- pages/copyright/createBuy/createBuy.wxml | 163 +++++- pages/copyright/createBuy/createBuy.wxss | 109 +++- .../createProjectInfo/createProjectInfo.js | 22 + .../createProjectInfo/createProjectInfo.wxml | 40 +- .../createProjectInfo/createProjectInfo.wxss | 69 ++- pages/copyright/payment/payment.js | 65 +++ pages/copyright/payment/payment.json | 3 + pages/copyright/payment/payment.wxml | 91 +++ pages/copyright/payment/payment.wxss | 230 ++++++++ pages/index/index.js | 57 +- pages/index/index.json | 4 +- pages/index/index.wxml | 144 ++--- pages/index/index.wxss | 71 ++- pages/login/login.wxss | 27 + pages/mine/mine.js | 15 +- pages/mine/mine.wxml | 64 ++- pages/mine/mine.wxss | 86 ++- static/images/bg_mine.jpeg | Bin 0 -> 241112 bytes static/images/ic_arrow_down.png | Bin 0 -> 629 bytes static/images/ic_calendar.png | Bin 0 -> 835 bytes static/images/ic_card_pay.png | Bin 0 -> 541 bytes static/images/ic_check_fit.png | Bin 836 -> 720 bytes static/images/ic_coupon.png | Bin 0 -> 932 bytes static/images/ic_wechat_pay.png | Bin 0 -> 1566 bytes static/images/load_err.png | Bin 0 -> 16724 bytes 63 files changed, 2597 insertions(+), 273 deletions(-) create mode 100644 components/container-loading/container-loading.js create mode 100644 components/container-loading/container-loading.json create mode 100644 components/container-loading/container-loading.wxml create mode 100644 components/container-loading/container-loading.wxss create mode 100644 components/content-loading/loading.js create mode 100644 components/content-loading/loading.json create mode 100644 components/content-loading/loading.wxml create mode 100644 components/content-loading/loading.wxss create mode 100644 components/empty/empty.js create mode 100644 components/empty/empty.json create mode 100644 components/empty/empty.wxml create mode 100644 components/empty/empty.wxss create mode 100755 components/fui-bottom-popup/fui-bottom-popup.js create mode 100755 components/fui-bottom-popup/fui-bottom-popup.json create mode 100755 components/fui-bottom-popup/fui-bottom-popup.wxml create mode 100755 components/fui-bottom-popup/fui-bottom-popup.wxss create mode 100644 components/loading/pageloading.js create mode 100644 components/loading/pageloading.json create mode 100644 components/loading/pageloading.wxml create mode 100644 components/loading/pageloading.wxss create mode 100644 components/mp-html/index.js create mode 100644 components/mp-html/index.json create mode 100644 components/mp-html/index.wxml create mode 100644 components/mp-html/index.wxss create mode 100644 components/mp-html/node/node.js create mode 100644 components/mp-html/node/node.json create mode 100644 components/mp-html/node/node.wxml create mode 100644 components/mp-html/node/node.wxss create mode 100644 components/mp-html/parser.js create mode 100644 components/page-loading/page-loading.js create mode 100644 components/page-loading/page-loading.json create mode 100644 components/page-loading/page-loading.wxml create mode 100644 components/page-loading/page-loading.wxss create mode 100644 pages/copyright/payment/payment.js create mode 100644 pages/copyright/payment/payment.json create mode 100644 pages/copyright/payment/payment.wxml create mode 100644 pages/copyright/payment/payment.wxss create mode 100644 static/images/bg_mine.jpeg create mode 100644 static/images/ic_arrow_down.png create mode 100644 static/images/ic_calendar.png create mode 100644 static/images/ic_card_pay.png create mode 100644 static/images/ic_coupon.png create mode 100644 static/images/ic_wechat_pay.png create mode 100644 static/images/load_err.png diff --git a/app.json b/app.json index 42529a2..c4dd00d 100644 --- a/app.json +++ b/app.json @@ -5,8 +5,9 @@ "pages/treaty/privacy/privacy", "pages/treaty/service/service", "pages/mine/mine", - "pages/copyright/create/create", - "pages/copyright/createBuy/createBuy" + "pages/copyright/createProjectInfo/createProjectInfo", + "pages/copyright/createBuy/createBuy", + "pages/copyright/payment/payment" ], "window": { "navigationBarTextStyle": "black", diff --git a/app.wxss b/app.wxss index 8c28c20..719fe50 100644 --- a/app.wxss +++ b/app.wxss @@ -1,6 +1,12 @@ /**自定义CheckBox**/ page { - background-color: white; + background-color: #FAFAFA; +} + +.page-container { + display: flex; + flex-direction: column; + padding: 20rpx; } ::-webkit-scrollbar { @@ -13,43 +19,16 @@ page { .custom-navbar { display: flex; align-items: center; - padding-left: 16px; - padding-right: 16px; - background-color: #ffffff; - box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.05); + padding-left: 20rpx; + padding-right: 20rpx; + background-color: transparent; + /* box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.05); */ } /* 标题 */ .navbar-title { - font-size: 18px; - font-weight: bold; - color: #000000; -} - -wx-checkbox .wx-checkbox-input.wx-checkbox-input-checked { - color: #fff !important; - background-color: #3F72FF; - border: 2rpx solid #3F72FF -} - -wx-checkbox .wx-checkbox-input { - /*margin-right: 10rpx;*/ - -webkit-appearance: none; - appearance: none; - outline: 0; - text-indent: 0; - border-radius: 50%; - width: 40rpx; - height: 40rpx; - background-color: transparent; - position: relative; - border: 1rpx solid rgb(85, 85, 85); - box-sizing: border-box; -} - -/*钩大小*/ -wx-checkbox .wx-checkbox-input.wx-checkbox-input-checked:before { font-size: 36rpx; + font-weight: bold; } /***End***/ @@ -72,6 +51,10 @@ wx-checkbox .wx-checkbox-input.wx-checkbox-input-checked:before { margin-left: 10rpx; } +.ml-20 { + margin-left: 20rpx; +} + .mb-10 { margin-bottom: 10rpx; } @@ -104,6 +87,32 @@ wx-checkbox .wx-checkbox-input.wx-checkbox-input-checked:before { padding: 10rpx; } +.mg-20 { + margin: 20rpx; +} + +.mg-40 { + margin: 40rpx; +} + +.pd-20 { + padding: 20rpx; +} + +.pd-40 { + padding: 40rpx; +} + +.border-left { + border-top-left-radius: 5rpx; + border-bottom-left-radius: 5rpx; +} + +.border-right { + border-top-right-radius: 5rpx; + border-bottom-right-radius: 5rpx; +} + .divider-v { margin-top: 5rpx; width: 90%; diff --git a/components/ad-popup/ad-popup.wxml b/components/ad-popup/ad-popup.wxml index ec93774..b538f78 100644 --- a/components/ad-popup/ad-popup.wxml +++ b/components/ad-popup/ad-popup.wxml @@ -1,6 +1,6 @@ - + × \ No newline at end of file diff --git a/components/ad-popup/ad-popup.wxss b/components/ad-popup/ad-popup.wxss index ea2bdab..c8fc2d0 100644 --- a/components/ad-popup/ad-popup.wxss +++ b/components/ad-popup/ad-popup.wxss @@ -19,7 +19,7 @@ overflow: hidden; } -.ad-content image { +.ad-content .img { width: 100%; height: 300rpx; } diff --git a/components/container-loading/container-loading.js b/components/container-loading/container-loading.js new file mode 100644 index 0000000..3b60416 --- /dev/null +++ b/components/container-loading/container-loading.js @@ -0,0 +1,30 @@ +// components/container-loading/container-loading.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + loadingState: { + type: String, + value: 'loading' + } + }, + observers: { + 'loadingState': function (newVal) { + this.setData({ + loadingVisible: newVal + }); + } + }, + data: { + loadingVisible: 'loading' + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) \ No newline at end of file diff --git a/components/container-loading/container-loading.json b/components/container-loading/container-loading.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/container-loading/container-loading.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/container-loading/container-loading.wxml b/components/container-loading/container-loading.wxml new file mode 100644 index 0000000..e5213fd --- /dev/null +++ b/components/container-loading/container-loading.wxml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/components/container-loading/container-loading.wxss b/components/container-loading/container-loading.wxss new file mode 100644 index 0000000..0234462 --- /dev/null +++ b/components/container-loading/container-loading.wxss @@ -0,0 +1,60 @@ +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + width: 100%; + min-height: 200rpx; +} + +.loading { + position: relative; + width: 40px; + border-radius: 20px; + perspective: 500px; + align-self: center; + margin-top: 80rpx; +} + +.loading:before, +.loading:after { + position: absolute; + width: 15px; + height: 15px; + content: ""; + border-radius: 20px; + animation: jumping 0.5s infinite alternate; + background: rgba(0, 0, 0, 0); +} + +.loading:before { + left: 0; +} + +.loading:after { + right: 0; + animation-delay: 0.15s; +} + +.loading_err { + display: flex; + flex-direction: row; + justify-content: center; + width: 150px; + align-items: center; + height: 100px; + align-self: center; +} + +@keyframes jumping { + 0% { + transform: scale(1) translateY(0px) rotateX(0deg); + box-shadow: 0 0 0 rgba(0, 0, 0, 0); + } + + 100% { + transform: scale(1.2) translateY(-25px) rotateX(45deg); + background: #FE9944; + box-shadow: 0 25px 40px #FE9944; + } +} \ No newline at end of file diff --git a/components/content-loading/loading.js b/components/content-loading/loading.js new file mode 100644 index 0000000..fa59c26 --- /dev/null +++ b/components/content-loading/loading.js @@ -0,0 +1,24 @@ +// components/content-loading/loading.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) \ No newline at end of file diff --git a/components/content-loading/loading.json b/components/content-loading/loading.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/content-loading/loading.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/content-loading/loading.wxml b/components/content-loading/loading.wxml new file mode 100644 index 0000000..61243fc --- /dev/null +++ b/components/content-loading/loading.wxml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/components/content-loading/loading.wxss b/components/content-loading/loading.wxss new file mode 100644 index 0000000..a00a816 --- /dev/null +++ b/components/content-loading/loading.wxss @@ -0,0 +1,54 @@ +/* components/content-loading/loading.wxss */ +/* components/page-loading/page-loading.wxss */ +.page-body { + width: 100vw; + height: 100vh; + background-color: rgba(255, 255, 255, 1); + z-index: 1; + position: absolute; + top: 0; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + flex: 1; +} + +.loading { + position: relative; + width: 50px; + border-radius: 25px; +} + +.loading:before, +.loading:after { + position: absolute; + width: 20px; + height: 20px; + content: ""; + border-radius: 20px; + animation: jumping 0.5s infinite alternate; + background: rgba(0, 0, 0, 0); +} + +.loading:before { + left: 0; +} + +.loading:after { + right: 0; + animation-delay: 0.15s; +} + +@keyframes jumping { + 0% { + transform: scale(1) translateY(0px) rotateX(0deg); + box-shadow: 0 0 0 rgba(0, 0, 0, 0); + } + + 100% { + transform: scale(1.2) translateY(-25px) rotateX(45deg); + background: #256742; + box-shadow: 0 25px 40px #256742; + } +} \ No newline at end of file diff --git a/components/empty/empty.js b/components/empty/empty.js new file mode 100644 index 0000000..9fe184b --- /dev/null +++ b/components/empty/empty.js @@ -0,0 +1,23 @@ +// components/empty/empty.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/components/empty/empty.json b/components/empty/empty.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/components/empty/empty.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/empty/empty.wxml b/components/empty/empty.wxml new file mode 100644 index 0000000..5c056ae --- /dev/null +++ b/components/empty/empty.wxml @@ -0,0 +1,5 @@ + + + + 暂无数据 + \ No newline at end of file diff --git a/components/empty/empty.wxss b/components/empty/empty.wxss new file mode 100644 index 0000000..d7792cf --- /dev/null +++ b/components/empty/empty.wxss @@ -0,0 +1,24 @@ +/* components/empty/empty.wxss */ +.data-empty { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + text-align: center; + align-self: center; + + position: fixed; + top: 50%; + left: 50%; + transform: translateX(-50%)translateY(-50%); +} + +.data-empty image { + width: 180rpx; + height: 120rpx; +} + +.data-empty .hint { + margin-top: 30rpx; + font-size: 32rpx; +} \ No newline at end of file diff --git a/components/fui-bottom-popup/fui-bottom-popup.js b/components/fui-bottom-popup/fui-bottom-popup.js new file mode 100755 index 0000000..59351fc --- /dev/null +++ b/components/fui-bottom-popup/fui-bottom-popup.js @@ -0,0 +1,40 @@ +Component({ + properties: { + show: { + type: Boolean, + value: false + }, + //背景颜色 + background: { + type: String, + value: '#fff' + }, + //圆角 + radius: { + type: Number, + optionalTypes: [String], + value: 24 + }, + zIndex: { + type: Number, + optionalTypes: [String], + value: 1001 + }, + //点击遮罩 是否可关闭 + maskClosable: { + type: Boolean, + value: true + }, + maskBackground: { + type: String, + value: 'rgba(0,0,0,.6)' + } + }, + methods: { + handleClose(e) { + if (!this.data.maskClosable) return; + this.triggerEvent('close', {}); + }, + stop(e) {} + } +}) \ No newline at end of file diff --git a/components/fui-bottom-popup/fui-bottom-popup.json b/components/fui-bottom-popup/fui-bottom-popup.json new file mode 100755 index 0000000..32640e0 --- /dev/null +++ b/components/fui-bottom-popup/fui-bottom-popup.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/fui-bottom-popup/fui-bottom-popup.wxml b/components/fui-bottom-popup/fui-bottom-popup.wxml new file mode 100755 index 0000000..81c5a4a --- /dev/null +++ b/components/fui-bottom-popup/fui-bottom-popup.wxml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/components/fui-bottom-popup/fui-bottom-popup.wxss b/components/fui-bottom-popup/fui-bottom-popup.wxss new file mode 100755 index 0000000..e352b42 --- /dev/null +++ b/components/fui-bottom-popup/fui-bottom-popup.wxss @@ -0,0 +1,36 @@ +.fui-bottom__popup-wrap { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 1001; + display: flex; + flex-direction: row; + align-items: flex-end; + justify-content: center; + transition: all ease-in-out .2s; + visibility: hidden; + opacity: 0; + overflow: hidden; +} + +.fui-bottom__popwrap-show { + opacity: 1; + visibility: visible; +} + +.fui-bottom__popup { + width: 100%; + transform: translate3d(0, 100%, 0); + transition: all 0.3s ease-in-out; + min-height: 20rpx; + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + flex: 1; + overflow: hidden; +} + +.fui-bottom__popup-show { + transform: translate3d(0, 0, 0); +} \ No newline at end of file diff --git a/components/loading/pageloading.js b/components/loading/pageloading.js new file mode 100644 index 0000000..7c20516 --- /dev/null +++ b/components/loading/pageloading.js @@ -0,0 +1,23 @@ +// components/loading/pageloading.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/components/loading/pageloading.json b/components/loading/pageloading.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/loading/pageloading.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/loading/pageloading.wxml b/components/loading/pageloading.wxml new file mode 100644 index 0000000..2115a2b --- /dev/null +++ b/components/loading/pageloading.wxml @@ -0,0 +1,5 @@ + + + + 加载中... + \ No newline at end of file diff --git a/components/loading/pageloading.wxss b/components/loading/pageloading.wxss new file mode 100644 index 0000000..f36fd23 --- /dev/null +++ b/components/loading/pageloading.wxss @@ -0,0 +1,24 @@ +/* components/loading/pageloading.wxss */ +.page-loading-box { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + /* background: rgba(255, 255, 255, 1); */ + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + z-index: 99; +} + +.page-loading-box image { + width: 128rpx; + height: 128rpx; +} + +.page-loading-box .text { + margin-top: 20rpx; + font-size: 28rpx; +} \ No newline at end of file diff --git a/components/mp-html/index.js b/components/mp-html/index.js new file mode 100644 index 0000000..d2cfa0a --- /dev/null +++ b/components/mp-html/index.js @@ -0,0 +1,152 @@ +"use strict"; + +function e(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e +} +/*! + * mp-html v2.5.0 + * https://github.com/jin-yufeng/mp-html + * + * Released under the MIT license + * Author: Jin Yufeng + */ +var t = require("./parser"), + n = []; +Component({ + data: { + nodes: [] + }, + properties: { + containerStyle: String, + content: { + type: String, + value: "", + observer: function (e) { + this.setContent(e) + } + }, + copyLink: { + type: Boolean, + value: !0 + }, + domain: String, + errorImg: String, + lazyLoad: Boolean, + loadingImg: String, + pauseVideo: { + type: Boolean, + value: !0 + }, + previewImg: { + type: null, + value: !0 + }, + scrollTable: Boolean, + selectable: null, + setTitle: { + type: Boolean, + value: !0 + }, + showImgMenu: { + type: Boolean, + value: !0 + }, + tagStyle: Object, + useAnchor: null + }, + created: function () { + this.plugins = []; + for (var e = n.length; e--;) this.plugins.push(new n[e](this)) + }, + detached: function () { + this._hook("onDetached") + }, + methods: { + in: function (e, t, n) { + e && t && n && (this._in = { + page: e, + selector: t, + scrollTop: n + }) + }, + navigateTo: function (t, n) { + var i = this; + return new Promise(function (o, r) { + if (!i.data.useAnchor) return void r(Error("Anchor is disabled")); + var a = wx.createSelectorQuery().in(i._in ? i._in.page : i).select((i._in ? i._in.selector : "._root") + (t ? "".concat(">>>", "#").concat(t) : "")).boundingClientRect(); + i._in ? a.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect() : a.selectViewport().scrollOffset(), a.exec(function (t) { + if (!t[0]) return void r(Error("Label not found")); + var a = t[1].scrollTop + t[0].top - (t[2] ? t[2].top : 0) + (n || parseInt(i.data.useAnchor) || 0); + i._in ? i._in.page.setData(e({}, i._in.scrollTop, a)) : wx.pageScrollTo({ + scrollTop: a, + duration: 300 + }), o() + }) + }) + }, + getText: function (e) { + var t = ""; + return function e(n) { + for (var i = 0; i < n.length; i++) { + var o = n[i]; + if ("text" === o.type) t += o.text.replace(/&/g, "&"); + else if ("br" === o.name) t += "\n"; + else { + var r = "p" === o.name || "div" === o.name || "tr" === o.name || "li" === o.name || "h" === o.name[0] && o.name[1] > "0" && o.name[1] < "7"; + r && t && "\n" !== t[t.length - 1] && (t += "\n"), o.children && e(o.children), r && "\n" !== t[t.length - 1] ? t += "\n" : "td" !== o.name && "th" !== o.name || (t += "\t") + } + } + }(e || this.data.nodes), t + }, + getRect: function () { + var e = this; + return new Promise(function (t, n) { + wx.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function (e) { + return e[0] ? t(e[0]) : n(Error("Root label not found")) + }) + }) + }, + pauseMedia: function () { + for (var e = (this._videos || []).length; e--;) this._videos[e].pause() + }, + setPlaybackRate: function (e) { + this.playbackRate = e; + for (var t = (this._videos || []).length; t--;) this._videos[t].playbackRate(e) + }, + setContent: function (e, n) { + var i = this; + this.imgList && n || (this.imgList = []), this._videos = []; + var o = {}, + r = new t(this).parse(e); + if (n) + for (var a = this.data.nodes.length, s = r.length; s--;) o["nodes[".concat(a + s, "]")] = r[s]; + else o.nodes = r; + if (this.setData(o, function () { + i._hook("onLoad"), i.triggerEvent("load") + }), this.data.lazyLoad || this.imgList._unloadimgs < this.imgList.length / 2) { + var l = 0, + c = function e(t) { + t && t.height || (t = {}), t.height === l ? i.triggerEvent("ready", t) : (l = t.height, setTimeout(function () { + i.getRect().then(e).catch(e) + }, 350)) + }; + this.getRect().then(c).catch(c) + } else this.imgList._unloadimgs || this.getRect().then(function (e) { + i.triggerEvent("ready", e) + }).catch(function () { + i.triggerEvent("ready", {}) + }) + }, + _hook: function (e) { + for (var t = n.length; t--;) this.plugins[t][e] && this.plugins[t][e]() + }, + _add: function (e) { + e.detail.root = this + } + } +}); \ No newline at end of file diff --git a/components/mp-html/index.json b/components/mp-html/index.json new file mode 100644 index 0000000..36b626e --- /dev/null +++ b/components/mp-html/index.json @@ -0,0 +1 @@ +{"component":true,"usingComponents":{"node":"./node/node"}} \ No newline at end of file diff --git a/components/mp-html/index.wxml b/components/mp-html/index.wxml new file mode 100644 index 0000000..9b84cb1 --- /dev/null +++ b/components/mp-html/index.wxml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/components/mp-html/index.wxss b/components/mp-html/index.wxss new file mode 100644 index 0000000..d1fbe4d --- /dev/null +++ b/components/mp-html/index.wxss @@ -0,0 +1,11 @@ +._root { + padding: 1px 0; + overflow-x: auto; + overflow-y: hidden; + -webkit-overflow-scrolling: touch +} + +._select { + -webkit-user-select: text; + user-select: text +} \ No newline at end of file diff --git a/components/mp-html/node/node.js b/components/mp-html/node/node.js new file mode 100644 index 0000000..e97ca31 --- /dev/null +++ b/components/mp-html/node/node.js @@ -0,0 +1,147 @@ +"use strict"; + +function t(t, e) { + var r = Object.keys(t); + if (Object.getOwnPropertySymbols) { + var i = Object.getOwnPropertySymbols(t); + e && (i = i.filter(function (e) { + return Object.getOwnPropertyDescriptor(t, e).enumerable + })), r.push.apply(r, i) + } + return r +} + +function e(e) { + for (var i = 1; i < arguments.length; i++) { + var o = null != arguments[i] ? arguments[i] : {}; + i % 2 ? t(Object(o), !0).forEach(function (t) { + r(e, t, o[t]) + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : t(Object(o)).forEach(function (t) { + Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(o, t)) + }) + } + return e +} + +function r(t, e, r) { + return e in t ? Object.defineProperty(t, e, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }) : t[e] = r, t +} +Component({ + data: { + ctrl: {}, + // isiOS: wx.getSystemInfoSync().system.includes("iOS") + isiOS: wx.getDeviceInfo().system.includes("iOS") + }, + properties: { + childs: Array, + opts: Array + }, + options: { + addGlobalClass: !0 + }, + attached: function () { + this.triggerEvent("add", this, { + bubbles: !0, + composed: !0 + }) + }, + methods: { + noop: function () {}, + getNode: function (t) { + try { + for (var e = t.split("_"), r = this.data.childs[e[0]], i = 1; i < e.length; i++) r = r.children[e[i]]; + return r + } catch (t) { + return { + text: "", + attrs: {}, + children: [] + } + } + }, + play: function (t) { + var r = t.target.dataset.i, + i = this.getNode(r); + if (this.root.triggerEvent("play", { + source: i.name, + attrs: e(e({}, i.attrs), {}, { + src: i.src[this.data.ctrl[r] || 0] + }) + }), this.root.data.pauseVideo) { + for (var o = !1, s = t.target.id, a = this.root._videos.length; a--;) this.root._videos[a].id === s ? o = !0 : this.root._videos[a].pause(); + if (!o) { + var n = wx.createVideoContext(s, this); + n.id = s, this.root.playbackRate && n.playbackRate(this.root.playbackRate), this.root._videos.push(n) + } + } + }, + imgTap: function (t) { + var e = this.getNode(t.target.dataset.i); + if (e.a) return this.linkTap(e.a); + if (!e.attrs.ignore && (this.root.triggerEvent("imgtap", e.attrs), this.root.data.previewImg)) { + var r = this.root.imgList[e.i]; + wx.previewImage({ + showmenu: this.root.data.showImgMenu, + current: r, + urls: this.root.imgList + }) + } + }, + imgLoad: function (t) { + var e, i = t.target.dataset.i, + o = this.getNode(i); + o.w ? (this.data.opts[1] && !this.data.ctrl[i] || -1 === this.data.ctrl[i]) && (e = 1) : e = t.detail.width, e && this.setData(r({}, "ctrl." + i, e)), this.checkReady() + }, + checkReady: function () { + var t = this; + this.root.data.lazyLoad || (this.root.imgList._unloadimgs -= 1, this.root.imgList._unloadimgs || setTimeout(function () { + t.root.getRect().then(function (e) { + t.root.triggerEvent("ready", e) + }).catch(function () { + t.root.triggerEvent("ready", {}) + }) + }, 350)) + }, + linkTap: function (t) { + var e = t.currentTarget ? this.getNode(t.currentTarget.dataset.i) : {}, + r = e.attrs || t, + i = r.href; + this.root.triggerEvent("linktap", Object.assign({ + innerText: this.root.getText(e.children || []) + }, r)), i && ("#" === i[0] ? this.root.navigateTo(i.substring(1)).catch(function () {}) : i.split("?")[0].includes("://") ? this.root.data.copyLink && wx.setClipboardData({ + data: i, + success: function () { + return wx.showToast({ + title: "链接已复制" + }) + } + }) : wx.navigateTo({ + url: i, + fail: function () { + wx.switchTab({ + url: i, + fail: function () {} + }) + } + })) + }, + mediaError: function (t) { + var e = t.target.dataset.i, + i = this.getNode(e); + if ("video" === i.name || "audio" === i.name) { + var o = (this.data.ctrl[e] || 0) + 1; + if (o > i.src.length && (o = 0), o < i.src.length) return this.setData(r({}, "ctrl." + e, o)) + } else "img" === i.name && (this.data.opts[2] && this.setData(r({}, "ctrl." + e, -1)), this.checkReady()); + this.root && this.root.triggerEvent("error", { + source: i.name, + attrs: i.attrs, + errMsg: t.detail.errMsg + }) + } + } +}); \ No newline at end of file diff --git a/components/mp-html/node/node.json b/components/mp-html/node/node.json new file mode 100644 index 0000000..36f7ff7 --- /dev/null +++ b/components/mp-html/node/node.json @@ -0,0 +1 @@ +{"component":true,"usingComponents":{"node":"./node"}} \ No newline at end of file diff --git a/components/mp-html/node/node.wxml b/components/mp-html/node/node.wxml new file mode 100644 index 0000000..8548380 --- /dev/null +++ b/components/mp-html/node/node.wxml @@ -0,0 +1,34 @@ + + var e = { abbr: !0, b: !0, big: !0, code: !0, del: !0, em: !0, i: !0, ins: !0, label: !0, q: !0, small: !0, span: !0, strong: !0, sub: !0, sup: !0 }; module.exports = function (n, i) { return e[n] || -1 !== (i || "").indexOf("inline") }; + +