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
dfddc2da
authored
Sep 16, 2019
by
施宇
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
22
parent
3e740fda
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
42 additions
and
39 deletions
components/chat/chat.js
components/chat/inputbar/suit/main/main.js
components/chat/msglist/msglist.wxml
pages/detail/good/index.js
pages/detail/xj/index.js
pages/tab/message/message.wxml
utils/api.js
utils/chat.js
components/chat/chat.js
View file @
dfddc2da
...
...
@@ -30,7 +30,7 @@ Component({
saveSendMsg
(
evt
){
msgStorage
.
saveMsg
(
evt
.
detail
.
msg
,
evt
.
detail
.
type
);
if
((
evt
.
detail
.
type
!==
'cmd'
)
&&
(
!
evt
.
detail
.
customer
)){
if
((
!
evt
.
detail
.
template
)
&&
(
!
evt
.
detail
.
customer
)){
this
.
data
.
__comps__
.
inputbar
.
cancelEmoji
();
}
}
...
...
components/chat/inputbar/suit/main/main.js
View file @
dfddc2da
...
...
@@ -56,7 +56,6 @@ Component({
sendMessage
()
{
if
(
this
.
data
.
isTopic
)
{
let
self
=
this
;
console
.
log
(
self
.
data
.
userMessage
)
this
.
triggerEvent
(
"newTextMsg"
,
{
msg
:
self
.
data
.
userMessage
...
...
@@ -127,10 +126,10 @@ Component({
inputMessage
:
""
,
});
},
send
Cmd
:
function
()
{
send
TemplateMessage
:
function
()
{
let
me
=
this
;
let
id
=
WebIM
.
conn
.
getUniqueId
();
let
msg
=
new
WebIM
.
message
(
msgType
.
CMD
,
id
);
let
msg
=
new
WebIM
.
message
(
msgType
.
TEXT
,
id
);
let
userId
=
wx
.
getStorageSync
(
'user_id'
);
let
companyName
=
wx
.
getStorageSync
(
'imNick'
);
let
avatar
=
wx
.
getStorageSync
(
'avatar'
);
...
...
@@ -144,18 +143,18 @@ Component({
touserid
:
touserid
,
name1
:
this
.
data
.
username
.
name
==
companyName
?
this
.
data
.
username
.
name1
:
this
.
data
.
username
.
name
,
img1
:
this
.
data
.
username
.
name
==
companyName
?
this
.
data
.
username
.
img1
:
this
.
data
.
username
.
img
,
timer
:
WebIM
.
time
()
timer
:
WebIM
.
time
(),
isTemplate
:
'1'
});
console
.
log
(
params
)
msg
.
set
({
msg
:
'
template
'
,
msg
:
''
,
from
:
me
.
data
.
username
.
myName
,
to
:
me
.
data
.
username
.
your
,
action
:
"template"
,
//
action: "template",
ext
:
params
,
success
:
function
()
{
console
.
log
(
'发送模板成功'
)
console
.
log
(
me
.
data
.
username
.
your
)
// getApp().addChatMember(me.data.username.your)
// disp.fire('em.chat.sendSuccess', id);
},
...
...
@@ -170,7 +169,8 @@ Component({
this
.
triggerEvent
(
"newTextMsg"
,
{
msg
:
msg
,
type
:
msgType
.
CMD
,
type
:
msgType
.
TEXT
,
template
:
true
},
{
bubbles
:
true
,
composed
:
true
...
...
@@ -198,7 +198,7 @@ Component({
template
:
template
});
wx
.
removeStorageSync
(
'template'
);
this
.
send
Cmd
();
this
.
send
TemplateMessage
();
};
if
(
customer
)
{
this
.
setData
({
...
...
components/chat/msglist/msglist.wxml
View file @
dfddc2da
...
...
@@ -32,8 +32,6 @@
</view>
</view>
</template>
<!-- view 换成 scroll-view效果更好 用view是为了要stopPullDownRefresh -->
<scroll-view scroll-y="true" class="{{ view }} wrap {{isIPX?'scroll_view_X': ''}}" bind:tap="onTap" scroll-into-view="{{ toView }}">
<view class="message" wx:for="{{ chatMsg }}" wx:key="{{ item.mid }}" id="{{ item.mid }}">
...
...
@@ -44,13 +42,13 @@
<block wx:else>
<image class="avatar" src="{{item.ext.img?item.ext.img:'/res/images/imgs/s.png'}}" />
</block>
<view class="msg {{item.
msg.type=='cmd'
?'cmd-msg':''}}">
<view class="msg {{item.
ext.isTemplate
?'cmd-msg':''}}">
<image class="err {{(item.style == 'self' && item.isFail) ? 'show' : 'hide'}}" src="../../../images/msgerr.png" />
<view wx:if="{{ item.msg.type == 'img'}}">
<template is="{{ item.msg.type }}" data="{{ item }}" />
</view>
<view wx:if="{{
item.msg.type == 'cmd'
}}">
<template is="
{{ item.msg.type }}
" data="{{ item }}" />
<view wx:if="{{
item.ext.isTemplate
}}">
<template is="
cmd
" data="{{ item }}" />
</view>
<view wx:elif="{{ item.msg.type == 'txt' || item.msg.type == 'emoji' }}">
<view class="template" wx:for="{{ item.msg.data }}" wx:key="">
...
...
pages/detail/good/index.js
View file @
dfddc2da
...
...
@@ -29,13 +29,13 @@ Page({
goodId
:
options
.
goodId
||
''
,
type
:
options
.
type
||
''
});
this
.
getData
(
false
)
this
.
getData
(
false
,
true
)
getApp
().
globalData
.
bus
.
off
(
'editGood'
);
getApp
().
globalData
.
bus
.
on
(
'editGood'
,
()
=>
{
me
.
getData
(
true
)
me
.
getData
(
true
,
true
)
})
},
getData
:
function
(
bool
)
{
getData
:
function
(
bool
,
isLoading
)
{
let
me
=
this
;
let
token
=
wx
.
getStorageSync
(
'access_token'
);
let
goodId
=
me
.
data
.
goodId
;
...
...
@@ -84,7 +84,7 @@ Page({
info
:
{}
})
}
},
true
)
},
isLoading
)
},
editGood
:
function
()
{
if
(
!
judgeToken
(
true
)
&&
this
.
data
.
type
==
3
)
{
...
...
@@ -104,7 +104,7 @@ Page({
let
userId
=
wx
.
getStorageSync
(
"user_id"
);
let
avatar
=
wx
.
getStorageSync
(
"avatar"
);
let
obj
=
{
userId
:
data
.
im_username
,
//
userId: data.im_username,
type
:
data
.
goods_name
,
price
:
data
.
currency
==
1
?
'¥'
+
data
.
price
:
'$'
+
data
.
price
,
brand
:
data
.
brand_name
,
...
...
@@ -113,9 +113,9 @@ Page({
hq
:
data
.
delivery_time
,
time
:
changeTime
(
data
.
add_time
*
1000
),
goodImage
:
data
.
goods_images
,
userName
:
data
.
company_name
,
targetId
:
data
.
user_id
,
userImg
:
data
.
avatar
,
//
userName: data.company_name,
//
targetId: data.user_id,
//
userImg: data.avatar,
};
let
queryObj
=
{
myName
:
my
,
...
...
@@ -211,12 +211,13 @@ Page({
refreshGood
:
function
()
{
let
me
=
this
;
console
.
log
(
this
.
data
.
goodId
)
getData
(
apis
.
goods
Save
,
'get'
,
{
getData
(
apis
.
goods
Polish
,
'get'
,
{
token
:
wx
.
getStorageSync
(
'access_token'
)
||
''
,
goods_id
:
me
.
data
.
goodId
},
function
(
res
)
{
if
(
res
.
errcode
==
0
)
{
tips
(
'操作成功'
)
tips
(
'操作成功'
);
me
.
getData
(
false
,
false
)
}
else
{
tips
(
res
.
errmsg
)
}
...
...
pages/detail/xj/index.js
View file @
dfddc2da
...
...
@@ -82,7 +82,7 @@ Page({
let
userId
=
wx
.
getStorageSync
(
"user_id"
);
let
avatar
=
wx
.
getStorageSync
(
"avatar"
);
let
obj
=
{
userId
:
data
.
im_username
,
//
userId: data.im_username,
type
:
topData
.
goods_name
,
price
:
topData
.
currency
==
1
?
'¥'
+
topData
.
price
:
'$'
+
topData
.
price
,
brand
:
topData
.
brand_name
,
...
...
@@ -91,9 +91,9 @@ Page({
hq
:
topData
.
delivery_time
,
time
:
changeTime
(
topData
.
add_time
*
1000
),
goodImage
:
topData
.
goods_images
||
''
,
userName
:
data
.
company_name
,
targetId
:
data
.
user_id
,
userImg
:
data
.
avatar
,
//
userName: data.company_name,
//
targetId: data.user_id,
//
userImg: data.avatar,
};
let
queryObj
=
{
myName
:
my
,
...
...
pages/tab/message/message.wxml
View file @
dfddc2da
...
...
@@ -56,7 +56,7 @@
<view class="message-c bold ellipsis">{{ item.name||'--' }}</view>
<view class="message-t ellipsis" wx:if="{{ item.msg.data[0].data }}">{{ item.msg.data[0].data }}</view>
<view class="message-t ellipsis" wx:if="{{item.msg.type == 'img' }}">[图片]</view>
<view class="message-t ellipsis" wx:if="{{item.
msg.type == 'cmd'
}}">{{item.ext.type}} {{item.ext.price}}</view>
<view class="message-t ellipsis" wx:if="{{item.
ext.isTemplate
}}">{{item.ext.type}} {{item.ext.price}}</view>
</view>
</view>
<view class="message-r">
...
...
utils/api.js
View file @
dfddc2da
...
...
@@ -111,6 +111,10 @@ const apis = {
* 商品修改
*/
goodsSave
:
goods_url
+
'/goods/save'
,
/**
* 商品擦亮
*/
goodsPolish
:
goods_url
+
'/goods/polish'
,
/***
* 商品上下架
*/
...
...
utils/chat.js
View file @
dfddc2da
...
...
@@ -124,15 +124,15 @@ const webimListen = () => {
conn
.
closed
=
true
;
WebIM
.
conn
.
close
();
},
onCmdMessage
(
message
)
{
if
(
message
)
{
if
(
onMessageError
(
message
))
{
addImUser
(
message
)
msgStorage
.
saveReceiveMsg
(
message
,
msgType
.
CMD
);
}
calcUnReadSpot
(
message
);
}
},
//
onCmdMessage(message) {
//
if (message) {
//
if (onMessageError(message)) {
//
addImUser(message)
//
msgStorage.saveReceiveMsg(message, msgType.CMD);
//
}
//
calcUnReadSpot(message);
//
}
//
},
onTextMessage
(
message
)
{
if
(
message
)
{
if
(
onMessageError
(
message
))
{
...
...
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