Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
9a8a0d2410
|
@ -0,0 +1,9 @@
|
|||
import server from '@/utils/request';
|
||||
|
||||
export const getModule = () => server.get('/license/module');
|
||||
|
||||
export const licenseInit = (data:any) =>server.post('/license/init',data);
|
||||
|
||||
export const getLicense = () => server.get('/license');
|
||||
|
||||
export const initPage = () => server.get('/user/settings/init');
|
|
@ -1,6 +1,7 @@
|
|||
export const LoginPath = '/login'
|
||||
export const InitHomePath = '/init-home'
|
||||
export const AccountCenterBindPath = '/account/center/bind'
|
||||
export const InitLicense = '/init-license'
|
||||
|
||||
export const AccountMenu = {
|
||||
path: '/account',
|
||||
|
@ -51,7 +52,7 @@ export const AccountMenu = {
|
|||
}
|
||||
|
||||
export default [
|
||||
{ path: '/*', redirect: '/'},
|
||||
{ path: '/*', redirect: '/' },
|
||||
{
|
||||
path: LoginPath,
|
||||
component: () => import('@/views/user/Login/index.vue')
|
||||
|
@ -64,5 +65,9 @@ export default [
|
|||
path: InitHomePath, // 初始化
|
||||
component: () => import('@/views/init-home/index.vue')
|
||||
},
|
||||
{
|
||||
path: InitLicense,
|
||||
component: () => import('@/views/system/License/index.vue')
|
||||
}
|
||||
|
||||
]
|
|
@ -0,0 +1,77 @@
|
|||
<template>
|
||||
<FullPage>
|
||||
<j-card>
|
||||
<TitleComponent data="基础信息"></TitleComponent>
|
||||
<div>
|
||||
<j-descriptions bordered :column="4">
|
||||
<j-descriptions-item label="Host" :span="4">
|
||||
{{ info?.host }}
|
||||
</j-descriptions-item>
|
||||
<template v-for="i in info?.modules" :key="i">
|
||||
<j-descriptions-item label="IP" :span="2">
|
||||
{{ i.ip }}
|
||||
</j-descriptions-item>
|
||||
<j-descriptions-item label="Mac" :span="2">
|
||||
{{ i.mac }}</j-descriptions-item
|
||||
>
|
||||
</template>
|
||||
</j-descriptions>
|
||||
</div>
|
||||
<div style="display: flex; margin-top: 10px; align-items: center">
|
||||
<TitleComponent
|
||||
data="License"
|
||||
style="margin-top: 20px"
|
||||
></TitleComponent>
|
||||
<slot></slot>
|
||||
</div>
|
||||
<j-textarea
|
||||
placeholder="请输入License"
|
||||
:rows="10"
|
||||
v-model:value="license"
|
||||
>
|
||||
</j-textarea>
|
||||
<PermissionButton
|
||||
type="primary"
|
||||
key="save"
|
||||
style="margin-top: 20px"
|
||||
@click="saveData"
|
||||
>保存</PermissionButton
|
||||
>
|
||||
</j-card>
|
||||
</FullPage>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
licenseData: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
let info = ref();
|
||||
let license = ref();
|
||||
watch(
|
||||
() => {
|
||||
props.data;
|
||||
},
|
||||
() => {
|
||||
info.value = props.data;
|
||||
},
|
||||
);
|
||||
watch(
|
||||
() => props.licenseData,
|
||||
() => {
|
||||
license.value = props.licenseData;
|
||||
},
|
||||
);
|
||||
const emit = defineEmits(['saveData']);
|
||||
const saveData = () => {
|
||||
emit('saveData', license.value);
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
|
@ -0,0 +1,40 @@
|
|||
<template>
|
||||
<Card :infoData="info" @saveData="saveData" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import Card from './component/Card.vue';
|
||||
import { message } from 'jetlinks-ui-components';
|
||||
import { getModule, licenseInit, initPage } from '@/api/system/license';
|
||||
let info = ref();
|
||||
const saveData = (data: any) => {
|
||||
if (data) {
|
||||
save(data);
|
||||
} else {
|
||||
message.error('请配置License');
|
||||
}
|
||||
};
|
||||
const getInfo = async () => {
|
||||
const res = await getModule();
|
||||
if (res.status === 200) {
|
||||
info.value = res.result;
|
||||
}
|
||||
};
|
||||
const save = async (data: any) => {
|
||||
const res: any = await licenseInit(data);
|
||||
if (res.status === 200) {
|
||||
message.success('配置成功');
|
||||
const resp: any = await initPage();
|
||||
if (resp.status === 200 && !resp.result.length) {
|
||||
window.location.href = '/#/init-home';
|
||||
} else {
|
||||
window.location.href = '/';
|
||||
}
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
getInfo();
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
|
@ -0,0 +1,64 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<Card
|
||||
:infoData="info"
|
||||
@saveData="saveData"
|
||||
:license-data="license"
|
||||
:licenseTime="licenseTime"
|
||||
>
|
||||
<div style="width: 200px">到期时间:{{ licenseTime?.expire }}</div>
|
||||
</Card>
|
||||
</page-container>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import Card from '../component/Card.vue';
|
||||
import { message } from 'jetlinks-ui-components';
|
||||
import {
|
||||
getModule,
|
||||
licenseInit,
|
||||
initPage,
|
||||
getLicense,
|
||||
} from '@/api/system/license';
|
||||
let info = ref();
|
||||
let license = ref();
|
||||
let licenseTime = ref();
|
||||
const saveData = (data: any) => {
|
||||
if (data) {
|
||||
save(data);
|
||||
} else {
|
||||
message.error('请配置License');
|
||||
}
|
||||
};
|
||||
const getlicense = async () => {
|
||||
const res: any = await getLicense();
|
||||
if (res.status === 200) {
|
||||
licenseTime.value = res.result;
|
||||
license.value = res.result?.license;
|
||||
}
|
||||
};
|
||||
const getInfo = async () => {
|
||||
const res = await getModule();
|
||||
if (res.status === 200) {
|
||||
info.value = res.result;
|
||||
}
|
||||
};
|
||||
const save = async (data: any) => {
|
||||
const res: any = await licenseInit(data);
|
||||
if (res.status === 200) {
|
||||
message.success('配置成功');
|
||||
const resp: any = await initPage();
|
||||
if (resp.status === 200 && !resp.result.length) {
|
||||
window.location.href = '/#/init-home';
|
||||
} else {
|
||||
window.location.href = '/';
|
||||
}
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
getInfo();
|
||||
getlicense();
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
Loading…
Reference in New Issue