Skip to content

Commit 070c53b

Browse files
committed
[frontend-next] bug fix
1 parent 2a13103 commit 070c53b

File tree

26 files changed

+414
-345
lines changed

26 files changed

+414
-345
lines changed

frontend/.env.development

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
VITE_API_ROOT = /api
2-
VITE_API_WSS_ROOT = wss://nginx.jackyu.cn/api

frontend/.env.production

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
VUE_APP_API_ROOT = /api
2-
VUE_APP_API_WSS_ROOT = /api
1+
VITE_API_ROOT = /api

frontend/frontend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import (
44
"embed"
55
)
66

7-
//go:embed dist
7+
//go:embed dist/* dist/*/*
88
var DistFS embed.FS

frontend/public/vite.svg

Lines changed: 0 additions & 18 deletions
This file was deleted.

frontend/src/components/StdDataDisplay/StdPagination.vue

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
1+
<script setup lang="ts">
2+
import {useGettext} from 'vue3-gettext'
3+
4+
const {pagination, size} = defineProps(['pagination', 'size'])
5+
const emit = defineEmits(['changePage'])
6+
const {$gettext} = useGettext()
7+
8+
function changePage(num: number) {
9+
emit('changePage', num)
10+
}
11+
</script>
12+
113
<template>
2-
<div v-if="Object.keys(pagination).length !== 0">
14+
<div v-if="pagination.total>pagination.per_page">
315
<a-pagination
416
:current="pagination.current_page"
5-
:hideOnSinglePage="true"
617
:pageSize="pagination.per_page"
718
:size="size"
819
:total="pagination.total"
920
:show-total="(total, range) => `当前显示${range[0]}-${range[1]}条数据,共${total}条数据`"
1021
class="pagination"
1122
@change="changePage"
1223
/>
13-
<div class="clear"></div>
1424
</div>
1525
</template>
1626

17-
<script>
18-
export default {
19-
name: 'StdPagination',
20-
props: {
21-
pagination: Object,
22-
size: {
23-
default: ''
24-
}
25-
},
26-
methods: {
27-
changePage(num) {
28-
return this.$emit('changePage', num)
29-
}
30-
}
31-
}
32-
</script>
33-
3427
<style lang="less">
3528
.ant-pagination-total-text {
3629
@media (max-width: 450px) {

frontend/src/components/StdDataDisplay/StdTable.vue

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const {$gettext, interpolate} = gettext
55
66
import StdDataEntry from '@/components/StdDataEntry'
77
import StdPagination from './StdPagination.vue'
8-
import {nextTick, reactive, ref} from 'vue'
8+
import {nextTick, reactive, ref, watch} from 'vue'
99
import {useRoute, useRouter} from 'vue-router'
1010
import {message} from 'ant-design-vue'
1111
@@ -61,9 +61,9 @@ const props = defineProps({
6161
})
6262
6363
64-
const data_source = reactive([])
64+
const data_source = ref([])
6565
const loading = ref(true)
66-
const pagination = ({
66+
const pagination = reactive({
6767
total: 1,
6868
per_page: 10,
6969
current_page: 1,
@@ -80,7 +80,6 @@ const rowSelection = reactive({})
8080
const searchColumns = getSearchColumns()
8181
const pithyColumns = getPithyColumns()
8282
83-
8483
get_list()
8584
8685
defineExpose({
@@ -102,7 +101,7 @@ function get_list(page_num = null) {
102101
params['page'] = page_num
103102
}
104103
props.api!.get_list(params).then((r: any) => {
105-
Object.assign(data_source, r.data)
104+
data_source.value = r.data
106105
107106
if (r.pagination !== undefined) {
108107
Object.assign(pagination, r.pagination)
@@ -161,10 +160,17 @@ function onSelect(record: any) {
161160
const router = useRouter()
162161
163162
const reset_search = async () => {
164-
params = reactive({})
163+
Object.keys(params).forEach(v => {
164+
delete params[v]
165+
})
165166
router.push({query: {}}).catch(() => {
166167
})
167168
}
169+
170+
watch(params, () => {
171+
router.push({query: params})
172+
get_list()
173+
})
168174
</script>
169175

170176
<template>
@@ -212,7 +218,6 @@ const reset_search = async () => {
212218
</template>
213219
</template>
214220
</template>
215-
216221
</a-table>
217222
<std-pagination :pagination="pagination" @changePage="get_list"/>
218223
</div>

frontend/src/dark.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
@import "ant-design-vue/dist/antd.dark";
2+
3+
.directive-editor-extra {
4+
background-color: rgba(0, 0, 0, 0.84) !important;
5+
}

frontend/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {createPinia} from 'pinia'
33
import gettext from './gettext'
44
import App from './App.vue'
55
import router from './routes'
6-
import 'ant-design-vue/dist/antd.less'
6+
//import 'ant-design-vue/dist/antd.less'
77
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
88
import {useSettingsStore} from '@/pinia'
99

frontend/src/style.less

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
@import "ant-design-vue/dist/antd.variable";
2-
3-
@border-radius-base: 4px;
1+
@import 'ant-design-vue/dist/antd.less';
Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,42 @@
1+
<script setup lang="ts">
2+
import CertInfo from '@/views/domain/cert/CertInfo.vue'
3+
import IssueCert from '@/views/domain/cert/IssueCert.vue'
4+
import {computed, ref} from 'vue'
5+
6+
const {directivesMap, current_server_directives, enabled} = defineProps<{
7+
directivesMap: any
8+
current_server_directives: Array<any>
9+
enabled: boolean
10+
}>()
11+
12+
const info = ref(null)
13+
14+
interface Info {
15+
get(): void
16+
}
17+
18+
function callback() {
19+
const t: Info | null = info.value
20+
t!.get()
21+
}
22+
23+
const name = computed(() => {
24+
return directivesMap['server_name'][0].params.trim()
25+
})
26+
</script>
27+
128
<template>
229
<div>
330
<cert-info ref="info" :domain="name" v-if="name"/>
431
<issue-cert
532
:current_server_directives="current_server_directives"
633
:directives-map="directivesMap"
7-
v-model="auto_cert"
34+
v-model:enabled="enabled"
835
@callback="callback"
936
/>
1037
</div>
1138
</template>
1239

13-
<script>
14-
import CertInfo from '@/views/domain/cert/CertInfo'
15-
import IssueCert from '@/views/domain/cert/IssueCert'
16-
17-
export default {
18-
name: 'Cert',
19-
components: {IssueCert, CertInfo},
20-
props: {
21-
directivesMap: Object,
22-
current_server_directives: Array,
23-
auto_cert: Boolean
24-
},
25-
model: {
26-
prop: 'auto_cert',
27-
event: 'change_auto_cert'
28-
},
29-
methods: {
30-
callback() {
31-
this.$refs.info.get()
32-
}
33-
},
34-
computed: {
35-
name() {
36-
return this.directivesMap['server_name'][0].params.trim()
37-
}
38-
}
39-
}
40-
</script>
41-
4240
<style scoped>
4341
4442
</style>

0 commit comments

Comments
 (0)