index.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. $(function () {
  2. // 公告关闭
  3. $('.article-top span').click(function() {
  4. $('.article-top').hide(500)
  5. })
  6. // 自动轮播
  7. $('#myCarousel').carousel({
  8. interval: 5000
  9. })
  10. // uas
  11. $('#myCarousel01').carousel({
  12. interval: 5000
  13. })
  14. // 新闻集锦
  15. $('#myCarousel02').carousel({
  16. interval: 5000
  17. })
  18. // 商城点击切换
  19. $('.section-bottom01 span').on('click', function () {
  20. var index = $(this).index();
  21. $(this).addClass('active').siblings().removeClass('active');
  22. $('.section-toggle01').eq(index).addClass('show').siblings().removeClass('show');
  23. })
  24. // u创
  25. $('.section-bottom02>span.tab').on('click', function () {
  26. var index = $(this).index();
  27. $(this).addClass('active').siblings().removeClass('active');
  28. $('.section-process').eq(index).addClass('show').siblings().removeClass('show');
  29. $('.c_case').eq(index).addClass('show').siblings().removeClass('show');
  30. })
  31. $('.c_tab>span.c_toggle').on('click', function () {
  32. var index = $(this).index();
  33. $(this).addClass('active').siblings().removeClass('active');
  34. $('.c_item_list').eq(index).addClass('show').siblings().removeClass('show');
  35. })
  36. // 成熟方案
  37. $('.case_indus_list').on('click', function () {
  38. var id = $(this).attr('id')
  39. $(this).addClass('active').siblings().removeClass('active');
  40. $.ajax({
  41. type: "GET",
  42. url: "https://login.usoftchina.com/ubtob/index/getProgramme",
  43. data: {id:id},
  44. dataType: "json",
  45. success: function(data){
  46. var html = '';
  47. if (data.data){
  48. $.each(data.data, function (k, v) {
  49. html += '<div class="c_case_list">'+
  50. '<a href="' + v.url + '">'+
  51. '<div class="c_img">'+
  52. '<img src="' + v.banner + '" alt="">'+
  53. '</div>'+
  54. '<p class="c_case_overflow">' + v.ptitle + '</p>'+
  55. '<div class="c_item_bottom">'+
  56. '<span>' + v.shop_name + '</span><span>价格: <b>¥' + v.price + '</b></span>'+
  57. '</div>'+
  58. '<div class="hover_case">'+
  59. '<div class="case_top">'+
  60. '<p class="c_case_title c_case_overflow">' + v.ptitle + '</p>'+
  61. '<div class="c_case_count">'+
  62. '<span>浏览 <span>' + v.views + '</span></span>'+
  63. '<span>成交量 <span>' + v.invitation + '</span></span>'+
  64. '</div>'+
  65. '</div>'+
  66. '<div class="case_bottom">'+
  67. '<div class="c_case_price">'+
  68. '<span>店铺名</span>'+
  69. '<span>价格: <span>¥' + v.price + '</span></span>'+
  70. '</div>'+
  71. '<a href="' + v.url + '" class="case_look">点击查看</a>'+
  72. '</div>'+
  73. '</div>'+
  74. '</a>'+
  75. '</div>'
  76. })
  77. }
  78. $('.c_case_content01').html(html)
  79. }
  80. });
  81. })
  82. $(document).ready(function(){
  83. $('.case_indus_list:first-child').addClass('active')
  84. $('.u_items:nth-child(2)').addClass('active')
  85. });
  86. // u客论坛
  87. // $('.k_item_list').on('click', function () {
  88. // $(this).addClass('active').siblings().removeClass('active');
  89. // })
  90. $(".k_item_list").hover(function(){
  91. $(this).addClass("active")
  92. .siblings().removeClass('active');
  93. });
  94. $(".u_char").hover(function(){
  95. $(this).addClass("active")
  96. .siblings().removeClass('active');
  97. });
  98. // 资讯
  99. $('.title_list_active').hover(function () {
  100. var index = $(this).index();
  101. $(this).addClass('active').siblings().removeClass('active');
  102. $('.hot_info_list_active').eq(index).addClass('show').siblings().removeClass('show');
  103. })
  104. // 滚动效果
  105. // function AutoScroll(obj){
  106. // $(obj).find(".scroll:first").animate({
  107. // marginTop:"-74px"
  108. // },500,function(){
  109. // $(this).css({marginTop:"0px"}).find("div.scroll .item-list:first").appendTo(this);
  110. // });
  111. // }
  112. // $(document).ready(function(){
  113. // setInterval('AutoScroll(".dynamic-scroll")',3000);
  114. // });
  115. // $(document).ready(function(){
  116. // $.fn.scrollTop = function(options){
  117. // var defaults = {
  118. // speed:30
  119. // }
  120. // var opts = $.extend(defaults,options);
  121. // this.each(function(){
  122. // var $timer;
  123. // var scroll_top=0;
  124. // var obj = $(this);
  125. // var $height = obj.find(".scroll").height();
  126. // obj.find(".scroll").clone().appendTo(obj);
  127. // obj.hover(function(){
  128. // clearInterval($timer);
  129. // },function(){
  130. // $timer = setInterval(function(){
  131. // scroll_top++;
  132. // if(scroll_top > $height){
  133. // scroll_top = 0;
  134. // }
  135. // obj.find(".scroll").first().css("margin-top",-scroll_top);
  136. // },opts.speed);
  137. // }).trigger("mouseleave");
  138. // })
  139. // }
  140. // })
  141. // $(document).ready(function(){
  142. // $(".scroll").scrollTop({
  143. // speed:30 //数值越大 速度越慢
  144. // });
  145. // })
  146. // 返回页面顶部
  147. $(window).on('scroll',function(){
  148. var $goTop=$('.go-top');
  149. if($(this).scrollTop()>0){
  150. $goTop.css("display","block");
  151. }else{
  152. $goTop.css("display","none");
  153. }
  154. })
  155. $('.go-top').click(function(e){
  156. e.preventDefault();
  157. if ($('html').scrollTop()) {
  158. $('html').animate({ scrollTop: 0 }, 1000);
  159. return false;
  160. }
  161. $('body').animate({ scrollTop: 0 }, 1000);
  162. return false;
  163. })
  164. // 首页计数器使用
  165. $('#statistic .count-close').click(function () {
  166. $(this).parent().hide()
  167. })
  168. function strNumSize(tempNum) {
  169. var stringNum = tempNum.toString();
  170. var index = stringNum.indexOf(".");
  171. var newNum = stringNum;
  172. if(index != -1) {
  173. newNum = stringNum.substring(0, index)
  174. }
  175. return newNum.length;
  176. }
  177. function unitConvert(num) {
  178. var moneyUnits = ["", "万", "亿", "万亿"];
  179. var dividend = 10000;
  180. var curentNum = num;
  181. //转换数字
  182. var curentUnit = moneyUnits[0];
  183. //转换单位
  184. for(var i = 0; i < 4; i++) {
  185. curentUnit = moneyUnits[i];
  186. if(strNumSize(curentNum) < 5) {
  187. break;
  188. };
  189. curentNum = curentNum / dividend;
  190. }
  191. return curentNum.toFixed(2) + curentUnit;
  192. }
  193. function toFinxedNum (num, flag) {
  194. var type = Number(num);
  195. var countd = 0;
  196. var unit = '';
  197. if(flag == 1) {
  198. unit = '家'
  199. } else if(flag == 2) {
  200. unit = '人'
  201. } else if(flag == 3) {
  202. unit = '元'
  203. } else {
  204. unit = '个'
  205. }
  206. count = type > 100000 ? unitConvert(type) : type;
  207. return (count + unit)
  208. }
  209. var userspaceCount, userCount, lastYearTraderCount, thisYearTraderCount, yearDate, upYearDate;
  210. yearDate = new Date().getFullYear();
  211. upYearDate = yearDate - 1;
  212. // 企业用户数量
  213. $.ajax({
  214. type: "GET",
  215. url: "https://ssorest.usoftchina.com/api/enterprise/total/get",
  216. dataType: "json",
  217. success: function (data) {
  218. if(data.entTotal) {
  219. userspaceCount = toFinxedNum(data.entTotal, 1)
  220. } else {
  221. userspaceCount = '- 家';
  222. }
  223. $('.userspace-count').html(userspaceCount)
  224. },
  225. error: function () {
  226. $('.userspace-count').html('- 家')
  227. }
  228. })
  229. // 个人用户数量
  230. $.ajax({
  231. type: "GET",
  232. url: "https://ssorest.usoftchina.com/api/user/total/get",
  233. dataType: "json",
  234. success: function (data) {
  235. if(data.userTotal) {
  236. userCount = toFinxedNum(data.userTotal, 2)
  237. } else {
  238. userCount = '- 个';
  239. }
  240. $('.user-count').html(userCount)
  241. },
  242. error: function () {
  243. $('.user-count').html('- 个')
  244. }
  245. })
  246. $.ajax({
  247. type: "GET",
  248. url: "https://oldmall.usoftchina.com/api/product/commoncount?usedFor=usoftchina_home_counter&_status=actived",
  249. dataType: "json",
  250. success: function(data) {
  251. if(data) {
  252. for(var m = 0; m < data.length; m++) {
  253. if(data[m].detno == 3) {
  254. thisYearTraderCount = data[m].count;
  255. } else if(data[m].detno == 4) {
  256. lastYearTraderCount = data[m].count;
  257. }
  258. }
  259. $('.last-year-trader-count').html(upYearDate + '年' + toFinxedNum(lastYearTraderCount, 3))
  260. $('.this-year-trader-count').html(yearDate + '年' + toFinxedNum(thisYearTraderCount, 3))
  261. } else {
  262. $('.last-year-trader-count').html(upYearDate + '年' + ' ' + '- 元')
  263. $('.this-year-trader-count').html(yearDate + '年' + ' ' + '- 元')
  264. }
  265. },
  266. error: function() {
  267. $('.last-year-trader-count').html(upYearDate + '年' + ' ' + '- 元')
  268. $('.this-year-trader-count').html(yearDate + '年' + ' ' + '- 元')
  269. }
  270. })
  271. // 首页计数器END
  272. $.ajax({
  273. type: "GET",
  274. url: "sso/loginInfo",
  275. dataType: "json",
  276. success: function (data) {
  277. if (data.success && data.userAccount) {
  278. if (data.userAccount.spaceName) {
  279. $('#username').html(data.userAccount.vipName + '&nbsp;&nbsp;|&nbsp;&nbsp;' + data.userAccount.spaceName);
  280. } else {
  281. $('#username').html(data.userAccount.vipName);
  282. }
  283. $('.login').show();
  284. $('.unLogin').hide();
  285. } else {
  286. $('.login').hide();
  287. $('.unLogin').show();
  288. }
  289. }
  290. })
  291. $('.a_login').click(function () {
  292. window.location.href = 'https://sso2.usoftchina.com/login.html?returnUrl=' + encodeURIComponent(window.location.href);
  293. })
  294. $('.a_logout').click(function () {
  295. window.location.href = 'https://sso2.usoftchina.com/loginOut.html?returnUrl=' + encodeURIComponent(window.location.href) + '&baseUrl=' + encodeURIComponent('https://ssorest.usoftchina.com');
  296. });
  297. $('.a_register').click(function () {
  298. window.location.href = 'https://sso2.usoftchina.com/companyRegister.html?returnUrl=' + encodeURIComponent(window.location.href);
  299. })
  300. // 更新上传品牌数据计数
  301. $.ajax({
  302. type: "GET",
  303. url: "https://oldmall.usoftchina.com/api/product/commoncount/3/count",
  304. dataType: "json",
  305. success: function(data) {
  306. $("#mall_count_brands").text('品牌' + data + '个')
  307. }
  308. })
  309. $.ajax({
  310. type: "GET",
  311. url: "https://oldmall.usoftchina.com/inquiry/public/getCountOfLastAndThisMonth",
  312. dataType: "json",
  313. success: function(json) {
  314. $("#mall_count_inquiry").text('本月询价条数' + json.current)
  315. }
  316. })
  317. $.ajax({
  318. type: "GET",
  319. url: "https://oldmall.usoftchina.com/api/product/commoncount/12/count",
  320. dataType: "json",
  321. success: function(json) {
  322. json = (json - json % 100000000)/100000000
  323. $("#mall_count_goods").text('产品库存数' + json + '亿')
  324. }
  325. })
  326. $.ajax({
  327. type: "GET",
  328. url: "https://login.usoftchina.com/ubtob/index/getZbSta",
  329. dataType: "json",
  330. success: function(json) {
  331. var html = ''
  332. for (var i = 0; i < json.data.length; i++) {
  333. html += '<div>'+json.data[i]+'</div>'
  334. }
  335. $("#uuzcc_count_platform").html(html)
  336. }
  337. })
  338. $.ajax({
  339. type: "GET",
  340. url: "https://login.usoftchina.com/ubtob/index/getBbsSta",
  341. dataType: "json",
  342. success: function(json) {
  343. console.log(json)
  344. var html = ''
  345. for (var i = 0; i < json.data.length; i++) {
  346. html += '<div>'+json.data[i]+'</div>'
  347. }
  348. $("#uuzcc_count_bbs").html(html)
  349. }
  350. })
  351. });