diff --git a/code/vue/vue3/src/api/stafflogin.ts b/code/vue/vue3/src/api/stafflogin.ts index ec010831d..829d0ffc9 100644 --- a/code/vue/vue3/src/api/stafflogin.ts +++ b/code/vue/vue3/src/api/stafflogin.ts @@ -1,20 +1,20 @@ -import request from "../util/request" +import request from '../util/request' // 这个是使用方法封装的axios进行请求,并传递查询参数 // 登录的接口 -export const login = (staffNo: string)=>{ - return request({ - url:'login', - method:'post', - params: { - staffNo: staffNo - } // 这里的 params 对象将被 axios 转换为查询字符串 - }) +export const login = (staffNo: string) => { + return request({ + url: 'login', + method: 'post', + params: { + staffNo: staffNo, + }, // 这里的 params 对象将被 axios 转换为查询字符串 + }) } // 登出的接口 -export const logout =()=>{ - return request({ - url:'logout', - method:'get' - }) +export const logout = () => { + return request({ + url: 'logout', + method: 'get', + }) } diff --git a/code/vue/vue3/src/tangxinyuan/stafflogin.vue b/code/vue/vue3/src/tangxinyuan/stafflogin.vue index b89cc2b87..b27ce0411 100644 --- a/code/vue/vue3/src/tangxinyuan/stafflogin.vue +++ b/code/vue/vue3/src/tangxinyuan/stafflogin.vue @@ -16,31 +16,31 @@ // 引入登录的方法 // import { login } from '@/api/stafflogin'; -import axios from 'axios'; -import { ref } from 'vue'; -import { useRouter } from 'vue-router'; -import Home from "@/tangxinyuan/Home.vue"; - -const staffNo=ref('') -const password=ref('') -const router=useRouter() - -// 获取表单实例 定义响应式状态 -async function login(){ - const url = 'http://127.0.0.1:12709/stafflogin?staffNo='+staffNo.value+'&password='+password.value+'' - console.log(url) - const result =await axios.get(url) - console.log(result.date) - if (result.date=='1'){//登录成功 - router.push({path: '/Home',name: 'Home',component: Home,}) - }else{//登录失败 - alert('登录失败') - } -} - - - - - \ No newline at end of file +// import axios from 'axios'; +// import { ref } from 'vue'; +// import { useRouter } from 'vue-router'; +// import Home from "@/tangxinyuan/Home.vue"; + +// const staffNo=ref('') +// const password=ref('') +// const router=useRouter() + +// // 获取表单实例 定义响应式状态 +// async function login(){ +// const url = 'http://127.0.0.1:12709/stafflogin?staffNo='+staffNo.value+'&password='+password.value+'' +// console.log(url) +// const result =await axios.get(url) +// console.log(result.date) +// if (result.date=='1'){//登录成功 +// router.push({path: '/Home',name: 'Home',component: Home,}) +// }else{//登录失败 +// alert('登录失败') +// } +// } + + +// + +// \ No newline at end of file