新增列表多选操作功能

This commit is contained in:
lyswhut
2019-08-19 18:19:39 +08:00
parent 8817318a53
commit 601e1a67a1
26 changed files with 750 additions and 192 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
import { httpFatch } from '../../request'
import { requestMsg } from '../../message'
const api_messoer = {
getMusicUrl(songInfo, type) {
@@ -7,7 +8,7 @@ const api_messoer = {
timeout: 5000,
})
requestObj.promise = requestObj.promise.then(({ body }) => {
return body.code === 200 ? Promise.resolve({ type, url: body.data }) : Promise.reject(new Error(body.msg))
return body.code === 200 ? Promise.resolve({ type, url: body.data }) : Promise.reject(new Error(requestMsg.fail))
})
return requestObj
},
@@ -17,7 +18,7 @@ const api_messoer = {
timeout: 5000,
})
requestObj.promise = requestObj.promise.then(({ body }) => {
return body.code === 200 ? Promise.resolve(body.data) : Promise.reject(new Error(body.msg))
return body.code === 200 ? Promise.resolve(body.data) : Promise.reject(new Error(requestMsg.fail))
})
return requestObj
},
-9
View File
@@ -7,11 +7,6 @@ const api_temp = {
})
requestObj.promise = requestObj.promise.then(({ body }) => {
return body.code === 0 ? Promise.resolve({ type, url: body.data }) : Promise.reject(new Error(body.msg))
}).catch(err => {
console.log(err)
if (err.message === 'socket hang up') return Promise.reject(new Error('接口挂了'))
if (err.code === 'ENOTFOUND') return Promise.reject(new Error('无法连接网络'))
return Promise.reject(err)
})
return requestObj
},
@@ -21,10 +16,6 @@ const api_temp = {
})
requestObj.promise = requestObj.promise.then(({ body }) => {
return body.code === 0 ? Promise.resolve(body.data) : Promise.reject(new Error(body.msg))
}).catch(err => {
if (err.message === 'socket hang up') return Promise.reject(new Error('接口挂了'))
if (err.code === 'ENOTFOUND') return Promise.reject(new Error('无法连接网络'))
return Promise.reject(err)
})
return requestObj
},
+2 -1
View File
@@ -1,4 +1,5 @@
import { httpFatch } from '../../request'
import { requestMsg } from '../../message'
const api_messoer = {
getMusicUrl(songInfo, type) {
@@ -7,7 +8,7 @@ const api_messoer = {
timeout: 5000,
})
requestObj.promise = requestObj.promise.then(({ body }) => {
return body.code === 200 ? Promise.resolve({ type, url: body.data }) : Promise.reject(new Error(body.msg))
return body.code === 200 ? Promise.resolve({ type, url: body.data }) : Promise.reject(new Error(requestMsg.fail))
})
return requestObj
},
+12
View File
@@ -0,0 +1,12 @@
/**
* 获取音乐音质
* @param {*} info
* @param {*} type
*/
const types = ['flac', 'ape', '320k', '192k', '128k']
export const getMusicType = (info, type) => {
const rangeType = types.slice(types.indexOf(type))
for (const type of rangeType) {
if (info._types[type]) return type
}
}