Kaynağa Gözat

Merge branch 'master' of http://git.zthymaoyi.com/wangchao/businessCard

# Conflicts:
#	xiaochengxu/pages/mySet/mySet.vue
高敬炎 2 yıl önce
ebeveyn
işleme
3d325f5efb

+ 9 - 0
xiaochengxu/pages.json

@@ -200,6 +200,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/mySet/editNickName",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "修改昵称",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"tabBar": {
 		"custom": false,

+ 4 - 1
xiaochengxu/pages/cardHolder/cardHolder.vue

@@ -334,7 +334,8 @@
 							</button>
 						</u-form-item>
 						<u-form-item label="昵称">
-							<input type="nickname" :value="userInfo.nickname" class="weui-input" @blur="userNameInput" placeholder="请输入昵称"/>
+								<u-input v-model="userInfo.nickname" class="weui-input" @blur="userNameInput" placeholder="请输入昵称" border="false"/>
+							<!-- <input type="nickname" :value="userInfo.nickname" class="weui-input" @blur="userNameInput" placeholder="请输入昵称"/> -->
 						</u-form-item>
 					</u-form>
 				</div>
@@ -352,6 +353,7 @@
 </template>
 
 <script>
+	var that;
 	import Poster from '../../components/zhangyuhao-poster/Poster.vue'
 	import { pathToBase64, base64ToPath } from 'image-tools'
 	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
@@ -425,6 +427,7 @@
 
 		},
 		onLoad: function(options) {
+			that = this
 			console.log(uni.getLaunchOptionsSync().scene, 1011)
 			if (uni.getStorageSync("userInfo").phone) {
 				this.userInfo = uni.getStorageSync("userInfo")

+ 1 - 0
xiaochengxu/pages/cardHolder/scanCodeAddCard.vue

@@ -228,5 +228,6 @@
 		justify-content: space-between;
 		// padding: 20rpx;
 		width: 100vw;
+		height: auto;
 	}
 </style>

+ 1 - 0
xiaochengxu/pages/circle/circle.vue

@@ -330,5 +330,6 @@
 		position: fixed;
 		bottom: 26rpx;
 		right: 26rpx;
+		height: auto;
 	}
 </style>

+ 86 - 0
xiaochengxu/pages/mySet/editNickName.vue

