微信小程序
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

113 satır
2.1 KiB

  1. // pages/user/region/region.js
  2. import * as UTIL from '../../../utils/util.js';
  3. import * as EVN_CONFIG from '../../../env/env.js';
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. isIPX: app.globalData.isIPX,
  11. activeNames: ['1'],
  12. nowDress:''
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad(options) {
  18. },
  19. onChange(event) {
  20. this.setData({
  21. activeNames: event.detail,
  22. });
  23. },
  24. back:function(){
  25. wx.navigateBack({
  26. delta: 1
  27. })
  28. },
  29. getLocation(){
  30. // var location = UTIL.getLocationFromWX();
  31. console.log(app.globalData.setInfo.latitude);
  32. },
  33. goChangeUrl(e){
  34. // https://192.168.0.112:8080/api e.currentTarget.dataset.url
  35. const url = e.currentTarget.dataset.url;
  36. const name = e.currentTarget.dataset.name;
  37. const parentname = e.currentTarget.dataset.parentname;
  38. wx.setStorageSync('dressCode', url);
  39. wx.setStorageSync('dressName', parentname+'-'+name);
  40. getApp().globalData.APIURL = url
  41. wx.reLaunch({
  42. url: '../login/login',
  43. })
  44. },
  45. /**
  46. * 生命周期函数--监听页面初次渲染完成
  47. */
  48. onReady() {
  49. },
  50. /**
  51. * 生命周期函数--监听页面显示
  52. */
  53. onShow() {
  54. var that = this ;
  55. let url = 'https://www.nongshen.net/static/wechat/area.json';
  56. wx.request({
  57. url: url, //接口地址
  58. data:{
  59. date:new Date().getTime()
  60. },
  61. header: {
  62. 'content-type': 'application/json' // 默认值
  63. },
  64. success (res) {
  65. console.log(res);
  66. that.setData({
  67. list : res.data,
  68. nowDress: wx.getStorageSync('dressName')
  69. })
  70. }
  71. })
  72. },
  73. /**
  74. * 生命周期函数--监听页面隐藏
  75. */
  76. onHide() {
  77. },
  78. /**
  79. * 生命周期函数--监听页面卸载
  80. */
  81. onUnload() {
  82. },
  83. /**
  84. * 页面相关事件处理函数--监听用户下拉动作
  85. */
  86. onPullDownRefresh() {
  87. },
  88. /**
  89. * 页面上拉触底事件的处理函数
  90. */
  91. onReachBottom() {
  92. },
  93. /**
  94. * 用户点击右上角分享
  95. */
  96. onShareAppMessage() {
  97. }
  98. })