import upload from '@/utils/upload'
import request from '@/utils/request'

// 用户密码重置
export function updateUserPwd(data) {
	// const data = {
	//     oldPassword,
	//     newPassword
	// }
  return request({
    url: '/system/user/profile/updatePwd?oldPassword='+data.oldPassword+'&newPassword='+data.newPassword,
    method: 'post',
    params:data,
	data:data
  })
}

// // 查询用户个人信息
// export function getUserProfile(data) {
// 	return request({
// 		url: '/smart-canteen/custInfo/queryCustInfoDetailForApp',
// 		method: 'post',
// 		data
// 	})
// }
// 查询用户个人信息
export function getUserProfile() {
  return request({
    url: '/system/user/'+uni.getStorageSync('userId'),
    method: 'get'
  })
}

export function getUserInfo() {
  return request({
    url: '/system/user/getInfo',
    method: 'get'
  })
}


// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/edit',
    method: 'post',
    data: data
  })
}

// 查询用户头像
export function getUserHeaderPhoto(data) {
  return request({
    url: '/smart-canteen/api/v4/app/custInfo/query/profile/photo',
	method: 'post',
	data
  })
}
// 保存头像地址
export function saveUserHeaderPhoto(data) {
  return request({
    url: '/smart-canteen/api/v4/app/custInfo/save/profile/photo',
	method: 'post',
	data
  })
}



// 用户头像上传
export function uploadAvatar(data) {
  return upload({
    url: '/system/user/profile/avatar',
    name: data.name,
    filePath: data.filePath
  })
}
