/*
 * @Descripttion: 公共工具库
 * @Company: 思宏科技
 * @version: v1.0
 * @Author: HJ
 * @Date: 2021-11-10 09:42:12
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-01-20 14:14:59
 */
// 解析URL链接或二维码中的参数
export const sceneDecode = str => {
  const result = {}
  const tempObj = str.split('_')
  tempObj.forEach(i => {
    const temp = i.split('-')
    if (temp?.[0]) result[temp[0]] = temp[1]
  })
  return result
}

export const sceneEncode = obj => {
  const result = []
  for (const i in obj) {
    const value = obj[i]
    result.push(`${i}-${value}`)
  }
  return result.join('_')
}
