新增在线看本子,去除视频在线看。优化本子名称缩短使其至少不为空白。优化部分代码。(同步更新)
This commit is contained in:
+63
-2
@@ -116,6 +116,26 @@ const actions = {
|
||||
ElMessage("查询失败")
|
||||
})
|
||||
},
|
||||
queryOnlineLinks(context, gid){
|
||||
// 如果本地有缓存,则直接返回,没有再请求
|
||||
if(context.state.onlineLinks[gid] !== undefined){
|
||||
context.commit("_setOnlineLinks", gid)
|
||||
}
|
||||
else {
|
||||
axios.get(GalleryManageUrl + "/onlineLinks", {
|
||||
params: {
|
||||
AuthCode: state.AuthCode,
|
||||
gid,
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.data.result === "success")
|
||||
context.commit("_addAndSetOnlineLinks", {gid, links: res.data.data})
|
||||
|
||||
else
|
||||
ElMessage(res.data.data)
|
||||
})
|
||||
}
|
||||
},
|
||||
updateGallery(context, link){
|
||||
axios.post(GalleryManageUrl + "/update", qs.stringify({AuthCode: state.AuthCode, link}))
|
||||
.then((res) => {
|
||||
@@ -135,10 +155,13 @@ const actions = {
|
||||
if(res.data.result === 'success'){
|
||||
state.userId = parseInt(res.data.data)
|
||||
context.commit("_authed", AuthCode)
|
||||
//初始化
|
||||
context.dispatch("loadMaskDomain").then()
|
||||
context.dispatch("loadWeekUsedAmount").then()
|
||||
context.dispatch("updateGalleryTasks", "all").then()
|
||||
context.dispatch("updateVideoTasks", "all").then()
|
||||
|
||||
//手机不需要设置宽度
|
||||
}
|
||||
else
|
||||
context.commit("_unAuthed")
|
||||
@@ -555,6 +578,27 @@ const mutations = {
|
||||
_setMaskDomain(state, maskDomain){
|
||||
state.maskDomain = maskDomain
|
||||
},
|
||||
_addAndSetOnlineLinks(state, data){
|
||||
let links = JSON.parse(data.links)
|
||||
state.onlineLinks[data.gid] = []
|
||||
state.currentLinks.splice(0)
|
||||
state.currentGid = data.gid
|
||||
|
||||
links.forEach((link) => {
|
||||
state.onlineLinks[data.gid].push('http://downloader.lionwebsite.xyz/GalleryManage/onlineImage/' + link + '?gid=' + state.currentGid + '&AuthCode=' + state.AuthCode)
|
||||
state.currentLinks.push('http://downloader.lionwebsite.xyz/GalleryManage/onlineImage/' + link + '?gid=' + state.currentGid + '&AuthCode=' + state.AuthCode)
|
||||
})
|
||||
|
||||
state.isOnlineReading = true
|
||||
},
|
||||
_setOnlineLinks(state, gid){
|
||||
state.currentLinks.splice(0)
|
||||
state.onlineLinks[gid].forEach((link) => {
|
||||
state.currentLinks.push(link)
|
||||
})
|
||||
state.currentGid = gid
|
||||
state.isOnlineReading = true
|
||||
},
|
||||
_openHistoryPanel(state){
|
||||
state.isShowHistory = true
|
||||
},
|
||||
@@ -573,6 +617,11 @@ const state = {
|
||||
thumbnailGallery:{}, //预览本子
|
||||
collectGallery:[], //收藏的本子
|
||||
|
||||
onlineLinks:{}, //在线本子链接
|
||||
isOnlineReading: false, //是否在线看
|
||||
currentGid: "", //当前GID
|
||||
currentLinks: [], //当前本子链接
|
||||
|
||||
totalVideoTask:[], //存放视频数据的数组
|
||||
chosenVideo:false, //准备下载的视频
|
||||
|
||||
@@ -657,13 +706,25 @@ function getShortname(name){
|
||||
let start = name.indexOf("[")
|
||||
let end = name.indexOf("]") + 1
|
||||
let temp = name.substring(start, end)
|
||||
name = name.replace(temp, "")
|
||||
temp = name.replace(temp, "")
|
||||
if(temp.trim() === ""){
|
||||
name = name.replace("[", "").replace("]", "")
|
||||
break
|
||||
}
|
||||
else
|
||||
name = temp
|
||||
}
|
||||
while (name.includes("(") && name.includes(")")) {
|
||||
let start = name.indexOf("(")
|
||||
let end = name.indexOf(")") + 1
|
||||
let temp = name.substring(start, end)
|
||||
name = name.replace(temp, "")
|
||||
temp = name.replace(temp, "")
|
||||
if(temp.trim() === ""){
|
||||
name = name.replace("(", "").replace(")", "")
|
||||
break
|
||||
}
|
||||
else
|
||||
name = temp
|
||||
}
|
||||
return name.trim()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user