select.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // pages/storeMessage/select.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. selectItem: '注册商户', //选中项
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad: function (options) {
  13. },
  14. /* 选择入口 */
  15. selectAccess(e) {
  16. const {
  17. name
  18. } = e.target.dataset;
  19. this.setData({
  20. selectItem: name
  21. })
  22. },
  23. /* 跳转页面 */
  24. submit() {
  25. if (this.data.selectItem == '注册商户') {
  26. wx.redirectTo({
  27. url: '/pages/storeMessage/index',
  28. })
  29. } else {
  30. wx.scanCode({
  31. success(res) {
  32. if (res.errMsg != 'scanCode:ok') return wx.showToast({
  33. title: '扫码失败',
  34. });
  35. wx.navigateTo({
  36. url: '/pages/login/QrCode?url=' + encodeURIComponent(res.result),
  37. });
  38. },
  39. fail(err) {
  40. wx.showToast({
  41. title: '扫码失败',
  42. });
  43. }
  44. })
  45. }
  46. },
  47. /**
  48. * 生命周期函数--监听页面初次渲染完成
  49. */
  50. onReady: function () {
  51. },
  52. /**
  53. * 生命周期函数--监听页面显示
  54. */
  55. onShow: function () {
  56. },
  57. /**
  58. * 生命周期函数--监听页面隐藏
  59. */
  60. onHide: function () {
  61. },
  62. /**
  63. * 生命周期函数--监听页面卸载
  64. */
  65. onUnload: function () {
  66. },
  67. /**
  68. * 页面相关事件处理函数--监听用户下拉动作
  69. */
  70. onPullDownRefresh: function () {
  71. },
  72. /**
  73. * 页面上拉触底事件的处理函数
  74. */
  75. onReachBottom: function () {
  76. },
  77. /**
  78. * 用户点击右上角分享
  79. */
  80. onShareAppMessage: function () {
  81. }
  82. })