Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsalesProgram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c661025b
authored
Aug 09, 2019
by
施宇
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
3
parent
9db8aced
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
63 additions
and
85 deletions
app.js
pages/tab/home/home.js
pages/tab/home/home.wxml
pages/tab/home/home.wxss
pages/tab/me/me.js
pages/tab/me/me.wxml
pages/tab/message/message.js
res/images/icons/home-s-4.png
utils/chat.js
app.js
View file @
c661025b
...
...
@@ -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'
...
...
pages/tab/home/home.js
View file @
c661025b
...
...
@@ -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({
})
}
},
fals
e
)
},
tru
e
)
},
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
);
}
...
...
pages/tab/home/home.wxml
View file @
c661025b
...
...
@@ -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>
...
...
pages/tab/home/home.wxss
View file @
c661025b
...
...
@@ -69,15 +69,14 @@
.advs-content {
flex: 1;
max-height:
60
px;
max-height:
110r
px;
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:
12
px;
font-size:
24r
px;
color: #61a0f2;
background: #f0f6fa;
border-radius: 2rpx;
height: 18px;
line-height: 18px;
padding: 0 19rpx;
padding: 2rpx 19rpx;
}
.adv-num {
font-size:
14
px;
font-size:
24r
px;
color: #515559;
margin-left: 24rpx;
}
.adv-time {
font-size:
12
px;
font-size:
24r
px;
color: #8a9299;
margin-left: 27rpx;
}
...
...
pages/tab/me/me.js
View file @
c661025b
...
...
@@ -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
pages/tab/me/me.wxml
View file @
c661025b
...
...
@@ -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>
...
...
pages/tab/message/message.js
View file @
c661025b
...
...
@@ -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
,
});
},
...
...
res/images/icons/home-s-4.png
View file @
c661025b
4.05 KB
|
W:
|
H:
1.78 KB
|
W:
|
H:
2-up
Swipe
Onion skin
utils/chat.js
View file @
c661025b
...
...
@@ -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
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment