Commit dfddc2da by 施宇

22

parent 3e740fda
......@@ -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();
}
}
......
......@@ -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: "",
});
},
sendCmd: function () {
sendTemplateMessage: 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.sendCmd();
this.sendTemplateMessage();
};
if (customer) {
this.setData({
......
......@@ -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="">
......
......@@ -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.goodsSave, 'get', {
getData(apis.goodsPolish, '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)
}
......
......@@ -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,
......
......@@ -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">
......
......@@ -111,6 +111,10 @@ const apis = {
* 商品修改
*/
goodsSave: goods_url + '/goods/save',
/**
* 商品擦亮
*/
goodsPolish: goods_url + '/goods/polish',
/***
* 商品上下架
*/
......
......@@ -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)) {
......
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