You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.0 KiB
JavaScript

import $post from "../lu/post.js"
import $res from "../lu/response.js"
import $api from "./api.js"
import {
delToken
} from '../tool/member.js'
export function userLoginAction(code, then) {
$post({
url: $api('微信登录'),
data: {
code
},
then: (response) => {
$res({
response,
then: (response) => {
then(response.data.token)
},
error: (res) => {
uni.$lu.toast(res.message);
}
})
}
})
}
export function getUserInfoAction(then, msg = true) {
$post({
url: $api('用户信息'),
then: (response) => {
$res({
response,
then: (response) => {
then(response.data)
},
error: (res) => {
delToken()
if (msg) uni.$lu.toast(res.message);
}
})
}
})
}
export function yo(then) {
$post({
url: $api('YO'),
then: (response) => {
$res({
response,
then: (response) => {
then(response)
},
error: (res) => {
uni.$lu.toast(res.message);
}
})
}
})
}