Newer
Older
gdtMimiProgram / api / user.js
dutingting on 15 Mar 2023 1007 bytes 小程序开发(80%)
import fetch from "@/common/fetch.js";
import BASE_URL from "./base.js";
import useNetWork from "@/common/useNetWork.js";
const LOGIN = BASE_URL + "/user/getLoginToken";
const UserType = BASE_URL + "/user/getUserType";
const UserRegister = BASE_URL + "/user/userRegister";
const UpdateUserImg = BASE_URL + "/user/updateUserImg";
const UserJurisdiction = BASE_URL + "/user/getUserJurisdiction";

export function login(code) {
  useNetWork();
  const params = `${LOGIN}?code=${code}`;
  return fetch.get(params).then((res) => res);
}

/**
 * 获取到用户权限
 * @param {*}
 */
export function getUserJurisdiction(data) {
  useNetWork();
  return fetch.post(UserJurisdiction,data).then((res) => res);
}

/**
 * 获取到用户类型
 * @param {*}
 */
export function getUserType() {
  useNetWork();
  return fetch.get(UserType).then((res) => res);
}

/**
 * 注册
 * @param {*}
 */
export function getUserRegister(params) {
  useNetWork();
  return fetch.post(UserRegister, params).then((res) => res);
}