新增列表多选操作功能
This commit is contained in:
@@ -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
|
||||
},
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user