Ver Fonte

feat(edit):个人信息修改接口对接
feat(pwdEdit):修改密码接口对接
defact(mine):个人中心页面样式修改
feat(attachmentList):新增附件组件

HMY há 1 ano atrás
pai
commit
a5b6b48d76

+ 45 - 3
api/mine.js

@@ -16,7 +16,10 @@ export function getUserInfo(useId) {
 }
 
 //检查今日考勤状况
-export function CheckAttendance({ universalid, rizi }) {
+export function checkAttendance({
+	universalid,
+	rizi
+}) {
 	return request({
 		url: preUrl,
 		method: 'post',
@@ -31,7 +34,11 @@ export function CheckAttendance({ universalid, rizi }) {
 }
 
 //获取我的考勤数据统计
-export function getMyTotalCount({ staffId, start_date, end_date }) {
+export function getMyTotalCount({
+	staffId,
+	start_date,
+	end_date
+}) {
 	return request({
 		url: preUrl,
 		method: 'post',
@@ -59,10 +66,45 @@ export function createAttendance(params) {
 }
 
 // 经纬度转地址
-export function TranAddress(locationStr) {
+export function tranAddress(locationStr) {
 	return request({
 		baseUrl: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + locationStr + '&key=' + config.mapKey +
 			'&get_poi=1',
 		method: 'GET'
 	})
+}
+
+//修改个人信息
+export function modifyMe(params) {
+	return request({
+		url: preUrl,
+		method: 'post',
+		data: {
+			serviceId: 'eu_2013V01modifyMe',
+			params: {
+				staffId: params.staffId,
+				qq: params.qq,
+				msn: params.msn,
+				// birthday: params.birthday,
+				// sex: params.sex,
+				// mail: params.mail,
+				// desktopPhone: params.desktopPhone
+			}
+		}
+	})
+}
+
+export function changePWD(params) {
+	return request({
+		url: preUrl,
+		method: 'post',
+		data: {
+			serviceId: 'eu_2013V01ChangePWD',
+			params: {
+				staffId: params.staffId,
+				oldpassword: params.oldpassword,
+				newpassword: params.newpassword,
+			}
+		}
+	})
 }

+ 57 - 0
components/ygoa/attachmentList.vue

@@ -0,0 +1,57 @@
+<template>
+	<view class="message_attachment">
+		<uni-section class="mb-10" title="附件" type="line">
+		</uni-section>
+		<uni-row :gutter="0">
+			<uni-col v-for="(attachment, index) in attachments" :key="index" :xs="{span: 24}" :sm="6">
+				<view class="attachment">
+					<text @click="seeAttachment(attachment.path)">{{ attachment.fileName || '空' }}</text>
+				</view>
+			</uni-col>
+		</uni-row>
+	</view>
+</template>
+
+<script setup lang="ts">
+	import $tab from '@/plugins/tab';
+	import { onMounted, ref } from 'vue';
+
+
+	onMounted(() => {
+		startAttachmentCheck();
+	})
+	const intervalId = ref(null); // 定时器ID
+
+	// TODO: 根据接口返回的数据动态生成process表单
+	// const props = defineProps(['attachments'])
+	const props = defineProps({
+		attachments: {
+			type: Array,
+			required: true,
+			default: []
+		}
+	})
+	//检查附件列表是否有数据
+	function startAttachmentCheck() {
+		intervalId.value = setInterval(() => {
+			console.log(111);
+			if (props.attachments) {
+				console.log('props', props.attachments);
+				clearInterval(intervalId.value); // 清除定时器    
+			}
+		}, 100); // 每0.1秒检查一次
+	}
+
+	//预览文件
+	function seeAttachment(path) {
+		// console.log('path',path);
+		$tab.navigateTo('/pages/message/detail/URLView?type=doc&url=' + encodeURIComponent(path));
+	}
+</script>
+
+<style lang="scss">
+	.attachment {
+		color: blue;
+		margin-left: 5px;
+	}
+</style>

+ 37 - 31
pages/message/detail/index.vue

@@ -13,33 +13,39 @@
 						<u-parse :content="msgInfo.content" :selectable="true" @navigate="parseNavigate">
 						</u-parse>
 					</view>
-					<view class="message_attachment">
+					<view>
+						<attachment-list :attachments="attachments"></attachment-list>
+					</view>
+					<!-- <view class="message_attachment">
+						<uni-section class="mb-10" title="附件" type="line">
+
+						</uni-section>
 						<uni-row :gutter="0">
-							附件: 
 							<uni-col v-for="(attachment, index) in attachments" :key="index" :xs="{span: 24}" :sm="6">
-								<view class="attachment" >
-									<text @click="seeAttachment(attachment.path)">{{ attachment.fileName || '空' }}</text>
+								<view class="attachment">
+									<text
+										@click="seeAttachment(attachment.path)">{{ attachment.fileName || '空' }}</text>
+								</view>
+							</uni-col>
+						</uni-row>
+					</view> -->
+
+					<view class="message_info">
+						<uni-row :gutter="20">
+							<uni-col :xs="{span: 24}" :sm="{span: 16, offset: 1}">
+								<view class="user">
+									<text class="user_pre">发布者:</text>
+									{{msgInfo.name}}
+								</view>
+							</uni-col>
+							<uni-col :xs="{span: 24}" :sm="6">
+								<view class="time">
+									发布时间:{{msgInfo.sendTime}}
 								</view>
 							</uni-col>
 						</uni-row>
 					</view>
-					
-						<view class="message_info">
-							<uni-row :gutter="20">
-								<uni-col :xs="{span: 24}" :sm="{span: 16, offset: 1}">
-									<view class="user">
-										<text class="user_pre">发布者:</text>
-										{{msgInfo.name}}
-									</view>
-								</uni-col>
-								<uni-col :xs="{span: 24}" :sm="6">
-									<view class="time">
-										发布时间:{{msgInfo.sendTime}}
-									</view>
-								</uni-col>
-							</uni-row>
-						</view>
-					
+
 				</uni-card>
 			</view>
 		</uni-card>
@@ -55,7 +61,7 @@
 	import uParse from '@/components/gaoyia-parse/parse.vue'
 	import { GetNoticeInfo, GetMessageInfo } from '@/api/message';
 	import { useUserStore } from '@/store/user';
-
+import attachmentList from '@/components/ygoa/attachmentList.vue'
 	const userStore = useUserStore();
 	const type = ref(-1);
 	const noticeId = ref('');
@@ -122,11 +128,11 @@
 		})
 	}
 	//预览文件
-	function seeAttachment(path){
-		// console.log('path',path);
-		$tab.navigateTo('./URLView?type=doc&url=' + encodeURIComponent(path));
-	}
-	
+	// function seeAttachment(path) {
+	// 	// console.log('path',path);
+	// 	$tab.navigateTo('./URLView?type=doc&url=' + encodeURIComponent(path));
+	// }
+
 	onMounted(() => {
 		switch (type.value) {
 			case 0:
@@ -171,16 +177,16 @@
 				.time {
 					// font-size: 1rem;
 				}
-				
+
 			}
 
-			.message_attachment{
-				.attachment{
+			.message_attachment {
+				.attachment {
 					color: blue;
 					margin-left: 5px;
 				}
 			}
-			
+
 		}
 	}
 </style>

+ 79 - 51
pages/mine/edit/edit.vue

@@ -1,39 +1,51 @@
 <template>
 	<view class="container">
 		<!-- 手机号码输入框 -->
-		<view class="input-group">
+		<!-- <view class="input-group">
 			<text>手机号码:</text>
-			<input type="number" maxlength="11" v-model="userInfo.phone" placeholder="请输入手机号码" />
-		</view>
+			<input type="number" maxlength="11" v-model="userInfo.desktopPhone" placeholder="请输入手机号码" />
+		</view> -->
 
 		<!-- 邮箱输入框 -->
-		<view class="input-group">
+		<!-- <view class="input-group">
 			<text>邮箱:</text>
-			<input type="text" v-model="userInfo.email" placeholder="请输入邮箱地址" />
+			<input type="text" v-model="userInfo.mail" placeholder="请输入邮箱地址" />
+		</view> -->
+		
+		<!-- qq输入框 -->
+		<view class="input-group">
+			<text>qq:</text>
+			<input type="text" v-model="userInfo.qq" placeholder="请输入qq" />
+		</view>
+		
+		<!-- msn输入框 -->
+		<view class="input-group">
+			<text>msn:</text>
+			<input type="text" v-model="userInfo.msn" placeholder="请输入msn" />
 		</view>
 
 		<!-- 用户生日输入框 -->
-		<view class="input-group">
+		<!-- <view class="input-group">
 			<text>用户生日:</text>
 			<view class="example-body">
 				<uni-datetime-picker type="date" :clear-icon="false" v-model="userInfo.birthday" @maskClick="maskClick" />
 			</view>
-		</view>
+		</view> -->
 		
 		<!-- 性别选择器 -->
-		<view class="gender-selector">
+		<!-- <view class="sex-selector">
 			<radio-group @change="handleGenderChange">
 				<text>性别:</text>
-				<view class="genderLabel">
+				<view class="sexLabel">
 					<label>
-						<radio value="male" :checked="userInfo.gender === 'male' " />男
+						<radio value="M" :checked="userInfo.sex === 'M' " />男
 					</label>
 					<label>
-						<radio value="female" :checked="userInfo.gender === 'female'" />女
+						<radio value="F" :checked="userInfo.sex === 'F'" />女
 					</label>
 				</view>
 			</radio-group>
-		</view>
+		</view> -->
 
 		<!-- 提交按钮 -->
 		<view class="primaryBtn">
@@ -45,54 +57,70 @@
 <script setup>
 	import {
 		ref,
-		reactive
+		reactive,
+		onMounted
 	} from 'vue';
+	import { useUserStore } from '@/store/user';
+	import { ModifyMe } from '@/api/mine';
+	import $modal from '@/plugins/modal.js'
 	// 定义用户信息的响应式对象
-	const userInfo = reactive({
-		phone: '13145672389',
-		email: '',
-		gender: 'male',
-		birthday: '2000-01-10'
+	const thisUser=useUserStore().user;
+	let userInfo = reactive({
+		staffId:thisUser.useId,
+		// desktopPhone: thisUser.desktopPhone,
+		// mail: thisUser.email,
+		// sex: thisUser.sex,
+		// birthday: thisUser.birthday,
+		qq:thisUser.qqnum,
+		msn:thisUser.msnnum
 	});
 	
-	function handleGenderChange(event) {
-		userInfo.gender = event.detail.value; // 更新性别
-	};
 	
-	// 校验手机号码格式
-	function validatePhone(phone) {
-		const phoneRegex = /^1[3-9]\d{9}$/; // 手机号码格式正则(以1开头,11位数字)
-		return phoneRegex.test(phone);
-	}
+	// function handleGenderChange(event) {
+	// 	userInfo.sex = event.detail.value; // 更新性别
+	// };
+	
+	// // 校验手机号码格式
+	// function validatePhone(desktopPhone) {
+	// 	const desktopPhoneRegex = /^1[3-9]\d{9}$/; // 手机号码格式正则(以1开头,11位数字)
+	// 	return desktopPhoneRegex.test(desktopPhone);
+	// }
 
-	// 校验邮箱格式
-	function validateEmail(email) {
-		const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; // 邮箱格式正则
-		return emailRegex.test(email);
-	}
+	// // 校验邮箱格式
+	// function validateEmail(mail) {
+	// 	const mailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; // 邮箱格式正则
+	// 	return mailRegex.test(mail);
+	// }
 
 	// 处理提交事件
 	function handleSubmit() {
-		if (!validatePhone(userInfo.phone)) {
-			uni.showToast({
-				title: '手机号码格式不正确',
-				icon: 'none'
-			});
-			return; // 终止提交
-		}
+		// if (!validatePhone(userInfo.desktopPhone)) {
+		// 	uni.showToast({
+		// 		title: '手机号码格式不正确',
+		// 		icon: 'none'
+		// 	});
+		// 	return; // 终止提交
+		// }
 		
-		if (!validateEmail(userInfo.email)) {
-			uni.showToast({
-				title: '邮箱格式不正确',
-				icon: 'none'
-			});
-			return; // 终止提交
-		}
+		// if (!validateEmail(userInfo.mail)) {
+		// 	uni.showToast({
+		// 		title: '邮箱格式不正确',
+		// 		icon: 'none'
+		// 	});
+		// 	return; // 终止提交
+		// }
+		ModifyMe(userInfo).then(res=>{
+			// console.log(res);
+			if("success"==res.returnMsg){
+				$modal.showToast('修改成功');
+				useUserStore().GetInfo().then(res=>{
+					console.log("GetInfo",res);
+				})
+			}
+			
+		})
 
-		uni.showToast({
-			title: '提交成功',
-			icon: 'none'
-		});
+		
 	}
 
 </script>
@@ -107,7 +135,7 @@
 	}
 
 	.input-group input,
-	.genderLabel {
+	.sexLabel {
 		padding-left: 20rpx;
 		margin: 20rpx auto;
 		height: 70rpx;
@@ -123,7 +151,7 @@
 		margin-bottom: 20rpx;
 	}
 
-	.gender-selector label {
+	.sex-selector label {
 		margin-right: 15rpx;
 	}
 

+ 36 - 14
pages/mine/index.vue

@@ -25,11 +25,11 @@
 						</view>
 					</view>
 					<view>
-						<text> 职务: {{ userInfo.positionName }}</text>
+						<text> 职务: {{ userInfo.positionName ||'暂无'}}</text>
 					</view>
 
 				</view>
-				<uni-icons @click="lookMsg()" type="forward" size="50" style="margin-right: 30rpx;"></uni-icons>
+				<uni-icons @click="lookMsg()" type="forward" size="16" style="margin-right: 30rpx;"></uni-icons>
 			</view>
 		</uni-card>
 
@@ -77,7 +77,9 @@
 
 	import headImg from "@/static/images/mine/headImg.jpg"
 	import $tab from "@/plugins/tab.js"
-	import { useUserStore } from '@/store/user.js'
+	import {
+		useUserStore
+	} from '@/store/user.js'
 	const userStore = useUserStore()
 	const userInfo = ref({})
 	onMounted(() => {
@@ -127,11 +129,12 @@
 
 <style lang="scss">
 	@import "@/static/font/ygoa/iconfont.css";
-	
-	.ygoa-icon{
+
+	.ygoa-icon {
 		margin-right: 20rpx;
 		font-size: 50rpx;
 	}
+
 	.content {
 		display: flex;
 		flex-direction: column;
@@ -142,7 +145,8 @@
 		display: flex;
 		align-items: center;
 		padding: 20rpx;
-		border-bottom: 1rpx solid #ddd;
+		border-bottom: 1rpx solid #666;
+		color: #777;
 	}
 
 
@@ -154,11 +158,13 @@
 
 	.info-detail {
 		flex-grow: 1;
-		font-size: 28rpx;
+		font-size: 18px;
+		text-align: center;
 	}
 
 	.name {
 		padding: 15rpx 0;
+		color: #333;
 	}
 
 
@@ -181,11 +187,11 @@
 
 	.title {
 		flex-grow: 1;
-		font-size: 32rpx;
+		font-size: 16px;
 	}
 
 	.desc {
-		color: #999;
+		color: #777;
 		margin-right: 20rpx;
 	}
 
@@ -199,9 +205,20 @@
 		text-align: center;
 	}
 
+	.info-detail text {
+		font-size: 18px;
+	}
+
 	//样式穿透
+	::v-deep .uni-list-cell {
+		justify-content: center;
+	}
+
 	::v-deep .uni-list-cell-left {
 		padding: 0 0;
+		font-size: 18px;
+		color: #333;
+		flex: none;
 	}
 
 	::v-deep .uni-list-cell::after {
@@ -210,11 +227,16 @@
 
 	::v-deep .uni-input {
 		padding: 15rpx 8rpx;
-		text-decoration: underline; /* 给文字添加下划线 */
-		text-decoration-color: blue;
+		text-decoration: underline;
+		/* 给文字添加下划线 */
+		color: blue;
+		font-size: 18px;
+		// text-decoration-color: blue;
 	}
-	
-	::v-deep .uni-list-cell-db picker{
-		width: 100px;
+
+
+	::v-deep .uni-list-cell-db,
+	.uni-list-cell-right {
+		flex: none;
 	}
 </style>

+ 45 - 39
pages/mine/setting/pwdEdit/pwdEdit.vue

@@ -2,24 +2,21 @@
 	<view class="container">
 		<!-- 旧密码输入框 -->
 		<view class="uni-input-wrapper">
-			<input class="uni-input" placeholder="请输入旧密码" :password="showPassword1" 
-			v-model="oldPassword" />
+			<input class="uni-input" placeholder="请输入旧密码" :password="showPassword1" v-model="oldPassword" />
 			<text class="uni-icon" :class="[!showPassword1 ? 'uni-eye-active' : '']"
 				@click="changePassword1">&#xe568;</text>
 		</view>
-		
+
 		<!-- 新密码输入框 -->
 		<view class="uni-input-wrapper">
-			<input class="uni-input" placeholder="请输入新密码" :password="showPassword2" 
-			v-model="newPassword" />
+			<input class="uni-input" placeholder="请输入新密码" :password="showPassword2" v-model="newPassword" />
 			<text class="uni-icon" :class="[!showPassword2 ? 'uni-eye-active' : '']"
 				@click="changePassword2">&#xe568;</text>
 		</view>
-		
+
 		<!-- 确认新密码输入框 -->
 		<view class="uni-input-wrapper">
-			<input class="uni-input" placeholder="请确认新密码" :password="showPassword3" 
-			v-model="confirmPassword" />
+			<input class="uni-input" placeholder="请确认新密码" :password="showPassword3" v-model="confirmPassword" />
 			<text class="uni-icon" :class="[!showPassword3 ? 'uni-eye-active' : '']"
 				@click="changePassword3">&#xe568;</text>
 		</view>
@@ -30,46 +27,59 @@
 </template>
 
 <script setup>
-	import { ref } from 'vue';
-	
+	import {
+		ref
+	} from 'vue';
+	import $modal from '@/plugins/modal.js'
+	import {
+		ChangePWD
+	} from '@/api/mine';
+	import {
+		useUserStore
+	} from '@/store/user';
+	import $tab from '@/plugins/tab.js'
+	const userStore = useUserStore();
 	const oldPassword = ref(''); // 旧密码
 	const newPassword = ref(''); // 新密码
 	const confirmPassword = ref(''); // 确认新密码
 	const showPassword1 = ref(true); // 旧密码可见性
 	const showPassword2 = ref(true); // 新密码可见性
 	const showPassword3 = ref(true); // 确认密码可见性
-	
+
 	// 提交逻辑
 	function submit() {
 		// 检查新密码和确认密码是否一致
 		if (newPassword.value !== confirmPassword.value) {
-			uni.showToast({
-				title: '新密码和确认密码不一致',
-				icon: 'none'
-			});
+			$modal.showToast('新密码和确认密码不一致')
 			return; // 终止提交
 		}
-		
+
 		// 检查新密码强度
 		if (!validatePassword(newPassword.value)) {
-			uni.showToast({
-				title: '新密码必须包含至少8个字符、一个大写字母、一个小写字母和一个数字',
-				icon: 'none'
-			});
+			$modal.showToast('新密码必须包含至少6个字符、包含字母和数字')
 			return; // 终止提交
 		}
 
 		// 通过校验后,提示提交成功
-		uni.showToast({
-			title: '提交成功',
-			icon: 'none'
-		});
+		const params = {
+			staffId: userStore.user.useId,
+			oldpassword: oldPassword.value,
+			newpassword: newPassword.value,
+		}
+		ChangePWD(params).then(res => {
+			$modal.showToast(res.returnMsg);
+			if ("1" == res.returnCode) { //修改成功
+				userStore.LogOut().then(() => {
+					$tab.reLaunch('/pages/login')
+				})
+			}
+		})
 	}
 
 	// 校验密码强度
 	function validatePassword(password) {
-		// 密码至少有8个字符,包含大写字母、小写字母和数字
-		const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,}$/;
+		// 密码至少有6个字符,包含字母和数字
+		const passwordRegex = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,}$/;
 		return passwordRegex.test(password);
 	}
 
@@ -77,12 +87,12 @@
 	function changePassword1() {
 		showPassword1.value = !showPassword1.value;
 	}
-	
+
 	// 切换新密码可见性
 	function changePassword2() {
 		showPassword2.value = !showPassword2.value;
 	}
-	
+
 	// 切换确认密码可见性
 	function changePassword3() {
 		showPassword3.value = !showPassword3.value;
@@ -98,12 +108,10 @@
 		margin-bottom: 30rpx;
 	}
 
-	
-
 	button {
 		background-color: #007aff;
 		color: white;
-		padding:  20rpx 40rpx;
+		padding: 20rpx 40rpx;
 		border: none;
 		border-radius: 10rpx;
 		cursor: pointer;
@@ -112,24 +120,22 @@
 	.uni-input-wrapper {
 		display: flex;
 		align-items: center;
-		
-		padding:  20rpx;
-		
-		margin:  20rpx;
-		
+		padding: 20rpx;
+		margin: 20rpx;
+
 	}
 
 
 	.uni-icon {
 		margin-left: 20rpx;
-		
+
 	}
 
 	.uni-eye-active {
 		color: #007aff;
 	}
-	
-	.submitBtn{
+
+	.submitBtn {
 		width: 90%;
 		margin-top: 30rpx;
 	}

+ 5 - 0
pages/mine/setting/setting.vue

@@ -36,6 +36,7 @@
 
 <script setup>
 	import $tab from "@/plugins/tab.js"
+	import { getUserInfo } from '@/utils/auth'
 	import { useUserStore } from '@/store/user.js'
 	const userStore = useUserStore()
 	// 退出登录
@@ -60,7 +61,11 @@
 			content: '是否确定要清理缓存?',
 			success: function(res) {
 				if (res.confirm) {
+					const userInfo = getUserInfo()
 					uni.clearStorageSync();
+					uni.setStorageSync('userInfo', userInfo)
+					userStore.user = userInfo
+					userStore.useId = userInfo.useId
 					// 提示用户缓存清理成功
 					uni.showToast({
 						title: '缓存清理成功',

+ 2 - 0
pages/work/index.vue

@@ -199,6 +199,8 @@ function clearCache() {
 	const userInfo = getUserInfo()
 	uni.clearStorageSync();
 	uni.setStorageSync('userInfo', userInfo)
+	userStore.user = userInfo
+	userStore.useId = userInfo.useId
 	// 提示用户缓存清理成功
 	uni.showToast({
 		title: '缓存清理成功',

+ 2 - 0
store/user.js

@@ -52,6 +52,7 @@ export const useUserStore = defineStore('user', () => {
 		return new Promise((resolve, reject) => {
 			// logout().then(() => {
 			user.value = {}
+			useId.value = 0
 			uni.clearStorageSync()
 			resolve()
 		}).catch(error => {
@@ -62,6 +63,7 @@ export const useUserStore = defineStore('user', () => {
 
 	return {
 		user,
+		useId,
 		Login,
 		GetInfo,
 		LogOut

+ 2 - 2
uni_modules/atl-map/components/atl-map/atl-map.vue

@@ -19,7 +19,7 @@
 </template>
 
 <script>
-	import amap from '../amap/amap.vue';
+	// import amap from '../amap/amap.vue';
 	import tmap from '../tmap/tmap.vue';
 	// import bmap from '../bmap/bmap.vue';
 
@@ -69,7 +69,7 @@
 			}
 		},
 		components: {
-			amap,
+			// amap,
 			tmap,
 			// bmap
 		},