zbb пре 1 месец
родитељ
комит
75f95141a7
11 измењених фајлова са 675 додато и 264 уклоњено
  1. 44 0
      api/card.js
  2. 0 25
      api/index.js
  3. 0 6
      api/request.js
  4. 1 1
      config/env.development.js
  5. 7 0
      pages.json
  6. 1 1
      pages/index/index.vue
  7. 49 69
      pages/login/login.vue
  8. 471 0
      pages/mine/userCard.vue
  9. 47 51
      pages/splash/splash.vue
  10. 34 65
      store/modules/user.js
  11. 21 46
      utils/userCache.js

+ 44 - 0
api/card.js

@@ -0,0 +1,44 @@
+/**
+ * 名片管理 API 接口
+ * 根据 D:\下载与安装\crm 名片管理.md 文档定义
+ */
+import request from '@/utils/request.js'
+
+/**
+ * 获取名片信息
+ * GET /crm/card/info
+ * @param {Object} params - 请求参数
+ * @param {number} params.userId - 用户 ID
+ * @returns {Promise}
+ */
+export const getCardInfo = (params = {}) => {
+	return request.get('/crm/card/info', params)
+}
+
+/**
+ * 获取名片二维码
+ * GET /crm/card/qrcode
+ * @param {Object} params - 请求参数
+ * @param {number} params.userId - 用户 ID
+ * @returns {Promise}
+ */
+export const getCardQrcode = (params = {}) => {
+	return request.get('/crm/card/qrcode', params)
+}
+
+/**
+ * 获取公司信息
+ * GET /crm/card/companyInfo
+ * @param {Object} params - 请求参数
+ * @param {number} params.userId - 用户 ID
+ * @returns {Promise}
+ */
+export const getCompanyInfo = (params = {}) => {
+	return request.get('/crm/card/companyInfo', params)
+}
+
+export default {
+	getCardInfo,
+	getCardQrcode,
+	getCompanyInfo
+}

+ 0 - 25
api/index.js

@@ -1,25 +0,0 @@
-/**
- * API 接口统一导出
- */
-import request from './request.js'
-
-// 用户相关接口
-export const userApi = {
-	// 发送验证码
-	sendCode: (data) => request.post('/oa/code/sendCode', data, headers: {
-		isToken: false,
-	}, ),
-	codeLogin: (data) => request.post('/codeLogin', data, headers: {
-		isToken: false
-	}, ),
-
-	// 手机号登录
-	login: (data) => request.post('/api/auth/login', data),
-
-	// 获取用户信息
-	getUserInfo: () => request.get('/api/user/info')
-}
-
-export default {
-	user: userApi
-}

+ 0 - 6
api/request.js

@@ -1,6 +0,0 @@
-/**
- * API 请求统一导出
- * 实际请求逻辑在 utils/request.js
- */
-export { request, get, post, put, del } from '@/utils/request.js'
-export { default } from '@/utils/request.js'

+ 1 - 1
config/env.development.js

@@ -6,7 +6,7 @@ export default {
 	env: 'development',
 	env: 'development',
 	
 	
 	// 测试
 	// 测试
-	baseUrl: 'http://192.168.0.170:8102',
+	// baseUrl: 'http://192.168.0.170:8102',
 	// 本地
 	// 本地
 	baseUrl: 'http://192.168.0.59:8102',
 	baseUrl: 'http://192.168.0.59:8102',
 	timeout: 10000,
 	timeout: 10000,

+ 7 - 0
pages.json

@@ -65,6 +65,13 @@
 				"navigationStyle": "custom"
 				"navigationStyle": "custom"
 			}
 			}
 		},
 		},
