import {
	myRequest
} from '../request.js'
import store from '@/store/index.js'    
export default {
	
	//我的列表数据
	getinfoAttached(data) {
		return myRequest({
			url: '/app/user/infoAttached',
			method: 'get',
			data: data
		})
	},
	//登录
	login(data) {
		return myRequest({
			url: '/login',
			// url: '/testLogin',
			method: 'post',
			data: data,
			noToken: true
		})
	},
	//登录用户信息
	getInfo() {
		return myRequest({
			url: '/app/user/getInfo',
			method: 'get',
		})
	},
	/**
	 * @param {Object} data 
	 * 微信登录
	 */
	wxLogin(data) {
		return myRequest({
			url: '/app/common/bindLogin',
			method: 'post',
			data: data,
			noToken: true
		})
	},
	
	
	//刷新令牌
	refreshToken(data) {
		return myRequest({
			url: '/refreshToken/' + data,
			method: 'get',
			noToken: true
		})
	},
	//查询等级列表
	gradelist(data) {
		return myRequest({
			url: '/grade/list',
			method: 'get',
			data: data
		})
	},
	refreshUserInfo() {
		this.getInfo().then(resdata => {
			if(resdata.data.code == 200){
			store.commit('updateUserInfo',{userInfo:resdata.data.data})
			}	
		});
	},
	//注册短信
	registerSms(data) {
		return myRequest({
			url: '/app/common/sms/register',
			method: 'post',
			data: data,
			noToken: true
		})
	},
	//获取重新绑定手机短信
	bindNewSms(data) {
		return myRequest({
			url: '/app/common/sms/bindNew',
			method: 'post',
			data: data,
			noToken: true
		})
	},
	
	//重新绑定手机
	bindNewTel(data) {
		return myRequest({
			url: '/app/user/bindNewTel',
			method: 'post',
			data: data
		})
	},

	//注册用户
	registerUser(data) {
		return myRequest({
			url: '/app/common/register_small',
			method: 'post',
			data: data,
			noToken: true
		})
	},
	//登录短信
	loginSms(data) {
		return myRequest({
			url: '/app/common/sms/login',
			method: 'post',
			data: data,
			noToken: true
		})
	},
	//忘记短信
	forgetSms(data) {
		return myRequest({
			url: '/app/common/sms/forget',
			method: 'post',
			data: data,
			noToken: true
		})
	},
	//忘记用户
	forgetUser(data) {
		return myRequest({
			url: '/app/common/register_forget',
			method: 'post',
			data: data,
			noToken: true
		})
	},
	//短信登录用户
	smsLogin(data) {
		return myRequest({
			url: '/app/common/sms_login',
			method: 'post',
			data: data,
			noToken: true
		})
	},
	//账号登录用户
	accountLogin(data) {
		return myRequest({
			url: '/app/common/account_login',
			method: 'post',
			data: data,
			noToken: true
		})
	},
	//绑定身份证号信息
	bindId(data) {
		return myRequest({
			url: '/app/user/bind_idcard',
			method: 'post',
			data: data
		})
	}
}
