| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375 |
- <template>
- <view class="splash-container">
- <view class="splash-bg-1"></view>
- <view class="splash-bg-2"></view>
- <view class="logo-section">
- <view class="logo-wrapper">
- <view class="logo-glow"></view>
- <image class="logo-icon" src="/static/image/public/logo.png" mode="aspectFit"></image>
- </view>
- <text class="app-name">{{appName}}</text>
- <text class="app-slogan">您的客户关系管理助手</text>
- </view>
- <view class="loading-section">
- <text class="loading-text">
- 正在加载
- <view class="loading-dots">
- <view class="dot dot1"></view>
- <view class="dot dot2"></view>
- <view class="dot dot3"></view>
- </view>
- </text>
- </view>
- <view class="version-info">
- <text class="version-text">{{version}}</text>
- <view class="version-text">
- 浙江舒博特网络科技有限公司提供技术支持
- </view>
- </view>
- <!-- 隐藏的 Canvas 用于生成名片快照 -->
- <canvas id="posterCanvas" type="2d"
- style="position: fixed; left: -9999px; top: -9999px; width: 750px; height: 780px;"></canvas>
-
- <!-- 隐藏的 Canvas 用于生成二维码海报 -->
- <view class="hidden-canvas-box">
- <canvas id="qrPosterCanvas" type="2d" style="width: 600px; height: 700px;"></canvas>
- </view>
-
- </view>
- </template>
- <script setup>
- import {
- ref,
- onMounted,
- } from 'vue'
- import {
- isLogin
- } from '@/utils/userCache.js'
- import {
- useUserStore
- } from '@/store/modules/user.js'
- import {
- onLoad,
- } from "@dcloudio/uni-app";
- const userStore = useUserStore() || null
- import {
- getCurrentConfig
- } from '@/config/index.js'
- const loadingText = ref('正在加载...')
- let appName = ref('')
- let version = ref('')
- // 页面加载
- onMounted(async () => {
- const config = await getCurrentConfig()
- appName.value = config.appName
- version.value = config.appVersion
- })
- onLoad((options) => {
- initApp(options?.userId)
- })
- /**
- * 初始化应用
- */
- const initApp = async (userId = null) => {
- try {
- loadingText.value = '检查登录状态...'
- const loginToggle = isLogin() || !!userId
- if (!loginToggle) {
- console.log('未登录,token 不存在')
- uni.reLaunch({
- url: '/pages/login/login'
- })
- return
- }
- if (loginToggle) {
- await userStore.queryCardInfo(userId)
- await userStore.queryCompanyInfo(userId)
- await userStore.queryCardPoster()
- uni.reLaunch({
- url: !!userId ? '/pages/mine/userCard' : '/pages/index/index'
- })
- // await userStore.queryCardQrcode(userId)
- } else {
- clearUserInfo()
- uni.reLaunch({
- url: '/pages/login/login'
- })
- }
- } catch (error) {
- console.error('验证登录态失败:', error)
- clearUserInfo()
- uni.reLaunch({
- url: '/pages/login/login'
- })
- }
- }
- /**
- * 延时函数
- * @param {number} ms - 毫秒数
- */
- const sleep = (ms) => {
- return new Promise(resolve => setTimeout(resolve, ms))
- }
- </script>
- <style lang="scss" scoped>
- .splash-container {
- min-height: 100vh;
- background: linear-gradient(135deg, #4A90E2 0%, #6FB3F2 50%, #87CEEB 100%);
- // background-color: #fff;
- position: relative;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 0 40rpx;
- .splash-bg-1 {
- position: absolute;
- top: -20%;
- left: -10%;
- width: 60%;
- height: 60%;
- background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
- border-radius: 50%;
- animation: floatBg1 8s ease-in-out infinite;
- }
- .splash-bg-2 {
- position: absolute;
- bottom: -20%;
- right: -10%;
- width: 70%;
- height: 70%;
- background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
- border-radius: 50%;
- animation: floatBg2 10s ease-in-out infinite;
- }
- }
- // Logo 区域
- .logo-section {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-bottom: 120rpx;
- position: relative;
- z-index: 10;
- .logo-wrapper {
- position: relative;
- width: 240rpx;
- height: 240rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- .logo-glow {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 280rpx;
- height: 280rpx;
- background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
- border-radius: 50%;
- animation: logoGlow 3s ease-in-out infinite;
- }
- .logo-icon {
- width: 200rpx;
- height: 200rpx;
- border-radius: 44rpx;
- background: rgba(255, 255, 255, 0.95);
- box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15),
- 0 0 40rpx rgba(255, 255, 255, 0.3);
- display: flex;
- align-items: center;
- justify-content: center;
- animation: logoFloat 3s ease-in-out infinite;
- position: relative;
- z-index: 2;
- }
- }
- .app-name {
- font-size: 48rpx;
- font-weight: 600;
- color: #ffffff;
- margin-top: 48rpx;
- letter-spacing: 3rpx;
- text-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
- }
- .app-slogan {
- font-size: 26rpx;
- color: rgba(255, 255, 255, 0.85);
- margin-top: 20rpx;
- letter-spacing: 1rpx;
- text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
- }
- }
- // 加载动画
- .loading-section {
- display: flex;
- flex-direction: column;
- align-items: center;
- position: relative;
- z-index: 10;
- .loading-text {
- font-size: 28rpx;
- color: rgba(255, 255, 255, 0.95);
- letter-spacing: 2rpx;
- text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
- display: flex;
- align-items: center;
- justify-content: center;
- background: rgba(255, 255, 255, 0.15);
- padding: 20rpx 40rpx;
- border-radius: 40rpx;
- backdrop-filter: blur(10rpx);
- box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
- .loading-dots {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-left: 8rpx;
- height: 20rpx;
- .dot {
- width: 12rpx;
- height: 12rpx;
- border-radius: 50%;
- background-color: #ffffff;
- margin: 0 4rpx;
- opacity: 0.4;
- box-shadow: 0 0 15rpx rgba(255, 255, 255, 0.5);
- }
- .dot1 {
- animation: loadingDot 1.4s ease-in-out infinite;
- }
- .dot2 {
- animation: loadingDot 1.4s ease-in-out 0.2s infinite;
- }
- .dot3 {
- animation: loadingDot 1.4s ease-in-out 0.4s infinite;
- }
- }
- }
- }
- // 版本信息
- .version-info {
- position: absolute;
- bottom: 80rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- z-index: 10;
- background: rgba(255, 255, 255, 0.1);
- padding: 20rpx 40rpx;
- border-radius: 32rpx;
- backdrop-filter: blur(10rpx);
- box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
- border: 1rpx solid rgba(255, 255, 255, 0.2);
- .version-text {
- font-size: 22rpx;
- color: rgba(255, 255, 255, 0.7);
- text-align: center;
- line-height: 1.6;
- text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
- }
- }
- // 动画
- @keyframes logoFloat {
- 0%,
- 100% {
- transform: translateY(0) scale(1);
- }
- 50% {
- transform: translateY(-15rpx) scale(1.02);
- }
- }
- @keyframes logoGlow {
- 0%,
- 100% {
- opacity: 0.5;
- transform: translate(-50%, -50%) scale(1);
- }
- 50% {
- opacity: 0.8;
- transform: translate(-50%, -50%) scale(1.1);
- }
- }
- @keyframes loadingDot {
- 0%,
- 80%,
- 100% {
- transform: scale(0.8);
- opacity: 0.4;
- }
- 40% {
- transform: scale(1.2);
- opacity: 1;
- }
- }
- @keyframes floatBg1 {
- 0%,
- 100% {
- transform: translate(0, 0) scale(1);
- }
- 50% {
- transform: translate(30rpx, -30rpx) scale(1.05);
- }
- }
- @keyframes floatBg2 {
- 0%,
- 100% {
- transform: translate(0, 0) scale(1);
- }
- 50% {
- transform: translate(-30rpx, 30rpx) scale(1.08);
- }
- }
- // 隐藏的 canvas 容器
- .hidden-canvas-box {
- position: fixed;
- left: -9999px;
- top: -9999px;
- width: 1px;
- height: 1px;
- overflow: hidden;
- }
- </style>
|