ccjgmwz 2 年 前
コミット
e41b6f7c72
1 ファイル変更82 行追加77 行削除
  1. 82 77
      xiaochengxu/pages/cardHolder/cardHolder.vue

+ 82 - 77
xiaochengxu/pages/cardHolder/cardHolder.vue

@@ -312,7 +312,7 @@
 				</div>
 				<div class="auth-btncard">
 					<div class="btn-unok"><u-button  :customStyle="customStyleUnOk" @click="showAuthorizePhone=false"> 拒绝</u-button></div>
-					<div class="btn-ok"><u-button  :customStyle="customStyleOk" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"> 允许</u-button></div>
+					<div class="btn-ok"><u-button  :customStyle="customStyleOk" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"> 立即登录</u-button></div>
 				</div>
 			</view>
 		</u-modal>
@@ -362,7 +362,7 @@
 		},
 		data() {
 			return {
-				userInfo: {avatarUrl:'',nickName:''},
+				userInfo: {head:'',nickname:''},
 				downOption: {
 					auto: false,
 				},
@@ -485,15 +485,17 @@
 				userNameInput(e){
 					this.userInfo.nickname = e.detail.value
 				},
-				onChooseAvatar(e) {
-					  console.log(e.detail.avatarUrl)
-					 pathToBase64( e.detail.avatarUrl).then(path => {
-					  this.userInfo.head = path
-					  console.log(path)
-					}).catch(error => {
-					  console.log(error)
+				async onChooseAvatar(e) {
+					this.$set(this.userInfo,"head",await this.toBase64(e.detail.avatarUrl))
+				},
+				toBase64(url){
+					return new Promise(resolve => {
+						pathToBase64(url).then(path => {
+						  resolve(path);
+						}).catch(error => {
+						  console.log(error)
+						})
 					})
-					// this.userInfo.head = e.detail.avatarUrl;
 				},
 				authUser(){
 					if(this.userInfo.nickname==''){
@@ -1054,79 +1056,82 @@
 					});
 				} else {
 					var that = this
-					uni.showLoading({
-						title: '数据加载中'
-					})
-					await this.$request.baseRequest('admin.unimall.cardHolderInfo', 'list', {
-						page: page.num,
-						limit: page.size,
-						commonId: uni.getStorageSync("userInfo").id,
-						searchContent: this.searchVal,
-						classify:this.typeName
-					}, failres => {
-						console.log('res+++++', failres.errmsg)
-						this.$refs.uToast.show({
-							type: 'error',
-							message: failres.errmsg,
+					if(uni.getStorageSync("userInfo").id){
+						uni.showLoading({
+							title: '数据加载中'
 						})
-						uni.hideLoading()
-					}).then(res => {
-						console.log(res)
-						if (page.num == 1) this.cardHolderList = [];
-						let curPageLen = res.data.items.length;
-						let totalPage = res.data.total;
-						for (var i = 0; i < res.data.items.length; i++) {
-							res.data.items[i].checked = false
-							if (res.data.items[i].classify) {
-								res.data.items[i].classifyName = res.data.items[i].classify[0]
+						await this.$request.baseRequest('admin.unimall.cardHolderInfo', 'list', {
+							page: page.num,
+							limit: page.size,
+							commonId: uni.getStorageSync("userInfo").id,
+							searchContent: this.searchVal,
+							classify:this.typeName
+						}, failres => {
+							console.log('res+++++', failres.errmsg)
+							this.$refs.uToast.show({
+								type: 'error',
+								message: failres.errmsg,
+							})
+							uni.hideLoading()
+						}).then(res => {
+							console.log(res)
+							if (page.num == 1) this.cardHolderList = [];
+							let curPageLen = res.data.items.length;
+							let totalPage = res.data.total;
+							for (var i = 0; i < res.data.items.length; i++) {
+								res.data.items[i].checked = false
+								if (res.data.items[i].classify) {
+									res.data.items[i].classifyName = res.data.items[i].classify[0]
+								}
 							}
-						}
-						this.cardHolderList = res.data.items
-						this.loading = false
-						this.$nextTick(() => {
-							that.mescroll.endBySize(curPageLen, totalPage)
-						});
-
-						uni.hideLoading()
-					})
-
-					await this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
-						page: 1,
-						limit: 9999,
-						commonId: uni.getStorageSync("userInfo").id
-					}, failres => {
-						console.log('res+++++', failres.errmsg)
-						this.$refs.uToast.show({
-							type: 'error',
-							message: failres.errmsg,
-						})
-					}).then(res => {
-						res.data.items.unshift({
-							circleName:'全部分类'
+							this.cardHolderList = res.data.items
+							this.loading = false
+							this.$nextTick(() => {
+								that.mescroll.endBySize(curPageLen, totalPage)
+							});
+						
+							uni.hideLoading()
 						})
-						this.typeColumns = [res.data.items]
 						
-						console.log(this.typeColumns)
-					})
-
-					await this.$request.baseRequest('admin.unimall.cardNewsInfo', 'list', {
-						receiveId: uni.getStorageSync("userInfo").id,
-					}, failres => {
-						console.log('res+++++', failres.errmsg)
-						this.$refs.uToast.show({
-							type: 'error',
-							message: failres.errmsg,
+						await this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
+							page: 1,
+							limit: 9999,
+							commonId: uni.getStorageSync("userInfo").id
+						}, failres => {
+							console.log('res+++++', failres.errmsg)
+							this.$refs.uToast.show({
+								type: 'error',
+								message: failres.errmsg,
+							})
+						}).then(res => {
+							res.data.items.unshift({
+								circleName:'全部分类'
+							})
+							this.typeColumns = [res.data.items]
+							
+							console.log(this.typeColumns)
 						})
-					}).then(res => {
-						this.noticeList = res.data.items
-						if (this.noticeList.length > 0) {
-							var data = this.noticeList.filter((item) => {
-								return item.newsFlag == 0
+						
+						await this.$request.baseRequest('admin.unimall.cardNewsInfo', 'list', {
+							receiveId: uni.getStorageSync("userInfo").id,
+						}, failres => {
+							console.log('res+++++', failres.errmsg)
+							this.$refs.uToast.show({
+								type: 'error',
+								message: failres.errmsg,
 							})
-							this.unread = data ? data.length : 0
-						}
-						console.log(this.unread)
-					})
+						}).then(res => {
+							this.noticeList = res.data.items
+							if (this.noticeList.length > 0) {
+								var data = this.noticeList.filter((item) => {
+									return item.newsFlag == 0
+								})
+								this.unread = data ? data.length : 0
+							}
+							console.log(this.unread)
+						})
+					}
+					
 				}
 			},
 			login() {