Merge branch 'v1.23.0'
This commit is contained in:
@@ -59,8 +59,8 @@
|
||||
|
||||
## ❓ 常见问题
|
||||
|
||||
- [如何获取参数 admin_id](./docs/faq/admin_id.md)
|
||||
- [服务器宽带占用过大解释](./docs/faq/bandwidth.md)
|
||||
- [Telegram 通知 Chat ID 获取教程](docs/faq/telegram-chat-id.md)
|
||||
|
||||
## ⚠️ 重要提示
|
||||
|
||||
@@ -76,10 +76,6 @@
|
||||
|
||||
- [Epusdt](https://github.com/assimon/epusdt)
|
||||
|
||||
## 📜 免责声明
|
||||
|
||||
本项目仅供个人学习研究使用。任何人或组织在使用过程中请符合当地的法律法规,否则产生的任何后果责任自负。
|
||||
|
||||
## 🌟 Star 历史
|
||||
|
||||
[](https://starchart.cc/v03413/bepusdt)
|
||||
|
||||
@@ -270,16 +270,17 @@ func (Auth) Menu(ctx *gin.Context) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Id: "06",
|
||||
Path: "/github-api-doc",
|
||||
Name: "github-api-doc",
|
||||
Id: "06",
|
||||
Path: "/github-api-doc",
|
||||
Name: "github-api-doc",
|
||||
Component: "about/doc",
|
||||
Meta: meta{
|
||||
Title: "github-api-doc",
|
||||
Hide: false,
|
||||
Disable: false,
|
||||
KeepAlive: true,
|
||||
Affix: false,
|
||||
Link: "https://github.com/v03413/BEpusdt/blob/main/docs/api.md",
|
||||
Link: "https://github.com/v03413/BEpusdt/blob/main/docs/api/api.md",
|
||||
Iframe: false,
|
||||
IsFull: false,
|
||||
Roles: []string{"admin"},
|
||||
@@ -288,7 +289,6 @@ func (Auth) Menu(ctx *gin.Context) {
|
||||
Sort: 1,
|
||||
Type: 2,
|
||||
},
|
||||
Children: nil,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ type cancelReq struct {
|
||||
func (Epusdt) SignVerify(ctx *gin.Context) {
|
||||
rawData, err := ctx.GetRawData()
|
||||
if err != nil {
|
||||
ctx.JSON(400, gin.H{"error": fmt.Sprintf("json 数据读取错误 %s", err.Error())})
|
||||
ctx.JSON(200, respFailJson(fmt.Sprintf("json 数据读取错误 %s", err.Error())))
|
||||
ctx.Abort()
|
||||
|
||||
return
|
||||
@@ -48,7 +48,7 @@ func (Epusdt) SignVerify(ctx *gin.Context) {
|
||||
|
||||
m := make(map[string]any)
|
||||
if err = json.Unmarshal(rawData, &m); err != nil {
|
||||
ctx.JSON(400, gin.H{"error": fmt.Sprintf("json 数据解析错误 %s", err.Error())})
|
||||
ctx.JSON(200, respFailJson(fmt.Sprintf("json 数据解析错误 %s", err.Error())))
|
||||
ctx.Abort()
|
||||
|
||||
return
|
||||
@@ -56,14 +56,14 @@ func (Epusdt) SignVerify(ctx *gin.Context) {
|
||||
|
||||
sign, ok := m["signature"]
|
||||
if !ok {
|
||||
ctx.JSON(400, gin.H{"error": "签名丢失"})
|
||||
ctx.JSON(200, respFailJson("签名丢失"))
|
||||
ctx.Abort()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if utils.EpusdtSign(m, model.AuthToken()) != sign {
|
||||
ctx.JSON(400, gin.H{"error": "签名错误"})
|
||||
ctx.JSON(200, respFailJson("签名错误"))
|
||||
ctx.Abort()
|
||||
|
||||
return
|
||||
@@ -76,7 +76,7 @@ func (Epusdt) SignVerify(ctx *gin.Context) {
|
||||
func (Epusdt) CreateTransaction(ctx *gin.Context) {
|
||||
var req createReq
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
ctx.JSON(400, gin.H{"error": fmt.Sprintf("请求参数错误:%s", err.Error())})
|
||||
ctx.JSON(200, respFailJson(fmt.Sprintf("请求参数错误:%s", err.Error())))
|
||||
|
||||
return
|
||||
}
|
||||
@@ -113,6 +113,8 @@ func (Epusdt) CreateTransaction(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
log.Info(fmt.Sprintf("订单创建成功 商户订单:%s", req.OrderID))
|
||||
|
||||
// 返回响应数据
|
||||
ctx.JSON(200, respSuccJson(gin.H{
|
||||
"fiat": order.Fiat,
|
||||
@@ -125,13 +127,12 @@ func (Epusdt) CreateTransaction(ctx *gin.Context) {
|
||||
"expiration_time": uint64(order.ExpiredAt.Sub(time.Now()).Seconds()),
|
||||
"payment_url": model.CheckoutCounter(host, order.TradeId),
|
||||
}))
|
||||
log.Info(fmt.Sprintf("订单创建成功 商户订单:%s", req.OrderID))
|
||||
}
|
||||
|
||||
func (Epusdt) CancelTransaction(ctx *gin.Context) {
|
||||
var req cancelReq
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
ctx.JSON(400, gin.H{"error": fmt.Sprintf("请求参数错误:%s", err.Error())})
|
||||
ctx.JSON(200, respFailJson(fmt.Sprintf("请求参数错误:%s", err.Error())))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
+1
-23
@@ -4,26 +4,4 @@
|
||||
* 这种情况尤其需要注意,当你禁止浏览器缓存时就必须将对应模块加载到依赖预构建,否则跳转时会频繁出现页面刷新的问题,因为它无法在浏览器缓存也没有在本地node_modules/.vite内缓存。
|
||||
* 如果使用的第三方库是全局引入,也就是src/main.ts文件里,那么它就会自动被vite缓存到node_modules/.vite,此时就不用将该第三方库做依赖预构建(添加到include内)。
|
||||
*/
|
||||
const include = [
|
||||
"vue-codemirror6",
|
||||
"qrcode",
|
||||
"jsbarcode",
|
||||
"vuedraggable",
|
||||
"@wangeditor/editor",
|
||||
"fingerprintjs2",
|
||||
"xgplayer",
|
||||
"print-js",
|
||||
"@codemirror/theme-one-dark",
|
||||
"@codemirror/lang-json",
|
||||
"@codemirror/lang-javascript",
|
||||
"@codemirror/lang-vue",
|
||||
"pinyin-pro"
|
||||
];
|
||||
|
||||
/**
|
||||
* 在预构建中强制排除的依赖项
|
||||
* 如果你有某些依赖包不希望被预构建,可以使用 exclude 属性来排除它们。
|
||||
*/
|
||||
// const exclude = [];
|
||||
|
||||
export { include };
|
||||
export const include = [];
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<link rel="icon" type="image/svg+xml" href="/src/assets/logo/snow.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/static/css/loading.css" type="text/css" />
|
||||
<title>BEpusdt 一款更好用的个人 USDT/USDC 收款网关!</title>
|
||||
<title>BEpusdt 一款更好用的个人加密货币收款网关!</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
|
||||
+4
-22
@@ -33,39 +33,18 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@arco-design/color": "^0.4.0",
|
||||
"@codemirror/lang-javascript": "^6.2.2",
|
||||
"@codemirror/lang-json": "^6.0.1",
|
||||
"@codemirror/lang-vue": "^0.1.3",
|
||||
"@codemirror/theme-one-dark": "^6.1.2",
|
||||
"@fingerprintjs/fingerprintjs": "^4.6.2",
|
||||
"@visactor/vchart": "^1.11.0",
|
||||
"@visactor/vchart-arco-theme": "^1.11.0",
|
||||
"@vueuse/core": "^12.4.0",
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||
"axios": "^1.6.8",
|
||||
"codemirror": "^6.0.1",
|
||||
"driver.js": "^1.3.1",
|
||||
"fingerprintjs2": "^2.1.4",
|
||||
"jsbarcode": "^3.11.6",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^2.3.0",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
"pinyin-pro": "^3.26.0",
|
||||
"print-js": "^1.6.0",
|
||||
"qrcode": "^1.5.4",
|
||||
"recorder-core": "^1.3.25011100",
|
||||
"sortablejs": "^1.15.2",
|
||||
"uuid": "^11.1.0",
|
||||
"vue": "^3.5.15",
|
||||
"vue-codemirror6": "^1.3.0",
|
||||
"vue-color-kit": "^1.0.6",
|
||||
"vue-i18n": "10.0.0-alpha.3",
|
||||
"vue-pick-colors": "^1.7.6",
|
||||
"vue-router": "^4.3.0",
|
||||
"vue-virtual-scroller": "2.0.0-beta.8",
|
||||
"vuedraggable": "^4.1.0",
|
||||
"xgplayer": "^3.0.18"
|
||||
"vue-router": "^4.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arco-design/web-vue": "^2.57.0",
|
||||
@@ -77,6 +56,7 @@
|
||||
"@typescript-eslint/parser": "^8.32.1",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"commitlint": "^19.2.1",
|
||||
"depcheck": "^1.4.7",
|
||||
"eslint": "^9.27.0",
|
||||
"eslint-config-prettier": "^10.1.1",
|
||||
"eslint-plugin-prettier": "^5.2.3",
|
||||
@@ -90,6 +70,7 @@
|
||||
"postcss-preset-env": "^9.5.2",
|
||||
"postcss-scss": "^4.0.9",
|
||||
"prettier": "^3.2.5",
|
||||
"rollup-plugin-visualizer": "^6.0.5",
|
||||
"sass-embedded": "^1.86.0",
|
||||
"stylelint": "^16.16.0",
|
||||
"stylelint-config-html": "^1.1.0",
|
||||
@@ -105,6 +86,7 @@
|
||||
"unplugin-vue-components": "^0.26.0",
|
||||
"vite": "^6.3.5",
|
||||
"vite-plugin-eslint": "^1.8.1",
|
||||
"vite-plugin-inspect": "^11.3.3",
|
||||
"vite-plugin-mock": "^2.9.6",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vue-tsc": "^2.2.4"
|
||||
|
||||
Generated
+561
-1089
File diff suppressed because it is too large
Load Diff
@@ -1,17 +0,0 @@
|
||||
import axios from "@/api";
|
||||
|
||||
// 获取机构树
|
||||
export const getDocumentLibraryTreeAPI = () => {
|
||||
return axios({
|
||||
url: "/mock/document-library/tree",
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
|
||||
// 获取列表数据
|
||||
export const getDocumentLibraryTableAPI = () => {
|
||||
return axios({
|
||||
url: "/mock/document-library/table",
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
@@ -1,26 +0,0 @@
|
||||
import axios from "@/api";
|
||||
|
||||
// 获取在线用户
|
||||
export const getOnlineuserAPI = () => {
|
||||
return axios({
|
||||
url: "/mock/monitor/getOnlineuser",
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
|
||||
// 获取定时任务
|
||||
export const getCrontabAPI = () => {
|
||||
return axios({
|
||||
url: "/mock/monitor/getCrontab",
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
|
||||
// 获取定时任务日志
|
||||
export const getCrontabLogsAPI = (params: any) => {
|
||||
return axios({
|
||||
url: "/mock/monitor/getCrontabLogs",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
};
|
||||
@@ -1,17 +0,0 @@
|
||||
import axios from "@/api";
|
||||
|
||||
// 获取列表数据
|
||||
export const getCommonTableListAPI = () => {
|
||||
return axios({
|
||||
url: "/mock/common-table/list",
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
|
||||
// 获取列表数据
|
||||
export const getCustomTableListAPI = () => {
|
||||
return axios({
|
||||
url: "/mock/custom-table/list",
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
import axios from "@/api";
|
||||
|
||||
export const mockTestAPI = () => {
|
||||
return axios({
|
||||
url: "/mock/test/success",
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
Vendored
-14
@@ -9,22 +9,8 @@ declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
SBarcodeDraw: typeof import('./components/s-barcode-draw/index.vue')['default']
|
||||
SCodeView: typeof import('./components/s-code-view/index.vue')['default']
|
||||
SExternalLinkPage: typeof import('./components/s-external-link-page/index.vue')['default']
|
||||
SFoldPage: typeof import('./components/s-fold-page/index.vue')['default']
|
||||
SFullPage: typeof import('./components/s-full-page/index.vue')['default']
|
||||
SInternalLinkPage: typeof import('./components/s-internal-link-page/index.vue')['default']
|
||||
SLangProvider: typeof import('./components/s-lang-provider/index.vue')['default']
|
||||
SLayoutSearch: typeof import('./components/s-layout-search/index.vue')['default']
|
||||
SLayoutTools: typeof import('./components/s-layout-tools/index.vue')['default']
|
||||
SMainTransition: typeof import('./components/s-main-transition/index.vue')['default']
|
||||
SPinyinPro: typeof import('./components/s-pinyin-pro/index.vue')['default']
|
||||
SQrcodeDraw: typeof import('./components/s-qrcode-draw/index.vue')['default']
|
||||
SRecorderPcm: typeof import('./components/s-recorder-pcm/index.vue')['default']
|
||||
SSelectIcon: typeof import('./components/s-select-icon/index.vue')['default']
|
||||
SSvgAndIcon: typeof import('./components/s-svg-and-icon/index.vue')['default']
|
||||
SSvgIcon: typeof import('./components/s-svg-icon/index.vue')['default']
|
||||
SVerifyCode: typeof import('./components/s-verify-code/index.vue')['default']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<template>
|
||||
<component :is="tag" ref="nodes" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import JsBarcode from "jsbarcode";
|
||||
const props = defineProps({
|
||||
// 节点类型,可接收svg、img、canvas
|
||||
tag: {
|
||||
type: String,
|
||||
default: "svg"
|
||||
},
|
||||
// 条形码具体内容
|
||||
text: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
// 条形码配置
|
||||
// https://github.com/lindell/JsBarcode/wiki/Options
|
||||
options: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const nodes = ref();
|
||||
onMounted(() => {
|
||||
JsBarcode(nodes.value, props.text, props.options);
|
||||
});
|
||||
</script>
|
||||
@@ -1,65 +0,0 @@
|
||||
<template>
|
||||
<code-mirror
|
||||
v-model="codeValue"
|
||||
:extensions="extensions"
|
||||
:basic="config.basic"
|
||||
:tab-size="config.tabSize"
|
||||
:dark="config.dark"
|
||||
:readonly="config.readonly"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import CodeMirror from "vue-codemirror6";
|
||||
import { oneDark } from "@codemirror/theme-one-dark";
|
||||
import { json } from "@codemirror/lang-json";
|
||||
import { javascript } from "@codemirror/lang-javascript";
|
||||
import { vue } from "@codemirror/lang-vue";
|
||||
// Props接口类型
|
||||
interface Props {
|
||||
type?: "javascript" | "vue" | "json";
|
||||
codeJson: string;
|
||||
}
|
||||
// withDefaults为defineProps标注类型
|
||||
// https://cn.vuejs.org/guide/typescript/composition-api.html#typing-component-props
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
type: "javascript", // 默认值
|
||||
codeJson: "" // 默认值
|
||||
});
|
||||
|
||||
// 通过计算属性实现数据实时更新
|
||||
// 将序列化的字符串美观输出,\t 换行
|
||||
const codeValue = computed(() => props.codeJson);
|
||||
|
||||
// 基础配置
|
||||
const config = ref({
|
||||
tabSize: 2,
|
||||
basic: true,
|
||||
dark: true,
|
||||
readonly: true
|
||||
});
|
||||
|
||||
// 扩展
|
||||
// 基础扩展:黑暗模式
|
||||
// 根据默认值来判断添加什么扩展
|
||||
const extensions = computed(() => {
|
||||
const arr = [oneDark];
|
||||
if (props.type === "javascript") {
|
||||
arr.push(javascript());
|
||||
}
|
||||
if (props.type === "vue") {
|
||||
arr.push(vue());
|
||||
}
|
||||
if (props.type === "json") {
|
||||
arr.push(json());
|
||||
}
|
||||
return arr;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 修改code中的字体样式
|
||||
:deep(.ͼ1 .cm-scroller) {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
|
||||
}
|
||||
</style>
|
||||
@@ -1,51 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="external-link-page">
|
||||
<div class="external-link-inner-page">
|
||||
<div>
|
||||
<div class="star-emoji">🌍</div>
|
||||
<div class="docs-text">外链页面已经在新窗口中打开</div>
|
||||
<div class="to-page"><a-button type="primary" @click="openPage">立即前往</a-button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
const openPage = () => {
|
||||
window.open(route.meta.link as string, "_blank");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.external-link-page {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
.external-link-inner-page {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background: $color-bg-1;
|
||||
.star-emoji {
|
||||
font-size: 100px;
|
||||
text-align: center;
|
||||
}
|
||||
.docs-text {
|
||||
margin: $margin 0;
|
||||
color: $color-text-3;
|
||||
text-align: center;
|
||||
}
|
||||
.to-page {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,79 +0,0 @@
|
||||
<template>
|
||||
<a-layout class="layout" id="s-fold-page">
|
||||
<a-layout-sider ref="siderContent" class="layout-sider" :collapsed-width="12" :width="width" :collapsed="collapsed">
|
||||
<div class="packup-btn" @click="collapsed = !collapsed">
|
||||
<icon-left v-if="!collapsed" />
|
||||
<icon-right v-else />
|
||||
</div>
|
||||
<div
|
||||
v-show="!collapsed"
|
||||
:style="{
|
||||
padding: siderPadding
|
||||
}"
|
||||
>
|
||||
<slot name="sider"> </slot>
|
||||
</div>
|
||||
</a-layout-sider>
|
||||
<a-layout-content>
|
||||
<div class="content">
|
||||
<slot name="content"> </slot>
|
||||
</div>
|
||||
</a-layout-content>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const width = defineModel("width", {
|
||||
type: Number,
|
||||
default: 200
|
||||
});
|
||||
const collapsed = ref<boolean>(false);
|
||||
const siderPadding = computed(() => (collapsed.value ? "0px" : "12px"));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.layout {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
.layout-sider {
|
||||
position: relative;
|
||||
border-right: 1px solid $color-border-2;
|
||||
.packup-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: calc(-24px / 2);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
color: $color-text-2;
|
||||
background: $color-bg-white;
|
||||
border-radius: 50%;
|
||||
box-shadow:
|
||||
inset 0 0 0 1px $color-border-2,
|
||||
0 0 10px 0 rgb(0 0 0 / 5%);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px $color-border-2,
|
||||
0 0 10px 0 rgb(0 0 0 / 5%);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px $color-border-2,
|
||||
0 0 10px 0 rgb(0 0 0 / 5%);
|
||||
transform: translateY(-50%);
|
||||
transition: all 0.1s;
|
||||
&:hover {
|
||||
transform: translateY(-50%) scale(1.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
.content {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
padding: 12px;
|
||||
}
|
||||
}
|
||||
:deep(.arco-layout-sider-light) {
|
||||
box-shadow: unset;
|
||||
}
|
||||
</style>
|
||||
@@ -1,23 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="external-link-page">
|
||||
<div class="external-link-inner-page">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.external-link-page {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
.external-link-inner-page {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background: $color-bg-1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,41 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-fill-pure">
|
||||
<div class="link-page-box">
|
||||
<div v-if="!isLoading" class="loading-page">
|
||||
<div class="dc-loader"></div>
|
||||
</div>
|
||||
<iframe v-show="isLoading" :src="link" class="iframe-size" id="internalLinkPage"> </iframe>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const link = ref<string>(route.meta.link as string);
|
||||
|
||||
const isLoading = ref(false); // iframe是否加载完成
|
||||
onMounted(() => {
|
||||
let iframe = document.getElementById("internalLinkPage") as HTMLElement;
|
||||
if (iframe) {
|
||||
// 加载完成
|
||||
iframe.onload = () => {
|
||||
isLoading.value = true;
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.link-page-box {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.iframe-size {
|
||||
flex: 1;
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,39 +0,0 @@
|
||||
<template>
|
||||
<a-grid :colGap="12" :rowGap="12" :cols="{ xs: 1, sm: 1, md: 1, lg: 2, xl: 3, xxl: 4 }" :collapsed="collapsed">
|
||||
<slot name="form"></slot>
|
||||
<a-grid-item suffix>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="onSearch">
|
||||
<template #icon>
|
||||
<icon-search />
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button @click="onReset">
|
||||
<template #icon>
|
||||
<icon-refresh />
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
<a-button type="text" @click="collapsed = !collapsed">
|
||||
<template #icon>
|
||||
<icon-down v-if="collapsed" />
|
||||
<icon-up v-else />
|
||||
</template>
|
||||
<span>{{ collapsed ? "展开" : "收起" }}</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-grid-item>
|
||||
</a-grid>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const emit = defineEmits(["search", "reset"]);
|
||||
const collapsed = ref<boolean>(true);
|
||||
|
||||
const onSearch = () => emit("search");
|
||||
|
||||
const onReset = () => emit("reset");
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,21 +0,0 @@
|
||||
<template>
|
||||
<div class="tools">
|
||||
<a-space>
|
||||
<slot name="left"> </slot>
|
||||
</a-space>
|
||||
<a-space>
|
||||
<slot name="right"> </slot>
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tools {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
@@ -1,56 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-html="content"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { html } from "pinyin-pro";
|
||||
// https://github.com/zh-lx/pinyin-pro
|
||||
interface Props {
|
||||
text: string;
|
||||
options?: {
|
||||
// 汉字和拼音最外层 <span> 标签的类名
|
||||
resultClass?: string;
|
||||
// 拼音外层 <rt> 标签的类名
|
||||
pinyinClass?: string;
|
||||
// 汉字外层 <span> 标签的类名
|
||||
chineseClass?: string;
|
||||
// 是否用 <span> 标签包裹非汉字字符。
|
||||
wrapNonChinese?: boolean;
|
||||
// 非汉字字符外层 <span> 标签的类名 (仅在 wrapNonChinese 值为 true 时有效)
|
||||
nonChineseClass?: string;
|
||||
// 拼音中音调的显示形式
|
||||
tone?: boolean;
|
||||
// v3.24.2+ 是否输出 <rp>(</rp> 和 <rp>)</rp> 标签
|
||||
rp?: boolean;
|
||||
// 指定文字类名 key:类名 value:文字数组
|
||||
customClassMap?: {
|
||||
[key: string]: string[];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// withDefaults为defineProps标注类型
|
||||
// https://cn.vuejs.org/guide/typescript/composition-api.html#typing-component-props
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
text: "", // 默认值
|
||||
options: () => ({})
|
||||
});
|
||||
|
||||
const content = ref<string>();
|
||||
const createPinyin = () => {
|
||||
content.value = html(props.text, props.options);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.text,
|
||||
() => {
|
||||
createPinyin();
|
||||
}
|
||||
);
|
||||
|
||||
createPinyin();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,48 +0,0 @@
|
||||
<template>
|
||||
<component :is="tag" ref="nodes" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import QRCode from "qrcode";
|
||||
|
||||
const props = defineProps({
|
||||
// 节点类型,可接收img、canvas
|
||||
tag: {
|
||||
type: String,
|
||||
default: "img"
|
||||
},
|
||||
// 条形码具体内容
|
||||
text: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
// 二维码配置
|
||||
// https://www.npmjs.com/package/qrcode
|
||||
options: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const nodes = ref();
|
||||
const createQRCode = () => {
|
||||
if (props.tag === "canvas") {
|
||||
QRCode.toCanvas(nodes.value, props.text, props.options, function (error: any) {
|
||||
if (error) return console.error(error);
|
||||
});
|
||||
} else {
|
||||
QRCode.toDataURL(props.text, props.options, function (error: any, url: any) {
|
||||
if (error) return console.error(error);
|
||||
nodes.value.src = url; // 将二维码图像显示在 img 元素中
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
createQRCode();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,115 +0,0 @@
|
||||
<template>
|
||||
<div style="width: 100%; height: 100%" ref="recwave"></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
//必须引入的核心
|
||||
import Recorder from "recorder-core";
|
||||
//引入pcm格式支持文件
|
||||
import "recorder-core/src/engine/pcm";
|
||||
//可选的插件支持项,这个是波形可视化插件
|
||||
import "recorder-core/src/extensions/waveview";
|
||||
//ts import 提示:npm包内已自带了.d.ts声明文件(不过是any类型)
|
||||
|
||||
const emit = defineEmits(["change"]);
|
||||
|
||||
let wave: any; // 用于绘制波形
|
||||
const recwave = ref(null); // 绑定到dom元素上
|
||||
let rec: any; // Recorder实例
|
||||
let send_chunk: any; // 上次分割点数据
|
||||
let testSampleRate = 16000; // 采样率
|
||||
|
||||
//重置环境,每次开始录音时必须先调用此方法,清理环境
|
||||
const RealTimeSendReset = () => {
|
||||
send_chunk = null;
|
||||
};
|
||||
|
||||
// 打开录音
|
||||
const recOpen = () => {
|
||||
RealTimeSendReset();
|
||||
// 创建录音对象
|
||||
rec = Recorder({
|
||||
type: "unknown", //这里特意使用unknown格式,方便清理内存
|
||||
onProcess: (buffers: any, powerLevel: any, _: any, bufferSampleRate: any) => {
|
||||
// 所有的pcm数据queue,缓存采样率,是否结束
|
||||
RealTimeSendTry(buffers, bufferSampleRate, false);
|
||||
if (wave) {
|
||||
wave.input(buffers[buffers.length - 1], powerLevel, bufferSampleRate);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!rec) {
|
||||
alert("当前浏览器不支持录音功能!");
|
||||
return;
|
||||
}
|
||||
// 打开录音,获得权限
|
||||
rec.open(
|
||||
() => {
|
||||
if (recwave.value) {
|
||||
// 创建音频可视化图形绘制对象
|
||||
wave = Recorder.WaveView({ elem: recwave.value });
|
||||
}
|
||||
},
|
||||
(msg: any, isUserNotAllow: any) => {
|
||||
// 用户拒绝了录音权限,或者浏览器不支持录音
|
||||
console.log((isUserNotAllow ? "UserNotAllow," : "") + "无法录音:" + msg);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const RealTimeSendTry = (buffers: any, bufferSampleRate: any, isClose: any) => {
|
||||
//提取出新的pcm数据
|
||||
let pcm = new Int16Array(0);
|
||||
if (buffers.length > 0) {
|
||||
//【关键代码】借用SampleData函数进行数据的连续处理,采样率转换是顺带的,得到新的pcm数据
|
||||
// send_chunk为上次分割点
|
||||
let chunk = Recorder.SampleData(buffers, bufferSampleRate, testSampleRate, send_chunk);
|
||||
send_chunk = chunk; // 保存本次分割点,用于下次使用
|
||||
pcm = chunk.data; //此时的pcm就是原始的音频16位pcm数据(小端LE),直接保存即为16位pcm文件、加个wav头即为wav文件、丢给mp3编码器转一下码即为mp3文件
|
||||
}
|
||||
|
||||
//没有指定固定的帧大小,直接把pcm发送出去即可
|
||||
TransferUpload(pcm, isClose);
|
||||
return;
|
||||
};
|
||||
|
||||
//=====数据传输函数==========
|
||||
const TransferUpload = (pcmFrame: any, isClose: any) => {
|
||||
if (isClose && pcmFrame.length == 0) {
|
||||
// 这里就是数据发送完成,录音结束的位置,可以停止ws了
|
||||
emit("change", { arrayBuffer: pcmFrame.buffer, close: true });
|
||||
// ws.send(arrayBuffer,true)
|
||||
return; //如果不需要处理最后一帧数据,直接return不做任何处理
|
||||
}
|
||||
// 二进制数据
|
||||
let arrayBuffer = pcmFrame.buffer;
|
||||
|
||||
emit("change", { arrayBuffer, close: false });
|
||||
//可以实现
|
||||
//WebSocket send(arrayBuffer) ...
|
||||
//WebRTC send(arrayBuffer) ...
|
||||
//XMLHttpRequest send(arrayBuffer) ...
|
||||
};
|
||||
|
||||
// 开始录音
|
||||
const recStart = () => {
|
||||
if (!rec) return console.error("未打开录音");
|
||||
rec.start();
|
||||
// 已开始录音
|
||||
};
|
||||
// 结束录音
|
||||
const recStop = () => {
|
||||
if (!rec) return console.error("未打开录音");
|
||||
rec.close(); // 关闭录音,释放录音资源
|
||||
rec = null;
|
||||
RealTimeSendTry([], 0, true); //最后一次发送
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
recOpen,
|
||||
recStart,
|
||||
recStop
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,142 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-input ref="inputRef" :style="{ width: '100%' }" placeholder="请选择图标" v-model="modelValue" @focus="onFocus">
|
||||
<template #suffix v-if="modelValue">
|
||||
<s-svg-icon v-if="type == 'svg'" :name="modelValue" :size="size" />
|
||||
<component v-else :is="modelValue" :size="size"></component>
|
||||
</template>
|
||||
<template #append>
|
||||
<span class="icon-reset" @click="reset">重置</span>
|
||||
</template>
|
||||
</a-input>
|
||||
<a-modal v-model:visible="visible" :unmount-on-close="true" width="70vw" :top="'50px'" :align-center="false" :footer="false">
|
||||
<template #title> 请选择图标 </template>
|
||||
<a-input
|
||||
:style="{
|
||||
width: '100%',
|
||||
marginBottom: '14px'
|
||||
}"
|
||||
placeholder="请输入关键词搜索"
|
||||
allow-clear
|
||||
v-model="searchName"
|
||||
>
|
||||
<template #prefix>
|
||||
<icon-search />
|
||||
</template>
|
||||
</a-input>
|
||||
<div class="over-scroll">
|
||||
<div class="icon-grid">
|
||||
<div v-for="item in iconList" :key="item" class="grid-item" @click="onIcon(item)">
|
||||
<s-svg-icon v-if="type == 'svg'" :name="item" :size="25" />
|
||||
<component v-else :is="item" :size="25"></component>
|
||||
<span>{{ item }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="iconList.length === 0" class="empty-row">
|
||||
<a-empty>
|
||||
<template #image>
|
||||
<icon-exclamation-circle-fill />
|
||||
</template>
|
||||
<span>未查询到您要找的图标</span>
|
||||
</a-empty>
|
||||
</div>
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import * as ArcoIcons from "@arco-design/web-vue/es/icon";
|
||||
interface Props {
|
||||
modelValue: string;
|
||||
type?: string;
|
||||
size?: number;
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
modelValue: "", // 图标名称-默认空字符串
|
||||
type: "arco", // 图标库类型,arco 或 svg
|
||||
size: 25 // 图标大小-默认25px
|
||||
});
|
||||
|
||||
const { modelValue, type, size } = toRefs(props);
|
||||
|
||||
const emit = defineEmits(["update:modelValue"]);
|
||||
|
||||
const visible = ref<boolean>(false);
|
||||
|
||||
const reset = () => {
|
||||
emit("update:modelValue", "");
|
||||
};
|
||||
|
||||
const onFocus = () => {
|
||||
searchName.value = "";
|
||||
visible.value = true;
|
||||
};
|
||||
|
||||
// svg模块-assets/svgs文件夹下的所有svg图标
|
||||
const SvgIconModules = import.meta.glob("@assets/svgs/*.svg");
|
||||
// 搜索关键字
|
||||
const searchName = ref<string>("");
|
||||
// icon列表
|
||||
const iconList = computed(() => {
|
||||
let icons: string[] = [];
|
||||
if (type.value === "arco") {
|
||||
if (!ArcoIcons) return [];
|
||||
for (let key in ArcoIcons) {
|
||||
if (key != "default") icons.push(key);
|
||||
}
|
||||
} else {
|
||||
if (!SvgIconModules) return [];
|
||||
for (let path in SvgIconModules) {
|
||||
icons.push(path.replace("/src/assets/svgs/", "").split(".svg")[0]);
|
||||
}
|
||||
}
|
||||
// 若按照关键字搜索,则返回搜索结果
|
||||
if (searchName.value) {
|
||||
return icons.filter(item => item.toLowerCase().includes(searchName.value.toLowerCase()));
|
||||
}
|
||||
// 若关键字为空则返回全部列表
|
||||
return icons;
|
||||
});
|
||||
|
||||
// 选择图标
|
||||
const onIcon = (name: string) => {
|
||||
visible.value = false;
|
||||
emit("update:modelValue", name);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.over-scroll {
|
||||
max-height: 70vh;
|
||||
overflow: auto;
|
||||
.icon-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, 150px); /* 自适应填充列,每列宽为 150px */
|
||||
justify-content: space-evenly; /* 水平均匀分配列之间的空隙 */
|
||||
overflow: hidden;
|
||||
.grid-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
row-gap: $margin;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100px;
|
||||
transition: transform 0.2s ease-in-out; /* 添加过渡效果 */
|
||||
&:hover {
|
||||
transform: scale(1.3); /* 鼠标移入时放大到 1.3 倍 */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.empty-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
}
|
||||
.icon-reset {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -1,19 +0,0 @@
|
||||
<template>
|
||||
<s-svg-icon v-if="props.svgIcon" :name="props.svgIcon" :size="25" />
|
||||
<component v-else-if="props.icon" :is="props.icon" :size="25"></component>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const props = defineProps({
|
||||
svgIcon: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,140 +0,0 @@
|
||||
<template>
|
||||
<span class="s-canvas" @click="changeCode">
|
||||
<canvas id="s-canvas" :width="contentWidth" :height="contentHeight"></canvas>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({ name: "s-verify-code" });
|
||||
// 通过defineProps接收父组件的值
|
||||
const props = defineProps({
|
||||
identifyCodes: {
|
||||
//验证码从该字段中抽取生成
|
||||
type: String,
|
||||
default: "1234567890"
|
||||
},
|
||||
fontSizeMin: {
|
||||
// 字体最小值
|
||||
type: Number,
|
||||
default: 25
|
||||
},
|
||||
fontSizeMax: {
|
||||
// 字体最大值
|
||||
type: Number,
|
||||
default: 35
|
||||
},
|
||||
backgroundColorMin: {
|
||||
// 验证码图片背景色最小值
|
||||
type: Number,
|
||||
default: 200
|
||||
},
|
||||
backgroundColorMax: {
|
||||
// 验证码图片背景色最大值
|
||||
type: Number,
|
||||
default: 220
|
||||
},
|
||||
dotColorMin: {
|
||||
// 背景干扰点最小值
|
||||
type: Number,
|
||||
default: 60
|
||||
},
|
||||
dotColorMax: {
|
||||
// 背景干扰点最大值
|
||||
type: Number,
|
||||
default: 120
|
||||
},
|
||||
contentWidth: {
|
||||
//容器宽度
|
||||
type: Number,
|
||||
default: 100
|
||||
},
|
||||
contentHeight: {
|
||||
//容器高度
|
||||
type: Number,
|
||||
default: 44
|
||||
}
|
||||
});
|
||||
const emit = defineEmits(["verifyCodeChange"]);
|
||||
const identifyCode = ref("");
|
||||
watch(identifyCode, () => {
|
||||
drawPic();
|
||||
});
|
||||
onMounted(() => {
|
||||
drawPic();
|
||||
makeCode(props.identifyCodes, 4);
|
||||
});
|
||||
// 生成一个随机数
|
||||
const randomNum = (min: any, max: any) => {
|
||||
return Math.floor(Math.random() * (max - min) + min);
|
||||
};
|
||||
// 生成一个随机的颜色
|
||||
const randomColor = (min: any, max: any) => {
|
||||
let r = randomNum(min, max);
|
||||
let g = randomNum(min, max);
|
||||
let b = randomNum(min, max);
|
||||
return "rgb(" + r + "," + g + "," + b + ")";
|
||||
};
|
||||
const drawPic = () => {
|
||||
let canvas = <HTMLCanvasElement>document.getElementById("s-canvas");
|
||||
if (!canvas) return;
|
||||
let ctx = canvas.getContext("2d");
|
||||
if (!ctx) return;
|
||||
ctx.textBaseline = "bottom";
|
||||
// 绘制背景
|
||||
ctx.fillStyle = randomColor(props.backgroundColorMin, props.backgroundColorMax);
|
||||
ctx.fillRect(0, 0, props.contentWidth, props.contentHeight);
|
||||
// 绘制文字
|
||||
for (let i = 0; i < identifyCode.value.length; i++) {
|
||||
drawText(ctx, identifyCode.value[i], i);
|
||||
}
|
||||
drawLine(ctx);
|
||||
drawDot(ctx);
|
||||
};
|
||||
const drawText = (ctx: any, txt: any, i: any) => {
|
||||
ctx.fillStyle = randomColor(50, 160); //随机生成字体颜色
|
||||
ctx.font = randomNum(props.fontSizeMin, props.fontSizeMax) + "px SimHei"; //随机生成字体大小
|
||||
let x = (i + 1) * (props.contentWidth / (identifyCode.value.length + 1)); // x轴
|
||||
let y = randomNum(props.fontSizeMax, props.contentHeight); // y轴
|
||||
let deg = randomNum(-30, 30);
|
||||
// 修改坐标原点和旋转角度
|
||||
ctx.translate(x, y);
|
||||
ctx.rotate((deg * Math.PI) / 180);
|
||||
ctx.fillText(txt, 0, 0);
|
||||
// 恢复坐标原点和旋转角度
|
||||
ctx.rotate((-deg * Math.PI) / 180);
|
||||
ctx.translate(-x, -y);
|
||||
};
|
||||
const drawLine = (ctx: any) => {
|
||||
// 绘制干扰线
|
||||
for (let i = 0; i < 4; i++) {
|
||||
ctx.strokeStyle = randomColor(100, 200);
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(randomNum(0, props.contentWidth), randomNum(0, props.contentHeight));
|
||||
ctx.lineTo(randomNum(0, props.contentWidth), randomNum(0, props.contentHeight));
|
||||
ctx.stroke();
|
||||
}
|
||||
};
|
||||
const drawDot = (ctx: any) => {
|
||||
// 绘制干扰点
|
||||
for (let i = 0; i < 30; i++) {
|
||||
ctx.fillStyle = randomColor(0, 255);
|
||||
ctx.beginPath();
|
||||
ctx.arc(randomNum(0, props.contentWidth), randomNum(0, props.contentHeight), 1, 0, 2 * Math.PI);
|
||||
ctx.fill();
|
||||
}
|
||||
};
|
||||
/*切换验证码start*/
|
||||
const changeCode = () => {
|
||||
identifyCode.value = "";
|
||||
makeCode(props.identifyCodes, 4);
|
||||
};
|
||||
const makeCode = (e: any, n: any) => {
|
||||
for (let i = 0; i < n; i++) {
|
||||
identifyCode.value += e[randomNum(0, e.length)];
|
||||
}
|
||||
emit("verifyCodeChange", identifyCode.value);
|
||||
};
|
||||
/*切换验证码end*/
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
declare module "virtual:svg-icons-register" {
|
||||
const content: any;
|
||||
export default content;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<a-card title="简介">
|
||||
<div>
|
||||
<p>SnowAdmin 一款基于 Vue、TypeScript、Vite5、Pinia、arco.design开源的后台管理框架,使用目前最新技术栈开发。</p>
|
||||
<p>融合了全新的UI框架,高度可自定义的主题功能使得用户可以根据自身需求轻松定制界面。</p>
|
||||
<p>代码全注释,可提供参考和学习。</p>
|
||||
</div>
|
||||
</a-card>
|
||||
<a-card class="margin-top" title="项目信息">
|
||||
<a-descriptions :column="2" bordered>
|
||||
<a-descriptions-item v-for="item of projectInfo" :key="item.label" :label="item.label">
|
||||
<a-link :href="item.value" v-if="item.link" target="_blank">{{ item.label }}</a-link>
|
||||
<span v-else>{{ item.value }}</span>
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-card>
|
||||
<a-card class="margin-top" title="生产环境依赖">
|
||||
<a-descriptions :data="dependencies" bordered :column="2" />
|
||||
</a-card>
|
||||
<a-card class="margin-top" title="开发环境依赖">
|
||||
<a-descriptions :data="devDependencies" bordered :column="2" />
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import packageJson from "../../../package.json";
|
||||
const projectInfo: any = [
|
||||
{
|
||||
label: "版本号",
|
||||
link: false,
|
||||
value: packageJson.version
|
||||
},
|
||||
{
|
||||
label: "发布时间",
|
||||
link: false,
|
||||
value: "2024-06-18"
|
||||
},
|
||||
{
|
||||
label: "GitHub",
|
||||
link: true,
|
||||
value: "https://github.com/WangFan-io/SnowAdmin"
|
||||
},
|
||||
{
|
||||
label: "Gitee",
|
||||
link: true,
|
||||
value: "https://gitee.com/wang_fan_w/SnowAdmin"
|
||||
},
|
||||
{
|
||||
label: "文档地址",
|
||||
link: true,
|
||||
value: "http://115.190.79.132:81/"
|
||||
},
|
||||
{
|
||||
label: "预览地址",
|
||||
link: true,
|
||||
value: "http://115.190.79.132/#/login"
|
||||
}
|
||||
];
|
||||
|
||||
const dependencies = ref<any>([]);
|
||||
const devDependencies = ref<any>([]);
|
||||
|
||||
const init = () => {
|
||||
dependencies.value.length = 0;
|
||||
devDependencies.value.length = 0;
|
||||
Object.entries(packageJson.dependencies).forEach(item => {
|
||||
dependencies.value.push({ label: item[0], value: item[1] });
|
||||
});
|
||||
Object.entries(packageJson.devDependencies).forEach(item => {
|
||||
devDependencies.value.push({ label: item[0], value: item[1] });
|
||||
});
|
||||
};
|
||||
init();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.margin-top {
|
||||
margin-top: $margin;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="doc-container">
|
||||
<div class="card">
|
||||
<h2>项目文档</h2>
|
||||
<div class="divider"></div>
|
||||
<p>
|
||||
仓库地址:
|
||||
<a href="https://github.com/v03413/BEpusdt" target="_blank" class="link"> https://github.com/v03413/BEpusdt </a>
|
||||
</p>
|
||||
<p style="margin-top: 12px">
|
||||
API对接:
|
||||
<a href="https://github.com/v03413/BEpusdt/blob/main/docs/api/api.md" target="_blank" class="link">
|
||||
https://github.com/v03413/BEpusdt/blob/main/docs/api/api.md
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.doc-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #fff;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0 0 10px 0;
|
||||
font-size: 18px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.divider {
|
||||
height: 1px;
|
||||
background-color: #dcdfe6;
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.link {
|
||||
color: #409eff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.link:hover {
|
||||
color: #66b1ff;
|
||||
}
|
||||
</style>
|
||||
@@ -1,107 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="15">
|
||||
<div class="code-box">
|
||||
<a-card v-for="item in codeList" :key="item.id" :title="item.docs" :style="{ width: '400px' }" hoverable>
|
||||
<div class="card-content">
|
||||
<s-barcode-draw :tag="item.tag" :text="item.text" :options="item.options" />
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="9">
|
||||
<a-scrollbar style="height: 625px; overflow: auto">
|
||||
<s-code-view :code-json="codeJson" style="width: 100%" />
|
||||
</a-scrollbar>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const codeList = ref([
|
||||
{
|
||||
id: 1,
|
||||
tag: "svg",
|
||||
text: "SnowAdmin",
|
||||
docs: "CODE128-默认条形码",
|
||||
options: {
|
||||
format: "CODE128",
|
||||
height: 100
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
tag: "svg",
|
||||
text: "SnowAdmin",
|
||||
docs: "自定义高度和颜色",
|
||||
options: {
|
||||
format: "CODE128",
|
||||
height: 50,
|
||||
background: "#f7f8fa",
|
||||
lineColor: "#2962ff"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
tag: "svg",
|
||||
text: "SnowAdmin",
|
||||
docs: "设置字体和倾斜",
|
||||
options: {
|
||||
format: "CODE128",
|
||||
height: 100,
|
||||
font: "fantasy",
|
||||
fontOptions: "italic"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
tag: "svg",
|
||||
text: "SnowAdmin",
|
||||
docs: "CODE39-商品条形码",
|
||||
options: {
|
||||
format: "CODE39",
|
||||
height: 100
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
tag: "svg",
|
||||
text: "6971318501227",
|
||||
docs: "EAN13-商品条形码",
|
||||
options: {
|
||||
format: "EAN13",
|
||||
height: 100
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
tag: "svg",
|
||||
text: "123456789999",
|
||||
docs: "UPC-商品条形码",
|
||||
options: {
|
||||
format: "UPC",
|
||||
height: 100
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
const codeJson = computed(() => JSON.stringify(codeList.value, null, "\t"));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.code-box {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: $margin;
|
||||
.card-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 120px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,21 +0,0 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<s-fold-page>
|
||||
<template #sider>
|
||||
<div>左侧</div>
|
||||
</template>
|
||||
<template #content>
|
||||
<div>右侧</div>
|
||||
</template>
|
||||
</s-fold-page>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
height: 100%;
|
||||
border: 1px solid $color-border-2;
|
||||
}
|
||||
</style>
|
||||
@@ -1,111 +0,0 @@
|
||||
<template>
|
||||
<a-space direction="vertical" fill size="medium">
|
||||
<a-card title="头部工具栏">
|
||||
<s-layout-tools>
|
||||
<template #left>
|
||||
<a-button type="primary">
|
||||
<template #icon>
|
||||
<icon-plus />
|
||||
</template>
|
||||
新增
|
||||
</a-button>
|
||||
<a-button type="primary" status="danger">
|
||||
<template #icon>
|
||||
<icon-delete />
|
||||
</template>
|
||||
删除
|
||||
</a-button>
|
||||
</template>
|
||||
<template #right>
|
||||
<a-input-search :style="{ width: '200px' }" placeholder="请输入关键字" search-button />
|
||||
<a-button type="primary" status="success">
|
||||
<template #icon>
|
||||
<icon-download />
|
||||
</template>
|
||||
</a-button>
|
||||
<a-button type="primary">
|
||||
<template #icon>
|
||||
<icon-refresh />
|
||||
</template>
|
||||
</a-button>
|
||||
</template>
|
||||
</s-layout-tools>
|
||||
</a-card>
|
||||
<a-card title="搜索栏布局">
|
||||
<s-layout-search @search="onSearch" @reset="onReset">
|
||||
<template #form>
|
||||
<a-grid-item>
|
||||
<div class="row-center-gap">
|
||||
<span class="text-nowrap">手机号</span>
|
||||
<a-input v-model="form.phone" placeholder="请输入手机号" allow-clear />
|
||||
</div>
|
||||
</a-grid-item>
|
||||
<a-grid-item>
|
||||
<div class="row-center-gap">
|
||||
<span class="text-nowrap">邮箱</span>
|
||||
<a-input v-model="form.email" placeholder="请输入邮箱" allow-clear />
|
||||
</div>
|
||||
</a-grid-item>
|
||||
<a-grid-item>
|
||||
<div class="row-center-gap">
|
||||
<span class="text-nowrap">状态</span>
|
||||
<a-input style="width: 100%" v-model="form.name" placeholder="请输入状态" allow-clear />
|
||||
</div>
|
||||
</a-grid-item>
|
||||
<a-grid-item>
|
||||
<div class="row-center-gap">
|
||||
<span class="text-nowrap">类型</span>
|
||||
<a-input style="width: 100%" v-model="form.name" placeholder="请输入类型" allow-clear />
|
||||
</div>
|
||||
</a-grid-item>
|
||||
<a-grid-item>
|
||||
<div class="row-center-gap">
|
||||
<span class="text-nowrap">机构</span>
|
||||
<a-input style="width: 100%" v-model="form.name" placeholder="请输入机构" allow-clear />
|
||||
</div>
|
||||
</a-grid-item>
|
||||
</template>
|
||||
</s-layout-search>
|
||||
</a-card>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const form = ref<any>({
|
||||
name: "",
|
||||
age: null,
|
||||
select: null,
|
||||
adderss: "",
|
||||
hobby: null,
|
||||
date: "",
|
||||
time: "",
|
||||
gender: null,
|
||||
score: null,
|
||||
rate: null,
|
||||
state: null,
|
||||
multiple: null,
|
||||
treeSelect: null
|
||||
});
|
||||
const onSearch = () => {
|
||||
arcoMessage("success", "搜索");
|
||||
};
|
||||
const onReset = () => {
|
||||
arcoMessage("success", "重置");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tools-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.row-center-gap {
|
||||
display: flex;
|
||||
column-gap: 12px;
|
||||
align-items: center;
|
||||
.text-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,46 +0,0 @@
|
||||
<template>
|
||||
<s-full-page>
|
||||
<s-fold-page v-model:width="siderWidth">
|
||||
<template #sider>
|
||||
<a-menu :style="{ width: '100%', height: '100%' }" :selected-keys="[currentMenu]" @menu-item-click="onMenuItem">
|
||||
<a-menu-item v-for="item in menuData" :key="item.id">{{ item.title }}</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<template #content>
|
||||
<div class="content" v-if="currentMenu == 1">
|
||||
<head-page />
|
||||
</div>
|
||||
<div class="content" v-if="currentMenu == 2">
|
||||
<fold-page />
|
||||
</div>
|
||||
</template>
|
||||
</s-fold-page>
|
||||
</s-full-page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import FoldPage from "@/views/component/common-layouts/fold-page.vue";
|
||||
import HeadPage from "@/views/component/common-layouts/head-page.vue";
|
||||
interface MenuData {
|
||||
id: number;
|
||||
title: string;
|
||||
}
|
||||
const siderWidth = ref<number>(250);
|
||||
const menuData = ref<MenuData[]>([
|
||||
{ id: 1, title: "头部布局" },
|
||||
{ id: 2, title: "可折叠布局" }
|
||||
]);
|
||||
const currentMenu = ref<number>(1);
|
||||
const onMenuItem = (e: number) => {
|
||||
currentMenu.value = e;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
height: 100%;
|
||||
}
|
||||
:deep(.arco-menu-vertical .arco-menu-inner) {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,123 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner draggable-page">
|
||||
<a-row :gutter="16">
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="14" :xl="12" :xxl="12">
|
||||
<a-space direction="vertical">
|
||||
<div class="draggable-container">
|
||||
<div class="title">Favorites</div>
|
||||
<draggable
|
||||
:list="list"
|
||||
class="draggable-box"
|
||||
chosen-class="chosenClass"
|
||||
animation="300"
|
||||
item-key="value"
|
||||
@start="onStart"
|
||||
@end="onEnd"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
<div class="draggable-list" :class="!animated && 'animated-fade-up-' + element.value">
|
||||
<div class="draggable-inner">
|
||||
<s-svg-icon :name="element.svg" :size="30" class="svg-box" />
|
||||
<div>{{ element.label }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</draggable>
|
||||
</div>
|
||||
<div>
|
||||
采用开源拖拽库:
|
||||
<a-link href="https://github.com/SortableJS/vue.draggable.next" target="_blank"> vue.draggable </a-link>
|
||||
</div>
|
||||
</a-space>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="10" :xl="12" :xxl="12">
|
||||
<a-scrollbar style="height: 396px; overflow: auto" outer-class="scrollbar">
|
||||
<s-code-view :code-json="codeJson" style="width: 500px" />
|
||||
</a-scrollbar>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import draggable from "vuedraggable";
|
||||
const list = ref([
|
||||
{ value: 0, label: "bilibili", svg: "bilibili" },
|
||||
{ value: 1, label: "微信", svg: "wechat" },
|
||||
{ value: 2, label: "QQ音乐", svg: "QQ音乐" },
|
||||
{ value: 3, label: "百度", svg: "百度" },
|
||||
{ value: 4, label: "优酷", svg: "优酷" },
|
||||
{ value: 5, label: "网易云音乐", svg: "网易云音乐" },
|
||||
{ value: 6, label: "抖音", svg: "抖音" },
|
||||
{ value: 7, label: "西瓜视频", svg: "西瓜视频" },
|
||||
{ value: 8, label: "微博", svg: "微博" },
|
||||
{ value: 9, label: "豆瓣", svg: "豆瓣" },
|
||||
{ value: 10, label: "github", svg: "github" },
|
||||
{ value: 11, label: "gitee", svg: "gitee" }
|
||||
]);
|
||||
const codeJson = computed(() => JSON.stringify({ list: list.value }, null, "\t"));
|
||||
|
||||
const animated = ref(false);
|
||||
|
||||
// 拖拽开始
|
||||
const onStart = () => {
|
||||
animated.value = true;
|
||||
};
|
||||
|
||||
// 拖拽结束
|
||||
const onEnd = () => {
|
||||
console.log("拖拽结束");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.draggable-page {
|
||||
display: flex;
|
||||
column-gap: $padding;
|
||||
}
|
||||
.draggable-container {
|
||||
padding: $padding;
|
||||
background: $color-bg-1;
|
||||
border-radius: $radius-box-5;
|
||||
box-shadow: inset 0 0 0 1px $color-border-2;
|
||||
.title {
|
||||
margin-bottom: $padding;
|
||||
font-weight: bold;
|
||||
}
|
||||
.draggable-box {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: $padding $padding;
|
||||
width: 448px;
|
||||
.draggable-list {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: $color-fill-1;
|
||||
border: 1px solid $color-border-2;
|
||||
border-radius: $radius-box-5;
|
||||
.draggable-inner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
.svg-box {
|
||||
margin-bottom: $margin;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.chosenClass {
|
||||
color: $color-primary;
|
||||
}
|
||||
}
|
||||
.scrollbar {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,57 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-space direction="vertical">
|
||||
<div>
|
||||
<div style="border: 1px solid #cccccc">
|
||||
<Toolbar style="border-bottom: 1px solid #cccccc" :editor="editorRef" :default-config="toolbarConfig" :mode="mode" />
|
||||
<Editor
|
||||
style="height: 500px; overflow-y: hidden"
|
||||
v-model="valueHtml"
|
||||
:default-config="editorConfig"
|
||||
:mode="mode"
|
||||
@on-created="handleCreated"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
采用开源富文本编辑器:<a-link href="https://github.com/wangeditor-team/wangEditor" target="_blank">wangEditor</a-link>
|
||||
</div>
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import "@wangeditor/editor/dist/css/style.css"; // 引入 css
|
||||
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
|
||||
|
||||
// 编辑器实例,必须用 shallowRef
|
||||
const editorRef = shallowRef();
|
||||
|
||||
// 内容 HTML
|
||||
const valueHtml = ref("<p>hello</p>");
|
||||
|
||||
// 模拟 ajax 异步获取内容
|
||||
onMounted(() => {
|
||||
setTimeout(() => {
|
||||
valueHtml.value = "<p>模拟ajax异步获取的内容</p>";
|
||||
}, 1500);
|
||||
});
|
||||
|
||||
const toolbarConfig = {};
|
||||
const editorConfig = { placeholder: "请输入内容..." };
|
||||
|
||||
// 组件销毁时,也及时销毁编辑器
|
||||
onBeforeUnmount(() => {
|
||||
const editor = editorRef.value;
|
||||
if (editor == null) return;
|
||||
editor.destroy();
|
||||
});
|
||||
const mode = "default";
|
||||
const handleCreated = (editor: any) => {
|
||||
editorRef.value = editor; // 记录 editor 实例,重要!
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,100 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-card title="浏览器检测-通过设备浏览器信息获取浏览器指纹">
|
||||
<a-descriptions :column="1" :data="browserInfo" bordered />
|
||||
</a-card>
|
||||
<br />
|
||||
<a-card title="移动设备">
|
||||
<a-descriptions :column="1" :data="mobileFinger" bordered />
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Fingerprint2 from "fingerprintjs2";
|
||||
|
||||
interface IComponents {
|
||||
key: string;
|
||||
value: any;
|
||||
}
|
||||
const browserInfo = ref<any>([]);
|
||||
const getBrowserInfo = () => {
|
||||
// 浏览器指纹
|
||||
Fingerprint2.get((components: any) => {
|
||||
// 参数只有回调函数时,默认浏览器指纹依据所有配置信息进行生成
|
||||
const values = components.map((component: any) => component.value); // 配置的值的数组
|
||||
const murmur = Fingerprint2.x64hash128(values.join(""), 31).toUpperCase(); // 生成浏览器指纹
|
||||
let arr = [];
|
||||
components.forEach((el: IComponents) => {
|
||||
switch (el.key) {
|
||||
case "userAgent":
|
||||
arr.push({ label: "用户代理(User-Agent)", value: el.value });
|
||||
break;
|
||||
case "language":
|
||||
arr.push({ label: "语言(Language)", value: el.value });
|
||||
break;
|
||||
case "colorDepth":
|
||||
arr.push({ label: "屏幕颜色深度(ColorDepth)", value: el.value });
|
||||
break;
|
||||
case "deviceMemory":
|
||||
arr.push({ label: "设备内存(DviceMemory)", value: `此设备至少拥有 ${el.value}GiB 的 RAM` });
|
||||
break;
|
||||
case "hardwareConcurrency":
|
||||
arr.push({ label: "硬件并发(HardwareConcurrency)", value: el.value });
|
||||
break;
|
||||
case "screenResolution":
|
||||
arr.push({ label: "屏幕分辨率(ScreenResolution)", value: el.value.join("*") });
|
||||
break;
|
||||
case "availableScreenResolution":
|
||||
arr.push({ label: "可用屏幕分辨率(AvailableScreenResolution)", value: el.value.join("*") });
|
||||
break;
|
||||
case "timezoneOffset":
|
||||
arr.push({ label: "到UTC的时区差异-分钟(TimezoneOffset)", value: el.value });
|
||||
break;
|
||||
case "timezone":
|
||||
arr.push({ label: "时区(Timezone)", value: el.value });
|
||||
break;
|
||||
case "sessionStorage":
|
||||
arr.push({ label: "会话存储支持(SessionStorage)", value: el.value ? "是(true)" : "否(false)" });
|
||||
break;
|
||||
case "localStorage":
|
||||
arr.push({ label: "本地存储支持(LocalStorage)", value: el.value ? "是(true)" : "否(false)" });
|
||||
break;
|
||||
case "indexedDb":
|
||||
arr.push({ label: "本地数据库支持(IndexedDb)", value: el.value ? "是(true)" : "否(false)" });
|
||||
break;
|
||||
case "openDatabase":
|
||||
arr.push({ label: "是否支持Web SQL(OpenDatabase)", value: el.value ? "是(true)" : "否(false)" });
|
||||
break;
|
||||
case "platform":
|
||||
arr.push({ label: "系统平台(Platform)", value: el.value });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
arr.push({ label: "浏览器指纹(BrowserFingerprint)", value: murmur });
|
||||
browserInfo.value = arr;
|
||||
});
|
||||
};
|
||||
|
||||
const mobileFinger = ref<any>([]);
|
||||
const getMobileFinger = () => {
|
||||
Fingerprint2.get((components: any) => {
|
||||
// 由于Fingerprint2是通过浏览器设备信息生成的浏览器指纹,
|
||||
// 大多数用户不会修改手机配置,同型号产品可能会出现指纹相同,这里需要加上唯一标识
|
||||
components.push({
|
||||
key: "ip",
|
||||
value: "192.168.1.1" //通过接口获取的到ip
|
||||
});
|
||||
const values = components.map((component: any) => component.value); // 配置的值的数组
|
||||
const murmur = Fingerprint2.x64hash128(values.join(""), 31).toUpperCase(); // 生成浏览器指纹
|
||||
mobileFinger.value.push({ label: "移动设备指纹(需要唯一标识)", value: murmur });
|
||||
});
|
||||
};
|
||||
|
||||
getBrowserInfo();
|
||||
getMobileFinger();
|
||||
</script>
|
||||
@@ -1,35 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-row class="grid-demo" :gutter="24">
|
||||
<a-col :span="12">
|
||||
<a-card title="图标选择器" :style="{ width: '100%' }">
|
||||
<s-select-icon type="arco" v-model:="iconName" />
|
||||
<div class="target-title">当前选择的图标:</div>
|
||||
<component v-if="iconName" :is="iconName" :size="50"></component>
|
||||
<a-empty v-else />
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-card title="SVG选择器" :style="{ width: '100%' }">
|
||||
<s-select-icon type="svg" v-model:="svgName" />
|
||||
<div class="target-title">当前选择的图标:</div>
|
||||
<s-svg-icon v-if="svgName" :name="svgName" :size="50" />
|
||||
<a-empty v-else />
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const iconName = ref<string>("icon-menu");
|
||||
const svgName = ref<string>("home");
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.target-title {
|
||||
margin: $margin 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,186 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-space direction="vertical" :size="10">
|
||||
<a-typography-text id="newbie-title-1"> SnowAdmin </a-typography-text>
|
||||
<a-typography-text id="newbie-title-2"> 清晰的项目架构:结构清晰,优雅易懂。 </a-typography-text>
|
||||
<a-typography-text id="newbie-title-3"> 严格的代码规范:严格遵循开发设计规范,保证代码的规范性。 </a-typography-text>
|
||||
<a-typography-text id="newbie-title-4"> 内置国际化方案:轻松实现多语言支持。</a-typography-text>
|
||||
<a-typography-text id="newbie-title-5"> 清新丰富的主题配置:内置多样的主题配置。</a-typography-text>
|
||||
</a-space>
|
||||
<div class="margin-top">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="openNewbie">打开指引</a-button>
|
||||
<a-button type="primary" @click="openSystemNewbie">系统指引</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="margin-top">
|
||||
新手指引,基于<a-link href="https://driver.employleague.cn/" target="_blank">driver.js</a-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { driver } from "driver.js";
|
||||
import "driver.js/dist/driver.css";
|
||||
|
||||
const openNewbie = () => {
|
||||
const driverObj = driver({
|
||||
allowClose: true,
|
||||
doneBtnText: "结束",
|
||||
nextBtnText: "下一步",
|
||||
prevBtnText: "上一步",
|
||||
steps: [
|
||||
{
|
||||
element: "#newbie-title-1",
|
||||
popover: {
|
||||
title: "SnowAdmin",
|
||||
description: "清新优雅的中后台管理模板",
|
||||
side: "right"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#newbie-title-2",
|
||||
popover: {
|
||||
title: "清晰的项目架构",
|
||||
description: "结构清晰,优雅易懂",
|
||||
side: "right"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#newbie-title-3",
|
||||
popover: {
|
||||
title: "严格的代码规范",
|
||||
description: "严格遵循开发设计规范,保证代码的规范性",
|
||||
side: "right"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#newbie-title-4",
|
||||
popover: {
|
||||
title: "内置国际化方案",
|
||||
description: "轻松实现多语言支持",
|
||||
side: "right"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#newbie-title-5",
|
||||
popover: {
|
||||
title: "清新丰富的主题配置",
|
||||
description: "内置多样的主题配置",
|
||||
side: "right"
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
driverObj.drive();
|
||||
};
|
||||
|
||||
let systemList = ref<any>([
|
||||
{
|
||||
element: "#system-collapsed",
|
||||
popover: {
|
||||
title: "折叠菜单",
|
||||
description: "菜单的展开收起",
|
||||
side: "right"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#system-breadcrumb",
|
||||
popover: {
|
||||
title: "面包屑",
|
||||
description: "页面路径",
|
||||
side: "right"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#system-language",
|
||||
popover: {
|
||||
title: "国际化",
|
||||
description: "切换系统语言",
|
||||
side: "left"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#system-dark",
|
||||
popover: {
|
||||
title: "黑暗模式",
|
||||
description: "切换黑暗和白天模式",
|
||||
side: "left"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#system-notice",
|
||||
popover: {
|
||||
title: "通知",
|
||||
description: "系统通知信息",
|
||||
side: "left"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#system-fullscreen",
|
||||
popover: {
|
||||
title: "全屏",
|
||||
description: "系统全屏显示",
|
||||
side: "left"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#system-settings",
|
||||
popover: {
|
||||
title: "系统设置",
|
||||
description: "修改系统的渲染配置",
|
||||
side: "left"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#system-theme",
|
||||
popover: {
|
||||
title: "主题设置",
|
||||
description: "修改系统的主题配置",
|
||||
side: "left"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#system-my-setting",
|
||||
popover: {
|
||||
title: "我的",
|
||||
description: "个人中心设置",
|
||||
side: "left"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#system-tabs-setting",
|
||||
popover: {
|
||||
title: "Tabs栏功能",
|
||||
description: "Tabs栏的关闭、刷新等功能",
|
||||
side: "left"
|
||||
}
|
||||
},
|
||||
{
|
||||
element: "#system-tabs-refresh",
|
||||
popover: {
|
||||
title: "页面刷新",
|
||||
description: "刷新当前窗口页面",
|
||||
side: "left"
|
||||
}
|
||||
}
|
||||
]);
|
||||
const openSystemNewbie = () => {
|
||||
const driverObj = driver({
|
||||
allowClose: true,
|
||||
doneBtnText: "结束",
|
||||
nextBtnText: "下一步",
|
||||
prevBtnText: "上一步",
|
||||
steps: systemList.value
|
||||
});
|
||||
driverObj.drive();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.margin-top {
|
||||
margin-top: $padding;
|
||||
}
|
||||
</style>
|
||||
@@ -1,77 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-card title="拼音转换" hoverable>
|
||||
<a-space direction="vertical" size="large" fill>
|
||||
<a-textarea v-model="myText" placeholder="请输入内容" allow-clear />
|
||||
<s-pinyin-pro
|
||||
v-if="myText"
|
||||
:text="myText"
|
||||
:options="{
|
||||
resultClass: 'my-text-item'
|
||||
}"
|
||||
/>
|
||||
<a-empty v-else />
|
||||
</a-space>
|
||||
</a-card>
|
||||
<br />
|
||||
<a-card title="默认字符拼音-自定义字体大小" hoverable>
|
||||
<s-pinyin-pro
|
||||
:text="text"
|
||||
:options="{
|
||||
resultClass: 'my-text-item'
|
||||
}"
|
||||
/>
|
||||
</a-card>
|
||||
<br />
|
||||
<a-card title="字符拼音-自定义颜色" hoverable>
|
||||
<s-pinyin-pro
|
||||
:text="text"
|
||||
:options="{
|
||||
resultClass: 'my-text-item',
|
||||
chineseClass: 'my-chinese-item',
|
||||
pinyinClass: 'my-pinyin-item'
|
||||
}"
|
||||
/>
|
||||
</a-card>
|
||||
<br />
|
||||
<a-card title="字符拼音-指定文字颜色" hoverable>
|
||||
<s-pinyin-pro
|
||||
:text="text"
|
||||
:options="{
|
||||
resultClass: 'my-text-item',
|
||||
customClassMap: {
|
||||
'red-item': ['节', '气'],
|
||||
'blue-item': ['科', '学']
|
||||
}
|
||||
}"
|
||||
/>
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
let text =
|
||||
"二十四节气是我国独创的传统历法,也是我国历史长河中不可多得的瑰宝,上至风雨雷电,下至芸芸众生,包罗万象。在长期的生产实践中,我国劳动人民通过对太阳、天象的不断观察,开创出了节气这种独特的历法。经过不断的探索、分析和总结,节气的划分逐渐变得科学和丰富,到距今两千多年的秦汉时期,二十四节气已经形成了完整的体系,并一直沿用至今。";
|
||||
const myText = ref("");
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.my-text-item) {
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
:deep(.my-chinese-item) {
|
||||
color: $color-primary;
|
||||
}
|
||||
:deep(.my-pinyin-item) {
|
||||
color: $color-danger;
|
||||
}
|
||||
:deep(.red-item) {
|
||||
color: $color-danger;
|
||||
}
|
||||
:deep(.blue-item) {
|
||||
color: $color-primary;
|
||||
}
|
||||
</style>
|
||||
@@ -1,69 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-space direction="vertical">
|
||||
<div class="player-box">
|
||||
<div id="mse"></div>
|
||||
</div>
|
||||
<div>采用开源视频播放器:<a-link href="https://h5player.bytedance.com/" target="_blank">西瓜播放器</a-link></div>
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Player from "xgplayer";
|
||||
import "xgplayer/dist/index.min.css";
|
||||
|
||||
onMounted(() => {
|
||||
new Player({
|
||||
id: "mse",
|
||||
autoplay: true,
|
||||
volume: 0.3,
|
||||
lang: "zh",
|
||||
url: "//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-360p.mp4",
|
||||
poster: "//lf3-static.bytednsdoc.com/obj/eden-cn/nupenuvpxnuvo/xgplayer_doc/poster.jpg",
|
||||
playsinline: true,
|
||||
thumbnail: {
|
||||
pic_num: 44,
|
||||
width: 160,
|
||||
height: 90,
|
||||
col: 10,
|
||||
row: 10,
|
||||
urls: ["//lf3-static.bytednsdoc.com/obj/eden-cn/nupenuvpxnuvo/xgplayer_doc/xgplayer-demo-thumbnail.jpg"]
|
||||
},
|
||||
danmu: {
|
||||
comments: [
|
||||
{
|
||||
duration: 15000,
|
||||
id: "1",
|
||||
start: 3000,
|
||||
txt: "长弹幕长弹幕长弹幕长弹幕长弹幕",
|
||||
style: {
|
||||
//弹幕自定义样式
|
||||
color: "#ff9500",
|
||||
fontSize: "20px",
|
||||
border: "solid 1px #ff9500",
|
||||
borderRadius: "50px",
|
||||
padding: "5px 11px",
|
||||
backgroundColor: "rgba(255, 255, 255, 0.1)"
|
||||
}
|
||||
}
|
||||
],
|
||||
area: {
|
||||
start: 0,
|
||||
end: 1
|
||||
}
|
||||
},
|
||||
height: "100%",
|
||||
width: "100%"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.player-box {
|
||||
width: 600px;
|
||||
height: 400px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,71 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-space direction="vertical">
|
||||
<div style="margin-top: -40px">
|
||||
<a-typography id="myTypography">
|
||||
<a-typography-title :heading="2">ArcoDesign</a-typography-title>
|
||||
<a-typography-paragraph>
|
||||
The ArcoDesign component library defines a set of default particle variables, and a custom theme is to
|
||||
<a-typography-text mark>customize</a-typography-text> and
|
||||
<a-typography-text underline>overwrite</a-typography-text> this variable list.
|
||||
</a-typography-paragraph>
|
||||
<a-typography-paragraph blockquote>
|
||||
A design is a plan or specification for the construction of an object or system or for the implementation of an
|
||||
activity or process, or the result of that plan or specification in the form of a
|
||||
<a-typography-text code>prototype</a-typography-text>, <a-typography-text code>product</a-typography-text> or
|
||||
<a-typography-text code>process</a-typography-text>. The verb to design expresses the process of developing a
|
||||
design.
|
||||
</a-typography-paragraph>
|
||||
<a-typography-paragraph mark underline delete>
|
||||
A design is a plan or specification for the construction of an object or system or for the implementation of an
|
||||
activity or process.
|
||||
</a-typography-paragraph>
|
||||
<a-typography-paragraph>
|
||||
<ul>
|
||||
<li>
|
||||
Architectural blueprints
|
||||
<ul>
|
||||
<li>Architectural blueprints</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Engineering drawings</li>
|
||||
<li>Business processes</li>
|
||||
</ul>
|
||||
</a-typography-paragraph>
|
||||
<a-typography-paragraph>
|
||||
<ol>
|
||||
<li>Architectural blueprints</li>
|
||||
<li>Engineering drawings</li>
|
||||
<li>Business processes</li>
|
||||
</ol>
|
||||
</a-typography-paragraph>
|
||||
</a-typography>
|
||||
</div>
|
||||
<a-button type="primary" @click="onPrint">打印</a-button>
|
||||
<div>采用开源打印库:<a-link href="https://printjs.crabbly.com/" target="_blank">printjs</a-link></div>
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import print from "print-js";
|
||||
|
||||
const onPrint = () => {
|
||||
print({
|
||||
printable: "myTypography", // id节点
|
||||
type: "html", // 打印方式,这里选择html
|
||||
header: "", // 是否定义头部,这里选择不定义
|
||||
scanStyles: false, // 当设置为 false 时,库将不会处理应用于正在打印的 html 的样式,转而使用style自定义样式
|
||||
maxWidth: 9999, // 页面最大宽度
|
||||
targetStyles: ["*"]
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: $font-size-title-5;
|
||||
}
|
||||
</style>
|
||||
@@ -1,112 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<div class="code-box">
|
||||
<a-card v-for="item in codeList" :key="item.id" :title="item.docs" :style="{ width: '300px' }" hoverable>
|
||||
<div class="card-content">
|
||||
<s-qrcode-draw :tag="item.tag" :text="item.text" :options="item.options" />
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-scrollbar style="height: 410px; overflow: auto">
|
||||
<s-code-view :code-json="codeJson" style="width: 100%" />
|
||||
</a-scrollbar>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const codeList = ref([
|
||||
{
|
||||
id: 1,
|
||||
text: "https://gitee.com/wang_fan_w/SnowAdmin",
|
||||
docs: "img格式",
|
||||
tag: "img",
|
||||
options: {
|
||||
width: 100, // 二维码的宽度
|
||||
height: 100, // 二维码的高度
|
||||
color: {
|
||||
dark: "#000000", // 二维码的前景色(黑色)
|
||||
light: "#ffffff" // 二维码的背景色(白色)
|
||||
},
|
||||
margin: 4, // 边距,默认是 4
|
||||
scale: 4, // 模块大小,默认是 4
|
||||
errorCorrectionLevel: "H" // 错误修正级别:L (低), M (中), Q (较高), H (最高)
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: "https://gitee.com/wang_fan_w/SnowAdmin",
|
||||
docs: "自定义大小和颜色",
|
||||
tag: "img",
|
||||
options: {
|
||||
width: 80, // 二维码的宽度
|
||||
height: 80, // 二维码的高度
|
||||
color: {
|
||||
dark: "#2962ff", // 二维码的前景色(黑色)
|
||||
light: "#f7f8fa" // 二维码的背景色(白色)
|
||||
},
|
||||
margin: 4, // 边距,默认是 4
|
||||
scale: 4, // 模块大小,默认是 4
|
||||
errorCorrectionLevel: "H" // 错误修正级别:L (低), M (中), Q (较高), H (最高)
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
text: "https://gitee.com/wang_fan_w/SnowAdmin",
|
||||
docs: "canvas格式",
|
||||
tag: "canvas",
|
||||
options: {
|
||||
width: 100, // 二维码的宽度
|
||||
height: 100, // 二维码的高度
|
||||
color: {
|
||||
dark: "#000000", // 二维码的前景色(黑色)
|
||||
light: "#ffffff" // 二维码的背景色(白色)
|
||||
},
|
||||
margin: 4, // 边距,默认是 4
|
||||
scale: 4, // 模块大小,默认是 4
|
||||
errorCorrectionLevel: "H" // 错误修正级别:L (低), M (中), Q (较高), H (最高)
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
text: "https://gitee.com/wang_fan_w/SnowAdmin",
|
||||
docs: "高清晰度",
|
||||
tag: "img",
|
||||
options: {
|
||||
width: 100, // 二维码的宽度
|
||||
height: 100, // 二维码的高度
|
||||
color: {
|
||||
dark: "#000000", // 二维码的前景色(黑色)
|
||||
light: "#ffffff" // 二维码的背景色(白色)
|
||||
},
|
||||
margin: 4, // 边距,默认是 4
|
||||
scale: 4, // 模块大小,默认是 4
|
||||
quality: 1, // 质量,默认0.92
|
||||
errorCorrectionLevel: "H" // 错误修正级别:L (低), M (中), Q (较高), H (最高)
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
const codeJson = computed(() => JSON.stringify(codeList.value, null, "\t"));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.code-box {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: $margin;
|
||||
.card-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 120px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,162 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-space direction="vertical" fill>
|
||||
<a-alert>本地录音需要https或localhost安全环境,是否为安全环境:{{ isSecureEnvironment() }}</a-alert>
|
||||
<a-alert type="success"
|
||||
>基于<a-link href="https://github.com/xiangyuecn/Recorder" target="_blank">Recorder.js</a-link
|
||||
>,采用PCM实时帧回调的方式,用于流式语音传输</a-alert
|
||||
>
|
||||
<a-space direction="vertical" fill>
|
||||
<!-- 波形绘制区域 -->
|
||||
<div class="waveview-box">
|
||||
<s-recorder-pcm ref="RecorderPCM" @change="onChange" />
|
||||
</div>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="recOpen">打开录音权限</a-button>
|
||||
<a-button type="primary" @click="recStart">开始录音</a-button>
|
||||
<a-button @click="recStop">结束录音</a-button>
|
||||
<a-button @click="audioList.length = 0">清空列表</a-button>
|
||||
</a-space>
|
||||
</a-space>
|
||||
<audio ref="audioElement" controls v-if="audioList.length"></audio>
|
||||
<a-list v-if="audioList.length">
|
||||
<template #header>音频帧列表</template>
|
||||
<a-list-item v-for="(item, index) in audioList" :key="index">
|
||||
<a-space>
|
||||
<span v-if="!item.close">PCM音频实时帧 - {{ index }}</span>
|
||||
<span v-else>PCM完整音频</span>
|
||||
<a-button-group>
|
||||
<a-button @click="playAudio(item)">播放</a-button>
|
||||
</a-button-group>
|
||||
</a-space>
|
||||
</a-list-item>
|
||||
</a-list>
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { isSecureEnvironment } from "@/utils/index";
|
||||
|
||||
const RecorderPCM = ref();
|
||||
|
||||
const recOpen = () => {
|
||||
audioList.value.length = 0;
|
||||
RecorderPCM.value.recOpen();
|
||||
};
|
||||
|
||||
const recStart = () => {
|
||||
RecorderPCM.value.recStart();
|
||||
};
|
||||
|
||||
const recStop = () => {
|
||||
RecorderPCM.value.recStop();
|
||||
};
|
||||
|
||||
interface AudioInfo {
|
||||
arrayBuffer: ArrayBuffer;
|
||||
close: boolean;
|
||||
}
|
||||
|
||||
// 音频帧列表
|
||||
const audioList = ref<AudioInfo[]>([]);
|
||||
|
||||
// 音频帧实时回调
|
||||
const onChange = async (e: AudioInfo) => {
|
||||
if (!e.close) {
|
||||
audioList.value.push(e);
|
||||
} else {
|
||||
// 合并音频帧列表
|
||||
let complete = mergePcmChunks(audioList.value.map(item => item.arrayBuffer));
|
||||
audioList.value.push({ arrayBuffer: complete, close: true });
|
||||
}
|
||||
};
|
||||
|
||||
// 合并多个PCM分片
|
||||
const mergePcmChunks = (chunks: ArrayBuffer[]) => {
|
||||
// 计算总长度
|
||||
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);
|
||||
|
||||
// 创建新的ArrayBuffer
|
||||
const mergedBuffer = new ArrayBuffer(totalLength);
|
||||
const mergedView = new Uint8Array(mergedBuffer);
|
||||
|
||||
// 按顺序复制每个分片
|
||||
let offset = 0;
|
||||
chunks.forEach(chunk => {
|
||||
mergedView.set(new Uint8Array(chunk), offset);
|
||||
offset += chunk.byteLength;
|
||||
});
|
||||
|
||||
return mergedBuffer;
|
||||
};
|
||||
|
||||
const audioElement = ref<any>();
|
||||
const playAudio = (e: AudioInfo) => {
|
||||
const wavBuffer = pcmToWav(e.arrayBuffer);
|
||||
const audioBlob = new Blob([wavBuffer], { type: "audio/wav" });
|
||||
|
||||
// 为Blob创建URL对象
|
||||
const audioUrl = URL.createObjectURL(audioBlob);
|
||||
|
||||
// 设置audio元素的src
|
||||
audioElement.value.src = audioUrl;
|
||||
|
||||
// 开始播放
|
||||
audioElement.value.play();
|
||||
|
||||
// 播放结束后释放URL对象
|
||||
audioElement.value.onended = function () {
|
||||
URL.revokeObjectURL(audioUrl);
|
||||
};
|
||||
};
|
||||
|
||||
// PCM转WAV函数
|
||||
const pcmToWav = (pcmArrayBuffer: ArrayBuffer, sampleRate = 16000, numChannels = 1, bitDepth = 16) => {
|
||||
const buffer = new ArrayBuffer(44 + pcmArrayBuffer.byteLength);
|
||||
const view = new DataView(buffer);
|
||||
|
||||
// 写入WAV文件头
|
||||
writeString(view, 0, "RIFF");
|
||||
view.setUint32(4, 36 + pcmArrayBuffer.byteLength, true);
|
||||
writeString(view, 8, "WAVE");
|
||||
|
||||
// 写入fmt子块
|
||||
writeString(view, 12, "fmt ");
|
||||
view.setUint32(16, 16, true); // 子块大小
|
||||
view.setUint16(20, 1, true); // 音频格式(1表示PCM)
|
||||
view.setUint16(22, numChannels, true); // 声道数
|
||||
view.setUint32(24, sampleRate, true); // 采样率
|
||||
view.setUint32(28, sampleRate * numChannels * (bitDepth / 8), true); // 字节率
|
||||
view.setUint16(32, numChannels * (bitDepth / 8), true); // 块对齐
|
||||
view.setUint16(34, bitDepth, true); // 位深度
|
||||
|
||||
// 写入data子块
|
||||
writeString(view, 36, "data");
|
||||
view.setUint32(40, pcmArrayBuffer.byteLength, true);
|
||||
|
||||
// 写入PCM数据
|
||||
const pcmData = new Uint8Array(pcmArrayBuffer);
|
||||
const resultData = new Uint8Array(buffer);
|
||||
resultData.set(pcmData, 44);
|
||||
|
||||
return buffer;
|
||||
};
|
||||
|
||||
const writeString = (view: DataView, offset: number, string: string) => {
|
||||
for (let i = 0; i < string.length; i++) {
|
||||
view.setUint8(offset + i, string.charCodeAt(i));
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.waveview-box {
|
||||
display: inline-block;
|
||||
width: 400px;
|
||||
height: 100px;
|
||||
border: 1px solid $color-border-2;
|
||||
}
|
||||
</style>
|
||||
@@ -1,47 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner" style="padding: 100px">
|
||||
<div class="my-avatar">
|
||||
<a-avatar :size="100">
|
||||
<img alt="avatar" :src="myImage" />
|
||||
</a-avatar>
|
||||
<div class="my-name">
|
||||
<div class="my-title">王马Verge</div>
|
||||
<div class="my-local">素材投稿:2547096351@qq.com</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-box">
|
||||
<a-button type="outline" style="width: 100px">转发</a-button>
|
||||
<a-button type="primary" style="width: 100px" color="#00aeec">关注</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import myImage from "@/assets/img/my-image.jpg";
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.my-avatar {
|
||||
display: flex;
|
||||
}
|
||||
.my-name {
|
||||
height: 100%;
|
||||
margin-left: 10px;
|
||||
.my-title {
|
||||
margin-top: 15px;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.my-local {
|
||||
margin-top: 25px;
|
||||
}
|
||||
}
|
||||
.btn-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 220px;
|
||||
margin: 20px 0 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,66 +0,0 @@
|
||||
<template>
|
||||
<div class="dynamic-scroller">
|
||||
<DynamicScroller :items="list" :min-item-size="54" direction="horizontal" class="scroller">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem
|
||||
:item="item"
|
||||
:active="active"
|
||||
:size-dependencies="[item.id]"
|
||||
:data-index="index"
|
||||
:data-active="active"
|
||||
class="message"
|
||||
>
|
||||
<div class="list-item">
|
||||
<a-image :src="myImage" width="50" />
|
||||
<div class="item-right">
|
||||
<div>月之暗面-{{ item.id }}</div>
|
||||
<div>The Dark Side of The Moon</div>
|
||||
</div>
|
||||
</div>
|
||||
</DynamicScrollerItem>
|
||||
</template>
|
||||
</DynamicScroller>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import myImage from "@/assets/img/The Dark Side of The Moon.jpg";
|
||||
import { DynamicScroller, DynamicScrollerItem } from "vue-virtual-scroller";
|
||||
// 还需引入vue-virtual-scroller的css文件,此处父组件已引入
|
||||
// import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
|
||||
|
||||
const list = ref<any>([]);
|
||||
|
||||
for (let i = 0; i < 500; i++) {
|
||||
list.value.push({
|
||||
id: i
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.dynamic-scroller {
|
||||
display: flex;
|
||||
width: 300px;
|
||||
height: 90px;
|
||||
overflow: hidden;
|
||||
border: 1px solid $color-primary;
|
||||
border-radius: 4px;
|
||||
.scroller {
|
||||
flex: 1;
|
||||
.message {
|
||||
padding: 12px;
|
||||
margin-bottom: 4px;
|
||||
border: 1px solid $color-border-2;
|
||||
.list-item {
|
||||
display: flex;
|
||||
column-gap: 4px;
|
||||
.item-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
padding: 4px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,56 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-space align="start">
|
||||
<a-card :style="{ width: '330px' }" title="垂直滚动-单列"> <vertical /> </a-card>
|
||||
<a-card :style="{ width: '330px' }" title="垂直滚动-网格">
|
||||
<vertical-grid />
|
||||
</a-card>
|
||||
<a-card :style="{ width: '330px' }" title="横向滚动">
|
||||
<horizontal />
|
||||
</a-card>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-typography>
|
||||
<a-typography-paragraph>
|
||||
<ol>
|
||||
<li>垂直虚拟列表需要设置父级高度,高度可以是height固定值,也可以是max-height约束值</li>
|
||||
<li>
|
||||
垂直网格布局的虚拟列表,组件不直接支持,需要手动分组,每行给一个id,一行显示两个
|
||||
<a-typography-text code> [{id: uid, list: [1,2]},{id: uid, list: [3,4]}] </a-typography-text>
|
||||
</li>
|
||||
<li>
|
||||
横向滚动,需要设置父元素高度height,高度必须是固定值,无法使用max-height,此外组件还需设置属性<a-typography-text
|
||||
code
|
||||
>direction="horizontal"</a-typography-text
|
||||
>
|
||||
</li>
|
||||
</ol>
|
||||
</a-typography-paragraph>
|
||||
<a-typography-paragraph blockquote>
|
||||
<div>
|
||||
基于:<a-link href="https://github.com/Akryum/vue-virtual-scroller" target="_blank">vue-virtual-scroller</a-link>
|
||||
</div>
|
||||
<div>
|
||||
页面使用需引入:
|
||||
<a-typography-text code>
|
||||
import { DynamicScroller, DynamicScrollerItem } from "vue-virtual-scroller";
|
||||
</a-typography-text>
|
||||
</div>
|
||||
<div>
|
||||
以及css文件:
|
||||
<a-typography-text code> import "vue-virtual-scroller/dist/vue-virtual-scroller.css"; </a-typography-text>
|
||||
</div>
|
||||
</a-typography-paragraph>
|
||||
</a-typography>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
|
||||
import vertical from "./vertical.vue";
|
||||
import verticalGrid from "./vertical-grid.vue";
|
||||
import horizontal from "./horizontal.vue";
|
||||
defineOptions({ name: "virtual-list" });
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,93 +0,0 @@
|
||||
<template>
|
||||
<div class="dynamic-scroller">
|
||||
<DynamicScroller :items="list" :min-item-size="54" class="scroller">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem
|
||||
:item="item"
|
||||
:active="active"
|
||||
:size-dependencies="[item.id]"
|
||||
:data-index="index"
|
||||
:data-active="active"
|
||||
class="message"
|
||||
>
|
||||
<div class="list-item">
|
||||
<div v-for="curr in item.list" :key="curr.id" class="grid-item">
|
||||
<a-image :src="myImage" width="50" />
|
||||
<div class="item-right">
|
||||
<div>甲壳虫-{{ curr.id }}</div>
|
||||
<div class="desc-text">Abbey Road</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DynamicScrollerItem>
|
||||
</template>
|
||||
</DynamicScroller>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import myImage from "@/assets/img/Abbey Road.jpg";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { DynamicScroller, DynamicScrollerItem } from "vue-virtual-scroller";
|
||||
// 还需引入vue-virtual-scroller的css文件,此处父组件已引入
|
||||
// import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
|
||||
|
||||
const list = ref<any>([]);
|
||||
|
||||
const getList = () => {
|
||||
let array = [];
|
||||
for (let i = 0; i < 500; i++) {
|
||||
array.push({
|
||||
id: i
|
||||
});
|
||||
}
|
||||
let group = [];
|
||||
for (let i = 0; i < array.length; i += 2) {
|
||||
group.push({
|
||||
id: uuidv4(),
|
||||
list: array.slice(i, i + 2)
|
||||
});
|
||||
}
|
||||
list.value = group;
|
||||
};
|
||||
|
||||
getList();
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.dynamic-scroller {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 300px;
|
||||
max-height: 400px;
|
||||
overflow: hidden;
|
||||
border: 1px solid $color-primary;
|
||||
border-radius: 4px;
|
||||
.scroller {
|
||||
flex: 1;
|
||||
.message {
|
||||
padding: 4px;
|
||||
margin-bottom: 4px;
|
||||
border: 1px solid $color-border-2;
|
||||
.list-item {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-gap: 4px;
|
||||
.grid-item {
|
||||
display: flex;
|
||||
column-gap: 4px;
|
||||
border: 1px solid $color-success;
|
||||
border-radius: 4px;
|
||||
.item-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
padding: 4px 0;
|
||||
.desc-text {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,67 +0,0 @@
|
||||
<template>
|
||||
<div class="dynamic-scroller">
|
||||
<DynamicScroller :items="list" :min-item-size="54" class="scroller">
|
||||
<template #default="{ item, index, active }">
|
||||
<DynamicScrollerItem
|
||||
:item="item"
|
||||
:active="active"
|
||||
:size-dependencies="[item.id]"
|
||||
:data-index="index"
|
||||
:data-active="active"
|
||||
class="message"
|
||||
>
|
||||
<div class="list-item">
|
||||
<a-image :src="myImage" width="50" />
|
||||
<div class="item-right">
|
||||
<div>月之暗面-{{ item.id }}</div>
|
||||
<div>The Dark Side of The Moon</div>
|
||||
</div>
|
||||
</div>
|
||||
</DynamicScrollerItem>
|
||||
</template>
|
||||
</DynamicScroller>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import myImage from "@/assets/img/The Dark Side of The Moon.jpg";
|
||||
import { DynamicScroller, DynamicScrollerItem } from "vue-virtual-scroller";
|
||||
// 还需引入vue-virtual-scroller的css文件,此处父组件已引入
|
||||
// import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
|
||||
|
||||
const list = ref<any>([]);
|
||||
|
||||
for (let i = 0; i < 500; i++) {
|
||||
list.value.push({
|
||||
id: i
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.dynamic-scroller {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 300px;
|
||||
max-height: 400px;
|
||||
overflow: hidden;
|
||||
border: 1px solid $color-primary;
|
||||
border-radius: 4px;
|
||||
.scroller {
|
||||
flex: 1;
|
||||
.message {
|
||||
padding: 12px;
|
||||
margin-bottom: 4px;
|
||||
border: 1px solid $color-border-2;
|
||||
.list-item {
|
||||
display: flex;
|
||||
column-gap: 4px;
|
||||
.item-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
padding: 4px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,29 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<div class="title">自定义防抖指令,连续点击按钮,0.5s后执行一次</div>
|
||||
<div class="button-box"><a-button type="primary" style="width: 100px" v-antiShake="onClick">防抖</a-button></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Message } from "@arco-design/web-vue";
|
||||
const onClick = () => {
|
||||
Message.success("0.5s后执行了");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: $font-size-title-1;
|
||||
color: $color-text-1;
|
||||
text-align: center;
|
||||
}
|
||||
.button-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,38 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
测试指令
|
||||
<!-- <button v-custom="{ goodsId, event: getFun }" :rowData="goodsId">文字变色</button> -->
|
||||
<!-- <button @click="jump">文字变色</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// const goodsId = ref(100);
|
||||
// setTimeout(() => {
|
||||
// goodsId.value = 200;
|
||||
// }, 1000);
|
||||
|
||||
// setTimeout(() => {
|
||||
// goodsId.value = 300;
|
||||
// }, 3000);
|
||||
|
||||
// setTimeout(() => {
|
||||
// goodsId.value = 400;
|
||||
// }, 4000);
|
||||
// const getFun = (e: any) => {
|
||||
// console.log("点击事件", e);
|
||||
// };
|
||||
// const router = useRouter();
|
||||
// const jump = () => {
|
||||
// router.push({
|
||||
// path: "/home",
|
||||
// query: {
|
||||
// name: "张三"
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,33 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<div class="my-page">
|
||||
<div class="title">自定义节流指令,连续点击按钮,每间隔1s执行一次</div>
|
||||
<div class="button-box">
|
||||
<a-button type="primary" style="width: 100px" v-throttle="onClick">1s节流</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Message } from "@arco-design/web-vue";
|
||||
const onClick = () => {
|
||||
Message.success("节流执行了");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: $font-size-title-1;
|
||||
color: $color-text-1;
|
||||
text-align: center;
|
||||
}
|
||||
.button-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">停用菜单</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,30 +0,0 @@
|
||||
interface SelectedKeys {
|
||||
type: string;
|
||||
showCheckedAll: boolean;
|
||||
onlyCurrent: boolean;
|
||||
}
|
||||
|
||||
interface Form {
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface Pagination {
|
||||
showPageSize: boolean;
|
||||
showTotal: boolean;
|
||||
current: number;
|
||||
pageSize: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
interface List {
|
||||
key: string;
|
||||
source: string;
|
||||
sourceSvg: string;
|
||||
sourceType: string;
|
||||
flow: string;
|
||||
percent: string;
|
||||
status: number;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
export type { SelectedKeys, Form, Pagination, List };
|
||||
@@ -1,179 +0,0 @@
|
||||
<template>
|
||||
<div class="container-page">
|
||||
<a-row :gutter="16" justify="space-between" class="bottom-gap">
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6" style="margin-bottom: 16px">
|
||||
<a-space>
|
||||
<a-button type="primary">
|
||||
<template #icon>
|
||||
<icon-plus />
|
||||
</template>
|
||||
<template #default>新增</template>
|
||||
</a-button>
|
||||
<a-button type="primary" status="danger">
|
||||
<template #icon>
|
||||
<icon-delete />
|
||||
</template>
|
||||
<template #default>删除</template>
|
||||
</a-button>
|
||||
<a-button>
|
||||
<template #icon>
|
||||
<icon-download />
|
||||
</template>
|
||||
<template #default>导出</template>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8" :xxl="6">
|
||||
<a-space>
|
||||
<a-input v-model="form.name" placeholder="请输入搜索关键词" />
|
||||
<a-button type="primary" status="success" @click="getList">
|
||||
<template #icon>
|
||||
<icon-search />
|
||||
</template>
|
||||
<template #default>搜索</template>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-table
|
||||
row-key="key"
|
||||
size="small"
|
||||
:bordered="{
|
||||
cell: true
|
||||
}"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||
:loading="loading"
|
||||
:data="list"
|
||||
:row-selection="rowSelection"
|
||||
v-model:selectedKeys="selectedKeys"
|
||||
:pagination="pagination"
|
||||
@page-change="pageChange"
|
||||
@page-size-change="pageSizeChange"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="序号" :width="68">
|
||||
<template #cell="cell">{{ cell.rowIndex + 1 }}</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="渠道来源" data-index="source">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<s-svg-icon :name="record.sourceSvg" />
|
||||
<span>{{ record.source }}</span>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="源类型" data-index="sourceType"></a-table-column>
|
||||
<a-table-column title="组流量共享" data-index="flow">
|
||||
<template #cell="{ record }">
|
||||
<a-badge status="processing" :text="record.flow" v-if="record.percent >= 60" />
|
||||
<a-badge status="warning" :text="record.flow" v-else-if="record.percent < 60 && record.percent >= 50" />
|
||||
<a-badge status="danger" :text="record.flow" v-else />
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="数据比例" data-index="percent" :width="200">
|
||||
<template #cell="{ record }">
|
||||
<a-progress v-if="record.percent >= 60" :percent="record.percent / 100" />
|
||||
<a-progress
|
||||
v-else-if="record.percent < 60 && record.percent >= 50"
|
||||
status="warning"
|
||||
:percent="record.percent / 100"
|
||||
/>
|
||||
<a-progress v-else status="danger" :percent="record.percent / 100" />
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="状态" data-index="status" align="center">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-tag size="small" color="green" v-if="record.status == 1">在线</a-tag>
|
||||
<a-tag size="small" color="red" v-else>离线</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="操作" :width="200" fixed="right">
|
||||
<template #cell="cell">
|
||||
<a-space>
|
||||
<a-button size="mini" type="primary">详情</a-button>
|
||||
<a-button size="mini">修改</a-button>
|
||||
<a-popconfirm content="确定删除这条数据吗?" type="warning">
|
||||
<a-button size="mini" type="primary" status="danger" @click="onDelete(cell)">删除</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getDocumentLibraryTableAPI } from "@/api/modules/file/index";
|
||||
import { SelectedKeys, Form, Pagination, List } from "./config";
|
||||
|
||||
const form = ref<Form>({ name: "" });
|
||||
const selectedKeys = ref<string[]>([]);
|
||||
const rowSelection = reactive<SelectedKeys>({
|
||||
type: "checkbox",
|
||||
showCheckedAll: true,
|
||||
onlyCurrent: false
|
||||
});
|
||||
const pagination = ref<Pagination>({ showPageSize: true, showTotal: true, current: 1, pageSize: 10, total: 0 });
|
||||
const pageChange = (page: number) => {
|
||||
pagination.value.current = page;
|
||||
};
|
||||
const pageSizeChange = (pageSize: number) => {
|
||||
pagination.value.pageSize = pageSize;
|
||||
};
|
||||
const onDelete = (cell: any) => {
|
||||
console.log("删除", cell);
|
||||
};
|
||||
|
||||
const loading = ref<boolean>(false);
|
||||
const list = ref<List[]>([]);
|
||||
const getList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
let { data } = await getDocumentLibraryTableAPI();
|
||||
pagination.value.total = data.total;
|
||||
list.value = shuffleArray(data.list);
|
||||
loading.value = false;
|
||||
} catch {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
getList();
|
||||
|
||||
const shuffleArray = (arr: List[]) => {
|
||||
// 循环遍历数组,从最后一个元素开始向前,
|
||||
// 递减生成,确保数组的每个值都被照顾到
|
||||
for (let i = arr.length - 1; i > 0; i--) {
|
||||
// 生成一个随机索引 j,范围是从 0 到 i
|
||||
// 生成的最大值就是arr数组的最大索引
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
// 交换 arr[i] 和 arr[j] 的值 (当前遍历的值和新生成的索引值)
|
||||
[arr[i], arr[j]] = [arr[j], arr[i]];
|
||||
// 随机修改值
|
||||
arr[i].flow = String(Math.floor(Math.random() * 5000));
|
||||
arr[i].percent = String(Math.floor(Math.random() * 100));
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
getList
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container-page {
|
||||
box-sizing: border-box;
|
||||
padding: $padding;
|
||||
}
|
||||
.bottom-gap {
|
||||
margin-bottom: $padding;
|
||||
}
|
||||
:deep(.arco-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,120 +0,0 @@
|
||||
<template>
|
||||
<div class="container-page">
|
||||
<a-input class="search-tree" v-model="searchKey" placeholder="请输入搜索关键词">
|
||||
<template #prefix>
|
||||
<icon-search />
|
||||
</template>
|
||||
</a-input>
|
||||
<div class="tree-box">
|
||||
<a-spin class="tree-loading" :loading="loading" tip="加载中...">
|
||||
<!-- TODO: 滚动条边距和宽度需要调整 -->
|
||||
<a-scrollbar style="height: 100%; overflow: auto" outer-class="scrollbar">
|
||||
<a-tree ref="aTreeRef" :data="treeData" :default-expand-all="true" :show-line="true" @select="onNode">
|
||||
<template #title="node">
|
||||
<span class="tree-title">{{ node.title }}</span>
|
||||
</template>
|
||||
<template #icon="node">
|
||||
<s-svg-icon name="folder-close" :size="16" v-if="!node.isLeaf && !node.expanded"></s-svg-icon>
|
||||
<s-svg-icon name="folder-open" :size="16" v-if="!node.isLeaf && node.expanded"></s-svg-icon>
|
||||
<s-svg-icon name="txt" :size="16" v-if="node.isLeaf"></s-svg-icon>
|
||||
</template>
|
||||
</a-tree>
|
||||
</a-scrollbar>
|
||||
</a-spin>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { findPathOfParentNode } from "@/utils/tree-tools";
|
||||
import { getDocumentLibraryTreeAPI } from "@/api/modules/file/index";
|
||||
|
||||
const emit = defineEmits(["onNode"]);
|
||||
|
||||
const onNode = (selectedKeys: Array<string>) => {
|
||||
let list = findPathOfParentNode(treeData.value, "key", selectedKeys[0]);
|
||||
emit("onNode", list || []);
|
||||
};
|
||||
|
||||
const searchKey = ref<string>("");
|
||||
const treeData = computed(() => {
|
||||
if (!searchKey.value) return sourceTree.value;
|
||||
return searchData(searchKey.value);
|
||||
});
|
||||
|
||||
// 搜索树
|
||||
const searchData = (keyword: string) => {
|
||||
const loop = (tree: SourceTree[]) => {
|
||||
const result: SourceTree[] = []; // 存储搜索结果
|
||||
tree.forEach((item: SourceTree) => {
|
||||
// 匹配节点
|
||||
if (item.title.toLowerCase().indexOf(keyword.toLowerCase()) > -1) {
|
||||
result.push({ ...item });
|
||||
} else if (item.children) {
|
||||
// 不匹配,但是有children,深层遍历
|
||||
// filterData 存储遍历结果
|
||||
const filterData = loop(item.children);
|
||||
// 如果在深层遍历中,匹配到
|
||||
if (filterData.length) {
|
||||
// 将结果存储到children中
|
||||
result.push({
|
||||
...item,
|
||||
children: filterData
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
// 开始递归
|
||||
return loop(sourceTree.value);
|
||||
};
|
||||
|
||||
interface SourceTree {
|
||||
title: string;
|
||||
key: string;
|
||||
children?: SourceTree[];
|
||||
}
|
||||
const aTreeRef = ref();
|
||||
const loading = ref<boolean>(false);
|
||||
const sourceTree = ref<SourceTree[]>([]);
|
||||
const getDocumentLibraryTree = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
let { data } = await getDocumentLibraryTreeAPI();
|
||||
loading.value = false;
|
||||
sourceTree.value = data;
|
||||
nextTick(() => {
|
||||
aTreeRef.value.expandAll(true);
|
||||
});
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
getDocumentLibraryTree();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container-page {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
padding: $padding;
|
||||
.search-tree {
|
||||
height: 32px;
|
||||
margin-bottom: $margin;
|
||||
}
|
||||
.tree-box {
|
||||
height: calc(100% - 32px - $margin);
|
||||
.tree-loading {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.scrollbar {
|
||||
height: 100%;
|
||||
.tree-title {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,70 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="container">
|
||||
<div class="left-box" v-show="!isMobile">
|
||||
<div class="box-title">文件库</div>
|
||||
<a-divider margin="0" />
|
||||
<FileTree class="file-tree-style" @on-node="onNode" />
|
||||
</div>
|
||||
<div class="right-box" :class="isMobile && 'row-content'">
|
||||
<div class="box-title">
|
||||
<a-breadcrumb>
|
||||
<a-breadcrumb-item v-for="(item, index) in breadcrumb" :key="index">{{ item.title }}</a-breadcrumb-item>
|
||||
<a-breadcrumb-item v-if="breadcrumb.length == 0">全部</a-breadcrumb-item>
|
||||
</a-breadcrumb>
|
||||
</div>
|
||||
<a-divider margin="0" />
|
||||
<FileTable ref="FileTableRef" class="file-table-style" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import FileTree from "@/views/file/document-library/components/file-tree.vue";
|
||||
import FileTable from "@/views/file/document-library/components/file-table.vue";
|
||||
import { useDevicesSize } from "@/hooks/useDevicesSize";
|
||||
const { isMobile } = useDevicesSize();
|
||||
const FileTableRef = ref();
|
||||
const breadcrumb = ref<any>([]);
|
||||
const onNode = (list: any) => {
|
||||
breadcrumb.value = list;
|
||||
FileTableRef.value && FileTableRef.value.getList();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
.left-box {
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
background: $color-bg-1;
|
||||
.file-tree-style {
|
||||
height: calc(100% - 40px);
|
||||
}
|
||||
}
|
||||
.right-box {
|
||||
width: calc(100% - 220px - $padding);
|
||||
height: 100%;
|
||||
margin-left: $padding;
|
||||
background: $color-bg-1;
|
||||
.file-table-style {
|
||||
height: calc(100% - 40px);
|
||||
}
|
||||
}
|
||||
.row-content {
|
||||
width: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
.box-title {
|
||||
height: 40px;
|
||||
padding: 0 $margin;
|
||||
font-size: $font-size-title-1;
|
||||
line-height: 40px;
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
@@ -1,202 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-row :gutter="16">
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" :xxl="12">
|
||||
<a-form ref="formRef" auto-label-width :size="form.size" :model="form" @submit="handleSubmit">
|
||||
<a-form-item field="size" label="表单大小">
|
||||
<a-radio-group v-model="form.size" type="button">
|
||||
<a-radio value="mini">迷你</a-radio>
|
||||
<a-radio value="small">偏小</a-radio>
|
||||
<a-radio value="medium">中等</a-radio>
|
||||
<a-radio value="large">偏大</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
field="name"
|
||||
label="用户名称"
|
||||
:rules="[
|
||||
{ required: true, message: '用户名称不能为空' },
|
||||
{ minLength: 5, message: '必须大于 5 个字符' }
|
||||
]"
|
||||
:validate-trigger="['change', 'input']"
|
||||
>
|
||||
<a-input :style="{ width: '100%' }" v-model="form.name" placeholder="请输入用户名称" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
field="age"
|
||||
label="年龄"
|
||||
:rules="[
|
||||
{ required: true, message: '年龄为必填项' },
|
||||
{ type: 'number', max: 200, message: '年龄上限为 200 岁' }
|
||||
]"
|
||||
>
|
||||
<a-input-number v-model="form.age" placeholder="请输入您的年龄" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="section" label="选项" :rules="[{ required: true, message: '选项不能为空' }]">
|
||||
<a-select v-model="form.section" placeholder="请选择" allow-clear>
|
||||
<a-option value="section one">Section One</a-option>
|
||||
<a-option value="section two">Section Two</a-option>
|
||||
<a-option value="section three">Section Three</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="province" label="地区" :rules="[{ required: true, message: '地区不能为空' }]">
|
||||
<a-cascader v-model="form.province" :options="options" placeholder="请选择地区" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="options" label="爱好" :rules="[{ type: 'array', minLength: 2, message: '请选择' }]">
|
||||
<a-checkbox-group v-model="form.options">
|
||||
<a-checkbox value="option one">听歌</a-checkbox>
|
||||
<a-checkbox value="option two">看电影</a-checkbox>
|
||||
<a-checkbox value="option three">旅游</a-checkbox>
|
||||
<a-checkbox value="option four">电竞</a-checkbox>
|
||||
</a-checkbox-group>
|
||||
</a-form-item>
|
||||
<a-form-item field="date" label="日期">
|
||||
<a-date-picker v-model="form.date" placeholder="请选择日期" />
|
||||
</a-form-item>
|
||||
<a-form-item field="time" label="时间">
|
||||
<a-time-picker v-model="form.time" placeholder="请选择时间" />
|
||||
</a-form-item>
|
||||
<a-form-item field="radio" label="性别" :rules="[{ required: true, message: '性别不能为空' }]">
|
||||
<a-radio-group v-model="form.radio">
|
||||
<a-radio value="man">男</a-radio>
|
||||
<a-radio value="woman">女</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item field="slider" label="进度" :rules="[{ type: 'number', min: 5, message: '最小为5' }]">
|
||||
<a-slider v-model="form.slider" :max="10" />
|
||||
</a-form-item>
|
||||
<a-form-item field="score" label="评分">
|
||||
<a-rate v-model="form.score" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="switch" label="状态" :rules="[{ type: 'boolean', true: true, message: '请打开开关' }]">
|
||||
<a-switch v-model="form.switch" />
|
||||
</a-form-item>
|
||||
<a-form-item field="multiSelect" label="多选">
|
||||
<a-select v-model="form.multiSelect" placeholder="请选择" multiple>
|
||||
<a-option value="section one">多选一</a-option>
|
||||
<a-option value="section two">多选二</a-option>
|
||||
<a-option value="section three">多选三</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="treeSelect" label="分组">
|
||||
<a-tree-select :data="treeData" v-model="form.treeSelect" placeholder="请选择分组" />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button html-type="submit">提交</a-button>
|
||||
<a-button @click="onReset">重置</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" :xxl="12">
|
||||
<s-code-view :code-json="codeJson" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const handleSubmit = ({ values, errors }: any) => {
|
||||
console.log("values:", values, "\nerrors:", errors);
|
||||
};
|
||||
// 将序列化的字符串美观输出,\t 换行
|
||||
const codeJson = computed(() => JSON.stringify(form, null, "\t"));
|
||||
const form = reactive({
|
||||
size: "medium",
|
||||
name: "",
|
||||
age: undefined,
|
||||
section: "",
|
||||
province: "guanggu",
|
||||
options: [],
|
||||
date: "",
|
||||
time: "",
|
||||
radio: "man",
|
||||
slider: 5,
|
||||
score: 5,
|
||||
switch: false,
|
||||
multiSelect: ["section one"],
|
||||
treeSelect: "node1"
|
||||
});
|
||||
const options = [
|
||||
{
|
||||
value: "hubei",
|
||||
label: "湖北",
|
||||
children: [
|
||||
{
|
||||
value: "wuhan",
|
||||
label: "武汉",
|
||||
children: [
|
||||
{
|
||||
value: "guanggu",
|
||||
label: "光谷"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
value: "xiaogan",
|
||||
label: "孝感"
|
||||
},
|
||||
{
|
||||
value: "huanggang",
|
||||
label: "黄冈"
|
||||
},
|
||||
{
|
||||
value: "xianning",
|
||||
label: "咸宁"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
value: "hunan",
|
||||
label: "湖南",
|
||||
children: [
|
||||
{
|
||||
value: "changsha",
|
||||
label: "长沙",
|
||||
children: [
|
||||
{
|
||||
value: "yuelu",
|
||||
label: "岳麓"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
const treeData = [
|
||||
{
|
||||
key: "node1",
|
||||
title: "分组01",
|
||||
children: [
|
||||
{
|
||||
key: "node1-01",
|
||||
title: "分组01-01"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: "node2",
|
||||
title: "分组02",
|
||||
children: [
|
||||
{
|
||||
key: "node2-01",
|
||||
title: "分组02-01"
|
||||
},
|
||||
{
|
||||
key: "node2-01",
|
||||
title: "分组02-02"
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
const formRef = ref();
|
||||
const onReset = () => {
|
||||
formRef.value.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,194 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<a-spin :loading="loading" style="display: block">
|
||||
<div class="snow-inner container">
|
||||
<a-row justify="center">
|
||||
<a-col :xs="22" :sm="18" :md="16" :lg="16" :xl="12" :xxl="12">
|
||||
<a-steps :current="currentStep" line-less>
|
||||
<a-step description="创建渠道活动">基本信息</a-step>
|
||||
<a-step description="完善活动渠道信息">活动渠道</a-step>
|
||||
<a-step description="创建成功">完成创建</a-step>
|
||||
</a-steps>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row justify="center" class="margin-top">
|
||||
<a-col :xs="18" :sm="12" :md="12" :lg="12" :xl="8" :xxl="8">
|
||||
<a-form ref="formRef" auto-label-width :model="form" :rules="rules" @submit="handleSubmit">
|
||||
<div v-if="currentStep == 1">
|
||||
<a-form-item field="name" label="活动名称">
|
||||
<a-input v-model="form.name" placeholder="请输入活动名称" />
|
||||
</a-form-item>
|
||||
<a-form-item field="type" label="渠道类型">
|
||||
<a-select v-model="form.type" placeholder="请选择渠道类型" allow-clear>
|
||||
<a-option value="1">互联网</a-option>
|
||||
<a-option value="2">线下</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="date" label="推广时间">
|
||||
<a-range-picker v-model="form.date" style="width: 100%" />
|
||||
</a-form-item>
|
||||
<a-form-item field="address" label="推广地址">
|
||||
<a-input v-model="form.address" placeholder="请输入推广地址" />
|
||||
<template #extra>
|
||||
<div>从哪些渠道了解到该项目,例如gitee:https://gitee.com/wang_fan_w/SnowAdmin</div>
|
||||
</template>
|
||||
</a-form-item>
|
||||
</div>
|
||||
<div v-if="currentStep == 2">
|
||||
<a-form-item field="source" label="广告来源">
|
||||
<a-input v-model="form.source" placeholder="请输入广告来源" />
|
||||
</a-form-item>
|
||||
<a-form-item field="medium" label="广告媒介">
|
||||
<a-input v-model="form.medium" placeholder="请输入广告媒介" />
|
||||
</a-form-item>
|
||||
<a-form-item field="keyword" label="关键词">
|
||||
<a-select v-model="form.keyword" placeholder="请选择关键词" allow-clear multiple>
|
||||
<a-option value="1">gitee</a-option>
|
||||
<a-option value="2">github</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="tip" label="推送提醒">
|
||||
<a-switch v-model="form.tip" />
|
||||
</a-form-item>
|
||||
<a-form-item field="content" label="广告内容">
|
||||
<a-textarea v-model="form.content" placeholder="请输入广告内容" allow-clear />
|
||||
</a-form-item>
|
||||
</div>
|
||||
|
||||
<div v-if="currentStep == 3">
|
||||
<a-result status="success" title="提交成功">
|
||||
<template #subtitle> 提交表单成功 </template>
|
||||
<template #extra>
|
||||
<a-space>
|
||||
<a-button type="primary">查看详情</a-button>
|
||||
<a-button @click="currentStep = 1">再次创建</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-result>
|
||||
</div>
|
||||
|
||||
<a-form-item v-if="currentStep != 3">
|
||||
<a-space>
|
||||
<a-button @click="onLastStep" v-if="currentStep != 1">上一步</a-button>
|
||||
<a-button html-type="submit" type="primary">下一步</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row v-if="currentStep == 3">
|
||||
<a-col :span="16" :offset="4">
|
||||
<a-typography style="padding: 24px; background: var(--color-fill-2)">
|
||||
<a-typography-paragraph>提示</a-typography-paragraph>
|
||||
<ul>
|
||||
<li>您可以在github或者gitee上完整预览该项目</li>
|
||||
<li>如果您觉得该项目对您有用,可以动动小手,点亮一下star噢</li>
|
||||
</ul>
|
||||
</a-typography>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</a-spin>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const loading = ref(false);
|
||||
const currentStep = ref(1);
|
||||
const form = ref({
|
||||
name: "",
|
||||
type: null,
|
||||
date: [],
|
||||
address: "https://gitee.com/wang_fan_w/SnowAdmin",
|
||||
source: "",
|
||||
medium: "",
|
||||
keyword: [],
|
||||
tip: true,
|
||||
content: ""
|
||||
});
|
||||
const rules = ref({
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入活动名称"
|
||||
}
|
||||
],
|
||||
type: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择渠道类型"
|
||||
}
|
||||
],
|
||||
date: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择推广时间"
|
||||
}
|
||||
],
|
||||
address: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入推广地址"
|
||||
}
|
||||
],
|
||||
source: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入广告来源"
|
||||
}
|
||||
],
|
||||
medium: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入广告媒介"
|
||||
}
|
||||
],
|
||||
keyword: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择关键词"
|
||||
}
|
||||
],
|
||||
tip: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择推送提醒"
|
||||
}
|
||||
],
|
||||
content: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入广告内容"
|
||||
}
|
||||
]
|
||||
});
|
||||
const formRef = ref();
|
||||
|
||||
const handleSubmit = ({ errors }: ArcoDesign.ArcoSubmit) => {
|
||||
if (errors) return;
|
||||
if (currentStep.value == 3) return;
|
||||
if (currentStep.value == 2) {
|
||||
loading.value = true;
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
currentStep.value += 1;
|
||||
}, 500);
|
||||
} else {
|
||||
currentStep.value += 1;
|
||||
}
|
||||
};
|
||||
|
||||
const onLastStep = () => {
|
||||
if (currentStep.value == 1) return;
|
||||
currentStep.value -= 1;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
padding: 60px 0;
|
||||
}
|
||||
.margin-top {
|
||||
margin-top: 60px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,239 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-alert type="success">工具类位置: src/utils/common-tools.ts</a-alert>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>小驼峰转小写下划线: toUnderline</div>
|
||||
<div>示例: userNameInfo -> user_name_info</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>toUnderline(需要转换的字符串)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>下划线命名转小驼峰: getCamelCase</div>
|
||||
<div>示例: user_name_info -> userNameInfo</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>getCamelCase(需要转换的字符串)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>生成随机Hex颜色: getColorHexColor</div>
|
||||
<div>该函数会随机生成并返回一个Hex的色值,如:#1eb31</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>getColorHexColor()</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>判断变量数据类型: getObjType</div>
|
||||
<div>
|
||||
该函数会判断传入的变量类型并返回,如: boolean / number / string / function / object / array / date / regExp / undefined
|
||||
/ null / object / symbol
|
||||
</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>getObjType(需要判断的变量)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>基本数据类型数组去重: arrSet</div>
|
||||
<div>该函数会对基本数据类型数组去重,返回去重后的数组</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>arrSet(需要去重的数组)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>数组对象去重: arrObjSet</div>
|
||||
<div>该函数会对数组对象去重,返回去重后的数组</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>arrObjSet(需要去重的数组)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>数组对象根据指定key去重: somethingSet</div>
|
||||
<div>该函数会根据指定key对数组对象去重,返回去重后的数组</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>somethingSet(需要去重的数组, 指定的key)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>排序-根据条件对数组对象排序: toSort</div>
|
||||
<div>该函数可根据指定key对数组对象排序,可设定升序、降序</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>toSort(需要去重的数组, 指定key, 升序或降序)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>比对新对象和旧对象的差异值,返回新对象的差异值: Difference</div>
|
||||
<div>根据传入的新、旧Objct进行比对,返回他们的差异值(只比对顶层)</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>Difference(新Object, 旧Object)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>删除数组中多个指定元素: arrMoreDeletion</div>
|
||||
<div>根据指定的key比对是否匹配,匹配则删除,最后返回删除后的数组,如:arrMoreDeletion(arr, [2,3,4], 'id')</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>arrMoreDeletion(原数组, [key的对应值], 指定的key)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>无条件A/B数组交叉合并: crossList</div>
|
||||
<div>该函数会交叉合并A/B数组,返回合并后的数组</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>crossList(A数组, B数组)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>生成指定长度的随机字符串: randomString</div>
|
||||
<div>包含数字、英文大小写,示例:randomString(5)</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>randomString(指定随机字符串长度)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>获取数值在数组中的近似值: closest</div>
|
||||
<div>根据传入的值匹配数字数组中值最接近的数字并返回</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>closest(数字数组, 需要匹配的值)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>根据标准值计算当前值的涨幅和减幅: getPercent</div>
|
||||
<div>
|
||||
该函数会根据传入的当前值、标准值进行计算,基于标准值计算出涨幅和减幅幅度,返回
|
||||
<a-typography-text code>{ percent: 10, type: 1, text: '涨幅10.00%'}</a-typography-text>
|
||||
格式
|
||||
</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>getPercent(当前值, 标准值)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>根据涨幅和减幅计算实际值: getValue</div>
|
||||
<div>该函数会根据涨幅或减幅计算最终结果,示例:getValue(100, {type: 1, percent: 10})</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>getValue(当前值, {type: 1涨幅2减幅, percent: 幅度百分比})</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>判断是否为空对象: isEmptyObject</div>
|
||||
<div>该函数会判断传入参数是否是空对象,返回true/false,区分Object/Array等类型</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>isEmptyObject(传入的值)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>判断是否为安全环境: isSecureEnvironment</div>
|
||||
<div>返回true/false,安全环境为:https / localhost / 127.0.0.1 / 0.0.0.0</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>isSecureEnvironment()</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>获取浏览器默认语言: webDefaultLanguage</div>
|
||||
<div>返回字符串,如:zh-CN</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>webDefaultLanguage()</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>深拷贝变量: deepClone</div>
|
||||
<div>返回深拷贝后的值</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>deepClone(需要深拷贝的变量)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>获取URL附带的参数: getQueryParams</div>
|
||||
<div>解析url?之后的参数转化为object的数据,默认取当前网页的url</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>getQueryParams(url)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>截断字符串: truncateString</div>
|
||||
<div>截断字符串,如果字符串超过指定长度,则截断并添加省略号</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>truncateString(字符串, 需要截断的长度)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>去掉字符串前后空格: verifyAndSpace</div>
|
||||
<div>该函数会去掉并返回字符串的前后空格</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>verifyAndSpace(字符串)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>去掉字符串的所有中文和空格: verifyCnAndSpace</div>
|
||||
<div>该函数会去掉字符串的所有中文和空格并返回新字符串</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>verifyCnAndSpace(字符串)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>去掉前后空格和字符串中的英文: verifyEnAndSpace</div>
|
||||
<div>该函数会返回纯非英文不包含前后空格的字符串</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>verifyEnAndSpace(字符串)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>数字转中文大写: verifyNumberCnUppercase</div>
|
||||
<div>根据传入的数字转成中文大写字符串并返回,如:verifyNumberCnUppercase(1506045) -> 壹佰伍拾万陆仟零肆拾伍元整</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>verifyNumberCnUppercase(数字)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,61 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-alert type="success">工具类位置: src/utils/file-tools.ts</a-alert>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>获取麦克风权限: getMicPower</div>
|
||||
<div>返回Promis的boolean,示例: getMicPower()</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>getMicPower()</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>十六进制字符串转换为字节数组: hexStringToByteArray</div>
|
||||
<div>返回Uint8Array,示例: hexStringToByteArray(hexString)</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>hexStringToByteArray(十六进制字符串)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>Uint8Array转换为ArrayBuffer: byteArrayToArrayBuffer</div>
|
||||
<div>返回ArrayBuffer,示例: byteArrayToArrayBuffer(Uint8Array)</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>byteArrayToArrayBuffer(你的Uint8Array数据)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>base64转blob: base64ToBlob</div>
|
||||
<div>返回处理后的blob,示例: base64ToBlob(base64)</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>base64ToBlob(base64字符串, MIME类型-可不传, 分片大小-可不传)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>base64转ArrayBuffer: base64ToArrayBuffer</div>
|
||||
<div>返回处理后的ArrayBuffer,示例: base64ToArrayBuffer(base64)</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>base64ToArrayBuffer(base64字符串)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>blob转Uint8Array: blobToUint8Array</div>
|
||||
<div>返回处理后的Uint8Array,示例: blobToUint8Array(base64)</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>blobToUint8Array(你的blob数据)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,25 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-card title="路由测试页">
|
||||
<a-space direction="vertical" fill>
|
||||
<div>路由:{{ route.path }}</div>
|
||||
<div>参数:{{ JSON.stringify(route.query) }}</div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入内容测试页面缓存" allow-clear v-model="form" />
|
||||
</a-space>
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRouteConfigStore } from "@/store/modules/route-config";
|
||||
defineOptions({ name: "common-route" });
|
||||
const routerStore = useRouteConfigStore();
|
||||
const route = useRoute();
|
||||
const form = ref("");
|
||||
|
||||
routerStore.setTabsTitle(`${route.query.name} - ${route.query.text}`);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,25 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-card title="路由测试页">
|
||||
<a-space direction="vertical" fill>
|
||||
<div>路由:{{ route.path }}</div>
|
||||
<div>参数:{{ JSON.stringify(route.params) }}</div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入内容测试页面缓存" allow-clear v-model="form" />
|
||||
</a-space>
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRouteConfigStore } from "@/store/modules/route-config";
|
||||
defineOptions({ name: "dynamic-route" });
|
||||
const routerStore = useRouteConfigStore();
|
||||
const route = useRoute();
|
||||
const form = ref("");
|
||||
|
||||
routerStore.setTabsTitle(`${route.params.name} - ${route.params.text}`);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,109 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<a-card title="普通路由">
|
||||
<a-alert style="width: 100%" type="success" class="content" :show-icon="false">
|
||||
<div>1. 无需在路由配置中声明,可以随意添加任意参数</div>
|
||||
<div>2. 参数以键值对的形式出现在 URL 的 ? 之后,用 & 分隔</div>
|
||||
<div>3. 例如:/user?id=123&name=John,其中 id=123 和 name=John 是 query 参数</div>
|
||||
<div>4. 参数是可选的非必填项,可以自由传递</div>
|
||||
</a-alert>
|
||||
<a-alert style="width: 100%" type="success" class="content" :show-icon="false">
|
||||
<div>路由:/functions/routing-operation/common-route</div>
|
||||
</a-alert>
|
||||
<a-space direction="vertical" fill>
|
||||
<a-input placeholder="请输入路由" allow-clear disabled v-model="connom.path">
|
||||
<template #prepend> 路由: </template>
|
||||
</a-input>
|
||||
<a-input placeholder="请输入参数" allow-clear v-model="connom.query.name">
|
||||
<template #prepend> 参数: </template>
|
||||
</a-input>
|
||||
<a-input placeholder="请输入参数" allow-clear v-model="connom.query.text">
|
||||
<template #prepend> 参数: </template>
|
||||
</a-input>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="onQuery">跳转-query</a-button>
|
||||
</a-space>
|
||||
</a-space>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-card title="动态匹配">
|
||||
<a-alert style="width: 100%" type="success" class="content" :show-icon="false">
|
||||
<div>1. 需要在路由配置中明确定义动态参数,否则参数会被忽略</div>
|
||||
<div>2. 参数会直接体现在 URL 路径中,通常用于动态路由匹配</div>
|
||||
<div>3. 例如:/user/123,其中 123 是 params 参数(对应路由 /user/:id)</div>
|
||||
<div>4. 如果在路由配置中声明了动态参数(如 /:id),则参数是必填的</div>
|
||||
</a-alert>
|
||||
<a-alert style="width: 100%" type="success" class="content" :show-icon="false">
|
||||
<div>路由:/functions/routing-operation/dynamic-route/:name/:text</div>
|
||||
</a-alert>
|
||||
<a-space direction="vertical" fill>
|
||||
<a-input placeholder="请输入路由" allow-clear disabled v-model="dynamic.name">
|
||||
<template #prepend> 路由: </template>
|
||||
</a-input>
|
||||
<a-input placeholder="请输入参数" allow-clear v-model="dynamic.params.name">
|
||||
<template #prepend> 参数: </template>
|
||||
</a-input>
|
||||
<a-input placeholder="请输入参数" allow-clear v-model="dynamic.params.text">
|
||||
<template #prepend> 参数: </template>
|
||||
</a-input>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="onParams">跳转-params</a-button>
|
||||
</a-space>
|
||||
</a-space>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({ name: "routing-operation" });
|
||||
const router = useRouter();
|
||||
// 普通跳转
|
||||
const connom = ref({
|
||||
path: "/functions/routing-operation/common-route",
|
||||
query: {
|
||||
name: "SnowAdmin",
|
||||
text: "月之暗面"
|
||||
}
|
||||
});
|
||||
const onQuery = () => {
|
||||
let route = {
|
||||
path: connom.value.path, // 跳转路由
|
||||
query: connom.value.query // 路由参数
|
||||
};
|
||||
router.push(route);
|
||||
};
|
||||
|
||||
// 动态匹配
|
||||
const dynamic = ref({
|
||||
name: "dynamic-route",
|
||||
params: {
|
||||
name: "SnowAdmin",
|
||||
text: "月之暗面"
|
||||
}
|
||||
});
|
||||
const onParams = () => {
|
||||
try {
|
||||
let route = {
|
||||
name: dynamic.value.name, // 跳转路由
|
||||
params: dynamic.value.params // 路由参数
|
||||
};
|
||||
router.push(route);
|
||||
} catch {
|
||||
arcoMessage("warning", "请完整填写参数");
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
width: 400px;
|
||||
margin: $margin 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,54 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-alert type="success">工具类位置: src/utils/tree-tools.ts</a-alert>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>判断code在树形数据中是否存在: treeCodeExist</div>
|
||||
<div>返回true / false,示例: treeCodeExist(treeData, "ABC123", { key: 'id', childrenKey: "children" })</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code
|
||||
>treeCodeExist(树数据, key值, { key: key名, childrenKey: 下级绑定的key比如children })</a-typography-text
|
||||
>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>返回指定名称的所有父节点: findPathOfParentNode</div>
|
||||
<div>示例: findPathOfParentNode(treeData,key, keyValue)</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>findPathOfParentNode(树数据, 指定的key, 指定key绑定的值)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>数组扁平化-多维转一维: arrayFlattened</div>
|
||||
<div>返回转一维的数组,示例: arrayFlattened(treeData, 'children')</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>arrayFlattened(树数据, 下级的键名如children)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>乱序一维数组转树形结构: buildTreeOptimized</div>
|
||||
<div>返回根据parentId将乱序的一维数组转树形结构,示例: buildTreeOptimized(nodes)</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>buildTreeOptimized(乱序的一维数组)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>根据指定key找到对应节点: findCategoryById</div>
|
||||
<div>返回指定id找到对应的节点,示例: findCategoryById(tree, key, keyValue)</div>
|
||||
<div>
|
||||
使用方式:
|
||||
<a-typography-text code>findCategoryById(树数据, 指定的key, 指定的key绑定的值)</a-typography-text>
|
||||
</div>
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,211 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-alert type="success">工具类位置: src/utils/verify-tools.ts</a-alert>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>处理输入内容,只允许输入数字和2位小数👉️ {{ text01 }}</div>
|
||||
<div>
|
||||
<a-input
|
||||
:style="{ width: '320px' }"
|
||||
placeholder="请输入"
|
||||
allow-clear
|
||||
v-model="text01"
|
||||
@input="onVerifyNumberIntegerAndFloat"
|
||||
/>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>输入框限制只允许正整数输入👉️ {{ text02 }}</div>
|
||||
<div>
|
||||
<a-input
|
||||
:style="{ width: '320px' }"
|
||||
placeholder="请输入"
|
||||
allow-clear
|
||||
v-model="text02"
|
||||
@input="onVerifiyNumberInteger"
|
||||
/>
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
手机号码格式验证,是否正确👉️
|
||||
{{ verifyPhone(text03) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text03" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
国内电话号码格式验证👉️
|
||||
{{ verifyTelPhone(text04) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text04" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
登录账号验证 (字母开头,允许5-16字节,允许字母数字下划线)👉️
|
||||
{{ verifyAccount(text05) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text05" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
密码 (以字母开头,长度在6~16之间,只能包含字母、数字和下划线)👉️
|
||||
{{ verifyPassword(text06) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text06" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
强密码 (字母+数字+特殊字符,长度在6-16之间)👉️
|
||||
{{ verifyPasswordPowerful(text07) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text07" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
密码强度(长度6~16)👉️
|
||||
{{ verifyPasswordStrength(text08) || "无" }}
|
||||
</div>
|
||||
<div>弱:纯数字,纯字母,纯特殊字符</div>
|
||||
<div>中:字母+数字,字母+特殊字符,数字+特殊字符</div>
|
||||
<div>强:字母+数字+特殊字符</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text08" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
校验IP地址是否正确👉️
|
||||
{{ verifyIPAddress(text09) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text09" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
校验邮箱是否正确👉️
|
||||
{{ verifyEmail(text10) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text10" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
身份证验证👉️
|
||||
{{ verifyIdCard(text11) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text11" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
中文姓名验证👉️
|
||||
{{ verifyFullName(text12) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text12" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
邮政编码验证👉️
|
||||
{{ verifyPostalCode(text13) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text13" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
url正确性验证👉️
|
||||
{{ verifyUrl(text14) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text14" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<a-space direction="vertical" fill>
|
||||
<div>
|
||||
车牌号验证👉️
|
||||
{{ verifyCarNum(text15) }}
|
||||
</div>
|
||||
<div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入" allow-clear v-model="text15" />
|
||||
</div>
|
||||
</a-space>
|
||||
<a-divider />
|
||||
<div>基于<a-link href="https://gitee.com/lyt-top/vue-next-admin" target="_blank">vue-next-admin</a-link>的验证工具</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
verifyNumberIntegerAndFloat,
|
||||
verifiyNumberInteger,
|
||||
verifyPhone,
|
||||
verifyTelPhone,
|
||||
verifyAccount,
|
||||
verifyPassword,
|
||||
verifyPasswordPowerful,
|
||||
verifyPasswordStrength,
|
||||
verifyIPAddress,
|
||||
verifyEmail,
|
||||
verifyIdCard,
|
||||
verifyFullName,
|
||||
verifyPostalCode,
|
||||
verifyUrl,
|
||||
verifyCarNum
|
||||
} from "@/utils/verify-tools.ts";
|
||||
const text01 = ref<string>("");
|
||||
const onVerifyNumberIntegerAndFloat = (e: string) => {
|
||||
text01.value = verifyNumberIntegerAndFloat(e);
|
||||
};
|
||||
|
||||
const text02 = ref<string>("");
|
||||
const onVerifiyNumberInteger = (e: string) => {
|
||||
text02.value = verifiyNumberInteger(e);
|
||||
};
|
||||
|
||||
const text03 = ref<string>("");
|
||||
const text04 = ref<string>("");
|
||||
const text05 = ref<string>("");
|
||||
const text06 = ref<string>("");
|
||||
const text07 = ref<string>("");
|
||||
const text08 = ref<string>("");
|
||||
const text09 = ref<string>("");
|
||||
const text10 = ref<string>("");
|
||||
const text11 = ref<string>("");
|
||||
const text12 = ref<string>("");
|
||||
const text13 = ref<string>("");
|
||||
const text14 = ref<string>("");
|
||||
const text15 = ref<string>("");
|
||||
</script>
|
||||
@@ -1,7 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">隐藏菜单</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,33 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<p>{{ $t(`system.switch-language-to-preview`) }}</p>
|
||||
<br />
|
||||
<div>
|
||||
<a-date-picker style="width: 200px" v-model="form.time" />
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<a-time-picker type="time-range" style="width: 252px" v-model="form.timeRange" />
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<a-range-picker style="width: 360px" show-time format="YYYY-MM-DD HH:mm" v-model="form.date" />
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<a-pagination :total="50" show-total show-jumper show-page-size />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const form = reactive({
|
||||
time: "",
|
||||
timeRange: [],
|
||||
date: []
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
<template>
|
||||
<s-external-link-page />
|
||||
</template>
|
||||
@@ -1,3 +0,0 @@
|
||||
<template>
|
||||
<s-internal-link-page />
|
||||
</template>
|
||||
@@ -4,7 +4,7 @@
|
||||
<LoginBanner v-if="isPc" />
|
||||
<div class="login_box">
|
||||
<div class="login_title">Welcome Back</div>
|
||||
<div class="login_title_desc">一款更好用的个人 USDT/USDC 收款网关,让您的收款更加便捷!</div>
|
||||
<div class="login_title_desc">一款更好用的个人加密货币收款网关,助力出海需求!</div>
|
||||
<LoginForm />
|
||||
<!-- <div class="author">by 兔子先森</div> -->
|
||||
</div>
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-space wrap>
|
||||
<a-input v-model="form.name" placeholder="请输入任务名称" allow-clear />
|
||||
<a-select placeholder="执行状态" v-model="form.status" style="width: 120px" allow-clear>
|
||||
<a-option v-for="item in openState" :key="item.value" :value="item.value">{{ item.name }}</a-option>
|
||||
</a-select>
|
||||
<a-range-picker v-model="form.datetimeRange" show-time format="YYYY-MM-DD HH:mm" allow-clear />
|
||||
|
||||
<a-button type="primary" @click="search">
|
||||
<template #icon><icon-search /></template>
|
||||
<span>查询</span>
|
||||
</a-button>
|
||||
<a-button @click="reset">
|
||||
<template #icon><icon-refresh /></template>
|
||||
<span>重置</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
|
||||
<a-table
|
||||
row-key="id"
|
||||
:data="list"
|
||||
:bordered="{ cell: true }"
|
||||
:loading="loading"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||
:pagination="pagination"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="序号" :width="64">
|
||||
<template #cell="cell">{{ cell.rowIndex + 1 }}</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="任务名称" data-index="taskName" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="执行状态" data-index="status" align="center" :width="100">
|
||||
<template #cell="{ record }">
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.status === 1">成功</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>失败</a-tag>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="备注" data-index="remark" ellipsis tooltip>
|
||||
<template #cell="{ record }">
|
||||
{{ record.remark || "无" }}
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="预设时间" data-index="createTime"></a-table-column>
|
||||
<a-table-column title="执行时间" data-index="executionTime"></a-table-column>
|
||||
<a-table-column title="操作" :width="100" align="center" :fixed="'right'">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-button type="primary" status="success" size="mini" @click="onDetail(record)">
|
||||
<template #icon><icon-file /></template>
|
||||
<span>详情</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getCrontabLogsAPI } from "@/api/modules/monitor/index";
|
||||
import { useRouteConfigStore } from "@/store/modules/route-config";
|
||||
defineOptions({ name: "crontab-logs" });
|
||||
let route = useRoute();
|
||||
const routerStore = useRouteConfigStore();
|
||||
const openState = ref(dictFilter("taskStatus"));
|
||||
|
||||
const form = ref({
|
||||
name: "",
|
||||
status: null,
|
||||
datetimeRange: []
|
||||
});
|
||||
const search = () => {
|
||||
getCrontabLogs();
|
||||
};
|
||||
const reset = () => {
|
||||
form.value = {
|
||||
name: "",
|
||||
status: null,
|
||||
datetimeRange: []
|
||||
};
|
||||
getCrontabLogs();
|
||||
};
|
||||
|
||||
const onDetail = (record: any) => {
|
||||
console.log("详情", record);
|
||||
};
|
||||
|
||||
// 获取列表
|
||||
const loading = ref(false);
|
||||
const pagination = ref({
|
||||
pageSize: 10,
|
||||
showPageSize: true
|
||||
});
|
||||
const list = ref([]);
|
||||
const getCrontabLogs = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
let res = await getCrontabLogsAPI(form.value);
|
||||
list.value = res.data;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const init = () => {
|
||||
if (route.query.id) {
|
||||
form.value.name = route.query.name;
|
||||
}
|
||||
getCrontabLogs();
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
routerStore.setTabsTitle(`任务日志${route.query.id ? " - " + route.query.id : ""}`);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.text-right-gap {
|
||||
margin-right: $margin;
|
||||
}
|
||||
</style>
|
||||
@@ -1,270 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-space wrap>
|
||||
<a-input v-model="form.loginLocation" placeholder="请输入任务名称" allow-clear />
|
||||
<a-select placeholder="任务状态" v-model="form.status" style="width: 120px" allow-clear>
|
||||
<a-option v-for="item in openState" :key="item.value" :value="item.value">{{ item.name }}</a-option>
|
||||
</a-select>
|
||||
<a-range-picker v-model="form.createTime" show-time format="YYYY-MM-DD HH:mm" allow-clear />
|
||||
<a-button type="primary" @click="search">
|
||||
<template #icon><icon-search /></template>
|
||||
<span>查询</span>
|
||||
</a-button>
|
||||
<a-button @click="reset">
|
||||
<template #icon><icon-refresh /></template>
|
||||
<span>重置</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
|
||||
<a-row>
|
||||
<a-space wrap>
|
||||
<a-button type="primary" @click="onAdd">
|
||||
<template #icon><icon-plus /></template>
|
||||
<span>新增</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-row>
|
||||
|
||||
<a-table
|
||||
row-key="id"
|
||||
:data="list"
|
||||
:bordered="{ cell: true }"
|
||||
:loading="loading"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||
:pagination="pagination"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="序号" :width="64">
|
||||
<template #cell="cell">{{ cell.rowIndex + 1 }}</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="任务名称" data-index="name" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="执行服务" data-index="service" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="定时规则" data-index="taskType" ellipsis tooltip>
|
||||
<template #cell="{ record }">
|
||||
<span v-if="record.taskType == 0">CRON: {{ record.cron }}</span>
|
||||
<span v-else>间隔时间: {{ record.every }} 秒</span>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="状态" align="center" data-index="status" :width="80">
|
||||
<template #cell="{ record }">
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.status === 1">启用</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>禁用</a-tag>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="备注" data-index="remark" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="创建时间" data-index="createTime" :width="180"></a-table-column>
|
||||
<a-table-column title="操作" :width="250" align="center" :fixed="'right'">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-button type="primary" status="success" size="mini" @click="onLogs(record)">
|
||||
<template #icon><icon-file /></template>
|
||||
<span>日志</span>
|
||||
</a-button>
|
||||
<a-button type="primary" size="mini" @click="onUpdate(record)">
|
||||
<template #icon><icon-edit /></template>
|
||||
<span>修改</span>
|
||||
</a-button>
|
||||
<a-popconfirm type="warning" content="确定删除吗?">
|
||||
<a-button type="primary" status="danger" size="mini">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<a-modal width="40%" v-model:visible="open" @close="afterClose" @ok="handleOk" @cancel="afterClose">
|
||||
<template #title> {{ title }} </template>
|
||||
<div>
|
||||
<a-form ref="formRef" auto-label-width :rules="rules" :model="addFrom">
|
||||
<a-form-item field="name" label="任务名称" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.name" placeholder="请输入任务名称" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="status" label="任务状态" validate-trigger="blur">
|
||||
<a-switch type="round" :checked-value="1" :unchecked-value="0" v-model="addFrom.status">
|
||||
<template #checked> 启用 </template>
|
||||
<template #unchecked> 禁用 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<a-form-item field="taskType" label="任务类型" validate-trigger="blur">
|
||||
<a-select placeholder="请选择执行策略" v-model="addFrom.taskType" allow-clear @change="onTaskTypeChange">
|
||||
<a-option v-for="item in taskTypeOption" :key="item.value" :value="item.value">{{ item.name }}</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="cron" label="Cron表达式" validate-trigger="blur" v-if="addFrom.taskType == 0">
|
||||
<a-input v-model="addFrom.cron" placeholder="******" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="every" label="间隔时长" validate-trigger="blur" v-else>
|
||||
<a-input-number
|
||||
v-model="addFrom.every"
|
||||
placeholder="请输入"
|
||||
:min="1"
|
||||
:max="999999999"
|
||||
:step="1"
|
||||
:precision="0"
|
||||
allow-clear
|
||||
>
|
||||
<template #suffix> 秒 </template>
|
||||
</a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-form-item field="service" label="执行服务" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.service" placeholder="请输入执行服务service" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="startDate" label="开始时间" validate-trigger="blur">
|
||||
<a-date-picker v-model="addFrom.startDate" show-time allow-clear format="YYYY-MM-DD HH:mm:ss" />
|
||||
</a-form-item>
|
||||
<a-form-item field="misfirePolicy" label="执行策略" validate-trigger="blur">
|
||||
<a-select placeholder="请选择执行策略" v-model="addFrom.misfirePolicy" allow-clear>
|
||||
<a-option v-for="item in misfirePolicyOption" :key="item.value" :value="item.value">{{ item.name }}</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="remark" label="备注" validate-trigger="blur">
|
||||
<a-textarea v-model="addFrom.remark" placeholder="请输入描述" allow-clear />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getCrontabAPI } from "@/api/modules/monitor/index";
|
||||
import { deepClone } from "@/utils";
|
||||
defineOptions({ name: "crontab" });
|
||||
const router = useRouter();
|
||||
const openState = ref(dictFilter("status"));
|
||||
const misfirePolicyOption = ref([
|
||||
{ name: "循环", value: 1 },
|
||||
{ name: "执行一次", value: 2 }
|
||||
]);
|
||||
const taskTypeOption = ref([
|
||||
{ name: "cron", value: 0 },
|
||||
{ name: "时间间隔", value: 1 }
|
||||
]);
|
||||
const form = ref({
|
||||
loginLocation: "",
|
||||
userName: "",
|
||||
status: null,
|
||||
createTime: []
|
||||
});
|
||||
const search = () => {
|
||||
getCrontab();
|
||||
};
|
||||
const reset = () => {
|
||||
form.value = {
|
||||
loginLocation: "",
|
||||
userName: "",
|
||||
status: null,
|
||||
createTime: []
|
||||
};
|
||||
getCrontab();
|
||||
};
|
||||
|
||||
// 新增
|
||||
const open = ref(false);
|
||||
const rules = {
|
||||
name: [{ required: true, message: "请输入任务名称" }],
|
||||
status: [{ required: true, message: "请选择任务状态" }],
|
||||
taskType: [{ required: true, message: "请选择任务类型" }],
|
||||
cron: [{ required: true, message: "请输入Cron表达式" }],
|
||||
every: [{ required: true, message: "请输入间隔时间(秒)" }],
|
||||
service: [{ required: true, message: "请输入执行服务service" }],
|
||||
startDate: [{ required: true, message: "请选择开始时间" }],
|
||||
misfirePolicy: [{ required: true, message: "请选择执行策略" }]
|
||||
};
|
||||
const addFrom = ref<any>({
|
||||
name: "",
|
||||
status: 1,
|
||||
taskType: 0,
|
||||
cron: "",
|
||||
every: null,
|
||||
service: "",
|
||||
startDate: "",
|
||||
misfirePolicy: 1,
|
||||
remark: ""
|
||||
});
|
||||
const title = ref("");
|
||||
const formRef = ref();
|
||||
const onAdd = () => {
|
||||
title.value = "添加任务";
|
||||
open.value = true;
|
||||
};
|
||||
const handleOk = async () => {
|
||||
let state = await formRef.value.validate();
|
||||
if (state) return (open.value = true); // 校验不通过
|
||||
arcoMessage("success", "模拟提交成功");
|
||||
getCrontab();
|
||||
};
|
||||
// 关闭对话框动画结束后触发
|
||||
const afterClose = () => {
|
||||
formRef.value.resetFields();
|
||||
addFrom.value = {
|
||||
name: "",
|
||||
status: 1,
|
||||
taskType: 0,
|
||||
cron: "",
|
||||
every: null,
|
||||
service: "",
|
||||
startDate: "",
|
||||
misfirePolicy: 1,
|
||||
remark: ""
|
||||
};
|
||||
};
|
||||
const onTaskTypeChange = (value: number) => {
|
||||
if (value == 0) return (addFrom.value.every = null);
|
||||
addFrom.value.cron = "";
|
||||
addFrom.value.startDate = "";
|
||||
};
|
||||
const onUpdate = (row: any) => {
|
||||
title.value = "修改任务";
|
||||
addFrom.value = deepClone(row);
|
||||
open.value = true;
|
||||
};
|
||||
|
||||
const onLogs = (row: any) => {
|
||||
router.push({
|
||||
path: "/monitor/crontab-logs",
|
||||
query: {
|
||||
id: row.id,
|
||||
name: row.name
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 获取列表
|
||||
const loading = ref(false);
|
||||
const pagination = ref({
|
||||
pageSize: 10,
|
||||
showPageSize: true
|
||||
});
|
||||
const list = ref([]);
|
||||
const getCrontab = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
let res = await getCrontabAPI();
|
||||
list.value = res.data;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
getCrontab();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.text-right-gap {
|
||||
margin-right: $margin;
|
||||
}
|
||||
</style>
|
||||
@@ -1,114 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-space wrap>
|
||||
<a-input v-model="form.loginLocation" placeholder="请输入登录地址" allow-clear />
|
||||
<a-input v-model="form.userName" placeholder="请输入账户名称" allow-clear />
|
||||
<a-range-picker v-model="form.loginTime" show-time format="YYYY-MM-DD HH:mm" allow-clear />
|
||||
<a-button type="primary" @click="search">
|
||||
<template #icon><icon-search /></template>
|
||||
<span>查询</span>
|
||||
</a-button>
|
||||
<a-button @click="reset">
|
||||
<template #icon><icon-refresh /></template>
|
||||
<span>重置</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
|
||||
<a-table
|
||||
row-key="id"
|
||||
:data="list"
|
||||
:bordered="{ cell: true }"
|
||||
:loading="loading"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||
:pagination="pagination"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="序号" :width="64">
|
||||
<template #cell="cell">{{ cell.rowIndex + 1 }}</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="会话编号" data-index="tokenId" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="登录账户" data-index="userName" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="部门名称" data-index="deptName" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="IP地址" data-index="ipaddr" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="登录地址" data-index="loginLocation" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="状态" data-index="status" align="center" :width="80">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-badge status="success" text="在线" v-if="record.status == 1" />
|
||||
<a-badge status="normal" text="离线" v-else />
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="浏览器" data-index="browser" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="操作系统" data-index="os" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="登录时间" data-index="loginTime" ellipsis tooltip></a-table-column>
|
||||
<a-table-column title="操作" :width="100" align="center" :fixed="'right'">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-popconfirm type="warning" content="确定强制退出该账号吗?" @ok="onLogout(record)">
|
||||
<a-button type="primary" status="danger" size="mini">
|
||||
<template #icon><icon-export /></template>
|
||||
<span>强退</span>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getOnlineuserAPI } from "@/api/modules/monitor/index";
|
||||
defineOptions({ name: "onlineuser" });
|
||||
const form = ref({
|
||||
loginLocation: "",
|
||||
userName: "",
|
||||
loginTime: []
|
||||
});
|
||||
const search = () => {
|
||||
getOnlineuser();
|
||||
};
|
||||
const reset = () => {
|
||||
form.value = {
|
||||
loginLocation: "",
|
||||
userName: "",
|
||||
loginTime: []
|
||||
};
|
||||
getOnlineuser();
|
||||
};
|
||||
|
||||
const onLogout = (row: any) => {
|
||||
console.log("退出", row);
|
||||
arcoMessage("success", "模拟退出成功");
|
||||
getOnlineuser();
|
||||
};
|
||||
|
||||
// 获取列表
|
||||
const loading = ref(false);
|
||||
const pagination = ref({
|
||||
pageSize: 10,
|
||||
showPageSize: true
|
||||
});
|
||||
const list = ref([]);
|
||||
const getOnlineuser = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
let res = await getOnlineuserAPI();
|
||||
list.value = res.data;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
getOnlineuser();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.text-right-gap {
|
||||
margin-right: $margin;
|
||||
}
|
||||
</style>
|
||||
@@ -1,14 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<div>二级-菜单 页面缓存</div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入内容测试页面缓存" allow-clear v-model="form" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const form = ref("");
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,14 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<div>三级-菜单-01 页面缓存</div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入内容测试页面缓存" allow-clear v-model="form" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const form = ref("");
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,14 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<div>三级-菜单-02 页面缓存</div>
|
||||
<a-input :style="{ width: '320px' }" placeholder="请输入内容测试页面缓存" allow-clear v-model="form" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const form = ref("");
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,11 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<div>三级-菜单-03</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -55,7 +55,7 @@
|
||||
<span>商户订单</span>
|
||||
</div>
|
||||
<div class="detail-value">
|
||||
<a-typography-text :copyable="{ text: detailData.order_id }">{{ detailData.order_id }}</a-typography-text>
|
||||
<a-typography-text copyable>{{ detailData.order_id }}</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
</a-col>
|
||||
@@ -66,7 +66,7 @@
|
||||
<span>交易编号</span>
|
||||
</div>
|
||||
<div class="detail-value">
|
||||
<a-typography-text :copyable="{ text: detailData.trade_id }">{{ detailData.trade_id }}</a-typography-text>
|
||||
<a-typography-text copyable>{{ detailData.trade_id }}</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
</a-col>
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-alert>
|
||||
当前页面
|
||||
<a-tag color="green"> 超级管理员 </a-tag>
|
||||
可查看,
|
||||
<a-tag color="orange"> 普通角色 </a-tag>
|
||||
无法查看
|
||||
</a-alert>
|
||||
|
||||
<br />
|
||||
<a-card hoverable title="根据角色判断页面是否显示">
|
||||
<a-typography-paragraph> <a-typography-text bold> 当前页面权限 </a-typography-text></a-typography-paragraph>
|
||||
<s-code-view :code-json="pageRule" style="width: 100%" />
|
||||
<br />
|
||||
<a-typography-paragraph> <a-typography-text bold> 当前角色权限 </a-typography-text></a-typography-paragraph>
|
||||
<s-code-view :code-json="roles" style="width: 100%" />
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useUserInfoStore } from "@/store/modules/user-info";
|
||||
const route = useRoute();
|
||||
let userInfoStore = useUserInfoStore();
|
||||
let { account } = storeToRefs(userInfoStore);
|
||||
const roles = computed(() => JSON.stringify(account.value.roles, null));
|
||||
const pageRule = computed(() => JSON.stringify(route.meta.roles, null));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,96 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-alert>
|
||||
当前页面
|
||||
<a-tag color="green"> 超级管理员 </a-tag>
|
||||
和
|
||||
<a-tag color="green"> 普通角色 </a-tag>
|
||||
都可查看
|
||||
</a-alert>
|
||||
<br />
|
||||
<a-card hoverable title="根据用户权限判断">
|
||||
<div>
|
||||
<a-typography-paragraph> <a-typography-text bold> 当前用户权限 </a-typography-text></a-typography-paragraph>
|
||||
<s-code-view :code-json="permissions" style="width: 100%" />
|
||||
<br />
|
||||
<a-row :gutter="[24, 12]">
|
||||
<a-col :span="24">
|
||||
<s-code-view type="vue" :code-json="sysBtn" style="width: 100%" />
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-space>
|
||||
<span>权限按钮:</span>
|
||||
<a-button v-hasPerm="['sys:btn:add']" type="primary">新增</a-button>
|
||||
<a-button v-hasPerm="['sys:btn:edit']" type="primary" status="success">编辑</a-button>
|
||||
<a-button v-hasPerm="['sys:btn:delete']" type="primary" status="danger">删除</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<br />
|
||||
<a-row :gutter="[24, 12]">
|
||||
<a-col :span="24">
|
||||
<s-code-view type="vue" :code-json="commonBtn" style="width: 100%" />
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-space>
|
||||
<span>权限按钮:</span>
|
||||
<a-button v-hasPerm="['common:btn:add']" type="primary">新增</a-button>
|
||||
<a-button v-hasPerm="['common:btn:edit']" type="primary" status="success">编辑</a-button>
|
||||
<a-button v-hasPerm="['common:btn:delete']" type="primary" status="danger">删除</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</a-card>
|
||||
<br />
|
||||
<a-card hoverable title="根据角色权限判断">
|
||||
<div>
|
||||
<a-typography-paragraph> <a-typography-text bold> 当前角色权限 </a-typography-text></a-typography-paragraph>
|
||||
<s-code-view :code-json="roles" style="width: 100%" />
|
||||
<br />
|
||||
<a-row :gutter="[24, 12]">
|
||||
<a-col :span="24">
|
||||
<s-code-view type="vue" :code-json="roleBtn" style="width: 100%" />
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-space>
|
||||
<span>权限按钮:</span>
|
||||
<a-button v-hasRole="['admin']" type="primary">超级管理员</a-button>
|
||||
<a-button v-hasRole="['common']" type="primary" status="success">普通角色</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useUserInfoStore } from "@/store/modules/user-info";
|
||||
let userInfoStore = useUserInfoStore();
|
||||
let { account } = storeToRefs(userInfoStore);
|
||||
const permissions = computed(() => JSON.stringify(account.value.permissions, null));
|
||||
const roles = computed(() => JSON.stringify(account.value.roles, null));
|
||||
|
||||
let sysBtn = `<a-space>
|
||||
<a-button v-hasPerm="['sys:btn:add']" type="primary">新增</a-button>
|
||||
<a-button v-hasPerm="['sys:btn:edit']" type="primary" status="success">编辑</a-button>
|
||||
<a-button v-hasPerm="['sys:btn:delete']" type="primary" status="danger">删除</a-button>
|
||||
</a-space>`;
|
||||
|
||||
let commonBtn = `<a-space>
|
||||
<a-button v-hasPerm="['common:btn:add']" type="primary">新增</a-button>
|
||||
<a-button v-hasPerm="['common:btn:edit']" type="primary" status="success">编辑</a-button>
|
||||
<a-button v-hasPerm="['common:btn:delete']" type="primary" status="danger">删除</a-button>
|
||||
</a-space>`;
|
||||
|
||||
let roleBtn = `<a-space>
|
||||
<a-button v-hasRole="['admin']" type="primary">超级管理员</a-button>
|
||||
<a-button v-hasRole="['common']" type="primary" status="success">普通角色</a-button>
|
||||
</a-space>`;
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,34 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-alert>
|
||||
当前页面
|
||||
<a-tag color="green"> 超级管理员 </a-tag>
|
||||
和
|
||||
<a-tag color="green"> 普通角色 </a-tag>
|
||||
都可查看
|
||||
</a-alert>
|
||||
|
||||
<br />
|
||||
<a-card hoverable title="根据角色判断页面是否显示">
|
||||
<a-typography-paragraph> <a-typography-text bold> 当前页面权限 </a-typography-text></a-typography-paragraph>
|
||||
<s-code-view :code-json="pageRule" style="width: 100%" />
|
||||
<br />
|
||||
<a-typography-paragraph> <a-typography-text bold> 当前角色权限 </a-typography-text></a-typography-paragraph>
|
||||
<s-code-view :code-json="roles" style="width: 100%" />
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useUserInfoStore } from "@/store/modules/user-info";
|
||||
const route = useRoute();
|
||||
let userInfoStore = useUserInfoStore();
|
||||
let { account } = storeToRefs(userInfoStore);
|
||||
const roles = computed(() => JSON.stringify(account.value.roles, null));
|
||||
const pageRule = computed(() => JSON.stringify(route.meta.roles, null));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,144 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-row align="center" :gutter="[0, 16]">
|
||||
<a-col :span="24">
|
||||
<a-card title="实名认证">
|
||||
<template #extra>
|
||||
<a-link>修改认证信息</a-link>
|
||||
</template>
|
||||
<a-space direction="vertical" size="large">
|
||||
<a-descriptions :column="3" :align="{ label: 'right' }" table-layout="fixed">
|
||||
<a-descriptions-item v-for="item of data" :key="item.label" :label="item.label">
|
||||
<a-tag v-if="item.label == '实名认证:'" :color="item.value == 1 ? 'green' : 'red'">{{
|
||||
item.value == 1 ? "已认证" : "未认证"
|
||||
}}</a-tag>
|
||||
<span v-else>{{ item.value }}</span>
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-space>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-card title="认证记录">
|
||||
<a-table :columns="tableColumns" :data="tableData" size="small">
|
||||
<template #status="{ record }">
|
||||
<a-space>
|
||||
<a-space>
|
||||
<a-badge status="success" text="已通过" v-if="record.status == 1" />
|
||||
<a-badge status="processing" text="审核中" v-else />
|
||||
</a-space>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #optional>
|
||||
<a-space>
|
||||
<a-button size="mini" type="text">查看</a-button>
|
||||
<a-button size="mini" type="text">撤回</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const data = ref([
|
||||
{
|
||||
label: "用户ID:",
|
||||
value: "1000001"
|
||||
},
|
||||
{
|
||||
label: "用户名:",
|
||||
value: "admin"
|
||||
},
|
||||
{
|
||||
label: "用户昵称:",
|
||||
value: "兔子先森"
|
||||
},
|
||||
{
|
||||
label: "角色:",
|
||||
value: "系统管理员"
|
||||
},
|
||||
{
|
||||
label: "权限:",
|
||||
value: "全部"
|
||||
},
|
||||
{
|
||||
label: "实名认证:",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: "邮箱:",
|
||||
value: "2547096351@qq.com"
|
||||
},
|
||||
{
|
||||
label: "手机号:",
|
||||
value: "15888888888"
|
||||
},
|
||||
{
|
||||
label: "注册时间:",
|
||||
value: "2024-06-20"
|
||||
}
|
||||
]);
|
||||
|
||||
const tableColumns = ref([
|
||||
{
|
||||
title: "认证类型",
|
||||
dataIndex: "authenticationType"
|
||||
},
|
||||
{
|
||||
title: "认证内容",
|
||||
dataIndex: "authenticationContent"
|
||||
},
|
||||
{
|
||||
title: "当前状态",
|
||||
dataIndex: "status",
|
||||
align: "center",
|
||||
slotName: "status"
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
dataIndex: "createTime"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "operation",
|
||||
slotName: "optional",
|
||||
fixed: "right",
|
||||
width: 200
|
||||
}
|
||||
]);
|
||||
const tableData = reactive([
|
||||
{
|
||||
key: "1",
|
||||
authenticationType: "证件认证",
|
||||
authenticationContent: "实名认证,鉴定信息",
|
||||
status: "0",
|
||||
createTime: "2024-06-20 17:35:25"
|
||||
},
|
||||
{
|
||||
key: "2",
|
||||
authenticationType: "证件认证",
|
||||
authenticationContent: "实名认证,鉴定信息",
|
||||
status: "1",
|
||||
createTime: "2024-06-08 15:25:37"
|
||||
},
|
||||
{
|
||||
key: "3",
|
||||
authenticationType: "证件认证",
|
||||
authenticationContent: "实名认证,鉴定信息",
|
||||
status: "1",
|
||||
createTime: "2024-06-01 10:55:21"
|
||||
}
|
||||
]);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.row-title {
|
||||
font-size: $font-size-title-1;
|
||||
}
|
||||
.margin-bottom {
|
||||
margin-bottom: $padding;
|
||||
}
|
||||
</style>
|
||||
@@ -1,117 +0,0 @@
|
||||
<template>
|
||||
<a-row align="center" :gutter="[0, 16]">
|
||||
<a-col :span="24">
|
||||
<a-card title="基本信息">
|
||||
<a-form :model="form" :rules="rules" :style="{ width: '600px' }" @submit="onSubmit">
|
||||
<a-form-item field="userId" label="用户ID">
|
||||
<a-input v-model="form.userId" disabled />
|
||||
</a-form-item>
|
||||
<a-form-item field="username" label="用户名">
|
||||
<a-input v-model="form.username" placeholder="请输入用户名" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="nickname" label="用户昵称">
|
||||
<a-input v-model="form.nickname" placeholder="请输入用户昵称" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="role" label="角色">
|
||||
<a-select :style="{ width: '320px' }" v-model="form.role" placeholder="请选择角色" allow-clear>
|
||||
<a-option>系统管理员</a-option>
|
||||
<a-option>普通角色</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="address" label="所在区域">
|
||||
<a-cascader
|
||||
v-model="form.address"
|
||||
:options="options"
|
||||
expand-trigger="hover"
|
||||
:style="{ width: '320px' }"
|
||||
placeholder="请选择所在区域"
|
||||
allow-clear
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item field="introduce" label="简介">
|
||||
<a-textarea placeholder="请输入简介" v-model="form.introduce" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" html-type="submit">提交</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import useGlobalProperties from "@/hooks/useGlobalProperties";
|
||||
const proxy = useGlobalProperties();
|
||||
const form = ref({
|
||||
userId: "1000001",
|
||||
username: "admin",
|
||||
nickname: "兔子先森",
|
||||
role: "系统管理员",
|
||||
address: "guanggu",
|
||||
introduce: ""
|
||||
});
|
||||
const rules = {
|
||||
userId: [
|
||||
{
|
||||
required: true,
|
||||
message: "用户ID不能为空"
|
||||
}
|
||||
],
|
||||
username: [
|
||||
{
|
||||
required: true,
|
||||
message: "用户名不能为空"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const options = ref([
|
||||
{
|
||||
value: "hubei",
|
||||
label: "湖北",
|
||||
children: [
|
||||
{
|
||||
value: "wuhan",
|
||||
label: "武汉",
|
||||
children: [
|
||||
{
|
||||
value: "guanggu",
|
||||
label: "光谷"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
value: "xiaogan",
|
||||
label: "孝感"
|
||||
},
|
||||
{
|
||||
value: "jingzhou",
|
||||
label: "荆州"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
value: "hunan",
|
||||
label: "湖南",
|
||||
children: [
|
||||
{
|
||||
value: "changsha",
|
||||
label: "长沙"
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
const onSubmit = ({ errors }: ArcoDesign.ArcoSubmit) => {
|
||||
if (errors) return;
|
||||
proxy.$message.success("修改基本信息");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.row-title {
|
||||
font-size: $font-size-title-1;
|
||||
}
|
||||
</style>
|
||||
@@ -1,69 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-row align="center" :gutter="[0, 16]">
|
||||
<a-col :span="24">
|
||||
<a-card title="安全设置">
|
||||
<a-form :model="form" :rules="rules" :style="{ width: '600px' }" @submit="onSubmit">
|
||||
<a-form-item field="password" label="登录密码">
|
||||
<a-input-password v-model="form.password" placeholder="请输入登录密码" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="phone" label="安全手机">
|
||||
<a-input v-model="form.phone" placeholder="请输入安全手机" allow-clear>
|
||||
<template #prepend> +86 </template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item field="email" label="安全邮箱">
|
||||
<a-input v-model="form.email" placeholder="请输入安全邮箱" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="question" label="密保问题">
|
||||
<a-input v-model="form.question" placeholder="请输入密保问题" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="answer" label="密保答案">
|
||||
<a-input v-model="form.answer" placeholder="请输入密保答案" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button type="primary" html-type="submit">提交</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import useGlobalProperties from "@/hooks/useGlobalProperties";
|
||||
const proxy = useGlobalProperties();
|
||||
const form = ref({
|
||||
password: "123456",
|
||||
phone: "15888888888",
|
||||
email: "",
|
||||
question: "",
|
||||
answer: ""
|
||||
});
|
||||
const rules = {
|
||||
password: [
|
||||
{
|
||||
required: true,
|
||||
message: "登录密码不能为空"
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
required: true,
|
||||
message: "安全手机不能为空"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const onSubmit = ({ errors }: ArcoDesign.ArcoSubmit) => {
|
||||
if (errors) return;
|
||||
proxy.$message.success("修改安全设置");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.row-title {
|
||||
font-size: $font-size-title-1;
|
||||
}
|
||||
</style>
|
||||
@@ -1,104 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="container">
|
||||
<a-card :bordered="false">
|
||||
<a-row align="center">
|
||||
<a-col :span="2">
|
||||
<div>
|
||||
<a-avatar :size="100" @click="toast" trigger-type="mask">
|
||||
<img alt="avatar" :src="myImage" />
|
||||
<template #trigger-icon>
|
||||
<IconEdit />
|
||||
</template>
|
||||
</a-avatar>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="22">
|
||||
<a-space direction="vertical" size="large">
|
||||
<a-descriptions :data="data" :column="3" title="用户资料" :align="{ label: 'right' }" />
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
<a-card class="margin-top" :bordered="false">
|
||||
<a-row align="center">
|
||||
<a-col :span="24">
|
||||
<a-tabs :type="type" :size="size">
|
||||
<a-tab-pane key="1" title="基本信息">
|
||||
<BasicInfo />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" title="安全设置">
|
||||
<SecuritySettings />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="3" title="实名认证">
|
||||
<Accreditation />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-col>
|
||||
<a-col :span="24"> </a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import myImage from "@/assets/img/my-image.jpg";
|
||||
import BasicInfo from "@/views/personal/user-settings/components/basic-info.vue";
|
||||
import SecuritySettings from "@/views/personal/user-settings/components/security-settings.vue";
|
||||
import Accreditation from "@/views/personal/user-settings/components/accreditation.vue";
|
||||
import useGlobalProperties from "@/hooks/useGlobalProperties";
|
||||
const proxy = useGlobalProperties();
|
||||
|
||||
const type = ref("rounded");
|
||||
const size = ref("medium");
|
||||
|
||||
const data = ref([
|
||||
{
|
||||
label: "用户ID:",
|
||||
value: "1000001"
|
||||
},
|
||||
{
|
||||
label: "用户名:",
|
||||
value: "admin"
|
||||
},
|
||||
{
|
||||
label: "用户昵称:",
|
||||
value: "兔子先森"
|
||||
},
|
||||
{
|
||||
label: "角色:",
|
||||
value: "系统管理员"
|
||||
},
|
||||
{
|
||||
label: "权限:",
|
||||
value: "全部"
|
||||
},
|
||||
{
|
||||
label: "实名认证:",
|
||||
value: "已认证"
|
||||
},
|
||||
{
|
||||
label: "邮箱:",
|
||||
value: "2547096351@qq.com"
|
||||
},
|
||||
{
|
||||
label: "手机号:",
|
||||
value: "15888888888"
|
||||
},
|
||||
{
|
||||
label: "注册时间:",
|
||||
value: "2024-06-20"
|
||||
}
|
||||
]);
|
||||
|
||||
const toast = () => {
|
||||
proxy.$message.info("修改头像");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.margin-top {
|
||||
margin-top: $padding;
|
||||
}
|
||||
</style>
|
||||
@@ -1,143 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<div class="my-avatar">
|
||||
<a-avatar :size="100">
|
||||
<img alt="avatar" :src="myImage" />
|
||||
</a-avatar>
|
||||
<div class="my-name">
|
||||
<div class="my-title title-size-1">兔子先森</div>
|
||||
<div class="my-local"><icon-location />浙江杭州</div>
|
||||
</div>
|
||||
</div>
|
||||
<a-grid :cols="{ xs: 1, sm: 1, md: 1, lg: 2, xl: 3 }" :col-gap="16" :row-gap="16">
|
||||
<a-grid-item>
|
||||
<div class="title-size-1">👋关于我</div>
|
||||
<div class="type-row" v-for="item in list.aboutMe" :key="item.label">
|
||||
<div class="column-title-size-1">{{ item.label }}:</div>
|
||||
<div v-for="(type, index) in item.value" :key="index">
|
||||
<a-tag :color="item.theme">
|
||||
{{ type }}
|
||||
</a-tag>
|
||||
</div>
|
||||
</div>
|
||||
</a-grid-item>
|
||||
<a-grid-item>
|
||||
<div class="title-size-1">💬联系我</div>
|
||||
<div class="type-row" v-for="item in list.callMe" :key="item.label">
|
||||
<div class="column-title-size-2">{{ item.label }}:</div>
|
||||
<div :class="item.link ? 'link-hover' : ''" @click="onLink(item)">{{ item.value }}</div>
|
||||
</div>
|
||||
</a-grid-item>
|
||||
<a-grid-item>
|
||||
<div class="title-size-1">🐾其它</div>
|
||||
<div class="type-row" v-for="item in list.other" :key="item.label">
|
||||
<div class="column-title-size-2">{{ item.label }}:</div>
|
||||
<div>{{ item.value }}</div>
|
||||
</div>
|
||||
<a-image width="100" :src="officialAccount" />
|
||||
</a-grid-item>
|
||||
<a-grid-item>
|
||||
<a-image default-scale height="220" :src="otherImage" />
|
||||
</a-grid-item>
|
||||
<a-grid-item>
|
||||
<div class="title-size-2">✨Hello 朋友们✨</div>
|
||||
<div class="type-row" v-for="item in list.introduce" :key="item.label">
|
||||
<div class="text-ellipsis">{{ item.label }}</div>
|
||||
</div>
|
||||
</a-grid-item>
|
||||
</a-grid>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import myImage from "@/assets/img/my-image.jpg";
|
||||
import otherImage from "@/assets/img/other-image.jpg";
|
||||
import officialAccount from "@/assets/img/official-account.png";
|
||||
|
||||
const list = reactive({
|
||||
aboutMe: [
|
||||
{ label: "🐦我用语雀", value: ["知识管理", "记录生活"], theme: "green" },
|
||||
{ label: "💫个性性格", value: ["天秤座", "INFJ-T"], theme: "blue" },
|
||||
{ label: "💼职业工作", value: ["互联网", "前端开发"], theme: "orangered" },
|
||||
{ label: "🏠现居城市", value: ["杭州"], theme: "magenta" },
|
||||
{ label: "💙兴趣爱好", value: ["读书", "音乐", "狗狗🐕"], theme: "purple" }
|
||||
],
|
||||
callMe: [
|
||||
{ label: "📧邮箱", value: "2547096351@qq.com", link: false },
|
||||
{ label: "📠微信", value: "fanction-w", link: false },
|
||||
{ label: "🛰️github", value: "兔子先森", link: true, url: "https://github.com/WangFan-io" },
|
||||
{ label: "📚思否", value: "兔子先森", link: true, url: "https://segmentfault.com/blog/dcodes" },
|
||||
{ label: "✒️掘金", value: "兔子先森Ace", link: true, url: "https://juejin.cn/user/1728883023940600/posts" }
|
||||
],
|
||||
other: [
|
||||
{ label: "🧭公众号", value: "DCodes" },
|
||||
{ label: "🌟公众号二维码", value: "" }
|
||||
],
|
||||
introduce: [
|
||||
{ label: "👋欢迎来到兔子先森的project,记录思考成长,一起进步" },
|
||||
{ label: "🔖长期主义者一枚,持续学习拓展思维及方法论" },
|
||||
{ label: "🤔行业瞬息万变,时刻关注行业最新资讯" },
|
||||
{ label: "🤝职场相处沟通都需要技巧,持续记录学习职场二三事" },
|
||||
{ label: "🌈人生多彩,除了工作还有很大的世界供我们探索,Let's go!" }
|
||||
]
|
||||
});
|
||||
|
||||
const onLink = (item: any) => {
|
||||
if (!item.link) return;
|
||||
window.open(item.url);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.border {
|
||||
border: 1px solid red;
|
||||
}
|
||||
.my-avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: calc($margin * 2);
|
||||
.my-name {
|
||||
height: 60px;
|
||||
margin-left: $margin;
|
||||
.my-title {
|
||||
height: 30px;
|
||||
}
|
||||
.my-local {
|
||||
display: flex;
|
||||
align-items: end;
|
||||
height: 30px;
|
||||
font-size: $font-size-body-3;
|
||||
}
|
||||
}
|
||||
}
|
||||
.type-row {
|
||||
display: flex;
|
||||
column-gap: $margin;
|
||||
align-items: center;
|
||||
height: 25px;
|
||||
margin-top: $margin;
|
||||
.column-title-size-1 {
|
||||
min-width: 90px;
|
||||
}
|
||||
.column-title-size-2 {
|
||||
min-width: 68px;
|
||||
}
|
||||
.text-ellipsis {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
.title-size-1 {
|
||||
font-size: $font-size-title-1;
|
||||
font-weight: bold;
|
||||
}
|
||||
.title-size-2 {
|
||||
font-size: $font-size-title-2;
|
||||
font-weight: bold;
|
||||
}
|
||||
.link-hover {
|
||||
color: $color-primary;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -1,384 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-fill">
|
||||
<div class="snow-fill-inner container">
|
||||
<div class="left-box">
|
||||
<a-input placeholder="请输入部门名称">
|
||||
<template #prefix>
|
||||
<icon-search />
|
||||
</template>
|
||||
</a-input>
|
||||
<div class="tree-box">
|
||||
<a-tree ref="treeRef" :field-names="fieldNames" :data="treeData" show-line @select="onSelectTree"> </a-tree>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-box">
|
||||
<a-space wrap>
|
||||
<a-input v-model="form.name" placeholder="请输入用户名称" allow-clear />
|
||||
<a-input v-model="form.phone" placeholder="请输入手机号码" allow-clear />
|
||||
<a-select placeholder="用户状态" v-model="form.status" style="width: 120px" allow-clear>
|
||||
<a-option v-for="item in openState" :key="item.value" :value="item.value">{{ item.name }}</a-option>
|
||||
</a-select>
|
||||
<a-range-picker v-model="form.createTime" show-time format="YYYY-MM-DD HH:mm" allow-clear />
|
||||
<a-button type="primary" @click="search">
|
||||
<template #icon><icon-search /></template>
|
||||
<span>查询</span>
|
||||
</a-button>
|
||||
<a-button @click="reset">
|
||||
<template #icon><icon-refresh /></template>
|
||||
<span>重置</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
|
||||
<a-row>
|
||||
<a-space wrap>
|
||||
<a-button type="primary" @click="onAdd">
|
||||
<template #icon><icon-plus /></template>
|
||||
<span>新增</span>
|
||||
</a-button>
|
||||
<a-button type="primary" status="danger">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-row>
|
||||
|
||||
<a-table
|
||||
row-key="id"
|
||||
:data="accountList"
|
||||
:bordered="{ cell: true }"
|
||||
:loading="loading"
|
||||
:scroll="{ x: '120%', y: '100%' }"
|
||||
:pagination="pagination"
|
||||
:row-selection="{ type: 'checkbox', showCheckedAll: true }"
|
||||
:selected-keys="selectedKeys"
|
||||
@select="select"
|
||||
@select-all="selectAll"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="序号" :width="64">
|
||||
<template #cell="cell">{{ cell.rowIndex + 1 }}</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="用户名称" data-index="userName"></a-table-column>
|
||||
<a-table-column title="昵称" data-index="nickName"></a-table-column>
|
||||
<a-table-column title="性别" data-index="sex" align="center">
|
||||
<template #cell="{ record }">
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.sex == 1">男</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else-if="record.sex == 0">女</a-tag>
|
||||
<a-tag bordered size="small" v-else>未知</a-tag>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="部门" data-index="deptName"></a-table-column>
|
||||
<a-table-column title="手机号" data-index="phone" :width="180"></a-table-column>
|
||||
<a-table-column title="状态" :width="100" align="center">
|
||||
<template #cell="{ record }">
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.status === 1">启用</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>禁用</a-tag>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="描述" data-index="description" :ellipsis="true" :tooltip="true"></a-table-column>
|
||||
<a-table-column title="创建时间" data-index="createTime" :width="180"></a-table-column>
|
||||
<a-table-column title="操作" :width="200" align="center" :fixed="'right'">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-button type="primary" size="mini" @click="onUpdate(record)">
|
||||
<template #icon><icon-edit /></template>
|
||||
<span>修改</span>
|
||||
</a-button>
|
||||
<a-popconfirm type="warning" content="确定删除该账号吗?">
|
||||
<a-button type="primary" status="danger" size="mini" :disabled="record.admin">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
<a-tooltip content="用户详情">
|
||||
<a-button type="primary" status="success" size="mini" @click="onDetail(record)">
|
||||
<template #icon>
|
||||
<icon-more />
|
||||
</template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a-modal width="40%" v-model:visible="open" @close="afterClose" @ok="handleOk" @cancel="afterClose">
|
||||
<template #title> {{ title }} </template>
|
||||
<div>
|
||||
<a-form ref="formRef" auto-label-width :rules="rules" :model="addFrom">
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="userName" label="用户名称" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.userName" placeholder="请输入用户名称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="nickName" label="昵称" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.nickName" placeholder="请输入昵称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="phone" label="手机号码" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.phone" placeholder="请输入手机号码" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="email" label="邮箱" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.email" placeholder="请输入邮箱" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item field="sex" label="性别" validate-trigger="blur">
|
||||
<a-radio-group v-model="addFrom.sex" :options="sexOption">
|
||||
<template #label="{ data }">
|
||||
<div>{{ data.name }}</div>
|
||||
</template>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item field="deptId" label="所属部门" validate-trigger="blur">
|
||||
<a-tree-select
|
||||
v-model="addFrom.deptId"
|
||||
:data="treeData"
|
||||
:field-names="{
|
||||
key: 'id',
|
||||
title: 'name',
|
||||
children: 'children'
|
||||
}"
|
||||
placeholder="请选择所属部门"
|
||||
></a-tree-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="roles" label="角色" validate-trigger="blur">
|
||||
<a-select v-model="addFrom.roles" multiple placeholder="请选择角色">
|
||||
<a-option
|
||||
v-for="item in roleList"
|
||||
:key="item.code"
|
||||
:value="item.code"
|
||||
:label="item.name"
|
||||
:disabled="item.admin"
|
||||
></a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="status" label="状态" validate-trigger="blur">
|
||||
<a-switch type="round" :checked-value="1" :unchecked-value="0" v-model="addFrom.status">
|
||||
<template #checked> 启用 </template>
|
||||
<template #unchecked> 禁用 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
<a-form-item field="description" label="描述" validate-trigger="blur">
|
||||
<a-textarea v-model="addFrom.description" placeholder="请输入描述" allow-clear />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getDivisionAPI, getAccountAPI, getRoleAPI } from "@/api/modules/system/index";
|
||||
import { deepClone } from "@/utils";
|
||||
|
||||
const router = useRouter();
|
||||
const openState = ref(dictFilter("status"));
|
||||
const sexOption = ref(dictFilter("gender"));
|
||||
const form = ref({
|
||||
name: "",
|
||||
phone: "",
|
||||
status: null,
|
||||
createTime: []
|
||||
});
|
||||
const search = () => {
|
||||
getAccount();
|
||||
};
|
||||
const reset = () => {
|
||||
form.value = {
|
||||
name: "",
|
||||
phone: "",
|
||||
status: null,
|
||||
createTime: []
|
||||
};
|
||||
getAccount();
|
||||
};
|
||||
// 新增
|
||||
const open = ref(false);
|
||||
const rules = {
|
||||
userName: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入用户名称"
|
||||
}
|
||||
],
|
||||
nickName: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入昵称"
|
||||
}
|
||||
],
|
||||
sex: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择性别"
|
||||
}
|
||||
],
|
||||
deptId: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择所属部门"
|
||||
}
|
||||
],
|
||||
roles: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择角色"
|
||||
}
|
||||
],
|
||||
status: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择状态"
|
||||
}
|
||||
]
|
||||
};
|
||||
const addFrom = ref<any>({
|
||||
userName: "",
|
||||
nickName: "",
|
||||
phone: "",
|
||||
email: "",
|
||||
sex: 2,
|
||||
deptId: null,
|
||||
roles: [],
|
||||
status: 1,
|
||||
description: ""
|
||||
});
|
||||
const formType = ref(0); // 0新增 1修改
|
||||
const title = ref("");
|
||||
const formRef = ref();
|
||||
const onAdd = () => {
|
||||
title.value = "新增账号";
|
||||
formType.value = 0;
|
||||
open.value = true;
|
||||
};
|
||||
const handleOk = async () => {
|
||||
let state = await formRef.value.validate();
|
||||
if (state) return (open.value = true); // 校验不通过
|
||||
arcoMessage("success", "模拟提交成功");
|
||||
getAccount();
|
||||
};
|
||||
// 关闭对话框动画结束后触发
|
||||
const afterClose = () => {
|
||||
formRef.value.resetFields();
|
||||
addFrom.value = {
|
||||
userName: "",
|
||||
nickName: "",
|
||||
phone: "",
|
||||
email: "",
|
||||
sex: 2,
|
||||
deptId: null,
|
||||
roles: [],
|
||||
status: 1,
|
||||
description: ""
|
||||
};
|
||||
};
|
||||
const onUpdate = (row: any) => {
|
||||
title.value = "修改账号";
|
||||
formType.value = 1;
|
||||
addFrom.value = deepClone(row);
|
||||
open.value = true;
|
||||
};
|
||||
|
||||
const onDetail = (row: any) => {
|
||||
console.log(row);
|
||||
|
||||
router.push({
|
||||
path: "/system/userinfo",
|
||||
query: {
|
||||
id: row.id,
|
||||
userName: row.userName
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const loading = ref(false);
|
||||
const pagination = ref({
|
||||
pageSize: 10,
|
||||
showPageSize: true
|
||||
});
|
||||
|
||||
// 账户
|
||||
const accountList = ref();
|
||||
const getAccount = async () => {
|
||||
loading.value = true;
|
||||
let res = await getAccountAPI();
|
||||
res.data.forEach((item: any) => item.admin && (item.disabled = true));
|
||||
accountList.value = res.data;
|
||||
loading.value = false;
|
||||
};
|
||||
const selectedKeys = ref([]);
|
||||
const select = (list: []) => {
|
||||
selectedKeys.value = list;
|
||||
};
|
||||
const selectAll = (state: boolean) => {
|
||||
selectedKeys.value = state ? (accountList.value.map((el: any) => el.id) as []) : [];
|
||||
};
|
||||
|
||||
// 部门树
|
||||
const fieldNames = ref({
|
||||
key: "id",
|
||||
title: "name",
|
||||
children: "children"
|
||||
});
|
||||
const treeData = ref();
|
||||
const treeRef = ref();
|
||||
const getDivision = async () => {
|
||||
let res = await getDivisionAPI();
|
||||
treeData.value = res.data;
|
||||
setTimeout(() => {
|
||||
treeRef.value.expandAll();
|
||||
}, 0);
|
||||
};
|
||||
const onSelectTree = () => {
|
||||
getAccount();
|
||||
};
|
||||
|
||||
// 角色列表
|
||||
const roleList = ref<any>([]);
|
||||
const getRole = async () => {
|
||||
let res = await getRoleAPI();
|
||||
roleList.value = res.data;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getDivision();
|
||||
getAccount();
|
||||
getRole();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
display: flex;
|
||||
column-gap: $padding;
|
||||
.left-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 250px;
|
||||
height: 100%;
|
||||
.tree-box {
|
||||
flex: 1;
|
||||
margin-top: $padding;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
.right-box {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,365 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<s-layout-tools>
|
||||
<template #left>
|
||||
<a-space wrap>
|
||||
<a-input v-model="form.name" placeholder="请输入字典名称" allow-clear />
|
||||
<a-input v-model="form.code" placeholder="请输入字典编码" allow-clear />
|
||||
<a-select placeholder="启用状态" v-model="form.status" style="width: 120px" allow-clear>
|
||||
<a-option v-for="item in openState" :key="item.value" :value="item.value">{{ item.name }}</a-option>
|
||||
</a-select>
|
||||
<a-button type="primary" @click="search">
|
||||
<template #icon><icon-search /></template>
|
||||
<span>查询</span>
|
||||
</a-button>
|
||||
<a-button @click="reset">
|
||||
<template #icon><icon-refresh /></template>
|
||||
<span>重置</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #right>
|
||||
<a-space wrap>
|
||||
<a-button type="primary" @click="onAdd">
|
||||
<template #icon><icon-plus /></template>
|
||||
<span>新增</span>
|
||||
</a-button>
|
||||
<a-button type="primary" status="danger">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</s-layout-tools>
|
||||
|
||||
<a-table
|
||||
row-key="id"
|
||||
:data="dictList"
|
||||
:bordered="{ cell: true }"
|
||||
:loading="loading"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||
:pagination="pagination"
|
||||
:row-selection="{ type: 'checkbox', showCheckedAll: true }"
|
||||
:selected-keys="selectedKeys"
|
||||
@select="select"
|
||||
@select-all="selectAll"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="序号" :width="64">
|
||||
<template #cell="cell">{{ cell.rowIndex + 1 }}</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="字典名称" data-index="name"></a-table-column>
|
||||
<a-table-column title="字典编码" data-index="code"></a-table-column>
|
||||
<a-table-column title="状态" :width="100" align="center">
|
||||
<template #cell="{ record }">
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.status === 1">启用</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>禁用</a-tag>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="描述" data-index="description" :ellipsis="true" :tooltip="true"></a-table-column>
|
||||
<a-table-column title="创建时间" data-index="createTime" :width="180"></a-table-column>
|
||||
<a-table-column title="操作" :width="280" align="center" :fixed="'right'">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-button type="primary" status="success" size="mini" @click="onDictData(record)">
|
||||
<template #icon><icon-file /></template>
|
||||
<span>字典值</span>
|
||||
</a-button>
|
||||
<a-button type="primary" size="mini" @click="onUpdate(record)">
|
||||
<template #icon><icon-edit /></template>
|
||||
<span>修改</span>
|
||||
</a-button>
|
||||
<a-popconfirm type="warning" content="确定删除该字典吗?">
|
||||
<a-button type="primary" status="danger" size="mini">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<a-modal v-model:visible="open" @close="afterClose" @ok="handleOk" @cancel="afterClose">
|
||||
<template #title> {{ title }} </template>
|
||||
<div>
|
||||
<a-form ref="formRef" auto-label-width :rules="rules" :model="addFrom">
|
||||
<a-form-item field="name" label="字典名称" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.name" placeholder="请输入字典名称" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="code" label="字典编码" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.code" placeholder="请输入字典编码" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="description" label="描述" validate-trigger="blur">
|
||||
<a-textarea v-model="addFrom.description" placeholder="请输入字典描述" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="description" label="状态" validate-trigger="blur">
|
||||
<a-switch type="round" :checked-value="1" :unchecked-value="0" v-model="addFrom.status">
|
||||
<template #checked> 启用 </template>
|
||||
<template #unchecked> 禁用 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-modal>
|
||||
|
||||
<a-modal width="50%" v-model:visible="detailOpen" @ok="detailOk" ok-text="关闭" :hide-cancel="true">
|
||||
<template #title> 字典详情 </template>
|
||||
<div>
|
||||
<a-row>
|
||||
<a-space wrap>
|
||||
<a-button type="primary" @click="onAddDetail">
|
||||
<template #icon><icon-plus /></template>
|
||||
<span>新增</span>
|
||||
</a-button>
|
||||
<a-button type="primary" status="danger">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-row>
|
||||
|
||||
<a-table
|
||||
row-key="id"
|
||||
:data="dictDetail.list"
|
||||
:bordered="{ cell: true }"
|
||||
:loading="detailLoading"
|
||||
:scroll="{ x: '100%', y: '100%' }"
|
||||
:pagination="pagination"
|
||||
:row-selection="{ type: 'checkbox', showCheckedAll: true }"
|
||||
:selected-keys="selectedKeysDetail"
|
||||
@select="selectDetail"
|
||||
@select-all="selectAllDetail"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="序号" :width="64">
|
||||
<template #cell="cell">{{ cell.rowIndex + 1 }}</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="字典名" data-index="name"></a-table-column>
|
||||
<a-table-column title="字典值" data-index="value"></a-table-column>
|
||||
<a-table-column title="状态" :width="100" align="center">
|
||||
<template #cell="{ record }">
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.status === 1">启用</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>禁用</a-tag>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="操作" align="center" :fixed="'right'">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-button type="primary" size="mini" @click="onDetailUpdate(record)">
|
||||
<template #icon><icon-edit /></template>
|
||||
<span>修改</span>
|
||||
</a-button>
|
||||
<a-popconfirm type="warning" content="确定删除该字典吗?">
|
||||
<a-button type="primary" status="danger" size="mini">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</a-modal>
|
||||
|
||||
<a-modal v-model:visible="detailCaseOpen" @close="afterCloseDetail" @ok="handleOkDetail" @cancel="afterCloseDetail">
|
||||
<template #title> {{ detailTitle }} </template>
|
||||
<div>
|
||||
<a-form ref="detailFormRef" auto-label-width :rules="detaulRules" :model="deatilForm">
|
||||
<a-form-item field="name" label="字典名称" validate-trigger="blur">
|
||||
<a-input v-model="deatilForm.name" placeholder="请输入字典名称" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="value" label="字典值" validate-trigger="blur">
|
||||
<a-input v-model="deatilForm.value" placeholder="请输入字典值" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="description" label="状态" validate-trigger="blur">
|
||||
<a-switch type="round" :checked-value="1" :unchecked-value="0" v-model="deatilForm.status">
|
||||
<template #checked> 启用 </template>
|
||||
<template #unchecked> 禁用 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getDictAPI } from "@/api/modules/system/index";
|
||||
import { deepClone } from "@/utils";
|
||||
const openState = ref(dictFilter("status"));
|
||||
const form = ref({
|
||||
name: "",
|
||||
code: "",
|
||||
status: null
|
||||
});
|
||||
const search = () => {
|
||||
getDict();
|
||||
};
|
||||
const reset = () => {
|
||||
form.value = {
|
||||
name: "",
|
||||
code: "",
|
||||
status: null
|
||||
};
|
||||
getDict();
|
||||
};
|
||||
|
||||
const open = ref<boolean>(false);
|
||||
const title = ref<string>("");
|
||||
const rules = {
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入字典名称"
|
||||
}
|
||||
],
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入字典编码"
|
||||
}
|
||||
],
|
||||
status: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择状态"
|
||||
}
|
||||
]
|
||||
};
|
||||
const addFrom = ref({
|
||||
name: "",
|
||||
code: "",
|
||||
description: "",
|
||||
status: 1
|
||||
});
|
||||
const formRef = ref();
|
||||
const onAdd = () => {
|
||||
open.value = true;
|
||||
title.value = "新增字典";
|
||||
};
|
||||
const handleOk = async () => {
|
||||
let state = await formRef.value.validate();
|
||||
if (state) return (open.value = true); // 校验不通过
|
||||
arcoMessage("success", "模拟提交成功");
|
||||
getDict();
|
||||
};
|
||||
// 关闭对话框动画结束后触发
|
||||
const afterClose = () => {
|
||||
formRef.value.resetFields();
|
||||
addFrom.value = {
|
||||
name: "",
|
||||
code: "",
|
||||
description: "",
|
||||
status: 1
|
||||
};
|
||||
};
|
||||
const onUpdate = (record: any) => {
|
||||
title.value = "修改字典";
|
||||
addFrom.value = deepClone(record);
|
||||
open.value = true;
|
||||
};
|
||||
|
||||
const loading = ref(false);
|
||||
const pagination = ref({
|
||||
pageSize: 10,
|
||||
showPageSize: true
|
||||
});
|
||||
const selectedKeys = ref([]);
|
||||
const select = (list: []) => {
|
||||
selectedKeys.value = list;
|
||||
};
|
||||
const selectAll = (state: boolean) => {
|
||||
selectedKeys.value = state ? (dictList.value.map((el: any) => el.id) as []) : [];
|
||||
};
|
||||
const dictList = ref();
|
||||
const getDict = async () => {
|
||||
loading.value = true;
|
||||
let res = await getDictAPI();
|
||||
dictList.value = res.data || [];
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
// 字典详情
|
||||
const detailLoading = ref(false);
|
||||
const detailOpen = ref(false);
|
||||
const dictDetail = ref({
|
||||
list: []
|
||||
});
|
||||
const onDictData = (record: any) => {
|
||||
detailLoading.value = true;
|
||||
dictDetail.value = record;
|
||||
detailOpen.value = true;
|
||||
detailLoading.value = false;
|
||||
};
|
||||
const detailOk = () => {
|
||||
detailOpen.value = false;
|
||||
};
|
||||
const deatilForm = ref({
|
||||
name: "",
|
||||
value: "",
|
||||
status: 1
|
||||
});
|
||||
const detaulRules = ref({
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入字典名称"
|
||||
}
|
||||
],
|
||||
value: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入字典值"
|
||||
}
|
||||
],
|
||||
status: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择状态"
|
||||
}
|
||||
]
|
||||
});
|
||||
const detailFormRef = ref();
|
||||
const detailTitle = ref("");
|
||||
const detailCaseOpen = ref(false);
|
||||
const onAddDetail = () => {
|
||||
detailTitle.value = "新增字典数据";
|
||||
detailCaseOpen.value = true;
|
||||
};
|
||||
const handleOkDetail = async () => {
|
||||
let state = await detailFormRef.value.validate();
|
||||
if (state) return (detailCaseOpen.value = true); // 校验不通过
|
||||
arcoMessage("success", "模拟提交成功");
|
||||
};
|
||||
const onDetailUpdate = (record: any) => {
|
||||
detailTitle.value = "修改字典数据";
|
||||
deatilForm.value = deepClone(record);
|
||||
detailCaseOpen.value = true;
|
||||
};
|
||||
// 关闭对话框动画结束后触发
|
||||
const afterCloseDetail = () => {
|
||||
detailFormRef.value.resetFields();
|
||||
deatilForm.value = {
|
||||
name: "",
|
||||
value: "",
|
||||
status: 1
|
||||
};
|
||||
};
|
||||
const selectedKeysDetail = ref([]);
|
||||
const selectDetail = (list: []) => {
|
||||
selectedKeysDetail.value = list;
|
||||
};
|
||||
const selectAllDetail = (state: boolean) => {
|
||||
selectedKeysDetail.value = state ? (dictDetail.value.list.map((el: any) => el.id) as []) : [];
|
||||
};
|
||||
|
||||
getDict();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,267 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<s-layout-tools>
|
||||
<template #left>
|
||||
<a-space wrap>
|
||||
<a-input v-model="form.name" placeholder="请输入部门名称" allow-clear />
|
||||
<a-select placeholder="部门状态" v-model="form.status" style="width: 120px" allow-clear>
|
||||
<a-option v-for="item in openState" :key="item.value" :value="item.value">{{ item.name }}</a-option>
|
||||
</a-select>
|
||||
<a-button type="primary" @click="search">
|
||||
<template #icon><icon-search /></template>
|
||||
<span>查询</span>
|
||||
</a-button>
|
||||
<a-button @click="reset">
|
||||
<template #icon><icon-refresh /></template>
|
||||
<span>重置</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #right>
|
||||
<a-space wrap>
|
||||
<a-button type="primary" @click="onAdd">
|
||||
<template #icon><icon-plus /></template>
|
||||
<span>新增</span>
|
||||
</a-button>
|
||||
<a-button type="primary" status="danger">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</s-layout-tools>
|
||||
<a-table
|
||||
ref="tableRef"
|
||||
:data="tableData"
|
||||
default-expand-all-rows
|
||||
:bordered="{ cell: true }"
|
||||
row-key="id"
|
||||
:loading="loading"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="部门名称">
|
||||
<template #cell="{ record }">
|
||||
{{ record.name }}
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="排序" data-index="sort" :width="100" align="center"></a-table-column>
|
||||
<a-table-column title="启用状态" align="center">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.status">启用</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>禁用</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="描述" data-index="description" :ellipsis="true" :tooltip="true"></a-table-column>
|
||||
<a-table-column title="创建时间" data-index="createTime" :ellipsis="true" :tooltip="true"></a-table-column>
|
||||
<a-table-column title="操作" align="center" :fixed="'right'">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-button size="mini" type="primary" @click="onUpdate(record)">
|
||||
<template #icon><icon-edit /></template>
|
||||
<span>修改</span>
|
||||
</a-button>
|
||||
<a-button size="mini" type="primary" status="success" @click="addDivision(record.id)">
|
||||
<template #icon><icon-plus /></template>
|
||||
<span>新增</span>
|
||||
</a-button>
|
||||
<a-popconfirm type="warning" content="确定删除该部门吗?">
|
||||
<a-button size="mini" type="primary" status="danger" v-if="record.id != '100'">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<a-modal width="40%" v-model:visible="open" @close="afterClose" @ok="handleOk" @cancel="afterClose">
|
||||
<template #title> {{ title }} </template>
|
||||
<div>
|
||||
<a-form ref="formRef" auto-label-width :rules="rules" :model="addFrom">
|
||||
<a-form-item field="parentId" label="上级部门" validate-trigger="blur">
|
||||
<a-tree-select
|
||||
v-model="addFrom.parentId"
|
||||
:data="tableData"
|
||||
:field-names="{
|
||||
key: 'id',
|
||||
title: 'name',
|
||||
children: 'children'
|
||||
}"
|
||||
placeholder="选择上级部门"
|
||||
></a-tree-select>
|
||||
</a-form-item>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<a-form-item field="name" label="部门名称" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.name" placeholder="请输入部门名称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="status" label="部门状态" validate-trigger="blur">
|
||||
<a-switch type="round" :checked-value="1" :unchecked-value="0" v-model="addFrom.status">
|
||||
<template #checked> 启用 </template>
|
||||
<template #unchecked> 禁用 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<a-form-item field="leader" label="负责人" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.leader" placeholder="请输入负责人" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="phone" label="联系电话" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.phone" placeholder="请输入联系电话" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<a-form-item field="email" label="邮箱" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.email" placeholder="请输入邮箱" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="sort" label="显示排序" validate-trigger="blur">
|
||||
<a-input-number
|
||||
v-model="addFrom.sort"
|
||||
placeholder="请输入排序值"
|
||||
:min="1"
|
||||
:max="999"
|
||||
:step="1"
|
||||
:precision="0"
|
||||
allow-clear
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item field="description" label="描述" validate-trigger="blur">
|
||||
<a-textarea v-model="addFrom.description" placeholder="请输入描述" allow-clear />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getDivisionAPI } from "@/api/modules/system/index";
|
||||
import { deepClone } from "@/utils";
|
||||
|
||||
// 新增
|
||||
const open = ref(false);
|
||||
const rules = {
|
||||
parentId: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择上级部门"
|
||||
}
|
||||
],
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入部门名称"
|
||||
}
|
||||
],
|
||||
status: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择部门状态"
|
||||
}
|
||||
]
|
||||
};
|
||||
const addFrom = ref<any>({
|
||||
parentId: null,
|
||||
name: "",
|
||||
sort: 0,
|
||||
leader: "",
|
||||
phone: "",
|
||||
email: "",
|
||||
status: 1,
|
||||
description: ""
|
||||
});
|
||||
const formType = ref(0); // 0新增 1修改 2新增下级
|
||||
const title = ref("");
|
||||
const formRef = ref();
|
||||
const onAdd = () => {
|
||||
title.value = "添加部门";
|
||||
formType.value = 0;
|
||||
open.value = true;
|
||||
};
|
||||
const handleOk = async () => {
|
||||
let state = await formRef.value.validate();
|
||||
if (state) return (open.value = true); // 校验不通过
|
||||
console.log("模拟提交", formType.value, addFrom.value);
|
||||
arcoMessage("success", "模拟提交成功");
|
||||
getDivision();
|
||||
};
|
||||
// 关闭对话框动画结束后触发
|
||||
const afterClose = () => {
|
||||
formRef.value.resetFields();
|
||||
addFrom.value = {
|
||||
parentId: null,
|
||||
name: "",
|
||||
sort: 0,
|
||||
leader: "",
|
||||
phone: "",
|
||||
email: "",
|
||||
status: 1,
|
||||
description: ""
|
||||
};
|
||||
};
|
||||
const onUpdate = (row: any) => {
|
||||
title.value = "修改部门";
|
||||
formType.value = 1;
|
||||
addFrom.value = deepClone(row);
|
||||
row.parentId == 0 && (addFrom.value.parentId = null);
|
||||
open.value = true;
|
||||
};
|
||||
const addDivision = (id: any) => {
|
||||
title.value = "新增部门";
|
||||
formType.value = 2;
|
||||
addFrom.value.parentId = id == 0 ? null : id;
|
||||
open.value = true;
|
||||
};
|
||||
|
||||
const openState = ref(dictFilter("status"));
|
||||
const form = ref({
|
||||
name: "",
|
||||
status: ""
|
||||
});
|
||||
const search = () => {
|
||||
getDivision();
|
||||
};
|
||||
const reset = () => {
|
||||
form.value = {
|
||||
name: "",
|
||||
status: ""
|
||||
};
|
||||
getDivision();
|
||||
};
|
||||
const loading = ref(false);
|
||||
const tableRef = ref();
|
||||
const tableData = ref();
|
||||
const getDivision = async () => {
|
||||
loading.value = true;
|
||||
let res = await getDivisionAPI();
|
||||
tableData.value = res.data;
|
||||
loading.value = false;
|
||||
setTimeout(() => {
|
||||
tableRef.value.expandAll();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getDivision();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,7 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">系统日志-敬请期待</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,563 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-fill">
|
||||
<div class="snow-fill-inner">
|
||||
<s-layout-tools>
|
||||
<template #left>
|
||||
<a-space wrap>
|
||||
<a-input v-model="form.name" placeholder="请输入菜单名称" allow-clear />
|
||||
<a-select v-model="form.hide" placeholder="请选择显示状态" allow-clear style="width: 120px">
|
||||
<a-option v-for="item in openState" :key="item.value" :value="item.value">{{ item.name }}</a-option>
|
||||
</a-select>
|
||||
<a-select v-model="form.disable" placeholder="请选择启用状态" allow-clear style="width: 120px">
|
||||
<a-option v-for="item in openState" :key="item.value" :value="item.value">{{ item.name }}</a-option>
|
||||
</a-select>
|
||||
<a-button type="primary" @click="onSearch">
|
||||
<template #icon><icon-search /></template>
|
||||
<span>查询</span>
|
||||
</a-button>
|
||||
|
||||
<a-button @click="onReset">
|
||||
<template #icon>
|
||||
<icon-refresh />
|
||||
</template>
|
||||
<template #default>重置</template>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #right>
|
||||
<a-space wrap>
|
||||
<a-button type="primary" @click="onAdd">
|
||||
<template #icon><icon-plus /></template>
|
||||
<span>新增</span>
|
||||
</a-button>
|
||||
<a-button type="primary" status="success" @click="onExpand">
|
||||
<template #icon>
|
||||
<icon-swap />
|
||||
</template>
|
||||
<span>{{ expand ? "收起" : "展开" }}</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</s-layout-tools>
|
||||
<a-table
|
||||
ref="tableRef"
|
||||
:data="tableTree"
|
||||
:loading="loading"
|
||||
row-key="name"
|
||||
:bordered="{ cell: true }"
|
||||
show-empty-tree
|
||||
:pagination="false"
|
||||
size="medium"
|
||||
:scroll="{ x: '150%', y: '93%' }"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="菜单名称">
|
||||
<template #cell="{ record }">
|
||||
{{ $t(`menu.${record.meta.title}`) }}
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="菜单类型" align="center" :width="100">
|
||||
<template #cell="{ record }">
|
||||
<a-tag v-if="record.meta.type == 1" bordered size="small" color="purple">目录</a-tag>
|
||||
<a-tag v-else-if="record.meta.type == 2" bordered size="small" color="green">菜单</a-tag>
|
||||
<a-tag v-else bordered size="small" color="gray">按钮</a-tag>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="图标" align="center" :width="100">
|
||||
<template #cell="{ record }">
|
||||
<MenuItemIcon :svg-icon="record.meta.svgIcon" :icon="record.meta.icon" />
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="路由路径" data-index="path"></a-table-column>
|
||||
<a-table-column title="路由名称" data-index="name"></a-table-column>
|
||||
<a-table-column title="组件路径">
|
||||
<template #cell="{ record }">
|
||||
{{ record.redirect ? record.redirect : record.component }}
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="权限标识" tooltip>
|
||||
<template #cell="{ record }">
|
||||
{{ record.meta.roles }}
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="排序" align="center" :width="80">
|
||||
<template #cell="{ record }">
|
||||
{{ record.meta.sort }}
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="是否隐藏" align="center" :width="100">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.meta.hide">是</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>否</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="是否禁用" align="center" :width="100">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.meta.disable">是</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>否</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="是否缓存" align="center" :width="100">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.meta.keepAlive">是</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>否</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="是否外链" align="center" :width="100">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.meta.link">是</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>否</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="是否全屏" align="center" :width="100">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.meta.isFull">是</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>否</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="操作" align="center" :width="250" :fixed="'right'">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-button size="mini" type="primary" @click="onUpdate(record)">
|
||||
<template #icon><icon-edit /></template>
|
||||
<span>修改</span>
|
||||
</a-button>
|
||||
<a-button size="mini" type="primary" status="success" v-if="record.meta.type != 3" @click="onCurrentAdd(record)">
|
||||
<template #icon><icon-plus /></template>
|
||||
<span>新增</span>
|
||||
</a-button>
|
||||
<a-popconfirm type="warning" content="确定删除该项吗?">
|
||||
<a-button size="mini" type="primary" status="danger">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<a-modal width="40%" v-model:visible="open" @close="afterClose" @ok="handleOk" @cancel="afterClose">
|
||||
<template #title> {{ title }} </template>
|
||||
<div>
|
||||
<a-form ref="formRef" auto-label-width :rules="rules" :model="addFrom">
|
||||
<a-form-item field="type" label="菜单类型" validate-trigger="blur">
|
||||
<a-radio-group type="button" :disabled="addFrom.id" v-model="addFrom.type" @change="typeChange">
|
||||
<a-radio v-for="item in menuType" :key="item.value" :value="item.value">{{ item.name }}</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item field="parentId" label="上级菜单" validate-trigger="blur" :disabled="addFrom.id">
|
||||
<a-tree-select
|
||||
v-model="addFrom.parentId"
|
||||
:data="menuTree"
|
||||
:field-names="{
|
||||
key: 'id',
|
||||
title: 'i18n',
|
||||
children: 'children'
|
||||
}"
|
||||
allow-clear
|
||||
placeholder="请选择上级菜单"
|
||||
></a-tree-select>
|
||||
<template #extra>
|
||||
<div>未选择则默认第一级</div>
|
||||
</template>
|
||||
</a-form-item>
|
||||
<a-row :gutter="24" v-if="[1, 2].includes(addFrom.type)">
|
||||
<a-col :span="12">
|
||||
<a-form-item field="svgIcon" label="自定义图标" validate-trigger="blur">
|
||||
<s-select-icon type="svg" v-model="addFrom.svgIcon" />
|
||||
<template #extra>
|
||||
<div>自定义图标优先级高于菜单图标</div>
|
||||
</template>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="icon" label="菜单图标" validate-trigger="blur">
|
||||
<s-select-icon type="arco" v-model="addFrom.icon" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item field="title" label="菜单标题" validate-trigger="blur">
|
||||
<a-input
|
||||
v-model="addFrom.title"
|
||||
placeholder="请输入菜单标题"
|
||||
allow-clear
|
||||
@input="(e: string) => onTrim(e, 'title')"
|
||||
/>
|
||||
<template #extra>
|
||||
<div>
|
||||
优先匹配国际化Key
|
||||
<a-typography-text code v-if="addFrom.title"> menu.{{ addFrom.title }} </a-typography-text>
|
||||
(无对应Key则直接取标题展示)
|
||||
</div>
|
||||
</template>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="[1, 2].includes(addFrom.type)" field="path" label="路由路径" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.path" placeholder="请输入路由路径,如:/home" allow-clear @input="pathChange" />
|
||||
<template #extra>
|
||||
<div>
|
||||
菜单名称由路径自动生成
|
||||
<a-typography-text code v-if="addFrom.name"> {{ addFrom.name }} </a-typography-text>
|
||||
</div>
|
||||
</template>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="addFrom.type == 3" field="permission" label="权限标识" validate-trigger="blur">
|
||||
<a-input
|
||||
v-model="addFrom.permission"
|
||||
placeholder="请输入权限标识,如:sys:btn:add"
|
||||
allow-clear
|
||||
@input="(e: string) => onTrim(e, 'permission')"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item v-if="[1, 2].includes(addFrom.type)" field="redirect" label="路由重定向" validate-trigger="blur">
|
||||
<a-input
|
||||
v-model="addFrom.redirect"
|
||||
placeholder="请输入路由重定向"
|
||||
allow-clear
|
||||
@input="(e: string) => onTrim(e, 'redirect')"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
v-if="addFrom.type == 2"
|
||||
field="component"
|
||||
label="组件路径"
|
||||
validate-trigger="blur"
|
||||
:disabled="addFrom.isLink"
|
||||
>
|
||||
<a-input
|
||||
v-model="addFrom.component"
|
||||
placeholder="请输入组件路径"
|
||||
allow-clear
|
||||
@input="(e: string) => onTrim(e, 'component')"
|
||||
>
|
||||
<template #prepend>@/views/</template>
|
||||
<template #append>.vue</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="8" v-if="[1, 2].includes(addFrom.type)">
|
||||
<a-form-item field="hide" label="显示状态" validate-trigger="blur">
|
||||
<a-switch type="round" v-model="addFrom.hide" :checked-value="false" :unchecked-value="true">
|
||||
<template #checked> 显示 </template>
|
||||
<template #unchecked> 隐藏 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8" v-if="[1, 2].includes(addFrom.type)">
|
||||
<a-form-item field="disable" label="启用状态" validate-trigger="blur">
|
||||
<a-switch type="round" v-model="addFrom.disable" :checked-value="false" :unchecked-value="true">
|
||||
<template #checked> 启用 </template>
|
||||
<template #unchecked> 禁用 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8" v-if="addFrom.type == 2">
|
||||
<a-form-item field="keepAlive" label="是否缓存" validate-trigger="blur">
|
||||
<a-switch type="round" v-model="addFrom.keepAlive">
|
||||
<template #checked> 是 </template>
|
||||
<template #unchecked> 否 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24" v-if="addFrom.type == 2">
|
||||
<a-col :span="8">
|
||||
<a-form-item field="affix" label="固定Tabs" validate-trigger="blur">
|
||||
<a-switch type="round" v-model="addFrom.affix">
|
||||
<template #checked> 是 </template>
|
||||
<template #unchecked> 否 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item field="isLink" label="是否外链" validate-trigger="blur">
|
||||
<a-switch type="round" v-model="addFrom.isLink" @change="onIsLink">
|
||||
<template #checked> 是 </template>
|
||||
<template #unchecked> 否 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item field="iframe" label="内嵌窗口" validate-trigger="blur" :disabled="!addFrom.isLink">
|
||||
<a-switch type="round" v-model="addFrom.iframe" @change="onIframe">
|
||||
<template #checked> 是 </template>
|
||||
<template #unchecked> 否 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item field="link" label="外链路径" validate-trigger="blur" v-if="addFrom.type == 2 && addFrom.isLink">
|
||||
<a-input v-model="addFrom.link" placeholder="请输入路由路径" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="affix" label="全屏显示" validate-trigger="blur" v-if="addFrom.type == 2">
|
||||
<a-switch type="round" v-model="addFrom.isFull">
|
||||
<template #checked> 是 </template>
|
||||
<template #unchecked> 否 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
<a-form-item field="sort" label="排序" validate-trigger="blur">
|
||||
<a-input-number
|
||||
v-model="addFrom.sort"
|
||||
:step="1"
|
||||
:precision="0"
|
||||
:min="1"
|
||||
:max="9999"
|
||||
:style="{ width: '120px' }"
|
||||
placeholder="请输入"
|
||||
mode="button"
|
||||
class="input-demo"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import MenuItemIcon from "@/layout/components/Menu/menu-item-icon.vue";
|
||||
import { getMenuListAPI } from "@/api/modules/system/index";
|
||||
import useGlobalProperties from "@/hooks/useGlobalProperties";
|
||||
import { deepClone, getPascalCase } from "@/utils";
|
||||
const proxy = useGlobalProperties();
|
||||
const openState = ref(dictFilter("status"));
|
||||
const form = ref({
|
||||
name: "",
|
||||
hide: "",
|
||||
disable: ""
|
||||
});
|
||||
|
||||
const onReset = () => {
|
||||
form.value = { name: "", hide: "", disable: "" };
|
||||
getMenuList();
|
||||
};
|
||||
|
||||
// 新增
|
||||
const open = ref(false);
|
||||
const rules = ref({
|
||||
parentId: [{ required: false, message: "请选择上级菜单" }],
|
||||
name: [{ required: true, message: "请输入菜单名称" }],
|
||||
title: [{ required: true, message: "请输入菜单标题" }],
|
||||
path: [{ required: true, message: "请输入路由路径" }],
|
||||
permission: [{ required: true, message: "请输入权限标识" }]
|
||||
});
|
||||
|
||||
const menuType = ref([
|
||||
{ name: "目录", value: 1 },
|
||||
{ name: "菜单", value: 2 },
|
||||
{ name: "按钮", value: 3 }
|
||||
]);
|
||||
const addFrom = ref<any>({
|
||||
type: 1,
|
||||
parentId: "",
|
||||
svgIcon: "",
|
||||
icon: "",
|
||||
name: "",
|
||||
title: "",
|
||||
isFull: false,
|
||||
permission: "",
|
||||
path: "",
|
||||
redirect: "",
|
||||
component: "",
|
||||
hide: false,
|
||||
disable: false,
|
||||
keepAlive: true,
|
||||
affix: false,
|
||||
isLink: false,
|
||||
link: "",
|
||||
iframe: false,
|
||||
sort: 1
|
||||
});
|
||||
const formType = ref(0); // 0新增 1修改
|
||||
const title = ref("");
|
||||
const formRef = ref();
|
||||
const onAdd = () => {
|
||||
title.value = "新增菜单";
|
||||
formType.value = 0;
|
||||
open.value = true;
|
||||
};
|
||||
const handleOk = async () => {
|
||||
let state = await formRef.value.validate();
|
||||
if (state) return (open.value = true); // 校验不通过
|
||||
console.log("addFrom.value", addFrom.value);
|
||||
arcoMessage("success", "模拟提交成功");
|
||||
getMenuList();
|
||||
};
|
||||
// 关闭对话框动画结束后触发
|
||||
const afterClose = () => {
|
||||
formRef.value.resetFields();
|
||||
addFrom.value = {
|
||||
type: 1,
|
||||
parentId: "",
|
||||
svgIcon: "",
|
||||
icon: "",
|
||||
name: "",
|
||||
title: "",
|
||||
isFull: false,
|
||||
permission: "",
|
||||
path: "",
|
||||
redirect: "",
|
||||
component: "",
|
||||
hide: false,
|
||||
disable: false,
|
||||
keepAlive: true,
|
||||
affix: false,
|
||||
isLink: false,
|
||||
link: "",
|
||||
iframe: false,
|
||||
sort: 1
|
||||
};
|
||||
};
|
||||
// 修改
|
||||
const onUpdate = (row: Menu.MenuOptions) => {
|
||||
let data = deepClone(row);
|
||||
delete data.children;
|
||||
if (data.parentId == "0") data.parentId = "";
|
||||
let form = {
|
||||
...data,
|
||||
...data.meta
|
||||
};
|
||||
if (form.meta) delete form.meta;
|
||||
typeChange(form.type);
|
||||
addFrom.value = form;
|
||||
title.value = "修改菜单";
|
||||
open.value = true;
|
||||
};
|
||||
// 列表新增
|
||||
const onCurrentAdd = (record: any) => {
|
||||
let {
|
||||
id,
|
||||
meta: { type }
|
||||
} = record;
|
||||
addFrom.value.parentId = id;
|
||||
addFrom.value.type = type == 2 ? 3 : type;
|
||||
title.value = "新增菜单";
|
||||
open.value = true;
|
||||
};
|
||||
|
||||
// 菜单类型
|
||||
const typeChange = (val: number) => {
|
||||
rules.value.parentId[0].required = val == 3;
|
||||
formRef.value.clearValidate();
|
||||
};
|
||||
|
||||
// 去除空格
|
||||
const onTrim = (val: string, key: string) => {
|
||||
addFrom.value[key] = val.trim();
|
||||
};
|
||||
|
||||
// 菜单名称
|
||||
const pathChange = (str: string) => {
|
||||
addFrom.value.path = str.trim();
|
||||
addFrom.value.name = getPascalCase(str.trim().replace(/[./:?=&"-]/g, "_"));
|
||||
};
|
||||
|
||||
// 是否外链
|
||||
const onIsLink = (is: boolean) => {
|
||||
// 非外链
|
||||
if (!is) {
|
||||
// 关联iframe和link
|
||||
addFrom.value.iframe = false;
|
||||
addFrom.value.link = "";
|
||||
addFrom.value.component = "";
|
||||
} else {
|
||||
// 外链
|
||||
addFrom.value.component = "link/external/external";
|
||||
}
|
||||
};
|
||||
|
||||
// 是否内嵌外链窗口
|
||||
const onIframe = (is: boolean) => {
|
||||
// 非内嵌
|
||||
if (!is) {
|
||||
// 关联iframe和link
|
||||
addFrom.value.component = "link/external/external";
|
||||
} else {
|
||||
// 内嵌
|
||||
addFrom.value.component = "link/internal/internal";
|
||||
}
|
||||
};
|
||||
|
||||
const onSearch = () => getMenuList();
|
||||
const loading = ref(false);
|
||||
const tableRef = ref();
|
||||
const tableTree = ref([]);
|
||||
const menuTree = ref<any>([]);
|
||||
const getMenuList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
let { data } = await getMenuListAPI();
|
||||
// 语言翻译
|
||||
translation(data);
|
||||
// 列表数据
|
||||
tableTree.value = data;
|
||||
// 过滤type:3的节点,该节点是按钮权限,不显示在菜单中-用于下拉选择
|
||||
menuTree.value = filterTree(data);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const expand = ref(false);
|
||||
const onExpand = () => {
|
||||
expand.value = !expand.value;
|
||||
tableRef.value.expandAll(expand.value);
|
||||
};
|
||||
|
||||
// 语言转化
|
||||
const translation = (tree: any) => {
|
||||
tree.forEach((item: any) => {
|
||||
if (item.children) translation(item.children);
|
||||
if (item.meta.title) {
|
||||
item.i18n = proxy.$t(`menu.${item.meta.title}`);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 过滤type:3的节点,该节点是按钮权限,不显示在菜单中-用于下拉选择
|
||||
* @param {object} nodes 路由树
|
||||
* @returns 节点过滤后的路由树
|
||||
*/
|
||||
const filterTree = (nodes: Menu.MenuOptions[]) => {
|
||||
// 过滤当前层级的节点,排除 type 为 3 的节点
|
||||
return nodes
|
||||
.filter((node: any) => node.meta.type !== 3)
|
||||
.map((node: any) => {
|
||||
// 创建新节点以避免修改原数据
|
||||
const newNode = { ...node };
|
||||
// 递归处理子节点
|
||||
if (newNode.children) {
|
||||
const filteredChildren = filterTree(newNode.children);
|
||||
if (filteredChildren.length > 0) {
|
||||
newNode.children = filteredChildren;
|
||||
} else {
|
||||
// 若子节点全被过滤,删除 children 属性
|
||||
delete newNode.children;
|
||||
}
|
||||
}
|
||||
return newNode;
|
||||
});
|
||||
};
|
||||
|
||||
getMenuList();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.arco-typography code) {
|
||||
font-size: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,333 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<s-layout-tools>
|
||||
<template #left>
|
||||
<a-space wrap>
|
||||
<a-input v-model="form.name" placeholder="请输入角色名称" allow-clear />
|
||||
<a-input v-model="form.code" placeholder="请输入角色标识" allow-clear />
|
||||
<a-select placeholder="角色状态" v-model="form.status" style="width: 120px" allow-clear>
|
||||
<a-option v-for="item in openState" :key="item.value" :value="item.value">{{ item.name }}</a-option>
|
||||
</a-select>
|
||||
<a-range-picker v-model="form.time" show-time format="YYYY-MM-DD HH:mm" allow-clear />
|
||||
<a-button type="primary" @click="search">
|
||||
<template #icon><icon-search /></template>
|
||||
<span>查询</span>
|
||||
</a-button>
|
||||
<a-button @click="reset">
|
||||
<template #icon><icon-refresh /></template>
|
||||
<span>重置</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #right>
|
||||
<a-space wrap>
|
||||
<a-button type="primary" @click="onAdd">
|
||||
<template #icon><icon-plus /></template>
|
||||
<span>新增</span>
|
||||
</a-button>
|
||||
<a-button type="primary" status="danger">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</s-layout-tools>
|
||||
<a-table
|
||||
row-key="id"
|
||||
:data="roleList"
|
||||
:bordered="{ cell: true }"
|
||||
:loading="loading"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||
:pagination="pagination"
|
||||
:row-selection="{ type: 'checkbox', showCheckedAll: true }"
|
||||
:selected-keys="selectedKeys"
|
||||
@select="select"
|
||||
@select-all="selectAll"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="序号" :width="64">
|
||||
<template #cell="cell">{{ cell.rowIndex + 1 }}</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="角色名称" data-index="name"></a-table-column>
|
||||
<a-table-column title="角色标识" data-index="code"></a-table-column>
|
||||
<a-table-column title="排序" data-index="sort" :width="100" align="center"></a-table-column>
|
||||
<a-table-column title="状态" :width="100" align="center">
|
||||
<template #cell="{ record }">
|
||||
<a-tag bordered size="small" color="arcoblue" v-if="record.status === 1">启用</a-tag>
|
||||
<a-tag bordered size="small" color="red" v-else>禁用</a-tag>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="描述" data-index="description" :ellipsis="true" :tooltip="true"></a-table-column>
|
||||
<a-table-column title="创建时间" data-index="createTime" :width="180"></a-table-column>
|
||||
<a-table-column title="操作" :width="280" align="center" :fixed="'right'">
|
||||
<template #cell="{ record }">
|
||||
<a-space>
|
||||
<a-button type="primary" status="success" size="mini" :disabled="record.admin" @click="onPrivileges(record)">
|
||||
<template #icon><icon-safe /></template>
|
||||
<span>分配权限</span>
|
||||
</a-button>
|
||||
<a-button type="primary" size="mini" :disabled="record.admin" @click="onUpdate(record)">
|
||||
<template #icon><icon-edit /></template>
|
||||
<span>修改</span>
|
||||
</a-button>
|
||||
<a-popconfirm type="warning" content="确定删除该角色吗?">
|
||||
<a-button type="primary" status="danger" size="mini" :disabled="record.admin">
|
||||
<template #icon><icon-delete /></template>
|
||||
<span>删除</span>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
<a-modal width="40%" v-model:visible="open" @close="afterClose" @ok="handleOk" @cancel="afterClose">
|
||||
<template #title> {{ title }} </template>
|
||||
<div>
|
||||
<a-form ref="formRef" auto-label-width :rules="rules" :model="addFrom">
|
||||
<a-form-item field="name" label="角色名称" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.name" placeholder="请输入角色名称" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="code" label="角色编码" validate-trigger="blur">
|
||||
<a-input v-model="addFrom.code" placeholder="请输入角色编码" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="status" label="状态" validate-trigger="blur">
|
||||
<a-switch type="round" :checked-value="1" :unchecked-value="0" v-model="addFrom.status">
|
||||
<template #checked> 启用 </template>
|
||||
<template #unchecked> 禁用 </template>
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
<a-form-item field="sort" label="排序" validate-trigger="blur">
|
||||
<a-input-number
|
||||
v-model="addFrom.sort"
|
||||
:step="1"
|
||||
:precision="0"
|
||||
:min="1"
|
||||
:max="9999"
|
||||
:style="{ width: '150px' }"
|
||||
placeholder="请输入"
|
||||
mode="button"
|
||||
class="input-demo"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item field="description" label="描述" validate-trigger="blur">
|
||||
<a-textarea v-model="addFrom.description" placeholder="请输入描述" allow-clear />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-modal>
|
||||
|
||||
<a-drawer :visible="drawerOpen" :width="500" @ok="drawerOk" @cancel="drawerCancel">
|
||||
<template #title> 分配权限 </template>
|
||||
<div>
|
||||
<a-card>
|
||||
<a-row :gutter="24" justify="center">
|
||||
<a-col :span="8">
|
||||
<span class="text-right-gap">展开全部</span>
|
||||
<a-switch type="round" v-model="treeSwitch.expandAll" @change="onExpandAll">
|
||||
<template #checked> 是 </template>
|
||||
<template #unchecked> 否 </template>
|
||||
</a-switch>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<span class="text-right-gap">全选节点</span>
|
||||
<a-switch type="round" v-model="treeSwitch.selectAll" @change="onSelectAll">
|
||||
<template #checked> 是 </template>
|
||||
<template #unchecked> 否 </template>
|
||||
</a-switch>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-tooltip
|
||||
content="权限树的父子节点独立,因为若节点关联,父节点会存在半选情况,半选节点的ID不会返回,会导致菜单无法渲染"
|
||||
>
|
||||
<span>父子关联 <icon-question-circle-fill /></span>
|
||||
</a-tooltip>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<a-tree
|
||||
ref="treeRef"
|
||||
:fieldNames="{
|
||||
key: 'id',
|
||||
title: 'i18n',
|
||||
children: 'children'
|
||||
}"
|
||||
:check-strictly="true"
|
||||
:checkable="true"
|
||||
:show-line="true"
|
||||
:unmount-on-close="true"
|
||||
v-model:checked-keys="permissionKeys"
|
||||
:data="permissionTree"
|
||||
/>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getRoleAPI, getMenuListAPI, getUserPermissionAPI } from "@/api/modules/system/index";
|
||||
import { deepClone } from "@/utils";
|
||||
import useGlobalProperties from "@/hooks/useGlobalProperties";
|
||||
const proxy = useGlobalProperties();
|
||||
const openState = ref(dictFilter("status"));
|
||||
const form = ref({
|
||||
name: "",
|
||||
code: "",
|
||||
time: [],
|
||||
status: null
|
||||
});
|
||||
const search = () => {
|
||||
getRole();
|
||||
};
|
||||
const reset = () => {
|
||||
form.value = {
|
||||
name: "",
|
||||
code: "",
|
||||
time: [],
|
||||
status: null
|
||||
};
|
||||
getRole();
|
||||
};
|
||||
|
||||
// 新增
|
||||
const open = ref(false);
|
||||
const rules = {
|
||||
name: [{ required: true, message: "请输入角色名称" }],
|
||||
code: [{ required: true, message: "请输入角色编码" }],
|
||||
status: [{ required: true, message: "请选择状态" }]
|
||||
};
|
||||
const addFrom = ref<any>({
|
||||
name: "",
|
||||
code: "",
|
||||
status: 1,
|
||||
sort: 1,
|
||||
description: ""
|
||||
});
|
||||
|
||||
const title = ref("");
|
||||
const formRef = ref();
|
||||
const onAdd = () => {
|
||||
title.value = "新增角色";
|
||||
open.value = true;
|
||||
};
|
||||
const handleOk = async () => {
|
||||
let state = await formRef.value.validate();
|
||||
if (state) return (open.value = true); // 校验不通过
|
||||
arcoMessage("success", "模拟提交成功");
|
||||
getRole();
|
||||
};
|
||||
// 关闭对话框动画结束后触发
|
||||
const afterClose = () => {
|
||||
formRef.value.resetFields();
|
||||
addFrom.value = {
|
||||
name: "",
|
||||
code: "",
|
||||
status: 1,
|
||||
sort: 1,
|
||||
description: ""
|
||||
};
|
||||
};
|
||||
// 修改角色
|
||||
const onUpdate = (row: any) => {
|
||||
title.value = "修改角色";
|
||||
addFrom.value = deepClone(row);
|
||||
open.value = true;
|
||||
};
|
||||
|
||||
// 获取列表
|
||||
const loading = ref(false);
|
||||
const pagination = ref({
|
||||
pageSize: 10,
|
||||
showPageSize: true
|
||||
});
|
||||
const roleList = ref([]);
|
||||
const getRole = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
let res = await getRoleAPI();
|
||||
res.data.forEach((item: any) => item.admin && (item.disabled = true));
|
||||
roleList.value = res.data;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const selectedKeys = ref([]);
|
||||
const select = (list: []) => {
|
||||
selectedKeys.value = list;
|
||||
};
|
||||
const selectAll = (state: boolean) => {
|
||||
selectedKeys.value = state ? (roleList.value.map((el: any) => el.id) as []) : [];
|
||||
};
|
||||
|
||||
// 获取权限树
|
||||
const treeRef = ref();
|
||||
const treeSwitch = ref({
|
||||
expandAll: true, // 展开全部
|
||||
selectAll: false // 全选
|
||||
});
|
||||
// 展开全部
|
||||
const onExpandAll = (state: boolean) => {
|
||||
treeRef.value.expandAll(state);
|
||||
};
|
||||
// 全选
|
||||
const onSelectAll = (state: boolean) => {
|
||||
treeRef.value.checkAll(state);
|
||||
};
|
||||
|
||||
// 重置节点操作开关
|
||||
const treeSwitchReset = () => {
|
||||
treeSwitch.value = {
|
||||
expandAll: true, // 固定
|
||||
selectAll: false // 全选
|
||||
};
|
||||
};
|
||||
const permissionTree = ref([]);
|
||||
const permissionKeys = ref([]);
|
||||
const getMenuList = async () => {
|
||||
let { data } = await getMenuListAPI();
|
||||
translation(data);
|
||||
permissionTree.value = data;
|
||||
};
|
||||
|
||||
// 分配权限
|
||||
const drawerOpen = ref(false);
|
||||
const onPrivileges = async (row: any) => {
|
||||
let res = await getUserPermissionAPI({ role: row.code });
|
||||
permissionKeys.value = res.data;
|
||||
drawerOpen.value = true;
|
||||
treeRef.value.expandAll(true);
|
||||
};
|
||||
|
||||
const drawerOk = () => {
|
||||
drawerOpen.value = false;
|
||||
treeSwitchReset();
|
||||
arcoMessage("success", "模拟提交成功");
|
||||
getRole();
|
||||
};
|
||||
const drawerCancel = () => {
|
||||
drawerOpen.value = false;
|
||||
treeSwitchReset();
|
||||
};
|
||||
|
||||
// 语言转化
|
||||
const translation = (tree: any) => {
|
||||
tree.forEach((item: any) => {
|
||||
if (item.children) translation(item.children);
|
||||
if (item.meta.title) {
|
||||
item.i18n = proxy.$t(`menu.${item.meta.title}`);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
getRole();
|
||||
getMenuList();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.text-right-gap {
|
||||
margin-right: $margin;
|
||||
}
|
||||
</style>
|
||||
@@ -1,78 +0,0 @@
|
||||
<template>
|
||||
<a-row align="center" :gutter="[0, 16]">
|
||||
<a-col :span="24">
|
||||
<a-card title="基本信息">
|
||||
<a-form :model="form" :rules="rules" :style="{ width: '600px' }" @submit="onSubmit">
|
||||
<a-form-item field="userName" label="用户名">
|
||||
<a-input v-model="form.userName" placeholder="请输入用户名" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="nickName" label="用户昵称">
|
||||
<a-input v-model="form.nickName" placeholder="请输入用户昵称" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="sex" label="性别" validate-trigger="blur">
|
||||
<a-radio-group v-model="form.sex" :options="sexOption">
|
||||
<template #label="{ data }">
|
||||
<div>{{ data.name }}</div>
|
||||
</template>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item field="description" label="描述">
|
||||
<a-textarea placeholder="请输入描述" v-model="form.description" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" html-type="submit">提交</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import useGlobalProperties from "@/hooks/useGlobalProperties";
|
||||
|
||||
const emit = defineEmits(["refresh"]);
|
||||
const proxy = useGlobalProperties();
|
||||
const data = defineModel() as any;
|
||||
const sexOption = ref(dictFilter("gender"));
|
||||
const form = ref({
|
||||
id: "",
|
||||
userName: "",
|
||||
nickName: "",
|
||||
sex: null,
|
||||
description: ""
|
||||
});
|
||||
const rules = {
|
||||
userName: [
|
||||
{
|
||||
required: true,
|
||||
message: "用户名不能为空"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const onSubmit = ({ errors }: ArcoDesign.ArcoSubmit) => {
|
||||
if (errors) return;
|
||||
proxy.$message.success("模拟修改成功");
|
||||
emit("refresh");
|
||||
};
|
||||
|
||||
watch(
|
||||
() => data.value,
|
||||
() => {
|
||||
form.value.id = data.value.id;
|
||||
form.value.userName = data.value.userName;
|
||||
form.value.nickName = data.value.nickName;
|
||||
form.value.sex = data.value.sex;
|
||||
form.value.description = data.value.description;
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.row-title {
|
||||
font-size: $font-size-title-1;
|
||||
}
|
||||
</style>
|
||||
@@ -1,75 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-row align="center" :gutter="[0, 16]">
|
||||
<a-col :span="24">
|
||||
<a-card title="安全设置">
|
||||
<a-form :model="form" :rules="rules" :style="{ width: '600px' }" @submit="onSubmit">
|
||||
<a-form-item field="password" label="登录密码">
|
||||
<a-input-password v-model="form.password" placeholder="请输入登录密码" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="phone" label="手机号">
|
||||
<a-input v-model="form.phone" placeholder="请输入手机号" allow-clear>
|
||||
<template #prepend> +86 </template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item field="email" label="邮箱">
|
||||
<a-input v-model="form.email" placeholder="请输入邮箱" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button type="primary" html-type="submit">提交</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import useGlobalProperties from "@/hooks/useGlobalProperties";
|
||||
|
||||
const emit = defineEmits(["refresh"]);
|
||||
const proxy = useGlobalProperties();
|
||||
const data = defineModel() as any;
|
||||
const form = ref({
|
||||
id: "",
|
||||
password: "",
|
||||
phone: "",
|
||||
email: ""
|
||||
});
|
||||
const rules = {
|
||||
password: [
|
||||
{
|
||||
required: true,
|
||||
message: "登录密码不能为空"
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
required: true,
|
||||
message: "手机号不能为空"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const onSubmit = ({ errors }: ArcoDesign.ArcoSubmit) => {
|
||||
if (errors) return;
|
||||
proxy.$message.success("模拟修改成功");
|
||||
emit("refresh");
|
||||
};
|
||||
|
||||
watch(
|
||||
() => data.value,
|
||||
() => {
|
||||
form.value.id = data.value.id;
|
||||
form.value.phone = data.value.phone;
|
||||
form.value.email = data.value.email;
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.row-title {
|
||||
font-size: $font-size-title-1;
|
||||
}
|
||||
</style>
|
||||
@@ -1,173 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<a-spin :loading="loading" tip="loading...">
|
||||
<a-card :bordered="false">
|
||||
<a-row align="center">
|
||||
<a-col :span="2">
|
||||
<div>
|
||||
<a-avatar :size="100" @click="toast" trigger-type="mask">
|
||||
<img alt="avatar" :src="userInfo.avatar" />
|
||||
<template #trigger-icon>
|
||||
<IconEdit />
|
||||
</template>
|
||||
</a-avatar>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="22">
|
||||
<a-space direction="vertical" size="large">
|
||||
<a-descriptions :data="detail" :column="4" title="用户资料" :align="{ label: 'right' }">
|
||||
<template #value="{ value, data }">
|
||||
<span v-if="data.key === 'roles'">
|
||||
{{ Array.isArray(value) && value.map((curr: any) => curr.name).join(",") }}
|
||||
</span>
|
||||
<span v-else-if="data.key == 'status'">
|
||||
{{ value === 1 ? "启用" : "禁用" }}
|
||||
</span>
|
||||
<span v-else-if="data.key == 'sex'">
|
||||
{{ value === 1 ? "男" : "女" }}
|
||||
</span>
|
||||
<span v-else>{{ value }}</span>
|
||||
</template>
|
||||
</a-descriptions>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
<a-card class="margin-top" :bordered="false">
|
||||
<a-row align="center">
|
||||
<a-col :span="24">
|
||||
<a-tabs :type="type" :size="size" :active-key="activeTabs" @change="onChangeTab">
|
||||
<a-tab-pane key="1" title="基本信息">
|
||||
<BasicInfo v-model="userInfo" @refresh="refresh" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" title="安全设置">
|
||||
<SecuritySettings v-model="userInfo" @refresh="refresh" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import BasicInfo from "@/views/system/userinfo/components/basic-info.vue";
|
||||
import SecuritySettings from "@/views/system/userinfo/components/security-settings.vue";
|
||||
import useGlobalProperties from "@/hooks/useGlobalProperties";
|
||||
import { getUserInfoAPI } from "@/api/modules/user/index";
|
||||
import { useRouteConfigStore } from "@/store/modules/route-config";
|
||||
|
||||
const route = useRoute();
|
||||
const proxy = useGlobalProperties();
|
||||
const routerStore = useRouteConfigStore();
|
||||
|
||||
interface Detail {
|
||||
key: string;
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
const type = ref("rounded");
|
||||
const size = ref("medium");
|
||||
const activeTabs = ref(route.query.type || "1");
|
||||
|
||||
const onChangeTab = (e: string) => {
|
||||
activeTabs.value = e;
|
||||
};
|
||||
|
||||
const detail = ref<Detail[]>([
|
||||
{
|
||||
key: "userName",
|
||||
label: "用户名:",
|
||||
value: "-"
|
||||
},
|
||||
{
|
||||
key: "nickName",
|
||||
label: "用户昵称:",
|
||||
value: "-"
|
||||
},
|
||||
{
|
||||
key: "sex",
|
||||
label: "性别:",
|
||||
value: "-"
|
||||
},
|
||||
{
|
||||
key: "roles",
|
||||
label: "角色:",
|
||||
value: "-"
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
label: "状态:",
|
||||
value: "-"
|
||||
},
|
||||
{
|
||||
key: "email",
|
||||
label: "邮箱:",
|
||||
value: "-"
|
||||
},
|
||||
{
|
||||
key: "phone",
|
||||
label: "手机号:",
|
||||
value: "-"
|
||||
},
|
||||
{
|
||||
key: "deptName",
|
||||
label: "部门:",
|
||||
value: "-"
|
||||
},
|
||||
{
|
||||
key: "createTime",
|
||||
label: "注册时间:",
|
||||
value: "-"
|
||||
},
|
||||
{
|
||||
key: "description",
|
||||
label: "描述:",
|
||||
value: "-"
|
||||
}
|
||||
]);
|
||||
|
||||
const toast = () => {
|
||||
proxy.$message.info("修改头像");
|
||||
};
|
||||
|
||||
const refresh = () => {
|
||||
getUserInfo();
|
||||
};
|
||||
|
||||
const loading = ref<boolean>(false);
|
||||
const userInfo = ref<any>({});
|
||||
const getUserInfo = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
let params = {
|
||||
id: route.query.id ? route.query.id : ""
|
||||
};
|
||||
let data = await getUserInfoAPI(params);
|
||||
userInfo.value = data.data.user;
|
||||
detail.value.forEach((item: Detail) => {
|
||||
if (userInfo.value.hasOwnProperty(item.key)) {
|
||||
item.value = userInfo.value[item.key];
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
getUserInfo();
|
||||
routerStore.setTabsTitle(`用户${route.query.userName ? " - " + route.query.userName : "信息"}`);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.margin-top {
|
||||
margin-top: $padding;
|
||||
}
|
||||
|
||||
// 解决tabs宽度异常的bug
|
||||
// :deep(.arco-tabs-content .arco-tabs-content-list) {
|
||||
// display: unset;
|
||||
// }
|
||||
</style>
|
||||
@@ -1,199 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-form ref="formRef" auto-label-width :model="formData.form">
|
||||
<a-row :gutter="16">
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="name" label="姓名">
|
||||
<a-input v-model="formData.form.name" placeholder="请输入姓名" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="phone" label="手机号">
|
||||
<a-input v-model="formData.form.phone" placeholder="请输入手机号" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="email" label="邮箱">
|
||||
<a-input v-model="formData.form.email" placeholder="请输入邮箱" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-space class="search-btn">
|
||||
<a-button type="primary" @click="getCommonTableList">
|
||||
<template #icon>
|
||||
<icon-search />
|
||||
</template>
|
||||
<template #default>查询</template>
|
||||
</a-button>
|
||||
<a-button @click="onReset">
|
||||
<template #icon>
|
||||
<icon-refresh />
|
||||
</template>
|
||||
<template #default>重置</template>
|
||||
</a-button>
|
||||
<a-button type="text" @click="formData.search = !formData.search">
|
||||
<template #icon>
|
||||
<icon-up v-if="formData.search" />
|
||||
<icon-down v-else />
|
||||
</template>
|
||||
<template #default>{{ formData.search ? "收起" : "展开" }}</template>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16" v-if="formData.search">
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="address" label="地址">
|
||||
<a-input v-model="formData.form.address" placeholder="请输入地址" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="status" label="用户状态">
|
||||
<a-select v-model="formData.form.status" placeholder="请选择用户状态" allow-clear>
|
||||
<a-option value="1">停用</a-option>
|
||||
<a-option value="2">启用</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<a-table
|
||||
row-key="key"
|
||||
size="small"
|
||||
:bordered="{
|
||||
cell: true
|
||||
}"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
:row-selection="rowSelection"
|
||||
v-model:selectedKeys="selectedKeys"
|
||||
:pagination="pagination"
|
||||
@page-change="pageChange"
|
||||
@page-size-change="pageSizeChange"
|
||||
>
|
||||
<template #avatar="{ record }">
|
||||
<a-avatar
|
||||
auto-fix-font-size
|
||||
:size="30"
|
||||
:style="{
|
||||
backgroundColor: '#14a9f8'
|
||||
}"
|
||||
>
|
||||
{{ record.avatar }}
|
||||
</a-avatar>
|
||||
</template>
|
||||
<template #status="{ record }">
|
||||
<a-space>
|
||||
<a-tag size="small" color="green" v-if="record.status == 1">启用</a-tag>
|
||||
<a-tag size="small" color="red" v-else>停用</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #optional>
|
||||
<a-space>
|
||||
<a-button size="mini" type="primary">详情</a-button>
|
||||
<a-button size="mini">修改</a-button>
|
||||
<a-popconfirm content="确定删除这条数据吗?" type="warning">
|
||||
<a-button size="mini" type="primary" status="danger">删除</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getCommonTableListAPI } from "@/api/modules/table/index";
|
||||
import { List, FormData, RowSelection, Pagination } from "./config";
|
||||
const formData = reactive<FormData>({
|
||||
form: {
|
||||
name: "",
|
||||
phone: "",
|
||||
email: "",
|
||||
address: "",
|
||||
status: null
|
||||
},
|
||||
search: false
|
||||
});
|
||||
const selectedKeys = ref<string[]>([]);
|
||||
const rowSelection = reactive<RowSelection>({
|
||||
type: "checkbox",
|
||||
showCheckedAll: true,
|
||||
onlyCurrent: false
|
||||
});
|
||||
const pagination = ref<Pagination>({ showPageSize: true, showTotal: true, current: 1, pageSize: 10, total: 10 });
|
||||
const pageChange = (page: number) => {
|
||||
pagination.value.current = page;
|
||||
};
|
||||
const pageSizeChange = (pageSize: number) => {
|
||||
pagination.value.pageSize = pageSize;
|
||||
};
|
||||
const columns = [
|
||||
{
|
||||
title: "姓名",
|
||||
dataIndex: "name"
|
||||
},
|
||||
{
|
||||
title: "头像",
|
||||
dataIndex: "avatar",
|
||||
slotName: "avatar",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
title: "手机号",
|
||||
dataIndex: "phone"
|
||||
},
|
||||
{
|
||||
title: "Email",
|
||||
dataIndex: "email"
|
||||
},
|
||||
{
|
||||
title: "居住地址",
|
||||
dataIndex: "address"
|
||||
},
|
||||
{
|
||||
title: "用户状态",
|
||||
dataIndex: "status",
|
||||
align: "center",
|
||||
slotName: "status"
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
dataIndex: "createTime"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
slotName: "optional",
|
||||
align: "center",
|
||||
fixed: "right",
|
||||
width: "200"
|
||||
}
|
||||
];
|
||||
const formRef = ref();
|
||||
const onReset = () => {
|
||||
formRef.value.resetFields();
|
||||
getCommonTableList();
|
||||
};
|
||||
const loading = ref<boolean>(false);
|
||||
const data = reactive<List[]>([]);
|
||||
const getCommonTableList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
let res = await getCommonTableListAPI();
|
||||
Object.assign(data, res.data.list);
|
||||
pagination.value.total = res.data.total;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
getCommonTableList();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.search-btn {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,37 +0,0 @@
|
||||
interface List {
|
||||
key: string;
|
||||
name: string;
|
||||
avatar: string;
|
||||
phone: string;
|
||||
email: string;
|
||||
address: string;
|
||||
status: number;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
form: {
|
||||
name: string;
|
||||
phone: string;
|
||||
email: string;
|
||||
address: string;
|
||||
status: number | null;
|
||||
};
|
||||
search: boolean;
|
||||
}
|
||||
|
||||
interface RowSelection {
|
||||
type: string;
|
||||
showCheckedAll: boolean;
|
||||
onlyCurrent: boolean;
|
||||
}
|
||||
|
||||
interface Pagination {
|
||||
showPageSize: boolean;
|
||||
showTotal: boolean;
|
||||
current: number;
|
||||
pageSize: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
export type { List, FormData, RowSelection, Pagination };
|
||||
@@ -1,51 +0,0 @@
|
||||
interface List {
|
||||
key: string;
|
||||
serial: string;
|
||||
name: string;
|
||||
content: string;
|
||||
searchType: string;
|
||||
contentSize: number;
|
||||
status: number;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
form: {
|
||||
serial: string;
|
||||
name: string;
|
||||
content: string;
|
||||
contentSize: string;
|
||||
status: number | null;
|
||||
createTime: string | null;
|
||||
};
|
||||
search: boolean;
|
||||
}
|
||||
|
||||
interface RowSelection {
|
||||
type: string;
|
||||
showCheckedAll: boolean;
|
||||
onlyCurrent: boolean;
|
||||
}
|
||||
|
||||
interface Pagination {
|
||||
showPageSize: boolean;
|
||||
showTotal: boolean;
|
||||
current: number;
|
||||
pageSize: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
interface Columns {
|
||||
title: string;
|
||||
dataIndex?: string;
|
||||
checked: boolean;
|
||||
slotName?: string;
|
||||
align?: string;
|
||||
}
|
||||
|
||||
interface DensityType {
|
||||
value: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export type { List, FormData, RowSelection, Pagination, Columns, DensityType };
|
||||
@@ -1,349 +0,0 @@
|
||||
<template>
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner">
|
||||
<a-form ref="formRef" :model="formData.form" auto-label-width>
|
||||
<a-row :gutter="16">
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="serial" label="集合编号">
|
||||
<a-input v-model="formData.form.serial" placeholder="请输入集合编号" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="name" label="集合名称">
|
||||
<a-input v-model="formData.form.name" placeholder="请输入集合名称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="content" label="内容载体">
|
||||
<a-input v-model="formData.form.content" placeholder="请输入内容载体" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-space class="search-btn">
|
||||
<a-button type="primary" @click="getCustomTableList">
|
||||
<template #icon>
|
||||
<icon-search />
|
||||
</template>
|
||||
<template #default>查询</template>
|
||||
</a-button>
|
||||
<a-button @click="onReset">
|
||||
<template #icon>
|
||||
<icon-refresh />
|
||||
</template>
|
||||
<template #default>重置</template>
|
||||
</a-button>
|
||||
<a-button type="text" @click="formData.search = !formData.search">
|
||||
<template #icon>
|
||||
<icon-up v-if="formData.search" />
|
||||
<icon-down v-else />
|
||||
</template>
|
||||
<template #default>{{ formData.search ? "收起" : "展开" }}</template>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16" v-if="formData.search">
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="contentSize" label="内容量">
|
||||
<a-input v-model="formData.form.contentSize" placeholder="请输入内容量" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="status" label="集合状态">
|
||||
<a-select v-model="formData.form.status" placeholder="请选择集合状态" allow-clear>
|
||||
<a-option value="1">已上线</a-option>
|
||||
<a-option value="2">已下线</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6" :xxl="6">
|
||||
<a-form-item field="createTime" label="创建时间">
|
||||
<a-range-picker v-model="formData.form.createTime" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<a-divider :margin="0" />
|
||||
<a-row :gutter="16" style="margin: 16px 0">
|
||||
<a-col :span="12">
|
||||
<a-space size="medium">
|
||||
<a-button type="primary">
|
||||
<template #icon>
|
||||
<icon-plus />
|
||||
</template>
|
||||
新建
|
||||
</a-button>
|
||||
<a-upload action="/">
|
||||
<template #upload-button>
|
||||
<a-button> 批量导入 </a-button>
|
||||
</template>
|
||||
</a-upload>
|
||||
</a-space>
|
||||
</a-col>
|
||||
<a-col :span="12" style="display: flex; align-items: center; justify-content: end">
|
||||
<a-space size="medium">
|
||||
<a-button>
|
||||
<template #icon>
|
||||
<icon-download />
|
||||
</template>
|
||||
下载
|
||||
</a-button>
|
||||
<a-tooltip content="刷新">
|
||||
<div class="action-icon" @click="getCustomTableList"><icon-refresh size="18" /></div>
|
||||
</a-tooltip>
|
||||
<a-dropdown @select="onDensity">
|
||||
<a-tooltip content="密度">
|
||||
<div class="action-icon"><icon-line-height size="18" /></div>
|
||||
</a-tooltip>
|
||||
<template #content>
|
||||
<a-doption v-for="item in densityType" :value="item.value" :key="item.value" :disabled="item.value === density">{{
|
||||
item.label
|
||||
}}</a-doption>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
<a-tooltip content="列设置">
|
||||
<a-popover trigger="click" position="br" @popup-visible-change="popupVisibleChange">
|
||||
<div class="action-icon"><icon-settings size="18" /></div>
|
||||
<template #content>
|
||||
<div id="tableSetting">
|
||||
<div v-for="(item, index) in columns" :key="item.dataIndex" class="setting">
|
||||
<div class="setting-box-icon">
|
||||
<icon-drag-arrow />
|
||||
</div>
|
||||
<div>
|
||||
<a-checkbox v-model="item.checked" @change="onCheckbox($event, item, index)"> </a-checkbox>
|
||||
</div>
|
||||
<div class="title">
|
||||
{{ item.title }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</a-popover>
|
||||
</a-tooltip>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-table
|
||||
row-key="key"
|
||||
column-resizable
|
||||
:loading="loading"
|
||||
:size="density"
|
||||
:bordered="{
|
||||
cell: true
|
||||
}"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||
:columns="columnsShow"
|
||||
:data="data"
|
||||
:row-selection="rowSelection"
|
||||
v-model:selectedKeys="selectedKeys"
|
||||
:pagination="pagination"
|
||||
@page-change="pageChange"
|
||||
@page-size-change="pageSizeChange"
|
||||
>
|
||||
<template #content="{ record }">
|
||||
<a-space>
|
||||
<s-svg-icon :name="'word'" :size="18" v-if="record.content == '图文'" />
|
||||
<s-svg-icon :name="'video'" :size="18" v-if="record.content == '视频'" />
|
||||
<s-svg-icon :name="'mp3'" :size="18" v-if="record.content == '音频'" />
|
||||
<span>{{ record.content }}</span>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #status="{ record }">
|
||||
<a-space>
|
||||
<a-badge status="success" text="已上线" v-if="record.status == 1" />
|
||||
<a-badge status="processing" text="已下线" v-else />
|
||||
</a-space>
|
||||
</template>
|
||||
<template #optional>
|
||||
<a-space>
|
||||
<a-button size="mini" type="text">查看</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getCustomTableListAPI } from "@/api/modules/table/index";
|
||||
import { List, FormData, RowSelection, Pagination, Columns, DensityType } from "./config";
|
||||
import { deepClone } from "@/utils";
|
||||
import Sortable from "sortablejs";
|
||||
const formData = reactive<FormData>({
|
||||
form: {
|
||||
serial: "",
|
||||
name: "",
|
||||
content: "",
|
||||
contentSize: "",
|
||||
status: null,
|
||||
createTime: null
|
||||
},
|
||||
search: false
|
||||
});
|
||||
const selectedKeys = ref<string[]>([]);
|
||||
const rowSelection = reactive<RowSelection>({
|
||||
type: "checkbox",
|
||||
showCheckedAll: true,
|
||||
onlyCurrent: false
|
||||
});
|
||||
const formRef = ref();
|
||||
const onReset = () => {
|
||||
formRef.value.resetFields();
|
||||
getCustomTableList();
|
||||
};
|
||||
const pagination = ref<Pagination>({ showPageSize: true, showTotal: true, current: 1, pageSize: 10, total: 10 });
|
||||
const pageChange = (page: number) => {
|
||||
pagination.value.current = page;
|
||||
};
|
||||
const pageSizeChange = (pageSize: number) => {
|
||||
pagination.value.pageSize = pageSize;
|
||||
};
|
||||
const columnsShow = ref<Columns[]>([]);
|
||||
const columns = ref<Columns[]>([
|
||||
{
|
||||
title: "集合编号",
|
||||
dataIndex: "serial",
|
||||
checked: true
|
||||
},
|
||||
{
|
||||
title: "集合名称",
|
||||
dataIndex: "name",
|
||||
checked: true
|
||||
},
|
||||
{
|
||||
title: "内容载体",
|
||||
dataIndex: "content",
|
||||
checked: true,
|
||||
slotName: "content"
|
||||
},
|
||||
{
|
||||
title: "筛选方式",
|
||||
dataIndex: "searchType",
|
||||
checked: true
|
||||
},
|
||||
{
|
||||
title: "内容量",
|
||||
dataIndex: "contentSize",
|
||||
checked: true
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
dataIndex: "createTime",
|
||||
checked: true
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
slotName: "status",
|
||||
align: "center",
|
||||
checked: true
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
slotName: "optional",
|
||||
align: "center",
|
||||
checked: true
|
||||
}
|
||||
]);
|
||||
// 将columns深拷贝一份,两份分别用于弹窗展示和列表展示
|
||||
// 原因:弹窗展示时可以勾选是否渲染,如果弹窗和列表共用一个数据,会导致数据勾选取消后无法复原
|
||||
const deepColumns = () => {
|
||||
columnsShow.value = deepClone(columns.value);
|
||||
};
|
||||
deepColumns();
|
||||
const loading = ref<boolean>(false);
|
||||
const data = reactive<List[]>([]);
|
||||
const getCustomTableList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
let res = await getCustomTableListAPI();
|
||||
Object.assign(data, res.data.list);
|
||||
pagination.value.total = res.data.total;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
getCustomTableList();
|
||||
const densityType = ref<DensityType[]>([
|
||||
{
|
||||
value: "mini",
|
||||
label: "迷你"
|
||||
},
|
||||
{
|
||||
value: "small",
|
||||
label: "偏小"
|
||||
},
|
||||
{
|
||||
value: "medium",
|
||||
label: "中等"
|
||||
},
|
||||
{
|
||||
value: "large",
|
||||
label: "偏大"
|
||||
}
|
||||
]);
|
||||
|
||||
// 密度
|
||||
const density = ref<string>("small");
|
||||
const onDensity = (e: string) => {
|
||||
density.value = e;
|
||||
};
|
||||
|
||||
// 修改列的显示隐藏
|
||||
const onCheckbox = (checked: any, row: any, index: any) => {
|
||||
if (!checked) {
|
||||
columnsShow.value = columnsShow.value.filter((item: any) => item.dataIndex != row.dataIndex);
|
||||
} else {
|
||||
columnsShow.value.splice(index, 0, row);
|
||||
}
|
||||
};
|
||||
// 气泡窗打开
|
||||
const popupVisibleChange = (visible: boolean) => {
|
||||
if (visible) {
|
||||
nextTick(() => {
|
||||
// 获取dom
|
||||
const el = document.getElementById("tableSetting") as HTMLElement;
|
||||
new Sortable(el, {
|
||||
onEnd(e: any) {
|
||||
// 移动结束后,获得新旧下标,这里不会实际更改原始值
|
||||
const { oldIndex, newIndex } = e;
|
||||
// 根据新旧下标更改原始值,更改弹窗columns和列表columns
|
||||
exchangeArray(columns.value, oldIndex, newIndex);
|
||||
exchangeArray(columnsShow.value, oldIndex, newIndex);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 位置替换
|
||||
const exchangeArray = (columns: Array<any>, oldIndex: number, newIndex: number) => {
|
||||
// 保存要交换的元素
|
||||
let temp = columns[newIndex];
|
||||
|
||||
// 将newIndex处的元素移动到oldIndex处
|
||||
columns[newIndex] = columns[oldIndex];
|
||||
|
||||
// 将保存的元素移动到newIndex处
|
||||
columns[oldIndex] = temp;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.search-btn {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.setting {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 200px;
|
||||
.setting-box-icon {
|
||||
margin-right: 4px;
|
||||
cursor: move;
|
||||
}
|
||||
.title {
|
||||
margin-left: $margin-text;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user