修复打开kg源歌单链接失败的问题

This commit is contained in:
lyswhut 2021-06-05 16:12:41 +08:00
parent 269b0f113a
commit 5e15f20d67
4 changed files with 6 additions and 3 deletions

View File

@ -8,3 +8,4 @@
- 修复打开歌单失败时会导致应用崩溃的问题 - 修复打开歌单失败时会导致应用崩溃的问题
- 修复打开kw歌单失败时会无限重试的问题 - 修复打开kw歌单失败时会无限重试的问题
- 尝试修复弹出菜单、列表位置不正确的问题 - 尝试修复弹出菜单、列表位置不正确的问题
- 修复打开kg源歌单链接失败的问题

View File

@ -154,6 +154,7 @@ export default {
async createHttp(url, options, retryNum = 0) { async createHttp(url, options, retryNum = 0) {
if (retryNum > 2) throw new Error('try max num') if (retryNum > 2) throw new Error('try max num')
let result let result
options.cache = 'default'
try { try {
result = await httpFetch(url, options).promise result = await httpFetch(url, options).promise
} catch (err) { } catch (err) {

View File

@ -1,4 +1,4 @@
// import crypto from 'crypto' import crypto from 'crypto'
/** /**
* 获取音乐音质 * 获取音乐音质
@ -18,4 +18,4 @@ export const getMusicType = (info, type) => {
return '128k' return '128k'
} }
// export const toMD5 = str => crypto.createHash('md5').update(str).digest('hex') export const toMD5 = str => crypto.createHash('md5').update(str).digest('hex')

View File

@ -101,13 +101,14 @@ const handleRequestData = async(url, {
method = 'get', method = 'get',
headers = {}, headers = {},
format = 'json', format = 'json',
cache = 'no-store',
...options ...options
}) => { }) => {
// console.log(url, options) // console.log(url, options)
headers = Object.assign({ headers = Object.assign({
Accept: 'application/json', Accept: 'application/json',
}, headers) }, headers)
options.cache = 'no-store' options.cache = cache
if (method.toLocaleLowerCase() === 'post' && !headers['Content-Type']) { if (method.toLocaleLowerCase() === 'post' && !headers['Content-Type']) {
if (options.form) { if (options.form) {
headers['Content-Type'] = 'application/x-www-form-urlencoded' headers['Content-Type'] = 'application/x-www-form-urlencoded'