Browse Source

pref: 修改首页计数器

wangcz 7 years ago
parent
commit
c01105454b

+ 4 - 9
jpress-web-template-mallcms/src/main/webapp/templates/mallcms/_layout.html

@@ -172,21 +172,16 @@
         <div class="count-list">
             <div class="items">
                 <p class="title">企业用户</p>
-                <span class="count-item">800000.00人</span>
+                <span class="count-item userspace-count">800000.00人</span>
             </div>
             <div class="items">
                 <p class="title">个人用户</p>
-                <span class="count-item">800000.00人</span>
+                <span class="count-item user-count">800000.00人</span>
             </div>
             <div class="items">
                 <p class="title two_item">交易金额</p>
-                <span class="count-item">本年800000.00亿</span><br/>
-                <span class="count-item">上年8000亿</span>
-            </div>
-            <div class="items">
-                <p class="title two_item">研发需求</p>
-                <span class="count-item">本年800000.00亿</span><br/>
-                <span class="count-item">上年8000亿</span>
+                <span class="count-item this-year-trader-count">本年800000.00亿</span><br/>
+                <span class="count-item last-year-trader-count">上年8000亿</span>
             </div>
         </div>
         <div class="count-close">×</div>

+ 11 - 6
jpress-web-template-mallcms/src/main/webapp/templates/mallcms/assets/css/index.css

@@ -2416,24 +2416,29 @@ a.x_gray_text.x_more{
 }
 #statistic .count-list{
     width: 187px;
-    height: 390px;
-    margin-left:-270px;
+    height: 320px;
+    margin-left:-295px;
     background: url(../images/statistic.png) no-repeat center center;
-    padding: 25px 45px 0;
+    padding-top: 20px;
 }
 
 #statistic .count-list .items{
     color:#fff;
-    font-size: 18px;
-    font-weight:bold;
     text-align: center;
     margin-bottom:10px;
+    padding-left:10px;
 }
 #statistic .count-list .items .title{
-    line-height: 30px;
+    line-height: 40px;
     margin:0;
+    font-size: 20px;
     font-weight:bold;
 }
+#statistic .count-list .items .count-item{
+    line-height: 30px;
+    margin:0;
+    font-size: 18px;
+}
 
 #statistic .count-list .items .two_item{
     line-height: 50px;

BIN
jpress-web-template-mallcms/src/main/webapp/templates/mallcms/assets/images/statistic.png


+ 45 - 27
jpress-web-template-mallcms/src/main/webapp/templates/mallcms/assets/js/index.js

