app更新对l2数据显示
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import request from '@/utils/request'
|
||||
import errorCode from '@/utils/errorCode'
|
||||
import { toast, tansParams } from '@/utils/common'
|
||||
|
||||
// 登录方法
|
||||
export function login(username, password, code, uuid) {
|
||||
@@ -18,6 +20,50 @@ export function login(username, password, code, uuid) {
|
||||
})
|
||||
}
|
||||
|
||||
// Zinc1系统登录方法(直接使用uni.request,因为登录接口不需要token,完全静默处理)
|
||||
export function loginZinc1(username, password, code, uuid) {
|
||||
const data = {
|
||||
username,
|
||||
password,
|
||||
code,
|
||||
uuid
|
||||
}
|
||||
|
||||
const baseUrl = 'http://140.143.206.120:10082/prod-api'
|
||||
const timeout = 10000
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: 'post',
|
||||
timeout: timeout,
|
||||
url: baseUrl + '/login',
|
||||
data: data,
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
dataType: 'json'
|
||||
}).then(response => {
|
||||
let [error, res] = response
|
||||
if (error) {
|
||||
// 静默失败,不显示任何提示
|
||||
reject('Zinc1系统连接异常')
|
||||
return
|
||||
}
|
||||
const code = res.data.code || 200
|
||||
if (code === 200 && res.data && res.data.token) {
|
||||
// 只有成功时才resolve
|
||||
resolve(res.data)
|
||||
} else {
|
||||
// 其他情况静默失败
|
||||
reject('Zinc1登录失败')
|
||||
}
|
||||
}).catch(error => {
|
||||
// 静默失败,不显示任何提示
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 注册方法
|
||||
export function register(data) {
|
||||
return request({
|
||||
|
||||
Reference in New Issue
Block a user