增加删除完善优化文档

Squashed commit of the following:

commit c0e6400bcd42f317012621f7befd085e8be03b2f
Author: Sun <95302870@qq.com>
Date:   Fri Nov 10 13:02:35 2023 +0800

    更新说明文档

commit 0a81db157bec6da80ec7b522c1f59ce5f0153fc2
Author: Sun <95302870@qq.com>
Date:   Fri Nov 10 13:02:27 2023 +0800

    完善删除图标功能
This commit is contained in:
Sun 2023-11-10 13:08:59 +08:00
parent 211c3071dc
commit 7c939175db
7 changed files with 90 additions and 26 deletions

View File

@ -1,8 +1,17 @@
# Sun-Panel <div style="text-align: center;margin-bottom:10px">
一个NAS导航面板、Homepage、浏览器首页。 <div style="font-size:50px;font-weight:700">Sun-Panel</div>
<div>
<a href="https://github.com/hslr-s/sun-panel.git">Github</a> |
<a href="https://gitee.com/hslr/sun-panel.git">Gitee</a>
</div>
<span style="font-size:25px">一个NAS导航面板、Homepage、浏览器首页。</span>
</div>
## 特点
![](./doc/images/icon-info.jpg)
## 😎 特点
- 局域网内外网链接切换 - 局域网内外网链接切换
- 简洁 - 简洁
@ -11,20 +20,19 @@
- 无需连接外部数据库 - 无需连接外部数据库
- 丰富图标自由搭配(文字图标+svg图标+内置三方图标库) - 丰富图标自由搭配(文字图标+svg图标+内置三方图标库)
- 支持网页内置小窗口打开(部分网站屏蔽此功能) - 支持网页内置小窗口打开(部分网站屏蔽此功能)
- 占用资源小
## 🫓 后面想做的事
先画个饼
## 后面想做的事
随心开发
- [ ] 图标排序 - [ ] 图标排序
- [ ] 服务器监控 - [ ] 服务器监控
- [ ] docker管理器 - [ ] docker管理器
- [ ] 计划任务 - [ ] 计划任务
## 预览截图 ## 🖼️ 预览截图
![](./doc/images/icon-info.jpg)
![](./doc/images/icon-small.jpg) ![](./doc/images/icon-small.jpg)
![](./doc/images/full-color-info.jpg) ![](./doc/images/full-color-info.jpg)
![](./doc/images/full-color-small.jpg) ![](./doc/images/full-color-small.jpg)
@ -33,7 +41,30 @@
![](./doc/images/window-ssh.png) ![](./doc/images/window-ssh.png)
![](./doc/images/window-xunlei.png) ![](./doc/images/window-xunlei.png)
## 使用教程 ## 🍜 使用教程
### 默认账号密码
账号admin@sun.cc
密码12345678
### 命令参数
|参数|说明|
|---|---|
|-h|查看命令说明|
|-config|生成配置文件conf/conf.ini|
|-password-reset|重置第一个用户的密码|
执行示例
```sh
./sun-panel -password-reset
```
输出
```
密码已经重置成功,以下是账号信息
用户名 xxx@qq.com
密码 12345678
```
### docker 运行 ### docker 运行

View File

@ -98,3 +98,20 @@ func (a *ItemIcon) GetListByGroupId(c *gin.Context) {
apiReturn.SuccessListData(c, itemIcons, 0) apiReturn.SuccessListData(c, itemIcons, 0)
} }
func (a *ItemIcon) Deletes(c *gin.Context) {
req := commonApiStructs.RequestDeleteIds[uint]{}
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
apiReturn.ErrorParamFomat(c, err.Error())
return
}
userInfo, _ := base.GetCurrentUserInfo(c)
if err := global.Db.Debug().Delete(&models.ItemIcon{}, "id in ? AND user_id=?", req.Ids, userInfo.ID).Error; err != nil {
apiReturn.ErrorDatabase(c, err.Error())
return
}
apiReturn.Success(c)
}

View File

@ -13,6 +13,6 @@ func InitItemIcon(router *gin.RouterGroup) {
{ {
r.POST("/panel/itemIcon/edit", itemIcon.Edit) r.POST("/panel/itemIcon/edit", itemIcon.Edit)
r.POST("/panel/itemIcon/getListByGroupId", itemIcon.GetListByGroupId) r.POST("/panel/itemIcon/getListByGroupId", itemIcon.GetListByGroupId)
r.POST("/panel/itemIcon/deletes", itemIcon.Deletes)
} }
} }

View File

