Commit 1729f808 by 施宇

123123213

parent fd096e79
......@@ -305,6 +305,7 @@ body {
font-weight: 600;
color: #2E3033;
width: 100%;
line-height: 22px;
}
.goods_data_list .my_xj_list .my_xj_item .item_middle {
margin-top: 12px;
......
......@@ -363,6 +363,7 @@ body {
font-weight: 600;
color: #2E3033;
width: 100%;
line-height: 22px;
}
}
......
......@@ -127,19 +127,20 @@ $(function () {
WebIM.config = config;
//建立聊天链接
this.conn = WebIM.conn = new WebIM.default.connection({
appKey: WebIM.config.appkey,
isHttpDNS: WebIM.config.isHttpDNS,
isMultiLoginSessions: WebIM.config.isMultiLoginSessions,
https: typeof WebIM.config.https === 'boolean' ? WebIM.config.https : location.protocol ===
'https:',
host: WebIM.config.Host,
https: WebIM.config.https,
url: WebIM.config.xmppURL,
apiUrl: WebIM.config.apiURL,
isAutoLogin: true,
heartBeatWait: WebIM.config.heartBeatWait,
autoReconnectNumMax: WebIM.config.autoReconnectNumMax,
autoReconnectInterval: WebIM.config.autoReconnectInterval
autoReconnectInterval: WebIM.config.autoReconnectInterval,
isStropheLog: WebIM.config.isStropheLog,
delivery: WebIM.config.delivery
});
// 初始化上传组件 fileInputId对应页面上的file组件id
// WebIM.flashUpload = UploadShim({
// fileInputId: 'image'
// }, this.conn).flashUpload;
//增加表情
WebIM.Emoji = {
path: dist + '/faces/',
......@@ -456,11 +457,9 @@ $(function () {
var id = this.conn.getUniqueId();
var msg = new WebIM.default.message('txt', id);
var emojiMessage = WebIM.default.utils.parseEmoji(content); //表情解析工具
console.log(msg)
msg.set({
msg: content, // 消息内容;
to: userId, // 接收消息对象;
roomType: false,
success: function (id, serverMsgId) {
$('#' + userId).find('.notice_item_content').append(self.messageHtml(1,
emojiMessage, false));
......@@ -471,7 +470,7 @@ $(function () {
},
fail: function (e) {
console.log("Send private text failed",e);
console.log("Send private text failed", e);
}
});
this.conn.send(msg.body);
......@@ -480,14 +479,13 @@ $(function () {
var self = this;
var userId = $('.notice_left ').find('.active').attr('userid');
var id = this.conn.getUniqueId();
var msg = new WebIM.message('cmd', id);
var msg = new WebIM.default.message('cmd', id);
msg.set({
msg: 'template',
to: userId,
roomType: false,
action: "template",
ext: templateObj,
success: function (id, serverMsgId) {
success: function () {
$('#' + userId).find('.notice_item_content').append(self.messageHtml(1,
templateObj, true));
var contentHeight = $('#' + userId).find('.notice_item_content')
......@@ -513,7 +511,6 @@ $(function () {
apiUrl: WebIM.config.apiURL,
file: file,
to: userId,
roomType: false,
flashUpload: WebIM.flashUpload,
onFileUploadError: function () {
console.log('失败')
......
// /**
// * git do not control webim.config.js
// * everyone should copy webim.config.js.demo to webim.config.js
// * and have their own configs.
// * In this way , others won't be influenced by this config while git pull.
// *
// */
// var config = {
// /*
// * XMPP server
// */
// xmppURL: 'im-api.easemob.com',
// /*
// * Backend REST API URL
// */
// apiURL: (location.protocol === 'https:' ? 'https:' : 'http:') + '//a1.easemob.com',
// /*
// * Application AppKey
// */
// appkey: '1113190618181018#icsales',
// /*
// * Whether to use wss
// * @parameter {Boolean} true or false
// */
// https: false,
// /*
// * isMultiLoginSessions
// * true: A visitor can sign in to multiple webpages and receive messages at all the webpages.
// * false: A visitor can sign in to only one webpage and receive messages at the webpage.
// */
// isMultiLoginSessions: false,
// /*
// * Set to auto sign-in
// */
// isAutoLogin: false,
// /**
// * Whether to use window.doQuery()
// * @parameter {Boolean} true or false
// */
// isWindowSDK: false,
// /**
// * isSandBox=true: xmppURL: 'im-api.sandbox.easemob.com', apiURL: '//a1.sdb.easemob.com',
// * isSandBox=false: xmppURL: 'im-api.easemob.com', apiURL: '//a1.easemob.com',
// * @parameter {Boolean} true or false
// */
// isSandBox: false,
// /**
// * Whether to console.log in strophe.log()
// * @parameter {Boolean} true or false
// */
// isDebug: false,
// /**
// * will auto connect the xmpp server autoReconnectNumMax times in background when client is offline.
// * won't auto connect if autoReconnectNumMax=0.
// */
// autoReconnectNumMax: 2,
// /**
// * the interval secons between each atuo reconnectting.
// * works only if autoReconnectMaxNum >= 2.
// */
// autoReconnectInterval: 2,
// /**
// * webrtc supports WebKit and https only
// */
// isWebRTC: /WebKit/.test(navigator.userAgent) && /^https\:$/.test(window.location.protocol),
// /**
// * while http access,use ip directly,instead of ServerName,avoiding DNS problem.
// */
// isHttpDNS: false
// };
/**
* git do not control webim.config.js
* everyone should copy webim.config.js.demo to webim.config.js
......@@ -82,6 +11,24 @@
// protocol: "https"
// }
function getUrl(){
var apiUrl = (window.location.protocol === "https:" ? "https:" : "http:") + "//a1-hsb.easemob.com"
var xmppUrl = "im-api.easemob.com"
if(window.location.href.indexOf("webim-h5.easemob.com") !== -1 || window.location.href.indexOf("localhost") !== -1 || window.location.href.indexOf("172.17.2.168") !== -1){
apiUrl = (window.location.protocol === "https:" ? "https:" : "http:") + "//a1-hsb-ly.easemob.com"
xmppUrl = "im-api.easemob.com"
}
// else if(window.location.href.indexOf("webim-hsb.easemob.com") !== -1){
// apiUrl = (window.location.protocol === "https:" ? "https:" : "http:") + "//a1-hsb.easemob.com"
// xmppUrl = "im-api-hsb.easemob.com"
// }
return {
apiUrl: apiUrl,
xmppUrl: xmppUrl
}
}
var config = {
/*
* XMPP server
......
......@@ -45,6 +45,10 @@
* 获取用户基本信息
*/
authme:auth_url+'/auth/me',
/***
* 上传文件的接口
*/
ossupload:goods_url+'/oss/upload',
/**
* 商品列表
*/
......
!function () {
window.ReleaseInquiry = {
isClick: false,
init: function () {
this.created(this).mounted(this).handleBind(this);
},
created: function (opt) {
return this;
},
mounted: function (opt) {
return this;
},
handleBind: function (opt) {
//货期选择
layui.form.on('radio(delivery)', function (data) {
! function () {
window.ReleaseInquiry = {
isClick: false,
init: function () {
this.created(this).mounted(this).isIe(this).handleBind(this);
},
created: function (opt) {
return this;
},
mounted: function (opt) {
return this;
},
uploadFun: function () {
layui.upload.render({
elem: '#upload_section',
url: apis.ossupload,
data: {
token: Util.getCookie('token'),
source:2,
var str = '期货';
data.value == '期货' ? str='期货':str='现货';
var getTpl = deliveryHtml.innerHTML;
layui.laytpl(getTpl).render(str, function (html) {
$("#day").empty().html(html);
},
field:"upload",
before: function () {
layer.load(1, {
offset: ['50%', "50%"],
shade: false
});
});
//天数同步期货
$(document).on('input propertychange', 'input[name="day"]', function () {
var val = $(this).val();
$("#daytext").val(val + '天');
});
$('.cz').on('click',function(){
$('#xj_form')[0].reset();
})
//上传商品发布
layui.form.on('submit(add)', function (data) {
$(data.elem).addClass("layui-btn-disabled");
if (!opt.isClick) {
opt.isClick = true;
IcController.getData(apis.inquiryadd+'?token='+Util.getCookie('token'), 'get', data.field, function (res) {
if (res.errcode == 0) {
layer.msg('发布询价成功', {time: 2000}, function () {
window.location.href = '/inquiry';
});
} else {
layer.msg(res.errmsg);
opt.isClick = false;
$(data.elem).removeClass("layui-btn-disabled");
}
},
done: function (res) {
layer.closeAll('loading');
if (res.errcode == 0) {
layer.msg('上传成功', {
time: 600
}, function () {
window.location.href = "/uploadresult";
});
} else {
layer.msg(res.errmsg)
}
},
err: function () {
layer.closeAll('loading');
layer.msg('上传失败');
}
});
},
isIe: function (opt) {
if (navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE8.0" || navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE9.0")) {
//ie版本
$('#fileLoad').show();
$('.sc').hide();
document.domain = cookieHostname; //设置domian跨域拿到iframe的内容
var iframe = document.getElementById("test");
if (iframe.attachEvent) {
iframe.attachEvent("onload", opt.iframeOnload);
} else {
iframe.onload = opt.iframeOnload;
};
opt.formSubmit();
$('#mineFiles').on('change', function () {
layer.load(1, {
offset: ['50%', "50%"],
shade: false
});
$('#fileLoad').submit();
})
} else {
//非ie低版本
$('#upload_section').show();
opt.uploadFun();
}
return this;
},
formSubmit: function () {
$('#fileLoad').submit(function () {
var uploadFileForm = document.getElementById("fileLoad");
uploadFileForm.action = apis.ossupload;
$('#token').val(Util.getCookie('token'));
$('#ie').val(cookieHostname);
})
},
iframeOnload: function () {
//表单上传完成后进入iframe获取返回的值
var iframe = document.getElementById("test");
var html = "",
json = null;
try {
var el = (iframe.contentWindow || iframe.contentDocument.parentWindow).document.body;
while (el && el.nodeType !== 3) {
el = el.firstChild;
}
html = el.nodeValue;
json = html ? eval("(" + html + ")") : false;
} catch (e) {
layer.closeAll('loading');
layer.msg('上传失败');
}
if (json) {
layer.closeAll('loading');
if (json.errcode == 0) {
layer.msg('上传成功', {
time: 600
}, function () {
window.location.href = "/uploadresult";
});
} else {
layer.msg(json.errmsg)
}
}
},
handleBind: function (opt) {
//货期选择
layui.form.on('radio(delivery)', function (data) {
var str = '期货';
data.value == '现货' ? str = '现货' : str = '期货';
var getTpl = deliveryHtml.innerHTML;
layui.laytpl(getTpl).render(str, function (html) {
$("#day").empty().html(html);
});
return this;
},
}, $(function () {
ReleaseInquiry.init();
})
}();
\ No newline at end of file
});
//天数同步期货
$(document).on('input propertychange', 'input[name="day"]', function () {
var val = $(this).val();
$("#daytext").val(val + '天');
});
$('.cz').on('click', function () {
$('#xj_form')[0].reset();
})
//上传商品发布
layui.form.on('submit(add)', function (data) {
$(data.elem).addClass("layui-btn-disabled");
if (!opt.isClick) {
opt.isClick = true;
IcController.getData(apis.inquiryadd + '?token=' + Util.getCookie('token'), 'get', data.field, function (res) {
if (res.errcode == 0) {
layer.msg('发布询价成功', {
time: 2000
}, function () {
window.location.href = '/inquiry';
});
} else {
layer.msg(res.errmsg);
opt.isClick = false;
$(data.elem).removeClass("layui-btn-disabled");
}
});
}
});
return this;
},
}, $(function () {
ReleaseInquiry.init();
})
}();
\ No newline at end of file
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