How to use the ant-design-vue/es/message.success function in ant-design-vue

To help you get started, we’ve selected a few ant-design-vue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xiaozhu188 / electron-vue-cloud-music / src / renderer / store / modules / User.js View on Github external
async subscribePlatlist ({commit, state}, {t, playlist}) {
    let pid = playlist.id
    let res = await likePlaylist(t, pid)
    if (res.code === 200) {
      let userPlaylists = state.userPlaylists.slice()
      if (t === 1) {
        Message.success('收藏成功!')
        playlist.subscribed = true
        userPlaylists.unshift(playlist)
      } else if (t === 2) {
        Message.success('取消收藏成功!')
        let index = userPlaylists.findIndex(item => item.id === pid)
        userPlaylists.splice(index, 1)
      }
      commit('SET_USER_PLAYLISTS', userPlaylists)
    }
  },
  // 取消收藏歌单
github xiaozhu188 / electron-vue-cloud-music / src / renderer / store / modules / User.js View on Github external
async subscribePlatlist ({commit, state}, {t, playlist}) {
    let pid = playlist.id
    let res = await likePlaylist(t, pid)
    if (res.code === 200) {
      let userPlaylists = state.userPlaylists.slice()
      if (t === 1) {
        Message.success('收藏成功!')
        playlist.subscribed = true
        userPlaylists.unshift(playlist)
      } else if (t === 2) {
        Message.success('取消收藏成功!')
        let index = userPlaylists.findIndex(item => item.id === pid)
        userPlaylists.splice(index, 1)
      }
      commit('SET_USER_PLAYLISTS', userPlaylists)
    }
  },
  // 取消收藏歌单
github xiaozhu188 / electron-vue-cloud-music / src / renderer / store / modules / User.js View on Github external
async removePlaylist ({commit, state}, {action, pid}) {
    let res = await likePlaylist(action, pid)
    if (res.code === 200) {
      let userPlaylists = state.userPlaylists.slice()
      let index = userPlaylists.findIndex(item => item.id === pid)
      userPlaylists.splice(index, 1)
      commit('SET_USER_PLAYLISTS', userPlaylists)
      Message.success('删除成功!')
    }
  },
  // 删除创建的歌单
github xiaozhu188 / electron-vue-cloud-music / src / renderer / store / modules / User.js View on Github external
return new Promise(async (resolve, reject) => {
      try {
        let { code } = await likeMusic(songId, isLike)
        if (code === 200) {
          let likedsongIds = [...state.likedsongIds]
          if (isLike) {
            likedsongIds.unshift(songId)
            commit('SET_LIKEDSONG_IDS', likedsongIds)
            Message.success('喜欢歌曲成功!')
          } else {
            let index = likedsongIds.findIndex(id => id === songId)
            likedsongIds.splice(index, 1)
            commit('SET_LIKEDSONG_IDS', likedsongIds)
            Message.success('取消喜欢成功!')
          }
          resolve()
        } else {
          reject(new Error('操作失败'))
        }
      } catch (error) {
        reject(error)
      }
    })
  },
github xiaozhu188 / electron-vue-cloud-music / src / renderer / store / modules / Download.js View on Github external
adddownloadQueue ({commit, dispatch, state}, songs) {
    let queue = [...state.queue]
    songs = songs.filter(song => {
      return !queue.some(item => item.id === song.id)
    })
    if (songs.length) {
      queue.push(...songs)
      commit('SET_QUEUE', queue)
      Message.success(`添加${songs.length}首歌到下载列表`)
    }
    if (state.queue.length > 0 && !state.downloading.length) {
      dispatch('download')
    }
  }
}
github xiaozhu188 / electron-vue-cloud-music / src / renderer / store / modules / User.js View on Github external
async subscribeDj ({commit, state}, {t, dj}) {
    let res = await subDj({t, rid: dj.id})
    if (res.code === 200) {
      t === 1 ? Message.success(res.message || '订阅电台成功!') : Message.success('取消订阅电台成功!')
    }
  },
  async subscribeAlbum ({commit, state}, {t, album}) {
github xiaozhu188 / electron-vue-cloud-music / src / renderer / store / modules / User.js View on Github external
async subscribeUser ({commit, state}, {t, userId, nickname}) {
    let id = userId
    let res = await user_follow({t, id})
    if (res.code === 200) {
      t === 1 ? Message.success(res.followContent || `关注用户${nickname}成功`) : Message.success(`取消关注用户${nickname}成功`)
      return res
    }
    throw new Error(res)
  }
}
github xiaozhu188 / electron-vue-cloud-music / src / renderer / store / modules / User.js View on Github external
async subscribeArtist ({commit, state}, {t, artist}) {
    let id = artist.id
    let res = await subArtist({t, id})
    if (res.code === 200) {
      t === 1 ? Message.success(`收藏歌手${artist.name}成功`) : Message.success(`取消收藏歌手${artist.name}成功`)
      return res.code
    }
    throw new Error(res)
  },
  async subscribeUser ({commit, state}, {t, userId, nickname}) {
github xiaozhu188 / electron-vue-cloud-music / src / renderer / store / modules / Download.js View on Github external
async download ({dispatch, commit, state, rootState}) {
    if (!state.queue.length) {
      Message.success('全部歌曲下载完毕!')
      return
    }
    let queue = state.queue
    let song = queue[0]
    let {id, name} = song
    let filename = generateName(song)
    try {
      let downloadUrl = await getUrl(id)
      if (downloadUrl) {
        ipcRenderer.send('download-start', {
          url: downloadUrl,
          filename,
          id,
          song,
          downloadFolder: rootState.Setting.downloadSongsFolders[0]
        })