This commit is contained in:
2026-03-31 12:28:51 +08:00
parent df29bbbfd9
commit 654724a213
2561 changed files with 108 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
<script setup lang="ts">
import HeardMain from './components/HeardMain.vue';
import FooterMain from './components/FooterMain.vue';
</script>
<template>
<div class="page">
<HeardMain />
<RouterView />
<FooterMain />
</div>
</template>
<style scoped></style>
+1
View File
@@ -0,0 +1 @@
/* color palette from <https://github.com/vuejs/theme> */
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>

After

Width:  |  Height:  |  Size: 276 B

+3
View File
@@ -0,0 +1,3 @@
html, body, #app {
height: 100%;
}
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-user"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0" /><path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2" /></svg>

After

Width:  |  Height:  |  Size: 401 B

@@ -0,0 +1,70 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
</script>
<template>
<footer class="footer footer-transparent d-print-none">
<div class="container-xl">
<div class="row text-center align-items-center flex-row-reverse">
<div class="col-lg-auto ms-lg-auto">
<ul class="list-inline list-inline-dots mb-0">
<li class="list-inline-item">
<a
href="https://git.lmve.net/kevin/ops2/-/blob/main/readme.md?ref_type=heads"
target="_blank"
class="link-secondary"
rel="noopener"
>{{t('footer.doc')}}</a
>
</li>
<li class="list-inline-item">
<a
href="https://git.lmve.net/kevin/ops2/-/blob/main/LICENSE?ref_type=heads"
target="_blank"
class="link-secondary"
>{{t('footer.license')}}</a
>
</li>
<li class="list-inline-item">
<a
href="https://git.lmve.net/kevin/ops2"
target="_blank"
class="link-secondary"
rel="noopener"
>{{t('footer.source_code')}}</a
>
</li>
<li class="list-inline-item">
<a
href="https://github.com/wuwenfengmi1998"
target="_blank"
class="link-secondary"
rel="noopener"
>
kevin
</a>
</li>
</ul>
</div>
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
<ul class="list-inline list-inline-dots mb-0">
<li class="list-inline-item">
{{ t('footer.copy')}}
</li>
<li class="list-inline-item">
<a
href="https://git.lmve.net/kevin/ops2/-/commits/main"
target="_blank"
class="link-secondary"
rel="noopener"
>
v0.0.1
</a>
</li>
</ul>
</div>
</div>
</div>
</footer>
</template>
@@ -0,0 +1,234 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { myfuncs } from '@/myfunc.ts'
import { onMounted, ref } from 'vue'
// 使用 vue-i18n 的 Composition API
const { t, locale } = useI18n()
const theTeme = ref('light')
const lang_sele = ref(null)
const isLogin = false
function set_them(temp: string) {
theTeme.value = temp
myfuncs.setTheme(temp, true)
}
function changeLanguage(lang: Event) {
// 切换语言
const selectElement = lang.target as HTMLSelectElement
const selectedLang = selectElement.value
locale.value = selectedLang
myfuncs.save('userLanguage', selectedLang)
//console.log("selectedLang:",selectedLang);
}
onMounted(() => {
const savedTheme = myfuncs.getThemefromStorge()
theTeme.value = savedTheme
myfuncs.setTheme(savedTheme, false)
const userLang = myfuncs.load('userLanguage')
if (userLang) {
locale.value = userLang
if (lang_sele.value) {
;(lang_sele.value as HTMLSelectElement).value = userLang
}
}
})
</script>
<template>
<header class="navbar navbar-expand-md d-print-none">
<div class="container-xl">
<!-- BEGIN NAVBAR TOGGLER -->
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbar-menu"
aria-controls="navbar-menu"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<!-- END NAVBAR TOGGLER -->
<!-- BEGIN NAVBAR LOGO -->
<div class="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pe-0 pe-md-3">
<router-link to="/" aria-label="Tabler">
<svg
xmlns="http://www.w3.org/2000/svg"
width="110"
height="32"
viewBox="0 0 232 68"
class="navbar-brand-image"
>
<path
d="M64.6 16.2C63 9.9 58.1 5 51.8 3.4 40 1.5 28 1.5 16.2 3.4 9.9 5 5 9.9 3.4 16.2 1.5 28 1.5 40 3.4 51.8 5 58.1 9.9 63 16.2 64.6c11.8 1.9 23.8 1.9 35.6 0C58.1 63 63 58.1 64.6 51.8c1.9-11.8 1.9-23.8 0-35.6zM33.3 36.3c-2.8 4.4-6.6 8.2-11.1 11-1.5.9-3.3.9-4.8.1s-2.4-2.3-2.5-4c0-1.7.9-3.3 2.4-4.1 2.3-1.4 4.4-3.2 6.1-5.3-1.8-2.1-3.8-3.8-6.1-5.3-2.3-1.3-3-4.2-1.7-6.4s4.3-2.9 6.5-1.6c4.5 2.8 8.2 6.5 11.1 10.9 1 1.4 1 3.3.1 4.7zM49.2 46H37.8c-2.1 0-3.8-1-3.8-3s1.7-3 3.8-3h11.4c2.1 0 3.8 1 3.8 3s-1.7 3-3.8 3z"
fill="#066fd1"
style="fill: var(--tblr-primary, #066fd1)"
/>
<path
d="M105.8 46.1c.4 0 .9.2 1.2.6s.6 1 .6 1.7c0 .9-.5 1.6-1.4 2.2s-2 .9-3.2.9c-2 0-3.7-.4-5-1.3s-2-2.6-2-5.4V31.6h-2.2c-.8 0-1.4-.3-1.9-.8s-.9-1.1-.9-1.9c0-.7.3-1.4.8-1.8s1.2-.7 1.9-.7h2.2v-3.1c0-.8.3-1.5.8-2.1s1.3-.8 2.1-.8 1.5.3 2 .8.8 1.3.8 2.1v3.1h3.4c.8 0 1.4.3 1.9.8s.8 1.2.8 1.9-.3 1.4-.8 1.8-1.2.7-1.9.7h-3.4v13c0 .7.2 1.2.5 1.5s.8.5 1.4.5c.3 0 .6-.1 1.1-.2.5-.2.8-.3 1.2-.3zm28-20.7c.8 0 1.5.3 2.1.8.5.5.8 1.2.8 2.1v20.3c0 .8-.3 1.5-.8 2.1-.5.6-1.2.8-2.1.8s-1.5-.3-2-.8-.8-1.2-.8-2.1c-.8.9-1.9 1.7-3.2 2.4-1.3.7-2.8 1-4.3 1-2.2 0-4.2-.6-6-1.7-1.8-1.1-3.2-2.7-4.2-4.7s-1.6-4.3-1.6-6.9c0-2.6.5-4.9 1.5-6.9s2.4-3.6 4.2-4.8c1.8-1.1 3.7-1.7 5.9-1.7 1.5 0 3 .3 4.3.8 1.3.6 2.5 1.3 3.4 2.1 0-.8.3-1.5.8-2.1.5-.5 1.2-.7 2-.7zm-9.7 21.3c2.1 0 3.8-.8 5.1-2.3s2-3.4 2-5.7-.7-4.2-2-5.8c-1.3-1.5-3-2.3-5.1-2.3-2 0-3.7.8-5 2.3-1.3 1.5-2 3.5-2 5.8s.6 4.2 1.9 5.7 3 2.3 5.1 2.3zm32.1-21.3c2.2 0 4.2.6 6 1.7 1.8 1.1 3.2 2.7 4.2 4.7s1.6 4.3 1.6 6.9-.5 4.9-1.5 6.9-2.4 3.6-4.2 4.8c-1.8 1.1-3.7 1.7-5.9 1.7-1.5 0-3-.3-4.3-.9s-2.5-1.4-3.4-2.3v.3c0 .8-.3 1.5-.8 2.1-.5.6-1.2.8-2.1.8s-1.5-.3-2.1-.8c-.5-.5-.8-1.2-.8-2.1V18.9c0-.8.3-1.5.8-2.1.5-.6 1.2-.8 2.1-.8s1.5.3 2.1.8c.5.6.8 1.3.8 2.1v10c.8-1 1.8-1.8 3.2-2.5 1.3-.7 2.8-1 4.3-1zm-.7 21.3c2 0 3.7-.8 5-2.3s2-3.5 2-5.8-.6-4.2-1.9-5.7-3-2.3-5.1-2.3-3.8.8-5.1 2.3-2 3.4-2 5.7.7 4.2 2 5.8c1.3 1.6 3 2.3 5.1 2.3zm23.6 1.9c0 .8-.3 1.5-.8 2.1s-1.3.8-2.1.8-1.5-.3-2-.8-.8-1.3-.8-2.1V18.9c0-.8.3-1.5.8-2.1s1.3-.8 2.1-.8 1.5.3 2 .8.8 1.3.8 2.1v29.7zm29.3-10.5c0 .8-.3 1.4-.9 1.9-.6.5-1.2.7-2 .7h-15.8c.4 1.9 1.3 3.4 2.6 4.4 1.4 1.1 2.9 1.6 4.7 1.6 1.3 0 2.3-.1 3.1-.4.7-.2 1.3-.5 1.8-.8.4-.3.7-.5.9-.6.6-.3 1.1-.4 1.6-.4.7 0 1.2.2 1.7.7s.7 1 .7 1.7c0 .9-.4 1.6-1.3 2.4-.9.7-2.1 1.4-3.6 1.9s-3 .8-4.6.8c-2.7 0-5-.6-7-1.7s-3.5-2.7-4.6-4.6-1.6-4.2-1.6-6.6c0-2.8.6-5.2 1.7-7.2s2.7-3.7 4.6-4.8 3.9-1.7 6-1.7 4.1.6 6 1.7 3.4 2.7 4.5 4.7c.9 1.9 1.5 4.1 1.5 6.3zm-12.2-7.5c-3.7 0-5.9 1.7-6.6 5.2h12.6v-.3c-.1-1.3-.8-2.5-2-3.5s-2.5-1.4-4-1.4zm30.3-5.2c1 0 1.8.3 2.4.8.7.5 1 1.2 1 1.9 0 1-.3 1.7-.8 2.2-.5.5-1.1.8-1.8.7-.5 0-1-.1-1.6-.3-.2-.1-.4-.1-.6-.2-.4-.1-.7-.1-1.1-.1-.8 0-1.6.3-2.4.8s-1.4 1.3-1.9 2.3-.7 2.3-.7 3.7v11.4c0 .8-.3 1.5-.8 2.1-.5.6-1.2.8-2.1.8s-1.5-.3-2.1-.8c-.5-.6-.8-1.3-.8-2.1V28.8c0-.8.3-1.5.8-2.1.5-.6 1.2-.8 2.1-.8s1.5.3 2.1.8c.5.6.8 1.3.8 2.1v.6c.7-1.3 1.8-2.3 3.2-3 1.3-.7 2.8-1 4.3-1z"
fill-rule="evenodd"
clip-rule="evenodd"
fill="#4a4a4a"
/>
</svg>
</router-link>
</div>
<!-- END NAVBAR LOGO -->
<div class="navbar-nav flex-row order-md-last">
<div class="nav-item">
<a
@click="set_them('dark')"
class="nav-link px-0"
:class="{ 'd-none': theTeme === 'dark' }"
:title="t('message.dark_mode')"
>
<!-- Download SVG icon from http://tabler.io/icons/icon/moon -->
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="icon icon-1"
>
<path
d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z"
/>
</svg>
</a>
<a
@click="set_them('light')"
class="nav-link px-0"
:class="{ 'd-none': theTeme === 'light' }"
:title="t('message.light_mode')"
>
<!-- Download SVG icon from http://tabler.io/icons/icon/sun -->
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="icon icon-1"
>
<path d="M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" />
<path
d="M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7"
/>
</svg>
</a>
</div>
<!-- 这里判断是否已经登陆 是则显示用户信息 否则显示登陆按钮 -->
<div v-if="!isLogin" class="nav-item">
<router-link to="login" class="btn btn-outline-primary" >
<svg
xmlns="http://www.w3.org/2000/svg"
class="icon"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0"></path>
<path d="M6 21v-2a4 4 0 0 1 4 -4h4"></path>
<path d="M19 22v-6"></path>
<path d="M22 19l-3 -3l-3 3"></path>
</svg>
{{ t('message.login_or_register') }}
</router-link>
</div>
<div v-if="isLogin" class="nav-item dropdown">
<a
href="#"
class="nav-link d-flex lh-1 p-0 px-2"
data-bs-toggle="dropdown"
aria-label="Open user menu"
>
<span class="avatar avatar-sm" style="background-image: url(./static/avatars/000m.jpg)">
</span>
<div class="d-none d-xl-block ps-2">
<div>Paweł Kuna</div>
<div class="mt-1 small text-secondary">UI Designer</div>
</div>
</a>
<div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
<a href="#" class="dropdown-item">Status</a>
<a href="./profile.html" class="dropdown-item">Profile</a>
<a href="#" class="dropdown-item">Feedback</a>
<div class="dropdown-divider"></div>
<a href="./settings.html" class="dropdown-item">Settings</a>
<a href="./sign-in.html" class="dropdown-item">Logout</a>
</div>
</div>
</div>
</div>
</header>
<header class="navbar-expand-md">
<div class="collapse navbar-collapse" id="navbar-menu">
<div class="navbar">
<div class="container-xl">
<div class="row flex-column flex-md-row flex-fill align-items-center">
<div class="col d-flex">
<!-- BEGIN NAVBAR MENU -->
<ul class="navbar-nav">
<li class="nav-item active">
<router-link to="/" class="nav-link">
<span class="nav-link-icon d-md-none d-lg-inline-block"
><!-- Download SVG icon from http://tabler.io/icons/icon/home -->
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="icon icon-1"
>
<path d="M5 12l-2 0l9 -9l9 9l-2 0" />
<path d="M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7" />
<path d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6" /></svg
></span>
<span class="nav-link-title"> {{ t('appname.home') }} </span>
</router-link>
</li>
</ul>
<div class="ms-auto">
<select class="form-select" @change="changeLanguage" ref="lang_sele">
<option value="en">English</option>
<option value="zh-CN">中文</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
</template>
<style scoped></style>
@@ -0,0 +1,7 @@
<script setup lang="ts"></script>
<template>
<div></div>
</template>
<style scoped></style>
@@ -0,0 +1,172 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { Offcanvas } from 'bootstrap'
const offcanvasTop = ref(null)
let ov: Offcanvas
const alertType=ref() // 可选值:'success', 'warning', 'danger', 'info'
const alertText=ref()
let autoCloseTimeout:number
onMounted(() => {
// 确保在组件挂载后初始化
if (offcanvasTop.value) {
ov = new Offcanvas(offcanvasTop.value,{
backdrop: false,
})
//ov.show();
//console.log('Offcanvas initialized:', ov)
}
})
function showAlert(type: string, text: string,timeout:number=5000) {
alertText.value = text;
alertType.value = type;
//console.log(ov);
if (ov) {
ov.hide();
ov.show();
if(autoCloseTimeout)
{
clearTimeout(autoCloseTimeout);
}
autoCloseTimeout=setTimeout(() => {
//console.log("timeout");
ov.hide();
}, timeout);
}
}
defineExpose({
showAlert
});
</script>
<style scoped>
.my_offcanvas_top {
position: fixed;
height: 45px;
top: 0;
right: 0;
left: 0;
margin-left: 20px;
margin-right: 20px;
margin-top: 20px;
max-height: 100%;
transform: translateY(-100%);
}
</style>
<template>
<div
class="offcanvas alert alert-important alert-dismissible my_offcanvas_top"
:class="{
'alert-success': alertType === 'success',
'alert-warning': alertType === 'warning',
'alert-danger': alertType === 'danger',
'alert-info': alertType === 'info',
}"
role="alert"
tabindex="-1"
ref="offcanvasTop"
>
<div class="d-flex">
<div>
<!-- Download SVG icon from http://tabler-icons.io/i/check -->
<svg
v-if="alertType === 'success'"
xmlns="http://www.w3.org/2000/svg"
class="icon alert-icon"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M5 12l5 5l10 -10"></path>
</svg>
<svg
v-if="alertType === 'warning'"
xmlns="http://www.w3.org/2000/svg"
class="icon alert-icon"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path
d="M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z"
></path>
<path d="M12 9v4"></path>
<path d="M12 17h.01"></path>
</svg>
<svg
v-if="alertType === 'danger'"
xmlns="http://www.w3.org/2000/svg"
class="icon alert-icon"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"></path>
<path d="M12 8v4"></path>
<path d="M12 16h.01"></path>
</svg>
<svg
v-if="alertType === 'info'"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="icon icon-tabler icons-tabler-outline icon-tabler-brand-hipchat"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path
d="M17.802 17.292s.077 -.055 .2 -.149c1.843 -1.425 3 -3.49 3 -5.789c0 -4.286 -4.03 -7.764 -9 -7.764c-4.97 0 -9 3.478 -9 7.764c0 4.288 4.03 7.646 9 7.646c.424 0 1.12 -.028 2.088 -.084c1.262 .82 3.104 1.493 4.716 1.493c.499 0 .734 -.41 .414 -.828c-.486 -.596 -1.156 -1.551 -1.416 -2.29z"
/>
<path d="M7.5 13.5c2.5 2.5 6.5 2.5 9 0" />
</svg>
</div>
<div>
{{ alertText }}
</div>
</div>
<a class="btn-close" data-bs-dismiss="offcanvas" aria-label="close"></a>
</div>
<!-- <div>
<button @click="showAlert('success','success')">success</button>
<button @click="showAlert('warning','warning')">warning</button>
<button @click="showAlert('danger','danger')">danger</button>
<button @click="showAlert('info','info')">info</button>
</div> -->
</template>
@@ -0,0 +1,5 @@
<script setup lang="ts"></script>
<template>
<div></div>
</template>
@@ -0,0 +1,5 @@
<template>
<div></div>
</template>
<style scoped></style>
@@ -0,0 +1,11 @@
import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import HelloWorld from '../HelloWorld.vue'
describe('HelloWorld', () => {
it('renders properly', () => {
const wrapper = mount(HelloWorld, { props: { msg: 'Hello Vitest' } })
expect(wrapper.text()).toContain('Hello Vitest')
})
})
@@ -0,0 +1,7 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor">
<path
d="M15 4a1 1 0 1 0 0 2V4zm0 11v-1a1 1 0 0 0-1 1h1zm0 4l-.707.707A1 1 0 0 0 16 19h-1zm-4-4l.707-.707A1 1 0 0 0 11 14v1zm-4.707-1.293a1 1 0 0 0-1.414 1.414l1.414-1.414zm-.707.707l-.707-.707.707.707zM9 11v-1a1 1 0 0 0-.707.293L9 11zm-4 0h1a1 1 0 0 0-1-1v1zm0 4H4a1 1 0 0 0 1.707.707L5 15zm10-9h2V4h-2v2zm2 0a1 1 0 0 1 1 1h2a3 3 0 0 0-3-3v2zm1 1v6h2V7h-2zm0 6a1 1 0 0 1-1 1v2a3 3 0 0 0 3-3h-2zm-1 1h-2v2h2v-2zm-3 1v4h2v-4h-2zm1.707 3.293l-4-4-1.414 1.414 4 4 1.414-1.414zM11 14H7v2h4v-2zm-4 0c-.276 0-.525-.111-.707-.293l-1.414 1.414C5.42 15.663 6.172 16 7 16v-2zm-.707 1.121l3.414-3.414-1.414-1.414-3.414 3.414 1.414 1.414zM9 12h4v-2H9v2zm4 0a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2zm3-3V3h-2v6h2zm0-6a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2zm-3-3H3v2h10V0zM3 0a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1V0zM0 3v6h2V3H0zm0 6a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1H0zm3 3h2v-2H3v2zm1-1v4h2v-4H4zm1.707 4.707l.586-.586-1.414-1.414-.586.586 1.414 1.414z"
/>
</svg>
</template>
@@ -0,0 +1,7 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" fill="currentColor">
<path
d="M11 2.253a1 1 0 1 0-2 0h2zm-2 13a1 1 0 1 0 2 0H9zm.447-12.167a1 1 0 1 0 1.107-1.666L9.447 3.086zM1 2.253L.447 1.42A1 1 0 0 0 0 2.253h1zm0 13H0a1 1 0 0 0 1.553.833L1 15.253zm8.447.833a1 1 0 1 0 1.107-1.666l-1.107 1.666zm0-14.666a1 1 0 1 0 1.107 1.666L9.447 1.42zM19 2.253h1a1 1 0 0 0-.447-.833L19 2.253zm0 13l-.553.833A1 1 0 0 0 20 15.253h-1zm-9.553-.833a1 1 0 1 0 1.107 1.666L9.447 14.42zM9 2.253v13h2v-13H9zm1.553-.833C9.203.523 7.42 0 5.5 0v2c1.572 0 2.961.431 3.947 1.086l1.107-1.666zM5.5 0C3.58 0 1.797.523.447 1.42l1.107 1.666C2.539 2.431 3.928 2 5.5 2V0zM0 2.253v13h2v-13H0zm1.553 13.833C2.539 15.431 3.928 15 5.5 15v-2c-1.92 0-3.703.523-5.053 1.42l1.107 1.666zM5.5 15c1.572 0 2.961.431 3.947 1.086l1.107-1.666C9.203 13.523 7.42 13 5.5 13v2zm5.053-11.914C11.539 2.431 12.928 2 14.5 2V0c-1.92 0-3.703.523-5.053 1.42l1.107 1.666zM14.5 2c1.573 0 2.961.431 3.947 1.086l1.107-1.666C18.203.523 16.421 0 14.5 0v2zm3.5.253v13h2v-13h-2zm1.553 12.167C18.203 13.523 16.421 13 14.5 13v2c1.573 0 2.961.431 3.947 1.086l1.107-1.666zM14.5 13c-1.92 0-3.703.523-5.053 1.42l1.107 1.666C11.539 15.431 12.928 15 14.5 15v-2z"
/>
</svg>
</template>
@@ -0,0 +1,7 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="20" fill="currentColor">
<path
d="M11.447 8.894a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm0 1.789a1 1 0 1 0 .894-1.789l-.894 1.789zM7.447 7.106a1 1 0 1 0-.894 1.789l.894-1.789zM10 9a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0H8zm9.447-5.606a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm2 .789a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zM18 5a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0h-2zm-5.447-4.606a1 1 0 1 0 .894-1.789l-.894 1.789zM9 1l.447-.894a1 1 0 0 0-.894 0L9 1zm-2.447.106a1 1 0 1 0 .894 1.789l-.894-1.789zm-6 3a1 1 0 1 0 .894 1.789L.553 4.106zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zm-2-.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 2.789a1 1 0 1 0 .894-1.789l-.894 1.789zM2 5a1 1 0 1 0-2 0h2zM0 7.5a1 1 0 1 0 2 0H0zm8.553 12.394a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 1a1 1 0 1 0 .894 1.789l-.894-1.789zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zM8 19a1 1 0 1 0 2 0H8zm2-2.5a1 1 0 1 0-2 0h2zm-7.447.394a1 1 0 1 0 .894-1.789l-.894 1.789zM1 15H0a1 1 0 0 0 .553.894L1 15zm1-2.5a1 1 0 1 0-2 0h2zm12.553 2.606a1 1 0 1 0 .894 1.789l-.894-1.789zM17 15l.447.894A1 1 0 0 0 18 15h-1zm1-2.5a1 1 0 1 0-2 0h2zm-7.447-5.394l-2 1 .894 1.789 2-1-.894-1.789zm-1.106 1l-2-1-.894 1.789 2 1 .894-1.789zM8 9v2.5h2V9H8zm8.553-4.894l-2 1 .894 1.789 2-1-.894-1.789zm.894 0l-2-1-.894 1.789 2 1 .894-1.789zM16 5v2.5h2V5h-2zm-4.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zm-2.894-1l-2 1 .894 1.789 2-1L8.553.106zM1.447 5.894l2-1-.894-1.789-2 1 .894 1.789zm-.894 0l2 1 .894-1.789-2-1-.894 1.789zM0 5v2.5h2V5H0zm9.447 13.106l-2-1-.894 1.789 2 1 .894-1.789zm0 1.789l2-1-.894-1.789-2 1 .894 1.789zM10 19v-2.5H8V19h2zm-6.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zM2 15v-2.5H0V15h2zm13.447 1.894l2-1-.894-1.789-2 1 .894 1.789zM18 15v-2.5h-2V15h2z"
/>
</svg>
</template>
@@ -0,0 +1,7 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor">
<path
d="M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.666.105 5.5 5.5 0 0 0-.114 7.665L10 18.78l8.39-8.4a5.5 5.5 0 0 0-.114-7.665 5.5 5.5 0 0 0-7.666-.105l-.61.61z"
/>
</svg>
</template>
@@ -0,0 +1,19 @@
<!-- This icon is from <https://github.com/Templarian/MaterialDesign>, distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license-->
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true"
role="img"
class="iconify iconify--mdi"
width="24"
height="24"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 24 24"
>
<path
d="M20 18v-4h-3v1h-2v-1H9v1H7v-1H4v4h16M6.33 8l-1.74 4H7v-1h2v1h6v-1h2v1h2.41l-1.74-4H6.33M9 5v1h6V5H9m12.84 7.61c.1.22.16.48.16.8V18c0 .53-.21 1-.6 1.41c-.4.4-.85.59-1.4.59H4c-.55 0-1-.19-1.4-.59C2.21 19 2 18.53 2 18v-4.59c0-.32.06-.58.16-.8L4.5 7.22C4.84 6.41 5.45 6 6.33 6H7V5c0-.55.18-1 .57-1.41C7.96 3.2 8.44 3 9 3h6c.56 0 1.04.2 1.43.59c.39.41.57.86.57 1.41v1h.67c.88 0 1.49.41 1.83 1.22l2.34 5.39z"
fill="currentColor"
></path>
</svg>
</template>
+48
View File
@@ -0,0 +1,48 @@
{
"appname": {
"home": "Home",
"login": "Login",
"forgot_password":"Forgot Password",
"register":"Register"
},
"message": {
"hello": "Hello",
"welcome": "Welcome",
"dark_mode":"Enable dark mode",
"light_mode":"Enable light mode",
"login_or_register":"Login/Register",
"login_to_your_account":"Login to your account",
"your_email_address":"Your email address",
"email_address":"Email address",
"user_name":"User name",
"your_user_name":"Your user name",
"password":"Password",
"your_password":"Your password",
"i_forgot_password":"I forgot my password",
"remember_me_on_this_device":"Remember me on this device",
"dont_have_account_yet":"Don't have an account yet?",
"register_now":"Register now",
"show_password":"Show password",
"hidden_Password":"Hidden Password",
"please_enter_username_and_password":"Please enter username and password",
"forgot_password":"Forgot Password",
"enter_your_email_to_reset_password":"Enter your email address and your password will be reset and emailed to you.",
"back_to_login":"Back to login",
"please_enter_your_email":"Please enter your email",
"this_not_email":"This is not an email address.",
"create_new_account":"Create new account",
"already_have_an_account":"Already have an account?"
},
"button": {
"submit": "Submit",
"cancel": "Cancel",
"sign_in":"Sign In",
"send_me_new_password":"Send me new password"
},
"footer":{
"doc":"Documentation",
"license":"License",
"source_code":"Source Code",
"copy":"Copyright © 2025 Operations. All rights reserved."
}
}
+48
View File
@@ -0,0 +1,48 @@
{
"appname": {
"home": "主页",
"login": "登录",
"forgot_password": "忘记密码",
"register": "注册"
},
"message": {
"hello": "你好",
"welcome": "欢迎",
"dark_mode": "深色模式",
"light_mode": "亮色模式",
"login_or_register": "登录/注册",
"login_to_your_account": "登录到您的账户",
"your_email_address": "您的邮箱地址",
"email_address": "邮箱地址",
"user_name": "用户名",
"your_user_name": "您的用户名",
"password": "密码",
"your_password": "您的密码",
"i_forgot_password": "我忘记了密码",
"remember_me_on_this_device": "记住我在这台设备上",
"dont_have_account_yet": "还没有账户?",
"register_now": "立即注册",
"show_password": "显示密码",
"hidden_Password": "隐藏密码",
"please_enter_username_and_password": "请输入用户名和密码",
"forgot_password": "忘记密码",
"enter_your_email_to_reset_password": "输入您的邮箱地址,您的密码将被重置并通过邮件发送给您。",
"back_to_login": "返回登录",
"please_enter_your_email": "请输入您的邮箱",
"this_not_email": "这不是一个有效的邮箱地址。",
"create_new_account":"创建新账户",
"already_have_an_account":"已经有账户了?"
},
"button": {
"submit": "提交",
"cancel": "取消",
"sign_in": "登录",
"send_me_new_password": "发送新密码"
},
"footer": {
"doc": "文档",
"license": "协议",
"source_code": "源码",
"copy": "版权 © 2025 Operations. 保留所有权利。"
}
}
+46
View File
@@ -0,0 +1,46 @@
import './assets/main.css'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createI18n } from 'vue-i18n'
import App from './App.vue'
import router from './router'
import '@tabler/core/dist/css/tabler.min.css'
import '@tabler/core/dist/css/tabler-vendors.min.css'
import '@tabler/core/dist/js/tabler.min.js'
// import 'bootstrap/dist/css/bootstrap.min.css'
// import 'bootstrap/dist/js/bootstrap.bundle.min.js'
const app = createApp(App)
// 添加全局变量
app.config.globalProperties.$appName = 'My Vue App'
app.config.globalProperties.$apiUrl = 'https://api.example.com'
app.config.globalProperties.$currentUser = {
name: 'John Doe',
role: 'admin'
}
import en from './i18n/en.json'
import zhCN from './i18n/zh-CN.json'
const i18n = createI18n({
legacy: false, // 使用 Composition API 模式
locale: 'en',
fallbackLocale: 'en',
messages: {
en,
'zh-CN': zhCN
}
})
app.use(createPinia())
app.use(router)
app.use(i18n)
app.mount('#app')
+40
View File
@@ -0,0 +1,40 @@
import axios from 'axios'
import { myfuncs } from './myfunc'
interface re_data {
statusCode: number
cookie?: string
error?: string
data?: JSON
}
export const my_network_func = {
post_json(path: string, json: JSON, callback: (i: re_data) => void) {
const head_path = '/api/v1'
const url = head_path + path
const cookie = myfuncs.load('cookie') || ''
const data = {
data: json,
cookie: cookie,
}
axios
.post(url, data, {
headers: {
'Content-Type': 'application/json',
},
})
.then((response) => {
const re: re_data = {
statusCode: response.status,
data: response.data,
}
callback(re)
//console.log(response)
})
.catch((error) => {
console.error('There was an error!', error)
})
},
}
+57
View File
@@ -0,0 +1,57 @@
export const myfuncs = {
themeStorageKey:"tablerTheme",
defaultTheme:"light",
test(){
console.log("myfuncs test ok");
},
save(key:string,data:string){
localStorage.setItem(key, data)
},
load(key:string){
return localStorage.getItem(key)
},
dele(key:string){
localStorage.removeItem(key)
},
save_json(key:string,data:JSON){
this.save(key,JSON.stringify(data))
},
load_json(key:string){
const js_data=this.load(key)
if(js_data){
return JSON.parse(js_data)
}else{
return null
}
},
getThemefromStorge() {
const storedTheme = this.load(this.themeStorageKey);
return storedTheme ? storedTheme : this.defaultTheme;
},
setTheme(selectedTheme:string,save:boolean) {
if(save){
this.save(this.themeStorageKey, selectedTheme); // 保存到本地存储
}
if (selectedTheme === 'dark') {
document.body.setAttribute("data-bs-theme", selectedTheme); // 暗色模式
} else {
document.body.removeAttribute("data-bs-theme"); // 亮色模式(移除属性)
}
},
isValidEmail(email:string) {
// 定义邮箱的正则表达式
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
// 使用正则表达式测试邮箱
return emailRegex.test(email);
}
}
+19
View File
@@ -0,0 +1,19 @@
export const mytablercon = {
set_bs_theme(color: string){
switch(color){
case "dark":
document.body.setAttribute("data-bs-theme", "dark"); // 暗色模式
break;
case "light":
document.body.setAttribute("data-bs-theme", "light"); // 亮色模式
break;
default:
document.body.removeAttribute("data-bs-theme"); // 跟随系统
}
},
}
+38
View File
@@ -0,0 +1,38 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomeView,
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/AboutView.vue'),
},
{
path: '/login',
name: 'login',
component: () => import('../views/loginView.vue'),
},
{
path: '/forgot_password',
name: 'forgot password',
component: () => import('../views/forgotPassword.vue'),
},
{
path: '/register',
name: 'Register',
component: () => import('../views/registerView.vue'),
},
],
})
export default router
+12
View File
@@ -0,0 +1,12 @@
import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
export const useCounterStore = defineStore('counter', () => {
const count = ref(0)
const doubleCount = computed(() => count.value * 2)
function increment() {
count.value++
}
return { count, doubleCount, increment }
})
+7
View File
@@ -0,0 +1,7 @@
<template>
<div>
<h1><p>{{ $t('message.hello') }}</p></h1>
</div>
</template>
<style></style>
+43
View File
@@ -0,0 +1,43 @@
<script setup lang="ts">
import MyOffcanvas from '@/components/MyOffcanvas.vue'
import { onMounted, ref } from 'vue'
//import { my_network_func } from '@/my_network_func'
const mos = ref<InstanceType<typeof MyOffcanvas> | null>(null)
onMounted(() => {
// 可以在这里调用mos.value的方法
//console.log('HomeView mounted', mos);
document.title = 'Operations.'
})
function c() {
mos.value?.showAlert('success', '111', 1000)
}
function d() {
interface User {
id: number
name: string
}
const Users: Partial<User> = {}
Users.id = 2
Users.name = 'Bob'
const jsonData = ref<User[]>([])
jsonData.value = [{ id: 1, name: 'Alice' }]
console.log('Users:', Users)
//my_network_func.post_json('/1',jsonData.value[0],()=>{})
}
</script>
<template>
<div>
<MyOffcanvas ref="mos" />
<button @click="c">test1</button>
<button @click="d">test2</button>
</div>
</template>
@@ -0,0 +1,97 @@
<script setup lang="ts">
import { onMounted, watch, ref } from 'vue'
import MyOffcanvas from '@/components/MyOffcanvas.vue'
import { myfuncs } from '@/myfunc.ts'
import { useI18n } from 'vue-i18n'
// 使用 vue-i18n 的 Composition API
const { t, locale } = useI18n()
const email = ref<HTMLInputElement | null>(null)
const mos = ref<InstanceType<typeof MyOffcanvas> | null>(null)
function resetPassword() {
// 在这里处理重置密码逻辑
const emailValue = email.value?.value
if (emailValue === undefined || emailValue.trim() === '') {
mos.value?.showAlert('info', t('message.please_enter_your_email'), 5000)
return
}
if (!myfuncs.isValidEmail(emailValue)) {
mos.value?.showAlert('warning', t('message.this_not_email'), 5000)
return
}
console.log('sending password reset to:', emailValue)
}
function functionupdataTitle() {
document.title = 'Operations.' + t('appname.forgot_password')
}
onMounted(() => {
functionupdataTitle()
})
// 监听语言变化,更新标题
watch(locale, () => {
functionupdataTitle()
})
</script>
<template>
<div class="container container-tight py-4">
<div class="text-center mb-4">
<a href="." class="navbar-brand navbar-brand-autodark">
<img
src="/static/logo.svg"
width="110"
height="32"
alt="Tabler"
class="navbar-brand-image"
/>
</a>
</div>
<div class="card card-md">
<div class="card-body">
<h2 class="card-title text-center mb-4">{{ t('message.forgot_password') }}</h2>
<p class="text-secondary mb-4">
{{ t('message.enter_your_email_to_reset_password') }}
</p>
<div class="mb-3">
<label class="form-label">{{ t('message.email_address') }}</label>
<input
ref="email"
type="email"
class="form-control"
:placeholder="t('message.your_email_address')"
/>
</div>
<div class="form-footer">
<button @click="resetPassword" class="btn btn-primary w-100">
<!-- Download SVG icon from http://tabler-icons.io/i/mail -->
<svg
xmlns="http://www.w3.org/2000/svg"
class="icon"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path
d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"
/>
<path d="M3 7l9 6l9 -6" />
</svg>
{{ t('button.send_me_new_password') }}
</button>
</div>
</div>
</div>
<div class="text-center text-secondary mt-3">
<router-link to="/login">{{ t('message.back_to_login') }}</router-link>
</div>
</div>
<MyOffcanvas ref="mos" />
</template>
+181
View File
@@ -0,0 +1,181 @@
<script setup lang="ts">
import { onMounted, watch, ref } from 'vue'
import MyOffcanvas from '@/components/MyOffcanvas.vue'
import { useI18n } from 'vue-i18n'
// 使用 vue-i18n 的 Composition API
const { t, locale } = useI18n()
const mos = ref<InstanceType<typeof MyOffcanvas> | null>(null)
const isShowPassword = ref(false)
const username = ref<HTMLInputElement | null>(null)
const password = ref<HTMLInputElement | null>(null)
const isRemember = ref<HTMLInputElement | null>(null)
function togglePasswordVisibility() {
isShowPassword.value = !isShowPassword.value
}
function login() {
// 在这里处理登录逻辑
const user = username.value?.value
const pass = password.value?.value
const remember = isRemember.value?.checked
username.value?.classList.remove('is-invalid')
password.value?.classList.remove('is-invalid')
if (!user || !pass) {
if (!user) {
username.value?.classList.add('is-invalid')
}
if (!pass) {
password.value?.classList.add('is-invalid')
}
mos.value?.showAlert('info', t('message.please_enter_username_and_password'), 5000)
return
}
console.log('登录信息:', { user, pass, remember })
}
function functionupdataTitle() {
document.title = 'Operations.' + t('appname.login')
}
onMounted(() => {
functionupdataTitle()
})
// 监听语言变化,更新标题
watch(locale, () => {
functionupdataTitle()
})
</script>
<template>
<div class="page page-center">
<div class="container container-normal py-6">
<div class="row align-items-center g-4">
<div class="col-lg">
<div class="container-tight">
<div class="card card-md">
<div class="card-body">
<h2 class="h2 text-center mb-4">{{ t('message.login_to_your_account') }}</h2>
<div class="mb-3">
<label class="form-label">{{ t('message.user_name') }}</label>
<input
ref="username"
type="text"
class="form-control"
:placeholder="t('message.your_user_name')"
autocomplete="off"
/>
</div>
<div class="mb-2">
<label class="form-label">
{{ t('message.password') }}
<span class="form-label-description">
<router-link to="/forgot_password">{{
t('message.i_forgot_password')
}}</router-link>
</span>
</label>
<div class="input-group input-group-flat">
<input
ref="password"
:type="isShowPassword ? 'text' : 'password'"
class="form-control"
:placeholder="t('message.your_password')"
autocomplete="off"
/>
<span class="input-group-text">
<div
class="link-secondary"
:title="
isShowPassword ? t('message.hidden_Password') : t('message.show_password')
"
data-bs-toggle="tooltip"
>
<!-- Download SVG icon from http://tabler-icons.io/i/eye -->
<svg
v-if="!isShowPassword"
@click="togglePasswordVisibility"
xmlns="http://www.w3.org/2000/svg"
class="icon"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
<path
d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"
/>
</svg>
<svg
v-if="isShowPassword"
@click="togglePasswordVisibility"
xmlns="http://www.w3.org/2000/svg"
class="icon"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M10.585 10.587a2 2 0 0 0 2.829 2.828" />
<path
d="M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"
/>
<path d="M3 3l18 18" />
</svg>
</div>
</span>
</div>
</div>
<div class="mb-2">
<label class="form-check">
<input ref="isRemember" type="checkbox" class="form-check-input" />
<span class="form-check-label">{{
t('message.remember_me_on_this_device')
}}</span>
</label>
</div>
<div class="form-footer">
<button @click="login" class="btn btn-primary w-100">
{{ t('button.sign_in') }}
</button>
</div>
</div>
</div>
<div class="text-center text-secondary mt-3">
{{ t('message.dont_have_account_yet') }}
<router-link to="/register">{{ t('message.register_now') }}</router-link>
</div>
</div>
</div>
<div class="col-lg d-none d-lg-block">
<img
src="/static/illustrations/undraw_secure_login_pdn4.svg"
height="300"
class="d-block mx-auto"
alt=""
/>
</div>
</div>
</div>
</div>
<MyOffcanvas ref="mos" />
</template>
+184
View File
@@ -0,0 +1,184 @@
<script setup lang="ts">
import { onMounted, watch, ref } from 'vue'
import MyOffcanvas from '@/components/MyOffcanvas.vue'
import { myfuncs } from '@/myfunc.ts'
import { useI18n } from 'vue-i18n'
// 使用 vue-i18n 的 Composition API
const { t, locale } = useI18n()
const mos = ref<InstanceType<typeof MyOffcanvas> | null>(null)
const isShowPassword = ref(false)
const username = ref<HTMLInputElement | null>(null)
const useremail = ref<HTMLInputElement | null>(null)
const userpassword = ref<HTMLInputElement | null>(null)
function functionupdataTitle() {
document.title = 'Operations.' + t('appname.register')
}
function togglePasswordVisibility() {
isShowPassword.value = !isShowPassword.value
}
function createAccount() {
// 在这里处理创建新账户的逻辑
const user = username.value?.value
const email = useremail.value?.value
const pass = userpassword.value?.value
username.value?.classList.remove('is-invalid');
useremail.value?.classList.remove('is-invalid');
userpassword.value?.classList.remove('is-invalid');
if (
!user ||
!email ||
!pass
) {
if(!user){
username.value?.classList.add('is-invalid');
}
if(!email){
useremail.value?.classList.add('is-invalid');
}
if(!pass){
userpassword.value?.classList.add('is-invalid');
}
mos.value?.showAlert('info', t('message.please_enter_username_and_password'), 5000)
return
}
if (!myfuncs.isValidEmail(email)) {
useremail.value?.classList.add('is-invalid');
mos.value?.showAlert('warning', t('message.this_not_email'), 5000)
return
}
console.log('创建新账户信息:', {
user: username.value?.value,
email: useremail.value?.value,
pass: userpassword.value?.value,
})
}
onMounted(() => {
functionupdataTitle()
})
// 监听语言变化,更新标题
watch(locale, () => {
functionupdataTitle()
})
</script>
<template>
<div class="page page-center">
<div class="container container-tight py-4">
<div class="text-center mb-4">
<a href="." class="navbar-brand navbar-brand-autodark">
<img
src="/static/logo.svg"
width="110"
height="32"
alt="Tabler"
class="navbar-brand-image"
/>
</a>
</div>
<div class="card card-md">
<div class="card-body">
<h2 class="card-title text-center mb-4">{{ t('message.create_new_account') }}</h2>
<div class="mb-3">
<label class="form-label">{{ t('message.user_name') }}</label>
<input
ref="username"
type="text"
class="form-control"
:placeholder="t('message.your_user_name')"
/>
</div>
<div class="mb-3">
<label class="form-label">{{ t('message.email_address') }}</label>
<input
ref="useremail"
type="email"
class="form-control"
:placeholder="t('message.your_email_address')"
/>
</div>
<div class="mb-3">
<label class="form-label">{{ t('message.password') }}</label>
<div class="input-group input-group-flat">
<input
ref="userpassword"
:type="isShowPassword ? 'text' : 'password'"
class="form-control"
:placeholder="t('message.your_password')"
autocomplete="off"
/>
<span class="input-group-text">
<div class="link-secondary" title="Show password" data-bs-toggle="tooltip">
<!-- Download SVG icon from http://tabler-icons.io/i/eye -->
<svg
v-if="!isShowPassword"
@click="togglePasswordVisibility"
xmlns="http://www.w3.org/2000/svg"
class="icon"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
<path
d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"
/>
</svg>
<svg
v-if="isShowPassword"
@click="togglePasswordVisibility"
xmlns="http://www.w3.org/2000/svg"
class="icon"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M10.585 10.587a2 2 0 0 0 2.829 2.828" />
<path
d="M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"
/>
<path d="M3 3l18 18" />
</svg>
</div>
</span>
</div>
</div>
<!-- <div class="mb-3">
<label class="form-check">
<input type="checkbox" class="form-check-input"/>
<span class="form-check-label">Agree the <a href="./terms-of-service.html" tabindex="-1">terms and policy</a>.</span>
</label>
</div> -->
<div class="form-footer">
<button @click="createAccount" class="btn btn-primary w-100">
{{ t('message.create_new_account') }}
</button>
</div>
</div>
</div>
<div class="text-center text-secondary mt-3">
{{ t('message.already_have_an_account') }}
<router-link to="/login">{{ t('message.back_to_login') }}</router-link>
</div>
</div>
</div>
<MyOffcanvas ref="mos" />
</template>