add some styling to lab home

This commit is contained in:
Zhigang Wang 2024-06-14 15:35:42 -07:00
parent 6d898a3b49
commit d011e6c286
5 changed files with 87 additions and 79 deletions

View File

@ -1,7 +1,11 @@
<template> <template>
<div class="directories_containter"> <div class="directories_containter">
<div class="directory_container" v-for="(directory, index) in directories" :key="index" <div
@click="view_link(directory)"> class="directory_container"
v-for="(directory, index) in directories"
:key="index"
@click="view_link(directory)"
>
<p>{{ directory.title_text }}</p> <p>{{ directory.title_text }}</p>
<img class="directory_cover_image" :src="directory.cover_picture" /> <img class="directory_cover_image" :src="directory.cover_picture" />
<p>{{ directory.summary_text }}</p> <p>{{ directory.summary_text }}</p>
@ -13,8 +17,7 @@ export default {
name: 'LabHome', name: 'LabHome',
components: {}, components: {},
computed: {}, computed: {},
mounted() { mounted() {},
},
methods: { methods: {
view_link(directory) { view_link(directory) {
this.mnx_navToLink(directory.path) this.mnx_navToLink(directory.path)
@ -24,11 +27,11 @@ export default {
return { return {
directories: [ directories: [
{ {
"path":"machine-translation", path: 'machine-translation',
"title_text": "Machine Translation", title_text: 'Machine Translation',
"summary_text": "Translate lanuages leverage AI power", summary_text: 'Translate lanuages leverage AI power',
"icon_picture":"", icon_picture: '',
"cover_picture":"" cover_picture: 'src/assets/images/lab-translation.png'
} }
] ]
} }
@ -50,4 +53,3 @@ export default {
height: 20vh; height: 20vh;
} }
</style> </style>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="input_containter"> <div class="input_containter">
<input type="text" v-model="input_text" @keyup.enter="translate($event)"> <input class="input_text" type="text" v-model="input_text" @keyup.enter="translate($event)" />
<p>{{ translated_text }}</p> <p class="translated_text">{{ translated_text }}</p>
</div> </div>
</template> </template>
<script> <script>
@ -10,8 +10,7 @@ export default {
name: 'TranslationHome', name: 'TranslationHome',
components: {}, components: {},
computed: {}, computed: {},
mounted() { mounted() {},
},
methods: { methods: {
translate($event) { translate($event) {
LabApi.translate_text(this.input_text) LabApi.translate_text(this.input_text)
@ -29,12 +28,18 @@ export default {
translated_text: null translated_text: null
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.input_containter { .input_containter {
@extend .container; @extend .container;
@extend .m-3;
}
.input_text {
@extend .w-100;
}
.translated_text {
@extend .w-100;
} }
</style> </style>

View File

@ -383,8 +383,7 @@ const router = createRouter({
path: '/lab-home', path: '/lab-home',
meta: { requiredRoles: [userRoleEnum.PERSONAL] }, meta: { requiredRoles: [userRoleEnum.PERSONAL] },
components: { default: LabHome, footer: FooterUser, header: HeaderUser } components: { default: LabHome, footer: FooterUser, header: HeaderUser }
} },
,
{ {
name: 'machine-translation', name: 'machine-translation',
path: '/machine-translation', path: '/machine-translation',

View File

@ -3,13 +3,15 @@ import { userUtils } from '../store/index'
class LabApi { class LabApi {
static translate_text(input_text) { static translate_text(input_text) {
let jwt = userUtils.getJwtToken() let jwt = userUtils.getJwtToken()
const request = backendAxios.post('/api/lab/translate_text', const request = backendAxios.post(
'/api/lab/translate_text',
{ {
input_text: input_text input_text: input_text
}, },
{ {
headers: { Authorization: `Bearer ${jwt}` } headers: { Authorization: `Bearer ${jwt}` }
}) }
)
return request return request
} }
} }