|
@@ -56,8 +56,7 @@
|
|
|
import { ref, reactive, onMounted } from 'vue'
|
|
|
import { useRouter } from 'vue-router' // 根据实际情况选择路由库
|
|
|
import store from '@/store'
|
|
|
-import { onShow } from '@dcloudio/uni-app'
|
|
|
-
|
|
|
+import { onShow, onLoad } from '@dcloudio/uni-app'
|
|
|
|
|
|
const imagePath = '/static/9efd1.png' // Path to the logo image (red tree)
|
|
|
|
|
@@ -69,8 +68,8 @@ const loginForm = reactive({
|
|
|
password: '',
|
|
|
code: '',
|
|
|
uuid: '',
|
|
|
- referrerType: 1,
|
|
|
- referrerId: 111,
|
|
|
+ referrerType: '',
|
|
|
+ referrerId: '',
|
|
|
})
|
|
|
|
|
|
const checkboxValue = ref(false)
|
|
@@ -84,6 +83,29 @@ const globalData = ref({
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
+// 获取小程序码参数
|
|
|
+onLoad((options) => {
|
|
|
+ console.log('onLoad options:', options)
|
|
|
+ // 处理从二维码扫描进入的场景
|
|
|
+ if (options.scene) {
|
|
|
+ const scene = decodeURIComponent(options.scene)
|
|
|
+ const params = scene.split(':')
|
|
|
+ if (params.length >= 2) {
|
|
|
+ loginForm.referrerType = params[0]
|
|
|
+ loginForm.referrerId = params[1]
|
|
|
+ console.log('从二维码获取参数:', loginForm.referrerType, loginForm.referrerId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果有直接传入的参数也可以获取
|
|
|
+ if (options.referrerType) {
|
|
|
+ loginForm.referrerType = options.referrerType
|
|
|
+ }
|
|
|
+ if (options.referrerId) {
|
|
|
+ loginForm.referrerId = options.referrerId
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
// 用户注册 - assuming this might be needed later, keeping it
|
|
|
const handleUserRegister = () => {
|
|
|
router.push('/pages/register') // 替换为实际的路由跳转逻辑
|
|
@@ -158,14 +180,11 @@ const handleLogin = async () => {
|
|
|
title: '系统暂未开放',
|
|
|
})
|
|
|
}
|
|
|
- // 保持原有的 referrerType 和 referrerId
|
|
|
- const currentReferrerType = loginForm.referrerType
|
|
|
- const currentReferrerId = loginForm.referrerId
|
|
|
|
|
|
loginForm.code = res.code
|
|
|
- // 确保 referrerType 和 referrerId 不被覆盖
|
|
|
- loginForm.referrerType = currentReferrerType
|
|
|
- loginForm.referrerId = currentReferrerId
|
|
|
+
|
|
|
+ // 打印当前登录信息
|
|
|
+ console.log('登录信息:', loginForm)
|
|
|
|
|
|
// 获取用户信息
|
|
|
uni.getUserInfo({
|