@@ -214,7 +214,42 @@ $(function () {
         return (count + unit)
     }
 
-    var countHtml = ''
+    var countHtml = '', userspaceCount, userCount, lastYearTraderCount, thisYearTraderCount;
+    // 企业用户数量
+    $.ajax({
+        type: "GET",
+        url: "https://sso.ubtob.com/api/userspace/count",
+        dataType: "json",
+        success: function (data) {
+            if(data.count) {
+                userspaceCount = data.count
+            } else {
+                userspaceCount = 10458;
+            }
+            $('.userspace-count').html(toFinxedNum(data.count, 1))
+        },
+        error: function () {
+            $('.userspace-count').html(toFinxedNum(10458, 1))
+        }
+    })
+    // 个人用户数量
+    $.ajax({
+        type: "GET",
+        url: "https://sso.ubtob.com/api/user/count",
+        dataType: "json",
+        success: function (data) {
+            if(data.count) {
+                userCount = data.count
+            } else {
+                userCount = 41697;
+            }
+            $('.user-count').html(toFinxedNum(userCount, 2))
+        },
+        error: function () {
+            $('.user-count').html(toFinxedNum(41697, 2))
+        }
+    })
+
     $.ajax({
         type: "GET",
         url: "https://mall.usoftchina.com/api/product/commoncount?usedFor=usoftchina_home_counter&_status=actived",
@@ -222,41 +257,24 @@ $(function () {
         success: function(data) {
             if(data) {
                 for(var m = 0; m < data.length; m++) {
-                    if(data[m].detno == 1) {
-                        countHtml += '<div class="items"><p class="title">企业用户</p><span class="count-item">' + toFinxedNum(data[m].count, 1) + '</span></div>';
-                    } else if(data[m].detno == 2) {
-                        countHtml += '<div class="items"><p class="title">个人用户</p><span class="count-item">' + toFinxedNum(data[m].count, 2) + '</span></div>';
-                    } else if(data[m].detno == 3) {
-                        countHtml += '<div class="items"><p class="title two_item">交易金额</p><span class="count-item">本年' + toFinxedNum(data[m].count, 3) + '</span><br/>';
+                    if(data[m].detno == 3) {
+                        thisYearTraderCount = data[m].count;
                     } else if(data[m].detno == 4) {
-                        countHtml += '<span class="count-item">上年' + toFinxedNum(data[m].count, 3) + '</span></div>';
-                    } else if(data[m].detno == 5) {
-                        countHtml += '<div class="items"><p class="title two_item">研发需求</p><span class="count-item">本年' + toFinxedNum(data[m].count, 4) + '</span><br/>';
-                    } else if(data[m].detno == 6) {
-                        countHtml += '<span class="count-item">上年' + toFinxedNum(data[m].count, 4) + '</span></div>';
+                        lastYearTraderCount = data[m].count;
                     }
                 }
+                $('.last-year-trader-count').html('上年' + toFinxedNum(lastYearTraderCount, 3))
+                $('.this-year-trader-count').html('本年' + toFinxedNum(thisYearTraderCount, 3))
             } else {
-                countHtml += '<div class="items"><p class="title">企业用户</p><span class="count-item">' + toFinxedNum(10428, 1) + '</span></div>';
-                countHtml += '<div class="items"><p class="title">个人用户</p><span class="count-item">' + toFinxedNum(41282, 2) + '</span></div>';
-                countHtml += '<div class="items"><p class="title two_item">交易金额</p><span class="count-item">本年' + toFinxedNum(15283268864.27, 3) + '</span><br/>';
-                countHtml += '<span class="count-item">上年' + toFinxedNum(11728286832.86, 3) + '</span></div>';
-                countHtml += '<div class="items"><p class="title two_item">研发需求</p><span class="count-item">本年' + toFinxedNum(383, 4) + '</span><br/>';
-                countHtml += '<span class="count-item">上年' + toFinxedNum(1, 4) + '</span></div>';
+                $('.last-year-trader-count').html('上年' + toFinxedNum(11728286832.86, 3))
+                $('.this-year-trader-count').html('本年' + toFinxedNum(15322057199.72, 3))
             }
-            $('#statistic .count-list').html(countHtml)
         },
         error: function() {
-            countHtml += '<div class="items"><p class="title">企业用户</p><span class="count-item">' + toFinxedNum(10428, 1) + '</span></div>';
-            countHtml += '<div class="items"><p class="title">个人用户</p><span class="count-item">' + toFinxedNum(41282, 2) + '</span></div>';
-            countHtml += '<div class="items"><p class="title two_item">交易金额</p><span class="count-item">本年' + toFinxedNum(15283268864.27, 3) + '</span><br/>';
-            countHtml += '<span class="count-item">上年' + toFinxedNum(11728286832.86, 3) + '</span></div>';
-            countHtml += '<div class="items"><p class="title two_item">研发需求</p><span class="count-item">本年' + toFinxedNum(383, 4) + '</span><br/>';
-            countHtml += '<span class="count-item">上年' + toFinxedNum(1, 4) + '</span></div>';
-            $('#statistic .count-list').html(countHtml)
+            $('.last-year-trader-count').html('上年' + toFinxedNum(11728286832.86, 3))
+            $('.this-year-trader-count').html('本年' + toFinxedNum(15322057199.72, 3))
         }
     })
-
     // 首页计数器END