Commit c661025b by 施宇

3

parent 9db8aced
......@@ -11,7 +11,6 @@ import {
App({
globalData: {
unReadMessageNum: 0,
auth: wx.getStorageSync('auth'),
token: wx.getStorageSync('access_token'),
isIPX: false, //是否为iphone X
......@@ -55,9 +54,9 @@ App({
if (this.globalData.auth) {
//是否登录
if (this.globalData.token) {
// wx.switchTab({
// url: '/pages/tab/home/home'
// });
wx.switchTab({
url: '/pages/tab/home/home'
});
} else {
wx.redirectTo({
url: '/pages/person/login/index'
......
......@@ -6,7 +6,6 @@ import {
import {
apis
} from '../../../utils/api.js';
let timer = null;
Page({
/**
......@@ -15,11 +14,10 @@ Page({
data: {
priceList: null,
xjList: [],
animation: {},
translateY: 0,
tabIndex: 1,
xb: 1, //1表示询价 2表示报价
limit: 10, //每页的条数
multiple:0
},
/**
......@@ -27,7 +25,7 @@ Page({
*/
onLoad: function(options) {
wx.removeStorageSync('homeToken')
this.getData();
this.getData(false);
if (!judgeToken()) {
wx.setStorageSync('homeToken', 1)
}
......@@ -35,19 +33,14 @@ Page({
getTopData: function() {
let me = this;
let token = wx.getStorageSync('access_token') || '';
this.setData({
xjList: [],
translateY: 0,
animation: {},
})
if (timer) {
clearInterval(timer)
}
// this.setData({
// xjList: [],
// })
getData(apis.inquirySearch, 'get', {
"offset": 10,
"p": 1,
"add_time/order": "desc",
"token": token
"p1": 1,
"add_time/order": "desc"
}, function(res) {
let newArr = [];
if (res.errcode === 0) {
......@@ -68,29 +61,15 @@ Page({
me.setData({
xjList: newArr
});
let arrLen = newArr.length;
if (!arrLen || arrLen < 3) {
if (newArr.length == 1) {
me.setData({
animation: {}
})
multiple:1
})
} else {
let allHeight = (arrLen - 2) * 30;
timer = setInterval(() => {
let translateY = me.data.translateY;
if (translateY + allHeight == 0) {
me.setData({
translateY: 0
})
me.translateYAnimation();
} else {
me.setData({
translateY: translateY - 30
});
me.translateYAnimation();
}
}, 2000)
me.setData({
multiple: 2
})
}
}
} else {
......@@ -99,9 +78,9 @@ Page({
})
}
}, false)
}, true)
},
getData: function() {
getData: function(bool) {
let me = this;
let url, token = wx.getStorageSync('access_token')
if (!token) {
......@@ -137,7 +116,7 @@ Page({
priceList: []
})
}
}, true)
}, bool)
}
},
interval: function(usedTime) {
......@@ -169,17 +148,6 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
translateYAnimation: function() {
let animation = wx.createAnimation({
duration: 1000,
timingFunction: 'ease',
delay: 1000
});
animation.translateY(this.data.translateY).step();
this.setData({
animation: animation.export()
});
},
onReady: function() {
},
......@@ -251,7 +219,7 @@ Page({
xb: 2,
});
}
this.getData();
this.getData(true);
}
......
......@@ -20,20 +20,22 @@
</view>
<view class="function-item column verCenter">
<image src="/res/images/icons/home-s-4.png" class="img"></image>
<text class="text">积分兑换</text>
<text class="text">福利中心</text>
</view>
</view>
<view class="advs" wx:if="{{xjList.length}}">
<view class="px-hr-top">
<view class=" row bothSide verCenter advs-content-parent">
<view class="advs-content">
<view class="advs-ul" animation="{{animation}}">
<view class="adv row verCenter" wx:for="{{xjList}}" wx:key="*this">
<text class="adv-mark">询价</text>
<text class="adv-num ellipsis">{{item.goods_name||'--'}}</text>
<text class="adv-time">{{item.usedTime}}</text>
</view>
</view>
<swiper vertical="true" circular="true" interval="2000" autoplay display-multiple-items='{{multiple}}' style="height:{{multiple==1?'55rpx':'110rpx'}}">
<swiper-item wx:for="{{xjList}}" wx:key="*this">
<view class="adv row verCenter">
<text class="adv-mark">询价</text>
<text class="adv-num ellipsis">{{item.goods_name||'--'}}</text>
<text class="adv-time">{{item.usedTime}}</text>
</view>
</swiper-item>
</swiper>
</view>
<view class="more-item" bindtap="toQd">
<text class="icon iconfont iconiconxiantiaoshouji6"></text>
......
......@@ -69,15 +69,14 @@
.advs-content {
flex: 1;
max-height:60px;
max-height:110rpx;
box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
position: relative;
}
.adv {
/* margin-bottom: 25rpx; */
height:30px;
height:55rpx;
margin-right: 29rpx;
}
......@@ -86,23 +85,21 @@
}
.adv-mark {
font-size: 12px;
font-size: 24rpx;
color: #61a0f2;
background: #f0f6fa;
border-radius: 2rpx;
height: 18px;
line-height: 18px;
padding: 0 19rpx;
padding: 2rpx 19rpx;
}
.adv-num {
font-size: 14px;
font-size: 24rpx;
color: #515559;
margin-left: 24rpx;
}
.adv-time {
font-size: 12px;
font-size: 24rpx;
color: #8a9299;
margin-left: 27rpx;
}
......
......@@ -132,5 +132,25 @@ Page({
}
}
},
sendCustomer: function () {
let my = wx.getStorageSync("myUsername");
let companyName = wx.getStorageSync("company_name");
let userId = wx.getStorageSync("user_id");
let avatar = wx.getStorageSync("avatar");
let queryObj = {
myName: my,
your: getApp().globalData.customerNum,
name: getApp().globalData.customerName,
name1: companyName,
id: userId,
touserid:'',
title: getApp().globalData.customerName,
img:'',
img1: avatar
};
wx.navigateTo({
url: "/pages/detail/chat/index?username=" + JSON.stringify(queryObj)
})
},
})
\ No newline at end of file
......@@ -73,7 +73,7 @@
</view>
</view>
<view class="hr"></view>
<view class="boxsiz bar row bothSide verCenter bor">
<view class="boxsiz bar row bothSide verCenter bor" bindtap="sendCustomer">
<view>
<text class="icon iconfont iconiconxiantiaoshouji26"></text>
<text class="t1">在线客服</text>
......
......@@ -10,7 +10,6 @@ Page({
* 页面的初始数据
*/
data: {
unReadSpotNum: 0,
arr: null,
userId: "",
customer: {},
......@@ -31,9 +30,9 @@ Page({
me.getCustom();
}
me.setData({
arr: me.getChatList(),
unReadSpotNum: getApp().globalData.unReadMessageNum > 99 ? '99+' : getApp().globalData.unReadMessageNum,
arr: me.getChatList()
});
});
}
......@@ -158,7 +157,6 @@ Page({
this.setData({
arr: this.getChatList(),
userId: wx.getStorageSync('user_id'),
unReadSpotNum: getApp().globalData.unReadMessageNum > 99 ? '99+' : getApp().globalData.unReadMessageNum,
});
},
......

4.05 KB | W: | H:

1.78 KB | W: | H:

res/images/icons/home-s-4.png
res/images/icons/home-s-4.png
res/images/icons/home-s-4.png
res/images/icons/home-s-4.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -24,13 +24,6 @@ let conn = {
}
};
const calcUnReadSpot = (message) => {
let myName = wx.getStorageSync("myUsername");
let allMembers = wx.getStorageSync("member") || []; //好友
let count = allMembers.reduce(function(result, curMember, idx) {
let chatMsgs = wx.getStorageSync(curMember.toLowerCase() + myName.toLowerCase()) || [];
return result + chatMsgs.length;
}, 0);
getApp().globalData.unReadMessageNum = count;
disp.fire("em.xmpp.unreadspot", message);
}
const onMessageError = (err) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment