dev
This commit is contained in:
parent
fd92dc315d
commit
f1b356f7fc
|
|
@ -2,7 +2,7 @@
|
||||||
import {onMounted, onUnmounted, ref} from 'vue'
|
import {onMounted, onUnmounted, ref} from 'vue'
|
||||||
import {post} from '@/utils/request.ts'
|
import {post} from '@/utils/request.ts'
|
||||||
import {useRouter} from "vue-router";
|
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 Mask from "@/components/common/Mask.vue";
|
||||||
import Auth from "@/components/manger/Auth.vue";
|
import Auth from "@/components/manger/Auth.vue";
|
||||||
import {apiConfig} from "@/assets/config/apiConfig";
|
import {apiConfig} from "@/assets/config/apiConfig";
|
||||||
|
|
@ -12,10 +12,12 @@ import {useWsStore} from "@/stores/wsStore.ts";
|
||||||
const username = ref('')
|
const username = ref('')
|
||||||
const password = ref('')
|
const password = ref('')
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
interface NetWorkType {
|
interface NetWorkType {
|
||||||
ip: string,
|
ip: string,
|
||||||
mac: string,
|
mac: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
const netWork = ref<NetWorkType>({
|
const netWork = ref<NetWorkType>({
|
||||||
ip: "192.168.1.1",
|
ip: "192.168.1.1",
|
||||||
mac: "00-00-00-00-00"
|
mac: "00-00-00-00-00"
|
||||||
|
|
@ -35,13 +37,14 @@ const handleLogin = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
post(apiConfig.ManagerLogin, {username: username.value, password: password.value}).then((token: any) => {
|
post(apiConfig.ManagerLogin, {username: username.value, password: password.value}).then((token: any) => {
|
||||||
localStorage.setItem('token', token)
|
localStorage.setItem('token', token)
|
||||||
|
|
||||||
//签到,如果 签到成功,则直接调用success,如果失败,调用error
|
//签到,如果 签到成功,则直接调用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 = () => {
|
const error = () => {
|
||||||
ElMessage({
|
ElMessageBox.alert('签到失败,我们将已非签到模式启动系统', '签到提示', {
|
||||||
message: "签到失败,我们将已非签到模式启动系统",
|
// if you want to disable its autofocus
|
||||||
type: 'warning',
|
// autofocus: false,
|
||||||
duration: 1000,
|
confirmButtonText: '确定',
|
||||||
onClose: () => {
|
callback: (action: Action) => {
|
||||||
router.push("/home/index")
|
router.push("/home/index")
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const wsStore = useWsStore();
|
const wsStore = useWsStore();
|
||||||
const reciceMessage = (response: Response) => {
|
const reciceMessage = (response: Response) => {
|
||||||
console.log(response)
|
netWork.value = {
|
||||||
|
ip: response.Data[0].IPAddress,
|
||||||
|
mac: response.Data[0].MACAddress
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const getNetwork = () => {
|
const getNetwork = () => {
|
||||||
let data: any = {}
|
let data: any = {}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue