运维小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. // pages/setup/index.js
  2. const api = require('../../api/index.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. // 状态栏高度
  9. statusBarHeight: wx.getStorageSync('statusBarHeight'),
  10. // 导航栏高度
  11. navBarHeight: wx.getStorageSync('navBarHeight'),
  12. // 导航栏和状态栏高度
  13. navStatusBarHeight: wx.getStorageSync('navStatusBarHeight'),
  14. // 胶囊
  15. menu:wx.getStorageSync('menu'),
  16. accountInfo:'',
  17. user:'',
  18. station:wx.getStorageSync('station'),
  19. showMultiTextAndTitle:false,
  20. inputValue: '', // 初始值
  21. partnerPosition:{}
  22. },
  23. onqrcode(){
  24. wx.navigateTo({
  25. url: '/pages/qrcode/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
  26. });
  27. },
  28. onstation(){
  29. wx.navigateTo({
  30. url: '/pages/station/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
  31. });
  32. },
  33. onsetup(){
  34. wx.navigateTo({
  35. url: '/pages/setuplevel/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
  36. });
  37. },
  38. // 电站详情
  39. onpowerstation(){
  40. wx.showToast({
  41. title: '暂未开放',
  42. icon: 'none'
  43. });
  44. return
  45. this.setData({
  46. showMultiTextAndTitle:true
  47. })
  48. },
  49. closeDialog(){
  50. this.setData({
  51. showMultiTextAndTitle:false
  52. })
  53. },
  54. click(){
  55. console.log('当前输入的文字是:', this.data.inputValue);
  56. },
  57. oncreatestation(){
  58. },
  59. toconfigure(e){
  60. console.log(e.currentTarget.dataset.name);
  61. if (e.currentTarget.dataset.name=="data") {
  62. wx.switchTab({
  63. url: '/pages/home/index',
  64. })
  65. }else if (e.currentTarget.dataset.name=="customer"){
  66. wx.navigateTo({
  67. url: '/pages/customer/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
  68. });
  69. }else if (e.currentTarget.dataset.name=="dailyreport"){
  70. wx.navigateTo({
  71. url: '/pages/dailyreport/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
  72. });
  73. }else{
  74. wx.showToast({
  75. title: '暂未开放',
  76. icon: 'none'
  77. });
  78. }
  79. },
  80. /**
  81. * 生命周期函数--监听页面加载
  82. */
  83. onLoad() {
  84. let _this = this
  85. try {
  86. const accountInfo = wx.getAccountInfoSync();
  87. this.setData({
  88. accountInfo:accountInfo.miniProgram.version
  89. })
  90. } catch (e) {
  91. console.error("获取小程序版本号失败:", e);
  92. }
  93. this.getuser()
  94. },
  95. getuser(){
  96. api.request(`/partner/selectinformation`, 'POST',{})
  97. .then((res) => {
  98. console.log(res);
  99. this.setData({
  100. user:res.data
  101. })
  102. // 设置数据到本地存储
  103. wx.setStorage({
  104. key: 'partnerPosition', // 存储的key值
  105. data:res.data,
  106. success: function(ress) {
  107. }
  108. });
  109. })
  110. .catch((err) => {
  111. console.error('请求失败:', err);
  112. // 在这里处理请求失败的情况
  113. });
  114. },
  115. onuser(){
  116. wx.showToast({
  117. title: '暂未开放',
  118. icon: 'none'
  119. });
  120. return
  121. wx.navigateTo({
  122. url: '/pages/personalInfo/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始
  123. });
  124. },
  125. /**
  126. * 生命周期函数--监听页面初次渲染完成
  127. */
  128. onReady() {
  129. },
  130. /**
  131. * 生命周期函数--监听页面显示
  132. */
  133. onShow() {
  134. this.setData({
  135. station:wx.getStorageSync('station'),
  136. partnerPosition:wx.getStorageSync('partnerPosition')
  137. })
  138. },
  139. /**
  140. * 生命周期函数--监听页面隐藏
  141. */
  142. onHide() {
  143. },
  144. /**
  145. * 生命周期函数--监听页面卸载
  146. */
  147. onUnload() {
  148. },
  149. /**
  150. * 页面相关事件处理函数--监听用户下拉动作
  151. */
  152. onPullDownRefresh() {
  153. },
  154. /**
  155. * 页面上拉触底事件的处理函数
  156. */
  157. onReachBottom() {
  158. },
  159. /**
  160. * 用户点击右上角分享
  161. */
  162. onShareAppMessage() {
  163. }
  164. })