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: $api('设置账号'), data, then: (response) => { $res({ response, then: (response) => { then() }, error: (res) => { error() uni.$lu.toast(res.message); } }) } }) } export function bindUserPhoneAction(data, then, error = () => {}) { $post({ url: $api('设置手机号'), data, then: (response) => { $res({ response, then: (response) => { then() }, error: (res) => { error() uni.$lu.toast(res.message); } }) } }) } export function editUserNicknameAction(nickname, then, error = () => {}) { $post({ url: $api('修改昵称'), 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: $api('上传头像'), 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: $api('基础参数'), 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: $api('微信登录'), 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: $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); } }) } }) }