chore:更换到主分支

This commit is contained in:
张益铭
2021-03-01 15:26:05 +08:00
parent 9064b372e8
commit 6a5f1810f9
3530 changed files with 59613 additions and 479452 deletions

View File

@@ -0,0 +1,200 @@
<template>
<div class="drag-container">
<!-- grid列表拖拽 -->
<el-row :gutter="25">
<el-col :xs="25" :sm="8" :md="8" :lg="8">
<el-card>
<template #header>
<div class="card-header">
<span>grid列表拖拽</span>
</div>
</template>
<draggable
v-model="gridLists"
class="grid-container"
item-key="grid"
animation="300"
chosenClass="chosen"
forceFallback="true"
>
<template #item="{ element }">
<div :class="'item'+' '+ 'item-' + element.num">{{ element.num }}</div>
</template>
</draggable>
</el-card>
</el-col>
<el-col :xs="25" :sm="8" :md="8" :lg="8">
<el-card>
<template #header>
<div class="card-header">
<span>单列拖拽</span>
</div>
</template>
<!-- 单列拖拽 -->
<draggable
v-model="lists"
item-key="name"
@change="change"
chosen-class="chosen"
force-fallback="true"
animation="300"
>
<template #item="{ element, index }">
<div class="item-single">{{element.name}} {{ index }}</div>
</template>
</draggable>
</el-card>
</el-col>
<el-col :xs="25" :sm="8" :md="8" :lg="8">
<el-card>
<template #header>
<div class="card-header">
<span>拖拽实现元素位置切换</span>
</div>
</template>
<!-- 拖拽实现元素位置切换 -->
<div class="cut-container">
<div class="item-cut" v-for="(item,index) in cutLists" :key="index">
<p>{{ item.name }}</p>
</div>
</div>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script lang='ts'>
import draggable from "vuedraggable";
import { reactive, toRefs, onMounted } from "vue";
export default {
components: { draggable },
setup() {
const myArray = reactive({
gridLists: [
{ grid: "cn", num: 1 },
{ grid: "cn", num: 2 },
{ grid: "cn", num: 3 },
{ grid: "cn", num: 4 },
{ grid: "cn", num: 5 },
{ grid: "cn", num: 6 },
{ grid: "cn", num: 7 },
{ grid: "cn", num: 8 },
{ grid: "cn", num: 9 },
],
lists: [
{ people: "cn", id: 1, name: "www.itxst.com" },
{ people: "cn", id: 2, name: "www.baidu.com" },
{ people: "cn", id: 3, name: "www.taobao.com" },
{ people: "cn", id: 4, name: "www.google.com" },
],
cutLists: [
{ people: "cn", id: 1, name: "cut1" },
{ people: "cn", id: 2, name: "cut2" },
{ people: "cn", id: 3, name: "cut3" },
{ people: "cn", id: 4, name: "cut4" },
],
});
const change = (evt): void => {
console.log("evt: ", evt);
};
onMounted(() => {
// 使用原生sortable实现元素位置切换
// @ts-ignore
new Sortable(document.querySelector(".cut-container"), {
swap: true,
forceFallback: true,
chosenClass: "chosen",
swapClass: "highlight",
animation: 300,
});
});
return {
...toRefs(myArray),
change,
};
},
};
</script>
<style lang="scss" scoped>
/* grid列表拖拽 */
.grid-container {
display: grid;
grid-template-columns: 33.3% 33.3% 33.3%;
grid-template-rows: 33.3% 33.3% 33.3%;
}
.item-single {
font-size: 1.5em;
height: 77px;
text-align: center;
line-height: 85px;
border: 1px solid #e5e4e9;
cursor: move;
}
.item-cut {
font-size: 1.5em;
height: 77px;
text-align: center;
border: 1px solid #e5e4e9;
cursor: move;
}
.item {
font-size: 2em;
text-align: center;
line-height: 100px;
border: 1px solid #e5e4e9;
cursor: move;
@media screen and (max-width: 750px) {
line-height: 90px;
}
}
.item-1 {
background-color: #ef342a;
}
.item-2 {
background-color: #f68f26;
}
.item-3 {
background-color: #4ba946;
}
.item-4 {
background-color: #0376c2;
}
.item-5 {
background-color: #c077af;
}
.item-6 {
background-color: #f8d29d;
}
.item-7 {
background-color: #b5a87f;
}
.item-8 {
background-color: #d0e4a9;
}
.item-9 {
background-color: #4dc7ec;
}
.chosen {
border: solid 2px #3089dc !important;
}
</style>

