Skip to content

Commit

Permalink
ignore api generated file
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Apr 8, 2024
1 parent 1c5d0b2 commit 80c5d63
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 136 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ internal/template/notify_tpl/default.html
# generated files
docs/swagger/swagger.json
docs/swagger/swagger.yaml
pnpm-lock.yaml
pnpm-lock.yaml
ui/artalk/src/api/v2.ts
22 changes: 13 additions & 9 deletions ui/artalk-sidebar/src/components/FileUploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const emit = defineEmits<{
const { apiUrl } = toRefs(props)
let xhr: XMLHttpRequest|null = null
const fileInputEl = ref<HTMLInputElement|null>(null)
let xhr: XMLHttpRequest | null = null
const fileInputEl = ref<HTMLInputElement | null>(null)
const remoteFilename = ref('')
const isUploading = ref(false)
const progress = ref(0)
Expand Down Expand Up @@ -45,7 +45,7 @@ async function startUploadFile(file: File) {
const fileSize = file.size
if (evt.loaded <= fileSize) {
// 正在上传
progress.value = Math.round(evt.loaded / fileSize * 100)
progress.value = Math.round((evt.loaded / fileSize) * 100)
}
})
Expand All @@ -56,7 +56,7 @@ async function startUploadFile(file: File) {
// 开始上传
xhr.open('post', apiUrl.value)
xhr.timeout = 5*60*1000 // 5分钟超时
xhr.timeout = 5 * 60 * 1000 // 5分钟超时
xhr.send(formData)
// 上传成功事件
Expand All @@ -72,7 +72,7 @@ async function startUploadFile(file: File) {
return
}
const ok = (xhr.status >= 200) && (xhr.status <= 299)
const ok = xhr.status >= 200 && xhr.status <= 299
if (!ok) {
setErr(`Response HTTP Code: ${xhr.status}, Body: ${xhr.response}`)
return
Expand Down Expand Up @@ -120,7 +120,13 @@ function abortUpload() {
<template>
<div class="atk-file-upload-group">
<div v-show="!isUploading" class="atk-file-input-wrap atk-fade-in">
<input ref="fileInputEl" type="file" name="AtkDataFile" accept=".artrans" @change="onFileInputChange()" />
<input
ref="fileInputEl"
type="file"
name="AtkDataFile"
accept=".artrans"
@change="onFileInputChange()"
/>
<div class="atk-desc">
<slot v-if="!isDone" name="tip"></slot>
<slot v-if="isDone" name="done-msg"></slot>
Expand All @@ -140,6 +146,4 @@ function abortUpload() {
</div>
</template>

<style scoped lang="scss">
</style>
<style scoped lang="scss"></style>
20 changes: 8 additions & 12 deletions ui/artalk-sidebar/src/components/PageEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ async function editAdminOnly() {
let p: ArtalkType.PageData
try {
p = (
await artalk!.ctx
.getApi()
.pages.updatePage(page.value.id, {
...page.value,
admin_only: !page.value.admin_only,
})
await artalk!.ctx.getApi().pages.updatePage(page.value.id, {
...page.value,
admin_only: !page.value.admin_only,
})
).data
} catch (err: any) {
alert(`修改失败:${err.message || '未知错误'}`)
Expand Down Expand Up @@ -97,12 +95,10 @@ async function onFieldEditorYes(val: string) {
let p: ArtalkType.PageData
try {
p = (
await artalk!.ctx
.getApi()
.pages.updatePage(page.value.id, {
...page.value,
[editFieldKey.value as any]: val,
})
await artalk!.ctx.getApi().pages.updatePage(page.value.id, {
...page.value,
[editFieldKey.value as any]: val,
})
).data
} catch (err: any) {
alert(`修改失败:${err.message || '未知错误'}`)
Expand Down
10 changes: 4 additions & 6 deletions ui/artalk-sidebar/src/components/SiteEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ async function onFieldEditorYes(val: string) {
.map((v) => v.trim())
.filter((v) => !!v)
s = (
await artalk!.ctx
.getApi()
.sites.updateSite(site.value.id, {
...site.value,
[editFieldKey.value]: finalVal,
})
await artalk!.ctx.getApi().sites.updateSite(site.value.id, {
...site.value,
[editFieldKey.value]: finalVal,
})
).data
} catch (err: any) {
alert(`修改失败:${err.message || '未知错误'}`)
Expand Down
2 changes: 0 additions & 2 deletions ui/artalk/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@

window.artalk = artalk
window.Artalk = Artalk

;(function () {
const toTopElem = document.querySelector('.to-top')
toTopElem.addEventListener('click', () => {
Expand All @@ -233,7 +232,6 @@
}
}
})()

;(function () {
// @Refer: https://stackoverflow.com/questions/50840168/how-to-detect-if-the-os-is-in-dark-mode-in-browsers
let darkMode = false
Expand Down
Loading

0 comments on commit 80c5d63

Please sign in to comment.