【前端】云工厂的纸掌柜app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.1 KiB

import http from '../utils/http/index.js'
let areaCache = null
/**
* 获取省市区街道
* @returns array
*/
export function getArea(data = {}) {
return new Promise((resolve, reject) => {
if (areaCache) {
resolve(areaCache)
} else {
http.get({ url: '/yyt-uec/get/regions', data }).then((res) => {
if (res) {
areaCache = res
resolve(res)
} else {
resolve(null)
}
})
}
})
}
let baseInfo = null
/**
* 获取当前账号的基础信息
* @param {object} data 参数,暂时不需要,可以传{}
* @param {boolean} refresh 是否强制刷新,默认false拿缓存数据
* @returns object
*/
export function getBaseInfo(data = {}, refresh = false) {
return new Promise((resolve, reject) => {
if (!refresh && baseInfo) {
resolve(baseInfo)
} else {
http.get({ url: '/yyt-uec/get/base-info', data }, { hideLoading: true }).then((res) => {
if (res) {
baseInfo = res
resolve(res)
} else {
resolve(null)
}
})
}
})
}