@@ -0,0 +1,86 @@
+<template>
+	<view class="content">
+		<view class="row1 flex">
+			<view class="left">
+				昵称
+			</view>
+			<u-input v-model="userInfo.nickname" :border="false" focus class="input" />
+		</view>
+		<view class="row2">
+			<view class="btn" @click="edit">
+				保存
+			</view>
+		</view>
+		<u-toast ref="uToast"></u-toast>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				value: '',
+				userInfo: {
+					nickname: ''
+				}
+			};
+		},
+		onLoad() {
+			this.userInfo = uni.getStorageSync("userInfo")
+		},
+		methods: {
+			edit() {
+				this.$request.baseRequest('commonUserApp', 'edit', {
+					commonUserInfo: JSON.stringify(this.userInfo)
+				}, failres => {
+					this.$refs.uToast.show({
+						type: 'error',
+						message: failres.errmsg,
+					})
+					uni.hideLoading()
+				}).then(res => {
+					this.userInfo = res.data
+					uni.setStorageSync("userInfo", this.userInfo)
+					let params = {
+						type: 'success',
+						message: "修改成功",
+						url: '/pages/mySet/mySet'
+					}
+					this.$refs.uToast.show({
+						...params,
+						complete() {
+							params.url && uni.switchTab({
+								url: params.url
+							})
+						}
+					})
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.row1 {
+		background: #fff;
+		padding: 20rpx;
+	}
+
+	.input {
+		font-size: 28rpx;
+	}
+
+	.row2 {
+		padding: 20rpx;
+	}
+
+	.btn {
+		color: #fff;
+		padding: 20rpx;
+		border-radius: 8px;
+		background: rgba(17, 34, 83, 1);
+		text-align: center;
+		font-size: 36rpx;
+
+	}
+</style>

+ 80 - 23
xiaochengxu/pages/mySet/mySet.vue

@@ -2,17 +2,14 @@
 	<view class="content">
 		<view class="content1 flex-between relative flex">
 			<view class="user flex">
-				<image :src="userInfo.head" mode="widthFix" class="img"></image>
+				<image :src="userInfo.head" mode="widthFix" class="img" @click="editHead"></image>
 				<view class="name">
 					{{userInfo.nickname}}
 				</view>
 			</view>
 			<view class="position">
 				<image @click='selectCard' src="../../static/imgs/mySet/share.png" mode="widthFix" class="right-img">
-<!-- 				<button v-if='list.length==1' class="shareBtn" type="default" data-name="shareBtn" open-type="share">
-					<image src="../../static/imgs/mySet/share.png" mode="widthFix" class="right-img">
-					</image>
-				</button> -->
+
 				<image @click='selectCard1' src="../../static/imgs/mySet/ewm.png" mode="widthFix" class="right-img">
 				</image>
 			</view>
@@ -46,6 +43,8 @@
 </template>
 
 <script>
+	var that;
+	import uploadImage from '@/components/ossutil/uploadFile.js';
 	import Poster from '../../components/zhangyuhao-poster/Poster.vue'
 	export default {
 		components: {
@@ -95,6 +94,11 @@
 						type: "contactCustomer",
 						src: '../../static/imgs/mySet/kf.png'
 					},
+					{
+						name: "修改昵称",
+						type: 'editNickName',
+						src: '../../static/imgs/mySet/set.png'
+					},
 					{
 						name: "设置",
 						type: 'set',
@@ -103,7 +107,12 @@
 				]
 			};
 		},
-		onShow() {
+		beforeDestroy() {
+			this.show = false
+		},
+
+		onLoad() {
+			that = this
 			if (uni.getStorageSync("userInfo").phone) {
 				this.userInfo = uni.getStorageSync("userInfo")
 				this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
@@ -115,7 +124,7 @@
 					})
 					uni.hideLoading()
 				}).then(res => {
-					this.list=res.data.items
+					this.list = res.data.items
 					this.cardList = [res.data.items]
 				})
 			} else {
@@ -144,36 +153,76 @@
 				return {
 					title: '名片Box',
 					path: '/pages/cardHolder/cardHolder',
-					imageUrl:''
+					imageUrl: ''
 				};
 			}
 		},
 		methods: {
+			editHead() {
+				uni.chooseImage({
+					count: 1,
+					sizeType: ['original', 'compressed'],
+					success: function(res) {
+						uploadImage(res.tempFilePaths[0], 'cardImages/',
+							result => {
+								that.userInfo.head = result
+								that.$request.baseRequest('commonUserApp', 'edit', {
+									commonUserInfo: JSON.stringify(that.userInfo)
+								}, failres => {
+									that.$refs.uToast.show({
+										type: 'error',
+										message: failres.errmsg,
+									})
+									uni.hideLoading()
+								}).then(res => {
+									uni.setStorageSync("userInfo", that.userInfo)
+									let params = {
+										type: 'success',
+										message: "修改成功",
+										url: '/pages/mySet/mySet'
+									}
+									that.$refs.uToast.show({
+										...params,
+										complete() {
+											params.url && uni.switchTab({
+												url: params.url
+											})
+										}
+									})
+								})
+							}
+						)
+					}
+				});
+			},
 			handleHiddenShare() {
 				this.popupshow = false
 			},
 			selectCard() {
+
 				if(this.cardList[0].length>0){
 					this.index=0
 					this.cardChange({
 						value: this.cardList[[0]]
 					})
-				}else if(this.list.length==0){
+				} else if (this.cardList[0].length == 0) {
 					this.$refs.uToast.show({
 						type: 'error',
 						message: '您还未创建名片',
 					})
 				}
-				
+
 			},
 			selectCard1() {
-				if(this.list.length>1){
+				console.log(this.cardList[0])
+				if (this.cardList[0].length > 1) {
 					this.show1 = true
-				}else if(this.list.length>0){
-					this.cardConfirm({value:this.cardList[[0]]})
+				} else if (this.cardList[0].length > 0) {
+					this.cardConfirm({
+						value: this.cardList[[0]]
+					})
 				}
-				
-				
+
 			},
 			cardConfirm(e) {
 				console.log(e)
@@ -200,7 +249,8 @@
 					},
 					{
 						type: 'image',
-						path: this.currectData.headSculpture?this.currectData.headSculpture:'../../static/imgs/card/defaulthead.png',
+						path: this.currectData.headSculpture ? this.currectData.headSculpture :
+							'../../static/imgs/card/defaulthead.png',
 						shape: 'circle',
 						use: 'head',
 						imageType:this.currectData.headSculpture?'wl':'bd',
@@ -493,13 +543,16 @@
 			width: 124rpx;
 			border-radius: 50%;
 			margin-right: 32rpx;
+			height: auto;
 		}
 
 		.position {
-			display:flex;
+			display: flex;
+
 			.right-img {
 				width: 44rpx;
 				margin-left: 40rpx;
+				height: auto;
 			}
 		}
 	}
@@ -515,6 +568,7 @@
 		.nav-img {
 			width: 32rpx;
 			margin-right: 20rpx;
+			height: auto;
 		}
 
 		.row {
@@ -523,6 +577,7 @@
 
 			.row-right-img {
 				width: 12rpx;
+				height: auto;
 			}
 		}
 
@@ -544,13 +599,15 @@
 			border: none !important;
 		}
 	}
-	.shareBtn{
-		background:transparent;
+
+	.shareBtn {
+		background: transparent;
 		line-height: 1;
-		padding:0;
+		padding: 0;
 	}
-	.shareBtn::after{
-		border:none;
-		
+
+	.shareBtn::after {
+		border: none;
+
 	}
 </style>