mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-10 15:18:46 +08:00
feat:设置页cookie默认不显示明文与资源标题点击复制链接
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<!-- 右侧信息 -->
|
||||
<div class="content__info">
|
||||
<!-- 标题 -->
|
||||
<div class="info__title" @click="openUrl(item.cloudLinks[0])">
|
||||
<div class="info__title" @click="copyUrl(item.cloudLinks[0])">
|
||||
{{ item.title }}
|
||||
</div>
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from "vue";
|
||||
import { useResourceStore } from "@/stores/resource";
|
||||
import { showNotify } from "vant";
|
||||
import type { ResourceItem } from "@/types";
|
||||
|
||||
// Props 定义
|
||||
@@ -112,8 +113,29 @@ const handleSave = (resource: ResourceItem) => {
|
||||
const handleJump = (resource: ResourceItem) => {
|
||||
emit("jump", resource);
|
||||
};
|
||||
const openUrl = (url: string) => {
|
||||
window.open(url);
|
||||
|
||||
const copyUrl = async (url: string) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(url);
|
||||
showNotify({
|
||||
type: "success",
|
||||
message: "链接已复制到剪贴板",
|
||||
duration: 1500,
|
||||
});
|
||||
} catch (err) {
|
||||
const input = document.createElement("input");
|
||||
input.value = url;
|
||||
document.body.appendChild(input);
|
||||
input.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(input);
|
||||
|
||||
showNotify({
|
||||
type: "success",
|
||||
message: "链接已复制到剪贴板",
|
||||
duration: 1500,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const searchMovieforTag = (tag: string) => {
|
||||
@@ -199,7 +221,7 @@ const toggleExpand = (id: string) => {
|
||||
@include text-ellipsis(2);
|
||||
|
||||
&:active {
|
||||
color: var(--theme-theme);
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,20 +48,35 @@
|
||||
<van-cell-group inset>
|
||||
<van-field
|
||||
v-model="localUserSettings.cloud115Cookie"
|
||||
:type="showCloud115Cookie ? 'text' : 'password'"
|
||||
label="115网盘"
|
||||
type="textarea"
|
||||
rows="2"
|
||||
autosize
|
||||
placeholder="请输入115网盘Cookie"
|
||||
/>
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-icon
|
||||
:name="showCloud115Cookie ? 'eye-o' : 'closed-eye'"
|
||||
@click="showCloud115Cookie = !showCloud115Cookie"
|
||||
/>
|
||||
</template>
|
||||
</van-field>
|
||||
|
||||
<van-field
|
||||
v-model="localUserSettings.quarkCookie"
|
||||
:type="showQuarkCookie ? 'text' : 'password'"
|
||||
label="夸克网盘"
|
||||
type="textarea"
|
||||
rows="2"
|
||||
autosize
|
||||
placeholder="请输入夸克网盘Cookie"
|
||||
/>
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-icon
|
||||
:name="showQuarkCookie ? 'eye-o' : 'closed-eye'"
|
||||
@click="showQuarkCookie = !showQuarkCookie"
|
||||
/>
|
||||
</template>
|
||||
</van-field>
|
||||
</van-cell-group>
|
||||
</div>
|
||||
|
||||
@@ -122,6 +137,10 @@ const localUserSettings = ref<UserSettingAttributes>({
|
||||
quarkCookie: "",
|
||||
});
|
||||
|
||||
// 添加显示/隐藏密码的状态
|
||||
const showCloud115Cookie = ref(false);
|
||||
const showQuarkCookie = ref(false);
|
||||
|
||||
// 监听 store 变化
|
||||
watch(
|
||||
() => settingStore.globalSetting,
|
||||
@@ -252,4 +271,15 @@ const handleProxyHostChange = (val: string) => {
|
||||
:deep(.van-cell-group--inset) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
// 添加图标样式
|
||||
:deep(.van-field__right-icon) {
|
||||
padding: 0 8px;
|
||||
cursor: pointer;
|
||||
color: var(--theme-color);
|
||||
|
||||
.van-icon {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user