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