Selaa lähdekoodia

退出登录

release/210823_需求对对碰
王饶冀 3 vuotta sitten
vanhempi
commit
2c17d69c94
4 muutettua tiedostoa jossa 40 lisäystä ja 23 poistoa
  1. 18
    11
      components/listItem/listItem.js
  2. 3
    2
      pages/login/login.js
  3. 16
    7
      pages/myModule/index.js
  4. 3
    3
      pages/myModule/index.wxml

+ 18
- 11
components/listItem/listItem.js Näytä tiedosto

@@ -15,14 +15,14 @@ Component({
default: 'index',
},
// 是否收藏
isCollect:{
type:Boolean,
default:false
isCollect: {
type: Boolean,
default: false
},
// 类名
listClass:{
type:String,
default:"",
listClass: {
type: String,
default: "",
},
},

@@ -38,14 +38,14 @@ Component({
methods: {
// 进入详情
goDetails(e) {
if(this.data.listClass == 'disabled-model-view'){
if (this.data.listClass == 'disabled-model-view') {
return
}
let dataset = e.currentTarget.dataset;
this.triggerEvent('getItem', dataset.item);
},
// 进入个人主页
goHomePage(e){
goHomePage(e) {
let customerid = e.currentTarget.dataset.customerid;
wx.navigateTo({
url: '/pages/index/components/homepage/homepage',
@@ -56,16 +56,23 @@ Component({
})
},
// 收藏
productCollect(e){
productCollect(e) {
this.triggerEvent('changeCollect');
},
// 聊一聊
goToChat(){
if(!app.globalData.customerId){
goToChat() {
if (!app.globalData.customerId) {
app.goLogin();
return
}
console.log(`点击了聊一聊`)
wx.navigateTo({
url:"/pages/msgModule/wechat2/wechat2",
success: function (res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('customerid', { customerid })
}
})
},
}
})

+ 3
- 2
pages/login/login.js Näytä tiedosto

@@ -121,13 +121,14 @@ Page({
if (prevPage.route == "pages/myModule/index") {
let businessCommunicationCustomer = res.data.businessCommunicationCustomer;
if (res.data.customer.paidByMonth) {
businessCommunicationCustomer.nickName = res.data.customer.paidByMonth;
businessCommunicationCustomer.nickName = res.data.customer.nickName;
businessCommunicationCustomer.isPartner = true;
} else {
businessCommunicationCustomer.isPartner = false;
}
prevPage.setData({
user: businessCommunicationCustomer
user: businessCommunicationCustomer,
isLogin:true
})
wx.setStorageSync('businessCommunicationCustomer', businessCommunicationCustomer)
wx.navigateBack()

+ 16
- 7
pages/myModule/index.js Näytä tiedosto

@@ -8,10 +8,6 @@ Page({
user: {
chatHeads: "https://wx.qlogo.cn/mmopen/vi_32/GhKAicgjqaCK1oZDfibe4ciaBWicWDnMFqibzWU0qp5diaE8tatUQCyTpDvlJIHJTbVprC1Dbwjh5WkWcgdmlO4VicJ8w/132",
name: "微信昵称微信昵称微微信微信昵称微信昵称微微信",
isPartner: true,
address: "上海市·徐汇区",
// customerId:666967,
customerId: 666678,
},
isLogin: false,
listData: [
@@ -42,7 +38,9 @@ Page({
user: app.globalData.businessCommunicationCustomer,
isLogin:true
})
console.log(`------------------当前登录用户-----------------------`)
console.log(app.globalData.businessCommunicationCustomer);
console.log(`------------------当前登录用户-----------------------`)
}
},
// 前往登录页
@@ -53,8 +51,9 @@ Page({
goRouterPage(e) {
let code = e.currentTarget.dataset.code;
let customerid = this.data.user.customerId;
if (!customerid) {
if (!customerid && code != 'my-contact') {
app.goLogin();
return
}
let url = "";
// 前往主页
@@ -75,8 +74,7 @@ Page({
}
// 前往联系客服
if (code == 'my-contact') {
// url = "/pages/outLink/outLink";
url = "/pages/msgModule/wechat2/wechat2"
url = "/pages/outLink/outLink";
}
wx.navigateTo({
url,
@@ -86,4 +84,15 @@ Page({
}
})
},
// 退出登录
exitLogin(){
wx.removeStorageSync('userInfo');
wx.removeStorageSync('businessCommunicationCustomer');
app.globalData.businessCommunicationCustomer = null;
app.globalData.customerId = null;
this.setData({
user:{},
isLogin:false
})
},
})

+ 3
- 3
pages/myModule/index.wxml Näytä tiedosto

@@ -7,7 +7,7 @@
</view>
<view class="user-info fl">
<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">
<image class="certification-img" src="/images/home/certification-icon.png" />
平台认证
@@ -16,13 +16,13 @@
<view class="user-name-box fl" wx:else>
<view class="user-name yichu fl">{{ user.name }}</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">
<image class="home-page-img" src="/images/home/home-page-icon.png" />
查 看 主 页 >>
</view>
</view>
<view class="exit-view">
<view class="exit-view" bindtap="exitLogin">
<image class="exit-img" src="/images/home/exit-icon.png" />
退出
</view>

Loading…
Peruuta
Tallenna