Commit b7909fb416d06b4cbb3eb5bc094e7cfc4a677452

Authored by pengye
1 parent 7f24cd89

商家入驻信息多次提交问题处理

@@ -76,7 +76,7 @@ Page({ @@ -76,7 +76,7 @@ Page({
76 }) 76 })
77 }) 77 })
78 }, 78 },
79 - submitInfo() { 79 + submitInfo: util.throttle(function () {
80 let sellername = this.data.sellername.trim(); 80 let sellername = this.data.sellername.trim();
81 let phone = this.data.phone.trim(); 81 let phone = this.data.phone.trim();
82 let rname = this.data.rname.trim(); 82 let rname = this.data.rname.trim();
@@ -131,9 +131,15 @@ Page({ @@ -131,9 +131,15 @@ Page({
131 if (res.ret != 200) { 131 if (res.ret != 200) {
132 return util.toast(res.msg, 'none') 132 return util.toast(res.msg, 'none')
133 } 133 }
134 - if(this.data.phone!='18601216909') this.sendIntentionFun() 134 + if(this.data.phone!='18601216909') {
  135 + this.sendIntentionFun()
  136 + }else{
  137 + wx.redirectTo({
  138 + url: '/pages/customer/collectSeller',
  139 + })
  140 + }
135 }) 141 })
136 - }, 142 + },3000),
137 // 发送意向店铺通知短信 143 // 发送意向店铺通知短信
138 sendIntentionFun(){ 144 sendIntentionFun(){
139 App.SaiYouYun.SendIntention({ 145 App.SaiYouYun.SendIntention({
@@ -255,6 +255,20 @@ function deletelUpload(filename,token,cb) { @@ -255,6 +255,20 @@ function deletelUpload(filename,token,cb) {
255 } 255 }
256 }) 256 })
257 }; 257 };
  258 +// 节流函数
  259 +function throttle(fn, gapTime) {
  260 + if (gapTime == null || gapTime == undefined) {
  261 + gapTime = 1500
  262 + }
  263 + let _lastTime = null
  264 + return function () {
  265 + let _nowTime = + new Date()
  266 + if (_nowTime - _lastTime > gapTime || !_lastTime) {
  267 + fn.apply(this, arguments)
  268 + _lastTime = _nowTime
  269 + }
  270 + }
  271 +}
258 module.exports = { 272 module.exports = {
259 formatTime: formatTime, 273 formatTime: formatTime,
260 unixtoTime: unixtoTime, 274 unixtoTime: unixtoTime,
@@ -266,6 +280,7 @@ module.exports = { @@ -266,6 +280,7 @@ module.exports = {
266 imageZoomHeightUtil, 280 imageZoomHeightUtil,
267 uploadFile, 281 uploadFile,
268 deletelUpload, 282 deletelUpload,
  283 + throttle,
269 cgi: function (act) { 284 cgi: function (act) {
270 return uri.HOST__LINE + act //正式 285 return uri.HOST__LINE + act //正式
271 //return uri.HOST__TEST+act //测试 286 //return uri.HOST__TEST+act //测试