收藏
回答

判断data里的 控制页面弹框return终止执行下面代码,就会有这个弹框?

回答关注问题邀请回答
收藏

3 个回答

  • ؞咬了你؞F࿆ū࿆t࿆ū࿆r࿆ē࿆
    ؞咬了你؞F࿆ū࿆t࿆ū࿆r࿆ē࿆
    2021-06-17

    废话少说,放码过来!

    2021-06-17
    有用
    回复 2
    • 吉拉扒啦
      吉拉扒啦
      2021-06-17
      tijiao(e) {
          // 这行代码位置不能放在获取手机号下面
          let that = this
          if(e.currentTarget.dataset.type !== '2'){
            if (!(this.data.phone.length > 9 && this.data.name.length > 0) ){
              this.submitAlert()//简单的提示
            }else{
              that.tijiaoDetail(e)
            }
          }else{
            that.tijiaoDetail(e)
          }
        },
        tijiaoDetail(e){
          let that = this
          this.setData({
            client_type: 2
          })
          if (!that.data.showPhone) {
            this.setData({
              phoneshow: true
            })
            return;
          }
          var phone = this.data.phone;
          var name = this.data.name || null;
          var txt = e.currentTarget.dataset.txt || '';
          var data = {
            building_id: this.data.building_id,
            appoint_id: this.data.id,
            merchant_id: this.data.merchant_id,
            title: this.data.title,
            phone: phone,
            type: 2,
            clue_type: +e.currentTarget.dataset.type
          }
          if (name) {
            data.name = name;
          }
          // 提交预约
          wx.request({
            url: app.gData.http2 + '/v1/ytf/wxapp/active_appoint',
            data: data,
            method: 'post',
            header: {
              'y-wxapp-jwt': wx.getStorageSync('token')
            },
            success: (res) => {
              if (res.data.error_no == 0) { //预约成功
                this.setData({
                  yuyueshow: true,
                });
                wx.showToast({
                  title: txt || res.data.error_msg,
                  icon: 'success',
                  time: 1500,
                })
              } else { // 预约失败
                wx.showToast({
                  title: res.data.error_msg,
                  icon: 'success',
                  time: 1500,
                })
              }
            },
            fail(err) {}
          })
        },
      2021-06-17
      回复
    • 吉拉扒啦
      吉拉扒啦
      2021-06-17
      只有,一加和华为手机才会出现这个提示,其他手机正常
      2021-06-17
      回复
  • 神经蛙
    神经蛙
    2021-06-17

    上代码

    2021-06-17
    有用
    回复 5
    • 吉拉扒啦
      吉拉扒啦
      2021-06-17
      tijiao(e) {
          // 这行代码位置不能放在获取手机号下面
          let that = this
          if(e.currentTarget.dataset.type !== '2'){
            if (!(this.data.phone.length > 9 && this.data.name.length > 0) ){
              this.submitAlert()//简单的提示
            }else{
              that.tijiaoDetail(e)
            }
          }else{
            that.tijiaoDetail(e)
          }
        },
        tijiaoDetail(e){
          let that = this
          this.setData({
            client_type: 2
          })
          if (!that.data.showPhone) {
            this.setData({
              phoneshow: true
            })
            return;
          }
          var phone = this.data.phone;
          var name = this.data.name || null;
          var txt = e.currentTarget.dataset.txt || '';
          var data = {
            building_id: this.data.building_id,
            appoint_id: this.data.id,
            merchant_id: this.data.merchant_id,
            title: this.data.title,
            phone: phone,
            type: 2,
            clue_type: +e.currentTarget.dataset.type
          }
          if (name) {
            data.name = name;
          }
          // 提交预约
          wx.request({
            url: app.gData.http2 + '/v1/ytf/wxapp/active_appoint',
            data: data,
            method: 'post',
            header: {
              'y-wxapp-jwt': wx.getStorageSync('token')
            },
            success: (res) => {
              if (res.data.error_no == 0) { //预约成功
                this.setData({
                  yuyueshow: true,
                });
                wx.showToast({
                  title: txt || res.data.error_msg,
                  icon: 'success',
                  time: 1500,
                })
              } else { // 预约失败
                wx.showToast({
                  title: res.data.error_msg,
                  icon: 'success',
                  time: 1500,
                })
              }
            },
            fail(err) {}
          })
        },
      2021-06-17
      回复
    • 神经蛙
      神经蛙
      2021-06-17回复吉拉扒啦
      除了你预约成功和失败都弹出了res.data.error_msg,其他的我觉得整块代码没问题啊,你感觉是return的问题吗?
      2021-06-17
      回复
    • 吉拉扒啦
      吉拉扒啦
      发表于移动端
      2021-06-17回复神经蛙
      之前觉得是return的问题,但是只有一加和华为的手机才有这种情况
      2021-06-17
      回复
    • 神经蛙
      神经蛙
      2021-06-17回复吉拉扒啦
      你打开调试,试着在 return 后面输出一下,如果说华为的手机输出了,就是return的问题,如果没输出,找下其他的toast,看看是那个地方弹出来的
      2021-06-17
      回复
    • 吉拉扒啦
      吉拉扒啦
      发表于移动端
      2021-06-17回复神经蛙
      好的,谢谢
      2021-06-17
      回复
  • 微喵网络
    微喵网络
    2021-06-17

    上代码

    2021-06-17
    有用
    回复 2
    • 吉拉扒啦
      吉拉扒啦
      2021-06-17
      tijiao(e) {
          // 这行代码位置不能放在获取手机号下面
          let that = this
          if(e.currentTarget.dataset.type !== '2'){
            if (!(this.data.phone.length > 9 && this.data.name.length > 0) ){
              this.submitAlert()//简单的提示
            }else{
              that.tijiaoDetail(e)
            }
          }else{
            that.tijiaoDetail(e)
          }
        },
        tijiaoDetail(e){
          let that = this
          this.setData({
            client_type: 2
          })
          if (!that.data.showPhone) {
            this.setData({
              phoneshow: true
            })
            return;
          }
          var phone = this.data.phone;
          var name = this.data.name || null;
          var txt = e.currentTarget.dataset.txt || '';
          var data = {
            building_id: this.data.building_id,
            appoint_id: this.data.id,
            merchant_id: this.data.merchant_id,
            title: this.data.title,
            phone: phone,
            type: 2,
            clue_type: +e.currentTarget.dataset.type
          }
          if (name) {
            data.name = name;
          }
          // 提交预约
          wx.request({
            url: app.gData.http2 + '/v1/ytf/wxapp/active_appoint',
            data: data,
            method: 'post',
            header: {
              'y-wxapp-jwt': wx.getStorageSync('token')
            },
            success: (res) => {
              if (res.data.error_no == 0) { //预约成功
                this.setData({
                  yuyueshow: true,
                });
                wx.showToast({
                  title: txt || res.data.error_msg,
                  icon: 'success',
                  time: 1500,
                })
              } else { // 预约失败
                wx.showToast({
                  title: res.data.error_msg,
                  icon: 'success',
                  time: 1500,
                })
              }
            },
            fail(err) {}
          })
        },
      2021-06-17
      回复
    • 微喵网络
      微喵网络
      2021-06-17回复吉拉扒啦
      每个都回复,还不如把代码放到问题里
      2021-06-17
      回复
登录 后发表内容