123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- // 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(`------------------当前登录用户-----------------------`)
- }
- },
- onShow(){
- this.setData({
- currentIndex: 3
- })
- },
- // 前往登录页
- 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
- })
- },
- /**
- * 用户点击右上角分享给朋友
- */
- onShareAppMessage() {
- return {
- title: "分享你一个需求交流平台!推荐你一起来关注~",
- imageUrl: '/images/home/ShareApp-index.png',
- path: 'pages/index/index'
- }
- },
- })
|