Skip to content

Commit

Permalink
[fix] fix some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
WindLX committed Dec 10, 2023
1 parent b40a1cb commit 6d1eb9d
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion data/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ backend_port = 13956

[basic]
title = "Pap"
log_level = "WARNING"
log_level = "INFO"

[path]
note_dir = "./data/note/"
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<body>
<div id="app"></div>
<script>
//window.host = "{{ host }}"
//window.port = {{ port }}
window.host = "127.0.0.1"
window.port = 13956
window.host = "{{ host }}"
window.port = {{ port }}
//window.host = "127.0.0.1"
//window.port = 13956
</script>
<script type="module" src="/src/main.ts"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pap",
"private": true,
"version": "0.2.4",
"version": "0.2.5",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
3 changes: 0 additions & 3 deletions scripts/pap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ if [ "$Update" = true ]; then
mv ./PapPack/libmd_net.so ./libmd_net.so
mv ./PapPack/requirements_release.txt ./requirements_release.txt

rm PapPack -r
rm PapPack.tar.gz

if [ -d ".venv" ]; then
rm .venv -r
fi
Expand Down
1 change: 1 addition & 0 deletions src/api/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class NoteApi extends BaseApi {
public static async getNoteByTags(tagsId: TagSetSchema): Promise<Array<NoteRelationshipSchema>> {
return new Promise(function (resolve, reject) {
pFetch(`/note/get_note_by_tags`, {
method: 'POST',
body: JSON.stringify(tagsId),
}).then(async res => {
const notes = await res.json() as Array<NoteRelationshipSchema>;
Expand Down
5 changes: 0 additions & 5 deletions src/components/Markdown/MdTip.vue

This file was deleted.

11 changes: 9 additions & 2 deletions src/components/Middlebar/Note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ tagStore.$onAction(
name: name,
after: after,
}) => {
after((result) => {
after(async (result) => {
switch (name) {
case "onUpdate":
filterTags.value = []
getNoteAsync()
await getNoteAsync()
break;
case "onChoose":
const e = result as TagEvent
if (e.filterId === -1) {
filterTags.value = filterTags.value.filter((t) => t.id !== e.tag.id)
filterTags.value.push(e.tag)
}
await getNoteByTagsAsync()
break;
}
})
Expand All @@ -52,6 +53,12 @@ async function getNoteAsync() {
noteSet.value = newData
}
async function getNoteByTagsAsync() {
const tagSet = { tags_id: filterTags.value.map((t) => t.id) }
const newData = await NoteApi.getNoteByTags(tagSet)
noteSet.value = newData
}
// callback function
function handleShowTag() {
tagStore.setShow()
Expand Down
10 changes: 8 additions & 2 deletions src/components/Tag/TagDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ let filterTags: ComputedRef<Array<TagRelationshipSchema>> = computed(() => {
})
let targetTag: ReactiveVariable<TagSchema> = reactive(tagDefault())
let inputValue: Ref<string> = ref("")
let dialogWidth = computed(() => {
const w = window.screen.width
if (w < 540) return '90%'
else if (w < 900) return '50%'
else return '30%'
})
// callback function
async function handleUpdateConfirmAsync() {
Expand Down Expand Up @@ -192,7 +198,7 @@ onMounted(() => {
</el-collapse>
</template>
</el-drawer>
<el-dialog v-model="inputVisible" title="修改标签" width="30%">
<el-dialog v-model="inputVisible" title="修改标签" :width="dialogWidth">
<el-form class="tag-new" :form="targetTag">
<el-form-item label="名称">
<el-input v-model="targetTag.name">
Expand All @@ -219,7 +225,7 @@ onMounted(() => {
</span>
</template>
</el-dialog>
<el-dialog v-model="chooseVisible" title="提示" width="30%">
<el-dialog v-model="chooseVisible" title="提示" :width="dialogWidth">
<div style="display: flex; align-items: center; flex-direction: column;">
<tag :color="targetTag?.color" :closable="false" :disable="false">
{{ targetTag?.name }}
Expand Down
4 changes: 4 additions & 0 deletions src/store/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export enum ContentIndex {
}

const sideIndexes = [SidebarIndex.Note, SidebarIndex.Net, SidebarIndex.Resource, SidebarIndex.Setting]
const contentIndexes = [ContentIndex.Note, ContentIndex.Net, ContentIndex.Resource]

export const useStateStore = defineStore('states', {
state: () => {
Expand All @@ -39,6 +40,9 @@ export const useStateStore = defineStore('states', {
},
select(index: number) {
this.sidebarIndex = sideIndexes[index]
if (index != 3) {
this.contentIndex = contentIndexes[index]
}
},
ownMiddlebar(): boolean {
let a = this.sidebarIndex != SidebarIndex.Net
Expand Down

0 comments on commit 6d1eb9d

Please sign in to comment.