+		{
+			"path": "pages/mine/userCard",
+			"style": {
+				"navigationBarTitleText": "名片信息",
+				"navigationStyle": "custom"
+			}
+		},
 		{
 		{
 			"path": "pages/test/debug",
 			"path": "pages/test/debug",
 			"style": {
 			"style": {

+ 1 - 1
pages/index/index.vue

@@ -742,7 +742,7 @@
 	/* 业务日历模块 */
 	/* 业务日历模块 */
 	.business-calendar {
 	.business-calendar {
 		background: #ffffff;
 		background: #ffffff;
-		margin: 20rpx;
+		margin: 20rpx 0;
 		padding: 32rpx;
 		padding: 32rpx;
 		border-radius: 24rpx;
 		border-radius: 24rpx;
 		box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
 		box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);

+ 49 - 69
pages/login/login.vue

@@ -77,7 +77,7 @@
 				</view>
 				</view>
 				<scroll-view scroll-y class="popup-body">
 				<scroll-view scroll-y class="popup-body">
 					<view class="agreement-content">
 					<view class="agreement-content">
-						<yonghuxieyi/>
+						<yonghuxieyi />
 					</view>
 					</view>
 				</scroll-view>
 				</scroll-view>
 				<view class="popup-footer">
 				<view class="popup-footer">
@@ -96,8 +96,8 @@
 				</view>
 				</view>
 				<scroll-view scroll-y class="popup-body">
 				<scroll-view scroll-y class="popup-body">
 					<view class="agreement-content">
 					<view class="agreement-content">
-						
-						<yonghuzhengce/>
+
+						<yonghuzhengce />
 					</view>
 					</view>
 				</scroll-view>
 				</scroll-view>
 				<view class="popup-footer">
 				<view class="popup-footer">
@@ -109,9 +109,9 @@
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-	import  yonghuxieyi from "./yonghuxieyi.vue"
-	import  yonghuzhengce from "./yonghuzhengce.vue"
-	
+	import yonghuxieyi from "./yonghuxieyi.vue"
+	import yonghuzhengce from "./yonghuzhengce.vue"
+
 	import {
 	import {
 		getCurrentConfig
 		getCurrentConfig
 	} from '@/config/index.js'
 	} from '@/config/index.js'
@@ -127,9 +127,14 @@
 		wxLogin
 		wxLogin
 	} from '@/api/login.js'
 	} from '@/api/login.js'
 	import {
 	import {
-		saveUserInfo,
-		getToken
+		saveToekn,
 	} from '@/utils/userCache.js'
 	} from '@/utils/userCache.js'
+	import {
+		useUserStore
+	} from '@/store/modules/user.js'
+
+	const userStore = useUserStore() || null
+
 	let appName = ref('')
 	let appName = ref('')
 	let version = ref('')
 	let version = ref('')
 	onMounted(async () => {
 	onMounted(async () => {
@@ -215,9 +220,12 @@
 		isLoading.value = true
 		isLoading.value = true
 		try {
 		try {
 			// 第一步:调用登录接口获取 token
 			// 第一步:调用登录接口获取 token
-			const res = await codeLogin({phonenumber:phoneNumber.value, smsCode:verifyCode.value})
+			const res = await codeLogin({
+				phonenumber: phoneNumber.value,
+				smsCode: verifyCode.value
+			})
 			console.log('登录接口返回:', res)
 			console.log('登录接口返回:', res)
-			
+
 			if (res.code != 200) {
 			if (res.code != 200) {
 				uni.showToast({
 				uni.showToast({
 					title: res.msg || '登录失败',
 					title: res.msg || '登录失败',
@@ -226,10 +234,11 @@
 				isLoading.value = false
 				isLoading.value = false
 				return
 				return
 			}
 			}
-			
 			// 获取 token
 			// 获取 token
-			const { token } = res.data || res
-			
+			const {
+				token
+			} = res.data || res
+
 			if (!token) {
 			if (!token) {
 				uni.showToast({
 				uni.showToast({
 					title: '未获取到 token',
 					title: '未获取到 token',
@@ -238,35 +247,21 @@
 				isLoading.value = false
 				isLoading.value = false
 				return
 				return
 			}
 			}
-			
-			// 第二步:调用 getUserInfo 获取用户信息
-			const userInfoRes = await getUserInfo({})
-			console.log('用户信息接口返回:', userInfoRes)
-			
-			if (userInfoRes.code != 200) {
-				uni.showToast({
-					title: userInfoRes.msg || '获取用户信息失败',
-					icon: 'none'
-				})
-				isLoading.value = false
-				return
-			}
-			
-			// 第三步:保存用户信息和 token
-			const userInfo = userInfoRes.data || userInfoRes
-			const saveSuccess = saveUserInfo(userInfo, token)
-			
-			if (saveSuccess) {
+			if (token) {
+				// 调用 store 里的函数获取名片和公司信息
+				saveToekn(token)
+			let cardInfo = 	await userStore.queryCardInfo()
+				await userStore.queryCompanyInfo()
+				console.log(cardInfo,"cardInfocardInfocardInfo");
+				
 				uni.showToast({
 				uni.showToast({
 					title: '登录成功',
 					title: '登录成功',
 					icon: 'success'
 					icon: 'success'
 				})
 				})
 				// 延迟跳转
 				// 延迟跳转
-				setTimeout(() => {
-					uni.reLaunch({
-						url: '/pages/index/index'
-					})
-				}, 1500)
+				uni.reLaunch({
+					url: '/pages/index/index'
+				})
 			} else {
 			} else {
 				uni.showToast({
 				uni.showToast({
 					title: '保存登录信息失败',
 					title: '保存登录信息失败',
@@ -298,16 +293,16 @@
 		try {
 		try {
 			// 先获取微信登录 code
 			// 先获取微信登录 code
 			const code = await wxLogin()
 			const code = await wxLogin()
-			
+
 			// 调用 wxgetLogin 接口,传入 code 和手机号信息
 			// 调用 wxgetLogin 接口,传入 code 和手机号信息
-			console.log(e,"eeeeeeee");
+			console.log(e, "eeeeeeee");
 			const res = await wxgetLogin({
 			const res = await wxgetLogin({
 				wxCode: code,
 				wxCode: code,
 				phoneCode: e.detail.code,
 				phoneCode: e.detail.code,
 				iv: e.detail.iv,
 				iv: e.detail.iv,
 				type: 1
 				type: 1
 			})
 			})
-			
+
 			if (res.code != 200) {
 			if (res.code != 200) {
 				uni.showToast({
 				uni.showToast({
 					title: res.msg || '登录失败',
 					title: res.msg || '登录失败',
@@ -315,12 +310,14 @@
 				})
 				})
 				return
 				return
 			}
 			}
-			
+
 			console.log('微信登录成功:', res)
 			console.log('微信登录成功:', res)
-			
+
 			// 获取 token
 			// 获取 token
-			const { token } = res.data || res
-			
+			const {
+				token
+			} = res.data || res
+
 			if (!token) {
 			if (!token) {
 				uni.showToast({
 				uni.showToast({
 					title: '未获取到 token',
 					title: '未获取到 token',
@@ -328,35 +325,18 @@
 				})
 				})
 				return
 				return
 			}
 			}
-			
-			// 第二步:调用 getUserInfo 获取用户信息
-			const userInfoRes = await getUserInfo({})
-			console.log('用户信息接口返回:', userInfoRes)
-			
-			if (userInfoRes.code != 200) {
-				uni.showToast({
-					title: userInfoRes.msg || '获取用户信息失败',
-					icon: 'none'
-				})
-				return
-			}
-			
-			// 第三步:保存用户信息和 token
-			const userInfo = userInfoRes.data || userInfoRes
-			const saveSuccess = saveUserInfo(userInfo, token)
-			
-			if (saveSuccess) {
+
+			if (token) {
+				saveToekn(token)
+				await userStore.queryCardInfo()
+				await userStore.queryCompanyInfo()
 				uni.showToast({
 				uni.showToast({
 					title: '登录成功',
 					title: '登录成功',
 					icon: 'success'
 					icon: 'success'
 				})
 				})
-				
-				// 延迟跳转到首页
-				setTimeout(() => {
-					uni.reLaunch({
-						url: '/pages/index/index'
-					})
-				}, .800)
+				uni.reLaunch({
+					url: '/pages/index/index'
+				})
 			} else {
 			} else {
 				uni.showToast({
 				uni.showToast({
 					title: '保存登录信息失败',
 					title: '保存登录信息失败',

+ 471 - 0
pages/mine/userCard.vue

@@ -0,0 +1,471 @@
+<template>
+	<view class="card-container">
+
+		<!-- 顶部背景 -->
+		<image class="top-bg" src="/static/image/home/top-bg.png" />
+		<NavBar title="名片信息" :show_back="false" color="#FFFFFF" :fixed="true" :bg="'transparent'"></NavBar>
+		<!-- 名片卡片 -->
+		<view class="page-top">
+			<view class="user-card">
+				<!-- 背景图 -->
+				<image class="user-card-bg" src="/static/image/home/usecard-bg.png" />
+		
+				<!-- 左上:姓名 + 职位 -->
+				<view class="user-header">
+					<view class="name-row">
+						<text class="user-name">赵建平</text>
+						<text class="user-role">销售经理</text>
+					</view>
+					<text class="company-name">杭州碟滤膜技术有限公司</text>
+				</view>
+		
+				<!-- 右上:头像 -->
+				<view class="avatar-wrapper">
+					<image class="avatar" src="/static/image/public/avatar-default.png" />
+					<image class="badge-icon" src="/static/image/public/badge-icon.png" />
+				</view>
+		
+				<!-- 左下:联系方式 -->
+				<view class="user-contact">
+					<view class="contact-row" @click="makeCall">
+						<uni-icons type="phone" :size="18" color="#666666"></uni-icons>
+						<text class="contact-text">138-0000-0000</text>
+					</view>
+					<view class="contact-row">
+						<uni-icons type="email" :size="18" color="#666666"></uni-icons>
+						<text class="contact-text">zhao.jp@subote.com</text>
+					</view>
+					<view class="contact-row">
+						<uni-icons type="location" :size="18" color="#666666"></uni-icons>
+						<text class="contact-text">上海市静安区江宁路 168 号</text>
+					</view>
+				</view>
+			</view>
+	<!-- 		<view class="control-card">
+				<view class="item">
+					<image src="/static/image/public/card-sharing.png"></image>
+					<text>分享名片</text>
+				</view>
+				<view class="item">
+					<image src="/static/image/public/card-save.png"></image>
+					<text>保存名片</text>
+				</view>
+				<view class="item">
+					<image src="/static/image/public/card-qr.png"></image>
+					<text>名片码</text>
+				</view>
+			</view> -->
+		</view>
+		<view class="card-content">
+			<!-- Tab 切换 -->
+			<view class="tab-section">
+				<view class="tab-wrapper">
+					<view class="tab-item" :class="{ active: currentTab === 'products' }"
+						@click="switchTab('products')">
+						<text class="tab-text">产品列表</text>
+						<view class="tab-indicator" v-if="currentTab === 'products'"></view>
+					</view>
+					<view class="tab-item" :class="{ active: currentTab === 'company' }" @click="switchTab('company')">
+						<text class="tab-text">企业简介</text>
+						<view class="tab-indicator" v-if="currentTab === 'company'"></view>
+					</view>
+				</view>
+			</view>
+			<!-- 产品列表 -->
+			<view class="product-list" v-if="currentTab === 'products'">
+				<view class="product-item" v-for="(item, index) in productList" :key="index">
+					<image class="product-image" :src="item.image" mode="aspectFill" />
+					<view class="product-info">
+						<text class="product-title">{{ item.title }}</text>
+						<text class="product-desc">{{ item.description }}</text>
+					</view>
+				</view>
+			</view>
+			<!-- 企业简介 -->
+			<view class="company-section" v-if="currentTab === 'company'">
+				<view class="company-content">
+					<text class="company-text">
+						杭州碟滤膜技术有限公司是一家专注于膜技术研发、生产和销售的高新技术企业。公司主要产品包括各种规格的滤膜、过滤器及相关设备,广泛应用于医药、化工、食品、环保等领域。
+					</text>
+					<text class="company-text">
+						公司拥有一支专业的研发团队和先进的生产设备,始终坚持"质量第一、客户至上"的经营理念,为客户提供优质的产品和服务。
+					</text>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		ref
+	} from 'vue'
+	import NavBar from '@/components/nav-bar/index.vue'
+	const currentTab = ref('products')
+
+	const productList = ref([{
+			id: 1,
+			title: '惠普黑白激光打印机 选配小白盒巴',
+			description: '打印机 | 惠普',
+			image: '/static/image/product/product-1.png'
+		},
+	])
+
+	const goBack = () => {
+		uni.navigateBack()
+	}
+
+	const shareCard = () => {
+		uni.showToast({
+			title: '分享名片',
+			icon: 'none'
+		})
+	}
+
+	const saveCard = () => {
+		uni.showToast({
+			title: '保存名片',
+			icon: 'none'
+		})
+	}
+
+	const showQRCode = () => {
+		uni.showToast({
+			title: '名片码',
+			icon: 'none'
+		})
+	}
+
+	const switchTab = (tab) => {
+		currentTab.value = tab
+	}
+</script>
+
+<style lang="scss" scoped>
+	.card-container {
+		background: #f5f6f8;
+	}
+
+	.top-bg {
+		width: 750rpx;
+		height: 634rpx;
+		position: fixed;
+		top: 0;
+		left: 0;
+		z-index: 1;
+	}
+
+	// 顶部背景区域
+	.header-bg {
+		background: linear-gradient(135deg, #4A90E2 0%, #6FB3F2 50%, #87CEEB 100%);
+		padding: 0 40rpx;
+		padding-top: calc(var(--status-bar-height) + 20rpx);
+		padding-bottom: 60rpx;
+		position: relative;
+		overflow: hidden;
+
+		// 背景光效
+		&::before {
+			content: '';
+			position: absolute;
+			top: -100rpx;
+			right: -100rpx;
+			width: 500rpx;
+			height: 500rpx;
+			background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
+			border-radius: 50%;
+		}
+
+		// 导航栏
+		.nav-bar {
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			height: 88rpx;
+			position: relative;
+			z-index: 10;
+
+			.nav-back {
+				width: 60rpx;
+				height: 60rpx;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+			}
+
+			.nav-title {
+				font-size: 32rpx;
+				font-weight: 600;
+				color: #ffffff;
+				text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
+			}
+
+			.nav-right {
+				display: flex;
+				align-items: center;
+
+				.more-btn,
+				.refresh-btn {
+					width: 64rpx;
+					height: 64rpx;
+					border-radius: 50%;
+					background: rgba(255, 255, 255, 0.15);
+					display: flex;
+					align-items: center;
+					justify-content: center;
+					margin-left: 16rpx;
+				}
+			}
+		}
+	}
+
+
+
+	/* 用户信息卡片 */
+	.page-top {
+		margin: 0 24rpx 24rpx;
+		.user-card {
+			position: relative;
+			z-index: 2;
+			width: 100%;
+			height: 400rpx;
+			box-sizing: border-box;
+			padding: 80rpx 40rpx 32rpx;
+			position: relative;
+
+			.user-card-bg {
+				position: absolute;
+				top: 0;
+				left: 0;
+				width: 100%;
+				height: 100%;
+				z-index: 0;
+			}
+
+			view,
+			text {
+				position: relative;
+				z-index: 1;
+			}
+
+			.user-header {
+				.name-row {
+					display: flex;
+					align-items: center;
+					margin-bottom: 16rpx;
+
+					.user-name {
+						font-size: 44rpx;
+						font-weight: 700;
+						color: #202020;
+						line-height: 1.2;
+					}
+
+					.user-role {
+						margin-left: 16rpx;
+						padding: 6rpx 16rpx;
+						background: rgba(68, 110, 255, 0.10);
+						border-radius: 8rpx;
+						font-size: 24rpx;
+						font-weight: 500;
+						color: #446eff;
+					}
+				}
+
+				.company-name {
+					font-size: 28rpx;
+					font-weight: 500;
+					color: #666666;
+					line-height: 1.4;
+				}
+			}
+
+			.avatar-wrapper {
+				position: absolute;
+				top: 32rpx;
+				right: 40rpx;
+				width: 140rpx;
+				height: 140rpx;
+				border-radius: 50%;
+				box-shadow: 0rpx 0rpx 4rpx 0rpx rgba(21, 93, 252, 0.20);
+
+				.avatar {
+					width: 100%;
+					height: 100%;
+				}
+
+				.badge-icon {
+					width: 64rpx;
+					height: 64rpx;
+					position: absolute;
+					bottom: 0;
+					right: 0;
+					transform: translate(50% 50%);
+					z-index: 1;
+				}
+			}
+
+			.user-contact {
+				margin-top: 32rpx;
+
+				.contact-row {
+					display: flex;
+					align-items: center;
+					margin-bottom: 16rpx;
+
+					uni-icons {
+						margin-right: 12rpx;
+						flex-shrink: 0;
+					}
+
+					.contact-text {
+						font-size: 26rpx;
+						color: #666666;
+					}
+				}
+			}
+
+		}
+		.control-card{
+			background-color: #fff;
+			border-radius: 0 0 24rpx 24rpx;
+			position: relative;
+			z-index: 1;
+			bottom: 24rpx;
+			display: flex;
+			align-items: center;
+			justify-content: space-around;
+			padding-top: 48rpx;
+			padding-bottom: 24rpx;
+			.item{
+				display: flex;
+				flex-direction: column;
+				align-items: center;
+				justify-content: center;
+				gap: 4rpx;
+				image{
+					width: 64rpx;
+					height: 64rpx;
+				}
+				text{
+					font-size: 26rpx;
+					color: #202020;
+				}
+			}
+		}
+	
+	
+	}
+	// 名片内容区域
+	.card-content {
+		margin: 0 24rpx;
+		padding: 0 24rpx ;
+		border-radius: 24rpx;
+		background: #ffffff;
+		box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.04);
+		position: relative;
+		z-index: 2;
+	}
+	// Tab 切换区域
+	.tab-section {
+		border-radius: 24rpx 24rpx 0 0;
+		padding: 0 40rpx;
+
+		.tab-wrapper {
+			display: flex;
+			border-bottom: 1rpx solid #f0f0f0;
+
+			.tab-item {
+				flex: 1;
+				display: flex;
+				flex-direction: column;
+				align-items: center;
+				padding: 32rpx 0;
+				position: relative;
+
+				.tab-text {
+					font-size: 28rpx;
+					color: #999999;
+					font-weight: 500;
+				}
+
+				&.active .tab-text {
+					color: #333333;
+					font-weight: 600;
+				}
+
+				.tab-indicator {
+					position: absolute;
+					bottom: 0;
+					width: 60rpx;
+					height: 4rpx;
+					background: linear-gradient(90deg, #4A90E2 0%, #6FB3F2 100%);
+					border-radius: 2rpx;
+				}
+			}
+		}
+	}
+
+	// 产品列表
+	.product-list {
+		padding: 24rpx 40rpx;
+		.product-item {
+			display: flex;
+			padding: 24rpx 0;
+			border-bottom: 1rpx solid #f0f0f0;
+
+			&:last-child {
+				border-bottom: none;
+			}
+
+			.product-image {
+				width: 160rpx;
+				height: 160rpx;
+				border-radius: 12rpx;
+				background: #f5f5f5;
+				flex-shrink: 0;
+				margin-right: 24rpx;
+			}
+
+			.product-info {
+				flex: 1;
+				display: flex;
+				flex-direction: column;
+				justify-content: center;
+
+				.product-title {
+					font-size: 28rpx;
+					color: #333333;
+					margin-bottom: 12rpx;
+					line-height: 1.5;
+				}
+
+				.product-desc {
+					font-size: 24rpx;
+					color: #999999;
+				}
+			}
+		}
+	}
+
+	// 企业简介
+	.company-section {
+		background: #ffffff;
+		padding: 40rpx;
+
+		.company-content {
+			.company-text {
+				display: block;
+				font-size: 28rpx;
+				color: #666666;
+				line-height: 1.8;
+				margin-bottom: 24rpx;
+				text-align: justify;
+
+				&:last-child {
+					margin-bottom: 0;
+				}
+			}
+		}
+	}
+</style>

+ 47 - 51
pages/splash/splash.vue

@@ -3,7 +3,7 @@
 		<!-- 背景装饰 -->
 		<!-- 背景装饰 -->
 		<view class="splash-bg-1"></view>
 		<view class="splash-bg-1"></view>
 		<view class="splash-bg-2"></view>
 		<view class="splash-bg-2"></view>
-		
+
 		<!-- Logo 区域 -->
 		<!-- Logo 区域 -->
 		<view class="logo-section">
 		<view class="logo-section">
 			<view class="logo-wrapper">
 			<view class="logo-wrapper">
@@ -42,14 +42,13 @@
 		onMounted
 		onMounted
 	} from 'vue'
 	} from 'vue'
 	import {
 	import {
-		isLogin,
-		getToken,
-		saveUserInfo,
-		clearUserInfo
+		isLogin
 	} from '@/utils/userCache.js'
 	} from '@/utils/userCache.js'
 	import {
 	import {
-		getUserInfo as fetchUserInfo
-	} from '@/api/login.js'
+		useUserStore
+	} from '@/store/modules/user.js'
+
+	const userStore = useUserStore() || null
 	import {
 	import {
 		getCurrentConfig
 		getCurrentConfig
 	} from '@/config/index.js'
 	} from '@/config/index.js'
@@ -59,7 +58,7 @@
 	// 页面加载
 	// 页面加载
 	onMounted(async () => {
 	onMounted(async () => {
 		const config = await getCurrentConfig()
 		const config = await getCurrentConfig()
-		console.log(config,"configconfigconfigconfig");
+		console.log(config, "configconfigconfigconfig");
 		appName.value = config.appName
 		appName.value = config.appName
 		version.value = config.appVersion
 		version.value = config.appVersion
 		initApp()
 		initApp()
@@ -72,52 +71,33 @@
 		try {
 		try {
 			// 模拟加载延迟(提升用户体验)
 			// 模拟加载延迟(提升用户体验)
 			await sleep(500)
 			await sleep(500)
-
 			loadingText.value = '检查登录状态...'
 			loadingText.value = '检查登录状态...'
-
-			// 获取本地 token
-			const token = getToken()
-			
 			// 如果没有 token,直接跳转登录页
 			// 如果没有 token,直接跳转登录页
-			if (!token) {
+			const loginToggle = isLogin()
+			if (!loginToggle) {
 				console.log('未登录,token 不存在')
 				console.log('未登录,token 不存在')
 				await sleep(800)
 				await sleep(800)
 				uni.reLaunch({
 				uni.reLaunch({
-					url: '/pages/index/index'
+					url: '/pages/login/login'
 				})
 				})
 				return
 				return
 			}
 			}
-			
-			// 调用 getUserInfo 接口验证 token
-			const res = await fetchUserInfo({})
-			
-			if (res.code === 200) {
-				// token 有效,更新用户信息
-				const userInfo = res.data || res
-				saveUserInfo(userInfo, token)
-				console.log('登录态有效,用户信息已更新')
-				// 延迟跳转,让动画更流畅
-				await sleep(500)
-				// 已登录,跳转首页
+			if (loginToggle) {
+				await userStore.queryCardInfo()
+				await userStore.queryCompanyInfo()
 				uni.reLaunch({
 				uni.reLaunch({
 					url: '/pages/index/index'
 					url: '/pages/index/index'
 				})
 				})
 			} else {
 			} else {
-				// token 失效,清除本地存储
-				console.log('登录凭证失效,需要重新登录')
 				clearUserInfo()
 				clearUserInfo()
 				await sleep(800)
 				await sleep(800)
-				// 跳转登录页
 				uni.reLaunch({
 				uni.reLaunch({
 					url: '/pages/login/login'
 					url: '/pages/login/login'
 				})
 				})
 			}
 			}
 		} catch (error) {
 		} catch (error) {
 			console.error('验证登录态失败:', error)
 			console.error('验证登录态失败:', error)
-			// 接口调用失败,也视为 token 失效
 			clearUserInfo()
 			clearUserInfo()
-			
-			// 出错时跳转到登录页
 			uni.reLaunch({
 			uni.reLaunch({
 				url: '/pages/login/login'
 				url: '/pages/login/login'
 			})
 			})
@@ -144,25 +124,25 @@
 		align-items: center;
 		align-items: center;
 		justify-content: center;
 		justify-content: center;
 		padding: 0 40rpx;
 		padding: 0 40rpx;
-		
+
 		.splash-bg-1 {
 		.splash-bg-1 {
 			position: absolute;
 			position: absolute;
 			top: -20%;
 			top: -20%;
 			left: -10%;
 			left: -10%;
 			width: 60%;
 			width: 60%;
 			height: 60%;
 			height: 60%;
-			background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
+			background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
 			border-radius: 50%;
 			border-radius: 50%;
 			animation: floatBg1 8s ease-in-out infinite;
 			animation: floatBg1 8s ease-in-out infinite;
 		}
 		}
-		
+
 		.splash-bg-2 {
 		.splash-bg-2 {
 			position: absolute;
 			position: absolute;
 			bottom: -20%;
 			bottom: -20%;
 			right: -10%;
 			right: -10%;
 			width: 70%;
 			width: 70%;
 			height: 70%;
 			height: 70%;
-			background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
+			background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
 			border-radius: 50%;
 			border-radius: 50%;
 			animation: floatBg2 10s ease-in-out infinite;
 			animation: floatBg2 10s ease-in-out infinite;
 		}
 		}
@@ -176,7 +156,7 @@
 		margin-bottom: 120rpx;
 		margin-bottom: 120rpx;
 		position: relative;
 		position: relative;
 		z-index: 10;
 		z-index: 10;
-		
+
 		.logo-wrapper {
 		.logo-wrapper {
 			position: relative;
 			position: relative;
 			width: 240rpx;
 			width: 240rpx;
@@ -184,7 +164,7 @@
 			display: flex;
 			display: flex;
 			align-items: center;
 			align-items: center;
 			justify-content: center;
 			justify-content: center;
-			
+
 			.logo-glow {
 			.logo-glow {
 				position: absolute;
 				position: absolute;
 				top: 50%;
 				top: 50%;
@@ -192,18 +172,18 @@
 				transform: translate(-50%, -50%);
 				transform: translate(-50%, -50%);
 				width: 280rpx;
 				width: 280rpx;
 				height: 280rpx;
 				height: 280rpx;
-				background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
+				background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
 				border-radius: 50%;
 				border-radius: 50%;
 				animation: logoGlow 3s ease-in-out infinite;
 				animation: logoGlow 3s ease-in-out infinite;
 			}
 			}
-			
+
 			.logo-icon {
 			.logo-icon {
 				width: 200rpx;
 				width: 200rpx;
 				height: 200rpx;
 				height: 200rpx;
 				border-radius: 44rpx;
 				border-radius: 44rpx;
 				background: rgba(255, 255, 255, 0.95);
 				background: rgba(255, 255, 255, 0.95);
 				box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15),
 				box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15),
-							0 0 40rpx rgba(255, 255, 255, 0.3);
+					0 0 40rpx rgba(255, 255, 255, 0.3);
 				display: flex;
 				display: flex;
 				align-items: center;
 				align-items: center;
 				justify-content: center;
 				justify-content: center;
@@ -252,7 +232,7 @@
 			border-radius: 40rpx;
 			border-radius: 40rpx;
 			backdrop-filter: blur(10rpx);
 			backdrop-filter: blur(10rpx);
 			box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
 			box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
-			
+
 			.loading-dots {
 			.loading-dots {
 				display: flex;
 				display: flex;
 				justify-content: center;
 				justify-content: center;
@@ -312,19 +292,25 @@
 
 
 	// 动画
 	// 动画
 	@keyframes logoFloat {
 	@keyframes logoFloat {
-		0%, 100% {
+
+		0%,
+		100% {
 			transform: translateY(0) scale(1);
 			transform: translateY(0) scale(1);
 		}
 		}
+
 		50% {
 		50% {
 			transform: translateY(-15rpx) scale(1.02);
 			transform: translateY(-15rpx) scale(1.02);
 		}
 		}
 	}
 	}
-	
+
 	@keyframes logoGlow {
 	@keyframes logoGlow {
-		0%, 100% {
+
+		0%,
+		100% {
 			opacity: 0.5;
 			opacity: 0.5;
 			transform: translate(-50%, -50%) scale(1);
 			transform: translate(-50%, -50%) scale(1);
 		}
 		}
+
 		50% {
 		50% {
 			opacity: 0.8;
 			opacity: 0.8;
 			transform: translate(-50%, -50%) scale(1.1);
 			transform: translate(-50%, -50%) scale(1.1);
@@ -332,29 +318,39 @@
 	}
 	}
 
 
 	@keyframes loadingDot {
 	@keyframes loadingDot {
-		0%, 80%, 100% {
+
+		0%,
+		80%,
+		100% {
 			transform: scale(0.8);
 			transform: scale(0.8);
 			opacity: 0.4;
 			opacity: 0.4;
 		}
 		}
+
 		40% {
 		40% {
 			transform: scale(1.2);
 			transform: scale(1.2);
 			opacity: 1;
 			opacity: 1;
 		}
 		}
 	}
 	}
-	
+
 	@keyframes floatBg1 {
 	@keyframes floatBg1 {
-		0%, 100% {
+
+		0%,
+		100% {
 			transform: translate(0, 0) scale(1);
 			transform: translate(0, 0) scale(1);
 		}
 		}
+
 		50% {
 		50% {
 			transform: translate(30rpx, -30rpx) scale(1.05);
 			transform: translate(30rpx, -30rpx) scale(1.05);
 		}
 		}
 	}
 	}
-	
+
 	@keyframes floatBg2 {
 	@keyframes floatBg2 {
-		0%, 100% {
+
+		0%,
+		100% {
 			transform: translate(0, 0) scale(1);
 			transform: translate(0, 0) scale(1);
 		}
 		}
+
 		50% {
 		50% {
 			transform: translate(-30rpx, 30rpx) scale(1.08);
 			transform: translate(-30rpx, 30rpx) scale(1.08);
 		}
 		}

+ 34 - 65
store/modules/user.js

@@ -1,71 +1,40 @@
 /**
 /**
  * 用户状态管理
  * 用户状态管理
  */
  */
-import { defineStore } from 'pinia'
-import { ref, computed } from 'vue'
+import {
+	defineStore
+} from 'pinia'
+import {
+	getCardInfo,
+	getCardQrcode,
+	getCompanyInfo
+} from '@/api/card.js'
+
+export const useUserStore = defineStore('user', {
+	state: () => ({
+		userLoc: null
+	}),
+	actions: {
+		// 获取用户卡片信息
+		 queryCardInfo(userId = null) {
+			return new Promise(async(resolve, reject) => {
+				let res = await getCardInfo({
+					userId
+				})
+				console.log(res, "aaaaaaaaaaaaaaaaa");
+				resolve(res.data)
+			})
+		},
+		 queryCompanyInfo(userId = null) {
+			return new Promise(async(resolve, reject) => {
+				let res = await getCompanyInfo({
+					userId
+				})
+				console.log(res, "bbbbbbbbbbbbbbbbbb");
+				resolve(res.data)
+			})
+		},
 
 
-export const useUserStore = defineStore('user', () => {
-	// 状态
-	const token = ref(uni.getStorageSync('token') || '')
-	const userInfo = ref(uni.getStorageSync('userInfo') || null)
-
-	// 计算属性
-	const isLoggedIn = computed(() => !!token.value)
-	const userName = computed(() => userInfo.value?.name || '')
-	const userAvatar = computed(() => userInfo.value?.avatar || '')
-
-	// 设置 token
-	const setToken = (newToken) => {
-		token.value = newToken
-		uni.setStorageSync('token', newToken)
-	}
-
-	// 设置用户信息
-	const setUserInfo = (info) => {
-		userInfo.value = info
-		uni.setStorageSync('userInfo', info)
-	}
-
-	// 登录成功
-	const loginSuccess = (data) => {
-		if (data.token) {
-			setToken(data.token)
-		}
-		if (data.userInfo) {
-			setUserInfo(data.userInfo)
-		}
 	}
 	}
 
 
-	// 退出登录
-	const logout = () => {
-		token.value = ''
-		userInfo.value = null
-		uni.removeStorageSync('token')
-		uni.removeStorageSync('userInfo')
-	}
-
-	// 更新用户信息
-	const updateUserInfo = (info) => {
-		userInfo.value = {
-			...userInfo.value,
-			...info
-		}
-		uni.setStorageSync('userInfo', userInfo.value)
-	}
-
-	return {
-		// 状态
-		token,
-		userInfo,
-		// 计算属性
-		isLoggedIn,
-		userName,
-		userAvatar,
-		// 方法
-		setToken,
-		setUserInfo,
-		loginSuccess,
-		logout,
-		updateUserInfo
-	}
-})
+})

+ 21 - 46
utils/userCache.js

@@ -1,18 +1,13 @@
 /**
 /**
  * 用户缓存管理
  * 用户缓存管理
  */
  */
-
-const USER_INFO_KEY = 'userInfo'
 const TOKEN_KEY = 'token'
 const TOKEN_KEY = 'token'
-
 /**
 /**
- * 保存用户信息和 token
- * @param {object} userInfo - 用户信息对象
+ * 保存 token
  * @param {string} token - 登录 token
  * @param {string} token - 登录 token
  */
  */
-export const saveUserInfo = (userInfo, token) => {
+export const saveToekn = ( token) => {
 	try {
 	try {
-		uni.setStorageSync(USER_INFO_KEY, userInfo)
 		uni.setStorageSync(TOKEN_KEY, token)
 		uni.setStorageSync(TOKEN_KEY, token)
 		return true
 		return true
 	} catch (e) {
 	} catch (e) {
@@ -20,16 +15,12 @@ export const saveUserInfo = (userInfo, token) => {
 		return false
 		return false
 	}
 	}
 }
 }
-
-/**
- * 获取用户信息
- * @returns {object|null} 用户信息对象,如果没有则返回 null
- */
-export const getUserInfo = () => {
+// 获取token
+export const getToken = () => {
 	try {
 	try {
-		const userInfo = uni.getStorageSync(USER_INFO_KEY)
-		if (userInfo) {
-			return userInfo
+		const token = uni.getStorageSync(TOKEN_KEY)
+		if (token) {
+			return token
 		}
 		}
 		return null
 		return null
 	} catch (e) {
 	} catch (e) {
@@ -38,18 +29,18 @@ export const getUserInfo = () => {
 	}
 	}
 }
 }
 
 
-/**
- * 获取 token
- * @returns {string} token 字符串
- */
-export const getToken = () => {
-	try {
-		return uni.getStorageSync(TOKEN_KEY) || ''
-	} catch (e) {
-		console.error('获取 token 失败', e)
-		return ''
-	}
-}
+ /**
+  * 清除用户信息(退出登录)
+  */
+ export const clearUserInfo = () => {
+ 	try {
+ 		uni.removeStorageSync(TOKEN_KEY)
+ 		return true
+ 	} catch (e) {
+ 		console.error('清除用户信息失败', e)
+ 		return false
+ 	}
+ }
 
 
 /**
 /**
  * 检查是否已登录
  * 检查是否已登录
@@ -59,25 +50,9 @@ export const isLogin = () => {
 	const token = getToken()
 	const token = getToken()
 	return !!token
 	return !!token
 }
 }
-
-/**
- * 清除用户信息(退出登录)
- */
-export const clearUserInfo = () => {
-	try {
-		uni.removeStorageSync(USER_INFO_KEY)
-		uni.removeStorageSync(TOKEN_KEY)
-		return true
-	} catch (e) {
-		console.error('清除用户信息失败', e)
-		return false
-	}
-}
-
 export default {
 export default {
-	saveUserInfo,
-	getUserInfo,
+	clearUserInfo,
+	saveToekn,
 	getToken,
 	getToken,
 	isLogin,
 	isLogin,
-	clearUserInfo
 }
 }