Skip to content

Commit 2c0d4dc

Browse files
committed
feat(System Settings): Add a welcome message for users who have questions in the system.
1 parent 20ded06 commit 2c0d4dc

File tree

3 files changed

+130
-4
lines changed

3 files changed

+130
-4
lines changed

frontend/src/stores/appearance.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ interface AppearanceState {
2828
name?: string
2929
foot?: string
3030
showSlogan?: string
31+
pc_welcome?: string
32+
pc_welcome_desc?: string
3133
footContent?: string
3234
loaded: boolean
3335
showDemoTips?: boolean
@@ -66,6 +68,8 @@ export const useAppearanceStore = defineStore('appearanceStore', {
6668
showDemoTips: false,
6769
demoTipsContent: '',
6870
fontList: [],
71+
pc_welcome: '',
72+
pc_welcome_desc: '',
6973
}
7074
},
7175
getters: {
@@ -272,14 +276,15 @@ export const useAppearanceStore = defineStore('appearanceStore', {
272276
}
273277
)[item.pkey] = item.pval
274278
})
275-
276279
this.navigate = data.navigate
277280
this.help = data.help
278281
this.showDoc = data.showDoc
279282
this.showAbout = data.showAbout
280283
this.navigateBg = data.navigateBg
281284
this.themeColor = data.themeColor
282285
this.customColor = data.customColor
286+
this.pc_welcome = data.pc_welcome
287+
this.pc_welcome_desc = data.pc_welcome_desc
283288
const currentColor =
284289
this.themeColor === 'custom' && this.customColor
285290
? this.customColor

frontend/src/views/chat/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@
145145
><custom_small v-if="appearanceStore.themeColor !== 'default'"></custom_small>
146146
<LOGO_fold v-else></LOGO_fold
147147
></el-icon>
148-
{{ t('qa.greeting') }}
148+
{{ appearanceStore.pc_welcome }}
149149
</div>
150150
<div class="sub">
151-
{{ t('qa.hint_description') }}
151+
{{ appearanceStore.pc_welcome_desc }}
152152
</div>
153153
</template>
154154

