Parcourir la source

修改默认昵称

achao il y a 2 ans
Parent
commit
387b48e8f5

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

@@ -1012,7 +1012,7 @@
 				this.remark = this.currectData.remark
 				this.modalShow = true
 			},
-			switchType(item) {debugger
+			switchType(item) {
 				this.type = 2
 				this.typeColumns[0].shift()
 				this.currectData = item

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

@@ -2,7 +2,7 @@
 	<view class="content">
 		<view class="content1 flex-between relative flex">
 			<view class="user flex">
-				<image :src="userInfo.head" mode="widthFix" class="img" @click="editHead"></image>
+				<image :src="userInfo.head?userInfo.head:'../../static/imgs/mySet/head.png'" mode="widthFix" class="img" @click="editHead"></image>
 				<view class="name">
 					{{userInfo.nickname}}
 				</view>
@@ -117,10 +117,29 @@
 
 		onLoad() {
 			that = this
-			if (uni.getStorageSync("userInfo").phone) {
-				this.userInfo = uni.getStorageSync("userInfo")
+			this.userInfo = uni.getStorageSync("userInfo")
+			if(!this.userInfo.nickname){
+				let code = ""
+				for(var i=0;i<6;i++){
+				    code += parseInt(Math.random()*10);
+				}
+				this.userInfo.nickname = 'user'+code
+				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)
+				})
+			}
+			if (this.userInfo.phone) {
 				this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
-					commonId: uni.getStorageSync("userInfo").id
+					commonId: this.userInfo.id
 				}, failres => {
 					this.$refs.uToast.show({
 						type: 'error',

BIN
xiaochengxu/static/imgs/mySet/head.png