filer/frontend/src/views/SettingView.vue

76 lines
2.3 KiB
Vue

<template>
<notifications />
<div class="card w-96 top-5 bg-base-100 shadow-xl">
<div class="card-body">
<h2 class="card-title">又拍云对象存储!</h2>
<div class="form-control w-full max-w-xs">
<label class="label">
<span class="label-text">服务名</span>
</label>
<input
type="text"
class="input input-bordered input-primary w-full max-w-xs"
v-model="allConfig.config.upyun.bucket"
/>
</div>
<div class="form-control w-full max-w-xs">
<label class="label">
<span class="label-text">操作员名称</span>
</label>
<input
type="text"
class="input input-bordered input-primary w-full max-w-xs"
v-model="allConfig.config.upyun.operator"
/>
</div>
<div class="form-control w-full max-w-xs">
<label class="label">
<span class="label-text">密码</span>
</label>
<input
type="password"
class="input input-bordered input-primary w-full max-w-xs"
v-model="allConfig.config.upyun.password"
/>
</div>
<div class="form-control w-full max-w-xs">
<label class="label">
<span class="label-text">域名</span>
</label>
<input
type="text"
class="input input-bordered input-primary w-full max-w-xs"
v-model="allConfig.config.upyun.domain"
/>
</div>
<div class="card-actions justify-end">
<button class="btn btn-primary" @click="upyun_update">更新配置</button>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { onMounted, reactive } from 'vue'
import { notify } from '@kyvg/vue3-notification'
import { GetConfig, SetUpyunConfig } from '@/../wailsjs/go/controller/Storage'
import { controller } from '@/../wailsjs/go/models'
let current_config: controller.ServerConfig = new controller.ServerConfig()
current_config.upyun = new controller.UpyunConfig()
let allConfig = reactive({ config: current_config })
const upyun_update = async () => {
console.log('current config: ', allConfig.config.upyun)
await SetUpyunConfig(allConfig.config.upyun)
notify({
title: '更新成功',
duration: 5000
})
}
onMounted(async () => {
allConfig.config = await GetConfig()
})
</script>