فهرست منبع

个人信息修改

xiaohaizhao 9 ماه پیش
والد
کامیت
23e4a5e1ac
3فایلهای تغییر یافته به همراه149 افزوده شده و 30 حذف شده
  1. 141 27
      pages/index/my.vue
  2. 7 3
      static/iconfont.css
  3. 1 0
      utils/Http.js

+ 141 - 27
pages/index/my.vue

@@ -23,29 +23,61 @@
 				<view class="label">
 					点击更换头像
 				</view>
-				<view class="profilePhoto">
-					<up-image :show-loading="true" :src="user.profilePhoto" width="80rpx" height="80rpx" />
-					<view class="loading">
-						<up-loading-icon mode="semicircle" />
+				<view class="value">
+					<view class="profilePhoto">
+						<up-image :show-loading="true" :src="user.profilePhoto" width="80rpx" height="80rpx" />
+						<view class="loading">
+							<up-loading-icon mode="semicircle" />
+						</view>
 					</view>
+					<view class="iconfont icon-a-wodetiaozhuan" />
 				</view>
 			</view>
-			<view v-show="!headportraitLoading" hover-class="navigator-hover">
+			<view v-show="!headportraitLoading">
 				<My_upload ref="upload" custom maxCount="1" @uploadCallback="uploadCallback"
 					@startUploading="startUploading">
-					<view class="row" style="width: calc(80vw);">
+					<view class="row" style="width: calc(80vw);" hover-class="navigator-hover">
 						<view class="label">
 							点击更换头像
 						</view>
-						<view class="profilePhoto">
-							<up-image :show-loading="true" :src="user.profilePhoto" width="80rpx" height="80rpx" />
+						<view class="value">
+							<view class="profilePhoto">
+								<up-image :show-loading="true" :src="user.profilePhoto" width="80rpx" height="80rpx" />
+							</view>
+							<view class="iconfont icon-a-wodetiaozhuan" />
 						</view>
 					</view>
 				</My_upload>
 			</view>
 
+			<view class="row" hover-class="navigator-hover" @click="modalShow = true">
+				<view class="label">
+					用户昵称
+				</view>
+				<view class="value">
+					{{ user.name }}
+					<view class="iconfont icon-a-wodetiaozhuan" />
+				</view>
+			</view>
+
+			<view class="row">
+				<view class="label">
+					手机号码
+				</view>
+				<view class="value">
+					{{ user.phonenumber }}
+				</view>
+			</view>
+			<view class="but">
+				<up-button type="primary" shape="circle" size="large" color="#3874F6" text="退出登录" @tap="logOut" />
+			</view>
 		</view>
 	</up-popup>
+
+	<up-modal :show="modalShow" title="修改昵称" showCancelButton @confirm="confirm" @cancel="modalShow = false"
+		ref="uModal" :asyncClose="true">
+		<up-input focus :placeholder="user.name" border="surround" v-model="userName"></up-input>
+	</up-modal>
 </template>
 
 <script setup>
@@ -70,12 +102,47 @@ onLoad(() => {
 	user.profilePhoto = userInfo.profilePhoto || '/static/image/user.png';
 });
 
-let popupShow = ref(true),
+let popupShow = ref(false),
 	headportraitLoading = ref(false);
 function close() {
 	popupShow.value = false
 }
 
+let uModal = ref(null),
+	modalShow = ref(false),
+	userName = ref('');
+
+function confirm() {
+	console.log('修改昵称', userName.value);
+	if (userName.value.trim() == '') {
+		modalShow.value = false;
+		return uni.showToast({
+			title: '昵称不能为空',
+			icon: 'none'
+		})
+	}
+
+	$Http.basic({
+		"classname": "common.usercenter.usercenter",
+		"method": "updateUserMsg",
+		"content": {
+			"name": userName.value,
+			"phonenumber": user.phonenumber,
+		}
+	}).then(res => {
+		console.log(res)
+		uni.showToast({
+			title: res.code == 1 ? '修改成功' : res.msg,
+			icon: 'none'
+		})
+		modalShow.value = false;
+		if (res.code == 1) {
+			userName.value = '';
+			getUserMsg();
+		}
+	})
+}
+
 // 更换头像
 let upload = ref(null);
 
