From 0708226890c66d8e62c8b9e9bd300257fd859da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E5=BE=88=E5=B7=AE=E5=95=A6?= <17633066053@163.com> Date: Wed, 29 Mar 2023 15:25:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E9=9D=A2=E5=8F=98=E9=87=8F=E5=91=BD=E5=90=8D?= =?UTF-8?q?=EF=BC=8C=E8=BF=81=E7=A7=BB=E9=A6=96=E9=A1=B5=E4=B8=AD=E6=96=B0?= =?UTF-8?q?=E4=BA=BA=E5=8F=91=E5=88=B8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/verification/verification.vue | 2 +- pages/tabbar/home/template/fetch_coupon.vue | 172 ++++++++++++++++++++ pages/tabbar/home/views.vue | 133 ++------------- 3 files changed, 188 insertions(+), 119 deletions(-) create mode 100644 pages/tabbar/home/template/fetch_coupon.vue diff --git a/components/verification/verification.vue b/components/verification/verification.vue index f10ac9e..0a6cb29 100644 --- a/components/verification/verification.vue +++ b/components/verification/verification.vue @@ -96,7 +96,7 @@ name="close" > - 刷新拼图 + 刷新拼图 Lili-FRAMEWORK diff --git a/pages/tabbar/home/template/fetch_coupon.vue b/pages/tabbar/home/template/fetch_coupon.vue new file mode 100644 index 0000000..b2ca090 --- /dev/null +++ b/pages/tabbar/home/template/fetch_coupon.vue @@ -0,0 +1,172 @@ + + + + + diff --git a/pages/tabbar/home/views.vue b/pages/tabbar/home/views.vue index a95ba4d..b6dc2de 100644 --- a/pages/tabbar/home/views.vue +++ b/pages/tabbar/home/views.vue @@ -1,37 +1,5 @@ @@ -89,12 +59,13 @@ import tpl_group from "@/pages/tabbar/home/template/tpl_group"; // import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //商品分类以及分类中的商品 // 结束引用组件 import { getFloorData } from "@/api/home"; //获取楼层装修接口 -import permision from "@/js_sdk/wa-permission/permission.js"; //权限工具类 +import permission from "@/js_sdk/wa-permission/permission.js"; //权限工具类 import config from "@/config/config"; -import {getAutoCoup} from "@/api/login" + import tpl_notice from "@/pages/tabbar/home/template/tpl_notice"; //标题栏模块 import tpl_promotions from "@/pages/tabbar/home/template/tpl_promotions_detail"; //标题栏模块 import storage from "@/utils/storage.js"; +import fetchCoupon from '@/pages/tabbar/home/template/fetch_coupon' // import {receiveCoupons} from "@/api/members" export default { @@ -103,7 +74,7 @@ export default { config, storage, coupList:[], - showCp:false, + showCp:true, pageData: "", //楼层页面数据 isIos: "", enableLoad: false, //触底加载 针对于商品模块 @@ -128,6 +99,7 @@ export default { group: tpl_group, notice: tpl_notice, promotions: tpl_promotions, + fetchCoupon }, mounted () { @@ -136,58 +108,9 @@ export default { // 小程序默认分享 uni.showShareMenu({ withShareTicket: true }); // #endif - this.firstGetAuto() + }, methods: { - firstGetAuto(){ - // console.log(123123213) - let data = new Date() - let datas = data.getDate() - let huors = data.getHours() - let flagCoup = storage.getAutoCp() - console.log(flagCoup) - console.log(datas) - if(storage.getAutoCp() && storage.getAutoCp() != '' && storage.getAutoCp() != undefined && storage.getAutoCp() != null){ - if(Number(datas) > Number(flagCoup)){ - if(Number(huors) >= 6){ - storage.setAutoCp(datas) - this.getAutoCp() - } - } - }else{ - this.getAutoCp() - } - - }, - getAutoCp(){ - let data = new Date() - let datas = data.getDate() - getAutoCoup().then(res=>{ - console.log(res) - if(res.data.success){ - this.coupList.push(...res.data.result) - if(this.coupList != ''){ - this.showCp = true - }else{ - this.showCp = false - } - storage.setAutoCp(datas) - let objs = {}; - this.coupList = this.coupList.reduce((cur, next) => { - //对象去重 - if (next.id != undefined) { - objs[next.id] - ? "" - : (objs[next.id] = true && cur.push(next)); - } - return cur; - }, []); - } - }) - }, - // receiveCoupons(v){ - - // }, /** * 实例化首页数据楼层 */ @@ -217,7 +140,7 @@ export default { * 扫描二维码登录 * 扫描其他站信息 弹出提示,返回首页。 */ - seacnCode () { + scanCode () { uni.scanCode({ success: function (res) { let path = encodeURIComponent(res.result); @@ -271,7 +194,7 @@ export default { if (this.isIos) { plus.runtime.openURL("app-settings:"); } else { - permision.gotoAppPermissionSetting(); + permission.gotoAppPermissionSetting(); } } }, @@ -290,10 +213,10 @@ export default { const iosFirstCamera = uni.getStorageSync("iosFirstCamera"); //是不是第一次开启相机 if (iosFirstCamera !== "false") { uni.setStorageSync("iosFirstCamera", "false"); //设为false就代表不是第一次开启相机 - this.seacnCode(); + this.scanCode(); } else { - if (permision.judgeIosPermission("camera")) { - this.seacnCode(); + if (permission.judgeIosPermission("camera")) { + this.scanCode(); } else { // 没有权限提醒是否去申请权限 this.tipsGetSettings(); @@ -304,13 +227,13 @@ export default { * TODO 安卓 权限已经授权了,调用api总是显示用户已永久拒绝申请。人傻了 * TODO 如果xdm有更好的办法请在 https://gitee.com/beijing_hongye_huicheng/lilishop/issues 提下谢谢 */ - this.seacnCode(); + this.scanCode(); } // #endif // #ifdef MP-WEIXIN - this.seacnCode(); + this.scanCode(); // #endif }, }, @@ -321,30 +244,4 @@ export default { .navbar-right { padding: 0 16rpx 0 0; } - -.grad1 { - width: 500rpx; - height: 200rpx; - background: radial-gradient(circle at right top, transparent 20rpx, #ff6b35 0) top left / 120rpx 51% no-repeat, - radial-gradient(circle at right bottom, transparent 20rpx, #ff6b35 0) bottom left /120rpx 51% no-repeat, - radial-gradient(circle at left top, transparent 20rpx, #ffffff 0) top right /380rpx 51% no-repeat, - radial-gradient(circle at left bottom, transparent 20rpx, #ffffff 0) bottom right /380rpx 51% no-repeat; - filter: drop-shadow(6rpx 6rpx 6rpx rgba(0,0,0,.3)); - margin: 30rpx auto; - padding-top: 2rpx; - padding-bottom: 10rpx; - padding-left: 38rpx; - padding-right: 30rpx; -} -// .grad2 { -// width: 100px; -// height: 120px; -// background: -// radial-gradient(circle at left bottom, transparent 10px, #28A4F2 0) top left /60px 30px no-repeat, -// radial-gradient(circle at right bottom, transparent 10px, #28A4F2 0) top right /60px 30px no-repeat, -// radial-gradient(circle at left top, transparent 10px, #EFEFF4 0) bottom left /60px 90px no-repeat, -// radial-gradient(circle at right top, transparent 10px, #EFEFF4 0) bottom right /60px 90px no-repeat; -// filter: drop-shadow(3rpx 3rpx 3rpx rgba(0,0,0,.3)); -// } -