|
@@ -72,8 +72,96 @@ onLaunch((options) => {
|
|
|
// checkUpdate()
|
|
// checkUpdate()
|
|
|
// 调用初始化
|
|
// 调用初始化
|
|
|
// initTheme()
|
|
// initTheme()
|
|
|
|
|
+
|
|
|
|
|
+ // 处理 signup 路径
|
|
|
|
|
+ handleSignupRoute(options)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+// 解析 URL 参数
|
|
|
|
|
+const parseUrlParams = () => {
|
|
|
|
|
+ const params = {}
|
|
|
|
|
+
|
|
|
|
|
+ // #ifdef H5
|
|
|
|
|
+ // H5 端:直接从浏览器 URL 解析
|
|
|
|
|
+ if (typeof window !== 'undefined' && window.location) {
|
|
|
|
|
+ const href = window.location.href
|
|
|
|
|
+ // 解析 hash 部分
|
|
|
|
|
+ const hashIndex = href.indexOf('#')
|
|
|
|
|
+ if (hashIndex !== -1) {
|
|
|
|
|
+ const hash = href.substring(hashIndex + 1)
|
|
|
|
|
+ // 解析路径
|
|
|
|
|
+ const pathMatch = hash.match(/^\/([^/?]+)/)
|
|
|
|
|
+ if (pathMatch) {
|
|
|
|
|
+ params.path = pathMatch[1]
|
|
|
|
|
+ }
|
|
|
|
|
+ // 解析路径参数 signup/19628/RHOP4WVa/B0
|
|
|
|
|
+ const pathParams = hash.match(/^\/signup\/([^/]+)\/?([^/]+)?\/?([^/]+)?/)
|
|
|
|
|
+ if (pathParams) {
|
|
|
|
|
+ params.path = 'signup'
|
|
|
|
|
+ params.p1 = pathParams[1]
|
|
|
|
|
+ params.p2 = pathParams[2]
|
|
|
|
|
+ params.p3 = pathParams[3]
|
|
|
|
|
+ }
|
|
|
|
|
+ // 解析 query 参数
|
|
|
|
|
+ const queryIndex = hash.indexOf('?')
|
|
|
|
|
+ if (queryIndex !== -1) {
|
|
|
|
|
+ const queryStr = hash.substring(queryIndex + 1)
|
|
|
|
|
+ const pairs = queryStr.split('&')
|
|
|
|
|
+ pairs.forEach(pair => {
|
|
|
|
|
+ const [key, value] = pair.split('=')
|
|
|
|
|
+ if (key && value) {
|
|
|
|
|
+ params[key] = decodeURIComponent(value)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // #endif
|
|
|
|
|
+
|
|
|
|
|
+ // #ifndef H5
|
|
|
|
|
+ // App 端:从 options 参数获取
|
|
|
|
|
+ if (typeof options === 'object' && options !== null) {
|
|
|
|
|
+ Object.assign(params, options)
|
|
|
|
|
+ }
|
|
|
|
|
+ // #endif
|
|
|
|
|
+
|
|
|
|
|
+ return params
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 处理 signup 路径
|
|
|
|
|
+const handleSignupRoute = (options) => {
|
|
|
|
|
+ // 解析 URL 参数(优先从浏览器 URL 解析)
|
|
|
|
|
+ const query = parseUrlParams()
|
|
|
|
|
+
|
|
|
|
|
+ // 如果浏览器解析不到,再使用 options 参数
|
|
|
|
|
+ if (Object.keys(query).length === 0 && options) {
|
|
|
|
|
+ Object.assign(query, options)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 判断是否是 signup 路径
|
|
|
|
|
+ const isSignup = query.path === 'signup' || query.s || query.signup || query.activeTab === '2'
|
|
|
|
|
+
|
|
|
|
|
+ if (!isSignup) return
|
|
|
|
|
+
|
|
|
|
|
+ // 获取参数
|
|
|
|
|
+ const id = query.id || query.agentId || query.p1 || ''
|
|
|
|
|
+ const subId = query.subId || query.w || query.p2 || ''
|
|
|
|
|
+ const code = query.code || query.oc || query.p3 || ''
|
|
|
|
|
+
|
|
|
|
|
+ // 构建登录页面 URL
|
|
|
|
|
+ let loginUrl = '/pages/login/index?activeTab=2'
|
|
|
|
|
+
|
|
|
|
|
+ // 携带参数
|
|
|
|
|
+ if (id) loginUrl += `&id=${id}`
|
|
|
|
|
+ if (subId) loginUrl += `&subId=${subId}`
|
|
|
|
|
+ if (code) loginUrl += `&code=${code}`
|
|
|
|
|
+
|
|
|
|
|
+ // 跳转到注册页面
|
|
|
|
|
+ uni.reLaunch({
|
|
|
|
|
+ url: loginUrl
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
watch(locale, () => {
|
|
watch(locale, () => {
|
|
|
// const currentPath = route.path;
|
|
// const currentPath = route.path;
|
|
|
// menu.value.forEach((item, index) => {
|
|
// menu.value.forEach((item, index) => {
|