示例#1
0
 close: () => {
   closeModal()
   location.replace(this.memberUrlPrefix + 'member-center/member-subscription/0/0')
 }
示例#2
0
文件: index.js 项目: raiyee/EasyHi
 confirm: promptText => {
   this.promptText = promptText
   closeModal()
 }
示例#3
0
文件: index.js 项目: raiyee/EasyHi
const resolveRoute = async (to, from, next) => {
  closeModal() && closeModal(TIP_ID)

  dispatch('setProgress', 50)

  const {meta} = to
  const bg = meta.bg

  utils[`${bg == null || bg ? 'add' : 'remove'}Class`](body, BG)

  let {auth, init} = meta

  // 判断是否需要登录权限
  if (auth) {
    // 如果未登录直接跳转登录页
    if (!getters.authorized) {
      return next({name: 'login', query: {from: to.fullPath}})
      // 已经登录判断是否只需要校验登录,无需校验身份
    } else if (auth !== true) {
      isFunction(auth) && (auth = auth(to, from))
      // 如果需要的角色列表不是数组,变更为数组
      isArray(auth) || (auth = [auth])

      const currentRole = getters.currentRole

      // 如果需要的角色列表不包含当前角色,跳转到对应首页
      if (!auth.includes(currentRole)) return next(`/${currentRole.toLowerCase()}-index`)
    }
  }

  const {fullPath} = to

  // 如果不需要先初始化数据或者已经拉取过数据则直接进入
  if (!init) return next()

  const cache = routeCache[fullPath]
  if (cache) return resolveData(cache, meta, next)

  if (isFunction(init)) init = init(to, from)
  if (isString(init)) init = {url: init}

  let {url, params, restore, options, type} = init

  isFunction(url) && (url = url(to, from))

  dispatch('setProgress', 70)

  params = params === undefined ? {
    ...to.params,
    ...to.query
  } : params

  try {
    const {data} = await axios[type || 'post'](url, params && Object.keys(params).length ? params : null, {
      noInterceptor: true,
      ...options
    })
    resolveData(data, meta, next)
    restore && (routeCache[fullPath] = data)
  } catch (e) {
    error(e)
    alert('系统异常,无法跳转')
    next(false)
    dispatch('setProgress', 0)
  }
}
示例#4
0
文件: index.js 项目: raiyee/EasyHi
     props: {
       bodyMsg: 'Just test body',
       transition: true
     }
   })
 },
 clearModal() {
   this.$modal.clear()
 },
 confirmModal() {
   confirm({
     tipText: '测试confirm 模态框',
     confirmText: '蓝瘦,香菇',
     confirm() {
       log('It is after confirm btn')
       closeModal()
     },
     close() {
       log('It is after cancel modal')
       closeModal()
     }
   })
 },
 toastModal() {
   toast({
     tipText: 'I am  a confirm modal tip Text',
     close() {
       log('It is a toast')
       closeModal()
     }
   })