记录app来源

This commit is contained in:
lccsw
2025-11-21 10:30:17 +08:00
parent 032352eeab
commit 0a8fc16800
3 changed files with 21 additions and 1 deletions
+11
View File
@@ -5,6 +5,7 @@ import { nextTick, onMounted, ref } from 'vue'
import { WechatAuth } from '@/utils/wechat'
import LoginModal from './components/LoginModal.vue'
import loginService from './services/loginService'
import { LOCAL_URL_CFROM,LOCAL_URL_CITY_ID } from './constants/common';
// 获取当前URL参数
const urlParams = new URLSearchParams(window.location.search);
@@ -12,6 +13,16 @@ const urlParams = new URLSearchParams(window.location.search);
const friend_account_id = urlParams.get('friend_account_id');
const accountId = urlParams.get('accountId');
const loginModal = ref(null) // 创建 ref
const cfrom = urlParams.get('from');
const cityId = urlParams.get('cityId');
if(cfrom){
localStorage.setItem(LOCAL_URL_CFROM, cfrom);
}
if(cityId){
localStorage.setItem(LOCAL_URL_CITY_ID, cityId);
}
//微信环境
if(WechatAuth.isWechatBrowser()){
+3 -1
View File
@@ -42,6 +42,7 @@ import api from '../utils/api.js'
import { showToast } from 'vant' // 导入Toast组件
import { getBasicConfig } from '@/utils/basicSetting'
import PopContent from '@/components/PopContent.vue' // 导入PopContent组件
import { LOCAL_APP_TOKEN, LOCAL_URL_CFROM } from '../constants/common'
// 响应式数据
const isVisible = ref(false)
@@ -131,9 +132,10 @@ const handleLogin = async () => {
const response = await api.post('/auto/login/mobile', {
mobile: mobile.value,
code: code.value,
cfrom: localStorage.getItem(LOCAL_URL_CFROM)
})
if (response.code === 200 && response.data.Authorization) {
localStorage.setItem('token', response.data.Authorization)
localStorage.setItem(LOCAL_APP_TOKEN, response.data.Authorization)
closeModal()
if (callback.value) {
callback.value()
+7
View File
@@ -0,0 +1,7 @@
/**
* 公共常量
*/
// 本地存储
export const LOCAL_APP_TOKEN = 'token' //系统token
export const LOCAL_URL_CFROM = 'url_cfrom' //跳转来源
export const LOCAL_URL_CITY_ID = 'url_cityId' //来源城市ID