1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- // pages/release/release.js
- // 获取应用实例
- const app = getApp()
-
- Page({
- data: {
- currentIndex: 3,
- user: {
- chatHeads: "https://wx.qlogo.cn/mmopen/vi_32/GhKAicgjqaCK1oZDfibe4ciaBWicWDnMFqibzWU0qp5diaE8tatUQCyTpDvlJIHJTbVprC1Dbwjh5WkWcgdmlO4VicJ8w/132",
- name: "微信昵称微信昵称微微信微信昵称微信昵称微微信",
- },
- isLogin: false,
- listData: [
- {
- title: "我发布的需求",
- code: "my-release",
- },
- {
- title: "我收藏的需求",
- code: "my-collect",
- },
- {
- title: "我关注的类型",
- code: "my-attention",
- },
- {
- title: "联系客服",
- code: "my-contact",
- },
- ],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- if (app.globalData.businessCommunicationCustomer) {
- this.setData({
- user: app.globalData.businessCommunicationCustomer,
- isLogin:true
- })
- console.log(`------------------当前登录用户-----------------------`)
- console.log(app.globalData.businessCommunicationCustomer);
- console.log(`------------------当前登录用户-----------------------`)
- }
- },
- // 前往登录页
- goLogin(e) {
- app.goLogin();
- },
- // 路由跳转
- goRouterPage(e) {
- let code = e.currentTarget.dataset.code;
- let customerid = this.data.user.customerId;
- if (!customerid && code != 'my-contact') {
- app.goLogin();
- return
- }
- let url = "";
- // 前往主页
- if (code == 'homepage') {
- url = "/pages/index/components/homepage/homepage";
- }
- // 前往发布的需求
- if (code == 'my-release') {
- url = "/pages/myModule/components/myRelease/myRelease";
- }
- // 前往收藏的需求
- if (code == 'my-collect') {
- url = "/pages/myModule/components/myCollect/myCollect";
- }
- // 前往关注的类型
- if (code == 'my-attention') {
- url = "/pages/myModule/components/myAttention/myAttention";
- }
- // 前往联系客服
- if (code == 'my-contact') {
- url = "/pages/outLink/outLink";
- }
- wx.navigateTo({
- url,
- success: function (res) {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('customerid', { customerid })
- }
- })
- },
- // 退出登录
- exitLogin(){
- wx.removeStorageSync('userInfo');
- wx.removeStorageSync('businessCommunicationCustomer');
- app.globalData.businessCommunicationCustomer = null;
- app.globalData.customerId = null;
- this.setData({
- user:{},
- isLogin:false
- })
- },
- })
|