Commit 8c61c719 authored by 王曜嵚 Wang Yaoqin's avatar 王曜嵚 Wang Yaoqin

dev: 状态变化

parent b649bc12
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<NuxtLayout> <NuxtLayout>
<div class='content'> <div class='content'>
<div class='container'> <div class='container'>
<form class='form' ref='form'> <form class='form'>
<div class="form-group"> <div class="form-group">
<div class="form-group__label"> <div class="form-group__label">
<label for="none"> <label for="none">
...@@ -44,11 +44,11 @@ const form = ref<Record<string, any>>({ ...@@ -44,11 +44,11 @@ const form = ref<Record<string, any>>({
}) })
onMounted(() => { onMounted(() => {
getData getData()
}) })
function getData() { function getData() {
$fetch('/api/getProjectInfo').then((res: any) => { $fetch('/api/devops/v1/getProjectInfo').then((res: any) => {
Object.keys(form.value).forEach(key => { Object.keys(form.value).forEach(key => {
if (res[key]) { if (res[key]) {
form.value[key] = res[key] form.value[key] = res[key]
...@@ -58,7 +58,7 @@ function getData() { ...@@ -58,7 +58,7 @@ function getData() {
} }
function handleSaveConfig(key: string) { function handleSaveConfig(key: string) {
const value = JSON.stringify(form.value[key]) const value = JSON.stringify(form.value[key])
$fetch('/api/config/setUserSetting', { method: 'post', body: { table: 'v1', key, value }}).then(() => { $fetch('/api/user/setUserSetting', { method: 'post', body: { table: 'v1', key, value }}).then(() => {
alert('保存成功') alert('保存成功')
}).catch(() => { }).catch(() => {
alert('保存失败!!!') alert('保存失败!!!')
......
...@@ -4,7 +4,7 @@ import { SESSION_PASSWORD } from "../../utils" ...@@ -4,7 +4,7 @@ import { SESSION_PASSWORD } from "../../utils"
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
const body = await readBody(event) const body = await readBody(event)
const username = body.username const username = body.username
const session = await useSession(event, { password: SESSION_PASSWORD }) const session = await useSession(event, { password: SESSION_PASSWORD, cookie: { secure: false } })
await session.update({ username }) await session.update({ username })
let user = await getPgTableData('user', username) let user = await getPgTableData('user', username)
......
...@@ -170,11 +170,11 @@ class Docker { ...@@ -170,11 +170,11 @@ class Docker {
if (platform === 'v1') { if (platform === 'v1') {
await this.switchJavaVersion({ container, username, version: 8 }) await this.switchJavaVersion({ container, username, version: 8 })
const statusV2 = (await getPgTableData( 'v2', username))?.status const statusV2 = (await getPgTableData( 'v2', username))?.status
if (statusV2) setPgTableData( 'v2', username, 'status', 'created') // 如果系统在运行,回退到已创建的状态 if (statusV2) setPgTableData( 'v2', username, 'status', 'compiled') // 如果系统在运行,回退到已创建的状态
} else { } else {
await this.switchJavaVersion({ container, username, version: 17 }) await this.switchJavaVersion({ container, username, version: 17 })
const statusV1 = (await getPgTableData( 'v1', username))?.status const statusV1 = (await getPgTableData( 'v1', username))?.status
if (statusV1) setPgTableData( 'v1', username, 'status', 'created') // 如果系统在运行,回退到已创建的状态 if (statusV1) setPgTableData( 'v1', username, 'status', 'compiled') // 如果系统在运行,回退到已创建的状态
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment