Authored by zzzzzzz

评价ok

{{#date}}
<div class="chat-time">{{.}}</div>
{{/date}}
<div class="msg-wrap {{style}}">
<img src="{{avatar}}" alt="" class="head-icon">
<div class="chat-info">
... ...
... ... @@ -45,6 +45,7 @@ var chat = {
$chat: null,
$chatWin: null,
$netTip: null,
$ratingView: $('#chat-comment'),
state: {
lastMSGTime: ''
... ... @@ -133,6 +134,16 @@ var chat = {
self.sendMSG(msg);
});
this.$ratingView.on('click', '.submit', function() {
self.ratingView.post({
encryptedUid,
conversationId: cmEntity.conversationId,
});
}).on('rating-success', function(e, data) {
append(tip(`您对我们的服务评价为:${data}`).onLine());
resizeFooter();
});
window.addEventListener('online', function() {
self._networkSick(false);
});
... ... @@ -445,39 +456,11 @@ $('.text-in').on('keydown', function(e) {
});
// 触发菜单
$('.menu-trigger').on('touchend', function() {
$('.menu-trigger').on('click', function() {
let $menu = $('.menu');
if ($menu.css('display') === 'none') {
$menu.show();
resizeFooter();
} else {
$menu.hide();
resizeFooter();
}
$('.upload-img').upload({
auto: true,
fileType: 'image/*',
uploadScript: '/api/upload/image',
fileObjName: 'filename',
fileSizeLimit: 5000000,
height: '100%',
width: '100%',
multi: false,
formData: {
bucket: 'suggest'
},
onUploadComplete: function(file, data) {
let url;
data = saveImage.saveImage(data);
url = data.imgList[0].imgRelUrl + '?imageView2/2/w/640/q/90';
url = 'http://img11.static.yhbimg.com/suggest' + url;
sendMsg(2, url);
}
});
$('.uploadifive-button').css('position', 'absolute');
$menu.toggle();
resizeFooter();
});
... ...
... ... @@ -93,6 +93,7 @@ RatingView.prototype = $.extend({}, EventEmitter.prototype, {
const curVal = this.rank = $rank.index();
this.rankText = rankMap[curVal];
this.$label.text(rankMap[curVal]);
this.$ranks.toggleClass(index => {
... ... @@ -101,9 +102,10 @@ RatingView.prototype = $.extend({}, EventEmitter.prototype, {
},
post(data) {
const elem = this.elem;
const self = this,
elem = this.elem;
var params = {
stars: this.rank,
stars: ++this.rank,
promoter: 1,
reasonMsg: elem.find('.words-to-say').val(),
};
... ... @@ -115,7 +117,8 @@ RatingView.prototype = $.extend({}, EventEmitter.prototype, {
data: params,
success: function(res) {
if (res && res.code === 200) {
elem.hide();
elem.trigger('rating-success', [self.rankText]);
}
},
error: function() {
... ...