|
|
@ -6,9 +6,6 @@
|
|
|
|
-->
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div class="vbtn" v-if="preview_mode" @click="preview_mode = false">
|
|
|
|
|
|
|
|
<OneIcon name='edit-square'>plus</OneIcon>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<Editor style="" v-if="core.id" :eid="core.id + '.des'" v-model="preview_mode" :content="content" @save="save">
|
|
|
|
<Editor style="" v-if="core.id" :eid="core.id + '.des'" v-model="preview_mode" :content="content" @save="save">
|
|
|
|
</Editor>
|
|
|
|
</Editor>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -16,7 +13,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import type { models } from '#imports';
|
|
|
|
import type { models } from '#imports';
|
|
|
|
import oaer from '@veypi/oaer'
|
|
|
|
import { fs } from '@veypi/oaer'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let props = withDefaults(defineProps<{
|
|
|
|
let props = withDefaults(defineProps<{
|
|
|
@ -27,40 +24,37 @@ let props = withDefaults(defineProps<{
|
|
|
|
|
|
|
|
|
|
|
|
let preview_mode = ref(true)
|
|
|
|
let preview_mode = ref(true)
|
|
|
|
|
|
|
|
|
|
|
|
let content = ref('编辑')
|
|
|
|
let content = ref('')
|
|
|
|
|
|
|
|
|
|
|
|
watch(computed(() => props.core.id), () => {
|
|
|
|
|
|
|
|
sync()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sync = () => {
|
|
|
|
const sync = () => {
|
|
|
|
if (props.core.des) {
|
|
|
|
if (props.core.des) {
|
|
|
|
console.log(props.core.des)
|
|
|
|
fs.app.getFileContents(fs.app.urlunwrap(props.core.des), { format: 'text' }).then((e) => {
|
|
|
|
oaer.fs().app.getFileContents("/net/go.mod", { format: 'text' }).then((e) => {
|
|
|
|
|
|
|
|
content.value = e as string
|
|
|
|
content.value = e as string
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(computed(() => props.core.id), () => {
|
|
|
|
|
|
|
|
sync()
|
|
|
|
|
|
|
|
}, { immediate: true })
|
|
|
|
|
|
|
|
|
|
|
|
const save = (des: string) => {
|
|
|
|
const save = (des: string) => {
|
|
|
|
oaer.fs().app.putFileContents("/info/des.md", des).then((e) => {
|
|
|
|
let furl = `/info/appdes/${props.core.id}.md`
|
|
|
|
console.log(e)
|
|
|
|
fs.app.putFileContents(furl, des).then((e) => {
|
|
|
|
|
|
|
|
furl = fs.app.urlwrap(furl)
|
|
|
|
|
|
|
|
if (props.core.des !== furl) {
|
|
|
|
|
|
|
|
api.app.Patch(props.core.id, { des: furl }).then((e) => {
|
|
|
|
|
|
|
|
preview_mode.value = true
|
|
|
|
|
|
|
|
props.core.des = furl
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
preview_mode.value = true
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
// oafs.upload([a], props.core.id).then(url => {
|
|
|
|
|
|
|
|
// api.app.update(props.core.id, { des: url[0] }).then(e => {
|
|
|
|
|
|
|
|
// preview_mode.value = true
|
|
|
|
|
|
|
|
// props.core.des = url[0]
|
|
|
|
|
|
|
|
// }).catch(e => {
|
|
|
|
|
|
|
|
// // msg.Warn("更新失败: " + e)
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// }).catch(e => {
|
|
|
|
|
|
|
|
// // msg.Warn("更新失败: " + e)
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
sync()
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|