From fc9bd6378d3bfbde6d5c71535757a3d44de8d8ff Mon Sep 17 00:00:00 2001 From: zhaojs <349234519@qq.com> Date: 星期四, 20 七月 2023 15:18:06 +0800 Subject: [PATCH] Merge branch 'feature/1.1.4开发' into develop --- uniapp/pages/login/setInviteCode.vue | 147 ++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 126 insertions(+), 21 deletions(-) diff --git a/uniapp/pages/login/setInviteCode.vue b/uniapp/pages/login/setInviteCode.vue index c76000c..efa0c41 100644 --- a/uniapp/pages/login/setInviteCode.vue +++ b/uniapp/pages/login/setInviteCode.vue @@ -4,27 +4,47 @@ 璇疯緭鍏ラ個璇风爜 </view> <view class="grey-input-content rowCen borderBox"> - <input class="iptclas" type="text" v-model="inviteCode" placeholder="璇峰~鍐欓個璇风爜" placeholder-class="pla-input"/> + <input class="iptclas" type="text" v-model="inviteCode" placeholder="璇峰~鍐欓個璇风爜锛�" placeholder-class="pla-input"/> </view> - <view class="model-tips" v-if="appInfo.isOpenOfficialCode==1"> + <view class="model-tips" v-if="appInfo.isOpenOfficialCode==1"> <view>濉啓閭�璇风爜鏈夊姪浜庢偍鐨勮喘鐗╄繑浣e摝锛�</view> </view> - <template v-if="isShowCode"> - <view class="copy-bar rowCenBet borderBox" v-if="appInfo.isOpenOfficialCode==1"> - <view class="left-code"> - {{appInfo.officialInvitationCode}} - </view> - <view class="copybtn rowCenCen" @tap="useCode()"> - <view>浣跨敤閭�璇风爜</view> - </view> - </view> - </template> + <view @click="setCode" class="login-btn rowCenCen" :class="inviteCode?'colorfulbtn':''" > <view class="btn-font" > 纭畾 </view> </view> + + <template v-if="isShowCode"> + <template v-if='commonInvite!=null&&commonInvite.length>0'> + <view class="s_inviter" @click="userInviter()"> + <view class="s_img"> + <image :src="commonInvite[inviteIndex].avatar"></image> + <span>{{commonInvite[inviteIndex].nickname}}</span> + </view> + <view> + <view>浣跨敤Ta鐨勯個璇风爜</view> + </view> + </view> + <view @click="changeInviter()" style="color: #999999; margin-top: 20rpx;"> + 鎹竴涓� + </view> + </template> + <template v-else> + <view class="copy-bar rowCenBet borderBox" style="margin-top: 70rpx;" v-if="appInfo.isOpenOfficialCode==1"> + <view class="left-code"> + {{appInfo.officialInvitationCode}} + </view> + <view class="copybtn rowCenCen" @tap="useCode()"> + <view>浣跨敤閭�璇风爜</view> + </view> + </view> + </template> + + + </template> <view class="yqmtip rowCenCen"> <span @click="showinvite">娌℃湁閭�璇风爜锛�</span> @@ -48,13 +68,48 @@ isShowCode:false, inviteCode:'', appInfo:'', - inviterShow:false + inviterShow:false, + platform:'', + commonInvite:[], + inviteIndex:0 } }, + onLoad() + { + this.getInviter(); + }, mounted() { - this.appInfo = uni.getStorageSync('appInfo') + this.appInfo = uni.getStorageSync('appInfo'); + this.platform = uni.getSystemInfoSync().platform }, methods: { + //鑾峰彇绯荤粺鎺ㄨ崘浜� + getInviter() + { + var that=this; + this.$u.api.getRecomInviter({}).then(e => { + console.log(e) + that.commonInvite=e.data; + }).catch(function (err) { + console.log(err) + }) + }, + changeInviter() + { + console.log(this.commonInvite.length) + if(this.inviteIndex==this.commonInvite.length-1) + { + this.inviteIndex=0; + } + else{ + this.inviteIndex=this.inviteIndex+1; + } + }, + userInviter() + { + this.inviteCode=this.commonInvite[this.inviteIndex].invitation_code; + }, + useCode() { this.inviteCode=this.appInfo.officialInvitationCode; @@ -76,11 +131,17 @@ confirmText:'鑱旂郴鎺ㄨ崘浜�', success:function(res) { + console.log(that.platform); + console.log(res); if (res.confirm) { - that.isShowCode=true; + that.isShowCode=false; } else if (res.cancel) { - that.isShowCode=false; + that.isShowCode=true; } + }, + fail:function(res) + { + that.isShowCode=true; } }); }, @@ -89,7 +150,10 @@ this.$u.api.getUserInfo({}).then(e => { console.log(e) util.setCache('userInfo', e.data.userinfo); - if (e.data.userinfo.isPwd == 'N') { + uni.switchTab({ + url: '../index/index' + }) + /* if (e.data.userinfo.isPwd == 'N') { uni.redirectTo({ url: './setPass' }) @@ -97,13 +161,14 @@ uni.switchTab({ url: '../index/index' }) - } + }*/ }).catch(function (err) { console.log(err) }) }, setCode() { + console.log("纭畾"); var that=this; if(this.inviteCode) { @@ -113,12 +178,32 @@ console.log(e) if(e.code != 0) return that.$alert(e.msg) uni.setStorageSync('inviterInfo',e.data) - this.inviterShow = true + //this.inviterShow = true + this.setinvite(); }).catch(function (err) { }) } - } - + }, + setinvite() { + var that = this; + let deviceInfo = uni.getDeviceInfo(); + console.log(deviceInfo.deviceId); + this.$u.api.bindInvitation({ + invite_code:this.inviteCode, + deviceid:deviceInfo.deviceId + }).then(e => { + if(e.code != 0) return that.$alert(e.msg) + uni.showToast({ + title:'缁戝畾鎴愬姛锛�', + icon:'none' + }) + setTimeout(function(){ + that.getuserInfo(); + },1000) + }).catch(function (err) { + }) + + }, } } </script> @@ -128,6 +213,26 @@ { background: #fff; } + .s_inviter + { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 70rpx; + width:100%; + .s_img + { + display: flex; + align-items: center; + span{ + margin-left: 13rpx; + }; + } + image{ + width:100rpx; + height: 100rpx; + } + } .yqmtip { -- Gitblit v1.9.3