my.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // pages/mytest/mytest.js
  2. const app = getApp()
  3. import http from "../../utils/http"
  4. import util from "../../utils/util"
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. safeTop: `40px`,
  11. info: '',
  12. config: '',
  13. appids: ''
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad(options) {
  19. const high = app.globalData.safeTop + 20
  20. this.setData({
  21. safeTop: `${high}px`
  22. })
  23. },
  24. /**
  25. * 生命周期函数--监听页面显示
  26. */
  27. onShow() {
  28. this.getInfo();
  29. },
  30. onLoadConfig(option){
  31. this.setData({
  32. config: app.globalData.config
  33. })
  34. },
  35. toService(){
  36. wx.navigateToMiniProgram({
  37. appId: this.data.appids.skillappid,
  38. envVersion: 'develop'
  39. })
  40. },
  41. toShop(){
  42. wx.navigateToMiniProgram({
  43. appId: this.data.appids.shopappid,
  44. envVersion: 'develop'
  45. })
  46. },
  47. login(){
  48. util.skip('/service/login/login')
  49. },
  50. skip(e){
  51. let url = e.currentTarget.dataset.url
  52. util.authSkip(url)
  53. },
  54. myOrder(e){
  55. let type = e.currentTarget.dataset.type
  56. let active = e.currentTarget.dataset.active
  57. let num = this.data.info ? this.data.info.orderCount.unServiceCount : 0
  58. util.authSkip('/service/myorder/myorder?type='+type+'&active='+active+'&num='+num)
  59. },
  60. getInfo(){
  61. http.post('index/getAppid', '', !this.data.info).then(res => {
  62. this.setData({
  63. appids: res.data
  64. })
  65. })
  66. if(!wx.getStorageSync('token')) return
  67. http.post('index/userindex', '', !this.data.info).then(res => {
  68. this.setData({
  69. info: res.data
  70. })
  71. })
  72. },
  73. //跳转意见反馈
  74. tofeedback(){
  75. wx.navigateTo({
  76. url: '/service/feedback/feedback',
  77. })
  78. },
  79. //跳转领券中心
  80. tocouponscenter(){
  81. wx.navigateTo({
  82. url: '/service/couponscenter/couponscenter',
  83. })
  84. },
  85. //跳转我的评论
  86. tomycomment(){
  87. wx.navigateTo({
  88. url: '/service/mycomment/mycomment',
  89. })
  90. },
  91. /**
  92. * 用户点击右上角分享
  93. */
  94. onShareAppMessage() {
  95. return {}
  96. }
  97. })