lyuis 7 月之前
父節點
當前提交
ce153d84ef
共有 3 個文件被更改,包括 654 次插入1 次删除
  1. 7 0
      pages.json
  2. 14 1
      pages/my/index.vue
  3. 633 0
      pages/my/setup.vue

+ 7 - 0
pages.json

@@ -345,6 +345,13 @@
 				"navigationStyle": "custom"
 			}
 		},
+		{
+			"path": "pages/my/setup",
+			"style": {
+				"navigationBarTitleText": "设置",
+				"navigationStyle": "custom"
+			}
+		},
 		{
 			"path": "pages/my/ruleCenter",
 			"style": {

+ 14 - 1
pages/my/index.vue

@@ -14,7 +14,7 @@
 						v-if="token && XCXIsSelect != '否'">
 						<image src="@/static/images/jobApplicant/qiehuan.svg" mode="scaleToFill"
 							style="margin-top: 40rpx;margin-right:30rpx" @click="goNav('switchRoles')" />
-						<u-icon @click="goNav('/pages/my/userinfo')" color="#ffffff" top="16rpx" size="34rpx" name="setting"></u-icon>
+						<u-icon @click="goNav('/pages/my/setup')" color="#ffffff" top="16rpx" size="34rpx" name="setting"></u-icon>
 						<!-- <image
               src="../../static/images/my/icon/selectUser.png"
               style="width: 40rpx; height: 100%; margin-right: 40rpx"
@@ -840,6 +840,19 @@
 				}
 				that.$queue.changeTabbar(res.userType)
 			})
