From fa70ad608a52fe0ff3e452bc1fd4f5e32b711833 Mon Sep 17 00:00:00 2001 From: jaylen <350683609@qq.com> Date: Sun, 27 Nov 2022 16:58:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9$t=E4=B8=BA$tn=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=83=A8=E5=88=86=E5=87=BD=E6=95=B0api=E7=9A=84?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 8196 -> 10244 bytes basicPage/color/color.vue | 4 +- basicPage/grid-layout/grid-layout.vue | 2 +- basicPage/icon/icon.vue | 2 +- basicPage/utils/color/index.vue | 26 +- basicPage/utils/message/index.vue | 50 +- basicPage/utils/number/index.vue | 46 +- basicPage/utils/string/index.vue | 22 +- componentsPage/action-sheet/action-sheet.vue | 4 +- componentsPage/fab/fab.vue | 4 +- componentsPage/form/form.vue | 28 +- componentsPage/goods-nav/goods-nav.vue | 214 ++--- componentsPage/image-upload/image-upload.vue | 4 +- componentsPage/keyboard/keyboard.vue | 16 +- componentsPage/lazy-load/lazy-load.vue | 166 ++-- componentsPage/modal/modal.vue | 4 +- componentsPage/picker/picker.vue | 2 +- componentsPage/scroll-list/scroll-list.vue | 6 +- componentsPage/select/select.vue | 2 +- componentsPage/sign-board/sign-board.vue | 4 +- componentsPage/swipe-action/swipe-action.vue | 6 +- componentsPage/tips/tips.vue | 4 +- componentsPage/toast/toast.vue | 4 +- .../verification-code/verification-code.vue | 14 +- libs/components/dynamic-demo-template.vue | 6 +- libs/mixin/template_page_mixin.js | 6 +- main.js | 8 +- mock/components_page.js | 28 +- pages/basic/basic.vue | 2 +- pages/components/components.vue | 2 +- pages/template/template.vue | 2 +- pages/tuniao/tuniao.vue | 897 +++++++++++------- store/{$t.mixin.js => $tn.mixin.js} | 6 +- templatePage/animate/bubble/bubble.vue | 14 +- templatePage/home/job/job.vue | 2 +- templatePage/life/about/about.vue | 14 +- templatePage/life/candle/candle.vue | 2 +- templatePage/life/plus/plus.vue | 150 ++- templatePage/life/share/share.vue | 23 +- templatePage/login/demo1/demo1.vue | 8 +- templatePage/login/demo2/demo2.vue | 8 +- templatePage/login/demo3/demo3.vue | 8 +- templatePage/login/demo4/demo4.vue | 8 +- .../tn-action-sheet/tn-action-sheet.vue | 2 +- tuniao-ui/components/tn-badge/tn-badge.vue | 20 +- .../components/tn-calendar/tn-calendar.vue | 18 +- .../tn-car-keyboard/tn-car-keyboard.vue | 20 +- .../components/tn-checkbox/tn-checkbox.vue | 20 +- .../tn-circle-progress/tn-circle-progress.vue | 22 +- .../tn-collapse-item/tn-collapse-item.vue | 20 +- .../tn-count-down/tn-count-down.vue | 26 +- .../tn-count-scroll/tn-count-scroll.vue | 18 +- tuniao-ui/components/tn-fab/tn-fab.vue | 50 +- .../components/tn-form-item/tn-form-item.vue | 2 +- tuniao-ui/components/tn-form/tn-form.vue | 18 +- .../components/tn-goods-nav/tn-goods-nav.vue | 18 +- .../tn-image-upload/tn-image-upload.vue | 22 +- .../tn-index-anchor/tn-index-anchor.vue | 20 +- .../tn-index-list/tn-index-list.vue | 22 +- tuniao-ui/components/tn-input/tn-input.vue | 6 +- .../components/tn-keyboard/tn-keyboard.vue | 18 +- .../components/tn-landscape/tn-landscape.vue | 20 +- .../components/tn-lazy-load/tn-lazy-load.vue | 24 +- .../tn-line-progress/tn-line-progress.vue | 8 +- .../components/tn-load-more/tn-load-more.vue | 18 +- .../components/tn-nav-bar/tn-nav-bar.vue | 10 +- .../tn-number-box/tn-number-box.vue | 26 +- .../tn-number-keyboard/tn-number-keyboard.vue | 6 +- tuniao-ui/components/tn-picker/tn-picker.vue | 4 +- tuniao-ui/components/tn-popup/tn-popup.vue | 30 +- tuniao-ui/components/tn-rate/tn-rate.vue | 28 +- .../components/tn-read-more/tn-read-more.vue | 18 +- tuniao-ui/components/tn-select/tn-select.vue | 20 +- .../tn-sign-board/tn-sign-board.vue | 26 +- .../components/tn-skeleton/tn-skeleton.vue | 10 +- tuniao-ui/components/tn-slider/tn-slider.vue | 22 +- tuniao-ui/components/tn-sticky/tn-sticky.vue | 8 +- .../tn-subsection/tn-subsection.vue | 4 +- tuniao-ui/components/tn-swiper/tn-swiper.vue | 4 +- tuniao-ui/components/tn-switch/tn-switch.vue | 24 +- tuniao-ui/components/tn-tabbar/tn-tabbar.vue | 16 +- .../tn-tabs-swiper/tn-tabs-swiper.vue | 12 +- tuniao-ui/components/tn-tabs/tn-tabs.vue | 14 +- tuniao-ui/components/tn-tips/tn-tips.vue | 10 +- tuniao-ui/components/tn-toast/tn-toast.vue | 20 +- tuniao-ui/index.js | 6 +- tuniao-ui/libs/css/style.mp.scss | 6 +- tuniao-ui/libs/function/colorUtils.js | 270 ------ tuniao-ui/libs/function/messageUtils.js | 74 -- tuniao-ui/libs/mixin/components_color.js | 10 +- tuniao-ui/libs/mixin/mixin.js | 6 +- tuniao-ui/libs/mixin/mpShare.js | 12 +- 92 files changed, 1475 insertions(+), 1461 deletions(-) rename store/{$t.mixin.js => $tn.mixin.js} (75%) delete mode 100644 tuniao-ui/libs/function/colorUtils.js delete mode 100644 tuniao-ui/libs/function/messageUtils.js diff --git a/.DS_Store b/.DS_Store index eab1927b44fa00fcb009e41d4680614aa22edd65..9575a7984233273079d193f9390086601ee05c23 100644 GIT binary patch delta 778 zcmZp1XbF&DU|?W$DortDU{C-uIe-{M3-C-V6q~50$f&h3U^hRb)?^-m#>tGrgXCVL9{@v<=_GvqVm0%1Nw-sEpWO*j-wq9`m2F3QWv z&r1hd$~bw7p#9|Og0grtgQR&-^jr{(=VW2XVaQ}iVkpL~(@Yqu1X=TD9U&h^?9MFX zW@RW~NMuN7NX2KYi8zunWTPkl6`l$Vl46Dupdlqd*Cpe2n+Y&TkQAaA(=Vb6bO}f{ zpP`5$6^|i6m%x>w7_n2Ndh#C;NjzFX(x{o3}zD-1hCkKmt!X9*HlY7OhHa6HZ z3Niy@6$li#frKk4Rc$Q%&ODi4CQyV4lGZdp(u@oY1|WKJflQwm13WH~{XpA@(gOgH CLcd`E delta 464 zcmZn(XmOBWU|?W$DortDU;r^WfEYvza8E20o2aMAD6=tOH$S7yWFCP=;T=f@Ihn;J z1_sv{nV4Bv+1NQaCNB_(*5>4l7m%o~HZn8NQ7|?!tJP7cwlo5=O^nTIYdJYYmG!NI z;102-DnVvopa6jcH;`}zh0n&q@640=RRTE}A)&@FIi6?Q { // this.containerScrollTop = 0 this.selectColorInfo = this.colorList[this.currentColorIndex - 1] - this.$t.message.closeLoading() + this.$tn.message.closeLoading() this.isUpdateColorInfo = false }, 10) // setTimeout(() => { diff --git a/basicPage/grid-layout/grid-layout.vue b/basicPage/grid-layout/grid-layout.vue index d6532fd..12980f1 100644 --- a/basicPage/grid-layout/grid-layout.vue +++ b/basicPage/grid-layout/grid-layout.vue @@ -20,7 +20,7 @@ - + diff --git a/basicPage/icon/icon.vue b/basicPage/icon/icon.vue index 05a4b69..b85e665 100644 --- a/basicPage/icon/icon.vue +++ b/basicPage/icon/icon.vue @@ -72,7 +72,7 @@ // 点击图标 clickIcon(index, name) { this.currentIconIndex = index - this.$t.message.toast(name, false, null, 'none', 5000) + this.$tn.message.toast(name, false, null, 'none', 5000) }, } } diff --git a/basicPage/utils/color/index.vue b/basicPage/utils/color/index.vue index c3ab9c9..b873934 100644 --- a/basicPage/utils/color/index.vue +++ b/basicPage/utils/color/index.vue @@ -48,9 +48,9 @@ - - - + + + - + } + + + } + diff --git a/basicPage/utils/message/index.vue b/basicPage/utils/message/index.vue index 41cf06d..694f6c8 100644 --- a/basicPage/utils/message/index.vue +++ b/basicPage/utils/message/index.vue @@ -91,9 +91,9 @@ - - - + + + - + } + + + } + diff --git a/basicPage/utils/number/index.vue b/basicPage/utils/number/index.vue index 97a7292..cf30491 100644 --- a/basicPage/utils/number/index.vue +++ b/basicPage/utils/number/index.vue @@ -12,25 +12,25 @@ 超过2位自动添加'+'号 - {{ $t.number.formatNumberString(56) }} + {{ $tn.number.formatNumberString(56) }} 超过2位自动添加'+'号 - {{ $t.number.formatNumberString(100) }} + {{ $tn.number.formatNumberString(100) }} 超过3位自动添加'+'号 - {{ $t.number.formatNumberString(899, 3) }} + {{ $tn.number.formatNumberString(899, 3) }} 超过3位自动添加'+'号 - {{ $t.number.formatNumberString(1000, 3) }} + {{ $tn.number.formatNumberString(1000, 3) }} @@ -41,19 +41,19 @@ 只有一位时会往前面添加'0' - {{ $t.number.formatNumberAddZero(6) }} + {{ $tn.number.formatNumberAddZero(6) }} 超过两位时不会往前面添加'0' - {{ $t.number.formatNumberAddZero(16) }} + {{ $tn.number.formatNumberAddZero(16) }} 超过两位时不会往前面添加'0' - {{ $t.number.formatNumberAddZero(106) }} + {{ $tn.number.formatNumberAddZero(106) }} @@ -64,37 +64,37 @@ 不带单位 - {{ $t.number.formatNumberAddPriceUnit(100) }} + {{ $tn.number.formatNumberAddPriceUnit(100) }} 不带单位 - {{ $t.number.formatNumberAddPriceUnit(100.88) }} + {{ $tn.number.formatNumberAddPriceUnit(100.88) }} 带K单位 - {{ $t.number.formatNumberAddPriceUnit(1000) }} + {{ $tn.number.formatNumberAddPriceUnit(1000) }} 带K单位 - {{ $t.number.formatNumberAddPriceUnit(1032.89) }} + {{ $tn.number.formatNumberAddPriceUnit(1032.89) }} 带W单位 - {{ $t.number.formatNumberAddPriceUnit(10000) }} + {{ $tn.number.formatNumberAddPriceUnit(10000) }} 带W单位 - {{ $t.number.formatNumberAddPriceUnit(10875.90) }} + {{ $tn.number.formatNumberAddPriceUnit(10875.90) }} @@ -124,9 +124,9 @@ - - - + + + - + } + + + } + diff --git a/basicPage/utils/string/index.vue b/basicPage/utils/string/index.vue index 6ed6e81..130d9c4 100644 --- a/basicPage/utils/string/index.vue +++ b/basicPage/utils/string/index.vue @@ -49,9 +49,9 @@ - - - + + + - + } + + + } + diff --git a/componentsPage/action-sheet/action-sheet.vue b/componentsPage/action-sheet/action-sheet.vue index 5bd21c7..141a0cb 100644 --- a/componentsPage/action-sheet/action-sheet.vue +++ b/componentsPage/action-sheet/action-sheet.vue @@ -116,7 +116,7 @@ // 点击了选项 clickActionSheetItem(index) { if (index === 1) { - this.$t.message.toast('选择正确') + this.$tn.message.toast('选择正确') } this.closedActionSheet() }, @@ -136,4 +136,4 @@ + diff --git a/componentsPage/fab/fab.vue b/componentsPage/fab/fab.vue index 7b560fe..fcedd32 100644 --- a/componentsPage/fab/fab.vue +++ b/componentsPage/fab/fab.vue @@ -185,7 +185,7 @@ // 点击悬浮按钮的内容 clickFabItem(e) { - this.$t.message.toast(`点击了第 ${e.index} 个选项`) + this.$tn.message.toast(`点击了第 ${e.index} 个选项`) } } @@ -193,4 +193,4 @@ + diff --git a/componentsPage/form/form.vue b/componentsPage/form/form.vue index 3126ea4..1e67a49 100644 --- a/componentsPage/form/form.vue +++ b/componentsPage/form/form.vue @@ -89,9 +89,9 @@ - - - + + + - + } + + + + diff --git a/componentsPage/goods-nav/goods-nav.vue b/componentsPage/goods-nav/goods-nav.vue index 325ae6e..b8c42f5 100644 --- a/componentsPage/goods-nav/goods-nav.vue +++ b/componentsPage/goods-nav/goods-nav.vue @@ -1,126 +1,126 @@ - diff --git a/componentsPage/image-upload/image-upload.vue b/componentsPage/image-upload/image-upload.vue index d386aea..926cea6 100644 --- a/componentsPage/image-upload/image-upload.vue +++ b/componentsPage/image-upload/image-upload.vue @@ -203,7 +203,7 @@ console.log('上传文件列表发生改变', lists, index); this.lists.splice(0, this.lists.length) this.$nextTick(() => { - this.lists = this.$t.deepClone(lists) + this.lists = this.$tn.deepClone(lists) if (this.customStyle && lists.length > 4) { this.fullWindowsScroll = true } else { @@ -270,4 +270,4 @@ justify-content: center; border-radius: 30rpx; } - + diff --git a/componentsPage/keyboard/keyboard.vue b/componentsPage/keyboard/keyboard.vue index 9aba2d4..3ea1a60 100644 --- a/componentsPage/keyboard/keyboard.vue +++ b/componentsPage/keyboard/keyboard.vue @@ -194,15 +194,15 @@ this.inputValue += e } else if (this.mode === 'car') { // 判断输入的值是否正确 - if (this.currentLicensePlateIndex === 0 && !this.$t.test.chinese(e)) { - this.$t.message.toast('车牌归属地选择错误') + if (this.currentLicensePlateIndex === 0 && !this.$tn.test.chinese(e)) { + this.$tn.message.toast('车牌归属地选择错误') return - } else if (this.currentLicensePlateIndex === 1 && !this.$t.test.letter(e)) { - this.$t.message.toast('车牌归属地字母选择错误') + } else if (this.currentLicensePlateIndex === 1 && !this.$tn.test.letter(e)) { + this.$tn.message.toast('车牌归属地字母选择错误') return } - if (this.currentLicensePlateIndex !== 0 && !this.$t.test.enOrNum(e)) { - this.$t.message.toast('车牌号码选择错误') + if (this.currentLicensePlateIndex !== 0 && !this.$tn.test.enOrNum(e)) { + this.$tn.message.toast('车牌号码选择错误') return } // this.licensePlateValue[this.currentLicensePlateIndex] = e @@ -216,11 +216,11 @@ }, // 点击了取消按钮 onCancel() { - this.$t.message.toast('点击了取消按钮') + this.$tn.message.toast('点击了取消按钮') }, // 点击了确认按钮 onConfirm() { - this.$t.message.toast('点击了确认按钮') + this.$tn.message.toast('点击了确认按钮') this.value = false }, // 点击了退格按钮 diff --git a/componentsPage/lazy-load/lazy-load.vue b/componentsPage/lazy-load/lazy-load.vue index a0deb33..ac55432 100644 --- a/componentsPage/lazy-load/lazy-load.vue +++ b/componentsPage/lazy-load/lazy-load.vue @@ -1,102 +1,102 @@ diff --git a/componentsPage/modal/modal.vue b/componentsPage/modal/modal.vue index a2d277a..a76de39 100644 --- a/componentsPage/modal/modal.vue +++ b/componentsPage/modal/modal.vue @@ -241,7 +241,7 @@ // 点击按钮 clickBtn(event) { this.show = false - this.$t.message.toast('点击了第'+(event.index + 1)+'个按钮') + this.$tn.message.toast('点击了第'+(event.index + 1)+'个按钮') } }, @@ -274,4 +274,4 @@ } } } - + diff --git a/componentsPage/picker/picker.vue b/componentsPage/picker/picker.vue index 66b6865..38c147c 100644 --- a/componentsPage/picker/picker.vue +++ b/componentsPage/picker/picker.vue @@ -259,7 +259,7 @@ // 点击取消按钮 cancelPicker(event) { - this.$t.message.toast('点击了取消按钮') + this.$tn.message.toast('点击了取消按钮') }, // 点击确认按钮 confirmPicker(event) { diff --git a/componentsPage/scroll-list/scroll-list.vue b/componentsPage/scroll-list/scroll-list.vue index 365b750..7a594bc 100644 --- a/componentsPage/scroll-list/scroll-list.vue +++ b/componentsPage/scroll-list/scroll-list.vue @@ -14,7 +14,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -52,7 +52,7 @@ - + diff --git a/componentsPage/select/select.vue b/componentsPage/select/select.vue index 7840ca0..ee3c4e8 100644 --- a/componentsPage/select/select.vue +++ b/componentsPage/select/select.vue @@ -326,7 +326,7 @@ // 点击取消按钮 cancelSelect(event) { - this.$t.message.toast('点击了取消按钮') + this.$tn.message.toast('点击了取消按钮') }, // 点击确认按钮 confirmSelect(event) { diff --git a/componentsPage/sign-board/sign-board.vue b/componentsPage/sign-board/sign-board.vue index cb74624..5e35d94 100644 --- a/componentsPage/sign-board/sign-board.vue +++ b/componentsPage/sign-board/sign-board.vue @@ -106,7 +106,7 @@ resolve() return } - this.$t.message.modal('操作提示','当前已经打开了签名板,是否确认需要关闭', () => { + this.$tn.message.modal('操作提示','当前已经打开了签名板,是否确认需要关闭', () => { resolve() }, true, () => { reject() @@ -131,4 +131,4 @@ .button { margin-top: 20rpx; } - + diff --git a/componentsPage/swipe-action/swipe-action.vue b/componentsPage/swipe-action/swipe-action.vue index 8f32db6..f83901e 100644 --- a/componentsPage/swipe-action/swipe-action.vue +++ b/componentsPage/swipe-action/swipe-action.vue @@ -205,9 +205,9 @@ // 处理swiperActionItem点击事件 onSwiperItemClick(e) { if (e.type === 'button') { - this.$t.message.toast(`点击了第${e.index}个按钮`) + this.$tn.message.toast(`点击了第${e.index}个按钮`) } else if (e.type === 'item') { - this.$t.message.toast(`点击了item标签,name为${e.name}`) + this.$tn.message.toast(`点击了item标签,name为${e.name}`) } } } @@ -241,4 +241,4 @@ } } } - + diff --git a/componentsPage/tips/tips.vue b/componentsPage/tips/tips.vue index 4304ccd..69e97fa 100644 --- a/componentsPage/tips/tips.vue +++ b/componentsPage/tips/tips.vue @@ -120,7 +120,7 @@ }, // 关闭Tips closeTips() { - this.$t.message.toast('tips提示框关闭了') + this.$tn.message.toast('tips提示框关闭了') } }, @@ -130,4 +130,4 @@ + diff --git a/componentsPage/toast/toast.vue b/componentsPage/toast/toast.vue index b61938c..c024133 100644 --- a/componentsPage/toast/toast.vue +++ b/componentsPage/toast/toast.vue @@ -126,7 +126,7 @@ }, // 关闭Toast closedToast() { - this.$t.message.toast('Toast关闭') + this.$tn.message.toast('Toast关闭') } }, @@ -136,4 +136,4 @@ + diff --git a/componentsPage/verification-code/verification-code.vue b/componentsPage/verification-code/verification-code.vue index f163fed..eb29b35 100644 --- a/componentsPage/verification-code/verification-code.vue +++ b/componentsPage/verification-code/verification-code.vue @@ -119,15 +119,15 @@ // 获取验证码 getCode() { if (this.$refs.code.canGetCode) { - this.$t.message.loading('正在获取验证码') + this.$tn.message.loading('正在获取验证码') setTimeout(() => { - this.$t.message.closeLoading() - this.$t.message.toast('验证码已经发送') + this.$tn.message.closeLoading() + this.$tn.message.toast('验证码已经发送') // 通知组件开始计时 this.$refs.code.start() }, 2000) } else { - this.$t.message.toast(this.$refs.code.secNum + '秒后再重试') + this.$tn.message.toast(this.$refs.code.secNum + '秒后再重试') } }, @@ -138,11 +138,11 @@ // 开始倒计时 codeStart() { - this.$t.message.toast('倒计时开始') + this.$tn.message.toast('倒计时开始') }, // 结束倒计时 codeEnd() { - this.$t.message.toast('倒计时结束') + this.$tn.message.toast('倒计时结束') }, // 正在倒计时 codeChange(event) { @@ -155,4 +155,4 @@ + diff --git a/libs/components/dynamic-demo-template.vue b/libs/components/dynamic-demo-template.vue index 16d396a..8f28af8 100644 --- a/libs/components/dynamic-demo-template.vue +++ b/libs/components/dynamic-demo-template.vue @@ -120,7 +120,7 @@ data() { return { // 图鸟颜色列表 - tuniaoColorList: this.$t.color.getTuniaoColorList(), + tuniaoColorList: this.$tn.color.getTuniaoColorList(), // 保存选项列表信息(由于prop中的数据时不能被修改的) _sectionList: [], // 模式列表信息 @@ -310,7 +310,7 @@ } }) - this._sectionList = this.$t.deepClone(this.sectionList) + this._sectionList = this.$tn.deepClone(this.sectionList) // 给本地选项按钮列表给默认show属性 this._sectionList.map((item) => { const section = item.section.map((section_item) => { @@ -353,7 +353,7 @@ // 更新选项按钮状态信息 updateSectionBtnsState(sectionIndex = -1, showState = true) { // 判断sectionIndex是否为数组 - if (this.$t.array.isArray(sectionIndex)) { + if (this.$tn.array.isArray(sectionIndex)) { if (sectionIndex.length === 0) { return } diff --git a/libs/mixin/template_page_mixin.js b/libs/mixin/template_page_mixin.js index 0025b53..1665693 100644 --- a/libs/mixin/template_page_mixin.js +++ b/libs/mixin/template_page_mixin.js @@ -41,7 +41,7 @@ module.exports = { // 如果获取失败则重新获取 if (!customBarHeight) { try { - const navBarInfo = await this.$t.updateCustomBar() + const navBarInfo = await this.$tn.updateCustomBar() customBarHeight = navBarInfo.customBarHeight statusBarHeight = navBarInfo.statusBarHeight } catch(e) { @@ -53,8 +53,8 @@ module.exports = { } // 更新vuex中的导航栏信息 - this.$t.vuex('vuex_status_bar_height', statusBarHeight) - this.$t.vuex('vuex_custom_bar_height', customBarHeight) + this.$tn.vuex('vuex_status_bar_height', statusBarHeight) + this.$tn.vuex('vuex_custom_bar_height', customBarHeight) } } } \ No newline at end of file diff --git a/main.js b/main.js index 4ae0f71..b236a7b 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,7 @@ import App from './App' -import store from './store' - -import Vue from 'vue' +import store from './store' + +import Vue from 'vue' Vue.config.productionTip = false App.mpType = 'app' @@ -10,7 +10,7 @@ import TuniaoUI from 'tuniao-ui' Vue.use(TuniaoUI) // 引入TuniaoUI提供的vuex简写方法 -let vuexStore = require('@/store/$t.mixin.js') +let vuexStore = require('@/store/$tn.mixin.js') Vue.mixin(vuexStore) // 引入TuniaoUI对小程序分享的mixin封装 diff --git a/mock/components_page.js b/mock/components_page.js index 999c9d5..e5202e7 100644 --- a/mock/components_page.js +++ b/mock/components_page.js @@ -18,7 +18,7 @@ export default { url: '/componentsPage/loading/loading' }, { - icon: 'share', + icon: 'tag', title: 'tabs标签', url: '/componentsPage/tabs/tabs' }, @@ -73,37 +73,37 @@ export default { url: '/componentsPage/scroll-list/scroll-list' }, { - icon: 'star', + icon: 'brand', title: 'swipeAction滑动菜单', url: '/componentsPage/swipe-action/swipe-action' }, { - icon: 'star', + icon: 'pharmacy', title: 'fab悬浮按钮', url: '/componentsPage/fab/fab' }, { - icon: 'star', + icon: 'cardbag', title: '懒加载', url: '/componentsPage/lazy-load/lazy-load' }, { - icon: 'star', + icon: 'down-double', title: '加载更多', url: '/componentsPage/load-more/load-more' }, { - icon: 'star', + icon: 'menu-more', title: '骨架屏', url: '/componentsPage/skeleton/skeleton' }, { - icon: 'star', + icon: 'empty-search', title: '空页面', url: '/componentsPage/empty/empty' }, { - icon: 'star', + icon: 'share', title: '商品导航', url: '/componentsPage/goods-nav/goods-nav' } @@ -134,7 +134,7 @@ export default { url: '/componentsPage/tips/tips' }, { - icon: 'creative', + icon: 'reply', title: '压屏窗', url: '/componentsPage/landscape/landscape' } @@ -150,17 +150,17 @@ export default { url: '/componentsPage/form/form' }, { - icon: 'image-text', + icon: 'square', title: 'Input输入框', url: '/componentsPage/input/input' }, { - icon: 'image-text', + icon: 'circle-fill', title: 'Radio单选框', url: '/componentsPage/radio/radio' }, { - icon: 'image-text', + icon: 'copy', title: 'Checkbox复选框', url: '/componentsPage/check-box/check-box' }, @@ -205,12 +205,12 @@ export default { url: '/componentsPage/sign-board/sign-board' }, { - icon: 'edit-write', + icon: 'safe', title: '验证码输入', url: '/componentsPage/verification-code-input/verification-code-input' }, { - icon: 'edit-write', + icon: 'expand', title: '分段器', url: '/componentsPage/subsection/subsection' } diff --git a/pages/basic/basic.vue b/pages/basic/basic.vue index e1345b1..46b8436 100644 --- a/pages/basic/basic.vue +++ b/pages/basic/basic.vue @@ -67,7 +67,7 @@ }, methods: { getRandomCoolBg() { - return this.$t.color.getRandomCoolBgClass() + return this.$tn.color.getRandomCoolBgClass() } } } diff --git a/pages/components/components.vue b/pages/components/components.vue index d05f8e1..78ce717 100644 --- a/pages/components/components.vue +++ b/pages/components/components.vue @@ -67,7 +67,7 @@ }, methods: { getRandomCoolBg() { - return this.$t.color.getRandomCoolBgClass() + return this.$tn.color.getRandomCoolBgClass() } } } diff --git a/pages/template/template.vue b/pages/template/template.vue index a8f7727..247d457 100644 --- a/pages/template/template.vue +++ b/pages/template/template.vue @@ -73,7 +73,7 @@ }, methods: { getRandomCoolBg() { - return this.$t.color.getRandomCoolBgClass() + return this.$tn.color.getRandomCoolBgClass() } } } diff --git a/pages/tuniao/tuniao.vue b/pages/tuniao/tuniao.vue index ac3cd4d..92713be 100644 --- a/pages/tuniao/tuniao.vue +++ b/pages/tuniao/tuniao.vue @@ -1,334 +1,563 @@ - - - - - + + + + + diff --git a/store/$t.mixin.js b/store/$tn.mixin.js similarity index 75% rename from store/$t.mixin.js rename to store/$tn.mixin.js index f86f5be..9145ccc 100644 --- a/store/$t.mixin.js +++ b/store/$tn.mixin.js @@ -13,9 +13,9 @@ module.exports = { beforeCreate() { // 将vuex方法挂在在$t中 // 使用方法: - // 修改vuex的state中的user.name变量为图鸟小菜 => this.$t.vuex('user.name', '图鸟小菜') - // 修改vuexde state中的version变量为1.0.1 => this.$t.vuex('version', 1.0.1) - this.$t.vuex = (name, value) => { + // 修改vuex的state中的user.name变量为图鸟小菜 => this.$tn.vuex('user.name', '图鸟小菜') + // 修改vuexde state中的version变量为1.0.1 => this.$tn.vuex('version', 1.0.1) + this.$tn.vuex = (name, value) => { this.$store.commit('$tStore', { name, value }) diff --git a/templatePage/animate/bubble/bubble.vue b/templatePage/animate/bubble/bubble.vue index 560f18b..b66b997 100644 --- a/templatePage/animate/bubble/bubble.vue +++ b/templatePage/animate/bubble/bubble.vue @@ -66,7 +66,7 @@ // 生成泡泡 generateBubble() { - const image = "https://tnuiimage.tnkjapp.com/bubble/" + this.$t.number.randomInt(1, 33) + ".png" + const image = "https://tnuiimage.tnkjapp.com/bubble/" + this.$tn.number.randomInt(1, 33) + ".png" uni.getImageInfo({ src: image, success: (res) => { @@ -103,16 +103,16 @@ y: height } const p1 = { - x: this.$t.number.random(0.22 * width, 0.33 * width), - y: this.$t.number.random(0.5 * height, 0.75 * height) + x: this.$tn.number.random(0.22 * width, 0.33 * width), + y: this.$tn.number.random(0.5 * height, 0.75 * height) } const p2 = { - x: this.$t.number.random(0, 0.88 * width), - y: this.$t.number.random(0.25 * height, 0.5 * height) + x: this.$tn.number.random(0, 0.88 * width), + y: this.$tn.number.random(0.25 * height, 0.5 * height) } const p3 = { - x: this.$t.number.random(0, 0.88 * width), - y: this.$t.number.random(0, 0.125 * height) + x: this.$tn.number.random(0, 0.88 * width), + y: this.$tn.number.random(0, 0.125 * height) } return [p0, p1, p2, p3] }, diff --git a/templatePage/home/job/job.vue b/templatePage/home/job/job.vue index c231c56..add962f 100644 --- a/templatePage/home/job/job.vue +++ b/templatePage/home/job/job.vue @@ -63,7 +63,7 @@ - + {{item.title}} diff --git a/templatePage/life/about/about.vue b/templatePage/life/about/about.vue index 64613ca..157b4a0 100644 --- a/templatePage/life/about/about.vue +++ b/templatePage/life/about/about.vue @@ -68,7 +68,7 @@ // 生成泡泡 generateBubble() { - const image = "https://tnuiimage.tnkjapp.com/bubble/" + this.$t.number.randomInt(1, 33) + ".png" + const image = "https://tnuiimage.tnkjapp.com/bubble/" + this.$tn.number.randomInt(1, 33) + ".png" uni.getImageInfo({ src: image, success: (res) => { @@ -105,16 +105,16 @@ y: height } const p1 = { - x: this.$t.number.random(0.22 * width, 0.33 * width), - y: this.$t.number.random(0.5 * height, 0.75 * height) + x: this.$tn.number.random(0.22 * width, 0.33 * width), + y: this.$tn.number.random(0.5 * height, 0.75 * height) } const p2 = { - x: this.$t.number.random(0, 0.88 * width), - y: this.$t.number.random(0.25 * height, 0.5 * height) + x: this.$tn.number.random(0, 0.88 * width), + y: this.$tn.number.random(0.25 * height, 0.5 * height) } const p3 = { - x: this.$t.number.random(0, 0.88 * width), - y: this.$t.number.random(0, 0.125 * height) + x: this.$tn.number.random(0, 0.88 * width), + y: this.$tn.number.random(0, 0.125 * height) } return [p0, p1, p2, p3] }, diff --git a/templatePage/life/candle/candle.vue b/templatePage/life/candle/candle.vue index c378ec5..ac6cf38 100644 --- a/templatePage/life/candle/candle.vue +++ b/templatePage/life/candle/candle.vue @@ -44,7 +44,7 @@ - + 敬请期待 diff --git a/templatePage/life/plus/plus.vue b/templatePage/life/plus/plus.vue index 68ab0fa..77f1765 100644 --- a/templatePage/life/plus/plus.vue +++ b/templatePage/life/plus/plus.vue @@ -9,7 +9,68 @@ - + + + + + + + 开源项目 + + + 不喜勿喷 + + + + + 普通用户 + + + 免费开源 + + + + + 至尊VIP + + + 会员福利 + + + + + + + + {{ item.title }} + + + + + + {{ item.common }} + + + {{ item.common2 }} + + + + + {{ item.vip }} + + + {{ item.vip2 }} + + + + + + + + + 图鸟UI小程序,免费开源可商用 (会员有更多福利鸭) @@ -35,7 +96,7 @@ 请勿转售,转售是会慢慢追究法律责任的 - (毕竟开发圈子就那么小) + (毕竟前端开发圈子就那么小) @@ -51,8 +112,10 @@ - 会员人数会达到50+叭 - (希望够垫付服务器+CDN支出) + 开源希望能得到理解 + (做开源本身就不是为了赚取) + (毕竟还不如多找几个会员进行项目合作) + (会员费用仅垫付服务器+工作室支出) @@ -67,7 +130,7 @@ 使用手册 + 图片素材 + 意见反馈 + Bug提交 - (https://www.yuque.com/tuniao) + (https://www.tuniaokj.com/) @@ -99,7 +162,7 @@ - 北北感恩你的支持 + 图鸟小小团队感恩你的支持 @@ -116,13 +179,64 @@ name: 'TemplatePlus', mixins: [template_page_mixin], data(){ - return {} + return { + setList: [ + { + title: "图鸟UI", + title2: "UI组件", + common: "免费商用", + common2: "插件市场获取", + vip: "免费商用", + vip2: "会员群直接获取" + }, + { + title: "图鸟VUE3 ", + title2: "UI组件", + common: "免费商用", + common2: "插件市场获取", + vip: "免费商用", + vip2: "会员群直接获取" + }, + { + title: "圈子博客", + title2: "纯前端模板", + common: "免费商用", + common2: "插件市场获取", + vip: "免费商用", + vip2: "会员群直接获取" + }, + { + title: "简约商圈", + title2: "纯前端模板", + common: "免费商用", + common2: "插件市场获取", + vip: "免费商用", + vip2: "会员群直接获取" + }, + { + title: "凶姐壁纸", + title2: "纯前端模板", + common: "免费商用", + common2: "插件市场获取", + vip: "免费商用", + vip2: "会员群直接获取" + }, + { + title: "无名小程序", + title2: "前后端项目", + common: "无", + common2: "", + vip: "会员专属", + vip2: "前后端开发ing" + } + ] + } }, methods: { - // 复制语雀地址 + // 复制地址 copyYuque() { uni.setClipboardData({ - data: "https://www.yuque.com/tuniao", + data: "https://www.tuniaokj.com/", }) }, // 复制微信号 @@ -138,6 +252,24 @@ diff --git a/templatePage/login/demo1/demo1.vue b/templatePage/login/demo1/demo1.vue index ca7c8b4..75f5124 100644 --- a/templatePage/login/demo1/demo1.vue +++ b/templatePage/login/demo1/demo1.vue @@ -169,15 +169,15 @@ // 获取验证码 getCode() { if (this.$refs.code.canGetCode) { - this.$t.message.loading('正在获取验证码') + this.$tn.message.loading('正在获取验证码') setTimeout(() => { - this.$t.message.closeLoading() - this.$t.message.toast('验证码已经发送') + this.$tn.message.closeLoading() + this.$tn.message.toast('验证码已经发送') // 通知组件开始计时 this.$refs.code.start() }, 2000) } else { - this.$t.message.toast(this.$refs.code.secNum + '秒后再重试') + this.$tn.message.toast(this.$refs.code.secNum + '秒后再重试') } }, // 获取验证码倒计时被修改 diff --git a/templatePage/login/demo2/demo2.vue b/templatePage/login/demo2/demo2.vue index 291f1c4..d0f6580 100644 --- a/templatePage/login/demo2/demo2.vue +++ b/templatePage/login/demo2/demo2.vue @@ -261,15 +261,15 @@ // 获取验证码 getCode() { if (this.$refs.code.canGetCode) { - this.$t.message.loading('正在获取验证码') + this.$tn.message.loading('正在获取验证码') setTimeout(() => { - this.$t.message.closeLoading() - this.$t.message.toast('验证码已经发送') + this.$tn.message.closeLoading() + this.$tn.message.toast('验证码已经发送') // 通知组件开始计时 this.$refs.code.start() }, 2000) } else { - this.$t.message.toast(this.$refs.code.secNum + '秒后再重试') + this.$tn.message.toast(this.$refs.code.secNum + '秒后再重试') } }, // 获取验证码倒计时被修改 diff --git a/templatePage/login/demo3/demo3.vue b/templatePage/login/demo3/demo3.vue index c61fddd..24eb234 100644 --- a/templatePage/login/demo3/demo3.vue +++ b/templatePage/login/demo3/demo3.vue @@ -161,15 +161,15 @@ // 获取验证码 getCode() { if (this.$refs.code.canGetCode) { - this.$t.message.loading('正在获取验证码') + this.$tn.message.loading('正在获取验证码') setTimeout(() => { - this.$t.message.closeLoading() - this.$t.message.toast('验证码已经发送') + this.$tn.message.closeLoading() + this.$tn.message.toast('验证码已经发送') // 通知组件开始计时 this.$refs.code.start() }, 2000) } else { - this.$t.message.toast(this.$refs.code.secNum + '秒后再重试') + this.$tn.message.toast(this.$refs.code.secNum + '秒后再重试') } }, // 获取验证码倒计时被修改 diff --git a/templatePage/login/demo4/demo4.vue b/templatePage/login/demo4/demo4.vue index 0527d8a..a36eb66 100644 --- a/templatePage/login/demo4/demo4.vue +++ b/templatePage/login/demo4/demo4.vue @@ -183,15 +183,15 @@ // 获取验证码 getCode() { if (this.$refs.code.canGetCode) { - this.$t.message.loading('正在获取验证码') + this.$tn.message.loading('正在获取验证码') setTimeout(() => { - this.$t.message.closeLoading() - this.$t.message.toast('验证码已经发送') + this.$tn.message.closeLoading() + this.$tn.message.toast('验证码已经发送') // 通知组件开始计时 this.$refs.code.start() }, 2000) } else { - this.$t.message.toast(this.$refs.code.secNum + '秒后再重试') + this.$tn.message.toast(this.$refs.code.secNum + '秒后再重试') } }, // 获取验证码倒计时被修改 diff --git a/tuniao-ui/components/tn-action-sheet/tn-action-sheet.vue b/tuniao-ui/components/tn-action-sheet/tn-action-sheet.vue index 4008da2..31e621a 100644 --- a/tuniao-ui/components/tn-action-sheet/tn-action-sheet.vue +++ b/tuniao-ui/components/tn-action-sheet/tn-action-sheet.vue @@ -139,7 +139,7 @@ } }, elZIndex() { - return this.zIndex ? this.zIndex : this.$t.zIndex.popup + return this.zIndex ? this.zIndex : this.$tn.zIndex.popup } }, methods: { diff --git a/tuniao-ui/components/tn-badge/tn-badge.vue b/tuniao-ui/components/tn-badge/tn-badge.vue index 62747f0..212887b 100644 --- a/tuniao-ui/components/tn-badge/tn-badge.vue +++ b/tuniao-ui/components/tn-badge/tn-badge.vue @@ -10,9 +10,9 @@ @click="handleClick" > - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-calendar/tn-calendar.vue b/tuniao-ui/components/tn-calendar/tn-calendar.vue index b06f735..99e9291 100644 --- a/tuniao-ui/components/tn-calendar/tn-calendar.vue +++ b/tuniao-ui/components/tn-calendar/tn-calendar.vue @@ -86,9 +86,9 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-car-keyboard/tn-car-keyboard.vue b/tuniao-ui/components/tn-car-keyboard/tn-car-keyboard.vue index f19216d..c4de1ec 100644 --- a/tuniao-ui/components/tn-car-keyboard/tn-car-keyboard.vue +++ b/tuniao-ui/components/tn-car-keyboard/tn-car-keyboard.vue @@ -42,9 +42,9 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-checkbox/tn-checkbox.vue b/tuniao-ui/components/tn-checkbox/tn-checkbox.vue index 675a5dd..88f92f7 100644 --- a/tuniao-ui/components/tn-checkbox/tn-checkbox.vue +++ b/tuniao-ui/components/tn-checkbox/tn-checkbox.vue @@ -19,9 +19,9 @@ > - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-circle-progress/tn-circle-progress.vue b/tuniao-ui/components/tn-circle-progress/tn-circle-progress.vue index 4fe8300..bd3305a 100644 --- a/tuniao-ui/components/tn-circle-progress/tn-circle-progress.vue +++ b/tuniao-ui/components/tn-circle-progress/tn-circle-progress.vue @@ -31,9 +31,9 @@ {{ percent + '%' }} - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-collapse-item/tn-collapse-item.vue b/tuniao-ui/components/tn-collapse-item/tn-collapse-item.vue index e481cb5..b684361 100644 --- a/tuniao-ui/components/tn-collapse-item/tn-collapse-item.vue +++ b/tuniao-ui/components/tn-collapse-item/tn-collapse-item.vue @@ -44,9 +44,9 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-count-down/tn-count-down.vue b/tuniao-ui/components/tn-count-down/tn-count-down.vue index bf6ffa0..21f90e9 100644 --- a/tuniao-ui/components/tn-count-down/tn-count-down.vue +++ b/tuniao-ui/components/tn-count-down/tn-count-down.vue @@ -87,9 +87,9 @@ > 秒 - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-count-scroll/tn-count-scroll.vue b/tuniao-ui/components/tn-count-scroll/tn-count-scroll.vue index 3bdd99d..aecc45e 100644 --- a/tuniao-ui/components/tn-count-scroll/tn-count-scroll.vue +++ b/tuniao-ui/components/tn-count-scroll/tn-count-scroll.vue @@ -5,7 +5,7 @@ :key="index" class="tn-count-scroll__box" :style="{ - width: $t.string.getLengthUnitValue(width), + width: $tn.string.getLengthUnitValue(width), height: heightPxValue + 'px' }" > @@ -33,9 +33,9 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-fab/tn-fab.vue b/tuniao-ui/components/tn-fab/tn-fab.vue index d33be09..db31d54 100644 --- a/tuniao-ui/components/tn-fab/tn-fab.vue +++ b/tuniao-ui/components/tn-fab/tn-fab.vue @@ -4,9 +4,9 @@ class="tn-fab__box" :class="{'tn-fab--right': left === 'auto'}" :style="{ - left: $t.string.getLengthUnitValue(fabLeft || left), - right: $t.string.getLengthUnitValue(fabRight || right), - bottom: $t.string.getLengthUnitValue(fabBottom || bottom), + left: $tn.string.getLengthUnitValue(fabLeft || left), + right: $tn.string.getLengthUnitValue(fabRight || right), + bottom: $tn.string.getLengthUnitValue(fabBottom || bottom), zIndex: elZIndex }" > @@ -34,7 +34,7 @@ :class="[left === 'auto' ? 'tn-fab__item__text--right' : 'tn-fab__item__text--left']" :style="{ color: item.textColor || '#FFF', - fontSize: $t.string.getLengthUnitValue(item.textSize || 28) + fontSize: $tn.string.getLengthUnitValue(item.textSize || 28) }" >{{ item.text || '' }} @@ -43,11 +43,11 @@ class="tn-fab__item__btn" :class="[!item.bgColor ? backgroundColorClass : '']" :style="{ - width: $t.string.getLengthUnitValue(width), - height: $t.string.getLengthUnitValue(height), - lineHeight: $t.string.getLengthUnitValue(height), + width: $tn.string.getLengthUnitValue(width), + height: $tn.string.getLengthUnitValue(height), + lineHeight: $tn.string.getLengthUnitValue(height), backgroundColor: item.bgColor || backgroundColorStyle || '#01BEFF', - borderRadius: $t.string.getLengthUnitValue(radius) + borderRadius: $tn.string.getLengthUnitValue(radius) }" > @@ -56,7 +56,7 @@ class="tn-fab__item__btn__title" :style="{ color: item.textColor || '#fff', - fontSize: $t.string.getLengthUnitValue(item.textSize || 28) + fontSize: $tn.string.getLengthUnitValue(item.textSize || 28) }" >{{ item.text || '' }} @@ -66,7 +66,7 @@ :class="[`tn-icon-${item.icon}`]" :style="{ color: item.iconColor || '#fff', - fontSize: $t.string.getLengthUnitValue(item.iconSize || iconSize || 64) + fontSize: $tn.string.getLengthUnitValue(item.iconSize || iconSize || 64) }" > @@ -74,8 +74,8 @@ v-else-if="!item.icon && item.imgUrl" class="tn-fab__item__btn__image" :style="{ - width: $t.string.getLengthUnitValue(item.imgWidth || 64), - height: $t.string.getLengthUnitValue(item.imgHeight || 64), + width: $tn.string.getLengthUnitValue(item.imgWidth || 64), + height: $tn.string.getLengthUnitValue(item.imgHeight || 64), }" :src="item.imgUrl" > @@ -87,24 +87,24 @@ class="tn-fab__item__btn tn-fab__item__btn--fab" :class="[backgroundColorClass, fontColorClass, {'tn-fab__item__btn--active': showFab}]" :style="{ - width: $t.string.getLengthUnitValue(width), - height: $t.string.getLengthUnitValue(height), + width: $tn.string.getLengthUnitValue(width), + height: $tn.string.getLengthUnitValue(height), backgroundColor: backgroundColorStyle || !backgroundColorClass ? '#01BEFF' : '', color: fontColorStyle || '#fff', - borderRadius: $t.string.getLengthUnitValue(radius), + borderRadius: $tn.string.getLengthUnitValue(radius), zIndex: elZIndex - 1 }" @tap.stop="fabClick" > - + - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-form-item/tn-form-item.vue b/tuniao-ui/components/tn-form-item/tn-form-item.vue index e6059cf..48ba615 100644 --- a/tuniao-ui/components/tn-form-item/tn-form-item.vue +++ b/tuniao-ui/components/tn-form-item/tn-form-item.vue @@ -250,7 +250,7 @@ mounted() { // 组件创建完成后,保存当前实例到form组件中 // 支付宝、头条小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环应用\ - this.parent = this.$t.$parent.call(this, 'tn-form') + this.parent = this.$tn.$parent.call(this, 'tn-form') if (this.parent) { // 遍历parentData属性,将parent中同名的属性赋值给parentData Object.keys(this.parentData).map(key => { diff --git a/tuniao-ui/components/tn-form/tn-form.vue b/tuniao-ui/components/tn-form/tn-form.vue index 4b6bcb4..e784916 100644 --- a/tuniao-ui/components/tn-form/tn-form.vue +++ b/tuniao-ui/components/tn-form/tn-form.vue @@ -1,9 +1,9 @@ - + + + - - + } + + + diff --git a/tuniao-ui/components/tn-goods-nav/tn-goods-nav.vue b/tuniao-ui/components/tn-goods-nav/tn-goods-nav.vue index 7595c33..59dbab0 100644 --- a/tuniao-ui/components/tn-goods-nav/tn-goods-nav.vue +++ b/tuniao-ui/components/tn-goods-nav/tn-goods-nav.vue @@ -144,17 +144,17 @@ }, computed: { backgroundColorStyle() { - return this.$t.color.getBackgroundColorStyle(this.backgroundColor) + return this.$tn.color.getBackgroundColorStyle(this.backgroundColor) }, backgroundColorClass() { - return this.$t.color.getBackgroundColorInternalClass(this.backgroundColor) + return this.$tn.color.getBackgroundColorInternalClass(this.backgroundColor) }, navStyle() { let style = {} if (this.height) { style.height = this.height + 'rpx' } - style.zIndex = this.zIndex ? this.zIndex : this.$t.zIndex.goodsNav + style.zIndex = this.zIndex ? this.zIndex : this.$tn.zIndex.goodsNav return style }, // 选项style @@ -182,7 +182,7 @@ clazz += ` ${item.colorClass}` } - clazz += ` buttons__item--${this.$t.string.humpConvertChar(this.buttonType, '-')}` + clazz += ` buttons__item--${this.$tn.string.humpConvertChar(this.buttonType, '-')}` return clazz } @@ -245,7 +245,7 @@ let option = {...item} option.showAvatar = item.hasOwnProperty('avatar') if (item.hasOwnProperty('count')) { - const count = this.$t.number.formatNumberString(item.count, 2) + const count = this.$tn.number.formatNumberString(item.count, 2) option.showBadge = true option.count = typeof count === 'number' ? String(count) : count option.countBackgroundColor = item.countBackgroundColor ? item.countBackgroundColor : '#01BEFF' @@ -260,12 +260,12 @@ this.buttonGroupsData = this.buttonGroups.map((item) => { let button = {...item} if (item.hasOwnProperty('backgroundColor')) { - button.backgroundColorClass = this.$t.color.getBackgroundColorInternalClass(item.backgroundColor) - button.backgroundColorStyle = this.$t.color.getBackgroundColorStyle(item.backgroundColor) + button.backgroundColorClass = this.$tn.color.getBackgroundColorInternalClass(item.backgroundColor) + button.backgroundColorStyle = this.$tn.color.getBackgroundColorStyle(item.backgroundColor) } if (item.hasOwnProperty('color')) { - button.colorClass = this.$t.color.getBackgroundColorInternalClass(item.color) - button.colorStyle = this.$t.color.getBackgroundColorStyle(item.color) + button.colorClass = this.$tn.color.getBackgroundColorInternalClass(item.color) + button.colorStyle = this.$tn.color.getBackgroundColorStyle(item.color) } return button }) diff --git a/tuniao-ui/components/tn-image-upload/tn-image-upload.vue b/tuniao-ui/components/tn-image-upload/tn-image-upload.vue index 018155c..7a9e9d3 100644 --- a/tuniao-ui/components/tn-image-upload/tn-image-upload.vue +++ b/tuniao-ui/components/tn-image-upload/tn-image-upload.vue @@ -6,8 +6,8 @@ :key="index" class="tn-image-upload__item tn-image-upload__item-preview" :style="{ - width: $t.string.getLengthUnitValue(width), - height: $t.string.getLengthUnitValue(height) + width: $tn.string.getLengthUnitValue(width), + height: $tn.string.getLengthUnitValue(height) }" > @@ -62,8 +62,8 @@ hover-class="tn-hover-class" hover-stay-time="150" :style="{ - width: $t.string.getLengthUnitValue(width), - height: $t.string.getLengthUnitValue(height) + width: $tn.string.getLengthUnitValue(width), + height: $tn.string.getLengthUnitValue(height) }" > @@ -342,7 +342,7 @@ // 提示用户信息 showToast(message, force = false) { if (this.showTips || force) { - this.$t.message.toast(message) + this.$tn.message.toast(message) } }, // 手动上传,通过ref进行调用 @@ -354,7 +354,7 @@ this.lists[index].progress = 0 this.lists[index].error = false this.lists[index].response = null - this.$t.message.loading('重新上传') + this.$tn.message.loading('重新上传') this.uploadFile(index) }, // 上传文件 @@ -378,7 +378,7 @@ // 通过bind()方法,绑定父组件的this,让this的this为父组件的上下文 // 因为upload组件可能会被嵌套在其他组件内,比如tn-form,这时this.$parent其实为tn-form的this, // 非页面的this,所以这里需要往上历遍,一直寻找到最顶端的$parent,这里用了this.$u.$parent.call(this) - let beforeResponse = this.beforeUpload.bind(this.$t.$parent.call(this))(index, this.lists) + let beforeResponse = this.beforeUpload.bind(this.$tn.$parent.call(this))(index, this.lists) // 判断是否返回了Promise if (!!beforeResponse && typeof beforeResponse.then === 'function') { await beforeResponse.then(res => { @@ -410,7 +410,7 @@ header: this.header, success: res => { // 判断啊是否为json字符串,将其转换为json格式 - let data = this.toJson && this.$t.test.jsonString(res.data) ? JSON.parse(res.data) : res.data + let data = this.toJson && this.$tn.test.jsonString(res.data) ? JSON.parse(res.data) : res.data if (![200, 201, 204].includes(res.statusCode)) { this.uploadError(index, data) } else { @@ -424,7 +424,7 @@ this.uploadError(index, err) }, complete: res => { - this.$t.message.closeLoading() + this.$tn.message.closeLoading() this.uploading = false this.uploadFile(index + 1) this.$emit('on-change', res, index, this.lists, this.index) @@ -449,14 +449,14 @@ // 删除一个图片 deleteItem(index) { if (!this.deleteable) return - this.$t.message.modal( + this.$tn.message.modal( '提示', '您确定要删除吗?', async () => { // 先检查是否有定义before-remove移除前钩子 // 执行before-remove钩子 if (this.beforeRemove && typeof(this.beforeRemove) === 'function') { - let beforeResponse = this.beforeRemove.bind(this.$t.$parent.call(this))(index, this.lists) + let beforeResponse = this.beforeRemove.bind(this.$tn.$parent.call(this))(index, this.lists) // 判断是否返回promise if (!!beforeResponse && typeof beforeResponse.then === 'function') { await beforeResponse.then(res => { diff --git a/tuniao-ui/components/tn-index-anchor/tn-index-anchor.vue b/tuniao-ui/components/tn-index-anchor/tn-index-anchor.vue index 6f63451..2097031 100644 --- a/tuniao-ui/components/tn-index-anchor/tn-index-anchor.vue +++ b/tuniao-ui/components/tn-index-anchor/tn-index-anchor.vue @@ -11,9 +11,9 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-index-list/tn-index-list.vue b/tuniao-ui/components/tn-index-list/tn-index-list.vue index 3451f5c..096e79f 100644 --- a/tuniao-ui/components/tn-index-list/tn-index-list.vue +++ b/tuniao-ui/components/tn-index-list/tn-index-list.vue @@ -37,9 +37,9 @@ {{ indexList[touchMoveIndex] }} - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-input/tn-input.vue b/tuniao-ui/components/tn-input/tn-input.vue index 61e5a33..9c34c1f 100644 --- a/tuniao-ui/components/tn-input/tn-input.vue +++ b/tuniao-ui/components/tn-input/tn-input.vue @@ -293,7 +293,7 @@ handleInput(event) { let value = event.detail.value // 是否需要去掉空格 - if (this.trim) value = this.$t.string.trim(value) + if (this.trim) value = this.$tn.string.trim(value) // 原生事件 this.$emit('input', value) // model赋值 @@ -304,7 +304,7 @@ setTimeout(() => { // 头条小程序由于自身bug,导致中文下,每按下一个键(尚未完成输入),都会触发一次@input,导致错误,这里进行判断处理 // #ifdef MP-TOUTIAO - if (this.$t.string.trim(value) === this.lastValue) return + if (this.$tn.string.trim(value) === this.lastValue) return this.lastValue = value // #endif @@ -331,7 +331,7 @@ setTimeout(() => { // 头条小程序由于自身bug,导致中文下,每按下一个键(尚未完成输入),都会触发一次@input,导致错误,这里进行判断处理 // #ifdef MP-TOUTIAO - if (this.$t.string.trim(value) === this.lastValue) return + if (this.$tn.string.trim(value) === this.lastValue) return this.lastValue = value // #endif diff --git a/tuniao-ui/components/tn-keyboard/tn-keyboard.vue b/tuniao-ui/components/tn-keyboard/tn-keyboard.vue index 958e83c..c46f6e0 100644 --- a/tuniao-ui/components/tn-keyboard/tn-keyboard.vue +++ b/tuniao-ui/components/tn-keyboard/tn-keyboard.vue @@ -48,9 +48,9 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-landscape/tn-landscape.vue b/tuniao-ui/components/tn-landscape/tn-landscape.vue index 7827016..df0ff61 100644 --- a/tuniao-ui/components/tn-landscape/tn-landscape.vue +++ b/tuniao-ui/components/tn-landscape/tn-landscape.vue @@ -21,9 +21,9 @@ :style="[maskStyle]" @tap="closeMask" > - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-lazy-load/tn-lazy-load.vue b/tuniao-ui/components/tn-lazy-load/tn-lazy-load.vue index 44d26a6..9be7f59 100644 --- a/tuniao-ui/components/tn-lazy-load/tn-lazy-load.vue +++ b/tuniao-ui/components/tn-lazy-load/tn-lazy-load.vue @@ -27,9 +27,9 @@ > - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-line-progress/tn-line-progress.vue b/tuniao-ui/components/tn-line-progress/tn-line-progress.vue index 2e670be..4bca0d4 100644 --- a/tuniao-ui/components/tn-line-progress/tn-line-progress.vue +++ b/tuniao-ui/components/tn-line-progress/tn-line-progress.vue @@ -6,7 +6,7 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-nav-bar/tn-nav-bar.vue b/tuniao-ui/components/tn-nav-bar/tn-nav-bar.vue index 2d1589f..23b9726 100644 --- a/tuniao-ui/components/tn-nav-bar/tn-nav-bar.vue +++ b/tuniao-ui/components/tn-nav-bar/tn-nav-bar.vue @@ -167,7 +167,7 @@ return style }, elZIndex() { - return this.zIndex ? this.zIndex : this.$t.zIndex.navbar + return this.zIndex ? this.zIndex : this.$tn.zIndex.navbar } }, data() { @@ -206,7 +206,7 @@ // 如果获取失败则重新获取 if (!customBarHeight) { try { - const navBarInfo = await this.$t.updateCustomBar() + const navBarInfo = await this.$tn.updateCustomBar() customBarHeight = navBarInfo.customBarHeight statusBarHeight = navBarInfo.statusBarHeight } catch(e) { @@ -218,8 +218,8 @@ } // 更新vuex中的导航栏信息 - this && this.$t.vuex('vuex_status_bar_height', statusBarHeight) - this && this.$t.vuex('vuex_custom_bar_height', customBarHeight) + this && this.$tn.vuex('vuex_status_bar_height', statusBarHeight) + this && this.$tn.vuex('vuex_custom_bar_height', customBarHeight) this.customBarHeight = customBarHeight this.statusBarHeight = statusBarHeight @@ -230,7 +230,7 @@ // 执行回调,同时传入索引当作参数 // 在微信,支付宝等环境(H5正常),会导致父组件定义的函数体中的this变成子组件的this // 通过bind()方法,绑定父组件的this,让this的this为父组件的上下文 - let beforeBack = this.beforeBack.bind(this.$t.$parent.call(this))() + let beforeBack = this.beforeBack.bind(this.$tn.$parent.call(this))() // 判断是否返回了Promise if (!!beforeBack && typeof beforeBack.then === 'function') { await beforeBack.then(res => { diff --git a/tuniao-ui/components/tn-number-box/tn-number-box.vue b/tuniao-ui/components/tn-number-box/tn-number-box.vue index c9bdcc5..b6b72b1 100644 --- a/tuniao-ui/components/tn-number-box/tn-number-box.vue +++ b/tuniao-ui/components/tn-number-box/tn-number-box.vue @@ -10,7 +10,7 @@ ]" :style="{ backgroundColor: backgroundColorStyle, - height: $t.string.getLengthUnitValue(inputHeight), + height: $tn.string.getLengthUnitValue(inputHeight), color: fontColorStyle, fontSize: fontSizeStyle }" @@ -31,8 +31,8 @@ {'tn-number-box__input--disabled': disabledInput || disabled} ]" :style="{ - width: $t.string.getLengthUnitValue(inputWidth), - height: $t.string.getLengthUnitValue(inputHeight), + width: $tn.string.getLengthUnitValue(inputWidth), + height: $tn.string.getLengthUnitValue(inputHeight), color: fontColorStyle, fontSize: fontSizeStyle, backgroundColor: backgroundColorStyle @@ -51,7 +51,7 @@ ]" :style="{ backgroundColor: backgroundColorStyle, - height: $t.string.getLengthUnitValue(inputHeight), + height: $tn.string.getLengthUnitValue(inputHeight), color: fontColorStyle, fontSize: fontSizeStyle }" @@ -60,9 +60,9 @@ > - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-number-keyboard/tn-number-keyboard.vue b/tuniao-ui/components/tn-number-keyboard/tn-number-keyboard.vue index 60af6f0..07ee2e8 100644 --- a/tuniao-ui/components/tn-number-keyboard/tn-number-keyboard.vue +++ b/tuniao-ui/components/tn-number-keyboard/tn-number-keyboard.vue @@ -62,7 +62,7 @@ if (!this.randomEnabled) { return [1, 2, 3, 4, 5, 6, 7, 8, 9, '', 0] } else { - let data = this.$t.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) + let data = this.$tn.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) data.splice(-1, 0, '') return data } @@ -70,7 +70,7 @@ if (!this.randomEnabled) { return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0] } else { - let data = this.$t.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) + let data = this.$tn.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) data.splice(-1, 0, this.dot) return data } @@ -78,7 +78,7 @@ if (!this.randomEnabled) { return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0] } else { - let data = this.$t.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) + let data = this.$tn.array.random([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) data.splice(-1, 0, this.cardX) return data } diff --git a/tuniao-ui/components/tn-picker/tn-picker.vue b/tuniao-ui/components/tn-picker/tn-picker.vue index 2fe8854..0b9081d 100644 --- a/tuniao-ui/components/tn-picker/tn-picker.vue +++ b/tuniao-ui/components/tn-picker/tn-picker.vue @@ -287,7 +287,7 @@ return [this.year, this.month] }, elZIndex() { - return this.zIndex ? this.zIndex : this.$t.zIndex.popup + return this.zIndex ? this.zIndex : this.$tn.zIndex.popup } }, data() { @@ -366,7 +366,7 @@ }, // 往数字前面补0 formatNumber(num) { - return this.$t.number.formatNumberAddZero(num) + return this.$tn.number.formatNumberAddZero(num) }, // 生成递进的数组 generateArray(start, end) { diff --git a/tuniao-ui/components/tn-popup/tn-popup.vue b/tuniao-ui/components/tn-popup/tn-popup.vue index ffd94c9..4f03095 100644 --- a/tuniao-ui/components/tn-popup/tn-popup.vue +++ b/tuniao-ui/components/tn-popup/tn-popup.vue @@ -66,9 +66,9 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-rate/tn-rate.vue b/tuniao-ui/components/tn-rate/tn-rate.vue index 576475e..4edc2ba 100644 --- a/tuniao-ui/components/tn-rate/tn-rate.vue +++ b/tuniao-ui/components/tn-rate/tn-rate.vue @@ -20,9 +20,9 @@ > - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-read-more/tn-read-more.vue b/tuniao-ui/components/tn-read-more/tn-read-more.vue index c8fa886..13c34d1 100644 --- a/tuniao-ui/components/tn-read-more/tn-read-more.vue +++ b/tuniao-ui/components/tn-read-more/tn-read-more.vue @@ -23,9 +23,9 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-select/tn-select.vue b/tuniao-ui/components/tn-select/tn-select.vue index b172cfb..bf238ab 100644 --- a/tuniao-ui/components/tn-select/tn-select.vue +++ b/tuniao-ui/components/tn-select/tn-select.vue @@ -49,9 +49,9 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-sign-board/tn-sign-board.vue b/tuniao-ui/components/tn-sign-board/tn-sign-board.vue index 83a695b..ab59f54 100644 --- a/tuniao-ui/components/tn-sign-board/tn-sign-board.vue +++ b/tuniao-ui/components/tn-sign-board/tn-sign-board.vue @@ -34,9 +34,9 @@ - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-skeleton/tn-skeleton.vue b/tuniao-ui/components/tn-skeleton/tn-skeleton.vue index 85a5987..c52e218 100644 --- a/tuniao-ui/components/tn-skeleton/tn-skeleton.vue +++ b/tuniao-ui/components/tn-skeleton/tn-skeleton.vue @@ -8,21 +8,21 @@ > - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-sticky/tn-sticky.vue b/tuniao-ui/components/tn-sticky/tn-sticky.vue index 62b01f1..7bc11b7 100644 --- a/tuniao-ui/components/tn-sticky/tn-sticky.vue +++ b/tuniao-ui/components/tn-sticky/tn-sticky.vue @@ -64,13 +64,13 @@ }, computed: { elZIndex() { - return this.zIndex ? this.zIndex : this.$t.zIndex.sticky + return this.zIndex ? this.zIndex : this.$tn.zIndex.sticky }, backgroundColorStyle() { - return this.$t.color.getBackgroundColorStyle(this.backgroundColor) + return this.$tn.color.getBackgroundColorStyle(this.backgroundColor) }, backgroundColorClass() { - return this.$t.color.getBackgroundColorInternalClass(this.backgroundColor) + return this.$tn.color.getBackgroundColorInternalClass(this.backgroundColor) }, stickyClass() { let clazz = '' @@ -97,7 +97,7 @@ // 监听组件别名 stickyObserverName: 'tnStickyObserver', // 组件的唯一编号 - elClass: this.$t.uuid(), + elClass: this.$tn.uuid(), // 是否固定 fixed: false, // 高度 diff --git a/tuniao-ui/components/tn-subsection/tn-subsection.vue b/tuniao-ui/components/tn-subsection/tn-subsection.vue index 85696e9..260f779 100644 --- a/tuniao-ui/components/tn-subsection/tn-subsection.vue +++ b/tuniao-ui/components/tn-subsection/tn-subsection.vue @@ -215,7 +215,7 @@ }, itemBarClass() { let clazz = '' - const buttonBgClass = this.$t.color.getBackgroundColorInternalClass(this.buttonColor) + const buttonBgClass = this.$tn.color.getBackgroundColorInternalClass(this.buttonColor) if (this.animation) { clazz += ' tn-subsection__bg__animation' if (this.animationType) { @@ -230,7 +230,7 @@ // 滑块样式 itemBarStyle() { let style = {} - const buttonBgStyle = this.$t.color.getBackgroundColorStyle(this.buttonColor) + const buttonBgStyle = this.$tn.color.getBackgroundColorStyle(this.buttonColor) if (buttonBgStyle) { style.backgroundColor = this.buttonColor } diff --git a/tuniao-ui/components/tn-swiper/tn-swiper.vue b/tuniao-ui/components/tn-swiper/tn-swiper.vue index 29defff..73f4d3c 100644 --- a/tuniao-ui/components/tn-swiper/tn-swiper.vue +++ b/tuniao-ui/components/tn-swiper/tn-swiper.vue @@ -177,10 +177,10 @@ }, computed: { backgroundColorStyle() { - return this.$t.color.getBackgroundColorStyle(this.backgroundColor) + return this.$tn.color.getBackgroundColorStyle(this.backgroundColor) }, backgroundColorClass() { - return this.$t.color.getBackgroundColorInternalClass(this.backgroundColor) + return this.$tn.color.getBackgroundColorInternalClass(this.backgroundColor) }, swiperStyle() { let style = {} diff --git a/tuniao-ui/components/tn-switch/tn-switch.vue b/tuniao-ui/components/tn-switch/tn-switch.vue index 1b214b1..1d7b5bb 100644 --- a/tuniao-ui/components/tn-switch/tn-switch.vue +++ b/tuniao-ui/components/tn-switch/tn-switch.vue @@ -34,9 +34,9 @@ !value ? 'tn-switch__icon--show' : '' ]" :style="[iconStyle]"> - - - + + + - + } + + + } + diff --git a/tuniao-ui/components/tn-tabbar/tn-tabbar.vue b/tuniao-ui/components/tn-tabbar/tn-tabbar.vue index 4a44c7b..5e68970 100644 --- a/tuniao-ui/components/tn-tabbar/tn-tabbar.vue +++ b/tuniao-ui/components/tn-tabbar/tn-tabbar.vue @@ -61,7 +61,7 @@ :absolute="true" :top="2" > - {{ $t.number.formatNumberString(item.count) }} + {{ $tn.number.formatNumberString(item.count) }} @@ -220,13 +220,13 @@ } // 判断是否获取内部样式 if (style) { - if (this.$t.color.getFontColorStyle(color) !== '') { + if (this.$tn.color.getFontColorStyle(color) !== '') { return color } else { return '' } } else { - if (this.$t.color.getFontColorStyle(color) === '') { + if (this.$tn.color.getFontColorStyle(color) === '') { return color } else { return '' @@ -246,13 +246,13 @@ } // 判断是否获取内部样式 if (style) { - if (this.$t.color.getFontColorStyle(color) !== '') { + if (this.$tn.color.getFontColorStyle(color) !== '') { return color } else { return '' } } else { - if (this.$t.color.getFontColorStyle(color) === '') { + if (this.$tn.color.getFontColorStyle(color) === '') { return color + ' tn-tabbar__content__item__icon--clip' } else { return '' @@ -277,7 +277,7 @@ let clazz = '' if (this.list[index]['out']) { clazz += 'tn-tabbar__content__item__button--out' - if (this.$t.color.getFontColorStyle(this.activeIconColor) === '') { + if (this.$tn.color.getFontColorStyle(this.activeIconColor) === '') { clazz += ` ${this.activeIconColor}` } if (this.value === index) { @@ -297,7 +297,7 @@ return (index) => { let style = {} if (this.list[index]['out']) { - if (this.$t.color.getFontColorStyle(this.activeIconColor) !== '') { + if (this.$tn.color.getFontColorStyle(this.activeIconColor) !== '') { style.backgroundColor = this.activeIconColor } style.width = `${this.outHeight - 35}rpx` @@ -378,7 +378,7 @@ // 执行回调,同时传入索引当作参数 // 在微信,支付宝等环境(H5正常),会导致父组件定义的函数体中的this变成子组件的this // 通过bind()方法,绑定父组件的this,让this的this为父组件的上下文 - let beforeSwitch = this.beforeSwitch.bind(this.$t.$parent.call(this))(index) + let beforeSwitch = this.beforeSwitch.bind(this.$tn.$parent.call(this))(index) // 判断是否返回了Promise if (!!beforeSwitch && typeof beforeSwitch.then === 'function') { await beforeSwitch.then(res => { diff --git a/tuniao-ui/components/tn-tabs-swiper/tn-tabs-swiper.vue b/tuniao-ui/components/tn-tabs-swiper/tn-tabs-swiper.vue index 2e38d4a..5f6b28d 100644 --- a/tuniao-ui/components/tn-tabs-swiper/tn-tabs-swiper.vue +++ b/tuniao-ui/components/tn-tabs-swiper/tn-tabs-swiper.vue @@ -1,5 +1,5 @@ + - + } + + + + diff --git a/tuniao-ui/index.js b/tuniao-ui/index.js index 537fe74..8b4a222 100644 --- a/tuniao-ui/index.js +++ b/tuniao-ui/index.js @@ -38,7 +38,7 @@ import zIndex from './libs/config/zIndex.js' // 主题颜色信息 import colorInfo from './libs/config/color.js' -const $t = { +const $tn = { updateCustomBar: updateCustomBarInfo, color, message, @@ -54,7 +54,7 @@ const $t = { } // 挂载到uni对象上 -uni.$t = $t +uni.$tn = $tn const install = Vue => { // 全局混入 @@ -62,7 +62,7 @@ const install = Vue => { // Filter格式化 - Vue.prototype.$t = $t + Vue.prototype.$tn = $tn } export default { diff --git a/tuniao-ui/libs/css/style.mp.scss b/tuniao-ui/libs/css/style.mp.scss index fe00f6d..5c683fc 100644 --- a/tuniao-ui/libs/css/style.mp.scss +++ b/tuniao-ui/libs/css/style.mp.scss @@ -40,11 +40,7 @@ } } } -/* 双标签 end*/ - -page { - // overflow-y: auto; -} +/* 双标签 end*/ /* #endif */ /* 微信小程序编译后页面有组件名的元素,特别处理 end */ diff --git a/tuniao-ui/libs/function/colorUtils.js b/tuniao-ui/libs/function/colorUtils.js deleted file mode 100644 index b6bc376..0000000 --- a/tuniao-ui/libs/function/colorUtils.js +++ /dev/null @@ -1,270 +0,0 @@ -let color = [ - 'red', - 'purplered', - 'purple', - 'bluepurple', - 'aquablue', - 'blue', - 'indigo', - 'cyan', - 'teal', - 'green', - 'yellowgreen', - 'lime', - 'yellow', - 'orangeyellow', - 'orange', - 'orangered', - 'brown', - 'grey', - 'gray' -] - -// 酷炫颜色的数量 -const COOL_BG_COLOR_COUNT = 16 - -/** - * 获取图鸟配色颜色列表 - */ -function getTuniaoColorList() { - return color -} - -/** - * 获取指定类型的随机颜色对应的类 - * @param {String} type 颜色类型 - */ -function getRandomColorClass(type = 'bg') { - const index = Math.floor(Math.random() * color.length) - const colorValue = color[index] - - return 'tn-' + type + '-' + colorValue -} - -/** - * 随机获取酷炫背景对应的类 - */ -function getRandomCoolBgClass() { - const index = (Math.random() * COOL_BG_COLOR_COUNT) + 1 - return 'tn-cool-bg-color-' + Math.floor(index) -} - -/** - * 根据传入的值获取内部背景颜色类 - * - * @param {String} backgroundColor 背景颜色信息 - */ -function getBackgroundColorInternalClass(backgroundColor = '') { - if (!backgroundColor) return '' - - if (['tn-bg', 'tn-dynamic-bg', 'tn-main-gradient', 'tn-cool-bg'].some(item => { - return backgroundColor.includes(item) - })) { - return backgroundColor - } - return '' -} - -/** - * 根据传入的值获取背景颜色样式 - * - * @param {String} backgroundColor 背景颜色信息 - */ -function getBackgroundColorStyle(backgroundColor = '') { - if (!backgroundColor) return '' - - if (!backgroundColor.startsWith('tn-') || ['#', 'rgb', 'rgba'].some(item => { - return backgroundColor.includes(item) - })) { - return backgroundColor - } - return '' -} - -/** - * 根据传入的值获取内部字体颜色类 - * - * @param {String} fontColor 背景颜色信息 - */ -function getFontColorInternalClass(fontColor = '') { - if (!fontColor) return '' - - if (['tn-color'].some(item => { - return fontColor.includes(item) - })) { - return fontColor - } - return '' -} - -/** - * 根据传入的值获取字体颜色样式 - * - * @param {String} fontColor 背景颜色信息 - */ -function getFontColorStyle(fontColor = '') { - if (!fontColor) return '' - - if (!fontColor.startsWith('tn-') || ['#', 'rgb', 'rgba'].some(item => { - return fontColor.includes(item) - })) { - return fontColor - } - return '' -} - -/** - * 求两个颜色之间的渐变值 - * - * @param {String} startColor 开始颜色 - * @param {String} endColor 结束颜色 - * @param {Number} step 颜色等分的份额 - */ -function colorGradient(startColor = 'rgb(0, 0, 0)', endColor='rgb(255, 255, 255)', step = 10) { - let startRGB = hexToRGB(startColor, false) - let startR = startRGB[0] - let startG = startRGB[1] - let startB = startRGB[2] - - let endRGB = hexToRGB(endColor, false) - let endR = endRGB[0] - let endG = endRGB[1] - let endB = endRGB[2] - - // 求差值 - let R = (endR - startR) / step - let G = (endG - startG) / step - let B = (endB - startB) / step - - let colorArr = [] - for (let i = 0; i < step; i++) { - // 计算每一步的hex值 - let hex = rgbToHex(`rgb(${Math.round(R * i + startR)}, ${Math.round(G * i + startG)}, ${Math.round(B * i + startB)})`) - colorArr.push(hex) - } - return colorArr -} - -/** - * 将hex的颜色表示方式转换为rgb表示方式 - * - * @param {String} color 颜色 - * @param {Boolean} str 是否返回字符串 - * @return {Array|String} rgb的值 - */ -function hexToRGB(color, str = true) { - let reg = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/ - - color = color.toLowerCase() - if (color && reg.test(color)) { - // #000 => #000000 - if (color.length === 4) { - let colorNew = '#' - for (let i = 1; i < 4; i++) { - colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1)) - } - color = colorNew - } - // 处理六位的颜色值 - let colorChange = [] - for (let i = 1; i < 7; i += 2) { - colorChange.push(parseInt("0x" + color.slice(i, i + 2))) - } - if (!str) { - return colorChange - } else { - return `rgb(${colorChange[0]}, ${colorChange[1]}, ${colorChange[2]})` - } - } else if (/^(rgb|RGB)/.test(color)) { - let arr = color.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(',') - return arr.map(item => Number(item)) - } else { - return color - } -} - -/** - * 将rgb的颜色表示方式转换成hex表示方式 - * - * @param {Object} rgb rgb颜色值 - */ -function rgbToHex(rgb) { - let reg = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/ - if (/^(rgb|RGB)/.test(rgb)) { - let color = rgb.replace(/(?:\(|\)|rgb|GRB)*/g, "").split(',') - let strHex = '#' - for (let i = 0; i < color.length; i++) { - let hex = Number(color[i]).toString(16) - // 保证每个值否是两位数 - hex = String(hex).length === 1 ? 0 + '' + hex: hex - if (hex === '0') { - hex += hex - } - strHex += hex - } - if (strHex.length !== 7) { - strHex = rgb - } - return strHex - } else if (reg.test(rgb)) { - let num = rgb.replace(/#/, '').split('') - if (num.length === 6) { - return rgb - } else if (num.length === 3) { - let numHex = '#' - for (let i = 0; i < num.length; i++) { - numHex += (num[i] + num[i]) - } - return numHex - } - } else { - return rgb - } -} - -/** - * 将传入的颜色值转换为rgba字符串 - * - * @param {String} color 颜色 - * @param {Number} alpha 透明度 - */ -function colorToRGBA(color, alpha = 0.3) { - color = rgbToHex(color) - // 十六进制颜色值的正则表达式 - let reg = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/ - - color = color.toLowerCase() - if (color && reg.test(color)) { - // #000 => #000000 - if (color.length === 4) { - let colorNew = '#' - for (let i = 1; i < 4; i++) { - colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1)) - } - color = colorNew - } - // 处理六位的颜色值 - let colorChange = [] - for (let i = 1; i < 7; i += 2) { - colorChange.push(parseInt("0x" + color.slice(i, i + 2))) - } - return `rgba(${colorChange[0]}, ${colorChange[1]}, ${colorChange[2]}, ${alpha})` - } else { - return color - } -} - -export default { - COOL_BG_COLOR_COUNT: COOL_BG_COLOR_COUNT, - getTuniaoColorList, - getRandomColorClass, - getRandomCoolBgClass, - getBackgroundColorInternalClass, - getBackgroundColorStyle, - getFontColorInternalClass, - getFontColorStyle, - colorGradient, - hexToRGB, - rgbToHex, - colorToRGBA -} diff --git a/tuniao-ui/libs/function/messageUtils.js b/tuniao-ui/libs/function/messageUtils.js deleted file mode 100644 index 39bda4a..0000000 --- a/tuniao-ui/libs/function/messageUtils.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * 弹出系统内置的toast - */ -function toast(title, mask = false, cb = null, icon = 'none', duration = 1500) { - uni.showToast({ - title: title, - icon: icon, - mask: mask, - duration: duration, - success: () => { - setTimeout(() => { - cb && cb() - }, duration) - } - }) -} - -/** - * 弹出内置的加载框 - */ -function loading(title) { - uni.showLoading({ - title: title, - mask: true - }) -} - -/** - * 弹出系统内置的modal - */ -function modal(title, - content, - confirmCb, - showCancel = false, - cancelCb = null, - confirmText = "确定", - cancelText = "取消") { - uni.showModal({ - title: title, - content: content, - showCancel: showCancel, - cancelText: cancelText, - confirmText: confirmText, - success: (res) => { - if (res.cancel) { - cancelCb && cancelCb() - } else if (res.confirm) { - confirmCb && confirmCb() - } - } - }) -} - -/** - * 关闭系统内置toast - */ -function closeToast() { - uni.hideToast() -} - -/** - * 关闭系统内置的加载框 - */ -function closeLoading() { - uni.hideLoading() -} - -export default { - toast, - loading, - modal, - closeToast, - closeLoading -} diff --git a/tuniao-ui/libs/mixin/components_color.js b/tuniao-ui/libs/mixin/components_color.js index d24a80a..772c251 100644 --- a/tuniao-ui/libs/mixin/components_color.js +++ b/tuniao-ui/libs/mixin/components_color.js @@ -26,19 +26,19 @@ module.exports = { }, computed: { backgroundColorStyle() { - return this.$t.color.getBackgroundColorStyle(this.backgroundColor) + return this.$tn.color.getBackgroundColorStyle(this.backgroundColor) }, backgroundColorClass() { - return this.$t.color.getBackgroundColorInternalClass(this.backgroundColor) + return this.$tn.color.getBackgroundColorInternalClass(this.backgroundColor) }, fontColorStyle() { - return this.$t.color.getFontColorStyle(this.fontColor) + return this.$tn.color.getFontColorStyle(this.fontColor) }, fontColorClass() { - return this.$t.color.getFontColorInternalClass(this.fontColor) + return this.$tn.color.getFontColorInternalClass(this.fontColor) }, fontSizeStyle() { - return this.$t.string.getLengthUnitValue(this.fontSize, this.fontUnit) + return this.$tn.string.getLengthUnitValue(this.fontSize, this.fontUnit) } }, methods: { diff --git a/tuniao-ui/libs/mixin/mixin.js b/tuniao-ui/libs/mixin/mixin.js index 9c4d881..5895bc1 100644 --- a/tuniao-ui/libs/mixin/mixin.js +++ b/tuniao-ui/libs/mixin/mixin.js @@ -4,12 +4,12 @@ module.exports = { }, onLoad() { // getRect挂载再$t上,用为这个方法需要使用in(this),所以无法把它独立层一个单独的文件导出 - this.$t.getRect = this._tGetRect + this.$tn.getRect = this._tGetRect }, beforeDestory() { // 判断当前页面是否存在parent和children // 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱 - if (this.parent && uni.$t.test.array(this.parent.children)) { + if (this.parent && uni.$tn.test.array(this.parent.children)) { // 组件销毁时,移除子组件在父组件children数组中的实例 const childrenList = this.parent.children childrenList.map((child, index) => { @@ -50,7 +50,7 @@ module.exports = { // 通过获取父组件实例 // 将父组件this中对应的参数,赋值给本组件的parentData对象中对应的属性 // 头条小程序不支持通过this.parent.xxx去监听父组件参数的变化,所以需要本方法进行实现 - this.parent = this.$t.$parent.call(this, parentName) + this.parent = this.$tn.$parent.call(this, parentName) if (this.parent) { // 遍历parentData中的属性,将parent中同名的属性赋值给parentData Object.keys(this.parentData).map(key => { diff --git a/tuniao-ui/libs/mixin/mpShare.js b/tuniao-ui/libs/mixin/mpShare.js index 14dff82..fe0908e 100644 --- a/tuniao-ui/libs/mixin/mpShare.js +++ b/tuniao-ui/libs/mixin/mpShare.js @@ -1,7 +1,7 @@ module.exports = { onLoad() { // 设置默认的转发参数 - this.$t.mpShare = { + this.$tn.mpShare = { // 分享的标题,默认为小程序名称 title: '', // 分享的路径,默认为当前页面 @@ -11,19 +11,19 @@ module.exports = { // 当前页面是否可以分享 share: true } - if (!this.$t.mpShare.share) { + if (!this.$tn.mpShare.share) { uni.hideShareMenu() } }, onShareAppMessage() { - return this.$t.mpShare + return this.$tn.mpShare }, // #ifdef MP-WEIXIN onShareTimeline() { return { - title: this.$t.mpShare.title, - query: this.$t.mpShare.path.substring(this.$t.mpShare.path.indexOf('?') + 1, this.$t.mpShare.path.length), - imageUrl: this.$t.mpShare.imageUrl + title: this.$tn.mpShare.title, + query: this.$tn.mpShare.path.substring(this.$tn.mpShare.path.indexOf('?') + 1, this.$tn.mpShare.path.length), + imageUrl: this.$tn.mpShare.imageUrl } } // #endif