diff --git a/weapp/pages/profile/profile.js b/weapp/pages/profile/profile.js index 31db4b4..35f7e03 100644 --- a/weapp/pages/profile/profile.js +++ b/weapp/pages/profile/profile.js @@ -151,6 +151,27 @@ Page(withDataCache({ } }, + onEditTouchStart: function(e) { + this._editSwipe = null; + if (!e.touches || e.touches.length !== 1 || (e.target && e.target.dataset && e.target.dataset.swipeIgnore)) return; + const point = e.touches[0]; + this._editSwipe = {x:point.clientX,y:point.clientY}; + }, + onEditTouchCancel: function() { this._editSwipe = null; }, + onEditTouchEnd: function(e) { + const start = this._editSwipe; + this._editSwipe = null; + const point = e.changedTouches && e.changedTouches[0]; + if (!start || !point) return; + const dx = start.x - point.clientX, dy = Math.abs(start.y - point.clientY); + if (dx < 80 || dx <= dy * 1.5) return; + if (this.data.showEditPartnerModal && (this.data.partnerSaving || this.data.partnerAvatarUploading)) return; + if (this.data.showEditProfileModal) this.hideEditProfileModal(); + else if (this.data.showEditPartnerModal) this.hideEditPartnerModal(); + else return; + wx.hideKeyboard(); + }, + _needRefresh: true, onScroll: function(e) { diff --git a/weapp/pages/profile/profile.wxml b/weapp/pages/profile/profile.wxml index bb4dbfc..2465503 100644 --- a/weapp/pages/profile/profile.wxml +++ b/weapp/pages/profile/profile.wxml @@ -46,30 +46,30 @@ - + - + {{editNicknameInitial || '?'}}点击更换头像 我的ID: {{myDisplayId}} - + {{editGenderText || '请选择'}} {{editBirthday || '请选择日期'}}自动计算:{{editAge}}岁 {{tempLoveDate || '设置你们在一起的日期'}} - + - + 编辑TA的资料 {{editPartnerNameInitial || '?'}}{{partnerAvatarUploading ? '正在上传头像…' : '点击更换头像'}} TA的ID: {{partnerDisplayId}} - + {{editPartnerGenderText || '请选择'}} {{editPartnerBirthday || '请选择日期'}}自动计算:{{editPartnerAge}}岁 {{tempLoveDate || '设置你们在一起的日期'}} -