| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- import request from '@/utils/request'
- import sqlite from '@/utils/sqlite'
- export function offlineData(data:UTSJSONObject):Promise<UTSJSONObject> {
- return new Promise((resolve, reject) => {
- let result = JSON.parseObject(JSON.stringify(data)) as UTSJSONObject
- resolve(result)
- });
- }
- // 登录方法
- export function login(username:string, password:string, code:string, uuid:string):Promise<UTSJSONObject> {
- const data = {
- username,
- password,
- code,
- uuid
- } as UTSJSONObject
-
- let data2 = {
- username: "admin",
- password: "admin123",
- code: "",
- uuid: '1',
- token: '123456',
- roles:[] as string[]
- } as UTSJSONObject
-
- // #ifdef APP-ANDROID
- let result = sqlite.selectTableData('app_user','username',data['username'],'password',data['password']);
- console.log(result)
- // #endif
- /*
- return request({
- 'url': '/login',
- headers: {
- isToken: false
- },
- 'method': 'post',
- 'data': data
- })*/
- return offlineData(data2)
- }
- export type RegForm={
- username: string,
- password: string,
- confirmPassword: string,
- code: string,
- uuid: string
- }
- // 注册方法
- export function register(data:RegForm):Promise<UTSJSONObject> {
- return request({
- url: '/register',
- headers: {
- isToken: false
- },
- method: 'post',
- data
- })
- }
- // 获取用户详细信息
- export function getInfo():Promise<UTSJSONObject> {
- /*
- return request({
- 'url': '/getInfo',
- 'method': 'get'
- })*/
- let data = {
- username: "admin",
- password: "admin123",
- code: "",
- uuid: '1',
- token: '123456',
- roles:[] as string[]
- } as UTSJSONObject
-
- // #ifdef APP-ANDROID
- let result = sqlite.selectTableData('app_user','username',data['username'],'password',data['password']);
- console.log(result)
- // #endif
-
- return offlineData(data)
- }
- // 退出方法
- export function logout(token?:any):Promise<UTSJSONObject> {
- return request({
- 'url': '/logout',
- 'method': 'post'
- })
- }
- // 获取验证码
- export function getCodeImg():Promise<UTSJSONObject> {
- return request({
- 'url': '/captchaImage',
- headers: {
- isToken: false
- },
- method: 'get',
- timeout: 20000
- })
- }
|