业务交流通
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.js 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // pages/release/release.js
  2. // 获取应用实例
  3. const app = getApp()
  4. Page({
  5. data: {
  6. currentIndex: 3,
  7. user: {
  8. chatHeads: "https://wx.qlogo.cn/mmopen/vi_32/GhKAicgjqaCK1oZDfibe4ciaBWicWDnMFqibzWU0qp5diaE8tatUQCyTpDvlJIHJTbVprC1Dbwjh5WkWcgdmlO4VicJ8w/132",
  9. name: "微信昵称微信昵称微微信微信昵称微信昵称微微信",
  10. },
  11. isLogin: false,
  12. listData: [
  13. {
  14. title: "我发布的需求",
  15. code: "my-release",
  16. },
  17. {
  18. title: "我收藏的需求",
  19. code: "my-collect",
  20. },
  21. {
  22. title: "我关注的类型",
  23. code: "my-attention",
  24. },
  25. {
  26. title: "联系客服",
  27. code: "my-contact",
  28. },
  29. ],
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. if (app.globalData.businessCommunicationCustomer) {
  36. this.setData({
  37. user: app.globalData.businessCommunicationCustomer,
  38. isLogin:true
  39. })
  40. console.log(`------------------当前登录用户-----------------------`)
  41. console.log(app.globalData.businessCommunicationCustomer);
  42. console.log(`------------------当前登录用户-----------------------`)
  43. }
  44. },
  45. // 前往登录页
  46. goLogin(e) {
  47. app.goLogin();
  48. },
  49. // 路由跳转
  50. goRouterPage(e) {
  51. let code = e.currentTarget.dataset.code;
  52. let customerid = this.data.user.customerId;
  53. if (!customerid && code != 'my-contact') {
  54. app.goLogin();
  55. return
  56. }
  57. let url = "";
  58. // 前往主页
  59. if (code == 'homepage') {
  60. url = "/pages/index/components/homepage/homepage";
  61. }
  62. // 前往发布的需求
  63. if (code == 'my-release') {
  64. url = "/pages/myModule/components/myRelease/myRelease";
  65. }
  66. // 前往收藏的需求
  67. if (code == 'my-collect') {
  68. url = "/pages/myModule/components/myCollect/myCollect";
  69. }
  70. // 前往关注的类型
  71. if (code == 'my-attention') {
  72. url = "/pages/myModule/components/myAttention/myAttention";
  73. }
  74. // 前往联系客服
  75. if (code == 'my-contact') {
  76. url = "/pages/outLink/outLink";
  77. }
  78. wx.navigateTo({
  79. url,
  80. success: function (res) {
  81. // 通过eventChannel向被打开页面传送数据
  82. res.eventChannel.emit('customerid', { customerid })
  83. }
  84. })
  85. },
  86. // 退出登录
  87. exitLogin(){
  88. wx.removeStorageSync('userInfo');
  89. wx.removeStorageSync('businessCommunicationCustomer');
  90. app.globalData.businessCommunicationCustomer = null;
  91. app.globalData.customerId = null;
  92. this.setData({
  93. user:{},
  94. isLogin:false
  95. })
  96. },
  97. /**
  98. * 用户点击右上角分享给朋友
  99. */
  100. onShareAppMessage() {
  101. return {
  102. title: "分享你一个需求交流平台!推荐你一起来关注~",
  103. imageUrl: '/images/home/ShareApp-index.png',
  104. path: 'pages/index/index'
  105. }
  106. },
  107. })