Commit c661025b by 施宇

3

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