lqq 8 år sedan
förälder
incheckning
04619e787e

+ 1 - 1
web12345-new/Gulpfile.js

@@ -36,7 +36,7 @@ var paths = {
     }
 }
 
-var distpath = '../dist/web12345-new';
+var distpath = '../dist/web12345';
 
 gulp.task('app-css', function() {
     del([distpath + '/app-*.css'], { cwd: process.cwd(), force: true });

+ 1 - 1
web12345-new/src/html/index.html

@@ -28,7 +28,7 @@
 </head>
 
 <body ng-app="app">
-    <script src="https://qiyukf.com/script/e52a7ac21a88369ef6c38c56b54c810e.js"></script>
+    <script src="https://qiyukf.com/script/acdf3e0b8a30e358652592e57b7d6a94.js"></script>
     <ui-view></ui-view>
 
 </body>

+ 9 - 8
web12345-new/src/js/controller/homeController.js

@@ -1,8 +1,8 @@
 'use strict';
 
-angular.module('app').controller('HomeController', ['$scope', '$state', '$timeout', function($scope, $state, $timeout) {
+angular.module('app').controller('HomeController', ['$scope', '$state', '$timeout', 'userService', function ($scope, $state, $timeout, userService) {
     $scope.getAddSuccess = true;
-
+    $scope.currentUser = userService.getMe();
     $scope.$on('$viewContentLoaded', function() {
         //加载轮播
         var swiper = new Swiper('.swiper-container', {
@@ -34,6 +34,7 @@ angular.module('app').controller('HomeController', ['$scope', '$state', '$timeou
             angular.element(".explain").removeClass("font-12");
             angular.element(".explain").addClass("font-15");
         }
+        console.log(userService.getMe());
         //加载sdk
         ysf.on({
             'onload': function() {
@@ -89,9 +90,8 @@ angular.module('app').controller('HomeController', ['$scope', '$state', '$timeou
 
     $scope.onOnlineClick = function(e) {
         console.log($scope.sdk);
-        $scope.mobile = "";
+        
         var activeClick = $(e.target);
-        //console.log(activeClick);
         if (!$scope.getAddSuccess) {
             alert("获取地址失败,请开启手机GPS定位功能,并允许获取地理位置授权");
             window.location.reload();
@@ -108,12 +108,13 @@ angular.module('app').controller('HomeController', ['$scope', '$state', '$timeou
 
     $scope.onlineService = function() {
         //console.log($scope.mobile, $scope.sdk);
-        if ($scope.mobile.length == 11 && $scope.sdk) {
+        if ($scope.currentUser.Mobile.length == 11 && $scope.sdk) {
+            userService.update();
             ysf.config({
-                uid: $scope.mobile, // 用户Id
-                name: '微信用户', // 用户名称
+                uid: $scope.currentUser.Id, // 用户Id
+                name: $scope.currentUser.Nickname, // 用户名称
                 email: $scope.addr.regeocode.formattedAddress, // 用户邮箱
-                mobile: $scope.mobile, // 用户电话
+                mobile: $scope.currentUser.Mobile, // 用户电话
                 success: function() { // 成功回调
                     ysf.open();
                     console.log('success');

+ 3 - 1
web12345-new/src/js/controller/webController.js

@@ -21,7 +21,9 @@ angular.module('app').controller('WebController', ['$scope', '$timeout', 'userSe
         isPublic: 0,
         assets: []
     };
-
+    $scope.currentUser = userService.getMe();
+    $scope.bundle.name = $scope.currentUser.Nickname;
+    $scope.bundle.mobile = $scope.currentUser.Mobile;
     $scope.$on('$viewContentLoaded', function() {
         var clientWidth = document.documentElement.clientWidth || window.innerWidth;
         var innerWidth = Math.max(Math.min(clientWidth, 480), 320);

+ 5 - 2
web12345-new/src/js/router.js

@@ -1,7 +1,10 @@
-angular.module('app').run(['$rootScope', '$state', '$stateParams',
-    function($rootScope, $state, $stateParams) {
+angular.module('app').run(['$rootScope', '$state', '$stateParams','auth2Service',
+    function ($rootScope, $state, $stateParams, auth2Service) {
         $rootScope.$state = $state;
         $rootScope.$stateParams = $stateParams;
+        var locationChangeStartOff = $rootScope.$on('$locationChangeStart', function (event) {
+            auth2Service.checkAuthByServer();
+        });  
     }
 ]).config(['$stateProvider', '$urlRouterProvider',
     function($stateProvider, $urlRouterProvider) {

+ 12 - 2
web12345-new/src/js/service/auth2Service.js

@@ -5,11 +5,12 @@
         .module('app')
         .service('auth2Service', auth2Service);
 
-    auth2Service.$inject = ['$cookies', '$http'];
+    auth2Service.$inject = ['$cookies', '$http', '$location'];
 
-    function auth2Service($cookies, $http) {
+    function auth2Service($cookies, $http, $location) {
         this.checkAuthByResponse = checkAuthByResponse;
         this.checkAuthByCookie = checkAuthByCookie;
+        this.checkAuthByServer = checkAuthByServer;
 
         function checkAuthByResponse(response) {
             if (response.status == 501) {
@@ -17,6 +18,15 @@
             }
         }
 
+        function checkAuthByServer() {
+            $http.get($location.protocol() + '://' + $location.host() + ':' + $location.port() + '/api/auth/check').then(
+                function () {
+
+                },
+                checkAuthByResponse
+            );
+        }
+
         function checkAuthByCookie() {
             return $cookies.user != "" || $cookies.user != undefined;
         }

+ 17 - 2
web12345-new/src/js/service/userService.js

@@ -9,10 +9,13 @@
 
     function userService($http, $cookies, auth2Service) {
         this.getMe = getMe;
+        this.update = update;
 
         function getMe() {
-            if (this.me != undefined)
-                return this.me;
+            if (this.me != undefined) {
+                return this.me;
+            }
+                
             if ($cookies.get('User') != "" || $cookies.get('User') != undefined) {
                 this.me = JSON.parse($cookies.get('User'));
                 return this.me;
@@ -29,5 +32,17 @@
                     }
                 );
         }
+
+        function update() {
+            if (this.me.Id != undefined)
+                $http.post('/api/user', this.me).then(
+                    function (response) {
+                        console.log(response.data)
+                    },
+                    function (response) {
+                        console.log(response.data)
+                    }
+                );
+        }
     }
 })();

+ 4 - 4
web12345-new/src/templates/home.html

@@ -43,12 +43,12 @@
                     <img class="breath size3" ng-click="onOnlineClick($event)" src="../img/webChatImg/在线服务.png" alt=""><span ng-click="onOnlineClick($event)" class="explain">在线服务</span>
                 </a>
             </div>
-            <div class="email" ng-cloak>
+            <div class="email" ng-cloak onclick="alert('此功能正在全力开放中,敬请期待')">
                 <a ui-sref="webChat.online">
-                    <img class="breath size4" src="../img/webChatImg/网上信箱.png" alt=""><span class="explain">网上信箱</span>
+                    <img class="breath size4" src="../img/webChatImg/网上信箱.png" alt="" ><span class="explain">网上信箱</span>
                 </a>
             </div>
-            <div class="result" ng-cloak>
+            <div class="result" ng-cloak onclick="alert('此功能正在全力开放中,敬请期待')">
                 <a href="">
                     <img class="breath size5" src="../img/webChatImg/结果查询.png" alt=""><span class="explain">结果查询</span>
                 </a>
@@ -68,7 +68,7 @@
     <div class="modal fade phoneLogin" id="phoneLoginModal" tabindex="-2" data-backdrop="static" role="dialog" aria-labelledby="phoneLoginModalLabel" aria-hidden="true">
         <div class="modal-info">
             <p>请输入手机号码</p>
-            <input class="form-control input-sm" type="text" ng-model="mobile">
+            <input class="form-control input-sm" type="text" ng-model="currentUser.Mobile">
             <a ng-click="onlineService()">确定</a>
             <a href="" data-dismiss="modal" style="color:#888;">关闭</a>
         </div>