Compare commits

..

No commits in common. '4907ac0fda1702d7ff1a4f42790ed4f5aae763e6' and '3f46d250d0c42ddccf5d74f02dda6ab893cd2ad1' have entirely different histories.

@ -30,10 +30,9 @@ export const constantRoutes = [
path: '/m/:code',
redirect: (to) => {
// 保存参数到本地缓存或 cookie
// localStorage.setItem('inviteCode', to.params.code)
localStorage.setItem('inviteCode', to.params.code)
// 如果需要使用 cookie可以使用 document.cookie = 'inviteCode=' + to.params.code
document.cookie = 'inviteCode=' + to.params.code+'; domain=api2gpt.com; path=/'
window.location.href = 'https://www.api2gpt.com'
return '/register'
}
},
{

@ -244,14 +244,3 @@ export function getNormalPath(p) {
export function blobValidate(data) {
return data.type !== 'application/json'
}
// 定义获取 cookie 的函数
export function getCookie(name) {
const regexp = new RegExp('(^| )' + name + '=([^;]*)(;|$)')
const result = document.cookie.match(regexp)
if (result) {
return result[2]
} else {
return null
}
}

@ -95,12 +95,11 @@
<script setup>
import { ElAlert, ElMessageBox } from "element-plus";
import { getCodeMail, register } from "@/api/login";
import { getCookie } from '@/utils/ruoyi'
const router = useRouter();
const { proxy } = getCurrentInstance();
const inviteCode = getCookie('inviteCode')
const inviteCode = localStorage.getItem('inviteCode') || ''
const registerForm = ref({
username: "",
password: "",

Loading…
Cancel
Save