This commit is contained in:
ChenQiuYu 2025-04-27 09:42:25 +08:00
parent fd92dc315d
commit f1b356f7fc
1 changed files with 21 additions and 15 deletions

View File

@ -2,7 +2,7 @@
import {onMounted, onUnmounted, ref} from 'vue'
import {post} from '@/utils/request.ts'
import {useRouter} from "vue-router";
import {ElMessage} from "element-plus";
import {type Action, ElMessage, ElMessageBox} from "element-plus";
import Mask from "@/components/common/Mask.vue";
import Auth from "@/components/manger/Auth.vue";
import {apiConfig} from "@/assets/config/apiConfig";
@ -12,18 +12,20 @@ import {useWsStore} from "@/stores/wsStore.ts";
const username = ref('')
const password = ref('')
const router = useRouter();
interface NetWorkType{
interface NetWorkType {
ip: string,
mac: string,
}
const netWork=ref<NetWorkType>({
const netWork = ref<NetWorkType>({
ip: "192.168.1.1",
mac: "00-00-00-00-00"
})
const handleLogin = () => {
if(netWork.value.mac=="00-00-00-00-00"){
if (netWork.value.mac == "00-00-00-00-00") {
// IP使IP
ElMessage({
message: "获取本地IP地址失败将使用默认IP地址",
@ -35,13 +37,14 @@ const handleLogin = () => {
}
post(apiConfig.ManagerLogin, {username: username.value, password: password.value}).then((token: any) => {
localStorage.setItem('token', token)
// success,error
post('signUp/signUp',{mac:netWork.value.mac,ip:netWork.value.ip},{catch_error: true}).then((res: any) => {
success()
}).catch(()=>{
error()
})
})
}
@ -57,18 +60,21 @@ const success = () => {
})
}
const error = () => {
ElMessage({
message: "签到失败,我们将已非签到模式启动系统",
type: 'warning',
duration: 1000,
onClose: () => {
ElMessageBox.alert('签到失败,我们将已非签到模式启动系统', '签到提示', {
// if you want to disable its autofocus
// autofocus: false,
confirmButtonText: '确定',
callback: (action: Action) => {
router.push("/home/index")
}
},
})
}
const wsStore = useWsStore();
const reciceMessage = (response: Response) => {
console.log(response)
netWork.value = {
ip: response.Data[0].IPAddress,
mac: response.Data[0].MACAddress
}
}
const getNetwork = () => {
let data: any = {}