View File

@@ -0,0 +1,85 @@
<template>
<div class="split-pane">
<splitpane :splitSet="settingLR">
<!-- #paneL 表示指定该组件为左侧面板 -->
<template #paneL>
<!-- 自定义左侧面板的内容 -->
<div class="dv-a">A</div>
</template>
<!-- #paneR 表示指定该组件为右侧面板 -->
<template #paneR>
<!-- 再次将右侧面板进行拆分 -->
<splitpane :splitSet="settingTB">
<template #paneL>
<div class="dv-b">B</div>
</template>
<template #paneR>
<div class="dv-c">C</div>
</template>
</splitpane>
</template>
</splitpane>
</div>
</template>
<script lang="ts">
import splitpane, {
ContextProps,
} from "../../../components/splitPane/index.vue";
import { reactive } from "vue";
export default {
name: "split",
components: {
splitpane,
},
setup() {
const settingLR: ContextProps = reactive({
minPercent: 20,
defaultPercent: 40,
split: "vertical",
});
const settingTB: ContextProps = reactive({
minPercent: 20,
defaultPercent: 40,
split: "horizontal",
});
return {
settingLR,
settingTB,
};
},
};
</script>
<style lang="scss" scoped>
$W: 100%;
$H: 80vh;
.split-pane {
width: 98%;
height: $H;
margin-top: 20px;
text-align: center;
font-size: 50px;
color: #fff;
.dv-a,
.dv-b,
.dv-c {
width: $W;
height: $W;
background: rgba($color: dodgerblue, $alpha: 0.8);
line-height: $H;
}
.dv-b,
.dv-c {
line-height: 250px;
}
.dv-b {
background: rgba($color: #000, $alpha: 0.8);
}
.dv-c {
background: rgba($color: #ce272d, $alpha: 0.8);
}
}
</style>

73
src/views/error/401.vue Normal file
View File

@@ -0,0 +1,73 @@
<template>
<div class="errPage-container">
<el-row>
<el-col :span="12">
<h1 class="text-jumbo text-ginormous">CURD Admin</h1>
<h2>你没有权限去该页面</h2>
<h6>如有不满请联系你领导</h6>
</el-col>
<el-col :span="12">
<img
:src="img"
width="313"
height="428"
alt="Girl has dropped her ice cream."
/>
</el-col>
</el-row>
</div>
</template>
<script lang='ts'>
import imgs from '/@/assets/401.gif'
import { ref } from "vue"
export default {
name: "401",
setup() {
const img = ref(`${imgs}?${new Date()}`)
return {
img
};
},
};
</script>
<style lang="scss" scoped>
.errPage-container {
width: 800px;
max-width: 100%;
margin: 100px auto;
.pan-back-btn {
background: #008489;
color: #fff;
border: none !important;
}
.pan-gif {
margin: 0 auto;
display: block;
}
.pan-img {
display: block;
margin: 0 auto;
width: 100%;
}
.text-jumbo {
font-size: 60px;
font-weight: 700;
color: #484848;
}
.list-unstyled {
font-size: 14px;
li {
padding-bottom: 5px;
}
a {
color: #008489;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
}
</style>

236
src/views/error/404.vue Normal file
View File

@@ -0,0 +1,236 @@
<template>
<div class="wscn-http404-container">
<div class="wscn-http404">
<div class="pic-404">
<img class="pic-404__parent" :src="four" alt="404" />
<img class="pic-404__child left" :src="four_cloud" alt="404" />
<img class="pic-404__child mid" :src="four_cloud" alt="404" />
<img class="pic-404__child right" :src="four_cloud" alt="404" />
</div>
<div class="bullshit">
<div class="bullshit__oops">CURD Admin</div>
<div class="bullshit__headline">{{ message }}</div>
<div class="bullshit__info">
Please check that the URL you entered is correct, or click the button
below to return to the homepage.
</div>
<a href="" class="bullshit__return-home">Back to home</a>
</div>
</div>
</div>
</template>
<script>
import { computed } from "vue";
import four from "/@/assets/404.png";
import four_cloud from "/@/assets/404_cloud.png";
export default {
name: "404",
setup() {
const message = computed(() => {
return "The webmaster said that you can not enter this page...";
});
return {
message,
four,
four_cloud,
};
},
};
</script>
<style lang="scss" scoped>
.wscn-http404-container {
transform: translate(-50%, -50%);
position: absolute;
top: 40%;
left: 50%;
}
.wscn-http404 {
position: relative;
width: 1200px;
padding: 0 50px;
overflow: hidden;
.pic-404 {
position: relative;
float: left;
width: 600px;
overflow: hidden;
&__parent {
width: 100%;
}
&__child {
position: absolute;
&.left {
width: 80px;
top: 17px;
left: 220px;
opacity: 0;
animation-name: cloudLeft;
animation-duration: 2s;
animation-timing-function: linear;
animation-fill-mode: forwards;
animation-delay: 1s;
}
&.mid {
width: 46px;
top: 10px;
left: 420px;
opacity: 0;
animation-name: cloudMid;
animation-duration: 2s;
animation-timing-function: linear;
animation-fill-mode: forwards;
animation-delay: 1.2s;
}
&.right {
width: 62px;
top: 100px;
left: 500px;
opacity: 0;
animation-name: cloudRight;
animation-duration: 2s;
animation-timing-function: linear;
animation-fill-mode: forwards;
animation-delay: 1s;
}
@keyframes cloudLeft {
0% {
top: 17px;
left: 220px;
opacity: 0;
}
20% {
top: 33px;
left: 188px;
opacity: 1;
}
80% {
top: 81px;
left: 92px;
opacity: 1;
}
100% {
top: 97px;
left: 60px;
opacity: 0;
}
}
@keyframes cloudMid {
0% {
top: 10px;
left: 420px;
opacity: 0;
}
20% {
top: 40px;
left: 360px;
opacity: 1;
}
70% {
top: 130px;
left: 180px;
opacity: 1;
}
100% {
top: 160px;
left: 120px;
opacity: 0;
}
}
@keyframes cloudRight {
0% {
top: 100px;
left: 500px;
opacity: 0;
}
20% {
top: 120px;
left: 460px;
opacity: 1;
}
80% {
top: 180px;
left: 340px;
opacity: 1;
}
100% {
top: 200px;
left: 300px;
opacity: 0;
}
}
}
}
.bullshit {
position: relative;
float: left;
width: 300px;
padding: 30px 0;
overflow: hidden;
&__oops {
font-size: 32px;
font-weight: bold;
line-height: 40px;
color: #1482f0;
opacity: 0;
margin-bottom: 20px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-fill-mode: forwards;
}
&__headline {
font-size: 20px;
line-height: 24px;
color: #222;
font-weight: bold;
opacity: 0;
margin-bottom: 10px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.1s;
animation-fill-mode: forwards;
}
&__info {
font-size: 13px;
line-height: 21px;
color: grey;
opacity: 0;
margin-bottom: 30px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.2s;
animation-fill-mode: forwards;
}
&__return-home {
display: block;
float: left;
width: 110px;
height: 36px;
background: #1482f0;
border-radius: 100px;
text-align: center;
color: #ffffff;
opacity: 0;
font-size: 14px;
line-height: 36px;
cursor: pointer;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.3s;
animation-fill-mode: forwards;
}
@keyframes slideUp {
0% {
transform: translateY(60px);
opacity: 0;
}
100% {
transform: translateY(0);
opacity: 1;
}
}
}
}
</style>

84
src/views/login.vue Normal file
View File

@@ -0,0 +1,84 @@
<template>
<div class="login">
<info
:ruleForm="contextInfo"
@on-behavior="onLogin"
@refreshVerify="refreshVerify"
/>
</div>
</template>
<script lang="ts">
import {
ref,
reactive,
onMounted,
onBeforeMount,
getCurrentInstance,
} from "vue";
import info, { ContextProps } from "../components/info/index.vue";
import { getVerify, getLogin } from "../api/user";
import { useRouter } from "vue-router";
import { storageSession } from "../utils/storage";
import { warnMessage, successMessage } from "../utils/message";
export default {
name: "login",
components: {
info,
},
setup() {
const router = useRouter();
// 刷新验证码
const refreshGetVerify = async () => {
let { svg } = await getVerify();
contextInfo.svg = svg;
};
const contextInfo: ContextProps = reactive({
userName: "",
passWord: "",
verify: null,
svg: null,
});
const toPage = (info: Object): void => {
storageSession.setItem("info", info);
router.push("/");
};
// 登录
const onLogin = async () => {
let { userName, passWord, verify } = contextInfo;
let { code, info, accessToken } = await getLogin({
username: userName,
password: passWord,
verify: verify,
});
code === 0
? successMessage(info) &&
toPage({
username: userName,
accessToken,
})
: warnMessage(info);
};
const refreshVerify = (): void => {
refreshGetVerify();
};
onBeforeMount(() => {
refreshGetVerify();
});
return {
contextInfo,
onLogin,
router,
toPage,
refreshVerify,
};
},
};
</script>

73
src/views/register.vue Normal file
View File

@@ -0,0 +1,73 @@
<template>
<div class="register">
<info
:ruleForm="contextInfo"
@on-behavior="onRegist"
@refreshVerify="refreshVerify"
/>
</div>
</template>
<script lang="ts">
import {
ref,
reactive,
onMounted,
onBeforeMount,
getCurrentInstance,
} from "vue";
import info, { ContextProps } from "../components/info/index.vue";
import { getRegist, getVerify } from "../api/user";
import { useRouter } from "vue-router";
import { warnMessage, successMessage } from "../utils/message";
export default {
name: "register",
components: {
info,
},
setup() {
const router = useRouter();
// 刷新验证码
const refreshGetVerify = async () => {
let { svg } = await getVerify();
contextInfo.svg = svg;
};
const contextInfo: ContextProps = reactive({
userName: "",
passWord: "",
verify: null,
svg: null,
});
// 注册
const onRegist = async () => {
let { userName, passWord, verify } = contextInfo;
let { code, info } = await getRegist({
username: userName,
password: passWord,
verify: verify,
});
code === 0
? successMessage(info) && router.push("/login")
: warnMessage(info);
};
const refreshVerify = (): void => {
refreshGetVerify();
};
onBeforeMount(() => {
refreshGetVerify();
});
return {
contextInfo,
onRegist,
router,
refreshVerify,
};
},
};
</script>

15
src/views/user.vue Normal file
View File

@@ -0,0 +1,15 @@
<template>
<div>用户管理页面</div>
</template>
<script lang='ts'>
export default {
name: "user",
setup() {
return {};
},
};
</script>
<style scoped>
</style>

26
src/views/welcome.vue Normal file
View File

@@ -0,0 +1,26 @@
<template>
<div class="welcome">
<a
title="欢迎Star"
href="https://github.com/xiaoxian521/CURD-TS/tree/vue-ts"
target="_blank"
>点击打开仓库地址</a
>
</div>
</template>
<script lang='ts'>
export default {
name: "welcome",
};
</script>
<style scoped>
.welcome {
width: 100%;
height: 100%;
background: url("../assets/welcome.png") no-repeat center;
background-size: cover;
position: absolute;
}
</style>