mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: 基础逻辑拼接
This commit is contained in:
parent
5ee0afb604
commit
6708903c65
BIN
napcat.webui/src/assets/Sotheby.ttf
Normal file
BIN
napcat.webui/src/assets/Sotheby.ttf
Normal file
Binary file not shown.
@ -6,6 +6,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import '../css/style.css';
|
||||||
export default {
|
export default {
|
||||||
name: 'Dashboard'
|
name: 'Dashboard'
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="login-container">
|
<div class="login-container">
|
||||||
<h2>Login</h2>
|
<h2 class="sotheby-font">QQ Login</h2>
|
||||||
<div class="login-methods">
|
<div class="login-methods">
|
||||||
<t-button id="quick-login" class="login-method active" @click="showQuickLogin">Quick Login</t-button>
|
<t-button id="quick-login" class="login-method" :class="{ active: isQuickLoginVisible }" @click="showQuickLogin">Quick Login</t-button>
|
||||||
<t-button id="qrcode-login" class="login-method" @click="showQrCodeLogin">QR Code</t-button>
|
<t-button id="qrcode-login" class="login-method" :class="{ active: isQrCodeVisible }" @click="showQrCodeLogin">QR Code</t-button>
|
||||||
</div>
|
</div>
|
||||||
<div id="quick-login-dropdown" class="login-form" v-show="isQuickLoginVisible">
|
<div id="quick-login-dropdown" class="login-form" v-show="isQuickLoginVisible">
|
||||||
<t-select id="quick-login-select" v-model="selectedAccount" @change="selectAccount">
|
<t-select id="quick-login-select" v-model="selectedAccount" @change="selectAccount">
|
||||||
@ -15,98 +15,81 @@
|
|||||||
</div>
|
</div>
|
||||||
<p id="message">{{ message }}</p>
|
<p id="message">{{ message }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
Power By NapCat.WebUi
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import { Button as TButton, Select as TSelect, Option as TOption } from 'tdesign-vue-next';
|
import { Button as TButton, Select as TSelect, Option as TOption, MessagePlugin } from 'tdesign-vue-next';
|
||||||
import QRCode from 'qrcode';
|
import QRCode from 'qrcode';
|
||||||
import { MessagePlugin } from 'tdesign-vue-next';
|
import { useRouter, useRoute } from 'vue-router';
|
||||||
|
|
||||||
export default {
|
const router = useRouter();
|
||||||
components: {
|
const route = useRoute();
|
||||||
TButton,
|
const isQuickLoginVisible = ref(true);
|
||||||
TSelect,
|
const isQrCodeVisible = ref(false);
|
||||||
TOption,
|
const quickLoginList = ref([]);
|
||||||
},
|
const selectedAccount = ref('');
|
||||||
setup() {
|
const message = ref('');
|
||||||
const isQuickLoginVisible = ref(true);
|
|
||||||
const isQrCodeVisible = ref(false);
|
|
||||||
const quickLoginList = ref([]);
|
|
||||||
const selectedAccount = ref('');
|
|
||||||
const message = ref('');
|
|
||||||
|
|
||||||
const showQuickLogin = () => {
|
const showQuickLogin = () => {
|
||||||
isQuickLoginVisible.value = true;
|
isQuickLoginVisible.value = true;
|
||||||
isQrCodeVisible.value = false;
|
isQrCodeVisible.value = false;
|
||||||
};
|
|
||||||
|
|
||||||
const showQrCodeLogin = () => {
|
|
||||||
isQuickLoginVisible.value = false;
|
|
||||||
isQrCodeVisible.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const selectAccount = async (accountName) => {
|
|
||||||
//const { result, errMsg } = await SetQuickLogin(accountName, localStorage.getItem('auth'));
|
|
||||||
if (true) {
|
|
||||||
MessagePlugin.success("登录成功即将跳转");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
MessagePlugin.error("登录失败," + errMsg);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const generateQrCode = (data, canvas) => {
|
|
||||||
QRCode.toCanvas(canvas, data, function (error) {
|
|
||||||
if (error) console.log(error);
|
|
||||||
console.log('QR Code generated!');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const InitPages = async () => {
|
|
||||||
// let QuickLists = await GetQQQucickLoginList(localStorage.getItem('auth'));
|
|
||||||
quickLoginList.value = ['example1', 'example2', 'example3'];
|
|
||||||
// generateQrCode(await GetQQLoginQrcode(localStorage.getItem('auth')), document.querySelector('#qrcode-canvas'));
|
|
||||||
generateQrCode('test', document.querySelector('#qrcode-canvas'));
|
|
||||||
setInterval(HeartBeat, 3000);
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
InitPages();
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
isQuickLoginVisible,
|
|
||||||
isQrCodeVisible,
|
|
||||||
quickLoginList,
|
|
||||||
selectedAccount,
|
|
||||||
message,
|
|
||||||
showQuickLogin,
|
|
||||||
showQrCodeLogin,
|
|
||||||
selectAccount,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const showQrCodeLogin = () => {
|
||||||
|
isQuickLoginVisible.value = false;
|
||||||
|
isQrCodeVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectAccount = async (accountName) => {
|
||||||
|
//const { result, errMsg } = await SetQuickLogin(accountName, localStorage.getItem('auth'));
|
||||||
|
if (true) {
|
||||||
|
MessagePlugin.success("登录成功即将跳转");
|
||||||
|
await router.push({ path: '/dashboard' });
|
||||||
|
} else {
|
||||||
|
MessagePlugin.error("登录失败," + errMsg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const generateQrCode = (data, canvas) => {
|
||||||
|
QRCode.toCanvas(canvas, data, function (error) {
|
||||||
|
if (error) console.log(error);
|
||||||
|
console.log('QR Code generated!');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const InitPages = async () => {
|
||||||
|
// let QuickLists = await GetQQQucickLoginList(localStorage.getItem('auth'));
|
||||||
|
quickLoginList.value = ['example1', 'example2', 'example3'];
|
||||||
|
// generateQrCode(await GetQQLoginQrcode(localStorage.getItem('auth')), document.querySelector('#qrcode-canvas'));
|
||||||
|
generateQrCode('test', document.querySelector('#qrcode-canvas'));
|
||||||
|
setInterval(HeartBeat, 3000);
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
InitPages();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
body {
|
|
||||||
font-family: Arial, sans-serif;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 100vh;
|
|
||||||
background-color: #f0f2f5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-container {
|
.login-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
||||||
background-color: white;
|
background-color: white;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.login-container {
|
||||||
|
width: 90%;
|
||||||
|
min-width: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-methods {
|
.login-methods {
|
||||||
@ -142,26 +125,23 @@ body {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
.sotheby-font {
|
||||||
|
font-family: Sotheby, Helvetica, monospace;
|
||||||
|
font-size: 3.125rem;
|
||||||
|
line-height: 1.2;
|
||||||
|
text-shadow: 0 1px 2px rgba(0, 0, 0, .1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
text-align: center;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: #888;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px;
|
background-color: white;
|
||||||
background-color: #007BFF;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
|
||||||
background-color: #0056b3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#qrcode-canvas {
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="login-container">
|
<div class="login-container">
|
||||||
<h2>WebUi Login</h2>
|
<h2 class="sotheby-font">WebUi Login</h2>
|
||||||
<t-form ref="form" :data="formData" :colon="true" :label-width="0" @submit="onSubmit">
|
<t-form ref="form" :data="formData" :colon="true" :label-width="0" @submit="onSubmit">
|
||||||
<t-form-item name="password">
|
<t-form-item name="password">
|
||||||
<t-input v-model="formData.token" type="password" clearable placeholder="请输入Token">
|
<t-input v-model="formData.token" type="password" clearable placeholder="请输入Token">
|
||||||
@ -14,16 +14,20 @@
|
|||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-form>
|
</t-form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
Power By NapCat.WebUi
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import '../css/font.css';
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { MessagePlugin } from 'tdesign-vue-next';
|
import { MessagePlugin } from 'tdesign-vue-next';
|
||||||
import { LockOnIcon } from 'tdesign-icons-vue-next';
|
import { LockOnIcon } from 'tdesign-icons-vue-next';
|
||||||
import { useRouter, useRoute } from 'vue-router';
|
import { useRouter, useRoute } from 'vue-router';
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter();
|
||||||
const route = useRoute()
|
const route = useRoute();
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
token: '',
|
token: '',
|
||||||
@ -31,8 +35,8 @@ const formData = reactive({
|
|||||||
|
|
||||||
const onSubmit = async ({ validateResult, firstError }) => {
|
const onSubmit = async ({ validateResult, firstError }) => {
|
||||||
if (validateResult === true) {
|
if (validateResult === true) {
|
||||||
await router.push({ path: '/dashboard' });
|
|
||||||
MessagePlugin.success('登录中...');
|
MessagePlugin.success('登录中...');
|
||||||
|
await router.push({ path: '/qqlogin' });
|
||||||
} else {
|
} else {
|
||||||
MessagePlugin.error('登录失败');
|
MessagePlugin.error('登录失败');
|
||||||
}
|
}
|
||||||
@ -43,15 +47,60 @@ const onSubmit = async ({ validateResult, firstError }) => {
|
|||||||
.login-container {
|
.login-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
||||||
background-color: white;
|
background-color: white;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.login-container {
|
||||||
|
width: 90%;
|
||||||
|
min-width: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-message {
|
.error-message {
|
||||||
color: red;
|
color: red;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tdesign-demo-block-column {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
row-gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tdesign-demo-block-column-large {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
row-gap: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tdesign-demo-block-row {
|
||||||
|
display: flex;
|
||||||
|
column-gap: 16px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sotheby-font {
|
||||||
|
font-family: Sotheby, Helvetica, monospace;
|
||||||
|
font-size: 3.125rem;
|
||||||
|
line-height: 1.2;
|
||||||
|
text-shadow: 0 1px 2px rgba(0, 0, 0, .1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
text-align: center;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: #888;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
6
napcat.webui/src/css/font.css
Normal file
6
napcat.webui/src/css/font.css
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: 'Sotheby';
|
||||||
|
src: url('../assets/Sotheby.ttf') format('truetype');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
@ -82,26 +82,3 @@ button:focus-visible {
|
|||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 竖排展示 demo 行间距 16px */
|
|
||||||
.tdesign-demo-block-column {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
row-gap: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 竖排展示 demo 行间距 32px */
|
|
||||||
.tdesign-demo-block-column-large {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
row-gap: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 横排排展示 demo 列间距 16px */
|
|
||||||
.tdesign-demo-block-row {
|
|
||||||
display: flex;
|
|
||||||
column-gap: 16px;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import './style.css'
|
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import {
|
import {
|
||||||
Button as TButton,
|
Button as TButton,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user