Browse Source

首页静态化上线

chao 4 years ago
parent
commit
ff1cf705ae
2 changed files with 17 additions and 12 deletions
  1. 17 12
      src/main/resources/static/js/base.js
  2. BIN
      target/www-0.0.1-SNAPSHOT.jar

+ 17 - 12
src/main/resources/static/js/base.js

@@ -189,24 +189,29 @@ var globalHead = new Vue({
         this.GetProductClassify(1);
         this.GetProductClassify(2);
         // this.GetNavigationMenu();
-        // 信息中心
-        this.articleType = getUrlParam("type");
-    },
-    mounted:function(){
-        var _self = this;
         // 判断登录状态
-        if (GLOBAL_TOKEN) {
-            _self.loginStatus = true;
-            _self.userIdentity = GLOBAL_USER_IDENTITY;
-            _self.shopId = GLOBAL_SHOP_ID;
-            _self.userData = globalUserData;
-            if(GLOBAL_USER_ID){
+        if (globalUserData.token) {
+            this.loginStatus = true;
+            this.userData = globalUserData;
+            var userId = this.userData.userId;
+            if(userId){
+                var _self = this;
                 // 获取头部购物车数据
                 setTimeout(function(){
-                    _self.getHeadCart(GLOBAL_USER_ID);
+                    _self.getHeadCart(userId);
                 }, 1000);
             }
         }
+        // 信息中心
+        this.articleType = getUrlParam("type");
+    },
+    mounted:function(){
+        var _self = this;
+        var userData = JSON.parse(window.localStorage.getItem('userInfo'));
+        if(userData!=null) {
+            this.userIdentity = userData.userIdentity;
+            this.shopId = userData.shopId;
+        }
         if($(window).width() > 1400){
             $(window).on('scroll', function() {
                 var scrollTop = $(this).scrollTop();

BIN
target/www-0.0.1-SNAPSHOT.jar