zhongtianhaoyuan 3 years ago
parent
commit
a06f8139b0
2 changed files with 71 additions and 65 deletions
  1. 2 2
      config/index.js
  2. 69 63
      pages/mine/settings/editAvatar.vue

+ 2 - 2
config/index.js

@@ -1,6 +1,6 @@
 const dev = {
-	baseUrlNew: 'https://apitest.eliangeyun.com',
-	// baseUrlNew: 'http://192.168.1.114:8091',
+	// baseUrlNew: 'https://apitest.eliangeyun.com',
+	baseUrlNew: 'http://192.168.1.114:8099',
 	// baseUrlNew: 'http://192.168.1.116:8999',
 	h5Appid: 'wxb66b599f7f61b46f',
 	debug: false

+ 69 - 63
pages/mine/settings/editAvatar.vue

@@ -1,14 +1,14 @@
 <template>
 	<view class="content">
 		<view @click="upload" class="picture">
-			<image class="xj-image"  v-if="!deptListurl.avatarUrl" src="@/static/images/common/tianjiazhaopian@2x.png"></image>
+			<image class="xj-image" v-if="!deptListurl.avatarUrl" src="@/static/images/common/tianjiazhaopian@2x.png">
+			</image>
 			<image class="xj-image" :src="deptListurl.avatarUrl" v-if="deptListurl.avatarUrl"></image>
-			
+
 		</view>
-			<view @click="submit" class="submit">提交</view>
+		<view @click="submit" class="submit">提交</view>
 		<u-action-sheet :actions="$helper.imgTypeList" :title="$helper.imgType" :show="isShowimgType"
-			@select="imgTypeSelect" :closeOnClickOverlay="true" :closeOnClickAction="true"
-			@close="isShowimgType=false">
+			@select="imgTypeSelect" :closeOnClickOverlay="true" :closeOnClickAction="true" @close="isShowimgType=false">
 		</u-action-sheet>
 	</view>
 </template>
@@ -22,12 +22,12 @@
 	export default {
 		data() {
 			return {
-					isShowimgType:false,
-					imgSrc:'',
-					deptListurl:{
-						avatarUrl:'',
-						id:''
-					}
+				isShowimgType: false,
+				imgSrc: '',
+				deptListurl: {
+					avatarUrl: '',
+					id: ''
+				}
 			}
 		},
 		onLoad() {
@@ -39,7 +39,7 @@
 		methods: {
 			upload() {
 				this.isShowimgType = true
-			
+
 			},
 			imgTypeSelect(val) {
 				console.log(val)
@@ -57,33 +57,35 @@
 											apiKey: 'yNWLRW6unoUxo2KXiCZxOxGS',
 											secretKey: 'E8hqzKWdFdTGnFnpAwZ7ixtL89SN3deR'
 										}).then(res => {
-												that.$request.baseRequest('get', '/commonUser/getUserDefinedBean', {
+											console.log(res)
+											that.$request.baseRequest('post',
+													'/commonUser/getUserDefinedBean', {
 														accessToken: res.data,
-														  imagePath : result
+														imagePath: result
 													}).then(res1 => {
-																	that.deptListurl.avatarUrl = result
-													})
-													.catch(res => {
-													uni.$u.toast( res.message);
-													});
+													that.deptListurl.avatarUrl = result
+												})
+												.catch(res => {
+													uni.$u.toast(res.message);
+												});
 										})
 										.catch(res => {
-										uni.$u.toast( res.message);
+											uni.$u.toast(res.message);
 										});
-									
-						
-			
+
+
+
 								}
 							)
 						}
 					});
-			
+
 				} else {
-			
+
 				}
-			
+
 			},
-			submit(){
+			submit() {
 				this.deptListurl.id = this.userInfo.id
 				this.$request.baseRequest('post', '/commonUser/editUserInfo', this.deptListurl).then(res => {
 						uni.showToast({
@@ -91,7 +93,7 @@
 							icon: 'success',
 							duration: 2000,
 							success() {
-								setTimeout(()=>{
+								setTimeout(() => {
 									that.userInfo.avatarUrl = that.deptListurl.avatarUrl
 									var _student = uni.getStorageSync('userInfo');
 									_student.avatarUrl = that.deptListurl.avatarUrl;
@@ -107,15 +109,15 @@
 										message: "修改成功!",
 									})
 									uni.navigateBack({
-										delta:1
+										delta: 1
 									})
-								},2000)
+								}, 2000)
 							}
 						})
-				
+
 					})
 					.catch(res => {
-					uni.$u.toast( res.message);
+						uni.$u.toast(res.message);
 					});
 			}
 		}
@@ -123,38 +125,42 @@
 </script>
 
 <style>
-	.content{
+	.content {
 		background: white;
 		padding: 20rpx;
 	}
-.left-text {
-			width: 290rpx;
-			color: #333333;
-			display: flex;
-			align-items: center;
-		}
-		.picture {
-			margin-top: 20rpx;
-			background: #F5F6FA;
-			width: 212rpx;
-			height: 212rpx;
-			border-radius: 10rpx;
-			display: flex;
-			flex-direction: column;
-			justify-content: center;
-			align-items: center;
-			color: #6A7282;
-		}
-		.xj-image {
-			width: 100rpx;
-			height: 100rpx;
-		}
-		.submit{
-			margin-top: 20rpx;
-			background: #2772FB;
-			border-radius: 50rpx;
-			padding: 20rpx 0;
-			color: white;
-			text-align: center;
-		}
+
+	.left-text {
+		width: 290rpx;
+		color: #333333;
+		display: flex;
+		align-items: center;
+	}
+
+	.picture {
+		margin-top: 20rpx;
+		background: #F5F6FA;
+		width: 212rpx;
+		height: 212rpx;
+		border-radius: 10rpx;
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+		color: #6A7282;
+	}
+
+	.xj-image {
+		width: 100rpx;
+		height: 100rpx;
+	}
+
+	.submit {
+		margin-top: 20rpx;
+		background: #2772FB;
+		border-radius: 50rpx;
+		padding: 20rpx 0;
+		color: white;
+		text-align: center;
+	}
 </style>