问题修复
This commit is contained in:
11
src/App.vue
11
src/App.vue
@@ -1,5 +1,5 @@
|
||||
<script setup lang='ts'>
|
||||
import { mpUpdate, setReferrerUserId, setRegisterStoreId } from '@/utils';
|
||||
import { mpUpdate, setCompanyId, setReferrerUserId, setRegisterStoreId } from '@/utils';
|
||||
|
||||
onLaunch((options) => {
|
||||
console.log('App Launch options ', options);
|
||||
@@ -10,6 +10,11 @@ onLaunch((options) => {
|
||||
setReferrerUserId(options.query.referrerUserId);
|
||||
}
|
||||
|
||||
//保存注册门店id
|
||||
if(options.query.companyId) {
|
||||
setCompanyId(options.query.companyId);
|
||||
}
|
||||
|
||||
//保存注册门店id
|
||||
if(options.query.storeId) {
|
||||
setRegisterStoreId(options.query.storeId);
|
||||
@@ -25,6 +30,10 @@ onShow(() => {
|
||||
onHide(() => {
|
||||
console.log('App Hide');
|
||||
});
|
||||
|
||||
// globalData : {
|
||||
// test: '';
|
||||
// }
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
|
@@ -4,7 +4,8 @@ export interface LoginParams {
|
||||
// phone: string;
|
||||
code: string;
|
||||
userInfo: any;
|
||||
referrerUserId: string;
|
||||
storeId: string;
|
||||
// referrerUserId: string;
|
||||
}
|
||||
|
||||
export interface RegisterParams {
|
||||
|
@@ -111,8 +111,8 @@ const show = async (goodsId: string, fn: Function) => {
|
||||
}
|
||||
|
||||
if(skuSizeList) {
|
||||
//skuSizeList.value![0].existingNumber = 2;
|
||||
//skuSizeList.value![2].existingNumber = 2;
|
||||
// skuSizeList.value![0].existingNumber = 2;
|
||||
// skuSizeList.value![2].existingNumber = 2;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -57,7 +57,7 @@
|
||||
|
||||
<view class='bottom-banner-view'>
|
||||
<swiper :indicator-dots='true' :autoplay='true' :interval='3000' :duration='1000'>
|
||||
<swiper-item v-for='(item, index) in companyConfigInfo.bannerhot' :key='index'>
|
||||
<swiper-item v-for='(item, index) in companyConfigInfo?.bannerhot' :key='index'>
|
||||
<image :src='item.src' mode='aspectFill' />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
@@ -121,7 +121,7 @@ onLoad(async (e: any) => {
|
||||
pageSize: 20,
|
||||
bean: {
|
||||
keyword: '',
|
||||
typeIds: ['1724629185362591745']
|
||||
typeIds: []
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -46,7 +46,7 @@ const bindInput = async (e: any) => {
|
||||
pageSize: 100,
|
||||
bean: {
|
||||
keyword: e.detail.value,
|
||||
typeIds: ['1724629185362591745']
|
||||
typeIds: []
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -47,7 +47,7 @@
|
||||
<view class='divider' />
|
||||
<view class='c-flex-row'>
|
||||
<text>生日</text>
|
||||
<picker mode='date' :disabled='userInfo.birthday!=""' @change='changeDate'>
|
||||
<picker mode='date' :disabled='(userInfo.birthday?.length||0)!=0' @change='changeDate'>
|
||||
<text>{{ params?.birthday || '请选择生日' }}</text>
|
||||
</picker>
|
||||
</view>
|
||||
|
@@ -4,7 +4,7 @@ import { getCompanyId } from '@/utils';
|
||||
|
||||
const useShoppingCartStore = defineStore('shoppingCart', {
|
||||
state: (): { shoppingCartList: GoodsBean[] } => ({
|
||||
shoppingCartList: uni.getStorageSync(`shoppingCart_${getCompanyId()}`) == '' ? [] : uni.getStorageSync(`shoppingCart_${getCompanyId()}`) as GoodsBean[]
|
||||
shoppingCartList: uni.getStorageSync(`shoppingCart_${getCompanyId()}`) === '' ? [] : uni.getStorageSync(`shoppingCart_${getCompanyId()}`) as GoodsBean[]
|
||||
}),
|
||||
|
||||
persist: {
|
||||
@@ -33,7 +33,7 @@ const useShoppingCartStore = defineStore('shoppingCart', {
|
||||
},
|
||||
|
||||
getSameGoodsIndex: (state) => (goodsId: string, colorId: string, sizeId: string) => {
|
||||
return state.shoppingCartList.findIndex(res => res.id === goodsId && res.checkedStock.colorId === colorId && res.checkedStock.sizeId === sizeId) || -1;
|
||||
return state.shoppingCartList?.findIndex(res => res.id === goodsId && res.checkedStock.colorId === colorId && res.checkedStock.sizeId === sizeId) || -1;
|
||||
}
|
||||
},
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import type { providerType, UserBean } from './types';
|
||||
import { getTerminal, getUserProfile, login, logout as userLogout, register } from '@/api/user/index';
|
||||
import { clearToken, getReferrerUserId, getRegisterStoreId, setCompanyId, setToken } from '@/utils/auth';
|
||||
import { clearToken, getRegisterStoreId, setCompanyId, setToken } from '@/utils/auth';
|
||||
import type { LoginResult, RegisterParams, TerminalBean } from '@/api/user/types';
|
||||
import { getCompanyInfo } from '@/api/company';
|
||||
|
||||
@@ -112,27 +112,30 @@ const useUserStore = defineStore('user', {
|
||||
const res = await login({
|
||||
code: result.code,
|
||||
userInfo: userInfo,
|
||||
storeId: getRegisterStoreId()
|
||||
// referrerUserId: '1727303781559697409'
|
||||
referrerUserId: getReferrerUserId()
|
||||
// referrerUserId: getReferrerUserId()
|
||||
});
|
||||
|
||||
if(res.user == undefined || res.user.id === null) {
|
||||
const registerForm = {
|
||||
unionId: res.user.unionId,
|
||||
openId: res.user.openId,
|
||||
maOpenId: res.user.maOpenId,
|
||||
image: res.user.image,
|
||||
nickName: res.user.nickName,
|
||||
telephone: res.user.telephone,
|
||||
birthday: res.user.birthday,
|
||||
companyId: res.user.companyId,
|
||||
creatorId: res.user.creatorId,
|
||||
gender: res.user.gender,
|
||||
unionId: res.user?.unionId,
|
||||
openId: res.user?.openId,
|
||||
maOpenId: res.user?.maOpenId,
|
||||
image: res.user?.image,
|
||||
nickName: res.user?.nickName,
|
||||
telephone: res.user?.telephone,
|
||||
birthday: res.user?.birthday,
|
||||
companyId: res.user?.companyId,
|
||||
creatorId: res.user?.creatorId,
|
||||
gender: res.user?.gender,
|
||||
storeId: getRegisterStoreId()
|
||||
};
|
||||
setToken(res.token);
|
||||
const registerResult = await this.userRegister(registerForm);
|
||||
await this.setUserInfo(registerResult as LoginResult);
|
||||
if(registerResult != null) {
|
||||
setToken(res.token);
|
||||
await this.setUserInfo(registerResult as LoginResult);
|
||||
}
|
||||
} else {
|
||||
setToken(res.token);
|
||||
await this.setUserInfo(res.user);
|
||||
|
Reference in New Issue
Block a user