初步完善
This commit is contained in:
@@ -177,7 +177,7 @@ export const isChildren = (parent, children) => {
|
||||
* @param {*} setting
|
||||
*/
|
||||
export const updateSetting = (setting, version) => {
|
||||
const defaultVersion = '1.0.16'
|
||||
const defaultVersion = '1.0.17'
|
||||
if (!version) {
|
||||
if (setting) {
|
||||
version = setting.version
|
||||
@@ -190,6 +190,7 @@ export const updateSetting = (setting, version) => {
|
||||
highQuality: false,
|
||||
isShowTaskProgess: true,
|
||||
volume: 1,
|
||||
mediaDeviceId: null,
|
||||
},
|
||||
list: {
|
||||
isShowAlbumName: true,
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { httpFetch } from '../../request'
|
||||
|
||||
|
||||
export default {
|
||||
regExps: {
|
||||
relWord: /RELWORD=(.+)/,
|
||||
},
|
||||
requestObj: null,
|
||||
tempSearch(str) {
|
||||
this.cancelTempSearch()
|
||||
this.requestObj = httpFetch(`https://c.y.qq.com/splcloud/fcgi-bin/smartbox_new.fcg?is_xml=0&format=json&key=${encodeURIComponent(str)}&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0`, {
|
||||
headers: {
|
||||
Referer: 'https://y.qq.com/portal/player.html',
|
||||
},
|
||||
})
|
||||
return this.requestObj.promise.then(({ statusCode, body }) => {
|
||||
if (statusCode != 200 || body.code != 0) return Promise.reject(new Error('请求失败'))
|
||||
return body.data
|
||||
})
|
||||
},
|
||||
handleResult(rawData) {
|
||||
return rawData.map(info => `${info.name} - ${info.singer}`)
|
||||
},
|
||||
cancelTempSearch() {
|
||||
if (this.requestObj && this.requestObj.cancelHttp) this.requestObj.cancelHttp()
|
||||
},
|
||||
async search(str) {
|
||||
return this.tempSearch(str).then(result => this.handleResult(result.song.itemlist))
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user