| default: 'index', | default: 'index', | ||||
| }, | }, | ||||
| // 是否收藏 | // 是否收藏 | ||||
| isCollect:{ | |||||
| type:Boolean, | |||||
| default:false | |||||
| isCollect: { | |||||
| type: Boolean, | |||||
| default: false | |||||
| }, | }, | ||||
| // 类名 | // 类名 | ||||
| listClass:{ | |||||
| type:String, | |||||
| default:"", | |||||
| listClass: { | |||||
| type: String, | |||||
| default: "", | |||||
| }, | }, | ||||
| }, | }, | ||||
| methods: { | methods: { | ||||
| // 进入详情 | // 进入详情 | ||||
| goDetails(e) { | goDetails(e) { | ||||
| if(this.data.listClass == 'disabled-model-view'){ | |||||
| if (this.data.listClass == 'disabled-model-view') { | |||||
| return | return | ||||
| } | } | ||||
| let dataset = e.currentTarget.dataset; | let dataset = e.currentTarget.dataset; | ||||
| this.triggerEvent('getItem', dataset.item); | this.triggerEvent('getItem', dataset.item); | ||||
| }, | }, | ||||
| // 进入个人主页 | // 进入个人主页 | ||||
| goHomePage(e){ | |||||
| goHomePage(e) { | |||||
| let customerid = e.currentTarget.dataset.customerid; | let customerid = e.currentTarget.dataset.customerid; | ||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| url: '/pages/index/components/homepage/homepage', | url: '/pages/index/components/homepage/homepage', | ||||
| }) | }) | ||||
| }, | }, | ||||
| // 收藏 | // 收藏 | ||||
| productCollect(e){ | |||||
| productCollect(e) { | |||||
| this.triggerEvent('changeCollect'); | this.triggerEvent('changeCollect'); | ||||
| }, | }, | ||||
| // 聊一聊 | // 聊一聊 | ||||
| goToChat(){ | |||||
| if(!app.globalData.customerId){ | |||||
| goToChat() { | |||||
| if (!app.globalData.customerId) { | |||||
| app.goLogin(); | app.goLogin(); | ||||
| return | return | ||||
| } | } | ||||
| console.log(`点击了聊一聊`) | console.log(`点击了聊一聊`) | ||||
| wx.navigateTo({ | |||||
| url:"/pages/msgModule/wechat2/wechat2", | |||||
| success: function (res) { | |||||
| // 通过eventChannel向被打开页面传送数据 | |||||
| res.eventChannel.emit('customerid', { customerid }) | |||||
| } | |||||
| }) | |||||
| }, | }, | ||||
| } | } | ||||
| }) | }) |
| if (prevPage.route == "pages/myModule/index") { | if (prevPage.route == "pages/myModule/index") { | ||||
| let businessCommunicationCustomer = res.data.businessCommunicationCustomer; | let businessCommunicationCustomer = res.data.businessCommunicationCustomer; | ||||
| if (res.data.customer.paidByMonth) { | if (res.data.customer.paidByMonth) { | ||||
| businessCommunicationCustomer.nickName = res.data.customer.paidByMonth; | |||||
| businessCommunicationCustomer.nickName = res.data.customer.nickName; | |||||
| businessCommunicationCustomer.isPartner = true; | businessCommunicationCustomer.isPartner = true; | ||||
| } else { | } else { | ||||
| businessCommunicationCustomer.isPartner = false; | businessCommunicationCustomer.isPartner = false; | ||||
| } | } | ||||
| prevPage.setData({ | prevPage.setData({ | ||||
| user: businessCommunicationCustomer | |||||
| user: businessCommunicationCustomer, | |||||
| isLogin:true | |||||
| }) | }) | ||||
| wx.setStorageSync('businessCommunicationCustomer', businessCommunicationCustomer) | wx.setStorageSync('businessCommunicationCustomer', businessCommunicationCustomer) | ||||
| wx.navigateBack() | wx.navigateBack() |
| user: { | user: { | ||||
| chatHeads: "https://wx.qlogo.cn/mmopen/vi_32/GhKAicgjqaCK1oZDfibe4ciaBWicWDnMFqibzWU0qp5diaE8tatUQCyTpDvlJIHJTbVprC1Dbwjh5WkWcgdmlO4VicJ8w/132", | chatHeads: "https://wx.qlogo.cn/mmopen/vi_32/GhKAicgjqaCK1oZDfibe4ciaBWicWDnMFqibzWU0qp5diaE8tatUQCyTpDvlJIHJTbVprC1Dbwjh5WkWcgdmlO4VicJ8w/132", | ||||
| name: "微信昵称微信昵称微微信微信昵称微信昵称微微信", | name: "微信昵称微信昵称微微信微信昵称微信昵称微微信", | ||||
| isPartner: true, | |||||
| address: "上海市·徐汇区", | |||||
| // customerId:666967, | |||||
| customerId: 666678, | |||||
| }, | }, | ||||
| isLogin: false, | isLogin: false, | ||||
| listData: [ | listData: [ | ||||
| user: app.globalData.businessCommunicationCustomer, | user: app.globalData.businessCommunicationCustomer, | ||||
| isLogin:true | isLogin:true | ||||
| }) | }) | ||||
| console.log(`------------------当前登录用户-----------------------`) | |||||
| console.log(app.globalData.businessCommunicationCustomer); | console.log(app.globalData.businessCommunicationCustomer); | ||||
| console.log(`------------------当前登录用户-----------------------`) | |||||
| } | } | ||||
| }, | }, | ||||
| // 前往登录页 | // 前往登录页 | ||||
| goRouterPage(e) { | goRouterPage(e) { | ||||
| let code = e.currentTarget.dataset.code; | let code = e.currentTarget.dataset.code; | ||||
| let customerid = this.data.user.customerId; | let customerid = this.data.user.customerId; | ||||
| if (!customerid) { | |||||
| if (!customerid && code != 'my-contact') { | |||||
| app.goLogin(); | app.goLogin(); | ||||
| return | |||||
| } | } | ||||
| let url = ""; | let url = ""; | ||||
| // 前往主页 | // 前往主页 | ||||
| } | } | ||||
| // 前往联系客服 | // 前往联系客服 | ||||
| if (code == 'my-contact') { | if (code == 'my-contact') { | ||||
| // url = "/pages/outLink/outLink"; | |||||
| url = "/pages/msgModule/wechat2/wechat2" | |||||
| url = "/pages/outLink/outLink"; | |||||
| } | } | ||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| url, | url, | ||||
| } | } | ||||
| }) | }) | ||||
| }, | }, | ||||
| // 退出登录 | |||||
| exitLogin(){ | |||||
| wx.removeStorageSync('userInfo'); | |||||
| wx.removeStorageSync('businessCommunicationCustomer'); | |||||
| app.globalData.businessCommunicationCustomer = null; | |||||
| app.globalData.customerId = null; | |||||
| this.setData({ | |||||
| user:{}, | |||||
| isLogin:false | |||||
| }) | |||||
| }, | |||||
| }) | }) |
| </view> | </view> | ||||
| <view class="user-info fl"> | <view class="user-info fl"> | ||||
| <view class="user-name-box fl" wx:if="{{ user.isPartner }}"> | <view class="user-name-box fl" wx:if="{{ user.isPartner }}"> | ||||
| <view class="user-name need yichu fl">{{ user.name }}</view> | |||||
| <view class="user-name need yichu fl">{{ user.nickName }}</view> | |||||
| <view class="user-isPartner fl"> | <view class="user-isPartner fl"> | ||||
| <image class="certification-img" src="/images/home/certification-icon.png" /> | <image class="certification-img" src="/images/home/certification-icon.png" /> | ||||
| 平台认证 | 平台认证 | ||||
| <view class="user-name-box fl" wx:else> | <view class="user-name-box fl" wx:else> | ||||
| <view class="user-name yichu fl">{{ user.name }}</view> | <view class="user-name yichu fl">{{ user.name }}</view> | ||||
| </view> | </view> | ||||
| <view class="user-address fl">{{ user.province + '·' + user.city }}</view> | |||||
| <view class="user-address fl">{{ user.province + user.city ? '·' + user.city : '' }}</view> | |||||
| <view class="show-home-page fl" bindtap="goRouterPage" data-code="homepage"> | <view class="show-home-page fl" bindtap="goRouterPage" data-code="homepage"> | ||||
| <image class="home-page-img" src="/images/home/home-page-icon.png" /> | <image class="home-page-img" src="/images/home/home-page-icon.png" /> | ||||
| 查 看 主 页 >> | 查 看 主 页 >> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class="exit-view"> | |||||
| <view class="exit-view" bindtap="exitLogin"> | |||||
| <image class="exit-img" src="/images/home/exit-icon.png" /> | <image class="exit-img" src="/images/home/exit-icon.png" /> | ||||
| 退出 | 退出 | ||||
| </view> | </view> |