+			uni.$on('offLogin',function(res){
+				that.userId = "";
+				that.userType = 1;
+				that.money = 0;
+				that.deliveryCount = 0;
+				that.browseCount = 0;
+				that.collectionCount = 0;
+				that.token = "";
+				that.isLogin = true;
+				that.userName = "登录";
+				that.avatar = "../../static/logo.png";
+				that.isVip = false;
+			})
 		},
 		onUnload(){
 			uni.$off('changeRole')

+ 633 - 0
pages/my/setup.vue

@@ -0,0 +1,633 @@
+<template>
+	<view>
+		<!-- 顶部导航栏 -->
+		<view class="navbar" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
+			<view class="navbar-content">
+				<view class="navbar-left" @click="goBack">
+					<u-icon name="arrow-leftward" size="36" color="#333"></u-icon>
+				</view>
+				<view class="navbar-title">设置</view>
+				<view class="navbar-right"></view>
+			</view>
+		</view>
+
+		<!-- <nav-bar title="基本信息"></nav-bar> -->
+
+		<view class="usermain">
+			
+			<!-- 我的公司 -->
+			<view class="usermain-item item-padding">
+				<view class="usermain-item-title">我的公司</view>
+				<view>
+					<u-icon name="arrow-right"></u-icon>
+				</view>
+			</view>
+			<view class="usermain-item item-padding">
+				<view class="usermain-item-title">我的公司</view>
+				<view>
+					<u-icon name="arrow-right"></u-icon>
+				</view>
+			</view>
+		</view>
+		<view class="footer-btn">
+			<view class="usermain-btn" @click="goOut()">退出</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import configdata from '../../common/config.js';
+	import navBar from "@/components/nav-bar/index.vue";
+	export default {
+		components: {
+			navBar
+		},
+		data() {
+			return {
+				statusBarHeight: 0, // 状态栏高度
+				phone: '',
+				weChatNum:'',//微信号
+				email: '',//接收简历邮箱
+				selectedCompany: '深圳市汉瑞国际猎头服务有限公司', // 我的公司
+				selectedPosition: '人事总监', // 我的职务
+				avatar: '../../static/logo.png',
+				userName: '',
+				nickName: '',
+				userId: '',
+				realName: '',
+				weChatId: "",
+				password: '',
+				platform: '',
+				createTime: '',
+				money: '',
+				jiFen: '',
+				status: '',
+				zhiFuBao: '',
+				zhiFuBaoName: '',
+				sex: 1,
+				age: 0
+			};
+		},
+		computed: {
+			phoneWithMask() {
+				if (this.phone && this.phone.length >= 11) {
+					return this.phone.substring(0, 3) + '******' + this.phone.substring(9);
+				}
+				return this.phone || '请设置手机号';
+			}
+		},
+		onLoad(e) {
+			// 获取状态栏高度
+			let systemInfo = uni.getSystemInfoSync();
+			this.statusBarHeight = systemInfo.statusBarHeight || 0;
+			
+			this.getUserInfo()
+			// this.avatar = uni.getStorageSync('avatar')
+		},
+		methods: {
+			// 返回上一页
+			goBack() {
+				uni.navigateBack();
+			},
+			// 修改手机号
+			modifyPhone() {
+				console.log('点击修改手机号,当前手机号:', this.phone);
+				const url = `/pages/my/userphone?currentPhone=${this.phone}`;
+				console.log('跳转路径:', url);
+				
+				uni.navigateTo({
+					url: url,
+				});
+			},
+			// 选择公司
+			selectCompany() {
+				uni.navigateTo({
+					url: '/pages/my/myCompany'
+				});
+			},
+			// 选择职务
+			selectPosition() {
+				// 这里可以跳转到职务选择页面或显示职务选择弹窗
+				console.log('选择职务');
+			},
+			onChooseAvatar(e) {
+				let that = this;
+				let token = uni.getStorageSync('token');
+				uni.uploadFile({
+					url: that.config("APIHOST1") +
+					'/alioss/upload', //真实的接口地址
+					filePath: e.detail.avatarUrl,
+					header: {
+						token: token
+					},
+					name: 'file',
+					success: uploadFileRes => {
+						let url = JSON.parse(uploadFileRes.data);
+						that.avatar = url.data
+						uni.hideLoading();
+			 	}
+			 });
+
+			},
+			goMyAddress() {
+				uni.navigateTo({
+					url: '../jifen/myaddress'
+				});
+			},
+			uploadImg() {
+				let token = uni.getStorageSync('token')
+
+				if (!token) {
+					this.goLoginInfo();
+					return;
+				}
+				let that = this;
+				var url = null;
+				uni.showActionSheet({
+					// itemList按钮的文字接受的是数组
+					itemList: ["查看头像", "从相册选择图片"],
+					success(e) {
+						var index = e.tapIndex
+						if (index === 0) {
+							// 用户点击了预览当前图片
+							// 可以自己实现当前头像链接的读取
+							let url = that.avatar;
+							let arr = []
+							arr.push(url)
+							uni.previewImage({
+								// 预览功能图片也必须是数组的
+								urls: arr
+							})
+						} else if (index === 1) {
+							uni.chooseImage({
+								count: 1, //默认9
+								sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+								sourceType: ['album'], //从相册选择
+								success: function(res) {
+									uni.showLoading({
+										title: '上传中...'
+									});
+									let token = uni.getStorageSync('token');
+									let userId = uni.getStorageSync('userId');
+									uni.uploadFile({
+										url: that.config("APIHOST1") +
+										'/alioss/upload', //真实的接口地址
+
+										filePath: res.tempFilePaths[0],
+										header: {
+											token: token
+										},
+										name: 'file',
+										success: uploadFileRes => {
+											url = JSON.parse(uploadFileRes.data);
+											that.avatar = url.data
+											uni.hideLoading();
+										}
+									});
+								}
+							});
+						}
+					}
+				})
+			},
+			config: function(name) {
+				var info = null;
+				if (name) {
+					var name2 = name.split("."); //字符分割
+					if (name2.length > 1) {
+						info = configdata[name2[0]][name2[1]] || null;
+					} else {
+						info = configdata[name] || null;
+					}
+					if (info == null) {
+						let web_config = cache.get("web_config");
+						if (web_config) {
+							if (name2.length > 1) {
+								info = web_config[name2[0]][name2[1]] || null;
+							} else {
+								info = web_config[name] || null;
+							}
+						}
+					}
+				}
+				return info;
+			},
+			getUserInfo() {
+				let userId = uni.getStorageSync('userId')
+				this.$Request.get("/app/user/selectUserById").then(res => {
+					if (res.code == 0) {
+						this.$queue.setData('avatar', res.data.avatar);
+						this.$queue.setData('userId', res.data.userId);
+						this.$queue.setData('userName', res.data.userName);
+						this.$queue.setData('phone', res.data.phone);
+						this.$queue.setData('age', res.data.age);
+						this.$queue.setData('weChatNum',res.data.weChatNum)
+						this.weChatNum = res.data.weChatNum
+						this.sex = res.data.sex
+						this.age = res.data.age
+						this.phone = res.data.phone;
+						this.avatar = res.data.avatar;
+						this.userName = res.data.userName;
+						if (this.userName == null) {
+							this.userName = res.data.nickName;
+						} else {
+							this.userName = res.data.userName;
+						}
+					}
+					uni.hideLoading();
+				});
+
+
+			},
+			// 保存
+			messagebtn() {
+				if (!this.userName) {
+					// this.$queue.showToast('用户名不能为空');
+					uni.showToast({
+						title: "用户名不能为空",
+						icon: "none"
+					})
+				} else if (!this.phone) {
+					// this.$queue.showToast('用户名不能为空');
+					uni.showToast({
+						title: "联系电话不能为空",
+						icon: "none"
+					})
+				} else {
+					let that = this
+					uni.showModal({
+						title: '温馨提示',
+						content: '确定保存信息',
+						success: e => {
+							if (e.confirm) {
+								that.$Request.postJson("/app/user/updateUser", {
+									userName: that.userName,
+									avatar: that.avatar,
+									phone: that.phone,
+									sex: that.sex,
+									age: that.age,
+									weChatNum:that.weChatNum
+								}).then(res => {
+									if (res.code === 0) {
+										uni.showToast({
+											title: '保存成功',
+											icon: "none"
+										})
+										that.getUserInfo()
+										setTimeout(function() {
+											uni.navigateBack()
+										}, 1000)
+									} else {
+										uni.showToast({
+											title: res.msg,
+											icon: "none"
+										})
+									}
+								})
+							}
+						}
+					});
+				}
+			},
+			goOut() {
+				let that = this;
+				uni.showModal({
+					title: "提示",
+					content: "确定退出登录吗?",
+					confirmColor: "#016BF6",
+					success: function(res) {
+						if (res.confirm) {
+							console.log("用户点击确定");
+							uni.removeStorageSync("userName");
+							uni.removeStorageSync("avatar");
+							uni.removeStorageSync("userId");
+							uni.removeStorageSync("token");
+							uni.removeStorageSync("phone");
+							uni.removeStorageSync("zhiFuBaoName");
+							uni.removeStorageSync("zhiFuBao");
+							uni.removeStorageSync("invitationCode");
+							uni.removeStorageSync("unionId");
+							uni.removeStorageSync("openId");
+							uni.removeStorageSync("isVIP");
+							uni.removeStorageSync("companyId");
+							// uni.removeStorageSync('userType')
+							uni.setStorageSync("userType", 1);
+							uni.setStorageSync("weixinPhone", false);
+							/* that.userId = "";
+							that.userType = 1;
+							that.money = 0;
+							that.deliveryCount = 0;
+							that.browseCount = 0;
+							that.collectionCount = 0;
+							that.token = ""; */
+							uni.$emit('offLogin')
+							uni.showToast({
+								title: "退出成功!",
+								icon: "none",
+								success() {
+									uni.navigateBack()
+								}
+							});
+							/* that.isLogin = true;
+							that.userName = "登录";
+							that.avatar = "../../static/logo.png";
+							that.isVip = false; */
+							// uni.reLaunch({
+							// 	url: '/pages/public/selectIdentity/selectIdentity'
+							// })
+						} else if (res.cancel) {
+							console.log("用户点击取消");
+						}
+					},
+				});
+			},
+		},
+		// userphone(){
+		// 	uni.navigateTo({
+		// 		url:'/pages/my/userphone'
+		// 	})
+		// }
+
+	};
+</script>
+
+<style lang="scss" scoped>
+	page {
+		/* background: #1c1b20; */
+	}
+
+	.navbar {
+		position: fixed;
+		top: 0;
+		left: 0;
+		right: 0;
+		z-index: 999;
+		background: #fff;
+		padding: 0 0 40rpx 20rpx;
+		
+		.navbar-content {
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			padding: 0 30rpx;
+			height: 60rpx;
+			
+			.navbar-left {
+				width: 60rpx;
+				height: 60rpx;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+			}
+			
+			.navbar-title {
+                color: rgba(23, 23, 37, 1);
+                font-family: DM Sans;
+                font-size: 36rpx;
+                font-weight: 700;
+                line-height: 52rpx;
+                letter-spacing: 0%;
+                text-align: center;
+			}
+			
+			.navbar-right {
+				width: 60rpx;
+				height: 60rpx;
+			}
+		}
+	}
+
+	button::after {
+		border: none;
+		background-color: none;
+	}
+
+	button {
+		position: relative;
+		display: block;
+		margin-left: auto;
+		margin-right: auto;
+		padding-left: 0px;
+		padding-right: 0px;
+		box-sizing: border-box;
+		text-decoration: none;
+		line-height: 1.35;
+		overflow: hidden;
+		color: #666666;
+		/* background-color: #fff; */
+		background-color: rgba(255, 255, 255, 0) !important;
+		width: 100%;
+		height: 100%;
+	}
+
+	.usermain {
+		background: #ffffff;
+		/* color: #fff; */
+		margin-top: 120rpx; /* 为固定导航栏留出空间 */
+	}
+
+	.usermain-item {
+		display: flex;
+		justify-content: space-between;
+		margin: 0 40rpx;
+		padding: 20rpx 0;
+		// border-bottom: 1rpx solid rgba(229, 229, 229, 0.3);
+		gap: 16rpx;
+	}
+
+	.usermain-item-title {
+		color: rgba(31, 44, 55, 1);
+		font-family: DM Sans;
+		font-size: 28rpx;
+		font-weight: 500;
+		line-height: 44rpx;
+		text-align: left;
+	}
+
+	.usermain-item.item-padding {
+		/* padding: 0; */
+	}
+
+	.cu-form-group {
+		padding: 0;
+		background: #ffffff;
+		text-align: right;
+	}
+
+	.cu-form-group input {
+		background: #ffffff;
+		font-size: 28rpx;
+		/* color: #fff; */
+
+	}
+
+	/* 姓名字段样式 - 参考basicInfo.vue */
+	.usermain-item .form-label {
+		color: rgba(31, 44, 55, 1);
+		font-family: DM Sans;
+		font-size: 32rpx;
+		font-weight: 500;
+		line-height: 44rpx;
+		letter-spacing: 0.5%;
+		text-align: left;
+		display: flex;
+		align-items: center;
+		margin-bottom: 16rpx;
+	}
+
+	.usermain-item .required-mark {
+		color: #FF3B30;
+		font-size: 36rpx;
+		font-weight: 600;
+		margin-right: 8rpx;
+	}
+
+	.usermain-item .cu-form-group {
+		background: transparent;
+		text-align: left;
+		padding: 0;
+	}
+
+	.usermain-item .cu-form-group input {
+		width: 100%;
+		height: 68rpx;
+		font-size: 28rpx;
+		border: 1rpx solid rgba(227, 231, 236, 1);
+		border-radius: 44rpx;
+		color: rgba(23, 23, 37, 1);
+		padding: 0 32rpx;
+		background: #ffffff;
+		font-family: DM Sans;
+		font-weight: 400;
+	}
+
+	.usermain-item .cu-form-group input::placeholder {
+		color: rgba(155, 155, 155, 1);
+		font-size: 28rpx;
+	}
+
+	/* 联系方式样式 */
+	.contact-structure {
+		border-bottom: none !important;
+	}
+
+	.contact-wrapper {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		padding: 0;
+		margin-top: 8rpx;
+	}
+
+	.phone-display {
+		color: rgba(23, 23, 37, 1);
+		font-family: DM Sans;
+		font-size: 28rpx;
+		font-weight: 400;
+		line-height: 40rpx;
+		letter-spacing: 0.5%;
+	}
+
+	.modify-link {
+		color: rgba(24, 144, 255, 1);
+		font-family: DM Sans;
+		font-size: 28rpx;
+		font-weight: 400;
+		line-height: 40rpx;
+		letter-spacing: 0.5%;
+		cursor: pointer;
+		text-decoration: none;
+	}
+
+	.modify-link:active {
+		opacity: 0.7;
+	}
+
+	/* 头像编辑图标样式 */
+	.avatar-wrapper {
+		position: relative;
+		display: inline-block;
+	}
+
+	.edit-avatar-icon {
+		position: absolute;
+		bottom: 10rpx;
+		right: 2rpx;
+		width: 24rpx;
+		height: 24rpx;
+		// background: #fff;
+		border-radius: 50%;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
+	}
+
+	.avatar-button {
+		position: relative;
+		padding: 0;
+		margin: 0;
+		background: transparent;
+		border: none;
+	}
+
+	.footer-btn {
+		margin-top: 40rpx;
+		padding-bottom: 40rpx;
+	}
+
+	.footer-btn .usermain-btn {
+		color: rgba(255, 255, 255, 1);
+		background: rgba(1, 107, 246, 1);
+		text-align: center;
+		width: 90%;
+		height: 80rpx;
+		font-size: 32rpx;
+		line-height: 80rpx;
+		margin: 20rpx auto;
+		border-radius: 40rpx;
+	}
+
+	/* 选择器样式 - 参考workExperience页面 */
+	.form-input-selector {
+		width: 100%;
+		height: 68rpx;
+		padding: 0 40rpx;
+		border: 1px solid rgba(227, 231, 236, 1);
+		border-radius: 24px;
+		background: rgba(255, 255, 255, 1);
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		cursor: pointer;
+		transition: all 0.2s ease;
+		
+		.placeholder {
+			color: #999999;
+			font-family: DM Sans;
+			font-size: 28rpx;
+			font-weight: 400;
+			line-height: 40rpx;
+		}
+		
+		text {
+			color: rgba(23, 23, 37, 1);
+			font-family: DM Sans;
+			font-size: 28rpx;
+			font-weight: 400;
+			line-height: 40rpx;
+		}
+	}
+
+	.arrow-down {
+		color: rgba(96, 98, 102, 1);
+		font-size: 24rpx;
+		font-weight: 400;
+		transform: scale(1.5);
+	}
+
+	.selector-group:active {
+		background: #f5f7fa !important;
+		transform: scale(0.99);
+	}
+</style>