V0.2
This commit is contained in:
parent
866d6ecb72
commit
ca523a5a57
@ -9,6 +9,7 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"axios": "^1.7.9",
|
||||
"element-plus": "^2.9.3",
|
||||
"nprogress": "^0.2.0",
|
||||
|
||||
@ -4,12 +4,17 @@ import NProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'// nprogress样式文件
|
||||
|
||||
import UI_1 from "../src/components/Aside/UI_1.vue";
|
||||
import UI_2 from "../src/components/Aside/UI_2.vue";
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/UI_1',
|
||||
component: UI_1
|
||||
},
|
||||
{
|
||||
path: '/UI_2',
|
||||
component: UI_2
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
|
||||
@ -6,7 +6,12 @@
|
||||
|
||||
<script setup>
|
||||
import Home from "./components/Main/Home.vue";
|
||||
|
||||
import {onMounted} from "vue";
|
||||
import {useRouter} from "vue-router";
|
||||
onMounted(()=>{
|
||||
const router = useRouter();
|
||||
router.push('/UI_1');
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -23,11 +23,13 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {reactive, ref} from 'vue'
|
||||
import {Api, RequestPost} from "../JS/RequestAPI.js";
|
||||
import {Api, RequestPost, User} from "../JS/RequestAPI.js";
|
||||
import {ElMessage} from "element-plus";
|
||||
const form = reactive({
|
||||
Duration: 1,
|
||||
@ -35,10 +37,13 @@ const form = reactive({
|
||||
target: '',
|
||||
Minutes:0,
|
||||
EffectiveD:5,
|
||||
User:User.User,
|
||||
Pwd:User.Pwd,
|
||||
});
|
||||
const DataDB = reactive({
|
||||
data: '',
|
||||
})
|
||||
|
||||
function handleSubmit() {
|
||||
if(form.region === 1){
|
||||
form.Minutes = form.Duration * 24;
|
||||
@ -50,15 +55,22 @@ function handleSubmit() {
|
||||
form.Minutes = form.Duration * 24 * 30 * 12;
|
||||
}
|
||||
console.log(form);
|
||||
form.User = User.User;
|
||||
form.Pwd = User.Pwd;
|
||||
RequestPost(Api.GetALicense,form,(res)=>{
|
||||
const data = res.data;
|
||||
if(data !== "NO"){
|
||||
if(data.Code === 1){
|
||||
DataDB.data = data.target;
|
||||
ElMessage.success('生成成功!');
|
||||
}
|
||||
else {
|
||||
if(data.Code === 2){
|
||||
ElMessage.error("权限认证失败!");
|
||||
}
|
||||
else {
|
||||
ElMessage.error('生成失败!');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@ -70,7 +82,6 @@ function handleSubmit() {
|
||||
align-items: center; /* 垂直居中 */
|
||||
height: 100vh; /* 使容器高度占满整个视口 */
|
||||
}
|
||||
|
||||
.el-form {
|
||||
max-width: 500px; /* 设置表单的最大宽度 */
|
||||
width: 100%; /* 使表单宽度自适应 */
|
||||
|
||||
202
src/components/Aside/UI_2.vue
Normal file
202
src/components/Aside/UI_2.vue
Normal file
@ -0,0 +1,202 @@
|
||||
<template>
|
||||
<el-scrollbar>
|
||||
<el-scrollbar>
|
||||
<el-row style="margin-left: 1%;margin-top: 1%;">
|
||||
<el-button type="primary" @click.stop="UpData">
|
||||
刷新
|
||||
</el-button>
|
||||
<el-button type="primary" @click.stop="UpLoad">
|
||||
上传新版本
|
||||
</el-button>
|
||||
<el-button type="primary" @click.stop="SetInitUpdatePar">
|
||||
上传启动器更新参数
|
||||
</el-button>
|
||||
</el-row>
|
||||
</el-scrollbar>
|
||||
<div style="margin-left: 1%;margin-top: 1%;">
|
||||
<el-table
|
||||
:data="DataDB.tableData"
|
||||
style="width: 98%;"
|
||||
height="calc(100vh - 200px)"
|
||||
>
|
||||
<el-table-column prop="Name" label="名称" align="center"/>
|
||||
<el-table-column prop="Date_t" label="时间" align="center"/>
|
||||
<el-table-column label="大小" align="center">
|
||||
<template #default="scope">
|
||||
{{ Convert(scope.row.Size) }} MB
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click.stop="Download(scope.row.ID)">
|
||||
下载
|
||||
</el-link>
|
||||
<el-link type="danger" @click.stop="Delete(scope.row.ID)" style="margin-left: 10px;">
|
||||
删除
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
<el-dialog v-model="dialogTableVisible1" title="上传新版本" width="800">
|
||||
<el-upload
|
||||
v-model:file-list="DataDB.fileList"
|
||||
ref="UpLoadDemo"
|
||||
class="upload-demo"
|
||||
drag
|
||||
:action="Api.GetBSVUpload"
|
||||
multiple
|
||||
limit="3"
|
||||
:on-success="BUpload"
|
||||
>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">
|
||||
将文件放到这里或<em>点击上传</em>
|
||||
</div>
|
||||
</el-upload>
|
||||
</el-dialog>
|
||||
<el-dialog v-model="dialogTableVisible2" title="设置启动器更新参数" width="500">
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="版本号">
|
||||
<el-input v-model="StaterDB.Ver" style="width: 300px;"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传文件">
|
||||
<el-upload
|
||||
ref="UpLoadBin"
|
||||
v-model="StaterDB.URL"
|
||||
class="upload-demo"
|
||||
:action="Api.UpStarter"
|
||||
:on-success="ReviseStarter"
|
||||
:on-error="On_error"
|
||||
:auto-upload="false"
|
||||
:limit="1"
|
||||
>
|
||||
<el-button type="primary">选择文件</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button type="primary" @click.stop="()=>{UpLoadBin.submit();}">
|
||||
确认
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {onMounted, reactive, ref} from "vue";
|
||||
import {Api, RequestPost, User} from "../JS/RequestAPI.js";
|
||||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import {UploadFilled} from "@element-plus/icons-vue";
|
||||
onMounted(()=>{
|
||||
GetData();
|
||||
});
|
||||
const dialogTableVisible1 = ref(false);
|
||||
const dialogTableVisible2 = ref(false);
|
||||
const UpLoadDemo = ref();
|
||||
const UpLoadBin = ref();
|
||||
const DataDB = reactive({
|
||||
tableData:[],
|
||||
fileList:[],
|
||||
});
|
||||
const StaterDB = reactive({
|
||||
Ver:'',
|
||||
URL:'',
|
||||
});
|
||||
function UpData(){
|
||||
GetData();
|
||||
}
|
||||
function GetData(){
|
||||
RequestPost(Api.GetBSVData,JSON.stringify({
|
||||
type:0
|
||||
}),(res)=>{
|
||||
const data = res.data;
|
||||
if(data.Code === 1){
|
||||
DataDB.tableData = data.list;
|
||||
}
|
||||
});
|
||||
}
|
||||
function Convert(size){
|
||||
const data = size / 1024 / 1024;
|
||||
return data.toFixed(2);
|
||||
}
|
||||
function Download(ID){
|
||||
const url = Api.GetBSVDownload + "?ID=" + ID;
|
||||
window.open(url);
|
||||
}
|
||||
function Delete(ID){
|
||||
ElMessageBox.confirm(
|
||||
'系统将永久删除该文件,继续吗?',
|
||||
'警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
RequestPost(Api.GetBSVDelete,JSON.stringify({
|
||||
ID:ID,
|
||||
User:User.User,
|
||||
Pwd:User.Pwd,
|
||||
}),(res)=>{
|
||||
const data = res.data;
|
||||
if(data.Code === 1){
|
||||
ElMessage.success('删除成功!');
|
||||
GetData();
|
||||
}
|
||||
else {
|
||||
if(data.Code === 2){
|
||||
ElMessage.error('权限认证失败!');
|
||||
}
|
||||
else {
|
||||
ElMessage.error('删除失败!');
|
||||
}
|
||||
}
|
||||
})
|
||||
}).catch(() => {});
|
||||
}
|
||||
function UpLoad(){
|
||||
DataDB.fileList = [];
|
||||
dialogTableVisible1.value = true;
|
||||
}
|
||||
function BUpload(){
|
||||
GetData();
|
||||
}
|
||||
function SetInitUpdatePar(){
|
||||
RequestPost(Api.GetStarter,JSON.stringify({
|
||||
type:0,
|
||||
}),(res)=>{
|
||||
const data = res.data;
|
||||
if(data.Code === 1){
|
||||
const Starter = data.Starter;
|
||||
StaterDB.Ver = Starter.Ver;
|
||||
dialogTableVisible2.value = true;
|
||||
}
|
||||
else {
|
||||
ElMessage.error('获取启动器更新参数失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
function ReviseStarter(){
|
||||
RequestPost(Api.ReviseStarter,JSON.stringify({
|
||||
Ver:StaterDB.Ver,
|
||||
}),(res)=>{
|
||||
const data = res.data;
|
||||
if(data.Code === 1){
|
||||
dialogTableVisible2.value = false;
|
||||
UpLoadBin.value.clearFiles();
|
||||
ElMessage.success('修改启动器更新参数成功');
|
||||
}
|
||||
else {
|
||||
ElMessage.error('修改启动器更新参数失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
function On_error(){
|
||||
ElMessage.error('启动器更新程序上传失败');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@ -1,8 +1,23 @@
|
||||
import axios from "axios";
|
||||
import {reactive, ref} from "vue";
|
||||
import {ElNotification} from "element-plus";
|
||||
const RootURL = '/api';// /api
|
||||
export const Api = reactive({
|
||||
GetALicense: ref(RootURL + '/ActivationCode'),
|
||||
GetBSVData: ref(RootURL + '/UI_2/GetData'),
|
||||
GetBSVDownload: ref(RootURL + '/UI_2/Download'),
|
||||
GetBSVUpload: ref(RootURL + '/UI_2/Upload'),
|
||||
GetBSVDelete: ref(RootURL + '/UI_2/DeleteData'),
|
||||
UserVerify: ref(RootURL + '/UserVerify'),
|
||||
GetStarter: ref(RootURL + '/Starter/GetStarter'),
|
||||
ReviseStarter: ref(RootURL + '/Starter/ReviseStarter'),
|
||||
UpStarter: ref(RootURL + '/Starter/UploadStarter'),
|
||||
});
|
||||
export const User = reactive({
|
||||
User:ref('-1'),
|
||||
Pwd:ref('-1'),
|
||||
Verify:false,
|
||||
Code:0,
|
||||
})
|
||||
export function RequestPost(url, data,call){
|
||||
axios.post(url,data).then(res=>{
|
||||
@ -11,3 +26,9 @@ export function RequestPost(url, data,call){
|
||||
console.error(err);
|
||||
})
|
||||
}
|
||||
|
||||
export function VlClose(){
|
||||
if(User.Code === 0){
|
||||
User.Verify = true;
|
||||
}
|
||||
}
|
||||
@ -5,13 +5,13 @@
|
||||
:ellipsis="false"
|
||||
@select="handleSelect"
|
||||
style="height: 80px;"
|
||||
default-active="/UI_1"
|
||||
>
|
||||
<el-menu-item index="0">
|
||||
<img
|
||||
style="width: 100px"
|
||||
:src="logo"
|
||||
alt="Element logo"
|
||||
/>
|
||||
<el-menu-item index="/UI_1">
|
||||
<span>注册服务</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="/UI_2">
|
||||
<span>BS更新服务</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
<div style="height: calc(100vh - 80px)">
|
||||
@ -19,18 +19,82 @@
|
||||
<router-view></router-view>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
v-model="User.Verify"
|
||||
title="权限认证"
|
||||
width="500"
|
||||
:before-close="VlClose"
|
||||
>
|
||||
<el-form>
|
||||
<el-form-item label="用户名">
|
||||
<el-input v-model="DataDB.User" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码">
|
||||
<el-input v-model="DataDB.Pwd" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="VlClose">
|
||||
取消
|
||||
</el-button>
|
||||
<el-button type="primary" @click.stop="PermissionAuthentication">
|
||||
确认
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import logo from '/src/assets/logo.png';
|
||||
import {onMounted} from "vue";
|
||||
import {onMounted, reactive, ref} from "vue";
|
||||
import {useRouter} from "vue-router";
|
||||
import {Api, User, VlClose} from "../JS/RequestAPI.js";
|
||||
import axios from "axios";
|
||||
import {ElNotification} from "element-plus";
|
||||
const router = useRouter();
|
||||
const DataDB = reactive({
|
||||
User:User.User,
|
||||
Pwd:User.Pwd,
|
||||
})
|
||||
onMounted(()=>{
|
||||
router.push('/UI_1');
|
||||
// router.push('/UI_1');
|
||||
User.Verify = true;
|
||||
})
|
||||
function handleSelect(key, keyPath){
|
||||
// console.log(key, keyPath);
|
||||
router.push(key);
|
||||
}
|
||||
function PermissionAuthentication(){
|
||||
axios.post(Api.UserVerify,JSON.stringify({
|
||||
User:DataDB.User,
|
||||
Pwd:DataDB.Pwd,
|
||||
})).then(res=>{
|
||||
const data = res.data;
|
||||
if(data.Code === 1){
|
||||
User.Code = 1;
|
||||
User.User = DataDB.User;
|
||||
User.Pwd = DataDB.Pwd;
|
||||
User.Verify = false;
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '验证成功',
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
else {
|
||||
User.Verify = true;
|
||||
ElNotification({
|
||||
title: '错误',
|
||||
message: '用户名或密码错误',
|
||||
type: 'error',
|
||||
})
|
||||
User.Code = 0;
|
||||
}
|
||||
}).catch(err=>{
|
||||
User.Code = 0;
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -5,8 +5,11 @@ import '@arco-design/web-vue/dist/arco.css';
|
||||
import router from "../router/router.js";
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
const app = createApp(App);
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
app.use(ArcoVue);
|
||||
app.use(router);
|
||||
app.use(ElementPlus)
|
||||
|
||||
@ -8,12 +8,12 @@ export default defineConfig({
|
||||
port: 5174,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:8888/',
|
||||
target: 'http://127.0.0.1:9999/',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
},
|
||||
'/sock': {
|
||||
target: 'ws://192.168.1.24:8888/',
|
||||
target: 'ws://192.168.1.24:9999/',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/sock/, '')
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user