|
@ -68,7 +68,7 @@ import { ref, onMounted } from "vue"; |
|
|
import axios from "axios"; |
|
|
import axios from "axios"; |
|
|
import API from "@/util/http"; |
|
|
import API from "@/util/http"; |
|
|
import { useRouter } from "vue-router"; |
|
|
import { useRouter } from "vue-router"; |
|
|
|
|
|
|
|
|
|
|
|
import { ElMessage, ElMessageBox } from "element-plus"; |
|
|
const router = useRouter(); |
|
|
const router = useRouter(); |
|
|
const firstAnimating = ref(false); |
|
|
const firstAnimating = ref(false); |
|
|
const isAnimating = ref(false); |
|
|
const isAnimating = ref(false); |
|
@ -85,12 +85,28 @@ const userInfo = ref({ |
|
|
password: "123456", |
|
|
password: "123456", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const getQueryVariable = (variable) => { |
|
|
|
|
|
const href = window.location.href; |
|
|
|
|
|
const query = href.split("?")[1]; |
|
|
|
|
|
console.log("query", query); |
|
|
|
|
|
const vars = query.split("&"); |
|
|
|
|
|
for (let i = 0; i < vars.length; i++) { |
|
|
|
|
|
const pair = vars[i].split("="); |
|
|
|
|
|
if (pair[0] === variable) { |
|
|
|
|
|
return pair[1]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return ""; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const login = async function () { |
|
|
const login = async function () { |
|
|
|
|
|
const machineId = getQueryVariable("machineId"); |
|
|
|
|
|
console.log(machineId); |
|
|
try { |
|
|
try { |
|
|
const result = await axios.post(`http://18.143.76.3:10704/admin/login`, { |
|
|
const result = await axios.post(`http://18.143.76.3:10704/admin/login`, { |
|
|
account: userInfo.value.username, |
|
|
account: userInfo.value.username, |
|
|
password: userInfo.value.password, |
|
|
password: userInfo.value.password, |
|
|
machineId: "23131233213", |
|
|
|
|
|
|
|
|
machineId: machineId, |
|
|
}); |
|
|
}); |
|
|
// const result = await API({ |
|
|
// const result = await API({ |
|
|
// url: "/admin/login", |
|
|
// url: "/admin/login", |
|
@ -102,13 +118,14 @@ const login = async function () { |
|
|
// }); |
|
|
// }); |
|
|
|
|
|
|
|
|
console.log("请求成功", result); |
|
|
console.log("请求成功", result); |
|
|
|
|
|
|
|
|
router.push({ |
|
|
|
|
|
name: "workspace", |
|
|
|
|
|
query: { |
|
|
|
|
|
machineId: result.data.data.machineId, |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
if (result.data.code == 200) { |
|
|
|
|
|
ElMessage.success('登录成功'); |
|
|
|
|
|
router.push({ |
|
|
|
|
|
name: "workspace", |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
ElMessage.error(result.data.msg); |
|
|
|
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.log("请求失败", error); |
|
|
console.log("请求失败", error); |
|
|
} |
|
|
} |
|
|