20240927-0005

This commit is contained in:
zjq
2024-09-27 17:48:43 +08:00
parent 96012e6b34
commit 7771b7f46b
13 changed files with 301 additions and 33 deletions
+2 -2
View File
@@ -3,9 +3,9 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome to Vuetify 3</title>
<title>设备授权</title>
</head>
<body>
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

+1 -6
View File
@@ -1,6 +1 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M261.126 140.65L164.624 307.732L256.001 466L377.028 256.5L498.001 47H315.192L261.126 140.65Z" fill="#1697F6"/>
<path d="M135.027 256.5L141.365 267.518L231.64 111.178L268.731 47H256H14L135.027 256.5Z" fill="#AEDDFF"/>
<path d="M315.191 47C360.935 197.446 256 466 256 466L164.624 307.732L315.191 47Z" fill="#1867C0"/>
<path d="M268.731 47C76.0026 47 141.366 267.518 141.366 267.518L268.731 47Z" fill="#7BC6FF"/>
</svg>
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1133.86 1133.86"><defs><style>.cls-1{fill:#17499d;}.cls-2{fill:#ee7a16;}</style></defs><path class="cls-1" d="M382.36,620.44a14.84,14.84,0,0,1-13.57-8.82A89.09,89.09,0,0,1,450.23,486.5a14.84,14.84,0,0,1,0,29.68,59.41,59.41,0,0,0-54.31,83.4,14.83,14.83,0,0,1-13.56,20.86Z"/><path class="cls-2" d="M450.23,664.6a14.84,14.84,0,0,1,0-29.68,59.48,59.48,0,0,0,57.49-44.53H450.23a14.84,14.84,0,1,1,0-29.68h74.21a14.83,14.83,0,0,1,14.84,14.84A89.15,89.15,0,0,1,450.23,664.6Z"/><path class="cls-1" d="M551,492.71l-.77.65a3.55,3.55,0,0,0-1.17,4,34.71,34.71,0,0,1,.53,15.11,35.63,35.63,0,0,1-5.62,14,36.79,36.79,0,0,1-11.15,10.79,38.37,38.37,0,0,1-11.11,4.61,3.69,3.69,0,0,0-3.17,4.05,4.49,4.49,0,0,0,.1.64l-.27.06c-.33-.92-.69-1.84-1-2.77-1.58-5-3.21-9.9-4.7-14.88a41.72,41.72,0,0,1-2.16-12.88c.1-4.57,2.26-7.91,6-10.39,4.66-3.07,9.88-4.86,15.07-6.7,6.08-2.14,12.19-4.18,18.29-6.26.34-.12.69-.18,1-.27Z"/><path class="cls-1" d="M504.36,497a38.09,38.09,0,0,1-6.26-10.6c-1.38-3.52-2.61-7.1-3.94-10.63a.94.94,0,0,1,.46-1.37,36.67,36.67,0,0,1,23.89-4.74,35.94,35.94,0,0,1,14.62,5.4,36.71,36.71,0,0,1,10.34,9.91c1.17,1.67,2.08,3.51,3.13,5.26.36.6.08.83-.45,1-2.76,1-5.49,1.94-8.26,2.85-5.42,1.77-10.82,3.61-16.29,5.19a23.74,23.74,0,0,1-11,1.05A12.37,12.37,0,0,1,504.36,497Z"/><path class="cls-1" d="M516.38,550.83c-.58-1.15-1.13-2.31-1.74-3.44a23.78,23.78,0,0,0-1.34-2.22,5.45,5.45,0,0,0-4.28-2.56A34.24,34.24,0,0,1,495,538a36.35,36.35,0,0,1-11.44-10.33,37.41,37.41,0,0,1-4.88-9.25c-.48-1.35-.41-1.21.77-1.57a57.26,57.26,0,0,1,12.38-2.82c2.94-.24,5.85,0,8.24,1.86a19.61,19.61,0,0,1,4.26,4.46c3.05,4.49,4.92,9.57,6.76,14.64s3.6,10.15,5.38,15.23a2.93,2.93,0,0,1,.09.53Z"/><path class="cls-1" d="M490.06,473.22c.63,1.8,1.23,3.54,1.84,5.27.84,2.4,1.71,4.79,2.51,7.2.29.86.41,1.79.63,2.68a17.66,17.66,0,0,0,.59,2.16c1.81,4.66,1.11,11.86-3.06,15.81A32.17,32.17,0,0,1,484,512c-1.85.87-3.77,1.58-5.65,2.38-.61.27-.88.11-1-.55a37,37,0,0,1,.75-18.46,38,38,0,0,1,9.43-15.71,7.41,7.41,0,0,0,2.32-5.95.88.88,0,0,1,0-.28S489.94,473.37,490.06,473.22Z"/><path class="cls-1" d="M559.55,600.38h0a14.56,14.56,0,0,1,14.55-14.55h0a14.55,14.55,0,0,1,14.55,14.55h0a14.54,14.54,0,0,1-14.55,14.55h0A14.55,14.55,0,0,1,559.55,600.38Z"/><path class="cls-1" d="M608.93,604.43a41.25,41.25,0,0,1,5-19.45,34,34,0,0,1,14-14.35,41.64,41.64,0,0,1,20.27-5q17.3,0,28.35,11.23t11.05,28.38q0,17.3-11.16,28.67t-28.1,11.37a44.34,44.34,0,0,1-20-4.73,32.5,32.5,0,0,1-14.46-13.89Q608.93,617.56,608.93,604.43Zm20.67,1.08q0,11.32,5.38,17.36a17.58,17.58,0,0,0,26.51,0q5.34-6,5.35-17.51,0-11.19-5.35-17.22a17.58,17.58,0,0,0-26.51,0Q629.6,594.17,629.6,605.51Z"/><path class="cls-1" d="M772.68,643.61H752.52V604.72q0-12.35-1.29-16a11.26,11.26,0,0,0-4.2-5.63,12,12,0,0,0-7-2,16.21,16.21,0,0,0-9.4,2.87,14.43,14.43,0,0,0-5.7,7.6q-1.54,4.74-1.55,17.51v34.52H703.22V567.4H722v11.19q10-12.92,25.11-12.91a30.29,30.29,0,0,1,12.2,2.4,20.45,20.45,0,0,1,8.36,6.14,22.17,22.17,0,0,1,4,8.46,63.17,63.17,0,0,1,1.11,13.57Z"/></svg>

