prefixUrl.js 937 B

1234567891011121314151617181920212223242526272829
  1. // import Snackbar from '@/plugins/snackbar'
  2. // import Curtain from '@/plugins/curtain'
  3. const prefixList = ['/app-api', '/admin-api']
  4. export const getSuffixAfterPrefix = (str) => {
  5. const matchingPrefix = prefixList.find(prefix => str.startsWith(prefix))
  6. if (matchingPrefix) {
  7. const matchUrl = str.slice(matchingPrefix.length)
  8. const hasQuery = matchUrl.indexOf('?') !== -1
  9. if (hasQuery) {
  10. const arr = matchUrl.split('?')
  11. return arr[0]
  12. }
  13. else return matchUrl
  14. }
  15. return undefined
  16. }
  17. // 展示积分
  18. // export function showNextAction (list) {
  19. // const arr = list.reduce((newArr, action) => {
  20. // // if (action.match) newArr.push(`+${action.point} 恭喜您【${action.title}】获得${action.point}积分`)
  21. // if (action.match) newArr.push(`+${action.point} 恭喜您获得${action.point}积分`)
  22. // return newArr
  23. // }, [])
  24. // if (arr?.length) Curtain('point', { list: arr })
  25. // }