From d10fed9d2028e896ad2b516d3562b126e164d3fd Mon Sep 17 00:00:00 2001 From: Areo-Joe <1047726015@qq.com> Date: Wed, 25 Sep 2024 11:25:10 +0800 Subject: [PATCH] fix(tcb-shop): fix cloudbase init guide --- .../cloud-template-checker/index.js | 33 +++++++++++++++ .../index.json | 3 +- .../cloud-template-checker/index.wxml | 21 ++++++++++ .../cloud-template-checker/index.wxss | 37 +++++++++++++++++ .../components/cloud-template-dialog/index.js | 41 ------------------- .../cloud-template-dialog/index.wxml | 13 ------ .../cloud-template-dialog/index.wxss | 27 ------------ miniprogram/tcb-shop/pages/home/home.js | 11 +++++ miniprogram/tcb-shop/pages/home/home.json | 2 +- miniprogram/tcb-shop/pages/home/home.wxml | 35 ++++++++-------- 10 files changed, 122 insertions(+), 101 deletions(-) create mode 100644 miniprogram/tcb-shop/components/cloud-template-checker/index.js rename miniprogram/tcb-shop/components/{cloud-template-dialog => cloud-template-checker}/index.json (56%) create mode 100644 miniprogram/tcb-shop/components/cloud-template-checker/index.wxml create mode 100644 miniprogram/tcb-shop/components/cloud-template-checker/index.wxss delete mode 100644 miniprogram/tcb-shop/components/cloud-template-dialog/index.js delete mode 100644 miniprogram/tcb-shop/components/cloud-template-dialog/index.wxml delete mode 100644 miniprogram/tcb-shop/components/cloud-template-dialog/index.wxss diff --git a/miniprogram/tcb-shop/components/cloud-template-checker/index.js b/miniprogram/tcb-shop/components/cloud-template-checker/index.js new file mode 100644 index 0000000..8ec8e78 --- /dev/null +++ b/miniprogram/tcb-shop/components/cloud-template-checker/index.js @@ -0,0 +1,33 @@ +Component({ + properties: { + show: { + type: Boolean, + value: false, + }, + text: { + type: String, + value: "" + }, + url: { + type: String, + value: "" + } + }, + + methods: { + check() { + this.triggerEvent("check"); + }, + copy() { + wx.setClipboardData({ + data: this.data.url, + }); + }, + }, + + lifetimes: { + attached: function () { + this.check(); + }, + }, +}); diff --git a/miniprogram/tcb-shop/components/cloud-template-dialog/index.json b/miniprogram/tcb-shop/components/cloud-template-checker/index.json similarity index 56% rename from miniprogram/tcb-shop/components/cloud-template-dialog/index.json rename to miniprogram/tcb-shop/components/cloud-template-checker/index.json index 677ffc2..0de7767 100644 --- a/miniprogram/tcb-shop/components/cloud-template-dialog/index.json +++ b/miniprogram/tcb-shop/components/cloud-template-checker/index.json @@ -2,8 +2,7 @@ "component": true, "styleIsolation": "shared", "usingComponents": { - "t-dialog": "tdesign-miniprogram/dialog/dialog", "t-button": "tdesign-miniprogram/button/button", - "t-radio": "tdesign-miniprogram/radio/radio" + "t-icon": "tdesign-miniprogram/icon/icon" } } \ No newline at end of file diff --git a/miniprogram/tcb-shop/components/cloud-template-checker/index.wxml b/miniprogram/tcb-shop/components/cloud-template-checker/index.wxml new file mode 100644 index 0000000..3952bb0 --- /dev/null +++ b/miniprogram/tcb-shop/components/cloud-template-checker/index.wxml @@ -0,0 +1,21 @@ + + + + + 加载数据失败 + + + {{text}} + + + {{url}} + + 复制链接 + 再试一次 + + + + + + + \ No newline at end of file diff --git a/miniprogram/tcb-shop/components/cloud-template-checker/index.wxss b/miniprogram/tcb-shop/components/cloud-template-checker/index.wxss new file mode 100644 index 0000000..8ff282f --- /dev/null +++ b/miniprogram/tcb-shop/components/cloud-template-checker/index.wxss @@ -0,0 +1,37 @@ +.cloud-checker-container { + display: flex; + justify-content: center; + align-items: center; +} + +.cloud-checker-container .card { + padding: 60rpx; +} + +.cloud-checker-container .text { + text-align: center; + margin: 20rpx; +} +.cloud-checker-container .url { + word-break: break-all; + font-size: small; + color: #3f3f3f; +} + +.cloud-checker-container .icon-text { + display: flex; + justify-content: center; + align-items: center; +} + +.cloud-checker-container .t-icon { + color: red; + margin-right: 5rpx; +} + +.cloud-checker-container .btns { + margin-top: 40rpx; + display: flex; + justify-content: center; + align-items: center; +} \ No newline at end of file diff --git a/miniprogram/tcb-shop/components/cloud-template-dialog/index.js b/miniprogram/tcb-shop/components/cloud-template-dialog/index.js deleted file mode 100644 index cb0422b..0000000 --- a/miniprogram/tcb-shop/components/cloud-template-dialog/index.js +++ /dev/null @@ -1,41 +0,0 @@ -const NEVER_SHOW_KEY = 'never_show_cloud_template_init_dialog'; - -Component({ - properties: { - show: { - type: Boolean, - value: true, - }, - url: { - type: String, - value: '', - }, - }, - - data: { checked: false }, - - methods: { - close() { - if (this.data.checked) { - wx.setStorageSync(NEVER_SHOW_KEY, 'true'); - } - }, - copy() { - wx.setClipboardData({ - data: this.data.url, - }); - }, - neverShowChanged({ detail: { checked } }) { - this.setData({ checked }); - }, - }, - - lifetimes: { - attached: function () { - const ifNever = wx.getStorageSync(NEVER_SHOW_KEY); - this.setData({ - show: ifNever !== 'true', - }); - }, - }, -}); diff --git a/miniprogram/tcb-shop/components/cloud-template-dialog/index.wxml b/miniprogram/tcb-shop/components/cloud-template-dialog/index.wxml deleted file mode 100644 index 9e4a11e..0000000 --- a/miniprogram/tcb-shop/components/cloud-template-dialog/index.wxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - {{url}} - - - - 复制 - - - - \ No newline at end of file diff --git a/miniprogram/tcb-shop/components/cloud-template-dialog/index.wxss b/miniprogram/tcb-shop/components/cloud-template-dialog/index.wxss deleted file mode 100644 index 9089da6..0000000 --- a/miniprogram/tcb-shop/components/cloud-template-dialog/index.wxss +++ /dev/null @@ -1,27 +0,0 @@ -.url-container text { - word-break: break-all; -} - -.btns { - display: flex; - justify-content: center; - align-items: center; - gap: 10px; -} - -.template-btn { - flex-grow: 1; -} - -.template-dialog .t-dialog { - margin-bottom: 20px; -} - - -.template-dialog .t-dialog__footer { - display: none; -} - -.template-dialog .t-radio--block { - padding-left: 0; -} \ No newline at end of file diff --git a/miniprogram/tcb-shop/pages/home/home.js b/miniprogram/tcb-shop/pages/home/home.js index d67e201..4a22118 100644 --- a/miniprogram/tcb-shop/pages/home/home.js +++ b/miniprogram/tcb-shop/pages/home/home.js @@ -17,6 +17,7 @@ Page({ interval: 5000, navigation: { type: 'dots' }, swiperImageProps: { mode: 'scaleToFill' }, + cloudCheckerShow: false }, goodListPagination: { @@ -128,4 +129,14 @@ Page({ url: `/pages/promotion-detail/index?promotion_id=${promotionID}`, }); }, + + async onCloudCheck() { + try { + await getHomeSwiper(); + this.setData({ cloudCheckerShow: false }) + } catch (e) { + console.log(e); + this.setData({ cloudCheckerShow: true }) + } + }, }); diff --git a/miniprogram/tcb-shop/pages/home/home.json b/miniprogram/tcb-shop/pages/home/home.json index 8df2da4..fae6a81 100644 --- a/miniprogram/tcb-shop/pages/home/home.json +++ b/miniprogram/tcb-shop/pages/home/home.json @@ -15,6 +15,6 @@ "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", "goods-list": "/components/goods-list/index", "load-more": "/components/load-more/index", - "cloud-template-dialog": "/components/cloud-template-dialog/index" + "cloud-template-checker": "/components/cloud-template-checker/index" } } \ No newline at end of file diff --git a/miniprogram/tcb-shop/pages/home/home.wxml b/miniprogram/tcb-shop/pages/home/home.wxml index c953bac..d40c51f 100644 --- a/miniprogram/tcb-shop/pages/home/home.wxml +++ b/miniprogram/tcb-shop/pages/home/home.wxml @@ -1,19 +1,20 @@ - - - - - - - - + + + - - + + + + + + + + + - - - - - - - \ No newline at end of file + + + + + + \ No newline at end of file