diff --git a/uni-app/src/App.vue b/uni-app/src/App.vue index 6c0cf899f..013673d67 100644 --- a/uni-app/src/App.vue +++ b/uni-app/src/App.vue @@ -8,7 +8,7 @@ import { useLogin } from '@/hooks/useLogin' import { useShare } from '@/hooks/useShare' - onLaunch(async(data) => { + onLaunch(async(data: any) => { // 添加初始化拦截器 launchInterceptor() @@ -53,11 +53,11 @@ // #ifdef MP const updateManager = uni.getUpdateManager(); - updateManager.onCheckForUpdate(function(res) { + updateManager.onCheckForUpdate(function (res) { // 请求完新版本信息的回调 }); - updateManager.onUpdateReady(function(res) { + updateManager.onUpdateReady(function (res) { uni.showModal({ title: '更新提示', content: '新版本已经准备好,是否重启应用?', @@ -70,7 +70,7 @@ }); }); - updateManager.onUpdateFailed(function(res) { + updateManager.onUpdateFailed(function (res) { // 新的版本下载失败 }); // #endif @@ -82,76 +82,90 @@ useSystemStore().getMapFn() useSystemStore().getSiteInfoFn() useMemberStore().getMemberLevel() + try { - // 隐藏tabbar - uni.hideTabBar() + uni.hideTabBar() // 隐藏tabbar } catch (e) { } // 判断在登录注册页面账号锁定后不进行请求三方登录注册 - let url = currRoute() - if ((url == 'app/pages/auth/login' || url == 'app/pages/auth/register') && (configStore.login.is_username || configStore.login.is_mobile || configStore.login.is_bind_mobile)) { + let url: any = currRoute() + if ((['app/pages/auth/index', 'app/pages/auth/login', 'app/pages/auth/register', 'app/pages/auth/resetpwd'].indexOf(url) != -1) && (configStore.login.is_username || configStore.login.is_mobile || configStore.login.is_bind_mobile)) { return false } // 判断是否已登录 if (getToken()) { - const memberStore = useMemberStore() - await memberStore.setToken(getToken()) + const memberStore: any = useMemberStore() - setTimeout(() => { + await memberStore.setToken(getToken(), () => { if (!uni.getStorageSync('openid')) { const memberInfo = useMemberStore().info const login = useLogin() + // #ifdef MP-WEIXIN + if (memberInfo.mobile) uni.setStorageSync('wap_member_mobile', memberInfo.mobile) // 存储会员手机号,防止重复请求微信获取手机号接口 if (memberInfo && memberInfo.weapp_openid) { uni.setStorageSync('openid', memberInfo.weapp_openid) } else { - login.getAuthCode('', true) + login.getAuthCode({ updateFlag: true }) // 更新oppenid } // #endif + // #ifdef H5 if (isWeixinBrowser()) { if (memberInfo && memberInfo.wx_openid) { uni.setStorageSync('openid', memberInfo.wx_openid) } else { - data.query.code ? login.updateOpenid(data.query.code) : login.getAuthCode('snsapi_userinfo') + data.query.code ? login.updateOpenid(data.query.code) : login.getAuthCode({ scopes: 'snsapi_userinfo' }) } } // #endif + } + // 开启强制绑定手机号 if (uni.getStorageSync('isbindmobile')) { uni.removeStorageSync('isbindmobile'); } + if (configStore.login.is_bind_mobile && !memberStore.info.mobile) { // 强制绑定手机号 uni.setStorageSync('isbindmobile', true) } - }, 1000) + }) + } + if (!getToken()) { - // todo 退出后不进行自动登录 + // #ifdef MP - if(uni.getStorageSync('autoLoginLock')){ - return false - } + // 小程序 会员退出后不会自动登录 + if (uni.getStorageSync('autoLoginLock')) return; // #endif + + const login = useLogin() + + // #ifdef MP // 判断是否开启第三方自动注册登录 if (configStore.login.is_auth_register) { - const login = useLogin() // 第三方平台自动登录 - // #ifdef MP login.getAuthCode() - // #endif - // #ifdef H5 - if (isWeixinBrowser()) { - data.query.code ? login.authLogin(data.query.code) : login.getAuthCode('snsapi_userinfo') - } - // #endif } + // #endif + + // #ifdef H5 + if (isWeixinBrowser()) { + if (uni.getStorageSync('autoLoginLock') && !uni.getStorageSync('wechat_login_back')) return; + if (configStore.login.is_auth_register || uni.getStorageSync('wechat_login_back')) { + uni.removeStorageSync('wechat_login_back') // 删除微信公众号手动授权登录回调标识 + data.query.code ? login.authLogin({ code: data.query.code }) : login.getAuthCode({ scopes: 'snsapi_userinfo' }) + } + } + // #endif } + }) onShow(() => { diff --git a/uni-app/src/addon/components/diy/group/index.scss b/uni-app/src/addon/components/diy/group/index.scss index dce75f40c..852605e70 100644 --- a/uni-app/src/addon/components/diy/group/index.scss +++ b/uni-app/src/addon/components/diy/group/index.scss @@ -1,29 +1,29 @@ -.draggable-element,.ignore-draggable-element { - &.decorate { - &:hover:before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - border: 4rpx dotted $u-primary; - z-index: 10; - pointer-events: none; - cursor: move; - } +.draggable-element { + &.decorate { + &:hover:before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + border: 4rpx dotted $u-primary; + z-index: 10; + pointer-events: none; + cursor: move; + } - &.selected:before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - border: 4rpx solid $u-primary; - z-index: 10; - pointer-events: none; - cursor: move; - } - } + &.selected:before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + border: 4rpx solid $u-primary; + z-index: 10; + pointer-events: none; + cursor: move; + } + } } diff --git a/uni-app/src/addon/components/diy/group/useDiyGroup.ts b/uni-app/src/addon/components/diy/group/useDiyGroup.ts index 1df11015f..d3ad816b0 100644 --- a/uni-app/src/addon/components/diy/group/useDiyGroup.ts +++ b/uni-app/src/addon/components/diy/group/useDiyGroup.ts @@ -7,8 +7,8 @@ import { getLocation } from '@/utils/common'; export function useDiyGroup(params: any = {}) { - let scrollVal = ""; //组件滚动值集合 - const componentsScrollBool = ref({}); //组件是否根据滚动进行相应改变 + let scrollVal: any = ""; //组件滚动值集合 + const componentsScrollBool: any = ref({}); //组件是否根据滚动进行相应改变 const diyStore = useDiyStore(); const positionFixed = ref(['fixed', 'top_fixed', 'right_fixed', 'bottom_fixed', 'left_fixed']); @@ -77,7 +77,7 @@ export function useDiyGroup(params: any = {}) { diyStore.value.splice(event.newIndex!, 0, temp); nextTick(() => { - sortable.sort(range(diyStore.value.length).map(value => { + sortable.sort(range(diyStore.value.length).map((value: any) => { return value.toString(); })); @@ -94,17 +94,16 @@ export function useDiyGroup(params: any = {}) { // 第一次获取经纬度 getLocation() } + + // 初始化组件滚动值 + scrollVal = uni.getStorageSync('componentsScrollValGroup'); + if (scrollVal) { + for (let key in scrollVal) { + componentsScrollBool.value[key] = -1; + } + } }, 500) - - // 初始化组件滚动值 - scrollVal = uni.getStorageSync('componentsScrollValGroup'); - if (scrollVal) { - for (let key in scrollVal) { - componentsScrollBool.value[key] = -1; - } - } }); - }); } @@ -120,7 +119,7 @@ export function useDiyGroup(params: any = {}) { const placeholderEvent = () => { } - let isPagesHide = ref(false) + const isPagesHide = ref(false) onShow(() => { isPagesHide.value = false; }) @@ -129,7 +128,7 @@ export function useDiyGroup(params: any = {}) { }) // 监听滚动事件 - let scrollValStr = ref() + const scrollValStr = ref() const onPageScrollLifeCycle = () => { onPageScroll((e) => { if (scrollVal && !isPagesHide.value) { diff --git a/uni-app/src/app/api/auth.ts b/uni-app/src/app/api/auth.ts index 593576d3c..f016ff99e 100644 --- a/uni-app/src/app/api/auth.ts +++ b/uni-app/src/app/api/auth.ts @@ -111,7 +111,7 @@ export function bind(data : AnyObject) { } /** - * 记录会员访问日志 + * 记录会员访问日志【目前只更新最后访问时间】 */ export function memberLog(data : AnyObject) { return request.post('member/log', data, { showErrorMessage: false }) diff --git a/uni-app/src/app/api/diy.ts b/uni-app/src/app/api/diy.ts index e3f971f18..45a545d44 100644 --- a/uni-app/src/app/api/diy.ts +++ b/uni-app/src/app/api/diy.ts @@ -7,13 +7,6 @@ export function getDiyInfo(params: Record) { return request.get('diy/diy', params) } -/** - * 获取底部导航信息 - */ -export function getTabbarInfo(params: Record) { - return request.get('diy/tabbar', params) -} - /** * 获取底部导航列表 */ diff --git a/uni-app/src/app/components/diy/active-cube/index.vue b/uni-app/src/app/components/diy/active-cube/index.vue index 3246d64fc..8b7e21935 100644 --- a/uni-app/src/app/components/diy/active-cube/index.vue +++ b/uni-app/src/app/components/diy/active-cube/index.vue @@ -2,26 +2,26 @@ - + - {{ diyComponent.text }} - {{ diyComponent.subTitle.text }} + {{ diyComponent.text }} + {{ diyComponent.subTitle.text }} - {{ diyComponent.text }} - {{ diyComponent.subTitle.text }} + {{ diyComponent.text }} + {{ diyComponent.subTitle.text }} - {{ diyComponent.text }} - - {{ diyComponent.subTitle.text }} - - + {{ diyComponent.text }} + + {{ diyComponent.subTitle.text }} + - {{ diyComponent.text }} - + {{ diyComponent.text }} + {{ diyComponent.subTitle.text }} @@ -29,11 +29,11 @@ - + - - + + @@ -75,15 +75,15 @@ - {{ item.title.text }} + {{ item.title.text }} - - + + @@ -92,9 +92,9 @@ - {{ item.subTitle.text }} + {{ item.subTitle.text }} - {{ item.title.text }} + {{ item.title.text }} @@ -162,21 +162,21 @@ //商品样式三 const itemStyle3 = ref(''); const setItemStyle3 = ()=>{ - // #ifdef MP-WEIXIN + // #ifdef MP-WEIXIN uni.createSelectorQuery().in(instance).select('#warpStyle3-'+diyComponent.value.id).boundingClientRect((res:any) => { uni.createSelectorQuery().in(instance).select('#item0'+diyComponent.value.id).boundingClientRect((data:any) => { itemStyle3.value = `margin-right:${(res.width - data.width*4)/3}px;` }).exec() }).exec() // #endif - // #ifdef H5 + // #ifdef H5 itemStyle3.value= 'margin-right:14rpx;' // #endif }; //商品样式四 const itemStyle4 = ref(''); const setItemStyle4 = ()=>{ - // #ifdef MP-WEIXIN + // #ifdef MP-WEIXIN uni.createSelectorQuery().in(instance).select('#warpStyle4-'+diyComponent.value.id).boundingClientRect((res:any) => { uni.createSelectorQuery().in(instance).select('#item0'+diyComponent.value.id).boundingClientRect((data:any) => { itemStyle4.value = `margin-right:${(res.width - data.width*4)/3}px;` @@ -184,7 +184,7 @@ }).exec() }).exec() // #endif - // #ifdef H5 + // #ifdef H5 itemStyle4.value= 'margin-right:14rpx;' // #endif }; diff --git a/uni-app/src/app/components/diy/carousel-search/index.vue b/uni-app/src/app/components/diy/carousel-search/index.vue index 6c659d6c0..c0c019441 100644 --- a/uni-app/src/app/components/diy/carousel-search/index.vue +++ b/uni-app/src/app/components/diy/carousel-search/index.vue @@ -11,9 +11,9 @@ - + {{isShowSearchPlaceholder ? diyComponent.search.text : ''}} - + @@ -35,7 +35,7 @@ - + @@ -57,7 +57,7 @@ 'swiper-right': diyComponent.swiper.indicatorAlign == 'right', 'ns-indicator-dots': diyComponent.swiper.indicatorStyle == 'style-2' }" - :previous-margin="swiperStyle2 ? 0 : '36rpx'" :next-margin="swiperStyle2 ? 0 : '36rpx'" + :previous-margin="swiperStyle2 ? 0 : '26rpx'" :next-margin="swiperStyle2 ? 0 : '26rpx'" :interval="diyComponent.swiper.interval * 1000" :indicator-dots="isShowDots" :indicator-color="diyComponent.swiper.indicatorColor" :indicator-active-color="diyComponent.swiper.indicatorActiveColor"> @@ -185,12 +185,12 @@ fixedStyleBg.value = false; if (props.scrollBool == 1) { - let str = diyComponent.value.fixedBgColor; + let str = diyComponent.value.fixedBgColor || ""; let arr = str.split(','); - let num = diyComponent.value.fixedBgColor ? parseInt(arr[arr.length-1]) : 0; - if(!diyComponent.value.fixedBgColor || num == 0 ){ + let num = diyComponent.value.fixedBgColor ? parseInt(arr[arr.length - 1]) : 0; + if (!diyComponent.value.fixedBgColor || num == 0) { fixedStyleBg.value = true; - }else{ + } else { fixedStyleBg.value = false; style += 'background-color:' + diyComponent.value.fixedBgColor + ';'; } @@ -245,8 +245,7 @@ // 轮播样式二 const swiperStyle2 = computed(()=>{ - var style = false; - style = diyComponent.value.swiper.swiperStyle == 'style-2' ? true : false; + var style = diyComponent.value.swiper.swiperStyle == 'style-2' ? true : false; return style; }) @@ -292,7 +291,7 @@ } const tabAllPopup = ref(false); - let menuButtonInfo:any = {}; + let menuButtonInfo: any = {}; const navbarInnerStyle = ref('') onMounted(() => { @@ -367,7 +366,7 @@ diyPageData.global.bottomTabBarSwitch = false; // 子页面不需要展示底部导航 diyPageData.value = sources.value; - diyPageData.value.forEach((item, index) => { + diyPageData.value.forEach((item: any, index) => { item.pageStyle = ''; if(item.pageStartBgColor) { if (item.pageStartBgColor && item.pageEndBgColor) item.pageStyle += `background:linear-gradient(${item.pageGradientAngle},${item.pageStartBgColor},${item.pageEndBgColor});`; @@ -465,7 +464,7 @@ justify-content: center; width: 140rpx; height: 60rpx; - margin-right: 20rpx; + margin-right: 30rpx; image{ width: 100%; height:100%; @@ -483,8 +482,8 @@ .input-content, .uni-input { box-sizing: border-box; display: block; - height: 64rpx; - line-height: 68rpx; + height: 60rpx; + line-height: 64rpx; width: 100%; padding-right: 20rpx; color: #fff; @@ -528,22 +527,22 @@ font-size: 28rpx; color: #333; line-height: 38rpx; - margin-bottom: 10rpx; + margin-bottom: 15rpx; } &.active { position: relative; .name { - font-size: 32rpx; + font-size: 28rpx; line-height: 38rpx; - font-weight: bold; + font-weight: 700; } .line{ position: absolute; - bottom: 0; + bottom: 1rpx; width: 34rpx; height: 4rpx; - border-radius: 29%; + border-radius: 2rpx; left: 50%; transform: translateX(-50%); } @@ -559,11 +558,11 @@ &::after{ content: ""; position: absolute; - top: 6rpx; - bottom: -2rpx; + top: 2rpx; + bottom: -4rpx; left: -14rpx; - width: 4rpx; - background: linear-gradient( 180deg, #FFFFFF 16%, rgba(255,255,255,0) 92%); + width: 2rpx; + background: linear-gradient( 180deg, #FFFFFF 16%, rgba(255,255,255,0) 86%); } /* #endif */ /* #ifdef MP-WEIXIN */ @@ -588,7 +587,7 @@ background-color: var(--primary-color-light); } .swiper-animation{ - transform: scale(0.94, 0.94); + transform: scale(0.96, 0.96); transition-duration: 0.3s; transition-timing-function: ease; } diff --git a/uni-app/src/app/components/diy/float-btn/index.vue b/uni-app/src/app/components/diy/float-btn/index.vue index 78eb016e5..9c569fdbf 100644 --- a/uni-app/src/app/components/diy/float-btn/index.vue +++ b/uni-app/src/app/components/diy/float-btn/index.vue @@ -80,7 +80,7 @@ //样式二 const styleTwoRepeat = ref(true) - const styleTwoRepeatTime = ref(null) + const styleTwoRepeatTime: any = ref(null) const styleTwoWarpCss = computed(() => { var style = ''; if(diyComponent.value.componentStartBgColor) { diff --git a/uni-app/src/app/components/diy/graphic-nav/index.vue b/uni-app/src/app/components/diy/graphic-nav/index.vue index 2232961c2..f159f3055 100644 --- a/uni-app/src/app/components/diy/graphic-nav/index.vue +++ b/uni-app/src/app/components/diy/graphic-nav/index.vue @@ -62,7 +62,7 @@ {{ item.title }} @@ -98,7 +98,7 @@ {{ item.title }} @@ -138,7 +138,7 @@ {{ item.title }} diff --git a/uni-app/src/app/components/diy/member-info/index.vue b/uni-app/src/app/components/diy/member-info/index.vue index 1f82b0d42..7e1170d2d 100644 --- a/uni-app/src/app/components/diy/member-info/index.vue +++ b/uni-app/src/app/components/diy/member-info/index.vue @@ -7,7 +7,7 @@ - + {{ info.nickname }} @@ -20,15 +20,15 @@ - - - + + + {{ t('login') }}/{{ t('register') }} - - + + @@ -59,10 +59,6 @@ - - - - @@ -151,24 +147,43 @@ }) const toLogin = () => { - if(configStore.login.is_username || configStore.login.is_mobile || configStore.login.is_bind_mobile){ - useLogin().setLoginBack({ url: '/app/pages/member/index' }) - }else if(configStore.login.is_auth_register){ // 判断是否开启第三方自动注册登录 - // 第三方平台自动登录 - // #ifdef MP - useLogin().getAuthCode() - // #endif - // #ifdef H5 - if (isWeixinBrowser()) { - useLogin().getAuthCode('snsapi_userinfo') - } - // #endif - }else{ - uni.showToast({ title: '商家未开启注册方式', icon: 'none' }) + let normalLogin = !configStore.login.is_username && !configStore.login.is_mobile && !configStore.login.is_bind_mobile; // 未开启普通登录 + let authRegisterLogin = !configStore.login.is_auth_register; // 自动注册登录 + + // #ifdef H5 + if (isWeixinBrowser()) { + // 微信浏览器 + if (normalLogin && authRegisterLogin) { + uni.showToast({ title: '商家未开启登录注册', icon: 'none' }) + } else if (configStore.login.is_username || configStore.login.is_mobile || configStore.login.is_bind_mobile) { + useLogin().setLoginBack({ url: '/addon/shop/pages/member/index' }) + } else if (normalLogin && configStore.login.is_auth_register) { + // 判断是否开启第三方自动注册登录 + useLogin().getAuthCode({ scopes: 'snsapi_userinfo' }) + } + } else { + // 普通浏览器 + if (normalLogin) { + uni.showToast({ title: '商家未开启登录注册', icon: 'none' }) + } else if (configStore.login.is_username || configStore.login.is_mobile || configStore.login.is_bind_mobile) { + useLogin().setLoginBack({ url: '/addon/shop/pages/member/index' }) + } } + // #endif + + // #ifdef MP + if (normalLogin && authRegisterLogin) { + uni.showToast({ title: '商家未开启登录注册', icon: 'none' }) + } else if (configStore.login.is_username || configStore.login.is_mobile || configStore.login.is_bind_mobile) { + useLogin().setLoginBack({ url: '/addon/shop/pages/member/index' }) + } else if (normalLogin && configStore.login.is_auth_register) { + // 判断是否开启第三方自动注册登录 + useLogin().getAuthCode() + } + // #endif } - const infoFill = ref(false) + const infoFill: any = ref(false) const clickAvatar = () => { // #ifdef MP-WEIXIN infoFill.value.show = true @@ -176,13 +191,13 @@ // #ifdef H5 if (isWeixinBrowser()) { - useLogin().getAuthCode('snsapi_userinfo') + useLogin().getAuthCode({ scopes : 'snsapi_userinfo' }) } else { redirect({ url: '/app/pages/member/personal' }) } // #endif } - let menuButtonInfo = {}; + let menuButtonInfo: any = {}; // 如果是小程序,获取右上角胶囊的尺寸信息,避免导航栏右侧内容与胶囊重叠(支付宝小程序非本API,尚未兼容) // #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ menuButtonInfo = uni.getMenuButtonBoundingClientRect(); diff --git a/uni-app/src/app/components/diy/member-level/index.vue b/uni-app/src/app/components/diy/member-level/index.vue index 6d24d2ff1..f7ff08a26 100644 --- a/uni-app/src/app/components/diy/member-level/index.vue +++ b/uni-app/src/app/components/diy/member-level/index.vue @@ -1,61 +1,60 @@