feat:设置页cookie默认不显示明文与资源标题点击复制链接

This commit is contained in:
jiangrui
2025-03-12 12:58:09 +08:00
parent 8fa1ed8fc2
commit ef0de7ad8c
2 changed files with 60 additions and 8 deletions

View File

@@ -19,7 +19,7 @@
<!-- 右侧信息 --> <!-- 右侧信息 -->
<div class="content__info"> <div class="content__info">
<!-- 标题 --> <!-- 标题 -->
<div class="info__title" @click="openUrl(item.cloudLinks[0])"> <div class="info__title" @click="copyUrl(item.cloudLinks[0])">
{{ item.title }} {{ item.title }}
</div> </div>
@@ -72,6 +72,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import { useResourceStore } from "@/stores/resource"; import { useResourceStore } from "@/stores/resource";
import { showNotify } from "vant";
import type { ResourceItem } from "@/types"; import type { ResourceItem } from "@/types";
// Props 定义 // Props 定义
@@ -112,8 +113,29 @@ const handleSave = (resource: ResourceItem) => {
const handleJump = (resource: ResourceItem) => { const handleJump = (resource: ResourceItem) => {
emit("jump", resource); 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) => { const searchMovieforTag = (tag: string) => {
@@ -199,7 +221,7 @@ const toggleExpand = (id: string) => {
@include text-ellipsis(2); @include text-ellipsis(2);
&:active { &:active {
color: var(--theme-theme); opacity: 0.7;
} }
} }

View File

@@ -48,20 +48,35 @@
<van-cell-group inset> <van-cell-group inset>
<van-field <van-field
v-model="localUserSettings.cloud115Cookie" v-model="localUserSettings.cloud115Cookie"
:type="showCloud115Cookie ? 'text' : 'password'"
label="115网盘" label="115网盘"
type="textarea"
rows="2" rows="2"
autosize autosize
placeholder="请输入115网盘Cookie" placeholder="请输入115网盘Cookie"
/> >
<template #right-icon>
<van-icon
:name="showCloud115Cookie ? 'eye-o' : 'closed-eye'"
@click="showCloud115Cookie = !showCloud115Cookie"
/>
</template>
</van-field>
<van-field <van-field
v-model="localUserSettings.quarkCookie" v-model="localUserSettings.quarkCookie"
:type="showQuarkCookie ? 'text' : 'password'"
label="夸克网盘" label="夸克网盘"
type="textarea"
rows="2" rows="2"
autosize autosize
placeholder="请输入夸克网盘Cookie" placeholder="请输入夸克网盘Cookie"
/> >
<template #right-icon>
<van-icon
:name="showQuarkCookie ? 'eye-o' : 'closed-eye'"
@click="showQuarkCookie = !showQuarkCookie"
/>
</template>
</van-field>
</van-cell-group> </van-cell-group>
</div> </div>
@@ -122,6 +137,10 @@ const localUserSettings = ref<UserSettingAttributes>({
quarkCookie: "", quarkCookie: "",
}); });
// 添加显示/隐藏密码的状态
const showCloud115Cookie = ref(false);
const showQuarkCookie = ref(false);
// 监听 store 变化 // 监听 store 变化
watch( watch(
() => settingStore.globalSetting, () => settingStore.globalSetting,
@@ -252,4 +271,15 @@ const handleProxyHostChange = (val: string) => {
:deep(.van-cell-group--inset) { :deep(.van-cell-group--inset) {
margin: 0; margin: 0;
} }
// 添加图标样式
:deep(.van-field__right-icon) {
padding: 0 8px;
cursor: pointer;
color: var(--theme-color);
.van-icon {
font-size: 18px;
}
}
</style> </style>