initial commit
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["johnsoncodehk.volar"]
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
# Vue 3 + Typescript + Vite + pinia + vue-router
|
||||
|
||||
# Create project document how to bulid a project
|
||||
before create project, you should install node to promit npm and node command is standy.
|
||||
npm -v
|
||||
node -v<br />
|
||||
|
||||
// 在想要创建的工程路径下执行以下命令,3到6秒就可以结束
|
||||
npm init vite@latest
|
||||
// 1.填写 g-home
|
||||
// 2.选择vue
|
||||
// 3.vue.ts
|
||||
|
||||
cd g-home
|
||||
npm install
|
||||
|
||||
# vue-router
|
||||
|
||||
npm install vue-router -S
|
||||
|
||||
# pinia
|
||||
// instand of vuex
|
||||
npm install pinia -S
|
||||
|
||||
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
Generated
+1375
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "g-home",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^1.1.4",
|
||||
"axios": "^0.26.1",
|
||||
"clipboard": "^2.0.10",
|
||||
"copy-to-clipboard": "^3.3.1",
|
||||
"element-plus": "^2.1.7",
|
||||
"js-cookie": "^3.0.1",
|
||||
"moment": "^2.29.1",
|
||||
"pinia": "^2.0.13",
|
||||
"vue": "^3.2.25",
|
||||
"vue-router": "^4.0.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-cookie": "^3.0.1",
|
||||
"@vitejs/plugin-vue": "^2.3.0",
|
||||
"typescript": "^4.5.4",
|
||||
"vite": "^2.9.0",
|
||||
"vue-tsc": "^0.29.8"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -0,0 +1,38 @@
|
||||
import request from '../utils/request'
|
||||
const search_bookmark = (params: Object) => {
|
||||
return request({
|
||||
url: '/bookmark',
|
||||
method: 'get',
|
||||
headers: {},
|
||||
// data: params
|
||||
})
|
||||
}
|
||||
|
||||
const put_bookmark = (params: Object) => {
|
||||
return request({
|
||||
url: '/bookmark',
|
||||
method: 'put',
|
||||
headers: {},
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
const delete_bookmark = (params: Object) => {
|
||||
return request({
|
||||
url: '/bookmark',
|
||||
method: 'delete',
|
||||
headers: {},
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
const delete_bookmarks = (params: Object) => {
|
||||
return request({
|
||||
url: '/bookmark',
|
||||
method: 'delete',
|
||||
headers: {},
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
export { search_bookmark, put_bookmark, delete_bookmark, delete_bookmarks }
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,52 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
defineProps<{ msg: string }>()
|
||||
|
||||
const count = ref(0)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>{{ msg }}</h1>
|
||||
|
||||
<p>
|
||||
Recommended IDE setup:
|
||||
<a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
|
||||
+
|
||||
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
|
||||
</p>
|
||||
|
||||
<p>See <code>README.md</code> for more information.</p>
|
||||
|
||||
<p>
|
||||
<a href="https://vitejs.dev/guide/features.html" target="_blank">
|
||||
Vite Docs
|
||||
</a>
|
||||
|
|
||||
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Docs</a>
|
||||
</p>
|
||||
|
||||
<button type="button" @click="count++">count is: {{ count }}</button>
|
||||
<p>
|
||||
Edit
|
||||
<code>components/HelloWorld.vue</code> to test hot module replacement.
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
|
||||
label {
|
||||
margin: 0 0.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
code {
|
||||
background-color: #eee;
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
color: #304455;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-container>
|
||||
<el-aside width="150px">
|
||||
<SideBar></SideBar>
|
||||
</el-aside>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<NavBar></NavBar>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<MainApp></MainApp>
|
||||
</el-main>
|
||||
<el-footer>
|
||||
<span>
|
||||
小管设计
|
||||
<br />一个执着于小提琴学习的垃圾程序员
|
||||
</span>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import MainApp from '../layout/MainApp.vue';
|
||||
import NavBar from "../layout/NavBar.vue";
|
||||
import SideBar from "../layout/SideBar.vue";
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* .el-header,
|
||||
.el-footer {
|
||||
background-color: #b8d1b3;
|
||||
color: rgb(51, 51, 51);
|
||||
text-align: center;
|
||||
line-height: 60px;
|
||||
}
|
||||
|
||||
.el-aside {
|
||||
background-color: #e9eef3;
|
||||
color: #333;
|
||||
text-align: left;
|
||||
line-height: 200px;
|
||||
}
|
||||
|
||||
.el-main {
|
||||
background-color: #e9eef3;
|
||||
color: #333;
|
||||
/* line-height: 450px; */
|
||||
/* vertical-align: top;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
body > .el-container {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.el-container:nth-child(5) .el-aside,
|
||||
.el-container:nth-child(6) .el-aside {
|
||||
line-height: 260px;
|
||||
}
|
||||
|
||||
.el-container:nth-child(7) .el-aside {
|
||||
line-height: 320px;
|
||||
} */
|
||||
</style>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<section class="section-main"
|
||||
style="height:100%;">
|
||||
<router-view style="height:100%;" />
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<div class="nav-main">
|
||||
当前时间:{{ time }}
|
||||
<span>论一个程序员的寂寞与忧伤</span>
|
||||
|
||||
<el-button icon="open_side" circle></el-button>
|
||||
<el-dropdown>
|
||||
<i class="el-icon-setting" style="margin-right: 15px"></i>
|
||||
<!-- <el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item>查看</el-dropdown-item>
|
||||
<el-dropdown-item>新增</el-dropdown-item>
|
||||
<el-dropdown-item>删除</el-dropdown-item>
|
||||
</el-dropdown-menu>-->
|
||||
</el-dropdown>
|
||||
<span>小管</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import $moment from "moment";
|
||||
import { ref } from "vue";
|
||||
|
||||
const getTime = () => {
|
||||
return $moment().format("YYYY年MM月DD日 HH:mm:ss");
|
||||
};
|
||||
|
||||
let time = ref<String>(getTime());
|
||||
|
||||
const timeChange = () => {
|
||||
time.value = getTime();
|
||||
};
|
||||
setInterval(timeChange, 1000);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.open_side {
|
||||
background: url("../../assets/logo.png") center no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.nav-main {
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-menu router>
|
||||
<el-menu-item
|
||||
v-for="(route, index) in current_routes"
|
||||
v-bind:key="index"
|
||||
v-bind:index="route.path"
|
||||
v-bind:title="route.meta?.name"
|
||||
>{{ route.meta?.name }}</el-menu-item>
|
||||
</el-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import { RouteRecordRaw } from "vue-router";
|
||||
import { store } from "../../store/index";
|
||||
import router from "../../router/index";
|
||||
import { reactive } from "vue";
|
||||
let current_routes = router.options.routes[0].children;
|
||||
console.log(router.options.routes[0].children);
|
||||
// let current_routes = reactive<Array<RouteRecordRaw>>(
|
||||
|
||||
// );
|
||||
|
||||
// console.log(so);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
closeStyle {
|
||||
width: 100px;
|
||||
}
|
||||
.side-main {
|
||||
width: 200px;
|
||||
}
|
||||
.el-menu-item {
|
||||
background-color: #01dfd7;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
login
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.login {
|
||||
background-color: beige;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
const from_static_data = {
|
||||
list: [
|
||||
{
|
||||
binary: 2,
|
||||
flg: true,
|
||||
text: '2进制',
|
||||
style: 'background-color: #F8F8FF'
|
||||
},
|
||||
{
|
||||
binary: 8,
|
||||
flg: true,
|
||||
text: '8进制',
|
||||
style: 'background-color: #F8F8FF'
|
||||
},
|
||||
{
|
||||
binary: 10,
|
||||
flg: true,
|
||||
text: '10进制',
|
||||
style: 'background-color: #F8F8FF'
|
||||
},
|
||||
{
|
||||
binary: 16,
|
||||
flg: true,
|
||||
text: '16进制',
|
||||
style: 'background-color: #F8F8FF'
|
||||
},
|
||||
{
|
||||
binary: 32,
|
||||
flg: true,
|
||||
text: '32进制',
|
||||
style: 'background-color: #F8F8FF'
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
const to_static_data = {
|
||||
list: [
|
||||
{
|
||||
binary: 2,
|
||||
flg: false,
|
||||
text: '2进制',
|
||||
style: 'background-color: #F8F8FF'
|
||||
},
|
||||
{
|
||||
binary: 8,
|
||||
flg: false,
|
||||
text: '8进制',
|
||||
style: 'background-color: #F8F8FF'
|
||||
},
|
||||
{
|
||||
binary: 10,
|
||||
flg: false,
|
||||
text: '10进制',
|
||||
style: 'background-color: #F8F8FF'
|
||||
},
|
||||
{
|
||||
binary: 16,
|
||||
flg: false,
|
||||
text: '16进制',
|
||||
style: 'background-color: #F8F8FF'
|
||||
},
|
||||
{
|
||||
binary: 32,
|
||||
flg: false,
|
||||
text: '32进制',
|
||||
style: 'background-color: #F8F8FF'
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
export { from_static_data, to_static_data }
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import ElementPlus from "element-plus";
|
||||
import 'element-plus/dist/index.css'
|
||||
import router from './router'
|
||||
|
||||
// vue store
|
||||
import { createPinia } from 'pinia'
|
||||
const store = createPinia()
|
||||
|
||||
let app = createApp(App)
|
||||
|
||||
|
||||
app.use(router)
|
||||
app.use(ElementPlus)
|
||||
app.use(store)
|
||||
app.mount('#app')
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import { createRouter, createMemoryHistory, RouteRecordRaw } from 'vue-router'
|
||||
|
||||
const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: "/",
|
||||
component: () => import('../components/layout/layout.vue'),
|
||||
children: [
|
||||
{
|
||||
path: '/home',
|
||||
component: () => import('../view/dashboard/index.vue'),
|
||||
meta: {
|
||||
name: '控制台'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/tools',
|
||||
component: () => import('../view/tools/index.vue'),
|
||||
meta: {
|
||||
name: '工具'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/blog',
|
||||
component: () => import('../view/blog/index.vue'),
|
||||
meta: {
|
||||
name: '博客'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/bookmark',
|
||||
component: () => import('../view/bookmark/index.vue'),
|
||||
meta: {
|
||||
name: '书签'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/school',
|
||||
component: () => import('../view/school/index.vue'),
|
||||
meta: {
|
||||
name: '学习'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/thinking',
|
||||
component: () => import('../view/thinking/index.vue'),
|
||||
meta: {
|
||||
name: '感悟人生'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/cloud',
|
||||
component: () => import('../view/cloud/index.vue'),
|
||||
meta: {
|
||||
name: '个人云盘'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/recommend',
|
||||
component: () => import('../view/recommend/index.vue'),
|
||||
meta: {
|
||||
name: '推荐中'
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
export default router
|
||||
@@ -0,0 +1,6 @@
|
||||
const query = () => {
|
||||
|
||||
|
||||
}
|
||||
|
||||
export { query }
|
||||
@@ -0,0 +1,19 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { Tables } from './table'
|
||||
|
||||
export const store = defineStore(Tables.AccessRoutes, {
|
||||
state: () => {
|
||||
return [
|
||||
{
|
||||
current: 1,
|
||||
name: 'xiaoman'
|
||||
}
|
||||
]
|
||||
},
|
||||
getters: {
|
||||
|
||||
},
|
||||
actions: {
|
||||
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
export const enum Tables {
|
||||
AccessRoutes = 'AccessRoutes'
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
const getToken = () => {
|
||||
const token = Cookies.get('token')
|
||||
return token
|
||||
}
|
||||
|
||||
const setToken = (token: String) => {
|
||||
Cookies.set('token', token)
|
||||
}
|
||||
|
||||
const resetToken = (token: String) => {
|
||||
Cookies.set('token', "")
|
||||
}
|
||||
|
||||
export { getToken, setToken, resetToken }
|
||||
@@ -0,0 +1,54 @@
|
||||
import axios from 'axios'
|
||||
|
||||
const service = axios.create(
|
||||
{
|
||||
baseURL: 'http://localhost:8081',
|
||||
timeout: 5000
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
// service.interceptors.request.use(
|
||||
// config => {
|
||||
// if (true) {
|
||||
// config.headers['Authorization'] = 'Bearer' + getToken('user-token')
|
||||
// }
|
||||
// return config
|
||||
// },
|
||||
// error => {
|
||||
// console.log(error)
|
||||
// return Promise.reject(error)
|
||||
// }
|
||||
// )
|
||||
|
||||
// service.interceptors.response.use(
|
||||
// response => {
|
||||
// if (response.headers['content-dispostion']
|
||||
// && response.headers['content-dispostion'].split(';')[0] === 'attachment') {
|
||||
// return response
|
||||
// } else {
|
||||
// return response.data
|
||||
// }
|
||||
// },
|
||||
// async error => {
|
||||
// if (error.code === 'ECONNABORTED') {
|
||||
// const error = {
|
||||
// message: '通信タイムアウト'
|
||||
// }
|
||||
// return Promise.reject(error)
|
||||
// } else if (!error.response) {
|
||||
// const error = {
|
||||
// message: 'サーバーエラー'
|
||||
// }
|
||||
// return Promise.reject(error)
|
||||
// } else if (error.response && error.response.status && (error.response.status === 403 || error.response.status === 403)) {
|
||||
|
||||
// } else {
|
||||
// return Promise.reject(error.response.data)
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
|
||||
export default service
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<div class="dashboard">blog</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.dashboard {
|
||||
background-color: beige;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<div class="dashboard">
|
||||
<el-form :model="form">
|
||||
<el-form-item label="分类" :label-width="formLabelWidth">
|
||||
<el-select v-model="form.type" placeholder="请选择">
|
||||
<el-option label="Java" value="Java" />
|
||||
<el-option label="Python" value="Python" />
|
||||
</el-select>
|
||||
<el-form-item label="备注" :label-width="formLabelWidth">
|
||||
<el-input v-model="form.comment" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="url" :label-width="formLabelWidth">
|
||||
<el-input v-model="form.url" autocomplete="off" />
|
||||
</el-form-item>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <template #footer> -->
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="concel">取消</el-button>
|
||||
<el-button type="primary" @click="submit">提交</el-button>
|
||||
</span>
|
||||
<!-- </template> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
const formLabelWidth = '140px'
|
||||
|
||||
const form = reactive({
|
||||
type: '',
|
||||
comment: '',
|
||||
url: ''
|
||||
})
|
||||
|
||||
// type Props = {
|
||||
// id: number,
|
||||
// type: string,
|
||||
// comment: string,
|
||||
// url: string
|
||||
// }
|
||||
|
||||
// const ttt = defineProps<Props>()
|
||||
// form.comment = ttt.comment
|
||||
// form.type = ttt.type
|
||||
// form.url = ttt.url
|
||||
|
||||
const emit = defineEmits(['on-concel', 'on-submit'])
|
||||
const concel = () => {
|
||||
emit('on-concel')
|
||||
}
|
||||
const submit = () => {
|
||||
emit('on-submit', form)
|
||||
}
|
||||
</script>
|
||||
<style scoped>.el-button--text {
|
||||
margin-right: 15px;
|
||||
}
|
||||
.el-select {
|
||||
width: 300px;
|
||||
}
|
||||
.el-input {
|
||||
width: 300px;
|
||||
}
|
||||
.dialog-footer button:first-child {
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<div class="dashboard">
|
||||
<el-form>
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<!-- <el-form-item>
|
||||
<el-autocomplete
|
||||
v-model="search_data.drug"
|
||||
poper-class="my-autocomplete"
|
||||
:fetch-suggestions="query"
|
||||
placeholder="xxx"
|
||||
label=":"
|
||||
:poper-append-to-body="false"
|
||||
>
|
||||
<template slot-scope="{item}">
|
||||
<span class="value">{{ item.value }}</span>
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
</el-form-item>-->
|
||||
</el-col>
|
||||
<el-col>
|
||||
<el-button type="primary" @click="doSearch">检索</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-tag class="ml-2 click-icon" type="success">Java</el-tag>
|
||||
<el-tag class="ml-2 click-icon" type="success">Xml</el-tag>
|
||||
<el-tag class="ml-2 click-icon" type="success">Html</el-tag>
|
||||
<el-tag class="ml-2 click-icon" type="success">ddo</el-tag>
|
||||
<el-button type="primary" @click="openDialog">添加</el-button>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div></div>
|
||||
|
||||
<el-table
|
||||
ref="multipleTableRef"
|
||||
:data="tableData"
|
||||
@selection-change="handleSelectionChange"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column type="index" label="index" width="180" />
|
||||
<el-table-column prop="type" label="分类" width="180" />
|
||||
<el-table-column prop="comment" label="名称" width="180" />
|
||||
<el-table-column class="click-icon" prop="url" label="url" />
|
||||
<el-table-column class="click-icon" prop label="操作">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="handleEdit(scope.$index, scope.row)">Edit</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="danger"
|
||||
@click="handleDelete(scope.$index, scope.row)"
|
||||
>Delete</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="margin-top: 20px">
|
||||
<el-button @click="toggleSelection([tableData[1], tableData[2]])">反选</el-button>
|
||||
<el-button @click="toggleSelection()">清除</el-button>
|
||||
</div>
|
||||
<el-dialog v-model="dialogFormVisible" title="添加书签">
|
||||
<bookmark_dialog
|
||||
:inputdata="currentDialogData"
|
||||
@on-concel="closeDialog"
|
||||
@on-submit="doSubmit"
|
||||
></bookmark_dialog>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { query } from '../../service/search'
|
||||
import { search_bookmark, put_bookmark } from '../../api/bookmark'
|
||||
import bookmark_dialog from './dialog.vue'
|
||||
import type { ElTable } from 'element-plus'
|
||||
|
||||
// 定义书签格式
|
||||
type Bookmark = {
|
||||
id: number,
|
||||
type: String,
|
||||
comment: String,
|
||||
url: String
|
||||
}
|
||||
|
||||
let dialogFormVisible = ref(false)
|
||||
const search_data = reactive({
|
||||
drug: '1'
|
||||
})
|
||||
// 响应式table数据
|
||||
const tableData = reactive<Bookmark[]>([])
|
||||
// 响应式dialog数据
|
||||
const currentDialogData = reactive<Bookmark>({
|
||||
id: -1,
|
||||
type: '',
|
||||
comment: '',
|
||||
url: ''
|
||||
})
|
||||
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
||||
const multipleSelection = ref<Bookmark[]>([])
|
||||
const toggleSelection = (rows?: Bookmark[]) => {
|
||||
if (rows) {
|
||||
rows.forEach((row) => {
|
||||
// TODO: improvement typing when refactor table
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
multipleTableRef.value!.toggleRowSelection(row, undefined)
|
||||
})
|
||||
} else {
|
||||
multipleTableRef.value!.clearSelection()
|
||||
}
|
||||
}
|
||||
|
||||
const handleEdit = (index: number, bookmark: Bookmark) => {
|
||||
Object.assign(currentDialogData, bookmark)
|
||||
openDialog()
|
||||
}
|
||||
|
||||
const handleDelete = (index: number, bookmark: Bookmark) => {
|
||||
|
||||
}
|
||||
|
||||
const handleSelectionChange = (val: Bookmark[]) => {
|
||||
console.log(val)
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
const doSearch = () => {
|
||||
tableData.splice(0, tableData.length)
|
||||
search_bookmark(1).then(response => {
|
||||
console.log(response.data)
|
||||
response.data.forEach((item: Bookmark, index: number) => {
|
||||
const row = {
|
||||
id: index + 1,
|
||||
type: item.type,
|
||||
comment: item.comment,
|
||||
url: item.url
|
||||
}
|
||||
tableData.push(row)
|
||||
})
|
||||
})
|
||||
}
|
||||
const openDialog = () => {
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
const closeDialog = () => {
|
||||
dialogFormVisible.value = false
|
||||
}
|
||||
const doSubmit = (form: any) => {
|
||||
put_bookmark(form).then(response => {
|
||||
|
||||
})
|
||||
dialogFormVisible.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.dashboard {
|
||||
background-color: beige;
|
||||
}
|
||||
.click-icon {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<div class="dashboard">cloud</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.dashboard {
|
||||
background-color: beige;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div class="dashboard">
|
||||
dashboard
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.dashboard {
|
||||
background-color: beige;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<div class="dashboard">recommend</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.dashboard {
|
||||
background-color: beige;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<div class="dashboard">study</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.dashboard {
|
||||
background-color: beige;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<div class="dashboard">thinking</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.dashboard {
|
||||
background-color: beige;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div style="display: flex; align-items:center;">
|
||||
<el-input
|
||||
class="text_input"
|
||||
v-model="input.in"
|
||||
v-on:input="handle(data.from, data.to)"
|
||||
:maxlength="20"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
<el-icon :size="10" style="margin-left: 10px;">
|
||||
<Right />
|
||||
</el-icon>
|
||||
<div class="text_output">
|
||||
<span>{{ input.out }}</span>
|
||||
<el-icon :size="20" @click="copyNumber" class="click-icon">
|
||||
<CopyDocument />
|
||||
</el-icon>
|
||||
</div>
|
||||
|
||||
<el-tag
|
||||
class="ml-2 click-icon"
|
||||
v-show="isPlus"
|
||||
type="success"
|
||||
@click="clickPlus"
|
||||
:data-clipboard-text="input.out"
|
||||
>+</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { CopyDocument, Right } from "@element-plus/icons-vue";
|
||||
import { reactive } from 'vue'
|
||||
import copy from 'copy-to-clipboard';
|
||||
import { h } from 'vue'
|
||||
import { ElNotification } from 'element-plus'
|
||||
|
||||
// 从父组件接受参数
|
||||
type Props = {
|
||||
data: {
|
||||
from: number,
|
||||
to: number
|
||||
},
|
||||
isPlus: boolean
|
||||
}
|
||||
const tt = defineProps<Props>()
|
||||
|
||||
// 对输入框进行响应式
|
||||
let input = reactive({
|
||||
in: '',
|
||||
out: ''
|
||||
})
|
||||
|
||||
// 进制转换控制器
|
||||
const handle = (from: number, to: number) => {
|
||||
if (from == 10) {
|
||||
convert10to(input.in, to)
|
||||
}
|
||||
if (to == 10) {
|
||||
input.out = parseInt(input.in, from) + ""
|
||||
}
|
||||
}
|
||||
|
||||
// 进制转换函数1
|
||||
const convert10to = (value: number | string, binary: number) => {
|
||||
if (value == '' || value == undefined) {
|
||||
input.out = ''
|
||||
return
|
||||
}
|
||||
let space = ' '
|
||||
// if (false == false) {
|
||||
// space = ''
|
||||
// }
|
||||
const tmp = Number(value).toString(binary)
|
||||
let firstByte = tmp.length > 3 ? tmp.substring(0, 4) : tmp.substring(0, tmp.length)
|
||||
for (let a = 4; a < tmp.length; a = a + 4) {
|
||||
firstByte = tmp.substring(a, a + 4) + space + firstByte
|
||||
}
|
||||
input.out = firstByte
|
||||
}
|
||||
|
||||
// 复制转换成功的数值,并提示 复制成功 信息
|
||||
const copyNumber = () => {
|
||||
copy(input.out)
|
||||
ElNotification({
|
||||
title: '',
|
||||
message: h('i', { style: 'color: teal' }, '复制成功'),
|
||||
})
|
||||
}
|
||||
|
||||
// 通知父组件增加一行,并提示 增加成功 信息
|
||||
const emit = defineEmits(['on-clickplus'])
|
||||
const clickPlus = () => {
|
||||
emit('on-clickplus')
|
||||
ElNotification({
|
||||
title: '',
|
||||
message: h('i', { style: 'color: teal' }, '增加成功'),
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.text_input {
|
||||
width: 300px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.text_output {
|
||||
width: 300px;
|
||||
border-radius: 4px;
|
||||
height: 30px;
|
||||
border: 1px solid rgba(151, 151, 151, 0.3);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-left: 10px;
|
||||
}
|
||||
span {
|
||||
font-size: 12px;
|
||||
}
|
||||
.click-icon {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<div class="frame_box">
|
||||
<unit class="unit_one"></unit>
|
||||
</div>
|
||||
<div class="unit_box" v-for="(index) in total">
|
||||
<unit class="unit_one"></unit>
|
||||
</div>
|
||||
<el-tag class="ml-2 click-icon" type="success" @click="add">增加一组</el-tag>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import unit from './unit.vue'
|
||||
let total = ref(0)
|
||||
const add = () => {
|
||||
total.value++
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.unit_box {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
border-top: 1px solid rgba(151, 151, 151, 0.3);
|
||||
border-bottom: 1px solid rgba(151, 151, 151, 0.3);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div class="tools">
|
||||
<!-- <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
|
||||
<el-tab-pane label="User" name="first">User</el-tab-pane>
|
||||
<el-tab-pane label="Config" name="second">Config</el-tab-pane>
|
||||
<el-tab-pane label="Role" name="third">Role</el-tab-pane>
|
||||
<el-tab-pane label="Task" name="fourth">Task</el-tab-pane>
|
||||
</el-tabs>-->
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane label="进制转换">
|
||||
<frame />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="JSON格式化">JSON格式化</el-tab-pane>
|
||||
<el-tab-pane label="SQL格式化">SQL格式化</el-tab-pane>
|
||||
<el-tab-pane label="SQL生成器">SQL生成器</el-tab-pane>
|
||||
<el-tab-pane label="XML格式化">XML生成器</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import type { TabsPaneContext } from 'element-plus'
|
||||
import frame from './frame.vue'
|
||||
console.log('tools')
|
||||
const activeName = ref('first')
|
||||
|
||||
const handleClick = (tab: TabsPaneContext, event: Event) => {
|
||||
console.log(tab, event)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.demo-tabs > .el-tabs__content {
|
||||
padding: 32px;
|
||||
color: #6b778c;
|
||||
font-size: 32px;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<div class="unit_tag" style="margin-bottom: 10px;">
|
||||
<el-tag class="ml-2">from</el-tag>
|
||||
<div v-for="(item, index) in colorup.list">
|
||||
<el-tag
|
||||
class="ml-2"
|
||||
:style="item.style"
|
||||
style
|
||||
@click="onChange(item.binary, item.flg, index)"
|
||||
>{{ item.text }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="unit_tag" style="margin-bottom: 10px; border-color: red;">
|
||||
<el-tag class="ml-2" style="width: 47.625px">to</el-tag>
|
||||
<div v-for="(item, index) in colordown.list">
|
||||
<el-tag
|
||||
class="ml-2"
|
||||
:style="item.style"
|
||||
@click="onChange(item.binary, item.flg, index)"
|
||||
>{{ item.text }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="test" style="margin-bottom: 10px; border-color: red;" v-for="(index) in total">
|
||||
<Cal @on-clickplus="add" :data="t2t" :isPlus="total == index"></Cal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
import Cal from './cal.vue'
|
||||
import { from_static_data, to_static_data } from '../../const/const'
|
||||
// 初期默认只有一个转换框,点击+号时增加一个转换框
|
||||
let total = ref(1)
|
||||
const add = () => {
|
||||
total.value++
|
||||
}
|
||||
|
||||
|
||||
// 相应式的 from 和 to,
|
||||
const t2t = reactive({
|
||||
from: 10,
|
||||
to: 2
|
||||
})
|
||||
|
||||
const colorup = reactive(JSON.parse(JSON.stringify(from_static_data)))
|
||||
colorup.list[2].style = 'background-color: gold'
|
||||
const colordown = reactive(JSON.parse(JSON.stringify(to_static_data)))
|
||||
colordown.list[0].style = 'background-color: gold'
|
||||
|
||||
//
|
||||
const onChange = (binary: number, isFrom: boolean, index: number) => {
|
||||
if (isFrom) {
|
||||
t2t.from = binary
|
||||
colorup.list.forEach((value: any, i: any) => {
|
||||
if (i == index) {
|
||||
value.style = 'background-color: gold'
|
||||
} else {
|
||||
value.style = 'background-color: #F8F8FF'
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
t2t.to = binary
|
||||
colordown.list.forEach((value: any, i: any) => {
|
||||
if (i == index) {
|
||||
value.style = 'background-color: gold'
|
||||
} else {
|
||||
value.style = 'background-color: #F8F8FF'
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.unit_tag {
|
||||
display: flex;
|
||||
}
|
||||
.test {
|
||||
display: flex;
|
||||
}
|
||||
.ml-2 {
|
||||
margin-right: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"sourceMap": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["esnext", "dom"]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()]
|
||||
})
|
||||
Reference in New Issue
Block a user