frontend/src/views/system/appearance/index.vue

Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
<div class="navigate-head">
165165
<div class="header-sql">
166166
<img height="30" width="30" v-if="pageLogin" :src="pageLogin" alt="" />
167-
<custom_small v-else-if="themeColor === 'custom'" class="logo" />
167+
<custom_small v-else-if="themeColor !== 'default'" class="logo" />
168168
<logo v-else></logo>
169169
<span style="margin-left: 8px">{{ loginForm.name }}</span>
170170
</div>
@@ -179,6 +179,27 @@
179179
</el-icon>
180180
</div>
181181
</div>
182+
<div class="welcome-content">
183+
<div class="greeting">
184+
<img v-if="pageLogin" height="32" width="32" :src="pageLogin" alt="" />
185+
<el-icon v-else size="32"
186+
><custom_small v-if="themeColor !== 'default'"></custom_small>
187+
<LOGO_fold v-else></LOGO_fold
188+
></el-icon>
189+
{{ topForm.pc_welcome }}
190+
</div>
191+
<div class="sub">
192+
{{ topForm.pc_welcome_desc }}
193+
</div>
194+
<el-button size="large" type="primary" class="greeting-btn">
195+
<span class="inner-icon">
196+
<el-icon>
197+
<icon_new_chat_outlined />
198+
</el-icon>
199+
</span>
200+
{{ t('qa.start_sqlbot') }}
201+
</el-button>
202+
</div>
182203
</div>
183204
<div class="tips-page">
184205
{{
@@ -212,6 +233,36 @@
212233
false-value="1"
213234
:label="$t('system.show_about')"
214235
/>
236+
<div style="margin-top: 8px" class="label">
237+
{{ $t('system.welcome_message') }}
238+
</div>
239+
<div style="margin: 8px 0">
240+
<el-input
241+
v-model="topForm.pc_welcome"
242+
:placeholder="
243+
$t('datasource.please_enter') +
244+
$t('common.empty') +
245+
$t('system.welcome_message')
246+
"
247+
maxlength="50"
248+
/>
249+
</div>
250+
<div class="label">
251+
{{ $t('embedded.welcome_description') }}
252+
</div>
253+
<div style="margin: 8px 0">
254+
<el-input
255+
v-model="topForm.pc_welcome_desc"
256+
:placeholder="
257+
$t('datasource.please_enter') +
258+
$t('common.empty') +
259+
$t('embedded.welcome_description')
260+
"
261+
type="textarea"
262+
show-word-limit
263+
maxlength="50"
264+
/>
265+
</div>
215266
</div>
216267
</div>
217268
</div>
@@ -230,6 +281,7 @@
230281

231282
<script lang="ts" setup>
232283
import logo from '@/assets/LOGO-fold.svg'
284+
import LOGO_fold from '@/assets/LOGO-fold.svg'
233285
import custom_small from '@/assets/svg/logo-custom_small.svg'
234286
import { ref, unref, reactive, onMounted, onUnmounted, nextTick, computed } from 'vue'
235287
import {
@@ -241,6 +293,7 @@ import {
241293
import { useI18n } from 'vue-i18n'
242294
import { request } from '@/utils/request'
243295
import icon_side_fold_outlined from '@/assets/svg/icon_side-fold_outlined.svg'
296+
import icon_new_chat_outlined from '@/assets/svg/icon_new_chat_outlined.svg'
244297
import { useAppearanceStoreWithOut } from '@/stores/appearance'
245298
import LoginPreview from './LoginPreview.vue'
246299
import Person from './Person.vue'
@@ -324,12 +377,16 @@ const defaultTopForm = {
324377
help: 'https://dataease.cn/sqlbot/v1/',
325378
showDoc: '0',
326379
showAbout: '0',
380+
pc_welcome: '你好,我是 SQLBot ',
381+
pc_welcome_desc: `我可以查询数据、生成图表、检测数据异常、预测数据等赶快开启智能问数吧~`,
327382
}
328383
329384
const topForm = reactive<{
330385
help: string
331386
showDoc: string
332387
showAbout: string
388+
pc_welcome: string
389+
pc_welcome_desc: string
333390
}>(cloneDeep(defaultTopForm))
334391
335392
const isBlue = computed(() => {
@@ -816,6 +873,7 @@ onUnmounted(() => {
816873
background-color: #fff;
817874
border-radius: 6px;
818875
overflow: hidden;
876+
position: relative;
819877
820878
.navigate-head {
821879
width: 240px;
@@ -847,6 +905,63 @@ onUnmounted(() => {
847905
}
848906
}
849907
}
908+
909+
.welcome-content {
910+
width: calc(100% - 240px);
911+
display: flex;
912+
gap: 16px;
913+
align-items: center;
914+
flex-direction: column;
915+
position: absolute;
916+
right: 0;
917+
top: 50%;
918+
transform: translateY(-50%);
919+
920+
.greeting {
921+
display: flex;
922+
align-items: center;
923+
gap: 16px;
924+
line-height: 32px;
925+
font-size: 24px;
926+
font-weight: 600;
927+
color: rgba(31, 35, 41, 1);
928+
}
929+
930+
.sub {
931+
color: grey;
932+
font-size: 16px;
933+
line-height: 24px;
934+
}
935+
936+
.greeting-btn {
937+
width: 80%;
938+
height: 88px;
939+
border-radius: 16px;
940+
border-style: dashed;
941+
942+
.inner-icon {
943+
display: flex;
944+
flex-direction: row;
945+
align-items: center;
946+
947+
margin-right: 6px;
948+
}
949+
950+
font-size: 16px;
951+
line-height: 24px;
952+
font-weight: 500;
953+
954+
--ed-button-text-color: var(--ed-color-primary, rgba(28, 186, 144, 1));
955+
--ed-button-hover-text-color: var(--ed-color-primary, rgba(28, 186, 144, 1));
956+
--ed-button-active-text-color: var(--ed-color-primary, rgba(28, 186, 144, 1));
957+
--ed-button-bg-color: rgba(248, 249, 250, 1);
958+
--ed-button-hover-bg-color: var(--ed-color-primary-1a, #1cba901a);
959+
--ed-button-border-color: rgba(217, 220, 223, 1);
960+
--ed-button-hover-border-color: var(--ed-color-primary, rgba(28, 186, 144, 1));
961+
--ed-button-active-bg-color: var(--ed-color-primary-33, #1cba9033);
962+
--ed-button-active-border-color: var(--ed-color-primary, rgba(28, 186, 144, 1));
963+
}
964+
}
850965
}
851966
}
852967
@@ -858,6 +973,12 @@ onUnmounted(() => {
858973
margin: 8px 0;
859974
}
860975
976+
.label {
977+
font-weight: 400;
978+
font-size: 14px;
979+
line-height: 22px;
980+
}
981+
861982
.config-item {
862983
min-height: 104px;
863984
margin-bottom: 8px;

0 commit comments

Comments
 (0)