index.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. const app = require('../../utils/util.js');
  2. const tools = require('../../utils/tools.js');
  3. Page({
  4. data: {
  5. // 轮播
  6. backgrounds: [{
  7. "pic": "/images/banner1.png",
  8. // link:'../aboutme/index',
  9. },
  10. {
  11. "pic": "/images/banner2.png",
  12. // link:'../aboutme/index',
  13. },
  14. {
  15. "pic": "/images/banner3.png",
  16. // link:'../aboutme/index',
  17. },
  18. ],
  19. indicatorDots: true,
  20. vertical: false,
  21. autoplay: true,
  22. interval: 5000,
  23. duration: 500,
  24. number: {},
  25. msgList: [
  26. {
  27. url: "url",
  28. title: "欢迎来到吉顺致养小程序"
  29. },
  30. {
  31. url: "url",
  32. title: "欢迎来到吉顺致养小程序"
  33. },
  34. ]
  35. },
  36. goCollect() {
  37. wx.switchTab({
  38. url: '/pages/collectInfo/collectInfo',
  39. })
  40. },
  41. goXunfang() {
  42. wx.switchTab({
  43. url: '/pages/visitandinfo/visitandinfo',
  44. })
  45. },
  46. goTongzhi() {
  47. wx.navigateTo({
  48. url: '/pages/notice/notice',
  49. })
  50. },
  51. goPaiming() {
  52. wx.navigateTo({
  53. url: '/pages/paiming/paiming',
  54. })
  55. },
  56. goSaoMa() {
  57. console.log("扫阿");
  58. var _this = this;
  59. // 允许从相机和相册扫码
  60. wx.scanCode({
  61. onlyFromCamera: true,
  62. success: (res) => {
  63. console.log(res, "打印锕");
  64. let length = res.result.substring(res.result.lastIndexOf('/') + 1, res.result.length)
  65. wx.navigateTo({
  66. url: '/pages/love/love?id=' + length,
  67. })
  68. },
  69. fail: (res) => {
  70. console.log(res, "假的");
  71. wx.showToast({
  72. title: '扫码失败',
  73. icon: 'none',
  74. duration: 2000,
  75. })
  76. }
  77. })
  78. },
  79. depts() {
  80. console.log(wx.getStorageSync('openId'), "openid的问题");
  81. wx.request({
  82. url: app.globalData.publicUrl + '/applet/homeStatistics',
  83. method: "GET",
  84. data: {
  85. appletsId: wx.getStorageSync('openId')
  86. },
  87. success: (res) => {
  88. if (res.data.code == 0) {
  89. this.setData({
  90. number: res.data.data
  91. })
  92. }
  93. }
  94. })
  95. },
  96. onLoad() {
  97. this.depts();
  98. },
  99. onShow() {
  100. this.depts();
  101. }
  102. })