common.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. jcapp = {}
  2. // jcapp.test_server = "http://w.eqbidding.com";
  3. jcapp.test_server = "http://www.eqbidding.com";
  4. // 获取服务器 ip+端口
  5. function getServerHttp(type) {
  6. var host = document.domain;
  7. var port = '';
  8. if (type == null) {
  9. port = ':16027';
  10. type = '/web-back'
  11. } else if (type == 'expert') {
  12. port = ':16026';
  13. type = '/web-expert'
  14. } else if (type == 'cp') {
  15. port = ':16025';
  16. type = '/web-cp-all'
  17. }
  18. if (host.indexOf('eqbidding') == -1) {
  19. host = jcapp.test_server + type;
  20. } else {
  21. //否则例如 w,www 等则直接用域名即可
  22. host = type;
  23. }
  24. return host;
  25. };
  26. // 转换时间戳
  27. function checkDateTime(time) {
  28. var today = new Date(time);
  29. var month = today.getMonth() + 1;
  30. var date = today.getDate();
  31. var year = today.getFullYear();
  32. month = today.getMonth() + 1;
  33. date = today.getDate();
  34. var day = today.getDay();
  35. var hour = today.getHours();
  36. var minute = today.getMinutes();
  37. var second = today.getSeconds();
  38. var dateTime = addZero(year) + "年" + addZero(month) + "月" + addZero(date) + "日 ";
  39. return dateTime
  40. }
  41. function addZero(num, end) {
  42. return num < 10 ? "0" + num : num;
  43. }
  44. function ajaxDataParames(data) {
  45. if (data.code !== 200) {
  46. // alert(data.message);
  47. return false;
  48. } else {
  49. return data.result;
  50. }
  51. // return data;
  52. }