Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
224db6202c | |||
dbd3800314 | |||
4545fbfab5 | |||
49af2cd078 | |||
bca9390042 | |||
bad6348393 |
@ -112,7 +112,7 @@ export default {
|
||||
if(options?.path?.includes('ticketsBuy/ticketsBuy') && options?.query.couponsId) {
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: 'pages/common/groupbuy/index?id=' + options?.query.couponsId
|
||||
url: 'pages/common/groupbuy/detail?id=' + options?.query.couponsId
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
"modules": {}
|
||||
},
|
||||
"mp-weixin": {
|
||||
"appid": "wx92e663dc11d0c0a8",
|
||||
"appid": "wx67a750d0ceed4d88",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
},
|
||||
|
@ -38,6 +38,12 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "肃客会员"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/coupons/ticketsBuy/ticketsBuy",
|
||||
"style": {
|
||||
"navigationBarTitleText": "团购详情"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
|
@ -26,29 +26,22 @@
|
||||
<script setup lang='ts'>
|
||||
import { useUserStore } from '@/store';
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { getRegisterStoreId, showToast } from '@/utils';
|
||||
import { showToast } from '@/utils';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const isAgreePrivacy = ref(false);
|
||||
|
||||
async function wechatLogin() {
|
||||
function wechatLogin() {
|
||||
if(!isAgreePrivacy.value) {
|
||||
showToast('请先阅读并同意小程序隐私保护协议');
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading();
|
||||
userStore.login().then(() => {
|
||||
uni.hideLoading();
|
||||
uni.reLaunch({ url: '/pages/home/index' });
|
||||
});
|
||||
// await uni.showLoading();
|
||||
// const result = await userStore.login();
|
||||
// uni.hideLoading();
|
||||
// if(result) {
|
||||
// await uni.reLaunch({ url: '/pages/home/index' });
|
||||
// } else {
|
||||
// await uni.navigateTo({ url: '/pages/common/register/index' });
|
||||
// }
|
||||
}
|
||||
|
||||
const bindCheck = () => {
|
||||
|
@ -120,7 +120,7 @@ const save = async () => {
|
||||
avatarUrl: avatarUrl.value,
|
||||
nickName: nickName.value,
|
||||
telephone: telephone.value,
|
||||
birthday: dayjs(birthday.value).format('YYYY-MM-DD HH:mm:ss'),
|
||||
birthday: dayjs(birthday.value).isValid() ? dayjs(birthday.value).format('YYYY-MM-DD HH:mm:ss') : dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
gender: gender.value
|
||||
};
|
||||
|
||||
|
29
src/pages/coupons/ticketsBuy/ticketsBuy.vue
Normal file
29
src/pages/coupons/ticketsBuy/ticketsBuy.vue
Normal file
@ -0,0 +1,29 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
onLoad((options) => {
|
||||
getApp().logger?.info('ticketsBuy options: ', options);
|
||||
let couponId = options?.couponsId;
|
||||
if(options?.query && couponId == undefined) {
|
||||
const params = decodeURIComponent(options?.query);
|
||||
couponId = getQueryParam(params, 'couponsId');
|
||||
}
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: `/pages/common/groupbuy/detail?id=${couponId}`
|
||||
});
|
||||
}, 300);
|
||||
});
|
||||
|
||||
function getQueryParam(queryParams: string, key: string) {
|
||||
let regex = new RegExp('(?:[?&]|^)' + key + '=([^&]+)'),
|
||||
match = queryParams.match(regex);
|
||||
return match && match[1];
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
||||
</style>
|
@ -86,7 +86,7 @@ const submenuList = [
|
||||
title: '注册有礼',
|
||||
icon: assetsUrl('ic_register_gift2.png'),
|
||||
path: '/pages/common/register/reward'
|
||||
// path: '/pages/common/register/index'
|
||||
// path: '/pages/coupons/ticketsBuy/ticketsBuy?couponsId=1797773484774432769'
|
||||
},
|
||||
{
|
||||
title: '团购秒杀',
|
||||
@ -196,10 +196,14 @@ const fetchCompanyList = (fn: any = undefined) => {
|
||||
} else {
|
||||
let index = companyList.value.findIndex((res: { id: string }) => res.id === getApp().globalData?.companyId);
|
||||
//未在当前公司下注册
|
||||
if(index < 0 && !getApp()?.globalData?.storeId) {
|
||||
goPath('/pages/common/register/index');
|
||||
return;
|
||||
if(index < 0) {
|
||||
if(!getApp()?.globalData?.storeId) {
|
||||
goPath('/pages/common/register/index');
|
||||
return;
|
||||
}
|
||||
index = 0;
|
||||
}
|
||||
|
||||
userStore.setUserInfo(userList.value[index]);
|
||||
userStore.setCompanyInfo(companyList.value[index]);
|
||||
avatarModifyRemind();
|
||||
|
@ -80,7 +80,7 @@ const params = ref<{
|
||||
nickName: userInfo.value.nickName,
|
||||
telephone: userInfo.value.telephone,
|
||||
gender: userInfo.value.gender,
|
||||
birthday: userInfo.value.birthday
|
||||
birthday: userInfo.value.birthday|| dayjs().format('YYYY-MM-DD')
|
||||
});
|
||||
|
||||
onLoad(() => {
|
||||
@ -135,7 +135,7 @@ const save = async () => {
|
||||
|
||||
const result = await updateProfile({
|
||||
...params.value,
|
||||
birthday: dayjs(params.value.birthday).format('YYYY-MM-DD HH:mm:ss'),
|
||||
birthday: dayjs(birthday.value).isValid() ? dayjs(birthday.value).format('YYYY-MM-DD HH:mm:ss') : dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
birthdayType: 0
|
||||
});
|
||||
|
||||
|
@ -93,16 +93,13 @@ const useUserStore = defineStore('user', {
|
||||
// referrerUserId: getReferrerUserId()
|
||||
});
|
||||
getApp().globalData?.logger.info('login result: ', res);
|
||||
console.log('login result: ', res);
|
||||
console.log('login result: ', res.token);
|
||||
console.log('login result: ', res.sessionKey);
|
||||
setToken(res.token);
|
||||
setSessionKey(res.sessionKey);
|
||||
setOpenId(res.maOpenId);
|
||||
if(res.user){
|
||||
await this.setUserInfo(res.user);
|
||||
}else {
|
||||
this.setUserInfo(res.userInfo)
|
||||
if(res.user) {
|
||||
this.setUserInfo(res.user);
|
||||
} else {
|
||||
this.setUserInfo(res.userInfo);
|
||||
}
|
||||
// }
|
||||
resolve(res);
|
||||
@ -155,7 +152,9 @@ const useUserStore = defineStore('user', {
|
||||
if(this.userInfo) {
|
||||
this.userInfo.userDiscount = this.getUserDiscount;
|
||||
await setCompanyId(this.userInfo.companyId);
|
||||
getApp().globalData!.companyId = this.userInfo.companyId;
|
||||
if(getApp().globalData){
|
||||
getApp().globalData.companyId = this.userInfo.companyId;
|
||||
}
|
||||
} else {
|
||||
await clearToken();
|
||||
}
|
||||
@ -165,7 +164,9 @@ const useUserStore = defineStore('user', {
|
||||
|
||||
setCompanyInfo(partial: Partial<any>) {
|
||||
this.companyInfo = partial as any;
|
||||
getApp().globalData!.companyId = this.companyInfo.id;
|
||||
if(getApp()?.globalData) {
|
||||
getApp().globalData.companyId = this.companyInfo.id;
|
||||
}
|
||||
},
|
||||
|
||||
setDeliveryAddress(partial: Partial<any>) {
|
||||
|
@ -40,9 +40,11 @@ function getCompanyId() {
|
||||
}
|
||||
|
||||
function setCompanyId(companyId: string) {
|
||||
uni.setStorageSync(CompanyIdKey, companyId);
|
||||
if(getApp()?.globalData) {
|
||||
getApp().globalData!.companyId = companyId;
|
||||
if(companyId) {
|
||||
uni.setStorageSync(CompanyIdKey, companyId);
|
||||
if(getApp()?.globalData) {
|
||||
getApp().globalData.companyId = companyId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { HttpError, HttpRequestConfig, HttpResponse } from 'uview-plus/libs/luch-request';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { getCompanyId, getToken } from '@/utils/auth';
|
||||
import { showMessage } from '@/utils/request/status';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
@ -22,7 +22,7 @@ function requestInterceptors() {
|
||||
const token = getToken();
|
||||
if(token && config.header) {
|
||||
config.header.token = token;
|
||||
config.header.companyid = getApp().globalData?.companyId;
|
||||
config.header.companyid = getCompanyId();
|
||||
|
||||
// config.header.contentType = "x-www-form-urlencoded"
|
||||
}
|
||||
@ -61,7 +61,7 @@ function responseInterceptors() {
|
||||
}
|
||||
|
||||
// 登录状态失效,重新登录
|
||||
if(data.code === 4011) {
|
||||
if(data.code === 4011 || data?.retcode === 4011) {
|
||||
// 是否在获取token中,防止重复获取
|
||||
if(!isRefreshing) {
|
||||
// 修改登录状态为true
|
||||
|
Loading…
Reference in New Issue
Block a user