Before

Width:  |  Height:  |  Size: 526 B

After

Width:  |  Height:  |  Size: 3.0 KiB

+1
View File
@@ -12,6 +12,7 @@ declare module 'vue' {
A: typeof import('./components/A.vue')['default']
AppFooter: typeof import('./components/AppFooter.vue')['default']
Authorization: typeof import('./components/authorization.vue')['default']
Home: typeof import('./components/home.vue')['default']
number: typeof import('./components/serial number.vue')['default']
PageA: typeof import('./components/pageA.vue')['default']
PageB: typeof import('./components/pageB.vue')['default']
+165
View File
@@ -0,0 +1,165 @@
<template>
<div class="main-container">
<div v-if="loading" class="loading-overlay">
<img src="/logo.png" alt="加载中...." class="loading-image" />
<p class="loading-text">加载中...</p>
</div>
<div v-else>
<div class="button-col">
<button class="custom-btn" @click="navigateToDevice">进入设备</button>
</div>
<div class="button-col">
<button class="custom-btn" @click="navigateToB">更新授权时间</button>
</div>
<div v-if="message" :class="['alert', isValid ? 'success' : 'error']">
{{ message }}
</div>
<div v-if="timeRangeMessage" class="time-range-message" :class="{'normal': isInRange && !isCloseToEnd, 'warning': isCloseToEnd, 'error': !isInRange}">
{{ timeRangeMessage }}
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
loading: true,
message: '',
isValid: false,
timeRangeMessage: '',
isInRange: false,
isCloseToEnd: false,
};
},
methods: {
async checkTime() {
try {
const response = await fetch('http://localhost:5001/check_time', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
});
const data = await response.json();
this.timeRangeMessage = data.message;
this.isInRange = data.valid;
if (data.valid && data.days_remaining <= 40) {
this.isCloseToEnd = true;
} else {
this.isCloseToEnd = false;
}
} catch (error) {
console.error("Error fetching time:", error);
this.message = '无法获取时间信息';
this.isValid = false;
} finally {
this.loading = false; // Stop loading regardless of success or failure
}
},
async navigateToDevice() {
if (this.isInRange) {
this.$router.push('/true');
} else {
this.$router.push('/false');
}
},
navigateToB() {
this.$router.push('/authorization');
},
},
mounted() {
this.checkTime();
},
};
</script>
<style scoped>
.main-container {
background-color: #f5f5f5;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.loading-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(255, 255, 255, 0.8);
display: flex;
flex-direction: column; /* Stack items vertically */
justify-content: center;
align-items: center;
z-index: 999; /* Ensure it's on top */
}
.loading-image {
width: 400px; /* Increase the size as needed */
height: 350px;
margin-bottom: -50px; /* Space between image and text */
}
.loading-text {
font-size: 25px; /* Text size */
text-align: center; /* Center the text */
}
.button-col {
margin: 10px;
}
.custom-btn {
background-color: #ffffff;
color: #000000;
border: 1px solid #cccccc;
width: 400px;
height: 70px;
font-size: 18px;
transition: all 0.3s;
cursor: pointer;
}
.custom-btn:hover {
background-color: #e0e0e0;
border-color: #999999;
}
.alert, .time-range-message {
margin-top: 20px;
font-size: 16px;
text-align: center; /* Center the text */
width: 100%; /* Full width for centering */
}
.success {
color: black;
}
.error {
color: red;
}
.normal {
color: black;
}
.warning {
color: red;
}
</style>
+19 -2
View File
@@ -1,13 +1,20 @@
<template>
<div class="container">
<v-container>
<v-row justify="center" align="center"> <!-- 使用 justify align 属性 -->
<v-row justify="center" align="center">
<v-col cols="auto">
<div class="result-message">
{{ verificationResult }}
</div>
</v-col>
</v-row>
<v-row justify="center">
<v-col cols="auto">
<v-btn class="custom-btn" color="primary" @click="goBack" :style="{ width: '2cm' }">
返回
</v-btn>
</v-col>
</v-row>
</v-container>
</div>
</template>
@@ -23,6 +30,12 @@ export default {
const message = decodeURIComponent(this.$route.query.message);
console.log(message); // 输出消息到控制台
this.verificationResult = message; // 将消息设置为验证结果
},
methods: {
goBack() {
this.$router.push('/#');
}
}
}
</script>
@@ -40,4 +53,8 @@ export default {
text-align: center; /* 文本水平居中 */
font-size: 1rem; /* 文本大小 */
}
</style>
.custom-btn {
width: 2cm; /* 设置按钮宽度为 2cm */
}
</style>
+19 -2
View File
@@ -1,13 +1,20 @@
<template>
<div class="container">
<v-container>
<v-row justify="center" align="center"> <!-- 使用 justify align 属性 -->
<v-row justify="center" align="center">
<v-col cols="auto">
<div class="result-message">
{{ verificationResult }}
</div>
</v-col>
</v-row>
<v-row justify="center">
<v-col cols="auto">
<v-btn class="custom-btn" color="primary" @click="goBack" :style="{ width: '2cm' }">
返回
</v-btn>
</v-col>
</v-row>
</v-container>
</div>
</template>
@@ -23,6 +30,12 @@ export default {
const message = decodeURIComponent(this.$route.query.message);
console.log(message); // 输出消息到控制台
this.verificationResult = message; // 将消息设置为验证结果
},
methods: {
goBack() {
window.history.back();
}
}
}
</script>
@@ -40,4 +53,8 @@ export default {
text-align: center; /* 文本水平居中 */
font-size: 1rem; /* 文本大小 */
}
</style>
.custom-btn {
width: 2cm; /* 设置按钮宽度为 2cm */
}
</style>
@@ -14,18 +14,21 @@
<v-col cols="9" class="input-col">
<v-text-field
v-model="signature"
label="SignatureData"
label="Signature"
outlined
class="serial-input"
></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col cols="10" class="button-row">
<v-col cols="9" class="button-row">
<v-spacer></v-spacer>
<v-btn @click="goToBack" color="primary" class="custom-button">返回</v-btn>
<v-btn @click="goToClient" color="primary" class="custom-button">确定</v-btn>
</v-col>
</v-row>
<!-- 显示验证结果 -->
<v-row v-if="showVerificationResult">
@@ -95,17 +98,19 @@ export default {
}
}
},
goToBack(){
window.history.back();
}
}
}
</script>
<style scoped>
.container {
position: absolute;
top: 9cm;
left: 50%;
transform: translateX(-50%);
width: 100%;
display: flex;
justify-content: center;
align-items: center;
height: 100vh; /* 使容器高度为视口高度 */
}
.b {
@@ -129,14 +134,14 @@ export default {
}
.serial-input {
width: 60%;
margin: 0 auto;
width: 100%; /* 使用100%宽度 */
max-width: 600px; /* 最大宽度限制 */
}
.input-col {
display: flex;
margin: 0 auto;
justify-content: flex-end;
}
.button-row {
@@ -145,11 +150,7 @@ export default {
}
.custom-button {
width: 2cm;
width: auto; /* 使用自动宽度 */
margin: 0 0.5cm;
}
.v-btn--block {
width: 100%;
}
</style>
+35
View File
@@ -0,0 +1,35 @@
<template>
<div class="success-container">
<h1>失败</h1>
</div>
</template>
<script>
export default {
name: 'SuccessPage'
};
</script>
<style scoped>
.success-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh; /* Full viewport height */
background-color: #f5f5f5;
text-align: center;
}
p {
margin: 20px 0;
font-size: 18px;
}
.router-link {
margin-top: 15px;
color: #007BFF; /* Bootstrap primary color */
}
</style>
+4 -6
View File
@@ -1,13 +1,11 @@
<template>
<!-- <Top />
<A /> -->
<authorization />
<home />
</template>
<script lang="ts" setup>
//import serialnumber from '@/components/serialnumber.vue';
//
import authorization from '@/components/authorization.vue';
import home from '@/components/home.vue';
</script>
+36
View File
@@ -0,0 +1,36 @@
<template>
<div class="success-container">
<h1>成功</h1>
</div>
</template>
<script>
export default {
name: 'SuccessPage'
};
</script>
<style scoped>
.success-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh; /* Full viewport height */
background-color: #f5f5f5;
text-align: center;
}
p {
margin: 20px 0;
font-size: 18px;
}
.router-link {
margin-top: 15px;
color: #007BFF; /* Bootstrap primary color */
}
</style>
+3
View File
@@ -19,7 +19,10 @@ declare module 'vue-router/auto-routes' {
*/
export interface RouteNamedMap {
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
'/authorization': RouteRecordInfo<'/authorization', '/authorization', Record<never, never>, Record<never, never>>,
'/false': RouteRecordInfo<'/false', '/false', Record<never, never>, Record<never, never>>,
'/Register': RouteRecordInfo<'/Register', '/Register', Record<never, never>, Record<never, never>>,
'/true': RouteRecordInfo<'/true', '/true', Record<never, never>, Record<never, never>>,
'/Verify': RouteRecordInfo<'/Verify', '/Verify', Record<never, never>, Record<never, never>>,
'/VerifyFailed': RouteRecordInfo<'/VerifyFailed', '/VerifyFailed', Record<never, never>, Record<never, never>>,
}