bind.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. const app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. frameStyle: { useTop: true, name: '账号绑定', leftArrow: false, useBar: false },
  8. id: '',
  9. type: ''
  10. },
  11. // 返回
  12. back: function () {
  13. wx.navigateBack({ delta: 1 })
  14. },
  15. toBind: function () {
  16. const that = this;
  17. let id = that.data.id;
  18. let type = that.data.type;
  19. wx.showModal({
  20. title: '提示',
  21. content: '你确定要使用此微信绑定账号吗?',
  22. async success(res) {
  23. if (res.confirm) {
  24. // 学校
  25. let arr;
  26. if (type == '1') { arr = await app.$get(`/school/${id}`) };
  27. if (arr.errcode == '0') {
  28. let params = {}
  29. } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
  30. }
  31. }
  32. })
  33. },
  34. /**
  35. * 生命周期函数--监听页面加载
  36. */
  37. onLoad: function (options) {
  38. const that = this;
  39. that.setData({ id: options.id || '62ff209808c3ce998df15dd3', type: options.type || '1' })
  40. },
  41. /**
  42. * 生命周期函数--监听页面初次渲染完成
  43. */
  44. onReady: function () {
  45. },
  46. /**
  47. * 生命周期函数--监听页面显示
  48. */
  49. onShow: function () {
  50. const that = this;
  51. },
  52. /**
  53. * 生命周期函数--监听页面隐藏
  54. */
  55. onHide: function () {
  56. },
  57. /**
  58. * 生命周期函数--监听页面卸载
  59. */
  60. onUnload: function () {
  61. },
  62. /**
  63. * 页面相关事件处理函数--监听用户下拉动作
  64. */
  65. onPullDownRefresh: function () {
  66. },
  67. /**
  68. * 页面上拉触底事件的处理函数
  69. */
  70. onReachBottom: function () {
  71. },
  72. /**
  73. * 用户点击右上角分享
  74. */
  75. onShareAppMessage: function () {
  76. }
  77. })