mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:13:26 +08:00
Merge branch 'feat/bob_dev_merge' into 'master'
uniapp【优化】: 用户登录的状态根据后台开关是否开启,通过分享进去设置上下级 See merge request jianweie/coreshoppro!66
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<view class="fix-bottom-btn">
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<view class="btn">
|
||||
<coreshop-button class="btn" v-bind="$attrs" @onClick="onClick()"></coreshop-button>
|
||||
<coreshop-button v-bind="$attrs" @onClick="onClick()"></coreshop-button>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
|
||||
@@ -210,6 +210,7 @@
|
||||
uni.setStorageSync(UserToken, phoneNumber.data.token);
|
||||
if (phoneNumber.otherData) {
|
||||
userInfoStore.setUserInfo(phoneNumber.otherData);
|
||||
uni.removeStorageSync(Invitecode);
|
||||
handleShowToast('登录成功', 'success');
|
||||
emits('getUserInfo')
|
||||
}
|
||||
|
||||
@@ -163,3 +163,9 @@ export enum ShowMenuEnum {
|
||||
show = 1,
|
||||
hidden = 2
|
||||
}
|
||||
|
||||
/** 是否开启二次扫码实现与上级绑定 */
|
||||
export enum AllowUserSecondBindEnum {
|
||||
yes = 1,
|
||||
no = 2,
|
||||
}
|
||||
@@ -15,6 +15,7 @@ export interface ShopConfigType {
|
||||
indexPopupWindowHrefUrl ?: string;
|
||||
indexPopupWindowImageUrl ?: string;
|
||||
invoiceSwitch ?: number;
|
||||
isAllowUserSecondBind ?: number;
|
||||
|
||||
/** 余额提现 */
|
||||
isAllowWithdrawCash ?: number;
|
||||
|
||||
@@ -133,6 +133,8 @@
|
||||
|
||||
/** 返回上一个页面 */
|
||||
handleShowToast(login.msg, 'success', () => {
|
||||
clearInterval(state.intervalTime);
|
||||
uni.removeStorageSync(Invitecode);
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1000)
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
<template>
|
||||
<uv-loading-page :loading="loading" loading-text="加载中..." color="#d33123" loadingColor="#d33123" font-size="24rpx"
|
||||
bgColor="rgba(255, 255, 255, 0.2)"></uv-loading-page>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { handleRouteSwitchTab, handleRouteRedirectTo, handleShowToast } from '@/core/utils';
|
||||
import { queryDeshare } from '@/core/api';
|
||||
import { queryDeshare, setMyInvite } from '@/core/api';
|
||||
import type { Response } from '@/core/models';
|
||||
import { Invitecode } from '@/core/consts';
|
||||
import { ShareEnum } from '@/core/enum';
|
||||
import { Invitecode, UserToken } from '@/core/consts';
|
||||
import { ShareEnum, AllowUserSecondBindEnum } from '@/core/enum';
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
|
||||
interface QueryParams {
|
||||
scene : string | number;
|
||||
}
|
||||
|
||||
/** 获取项目配置 */
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
|
||||
const loading = ref(true);
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
if (query?.scene) {
|
||||
handleShare(query?.scene)
|
||||
@@ -22,9 +31,24 @@
|
||||
|
||||
const handleShare = async (code : string | number) => {
|
||||
const shareData : Response<any> = await queryDeshare({ code, });
|
||||
if (!shareData.status) {
|
||||
loading.value = false;
|
||||
handleShowToast('跳转失败', 'error', () => {
|
||||
setTimeout(() => {
|
||||
handleRouteSwitchTab();
|
||||
}, 1000)
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
if (shareData.status) {
|
||||
/** 登录状态 + 后台开启 设置上下级 */
|
||||
if (uni.getStorageSync(UserToken) && shopConfigStore.config?.isAllowUserSecondBind === AllowUserSecondBindEnum.yes) {
|
||||
await setMyInvite({ id: shareData.data?.userShareCode });
|
||||
}else{
|
||||
uni.setStorageSync(Invitecode, shareData.data?.userShareCode);
|
||||
}
|
||||
|
||||
loading.value = false;
|
||||
switch (Number(shareData.data?.page)) {
|
||||
/** 首页*/
|
||||
case ShareEnum.index:
|
||||
@@ -130,13 +154,7 @@
|
||||
handleRouteSwitchTab();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
handleShowToast('跳转失败', 'error', () => {
|
||||
setTimeout(() => {
|
||||
handleRouteSwitchTab();
|
||||
}, 1000)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
Reference in New Issue
Block a user