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