$(function () {
// 公告关闭
$('.article-top span').click(function() {
$('.article-top').hide(500)
})
// 自动轮播
$('#myCarousel').carousel({
interval: 5000
})
// uas
$('#myCarousel01').carousel({
interval: 5000
})
// 新闻集锦
$('#myCarousel02').carousel({
interval: 5000
})
// 商城点击切换
$('.section-bottom01 span').on('click', function () {
var index = $(this).index();
$(this).addClass('active').siblings().removeClass('active');
$('.section-toggle01').eq(index).addClass('show').siblings().removeClass('show');
})
// u创
$('.section-bottom02>span.tab').on('click', function () {
var index = $(this).index();
$(this).addClass('active').siblings().removeClass('active');
$('.section-process').eq(index).addClass('show').siblings().removeClass('show');
$('.c_case').eq(index).addClass('show').siblings().removeClass('show');
})
$('.c_tab>span.c_toggle').on('click', function () {
var index = $(this).index();
$(this).addClass('active').siblings().removeClass('active');
$('.c_item_list').eq(index).addClass('show').siblings().removeClass('show');
})
// 成熟方案
$('.case_indus_list').on('click', function () {
var id = $(this).attr('id')
$(this).addClass('active').siblings().removeClass('active');
$.ajax({
type: "GET",
url: "https://login.usoftchina.com/ubtob/index/getProgramme",
data: {id:id},
dataType: "json",
success: function(data){
var html = '';
if (data.data){
$.each(data.data, function (k, v) {
html += '
'
})
}
$('.c_case_content01').html(html)
}
});
})
$(document).ready(function(){
$('.case_indus_list:first-child').addClass('active')
$('.u_items:nth-child(2)').addClass('active')
});
// u客论坛
// $('.k_item_list').on('click', function () {
// $(this).addClass('active').siblings().removeClass('active');
// })
$(".k_item_list").hover(function(){
$(this).addClass("active")
.siblings().removeClass('active');
});
$(".u_char").hover(function(){
$(this).addClass("active")
.siblings().removeClass('active');
});
// 资讯
$('.title_list_active').hover(function () {
var index = $(this).index();
$(this).addClass('active').siblings().removeClass('active');
$('.hot_info_list_active').eq(index).addClass('show').siblings().removeClass('show');
})
// 滚动效果
// function AutoScroll(obj){
// $(obj).find(".scroll:first").animate({
// marginTop:"-74px"
// },500,function(){
// $(this).css({marginTop:"0px"}).find("div.scroll .item-list:first").appendTo(this);
// });
// }
// $(document).ready(function(){
// setInterval('AutoScroll(".dynamic-scroll")',3000);
// });
// $(document).ready(function(){
// $.fn.scrollTop = function(options){
// var defaults = {
// speed:30
// }
// var opts = $.extend(defaults,options);
// this.each(function(){
// var $timer;
// var scroll_top=0;
// var obj = $(this);
// var $height = obj.find(".scroll").height();
// obj.find(".scroll").clone().appendTo(obj);
// obj.hover(function(){
// clearInterval($timer);
// },function(){
// $timer = setInterval(function(){
// scroll_top++;
// if(scroll_top > $height){
// scroll_top = 0;
// }
// obj.find(".scroll").first().css("margin-top",-scroll_top);
// },opts.speed);
// }).trigger("mouseleave");
// })
// }
// })
// $(document).ready(function(){
// $(".scroll").scrollTop({
// speed:30 //数值越大 速度越慢
// });
// })
// 返回页面顶部
$(window).on('scroll',function(){
var $goTop=$('.go-top');
if($(this).scrollTop()>0){
$goTop.css("display","block");
}else{
$goTop.css("display","none");
}
})
$('.go-top').click(function(e){
e.preventDefault();
if ($('html').scrollTop()) {
$('html').animate({ scrollTop: 0 }, 1000);
return false;
}
$('body').animate({ scrollTop: 0 }, 1000);
return false;
})
// 首页计数器使用
$('#statistic .count-close').click(function () {
$(this).parent().hide()
})
function strNumSize(tempNum) {
var stringNum = tempNum.toString();
var index = stringNum.indexOf(".");
var newNum = stringNum;
if(index != -1) {
newNum = stringNum.substring(0, index)
}
return newNum.length;
}
function unitConvert(num) {
var moneyUnits = ["", "万", "亿", "万亿"];
var dividend = 10000;
var curentNum = num;
//转换数字
var curentUnit = moneyUnits[0];
//转换单位
for(var i = 0; i < 4; i++) {
curentUnit = moneyUnits[i];
if(strNumSize(curentNum) < 5) {
break;
};
curentNum = curentNum / dividend;
}
return curentNum.toFixed(2) + curentUnit;
}
function toFinxedNum (num, flag) {
var type = Number(num);
var countd = 0;
var unit = '';
if(flag == 1) {
unit = '家'
} else if(flag == 2) {
unit = '人'
} else if(flag == 3) {
unit = '元'
} else {
unit = '个'
}
count = type > 100000 ? unitConvert(type) : type;
return (count + unit)
}
var userspaceCount, userCount, lastYearTraderCount, thisYearTraderCount, yearDate, upYearDate;
yearDate = new Date().getFullYear();
upYearDate = yearDate - 1;
// 企业用户数量
$.ajax({
type: "GET",
url: "https://ssorest.usoftchina.com/api/enterprise/total/get",
dataType: "json",
success: function (data) {
if(data.entTotal) {
userspaceCount = toFinxedNum(data.entTotal, 1)
} else {
userspaceCount = '- 家';
}
$('.userspace-count').html(userspaceCount)
},
error: function () {
$('.userspace-count').html('- 家')
}
})
// 个人用户数量
$.ajax({
type: "GET",
url: "https://ssorest.usoftchina.com/api/user/total/get",
dataType: "json",
success: function (data) {
if(data.userTotal) {
userCount = toFinxedNum(data.userTotal, 2)
} else {
userCount = '- 个';
}
$('.user-count').html(userCount)
},
error: function () {
$('.user-count').html('- 个')
}
})
$.ajax({
type: "GET",
url: "https://oldmall.usoftchina.com/api/product/commoncount?usedFor=usoftchina_home_counter&_status=actived",
dataType: "json",
success: function(data) {
if(data) {
for(var m = 0; m < data.length; m++) {
if(data[m].detno == 3) {
thisYearTraderCount = data[m].count;
} else if(data[m].detno == 4) {
lastYearTraderCount = data[m].count;
}
}
$('.last-year-trader-count').html(upYearDate + '年' + toFinxedNum(lastYearTraderCount, 3))
$('.this-year-trader-count').html(yearDate + '年' + toFinxedNum(thisYearTraderCount, 3))
} else {
$('.last-year-trader-count').html(upYearDate + '年' + ' ' + '- 元')
$('.this-year-trader-count').html(yearDate + '年' + ' ' + '- 元')
}
},
error: function() {
$('.last-year-trader-count').html(upYearDate + '年' + ' ' + '- 元')
$('.this-year-trader-count').html(yearDate + '年' + ' ' + '- 元')
}
})
// 首页计数器END
$.ajax({
type: "GET",
url: "sso/loginInfo",
dataType: "json",
success: function (data) {
if (data.success && data.userAccount) {
if (data.userAccount.spaceName) {
$('#username').html(data.userAccount.vipName + ' | ' + data.userAccount.spaceName);
} else {
$('#username').html(data.userAccount.vipName);
}
$('.login').show();
$('.unLogin').hide();
} else {
$('.login').hide();
$('.unLogin').show();
}
}
})
$('.a_login').click(function () {
window.location.href = 'https://sso2.usoftchina.com/login.html?returnUrl=' + encodeURIComponent(window.location.href);
})
$('.a_logout').click(function () {
window.location.href = 'https://sso2.usoftchina.com/loginOut.html?returnUrl=' + encodeURIComponent(window.location.href) + '&baseUrl=' + encodeURIComponent('https://ssorest.usoftchina.com');
});
$('.a_register').click(function () {
window.location.href = 'https://sso2.usoftchina.com/companyRegister.html?returnUrl=' + encodeURIComponent(window.location.href);
})
// 更新上传品牌数据计数
$.ajax({
type: "GET",
url: "https://oldmall.usoftchina.com/api/product/commoncount/3/count",
dataType: "json",
success: function(data) {
$("#mall_count_brands").text('品牌' + data + '个')
}
})
$.ajax({
type: "GET",
url: "https://oldmall.usoftchina.com/inquiry/public/getCountOfLastAndThisMonth",
dataType: "json",
success: function(json) {
$("#mall_count_inquiry").text('本月询价条数' + json.current)
}
})
$.ajax({
type: "GET",
url: "https://oldmall.usoftchina.com/api/product/commoncount/12/count",
dataType: "json",
success: function(json) {
json = (json - json % 100000000)/100000000
$("#mall_count_goods").text('产品库存数' + json + '亿')
}
})
$.ajax({
type: "GET",
url: "https://login.usoftchina.com/ubtob/index/getZbSta",
dataType: "json",
success: function(json) {
var html = ''
for (var i = 0; i < json.data.length; i++) {
html += ''+json.data[i]+'
'
}
$("#uuzcc_count_platform").html(html)
}
})
$.ajax({
type: "GET",
url: "https://login.usoftchina.com/ubtob/index/getBbsSta",
dataType: "json",
success: function(json) {
console.log(json)
var html = ''
for (var i = 0; i < json.data.length; i++) {
html += ''+json.data[i]+'
'
}
$("#uuzcc_count_bbs").html(html)
}
})
});