index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import Toast from '@vant/weapp/toast/toast';
  2. const _Http = getApp().globalData.http;
  3. const loginMsg = require("./modules/login");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. isAgree: true
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad(options) {
  15. },
  16. toPhoneLodin() {
  17. if (!this.data.isAgree) return Toast({
  18. message: '请阅读并勾选用户协议',
  19. position: 'bottom'
  20. });
  21. wx.navigateTo({
  22. url: './phone'
  23. })
  24. },
  25. agreementChange({
  26. detail
  27. }) {
  28. this.setData({
  29. isAgree: detail
  30. })
  31. },
  32. wechatLogin() {
  33. wx.login({
  34. success(res) {
  35. if (res.code) {
  36. _Http.loginbywechat({
  37. wechat_code: res.code,
  38. "systemclient": "wechatsaletool"
  39. }).then(res => {
  40. console.log(res)
  41. if (res.code == 0) return wx.showToast({
  42. title: res.msg,
  43. icon: "none"
  44. })
  45. loginMsg.loginMsg(res);
  46. })
  47. } else {
  48. console.log('登录失败!' + res.errMsg)
  49. }
  50. }
  51. })
  52. },
  53. /**
  54. * 生命周期函数--监听页面初次渲染完成
  55. */
  56. onReady() {
  57. },
  58. /**
  59. * 生命周期函数--监听页面显示
  60. */
  61. onShow() {
  62. },
  63. /**
  64. * 生命周期函数--监听页面隐藏
  65. */
  66. onHide() {
  67. },
  68. /**
  69. * 生命周期函数--监听页面卸载
  70. */
  71. onUnload() {
  72. },
  73. /**
  74. * 页面相关事件处理函数--监听用户下拉动作
  75. */
  76. onPullDownRefresh() {
  77. },
  78. /**
  79. * 页面上拉触底事件的处理函数
  80. */
  81. onReachBottom() {
  82. },
  83. /**
  84. * 用户点击右上角分享
  85. */
  86. onShareAppMessage() {
  87. }
  88. })