index.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import {
  2. ApiModel
  3. } from "../../utils/api";
  4. const _Http = new ApiModel();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. url: {},
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. const url = decodeURIComponent(options.url);
  17. console.log(url)
  18. //判断是否纯在登录态度
  19. if (!wx.getStorageSync('userData').token) {
  20. getApp().globalData.liveUrl = url;
  21. wx.reLaunch({
  22. url: '/pages/login/index'
  23. })
  24. } else {
  25. _Http.basic({
  26. "accesstoken": wx.getStorageSync('userData').token,
  27. "classname": "customer.usercenter.usermsg.usermsg",
  28. "method": "query_usermsg",
  29. "content": {}
  30. }).then(res => {
  31. if (res.msg != '成功') {
  32. getApp().globalData.liveUrl = url;
  33. wx.reLaunch({
  34. url: '/pages/login/index'
  35. })
  36. }
  37. })
  38. };
  39. this.setData({
  40. url: url
  41. })
  42. },
  43. /**
  44. * 生命周期函数--监听页面初次渲染完成
  45. */
  46. onReady: function () {
  47. },
  48. /**
  49. * 生命周期函数--监听页面显示
  50. */
  51. onShow: function () {
  52. },
  53. /**
  54. * 生命周期函数--监听页面隐藏
  55. */
  56. onHide: function () {
  57. },
  58. /**
  59. * 生命周期函数--监听页面卸载
  60. */
  61. onUnload: function () {
  62. },
  63. /**
  64. * 页面相关事件处理函数--监听用户下拉动作
  65. */
  66. onPullDownRefresh: function () {
  67. },
  68. /**
  69. * 页面上拉触底事件的处理函数
  70. */
  71. onReachBottom: function () {
  72. },
  73. /**
  74. * 用户点击右上角分享
  75. */
  76. onShareAppMessage: function () {
  77. }
  78. })