@ -1,13 +1,5 @@
import { post } from '@/utils/request' import { post } from '@/utils/request'
// // 获取绘图的列表
// export function getMyDrawList<T>(req: Common.ListRequest) {
// return post<T>({
// url: '/aiDraw/getMyDrawList',
// data: req,
// })
// }
export function edit<T>(req: Panel.ItemInfo) { export function edit<T>(req: Panel.ItemInfo) {
return post<T>({ return post<T>({
url: '/panel/itemIcon/edit', url: '/panel/itemIcon/edit',
@ -28,9 +20,9 @@ export function getListByGroupId<T>() {
}) })
} }
export function getSystemList<T>(data: Common.ListRequest) { export function deletes<T>(ids: number[]) {
return post<T>({ return post<T>({
url: '/aiApplet/getSystemList', url: '/panel/itemIcon/deletes',
data, data: { ids },
}) })
} }

View File

@ -12,6 +12,8 @@ const show = ref(false)
<div class="flex-1 flex-shrink-0 overflow-hidden"> <div class="flex-1 flex-shrink-0 overflow-hidden">
<!-- <UserAvatar /> --> <!-- <UserAvatar /> -->
</div> </div>
<a href="https://gitee.com/hslr/sun-panel.git">Gitee</a>
<a href="https://github.com/hslr-s/sun-panel.git">Github</a>
<HoverButton @click="show = true"> <HoverButton @click="show = true">
<span class="text-xl text-[#4f555e] dark:text-white"> <span class="text-xl text-[#4f555e] dark:text-white">

View File

@ -118,7 +118,7 @@ const handleUploadFinish = ({
<div v-if="checkedValueRef === 3"> <div v-if="checkedValueRef === 3">
<div> <div>
<NInput v-model:value="itemIconInfo.text" class="mb-[5px]" size="small" type="text" placeholder="请输入图标名字" @input="handleChange" /> <NInput v-model:value="itemIconInfo.text" class="mb-[5px]" size="small" type="text" placeholder="请输入图标名字" @input="handleChange" />
<a target="_blank" href="https://icon-sets.iconify.design/" class="text-[blue]">图标列表</a> <a target="_blank" href="https://icon-sets.iconify.design/" class="text-[blue]">图标</a>
</div> </div>
<NColorPicker <NColorPicker
v-model:value="itemIconInfo.bgColor" v-model:value="itemIconInfo.bgColor"

View File

@ -1,16 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import { NButton, NButtonGroup, NDropdown, NEllipsis, NGrid, NGridItem, NModal, NSkeleton, NSpin, useMessage } from 'naive-ui' import { NButton, NButtonGroup, NDropdown, NEllipsis, NGrid, NGridItem, NModal, NSkeleton, NSpin, useDialog, useMessage } from 'naive-ui'
import { nextTick, onMounted, ref } from 'vue' import { nextTick, onMounted, ref } from 'vue'
import { EditItem, Setting } from './components' import { EditItem, Setting } from './components'
import { Clock } from '@/components/deskModule' import { Clock } from '@/components/deskModule'
import { ItemIcon, SvgIcon } from '@/components/common' import { ItemIcon, SvgIcon } from '@/components/common'
import { getListByGroupId } from '@/api/panel/itemIcon' import { deletes, getListByGroupId } from '@/api/panel/itemIcon'
import { getInfo } from '@/api/system/user' import { getInfo } from '@/api/system/user'
import { usePanelState, useUserStore } from '@/store' import { usePanelState, useUserStore } from '@/store'
import { PanelStateNetworkModeEnum } from '@/enum' import { PanelStateNetworkModeEnum } from '@/enum'
import { setTitle } from '@/utils/cmn' import { setTitle } from '@/utils/cmn'
const ms = useMessage() const ms = useMessage()
const dialog = useDialog()
const panelState = usePanelState() const panelState = usePanelState()
const userStore = useUserStore() const userStore = useUserStore()
@ -39,6 +40,10 @@ const dropdownMenuOptions = [
label: '编辑', label: '编辑',
key: 'edit', key: 'edit',
}, },
{
label: '删除',
key: 'delete',
},
] ]
const items = ref<Panel.ItemInfo[]>() const items = ref<Panel.ItemInfo[]>()
@ -100,7 +105,24 @@ function handleSelect(key: string | number) {
editItemInfoData.value = { ...currentRightSelectItem.value } as Panel.ItemInfo editItemInfoData.value = { ...currentRightSelectItem.value } as Panel.ItemInfo
editItemInfoShow.value = true editItemInfoShow.value = true
break break
case 'del': case 'delete':
dialog.warning({
title: '警告',
content: `你确定要删除图标 ${currentRightSelectItem.value?.title} `,
positiveText: '确定',
negativeText: '取消',
onPositiveClick: () => {
deletes([currentRightSelectItem.value?.id as number]).then(({ code, msg }) => {
if (code === 0) {
ms.success('已删除')
getList()
}
else {
ms.error(`删除失败:${msg}`)
}
})
},
})
break break
default: default: