合伙人运营小程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // pages/powerstation/index.js
  2. const api = require('../../api/index.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. infolist:{},
  9. options:{},
  10. msg:''
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad(options) {
  16. console.log(options);
  17. this.setData({
  18. options:options
  19. })
  20. this.getinfo()
  21. },
  22. getinfo(){
  23. let _this =this
  24. api.request(`/station/${this.data.options.id}/info`, 'POST')
  25. .then((res) => {
  26. wx.showToast({
  27. title: res.msg,
  28. icon: 'none',
  29. });
  30. this.setData({
  31. msg:res.msg,
  32. infolist:res.data
  33. })
  34. if (res.msg =='成功') {
  35. api.request('/station/list/stationName', 'POST')
  36. .then((ress) => {
  37. for (let index = 0; index < ress.data.length; index++) {
  38. if (_this.data.options.id == ress.data[index].id) {
  39. wx.setStorage({
  40. key: 'station', // 本地缓存中指定的 key
  41. data: ress.data[index],
  42. success: function () {
  43. }
  44. });
  45. }
  46. }
  47. })
  48. }
  49. })
  50. .catch((err) => {
  51. console.error('请求失败:', err);
  52. // 在这里处理请求失败的情况
  53. });
  54. },
  55. // 绑定
  56. signout(){
  57. let data ={
  58. deviceId:this.data.options.id,
  59. UnbindStart:1
  60. }
  61. api.request('/system/tenantpower/APP/bind', 'POST',data )
  62. .then((res) => {
  63. wx.showToast({
  64. title: res.msg,
  65. icon: 'none',
  66. });
  67. this.getinfo()
  68. })
  69. .catch((err) => {
  70. console.error('请求失败:', err);
  71. // 在这里处理请求失败的情况
  72. });
  73. },
  74. /**
  75. * 生命周期函数--监听页面初次渲染完成
  76. */
  77. onReady() {
  78. },
  79. /**
  80. * 生命周期函数--监听页面显示
  81. */
  82. onShow() {
  83. },
  84. /**
  85. * 生命周期函数--监听页面隐藏
  86. */
  87. onHide() {
  88. },
  89. /**
  90. * 生命周期函数--监听页面卸载
  91. */
  92. onUnload() {
  93. },
  94. /**
  95. * 页面相关事件处理函数--监听用户下拉动作
  96. */
  97. onPullDownRefresh() {
  98. },
  99. /**
  100. * 页面上拉触底事件的处理函数
  101. */
  102. onReachBottom() {
  103. },
  104. /**
  105. * 用户点击右上角分享
  106. */
  107. onShareAppMessage() {
  108. }
  109. })