微信小程序
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.

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