Skip to content

Commit e66fa42

Browse files
committed
feat: Style optimization
1 parent 0ecca1e commit e66fa42

File tree

2 files changed

+169
-0
lines changed

2 files changed

+169
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<script lang="ts" setup>
2+
import { ref } from "vue";
3+
import { Document } from "@element-plus/icons-vue";
4+
const props = withDefaults(
5+
defineProps<{
6+
name: string;
7+
description: string;
8+
creator: string;
9+
}>(),
10+
{
11+
name: "",
12+
description: "",
13+
creator: "",
14+
}
15+
);
16+
</script>
17+
18+
<template>
19+
<div class="datasource-card">
20+
<div class="description">
21+
<el-icon size="20" style="margin-right: 12px">
22+
<Document></Document>
23+
</el-icon>
24+
<span class="value">{{ name }}</span>
25+
</div>
26+
<div class="description">
27+
<span class="key">describe:</span>
28+
<span class="value">{{ description }}</span>
29+
</div>
30+
<div class="description">
31+
<span class="key">Founder:</span>
32+
<span class="value">{{ creator }}</span>
33+
</div>
34+
</div>
35+
</template>
36+
37+
<style lang="less" scoped>
38+
.datasource-card {
39+
height: 120px;
40+
padding: 16px;
41+
border-radius: 4px;
42+
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
43+
.description {
44+
display: flex;
45+
align-items: center;
46+
width: 100%;
47+
margin-bottom: 8px;
48+
.key {
49+
margin-right: 12px;
50+
}
51+
}
52+
}
53+
</style>

frontend/src/views/work/index.vue

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<script lang="ts" setup>
2+
import { ref, computed } from "vue";
3+
import DatasourceCard from "./DatasourceCard.vue";
4+
5+
const props = withDefaults(
6+
defineProps<{
7+
datasourceList: Array<any>;
8+
}>(),
9+
{
10+
datasourceList: () => [],
11+
}
12+
);
13+
14+
const datasourceName = ref("");
15+
const datasourceListComputed = computed(() =>
16+
props.datasourceList.filter((val) =>
17+
val.name.toLowerCase.includes(datasourceName.value.toLowerCase())
18+
)
19+
);
20+
21+
const dialogVisible = ref(false);
22+
</script>
23+
24+
<template>
25+
<div class="chat-init_tip">
26+
<div class="hello-sqlbot">Hello, I'm SQLBot, happy to serve you!</div>
27+
<div class="function-sqlbot">
28+
I can help you query data, generate charts, detect data anomalies, predict
29+
data, etc. Please select a data source and start intelligent data query~
30+
</div>
31+
<div class="select-datasource">
32+
<span class="title">Select data source</span>
33+
<el-button @click="dialogVisible = true" text>View more</el-button>
34+
</div>
35+
<div class="datasource-content">
36+
<DatasourceCard
37+
name="1"
38+
v-for="ele in datasourceList"
39+
:key="ele.id"
40+
></DatasourceCard>
41+
</div>
42+
<el-button type="primary">Create a new data source</el-button>
43+
</div>
44+
<el-dialog
45+
v-model="dialogVisible"
46+
title="Select data source"
47+
width="800"
48+
modal-class="select-datasource_dialog"
49+
>
50+
<div class="search-datasource">
51+
<el-input
52+
v-model="datasourceName"
53+
style="width: 240px"
54+
placeholder="Please input"
55+
/>
56+
</div>
57+
<div class="datasource-content">
58+
<DatasourceCard
59+
name="1"
60+
v-for="ele in datasourceListComputed"
61+
:key="ele.id"
62+
></DatasourceCard>
63+
</div>
64+
<template #footer>
65+
<div class="dialog-footer">
66+
<el-button @click="dialogVisible = false">Cancel</el-button>
67+
<el-button type="primary" @click="dialogVisible = false">
68+
Confirm
69+
</el-button>
70+
</div>
71+
</template>
72+
</el-dialog>
73+
</template>
74+
75+
<style lang="less" scoped>
76+
.chat-init_tip {
77+
width: 780px;
78+
padding: 16px;
79+
.hello-sqlbot {
80+
margin-bottom: 12px;
81+
font-size: 16px;
82+
font-weight: 500;
83+
}
84+
.function-sqlbot {
85+
margin-bottom: 12px;
86+
}
87+
88+
.select-datasource {
89+
display: flex;
90+
align-items: center;
91+
justify-content: space-between;
92+
}
93+
94+
.datasource-content {
95+
margin: 12px 0;
96+
display: grid;
97+
grid-template-columns: 1fr 1fr;
98+
gap: 16px;
99+
}
100+
}
101+
</style>
102+
103+
<style lang="less">
104+
.select-datasource_dialog {
105+
.search-datasource {
106+
text-align: right;
107+
}
108+
109+
.datasource-content {
110+
display: grid;
111+
grid-template-columns: 1fr 1fr 1fr;
112+
gap: 16px;
113+
margin-top: 16px;
114+
}
115+
}
116+
</style>

0 commit comments

Comments
 (0)