@@ -146,6 +213,29 @@ function getProperty() {
 		console.log('个人资产', res);
 	})
 }
+
+function logOut() {
+	console.log('退出登录');
+	uni.showModal({
+		title: '提示',
+		content: '是否确定退出登录?',
+		success: function ({ confirm }) {
+			if (confirm) {
+				$Http.logout();
+				uni.removeStorageSync('userMsg');
+				uni.reLaunch({
+					url: '/pages/login/login',
+					success: () => {
+						uni.showToast({
+							title: '退出登录成功',
+							icon: 'none'
+						});
+					}
+				});
+			}
+		}
+	});
+}
 </script>
 
 <style lang="less" scoped>
@@ -188,8 +278,10 @@ function getProperty() {
 }
 
 .change-user {
+	position: relative;
 	padding-top: 55px;
 	box-sizing: border-box;
+	height: 100%;
 
 	.title {
 		font-size: 28rpx;
@@ -207,33 +299,55 @@ function getProperty() {
 		padding: 20rpx 30rpx;
 		border-radius: 16rpx;
 		box-sizing: border-box;
+		margin-bottom: 20rpx;
 
 		.label {
 			font-size: 28rpx;
 			color: #666;
+			flex-shrink: 0;
+			margin-right: 20rpx;
 		}
 
-		.profilePhoto {
-			position: relative;
-			width: 80rpx;
-			height: 80rpx;
-			border-radius: 50%;
-			overflow: hidden;
-
-			.loading {
-				position: absolute;
-				top: 0;
-				left: 0;
-				width: 100%;
-				height: 100%;
-				display: flex;
-				align-items: center;
-				justify-content: center;
-				background: rgba(0, 0, 0, 0.09);
-				z-index: 1;
+		.value {
+			display: flex;
+			align-items: center;
+
+			.profilePhoto {
+				position: relative;
+				width: 80rpx;
+				height: 80rpx;
+				border-radius: 50%;
+				overflow: hidden;
+
+				.loading {
+					position: absolute;
+					top: 0;
+					left: 0;
+					width: 100%;
+					height: 100%;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+					background: rgba(0, 0, 0, 0.09);
+					z-index: 1;
+				}
+			}
+
+			.iconfont {
+				font-size: 28rpx;
+				color: #999;
+				margin-top: 5rpx;
 			}
 		}
 
+
+
+	}
+
+	.but {
+		width: 100%;
+		position: absolute;
+		bottom: 130rpx;
 	}
 }
 </style>

+ 7 - 3
static/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 4985326 */
-  src: url('//at.alicdn.com/t/c/font_4985326_3lo8rjw0fz.woff2?t=1756171236226') format('woff2'),
-       url('//at.alicdn.com/t/c/font_4985326_3lo8rjw0fz.woff?t=1756171236226') format('woff'),
-       url('//at.alicdn.com/t/c/font_4985326_3lo8rjw0fz.ttf?t=1756171236226') format('truetype');
+  src: url('//at.alicdn.com/t/c/font_4985326_k6gds60jjxi.woff2?t=1756186335629') format('woff2'),
+       url('//at.alicdn.com/t/c/font_4985326_k6gds60jjxi.woff?t=1756186335629') format('woff'),
+       url('//at.alicdn.com/t/c/font_4985326_k6gds60jjxi.ttf?t=1756186335629') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,10 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-a-wodetiaozhuan:before {
+  content: "\e647";
+}
+
 .icon-dianhua2:before {
   content: "\e706";
 }

+ 1 - 0
utils/Http.js

@@ -112,6 +112,7 @@ class HTTP {
    * 会话过期处理
    */
   _checkSessionExpired(res) {
+    return;
     if (res.data?.msg === "登陆状态已过期,请重新登陆!") {
       this.jsessionid = "";
       uni.removeStorageSync("JSESSIONID");