报错:ReferenceError: 相应的数据表 is not defined?

发布于 6 年前作者 taoyan11835 次浏览最后编辑 6 年前来自 ask

源代码为:

const app = getApp()

 

wx.cloud.init({

  env: 'houseworkapp-1g2njf66a3441491'

})

const db = wx.cloud.database({

  env: 'houseworkapp-1g2njf66a3441491'

})

 

Page({

 

  data: {

    phone: '', 

    username: '',

    usernameverify:1,

    NewChanges: '',

    NewChangesAgain: '',

  },

  

  handleInputPhone: function (e) {

    var that = this;

    that.setData({

      phone: e.detail.value

    })

  },

  handleusername: function (e) {

    var that = this;

    this.setData({

      username: e.detail.value

    })

    

  },

  handleNewChanges: function (e) {

    var that = this;

    that.setData({

      NewChanges: e.detail.value

    })

  },

  handleNewChangesAgain: function (e) {

    var that = this;

    that.setData({

      NewChangesAgain: e.detail.value

    })

  },

 

  submit: function (e) {

    var that = this

    

    db.collection('users'[相应的数据表]).where({ username: that.data.username }).get({

      success: function (res) {

        var that = this

        that.setData({

          usernameverify: res.data[0].verifycode 

        })

      }

    })

    if (that.data.phone == ''{

      console.log('a')

      wx.showToast({

        title: '手机号码不能为空',

        duration: 2000

      })

    } else if (that.data.phone.trim().length != 11{

      console.log('b')

      wx.showToast({

        title: '手机号码格式不对',

        duration: 2000

      })

    } else if (that.data.username == ''{

      console.log('c')

      wx.showToast({

        title: '登录名不能为空',

        duration: 2000

      })

    }

    else if (!that.data.usernameverify{

      console.log('d')

      wx.showToast({

        title: '登录名已经被注册了',

        duration: 2000

      })

    }

    else if (that.data.NewChanges == ''{

      console.

...

1 回复
zengguiying
zengguiying1 楼4 年前