更新v1.2.1
Squashed commit of the following: commit 146f106fbece251606f358141bda3d9c524c3e93 Author: Sun <95302870@qq.com> Date: Thu Dec 28 19:39:36 2023 +0800 修改默认宽度 commit 827197e295b2b0997902b8f965d14ab2598c5c1b Author: Sun <95302870@qq.com> Date: Thu Dec 28 17:54:25 2023 +0800 修复升级掉登录的问题 commit 2e54326f5fe2b8fac4eed488a14b04b8133c41bb Author: Sun <95302870@qq.com> Date: Thu Dec 28 17:21:49 2023 +0800 优化边距等提示 commit 469c6fd644a2a23d96405d15456980edfdfb17b0 Author: Sun <95302870@qq.com> Date: Thu Dec 28 17:21:34 2023 +0800 搜索栏选择搜索引擎后关闭选择器 commit 632da9635a4a434d361495dfcb83f8b650cb4a3c Author: Sun <95302870@qq.com> Date: Thu Dec 28 16:54:28 2023 +0800 增加 内容左右边距和最大宽度 commit f1cc3dce2a51ec60c1b04f21954b99b284b2df61 Author: Sun <95302870@qq.com> Date: Thu Dec 28 14:24:23 2023 +0800 分组标题增加阴影 commit 7615a29678037362c18632f38caad72e07a32d1a Author: Sun <95302870@qq.com> Date: Thu Dec 28 14:18:41 2023 +0800 更改版本号1.2.1 commit b605374e951d3fb2ca52d36bd0fa82aec4a5e89b Author: Sun <95302870@qq.com> Date: Thu Dec 28 14:11:06 2023 +0800 优化小部分网站图标获取失败的问题 commit c8141184a14fb02f941bbec03ac98f59f8b12d4b Author: Sun <95302870@qq.com> Date: Thu Dec 28 13:00:56 2023 +0800 优化上传管理界面
This commit is contained in:
parent
c9e05a5624
commit
bb67aaf5a6
@ -1 +1 @@
|
||||
7|1.2.0
|
||||
8|1.2.1
|
@ -2,7 +2,6 @@ package siteFavicon
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
@ -13,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func IsHTTPURL(url string) bool {
|
||||
httpPattern := `^(http://|https://)`
|
||||
httpPattern := `^(http://|https://|//)`
|
||||
match, err := regexp.MatchString(httpPattern, url)
|
||||
if err != nil {
|
||||
return false
|
||||
@ -24,7 +23,6 @@ func IsHTTPURL(url string) bool {
|
||||
func GetOneFaviconURL(urlStr string) (string, bool) {
|
||||
iconURLs, err := getFaviconURL(urlStr)
|
||||
if err != nil {
|
||||
fmt.Println("Error:", err)
|
||||
return "", false
|
||||
}
|
||||
|
||||
@ -44,10 +42,20 @@ func GetOneFaviconURL(urlStr string) (string, bool) {
|
||||
func getFaviconURL(url string) ([]string, error) {
|
||||
var icons []string
|
||||
icons = make([]string, 0)
|
||||
resp, err := http.Get(url)
|
||||
client := &http.Client{}
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
if err != nil {
|
||||
return icons, err
|
||||
}
|
||||
|
||||
// 设置User-Agent头字段,模拟浏览器请求
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3")
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return icons, err
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
@ -71,7 +79,7 @@ func getFaviconURL(url string) ([]string, error) {
|
||||
})
|
||||
|
||||
if len(icons) == 0 {
|
||||
return icons, fmt.Errorf("favicon not found on the page")
|
||||
return icons, errors.New("favicon not found on the page")
|
||||
}
|
||||
|
||||
return icons, nil
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import type { UploadFileInfo } from 'naive-ui'
|
||||
import { NButton, NCard, NColorPicker, NGrid, NGridItem, NInput, NPopconfirm, NSelect, NSlider, NSwitch, NUpload, NUploadDragger, useMessage } from 'naive-ui'
|
||||
import { NButton, NCard, NColorPicker, NGrid, NGridItem, NInput, NInputGroup, NPopconfirm, NSelect, NSlider, NSwitch, NUpload, NUploadDragger, useMessage } from 'naive-ui'
|
||||
import { useAuthStore, usePanelState } from '@/store'
|
||||
import { set as setUserConfig } from '@/api/panel/userConfig'
|
||||
import { PanelPanelConfigStyleEnum } from '@/enums/panel'
|
||||
@ -23,19 +23,24 @@ const iconTypeOptions = [
|
||||
},
|
||||
]
|
||||
|
||||
const maxWidthUnitOption = [
|
||||
{
|
||||
label: 'px',
|
||||
value: 'px',
|
||||
},
|
||||
{
|
||||
label: '%',
|
||||
value: '%',
|
||||
},
|
||||
]
|
||||
|
||||
watch(panelState.panelConfig, () => {
|
||||
if (!isSaveing.value) {
|
||||
isSaveing.value = true
|
||||
|
||||
setTimeout(() => {
|
||||
panelState.recordState()// 本地记录
|
||||
setUserConfig({ panel: panelState.panelConfig }).then((res) => {
|
||||
if (res.code === 0)
|
||||
ms.success('配置已保存')
|
||||
else
|
||||
ms.error(`配置保存失败${res.msg}`)
|
||||
isSaveing.value = false
|
||||
})
|
||||
uploadCloud()
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
@ -55,9 +60,9 @@ function handleUploadBackgroundFinish({
|
||||
function uploadCloud() {
|
||||
setUserConfig({ panel: panelState.panelConfig }).then((res) => {
|
||||
if (res.code === 0)
|
||||
ms.success('配置已同步到云端')
|
||||
ms.success('配置已保存')
|
||||
else
|
||||
ms.error(`配置同步到云端失败${res.msg}`)
|
||||
ms.error(`配置已保存${res.msg}`)
|
||||
})
|
||||
}
|
||||
|
||||
@ -199,10 +204,27 @@ function resetPanelConfig() {
|
||||
|
||||
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
|
||||
<div class="text-slate-500 mb-[5px] font-bold">
|
||||
其他
|
||||
内容区域
|
||||
</div>
|
||||
|
||||
<NGrid cols="2">
|
||||
<NGridItem span="12 400:12">
|
||||
<div class="flex items-center mt-[10px]">
|
||||
<span class="mr-[10px]">最大宽度</span>
|
||||
<div class="flex">
|
||||
<NInputGroup>
|
||||
<NInput v-model:value="panelState.panelConfig.maxWidth" size="small" type="number" :maxlength="10" :style="{ width: '100px' }" placeholder="1200" />
|
||||
<NSelect v-model:value="panelState.panelConfig.maxWidthUnit" :style="{ width: '80px' }" :options="maxWidthUnitOption" size="small" />
|
||||
</NInputGroup>
|
||||
</div>
|
||||
</div>
|
||||
</NGridItem>
|
||||
<NGridItem span="12 400:12">
|
||||
<div class="flex items-center mt-[10px]">
|
||||
<span class="mr-[10px]">左右边距</span>
|
||||
<NSlider v-model:value="panelState.panelConfig.marginX" class="max-w-[200px]" :step="1" :max="100" />
|
||||
</div>
|
||||
</NGridItem>
|
||||
<NGridItem span="12 400:12">
|
||||
<div class="flex items-center mt-[10px]">
|
||||
<span class="mr-[10px]">上边距 (%)</span>
|
||||
@ -231,7 +253,7 @@ function resetPanelConfig() {
|
||||
</NPopconfirm>
|
||||
|
||||
<NButton size="small" quaternary type="success" class="ml-[10px]" @click="uploadCloud">
|
||||
立即同步到云端
|
||||
立即保存
|
||||
</NButton>
|
||||
</NCard>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NButtonGroup, NCard, NEllipsis, NGrid, NGridItem, NImage, NImageGroup, NSpin, useDialog, useMessage } from 'naive-ui'
|
||||
import { NAlert, NButton, NButtonGroup, NCard, NEllipsis, NGrid, NGridItem, NImage, NImageGroup, NSpin, useDialog, useMessage } from 'naive-ui'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { deletes, getList } from '@/api/system/file'
|
||||
import { set as savePanelConfig } from '@/api/panel/userConfig'
|
||||
@ -86,8 +86,14 @@ onMounted(() => {
|
||||
<template>
|
||||
<div class="bg-slate-200 p-2 h-full">
|
||||
<NSpin v-show="loading" size="small" />
|
||||
<div class="flex justify-center">
|
||||
<NImageGroup>
|
||||
<NAlert type="info" :bordered="false">
|
||||
{{ $t('apps.uploadsFileManager.alertText') }}
|
||||
</NAlert>
|
||||
<div class="flex justify-center mt-2">
|
||||
<div v-if="imageList.length === 0 && !loading" class="flex">
|
||||
{{ $t('apps.uploadsFileManager.nothingText') }}
|
||||
</div>
|
||||
<NImageGroup v-else>
|
||||
<NGrid cols="2 300:2 600:4 900:6 1100:9" :x-gap="5" :y-gap="5">
|
||||
<NGridItem v-for=" item, index in imageList" :key="index">
|
||||
<NCard size="small" style="border-radius: 5px;" :bordered="true">
|
||||
|
@ -76,6 +76,7 @@ function handleEngineClick() {
|
||||
function handleEngineUpdate(engine: DeskModule.SearchBox.SearchEngine) {
|
||||
state.value.currentSearchEngine = engine
|
||||
moduleConfig.saveToCloud(moduleConfigName, state.value)
|
||||
searchSelectListShow.value = false
|
||||
}
|
||||
|
||||
function handleSearchClick() {
|
||||
|
@ -114,6 +114,8 @@ export default {
|
||||
copySuccess: '链接复制成功,可以在图标地址栏',
|
||||
copyFailed: '复制失败',
|
||||
setWallpaper: '设置为壁纸',
|
||||
alertText: '你可以在这里管理你上传过的壁纸和图标',
|
||||
nothingText: '你还没有上传过任何图片',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { AuthState } from './index'
|
||||
import { ss } from '@/utils/storage'
|
||||
|
||||
const LOCAL_NAME = 'SECRET_TOKEN'
|
||||
const LOCAL_NAME = 'AUTH_TOKEN'
|
||||
|
||||
// export function getToken() {
|
||||
// return ss.get(LOCAL_NAME)
|
||||
|
@ -19,6 +19,9 @@ export function defaultStatePanelConfig(): Panel.panelConfig {
|
||||
searchBoxSearchIcon: false,
|
||||
marginBottom: 10,
|
||||
marginTop: 10,
|
||||
maxWidth: 1200,
|
||||
maxWidthUnit: 'px',
|
||||
marginX: 5,
|
||||
}
|
||||
}
|
||||
|
||||
|
3
src/typings/panel.d.ts
vendored
3
src/typings/panel.d.ts
vendored
@ -52,6 +52,9 @@ declare namespace Panel {
|
||||
searchBoxSearchIcon?:boolean
|
||||
marginTop?:number
|
||||
marginBottom?:number
|
||||
maxWidth?:number
|
||||
maxWidthUnit:string
|
||||
marginX?:number
|
||||
}
|
||||
|
||||
interface userConfig{
|
||||
|
@ -334,8 +334,12 @@ function handleAddItem(itemIconGroupId?: number) {
|
||||
<div class="mask" :style="{ backgroundColor: `rgba(0,0,0,${panelState.panelConfig.backgroundMaskNumber})` }" />
|
||||
<div ref="scrollContainerRef" class="absolute w-full h-full overflow-auto">
|
||||
<div
|
||||
class="p-2.5 xs:max-w-[95%] lg:max-w-[80%] mx-auto "
|
||||
:style="{ marginTop: `${panelState.panelConfig.marginTop}%`, marginBottom: `${panelState.panelConfig.marginBottom}%` }"
|
||||
class="p-2.5 mx-auto"
|
||||
:style="{
|
||||
marginTop: `${panelState.panelConfig.marginTop}%`,
|
||||
marginBottom: `${panelState.panelConfig.marginBottom}%`,
|
||||
maxWidth: (panelState.panelConfig.maxWidth ?? '1200') + panelState.panelConfig.maxWidthUnit,
|
||||
}"
|
||||
>
|
||||
<!-- 头 -->
|
||||
<div class="mx-[auto] w-[80%]">
|
||||
@ -358,7 +362,7 @@ function handleAddItem(itemIconGroupId?: number) {
|
||||
</div>
|
||||
|
||||
<!-- 应用盒子 -->
|
||||
<div class="mt-[50px]">
|
||||
<div class="mt-[50px]" :style="{ marginLeft: `${panelState.panelConfig.marginX}px`, marginRight: `${panelState.panelConfig.marginX}px` }">
|
||||
<!-- 组纵向排列 -->
|
||||
<div
|
||||
v-for="(itemGroup, itemGroupIndex) in filterItems" :key="itemGroupIndex"
|
||||
@ -369,7 +373,7 @@ function handleAddItem(itemIconGroupId?: number) {
|
||||
>
|
||||
<!-- 分组标题 -->
|
||||
<div class="text-white text-xl font-extrabold mb-[20px] ml-[10px] flex items-center">
|
||||
<span>
|
||||
<span class="text-shadow">
|
||||
{{ itemGroup.title }}
|
||||
</span>
|
||||
<div
|
||||
|
Loading…
x
Reference in New Issue
Block a user