gov_propagandize/utils/api/testapi.js
2025-01-02 17:31:12 +08:00

44 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {
request
} from "../http";
// 管理地址个人习惯喜欢的下载request参数中也行
const apiPath = {
login: "/api/v1/login"
}
class AuthService {
static login(data) {
// 按住ctrl点击wx.request进入ts声明看options的类型method是均大写的对应即可
return request(apiPath.login, "GET", data)
// 由于request的参数顺序第四个才是查询参数所以如果需要传递第三个传输传空对象即可
// return request(apiPath.login, "GET", {}, data)
}
}
export default AuthService;
// import AuthService from "../../service/AuthService";
// // 导入封装好的服务层
// // 其他代码省略
// page({
// // Promise语法
// submitForm(){
// AuthService.login({username:"a",password:"2"}).then(res=>{
// // 干点别的
// },err=>{
// // 出错了干点啥
// })
// },
// // async-await语法糖
// async asycsubmitForm(){
// try{
// const res = await AuthService.login({username:"abc",password:"123"});
// // 干点别的
// }catch(err){
// // 错了干点啥?
// }
// }
// })