Newer
Older
gdtMimiProgram / api / user.js
MrTan on 21 Nov 2022 978 bytes 修改request判断返回数据
import fetch from '@/common/fetch.js';
import BASE_URL from './base.js';
import useNetWork from '@/common/useNetWork.js';

const LOGIN = BASE_URL + '/user/login';
const UserType = BASE_URL + '/user/getUserType'
const UserRegister = BASE_URL + '/user/userRegister'
const UpdateUserImg = BASE_URL + '/user/updateUserImg'

export function login(code) {
	useNetWork();
  const params = {
    wxcode: code,
  };
  return fetch.post(LOGIN, params).then(res => res);
}

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

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

/**
 * 修改图片
 * @param {*}  
 */
export function getUpdateUserImg(data) {
	useNetWork();
	const params = {
		
	}
  return fetch.post(UpdateUserImg,params).then(res => res);
}