新增分享按钮,自动复制分享链接(傻逼Safari),狮子可以查看下载人(同步更新)。交换按钮位置

This commit is contained in:
chuzhongzai 2023-02-13 10:37:12 +08:00
parent 4f06a20e52
commit 8ab862093b
2 changed files with 35 additions and 6 deletions

View File

@ -14,10 +14,14 @@
分辨率:{{props.row.resolution}}<br>
任务创建时间:{{props.row.createTimeDisplay}}<br>
标签:{{props.row.tag === '' ? '无': props.row.tag}} <br>
<span v-show="isLion">
downloader:{{props.row.downloader}}
</span>
<el-button @click="changeCollect(props.row.gid, props.row.isCollect)">{{props.row.isCollect ? '取消收藏' : '收藏'}}</el-button>
<el-button @click="deleteGallery(props.row.gid)" :disabled="props.row.download === undefined">删除</el-button>
<el-button @click="editTag(props.row.gid, props.row.tag)">编辑标签</el-button>
<el-button @click="updateGallery(props.row.link)" :disabled="props.row.download === undefined">更新</el-button>
<el-button @click="shareGallery({gid:props.row.gid, shortName:props.row.shortName + '.zip'})" v-if="isLion">分享</el-button>
</template>
</el-table-column>
@ -33,7 +37,7 @@
<template #default="scoped">
<span>
<el-button @click="downloadTask(scoped.row.download)" :disabled="scoped.row.download === undefined">下载</el-button>
<el-button @click="deleteGallery(scoped.row.gid)" :disabled="scoped.row.download === undefined">删除</el-button>
<el-button @click="changeCollect(scoped.row.gid, scoped.row.isCollect)">{{scoped.row.isCollect ? '取消收藏' : '收藏'}}</el-button>
<el-button @click="onlineGalleryReader(scoped.row.gid)" :disabled="scoped.row.download === undefined">在线看</el-button>
</span>
</template>
@ -143,6 +147,8 @@
<script setup>
import store from "../store";
import {computed, ref} from "vue";
import axios from "axios";
import {ElMessage} from "element-plus";
//
let inputNode = ref(null)
@ -196,6 +202,9 @@ let page = computed(() => {
targetPage.value = store.state.page
return store.state.page
})
let isLion = computed(() => {
return store.state.userId === 3
})
let currentLinks = computed(() => {
return store.state.currentLinks
@ -299,6 +308,25 @@ function onlineGalleryReader(gid){
function closeOnlineReader(){
store.state.isOnlineReading = false
}
function shareGallery(data){
const {gid, shortName} = data
let link
axios.post("http://downloader.lionwebsite.xyz/GalleryManage/share?userId=3&expireHour=3&gid=" + gid).then((res) => {
if(res.data.result === "success"){
let data = JSON.parse(res.data.data)
link = 'http://lionwebsite.xyz/GetFile/{1}?ShareCode={2}'.replace("{1}", shortName).replace("{2}", data.shareCode)
console.log(data)
ElMessage({dangerouslyUseHTMLString: true,
message: "<span>分享成功, 过期时间:" + data.expireTime + "</span><br><a href=" + link + ">链接</a>",
duration: 0,
'show-close': true
})
navigator.clipboard.writeText(link)
}
else
ElMessage(res.data.data)
})
}
//
function showThumbnail(gallery){

View File

@ -153,8 +153,7 @@ const actions = {
validate(context, AuthCode){
axios.post(BaseUrl + "validate?AuthCode=" + AuthCode).then((res)=>{
if(res.data.result === 'success'){
state.userId = parseInt(res.data.data)
context.commit("_authed", AuthCode)
context.commit("_authed", {AuthCode, userId: parseInt(res.data.data)})
//初始化
context.dispatch("loadMaskDomain").then()
context.dispatch("loadWeekUsedAmount").then()
@ -446,14 +445,16 @@ const mutations = {
_changePage(state, targetPage){
state.page = targetPage
},
_authed(state, AuthCode){
state.AuthCode = AuthCode
_authed(state, data){
state.AuthCode = data.AuthCode
state.userId = data.userId
state.isAuth = true
ElMessage("验证成功,加载中")
},
_unAuthed(state){
state.isAuth = false
state.AuthCode = ""
state.userId = -1
ElMessage("授权码错误")
localStorage.removeItem("auth")
},