|
|
|
@ -6,9 +6,6 @@
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
|
<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>
|
|
|
|
|
</div>
|
|
|
|
@ -16,7 +13,7 @@
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import type { models } from '#imports';
|
|
|
|
|
import oaer from '@veypi/oaer'
|
|
|
|
|
import { fs } from '@veypi/oaer'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let props = withDefaults(defineProps<{
|
|
|
|
@ -27,40 +24,37 @@ let props = withDefaults(defineProps<{
|
|
|
|
|
|
|
|
|
|
let preview_mode = ref(true)
|
|
|
|
|
|
|
|
|
|
let content = ref('编辑')
|
|
|
|
|
|
|
|
|
|
watch(computed(() => props.core.id), () => {
|
|
|
|
|
sync()
|
|
|
|
|
})
|
|
|
|
|
let content = ref('')
|
|
|
|
|
|
|
|
|
|
const sync = () => {
|
|
|
|
|
if (props.core.des) {
|
|
|
|
|
console.log(props.core.des)
|
|
|
|
|
oaer.fs().app.getFileContents("/net/go.mod", { format: 'text' }).then((e) => {
|
|
|
|
|
fs.app.getFileContents(fs.app.urlunwrap(props.core.des), { format: 'text' }).then((e) => {
|
|
|
|
|
content.value = e as string
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch(computed(() => props.core.id), () => {
|
|
|
|
|
sync()
|
|
|
|
|
}, { immediate: true })
|
|
|
|
|
|
|
|
|
|
const save = (des: string) => {
|
|
|
|
|
oaer.fs().app.putFileContents("/info/des.md", des).then((e) => {
|
|
|
|
|
console.log(e)
|
|
|
|
|
let furl = `/info/appdes/${props.core.id}.md`
|
|
|
|
|
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(() => {
|
|
|
|
|
sync()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|