initial commit

This commit is contained in:
simple321vip
2022-04-03 23:43:45 +08:00
commit ef1c97251d
42 changed files with 2628 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
<template>
<div class="dashboard">blog</div>
</template>
<script setup lang="ts">
</script>
<style>
.dashboard {
background-color: beige;
}
</style>
+68
View File
@@ -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>
+164
View File
@@ -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>
+12
View File
@@ -0,0 +1,12 @@
<template>
<div class="dashboard">cloud</div>
</template>
<script setup lang="ts">
</script>
<style>
.dashboard {
background-color: beige;
}
</style>
+14
View File
@@ -0,0 +1,14 @@
<template>
<div class="dashboard">
dashboard
</div>
</template>
<script setup lang="ts">
</script>
<style>
.dashboard {
background-color: beige;
}
</style>
+12
View File
@@ -0,0 +1,12 @@
<template>
<div class="dashboard">recommend</div>
</template>
<script setup lang="ts">
</script>
<style>
.dashboard {
background-color: beige;
}
</style>
+12
View File
@@ -0,0 +1,12 @@
<template>
<div class="dashboard">study</div>
</template>
<script setup lang="ts">
</script>
<style>
.dashboard {
background-color: beige;
}
</style>
+12
View File
@@ -0,0 +1,12 @@
<template>
<div class="dashboard">thinking</div>
</template>
<script setup lang="ts">
</script>
<style>
.dashboard {
background-color: beige;
}
</style>
+122
View File
@@ -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>
+29
View File
@@ -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>
+40
View File
@@ -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>
+87
View File
@@ -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>