Merge branch 'dev' of ssh://git.online.zzfzyc.com:10022/mp/spider_cloud_warehouse into 订单页

This commit is contained in:
Haiyi
2022-10-19 17:37:31 +08:00
13 changed files with 370 additions and 239 deletions
+15 -14
View File
@@ -61,16 +61,16 @@ export const getFilterData = (val = {}, arr: string[] = []) => {
* @param {*} object
* @returns
*/
export const copyObject = (object) => {
export const copyObject = object => {
if (object.constructor == Object) {
let keys = Object.keys(object)
let newObject = {}
keys.map((key) => {
keys.map(key => {
newObject[key] = copyObject(object[key])
})
return newObject
} else if (object.constructor == Array) {
return object.map((item) => {
return object.map(item => {
return copyObject(item)
})
} else {
@@ -93,9 +93,17 @@ export const copyObject = (object) => {
export const screenshot = (url, suffix = '!w200') => {
return url + suffix
}
interface DataLoadingStatus {
list: any[]
total: number
status: boolean
}
//获取数据加载状态 //0:数据从无到有加载数据,1,没有任何数据, 2:下拉加载,3:下拉没有数据
export const dataLoadingStatus = ({ list = [], total = 0, status = false }: { list: any[]; total: number; status: true | false }) => {
export const dataLoadingStatus = ({ list = [], total = 0, status = true }: DataLoadingStatus) => {
// 类型校验
if (Object.prototype.toString.call(list) !== '[object Array]') {
list = []
}
if (list.length == 0 && status) {
return 0
} else if (list.length == 0 && !status) {
@@ -107,7 +115,6 @@ export const dataLoadingStatus = ({ list = [], total = 0, status = false }: { li
}
}
function delay(delayTime = 25): Promise<null> {
return new Promise(resolve => {
setTimeout(() => {
@@ -117,10 +124,7 @@ function delay(delayTime = 25): Promise<null> {
})
}
export function delayQuerySelector(
selectorStr: string,
delayTime = 500
): Promise<any[]> {
export function delayQuerySelector(selectorStr: string, delayTime = 500): Promise<any[]> {
return new Promise(resolve => {
const selector: SelectorQuery = Taro.createSelectorQuery()
delay(delayTime).then(() => {
@@ -134,7 +138,6 @@ export function delayQuerySelector(
})
}
//全局分享监听
export const shareShop = () => {
const page = Taro.getCurrentInstance().page
@@ -143,7 +146,7 @@ export const shareShop = () => {
analysisShortCodeApi(page.options.share)
}
if (page && page.onShareAppMessage) {
page.onShareAppMessage = (res) => {
page.onShareAppMessage = res => {
let path = ''
let title = ''
let imageUrl = ''
@@ -170,5 +173,3 @@ export const shareShop = () => {
}
}
}