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.
156 lines
2.6 KiB
JavaScript
156 lines
2.6 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 setUserAccountAction(data, then, error = () => {}) {
|
|
$post({
|
|
url: '设置账号',
|
|
data,
|
|
then: (response) => {
|
|
$res({
|
|
response,
|
|
then: (response) => {
|
|
then()
|
|
},
|
|
error: (res) => {
|
|
error()
|
|
uni.$lu.toast(res.message);
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
export function bindUserPhoneAction(data, then, error = () => {}) {
|
|
$post({
|
|
url: '设置手机号',
|
|
data,
|
|
then: (response) => {
|
|
$res({
|
|
response,
|
|
then: (response) => {
|
|
then()
|
|
},
|
|
error: (res) => {
|
|
error()
|
|
uni.$lu.toast(res.message);
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
export function editUserNicknameAction(nickname, then, error = () => {}) {
|
|
$post({
|
|
url: '修改昵称',
|
|
data: {
|
|
nickname
|
|
},
|
|
then: (response) => {
|
|
$res({
|
|
response,
|
|
then: (response) => {
|
|
then()
|
|
},
|
|
error: (res) => {
|
|
error()
|
|
uni.$lu.toast(res.message);
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
export function uploadUserAvatarAction(avatar, then, error = () => {}) {
|
|
$post({
|
|
url: '上传头像',
|
|
data: {
|
|
avatar
|
|
},
|
|
then: (response) => {
|
|
$res({
|
|
response,
|
|
then: (response) => {
|
|
then()
|
|
},
|
|
error: (res) => {
|
|
error()
|
|
uni.$lu.toast(res.message);
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
export function getConfigAction(config_arr, then) {
|
|
$post({
|
|
url: '基础参数',
|
|
data: {
|
|
config_arr
|
|
},
|
|
then: (response) => {
|
|
$res({
|
|
response,
|
|
then: (response) => {
|
|
then(response.data.list)
|
|
},
|
|
error: (res) => {
|
|
uni.$lu.toast(res.message);
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
export function userLoginAction(code, then, error = () => {}) {
|
|
$post({
|
|
url: '微信登录',
|
|
data: {
|
|
code
|
|
},
|
|
then: (response) => {
|
|
$res({
|
|
response,
|
|
then: (response) => {
|
|
then(response.data.token)
|
|
},
|
|
error: (res) => {
|
|
error()
|
|
uni.$lu.toast(res.message);
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
export function getUserInfoAction(then, msg = true) {
|
|
$post({
|
|
url: '用户信息',
|
|
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: 'YO',
|
|
then: (response) => {
|
|
$res({
|
|
response,
|
|
then: (response) => {
|
|
then(response)
|
|
},
|
|
error: (res) => {
|
|
uni.$lu.toast(res.message);
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|