u
This commit is contained in:
1 parent
f431b7ead6
commit
5569fe9c4f
17 files changed
+446
-139
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html build-time="%BUILD_TIME%">
|
||||
<html build-time="BUILD_TIME">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
@@ -14,6 +14,7 @@
|
||||
'" />',
|
||||
)
|
||||
</script>
|
||||
<title>VITE_APP_TITLE</title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
</head>
|
||||
|
||||
@@ -79,8 +79,8 @@
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-mp-xhs": "3.0.0-4070620250821001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4070620250821001",
|
||||
"@iconify/utils": "^3.0.2",
|
||||
"@iconify/vue": "^5.0.0",
|
||||
"abortcontroller-polyfill": "^1.7.8",
|
||||
"dayjs": "1.11.10",
|
||||
"pinia": "2.0.36",
|
||||
"pinia-plugin-persistedstate": "3.2.1",
|
||||
|
||||
+8
-44
@@ -56,12 +56,12 @@ importers:
|
||||
'@dcloudio/uni-quickapp-webview':
|
||||
specifier: 3.0.0-4070620250821001
|
||||
version: 3.0.0-4070620250821001(postcss@8.5.6)(rollup@4.52.2)(vue@3.5.21(typescript@5.8.3))
|
||||
'@iconify/utils':
|
||||
specifier: ^3.0.2
|
||||
version: 3.0.2
|
||||
'@iconify/vue':
|
||||
specifier: ^5.0.0
|
||||
version: 5.0.0(vue@3.5.21(typescript@5.8.3))
|
||||
abortcontroller-polyfill:
|
||||
specifier: ^1.7.8
|
||||
version: 1.7.8
|
||||
dayjs:
|
||||
specifier: 1.11.10
|
||||
version: 1.11.10
|
||||
@@ -245,9 +245,6 @@ packages:
|
||||
'@antfu/utils@0.7.10':
|
||||
resolution: {integrity: sha512-+562v9k4aI80m1+VuMHehNJWLOFjBnXn3tdOitzD0il5b7smkSBal4+a3oKiQTbrwMmN/TBUMDvbdoWDehgOww==}
|
||||
|
||||
'@antfu/utils@9.2.1':
|
||||
resolution: {integrity: sha512-TMilPqXyii1AsiEii6l6ubRzbo76p6oshUSYPaKsmXDavyMLqjzVDkcp3pHp5ELMUNJHATcEOGxKTTsX9yYhGg==}
|
||||
|
||||
'@babel/code-frame@7.27.1':
|
||||
resolution: {integrity: sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
@@ -1215,9 +1212,6 @@ packages:
|
||||
'@iconify/types@2.0.0':
|
||||
resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==}
|
||||
|
||||
'@iconify/utils@3.0.2':
|
||||
resolution: {integrity: sha512-EfJS0rLfVuRuJRn4psJHtK2A9TqVnkxPpHY6lYHiB9+8eSuudsxbwMiavocG45ujOo6FJ+CIRlRnlOGinzkaGQ==}
|
||||
|
||||
'@iconify/vue@5.0.0':
|
||||
resolution: {integrity: sha512-C+KuEWIF5nSBrobFJhT//JS87OZ++QDORB6f2q2Wm6fl2mueSTpFBeBsveK0KW9hWiZ4mNiPjsh6Zs4jjdROSg==}
|
||||
peerDependencies:
|
||||
@@ -1541,28 +1535,24 @@ packages:
|
||||
engines: {node: '>= 12'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@node-rs/xxhash-linux-arm64-musl@1.7.6':
|
||||
resolution: {integrity: sha512-AB5m6crGYSllM9F/xZNOQSPImotR5lOa9e4arW99Bv82S+gcpphI8fGMDOVTTCXY/RLRhvvhwzLDxmLB2O8VDg==}
|
||||
engines: {node: '>= 12'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@node-rs/xxhash-linux-x64-gnu@1.7.6':
|
||||
resolution: {integrity: sha512-a2A6M+5tc0PVlJlE/nl0XsLEzMpKkwg7Y1lR5urFUbW9uVQnKjJYQDrUojhlXk0Uv3VnYQPa6ThmwlacZA5mvQ==}
|
||||
engines: {node: '>= 12'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@node-rs/xxhash-linux-x64-musl@1.7.6':
|
||||
resolution: {integrity: sha512-WioGJSC1GoxQpmdQrG5l/uddSBAS4XCWczHNwXe895J5xadGQzyvmr0r17BNfihvbBUDH1H9jwouNYzDDeA6+A==}
|
||||
engines: {node: '>= 12'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@node-rs/xxhash-wasm32-wasi@1.7.6':
|
||||
resolution: {integrity: sha512-WDXXKMMFMrez+esm2DzMPHFNPFYf+wQUtaXrXwtxXeQMFEzleOLwEaqV0+bbXGJTwhPouL3zY1Qo2xmIH4kkTg==}
|
||||
@@ -1660,67 +1650,56 @@ packages:
|
||||
resolution: {integrity: sha512-kDWSPafToDd8LcBYd1t5jw7bD5Ojcu12S3uT372e5HKPzQt532vW+rGFFOaiR0opxePyUkHrwz8iWYEyH1IIQA==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-arm-musleabihf@4.52.2':
|
||||
resolution: {integrity: sha512-gKm7Mk9wCv6/rkzwCiUC4KnevYhlf8ztBrDRT9g/u//1fZLapSRc+eDZj2Eu2wpJ+0RzUKgtNijnVIB4ZxyL+w==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-arm64-gnu@4.52.2':
|
||||
resolution: {integrity: sha512-66lA8vnj5mB/rtDNwPgrrKUOtCLVQypkyDa2gMfOefXK6rcZAxKLO9Fy3GkW8VkPnENv9hBkNOFfGLf6rNKGUg==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-arm64-musl@4.52.2':
|
||||
resolution: {integrity: sha512-s+OPucLNdJHvuZHuIz2WwncJ+SfWHFEmlC5nKMUgAelUeBUnlB4wt7rXWiyG4Zn07uY2Dd+SGyVa9oyLkVGOjA==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-loong64-gnu@4.52.2':
|
||||
resolution: {integrity: sha512-8wTRM3+gVMDLLDdaT6tKmOE3lJyRy9NpJUS/ZRWmLCmOPIJhVyXwjBo+XbrrwtV33Em1/eCTd5TuGJm4+DmYjw==}
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-ppc64-gnu@4.52.2':
|
||||
resolution: {integrity: sha512-6yqEfgJ1anIeuP2P/zhtfBlDpXUb80t8DpbYwXQ3bQd95JMvUaqiX+fKqYqUwZXqdJDd8xdilNtsHM2N0cFm6A==}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-riscv64-gnu@4.52.2':
|
||||
resolution: {integrity: sha512-sshYUiYVSEI2B6dp4jMncwxbrUqRdNApF2c3bhtLAU0qA8Lrri0p0NauOsTWh3yCCCDyBOjESHMExonp7Nzc0w==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-riscv64-musl@4.52.2':
|
||||
resolution: {integrity: sha512-duBLgd+3pqC4MMwBrKkFxaZerUxZcYApQVC5SdbF5/e/589GwVvlRUnyqMFbM8iUSb1BaoX/3fRL7hB9m2Pj8Q==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-s390x-gnu@4.52.2':
|
||||
resolution: {integrity: sha512-tzhYJJidDUVGMgVyE+PmxENPHlvvqm1KILjjZhB8/xHYqAGeizh3GBGf9u6WdJpZrz1aCpIIHG0LgJgH9rVjHQ==}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-x64-gnu@4.52.2':
|
||||
resolution: {integrity: sha512-opH8GSUuVcCSSyHHcl5hELrmnk4waZoVpgn/4FDao9iyE4WpQhyWJ5ryl5M3ocp4qkRuHfyXnGqg8M9oKCEKRA==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-x64-musl@4.52.2':
|
||||
resolution: {integrity: sha512-LSeBHnGli1pPKVJ79ZVJgeZWWZXkEe/5o8kcn23M8eMKCUANejchJbF/JqzM4RRjOJfNRhKJk8FuqL1GKjF5oQ==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-openharmony-arm64@4.52.2':
|
||||
resolution: {integrity: sha512-uPj7MQ6/s+/GOpolavm6BPo+6CbhbKYyZHUDvZ/SmJM7pfDBgdGisFX3bY/CBDMg2ZO4utfhlApkSfZ92yXw7Q==}
|
||||
@@ -2103,6 +2082,9 @@ packages:
|
||||
resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==}
|
||||
deprecated: Use your platform's native atob() and btoa() methods instead
|
||||
|
||||
abortcontroller-polyfill@1.7.8:
|
||||
resolution: {integrity: sha512-9f1iZ2uWh92VcrU9Y8x+LdM4DLj75VE0MJB8zuF1iUnroEptStw+DQ8EQPMUdfe5k+PkB1uUfDQfWbhstH8LrQ==}
|
||||
|
||||
accepts@1.3.8:
|
||||
resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@@ -3593,9 +3575,6 @@ packages:
|
||||
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
kolorist@1.8.0:
|
||||
resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==}
|
||||
|
||||
lcid@3.1.1:
|
||||
resolution: {integrity: sha512-M6T051+5QCGLBQb8id3hdvIW8+zeFV2FyBGFS9IEK5H9Wt4MueD4bW1eWikpHgZp+5xR3l5c8pZUkQsIA0BFZg==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -5164,8 +5143,6 @@ snapshots:
|
||||
|
||||
'@antfu/utils@0.7.10': {}
|
||||
|
||||
'@antfu/utils@9.2.1': {}
|
||||
|
||||
'@babel/code-frame@7.27.1':
|
||||
dependencies:
|
||||
'@babel/helper-validator-identifier': 7.27.1
|
||||
@@ -6816,19 +6793,6 @@ snapshots:
|
||||
|
||||
'@iconify/types@2.0.0': {}
|
||||
|
||||
'@iconify/utils@3.0.2':
|
||||
dependencies:
|
||||
'@antfu/install-pkg': 1.1.0
|
||||
'@antfu/utils': 9.2.1
|
||||
'@iconify/types': 2.0.0
|
||||
debug: 4.4.3
|
||||
globals: 15.15.0
|
||||
kolorist: 1.8.0
|
||||
local-pkg: 1.1.2
|
||||
mlly: 1.8.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@iconify/vue@5.0.0(vue@3.5.21(typescript@5.8.3))':
|
||||
dependencies:
|
||||
'@iconify/types': 2.0.0
|
||||
@@ -8006,6 +7970,8 @@ snapshots:
|
||||
|
||||
abab@2.0.6: {}
|
||||
|
||||
abortcontroller-polyfill@1.7.8: {}
|
||||
|
||||
accepts@1.3.8:
|
||||
dependencies:
|
||||
mime-types: 2.1.35
|
||||
@@ -9813,8 +9779,6 @@ snapshots:
|
||||
|
||||
kleur@3.0.3: {}
|
||||
|
||||
kolorist@1.8.0: {}
|
||||
|
||||
lcid@3.1.1:
|
||||
dependencies:
|
||||
invert-kv: 3.0.1
|
||||
|
||||
@@ -1,19 +1,29 @@
|
||||
<script setup lang="ts">
|
||||
import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
|
||||
import { useUserStore } from './store'
|
||||
|
||||
onLaunch((options) => {
|
||||
console.log('App Launch', options)
|
||||
const userStore = useUserStore()
|
||||
|
||||
onLaunch(() => {
|
||||
console.log('App Launch')
|
||||
})
|
||||
onShow((options) => {
|
||||
console.log('App Show', options)
|
||||
onShow(() => {
|
||||
userStore.requireLogin()
|
||||
|
||||
console.log('App Show')
|
||||
})
|
||||
onHide(() => {
|
||||
console.log('App Hide')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style>
|
||||
page {
|
||||
background-color: #fcfbfe;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
swiper,
|
||||
scroll-view {
|
||||
flex: 1;
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,33 @@
|
||||
import { useUserStore } from '@/store'
|
||||
|
||||
const whiteList = [
|
||||
'/pages-sub/login/index',
|
||||
]
|
||||
|
||||
export const navigateToInterceptor = {
|
||||
invoke(args: UniApp.NavigateToOptions) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 白名单直接放行
|
||||
if (whiteList.some(path => args.url.startsWith(path))) {
|
||||
return args
|
||||
}
|
||||
|
||||
// 调用 requireLogin,如果未登录,会自动提示并跳转
|
||||
const ok = userStore.requireLogin()
|
||||
if (!ok) {
|
||||
return false // 阻止路由跳转
|
||||
}
|
||||
|
||||
return args // 已登录则放行
|
||||
},
|
||||
}
|
||||
|
||||
export const routeInterceptor = {
|
||||
install() {
|
||||
uni.addInterceptor('navigateTo', navigateToInterceptor)
|
||||
uni.addInterceptor('reLaunch', navigateToInterceptor)
|
||||
uni.addInterceptor('redirectTo', navigateToInterceptor)
|
||||
uni.addInterceptor('switchTab', navigateToInterceptor)
|
||||
},
|
||||
}
|
||||
@@ -2,5 +2,10 @@
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<slot />
|
||||
<view>
|
||||
<slot />
|
||||
<sar-toast-agent />
|
||||
<sar-dialog-agent />
|
||||
<sar-notify-agent />
|
||||
</view>
|
||||
</template>
|
||||
@@ -1,12 +1,13 @@
|
||||
import { createSSRApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import { routeInterceptor } from './interceptor/router'
|
||||
import store from './store'
|
||||
import '@/style/index.scss'
|
||||
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.use(store)
|
||||
|
||||
app.use(routeInterceptor)
|
||||
return {
|
||||
app,
|
||||
}
|
||||
|
||||
@@ -1,88 +1,193 @@
|
||||
<script lang="ts" setup>
|
||||
import type { FieldValidateError, FormExpose, FormRules } from 'sard-uniapp'
|
||||
import { getWindowInfo, toast } from 'sard-uniapp'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { useUserStore } from '@/store'
|
||||
|
||||
const useStore = useUserStore()
|
||||
|
||||
const startOffset = ref(getWindowInfo().statusBarHeight + 60)
|
||||
|
||||
const formModel = reactive({
|
||||
orgid: '',
|
||||
userid: '',
|
||||
password: '',
|
||||
})
|
||||
|
||||
const formRules: FormRules = {
|
||||
orgid: {
|
||||
required: true,
|
||||
message: '请输入机构码',
|
||||
},
|
||||
userid: {
|
||||
required: true,
|
||||
message: '请输入账号',
|
||||
},
|
||||
}
|
||||
|
||||
const formRef = ref<FormExpose>()
|
||||
|
||||
function onSubmit() {
|
||||
formRef.value
|
||||
?.validate()
|
||||
.then(() => {
|
||||
|
||||
})
|
||||
.catch((error: FieldValidateError[]) => {
|
||||
toast.fail(error[0].message)
|
||||
console.log('error submit!', error)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="g3-container">
|
||||
Container
|
||||
<view class="form-container">
|
||||
<sar-form-plain
|
||||
ref="formRef"
|
||||
:model="formModel"
|
||||
:rules="formRules"
|
||||
scroll-to-first-error
|
||||
:scroll-into-view-options="{
|
||||
startOffset,
|
||||
position: 'start',
|
||||
}"
|
||||
>
|
||||
<view class="form-description">
|
||||
<view class="form-title">
|
||||
欢迎登录!
|
||||
</view>
|
||||
<view class="form-subtitle">
|
||||
请输入机构码、账号和密码
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="form-list">
|
||||
<sar-form-item-plain name="orgid">
|
||||
<template #custom="{ fieldId }">
|
||||
<view class="form-label" :class="fieldId">
|
||||
<text>机构码</text>
|
||||
</view>
|
||||
<view class="form-input">
|
||||
<sar-input
|
||||
v-model="formModel.orgid"
|
||||
placeholder="请输入机构码"
|
||||
clearable
|
||||
>
|
||||
<template #prepend>
|
||||
<sar-icon family="iconfont" name="company" size="36rpx" />
|
||||
</template>
|
||||
</sar-input>
|
||||
</view>
|
||||
</template>
|
||||
</sar-form-item-plain>
|
||||
<sar-form-item-plain name="userid">
|
||||
<template #custom="{ fieldId }">
|
||||
<view class="form-label" :class="fieldId">
|
||||
账号
|
||||
</view>
|
||||
<view class="form-input">
|
||||
<sar-input
|
||||
v-model="formModel.userid"
|
||||
placeholder="请输入账号"
|
||||
clearable
|
||||
>
|
||||
<template #prepend>
|
||||
<sar-icon family="iconfont" name="user" size="36rpx" />
|
||||
</template>
|
||||
</sar-input>
|
||||
</view>
|
||||
</template>
|
||||
</sar-form-item-plain>
|
||||
<sar-form-item-plain name="password">
|
||||
<template #custom="{ fieldId }">
|
||||
<view class="form-label" :class="fieldId">
|
||||
密码
|
||||
</view>
|
||||
<view class="form-input">
|
||||
<sar-input
|
||||
v-model="formModel.password"
|
||||
placeholder="请输入密码"
|
||||
clearable
|
||||
>
|
||||
<template #prepend>
|
||||
<sar-icon family="iconfont" name="lock" size="36rpx" />
|
||||
</template>
|
||||
</sar-input>
|
||||
</view>
|
||||
</template>
|
||||
</sar-form-item-plain>
|
||||
</view>
|
||||
|
||||
<view class="footer">
|
||||
<sar-button loading-type="clock" @click="onSubmit">
|
||||
登录
|
||||
</sar-button>
|
||||
</view>
|
||||
</sar-form-plain>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.g3-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
padding: 2em;
|
||||
margin: 0 auto;
|
||||
font-family: 'Inter', sans-serif; /* 设置字体为Inter */
|
||||
<style>
|
||||
page {
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.form-container {
|
||||
padding: 0rpx 32rpx;
|
||||
}
|
||||
.g3-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
.g3-header-title {
|
||||
font-size: 24px;
|
||||
|
||||
.form-description {
|
||||
padding: 64rpx 0 64rpx;
|
||||
color: var(--sar-secondary-color);
|
||||
|
||||
.form-title {
|
||||
font-size: 42rpx;
|
||||
font-weight: bold;
|
||||
color: #575dfb;
|
||||
color: #000;
|
||||
}
|
||||
.g3-header-prompt {
|
||||
font-size: 16px;
|
||||
color: #666; /* 提示文字颜色稍微调淡 */
|
||||
.form-subtitle {
|
||||
margin-top: 16rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
.g3-content {
|
||||
width: 100%; /* 宽度调整为100%,以适应容器大小 */
|
||||
.g3-content-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
.g3-content-form-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
.label {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
::v-deep .input {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0.3rem;
|
||||
border: 2px solid #0498e1 !important;
|
||||
border-radius: 6px;
|
||||
&::after {
|
||||
display: none;
|
||||
}
|
||||
.wd-input__icon {
|
||||
font-size: 20px;
|
||||
color: #575dfb;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 36rpx;
|
||||
}
|
||||
.g3-footer {
|
||||
|
||||
.form-label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
width: 100%; /* 宽度调整为100% */
|
||||
text-align: center;
|
||||
::v-deep .login-button {
|
||||
height: 3rem;
|
||||
font-size: 1rem;
|
||||
font-weight: bold;
|
||||
border-radius: 6px;
|
||||
.wd-button__text {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.form-star {
|
||||
color: var(--sar-danger);
|
||||
}
|
||||
.form-input {
|
||||
margin-top: 20rpx;
|
||||
:deep(.sar-input) {
|
||||
background-color: #fff;
|
||||
.sar-icon {
|
||||
color: var(--sar-input-placeholder-color);
|
||||
}
|
||||
}
|
||||
.register {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
:deep(.sar-input_focused) {
|
||||
.sar-input__prepend {
|
||||
.sar-icon {
|
||||
color: var(--sar-input-focused-border-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
// position: sticky;
|
||||
// bottom: 0;
|
||||
padding-top: 64rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -2,7 +2,7 @@
|
||||
"globalStyle": {
|
||||
"navigationStyle": "default",
|
||||
"navigationBarTitleText": "App",
|
||||
"navigationBarBackgroundColor": "#f8f8f8",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTextStyle": "black",
|
||||
"backgroundColor": "#FFFFFF"
|
||||
},
|
||||
@@ -55,12 +55,19 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "pages-sub",
|
||||
"pages": [
|
||||
{
|
||||
"path": "login/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录",
|
||||
"navigationStyle": "default"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
// "subPackages": [
|
||||
// {
|
||||
// "root": "pages-sub",
|
||||
// "pages": [
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts"></script>
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>account</div>
|
||||
|
||||
@@ -5,6 +5,12 @@ const visible = ref(false)
|
||||
function show() {
|
||||
visible.value = !visible.value
|
||||
}
|
||||
|
||||
function toLogin() {
|
||||
uni.navigateTo({
|
||||
url: '/pages-sub/login/index',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -24,9 +30,11 @@ function show() {
|
||||
/>
|
||||
</sar-form-item>
|
||||
</sar-form>
|
||||
|
||||
<sar-button @click="toLogin">
|
||||
登录
|
||||
</sar-button>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.test {
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,5 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
import { toast } from '@/utils/toast'
|
||||
|
||||
const initState = { token: '', orgid: '', userid: '' }
|
||||
|
||||
@@ -21,13 +20,26 @@ export const useUserStore = defineStore(
|
||||
() => !!(userInfo.value.token && userInfo.value.orgid && userInfo.value.userid),
|
||||
)
|
||||
|
||||
function validateLogin(): boolean {
|
||||
function requireLogin(): boolean {
|
||||
if (!isLogined.value) {
|
||||
toast.error('尚未登陆或登录已过期')
|
||||
uni.navigateTo({ url: '/pages-sub/login/index' })
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1]
|
||||
const path = currentPage?.route ? `/${currentPage.route}` : ''
|
||||
|
||||
if (!path || path !== '/pages-sub/login/index') {
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none',
|
||||
success: () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages-sub/login/index',
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -35,7 +47,7 @@ export const useUserStore = defineStore(
|
||||
setUserInfo,
|
||||
reset,
|
||||
isLogined,
|
||||
validateLogin,
|
||||
requireLogin,
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
@font-face {
|
||||
font-family: "iconfont"; /* Project id 5031675 */
|
||||
src:
|
||||
url('data:font/ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwR1NVQiCLJXoAAAE4AAAAVE9TLzI8xktYAAABjAAAAGBjbWFwuNkq8AAAAfwAAAGcZ2x5ZhSTPTYAAAOkAAABqGhlYWQtGakQAAAA4AAAADZoaGVhB94DhQAAALwAAAAkaG10eBAAAAAAAAHsAAAAEGxvY2EBDACIAAADmAAAAAptYXhwARIAQAAAARgAAAAgbmFtZRCjPLAAAAVMAAACZ3Bvc3Sp2r9RAAAHtAAAAD8AAQAAA4D/gABcBAAAAAAABAAAAQAAAAAAAAAAAAAAAAAAAAQAAQAAAAEAAAWhLl9fDzz1AAsEAAAAAADk/TJ0AAAAAOT9MnQAAP/VBAADVgAAAAgAAgAAAAAAAAABAAAABAA0AAQAAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKADAAPgACREZMVAAObGF0bgAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAQEAAGQAAUAAAKJAswAAACPAokCzAAAAesAMgEIAAACAAUDAAAAA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AA=') format('truetype');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.iconfont-company:before {
|
||||
content: "\e6b1";
|
||||
}
|
||||
|
||||
.iconfont-lock:before {
|
||||
content: "\e85f";
|
||||
}
|
||||
|
||||
.iconfont-user:before {
|
||||
content: "\e888";
|
||||
}
|
||||
@@ -1,4 +1,12 @@
|
||||
@import 'sard-uniapp/index.scss';
|
||||
@import './iconfont.css';
|
||||
|
||||
page,
|
||||
.sar-portal {
|
||||
--sar-input-border-color: #ddd;
|
||||
--sar-primary: #0064fa;
|
||||
--sar-rounded: 4rpx;
|
||||
}
|
||||
|
||||
.picker-select__pagination-root {
|
||||
width: 100%;
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
|
||||
<title>登录</title>
|
||||
<style>
|
||||
:root {
|
||||
--primary: #409eff;
|
||||
--text: #222;
|
||||
--subtext: #666;
|
||||
--bg: #f5f7fa;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
background: var(--bg);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
width: 92%;
|
||||
max-width: 400px;
|
||||
background: #fff;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
|
||||
padding: 28px 22px;
|
||||
}
|
||||
|
||||
.login-header {
|
||||
text-align: center;
|
||||
font-size: 1.3rem;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 12px 14px;
|
||||
font-size: 0.95rem;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 10px;
|
||||
outline: none;
|
||||
transition: border 0.2s;
|
||||
}
|
||||
|
||||
.form-group input:focus {
|
||||
border-color: var(--primary);
|
||||
}
|
||||
|
||||
.login-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 0.85rem;
|
||||
margin: 6px 0 18px;
|
||||
color: var(--subtext);
|
||||
}
|
||||
|
||||
.login-actions label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.login-actions a {
|
||||
color: var(--primary);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.login-button {
|
||||
width: 100%;
|
||||
padding: 13px;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
background: var(--primary);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.login-button:active {
|
||||
background: #318ae6;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-container">
|
||||
<div class="login-header">系统登录</div>
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="请输入机构码">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="请输入账号">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="password" placeholder="请输入密码">
|
||||
</div>
|
||||
<div class="login-actions">
|
||||
<label>
|
||||
<input type="checkbox" style="accent-color: var(--primary);"> 记住我
|
||||
</label>
|
||||
<a href="#">忘记密码?</a>
|
||||
</div>
|
||||
<button type="submit" class="login-button">登录</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,11 +1,12 @@
|
||||
import path from 'node:path'
|
||||
import process from 'node:process'
|
||||
import Uni from '@uni-helper/plugin-uni'
|
||||
|
||||
import Components from '@uni-helper/vite-plugin-uni-components'
|
||||
import UniLayouts from '@uni-helper/vite-plugin-uni-layouts'
|
||||
import UniPlatform from '@uni-helper/vite-plugin-uni-platform'
|
||||
import Optimization from '@uni-ku/bundle-optimizer'
|
||||
// https://github.com/uni-ku/root
|
||||
|
||||
import { visualizer } from 'rollup-plugin-visualizer'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
@@ -26,7 +27,8 @@ export default defineConfig(({ command, mode }) => {
|
||||
console.log('环境变量 env -> ', env)
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log('当前是开发模式')
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
console.log('当前是生产/打包模式')
|
||||
}
|
||||
return defineConfig({
|
||||
@@ -123,5 +125,8 @@ export default defineConfig(({ command, mode }) => {
|
||||
// 开发环境不用压缩
|
||||
minify: mode === 'development' ? false : 'esbuild',
|
||||
},
|
||||
optimizeDeps: {
|
||||
exclude: ['sard-uniapp'],
|
||||
},
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user