diff --git a/src/main/ui/m_login.html b/src/main/ui/m_login.html index 3c4210286..b5714978b 100644 --- a/src/main/ui/m_login.html +++ b/src/main/ui/m_login.html @@ -142,7 +142,7 @@ dataType: 'text', success: function () { var from = getUrlParam("f"); - location.href = from ? decodeURIComponent(from) : 'manage.html' + location.href = from ? decodeURIComponent(from) : 'managev2.html' }, error: function (jqXHR) { alert(JSON.parse(jqXHR.responseText).message); @@ -185,7 +185,7 @@ url: '/global/userstatus/manager_signin_wechat_qrcode/' + codeId + '/check', method: 'get', success: function () { - location.href = '/manage.html' + location.href = '/managev2.html' }, error: function () { setTimeout(function () { diff --git a/src/main/ui/main_menu.html b/src/main/ui/main_menu.html index de46097e2..3b0aa58eb 100644 --- a/src/main/ui/main_menu.html +++ b/src/main/ui/main_menu.html @@ -7,7 +7,7 @@
-
+
@@ -39,7 +39,7 @@
-
+
@@ -109,8 +109,8 @@
-
-
+
+
@@ -173,8 +173,8 @@
-
-
+
+
@@ -271,8 +271,8 @@
-->
-
-
+
+
@@ -334,8 +334,8 @@
-
-
+
+
@@ -385,9 +385,9 @@
-
+
-
+
@@ -517,9 +517,9 @@
-
+
-
+
@@ -558,8 +558,8 @@
-
-
+
+
@@ -627,14 +627,15 @@
-
-
+
+
-
+
-
-
+
+
@@ -739,8 +740,8 @@
-
-
+
+
@@ -778,8 +779,8 @@
-
-
+
+
diff --git a/src/main/ui/manage.html b/src/main/ui/manage.html index d77789135..640a5d069 100644 --- a/src/main/ui/manage.html +++ b/src/main/ui/manage.html @@ -41,66 +41,6 @@ @@ -188,51 +117,46 @@ margin-bottom: 10%;"/>

To Be The Best QRCode Payment Service Provider!

- - -
-
- -
+ diff --git a/src/main/ui/manage_bak.html b/src/main/ui/manage_bak.html deleted file mode 100644 index 1aa66dcf6..000000000 --- a/src/main/ui/manage_bak.html +++ /dev/null @@ -1,488 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - RoyalPay - - - - - - - - - - - - - - - - - - - - - - - - -
-
- RoyalPay -

To Be The Best QRCode Payment Service Provider!

-
-
-
- -
- <!– Logo –> - - - <!– Header Navbar: style can be found in header.less –> - <!–顶部导航栏–> - -
- - - - - - - - - -
-
-
- - -
- - Copyright © 2015-2017 RoyalPay. All rights - reserved. -
- -
- - - diff --git a/src/main/ui/managev2.html b/src/main/ui/managev2.html new file mode 100644 index 000000000..13ccee754 --- /dev/null +++ b/src/main/ui/managev2.html @@ -0,0 +1,439 @@ + + + + + + + + + + + + + + + + + + + + + + + + RoyalPay + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ RoyalPay +

To Be The Best QRCode Payment Service Provider!

+
+
+ + +
+
+ + +
+
+
+ + + + +
+
+ Copyright © 2015-2017 RoyalPay. All rights + reserved. +
+
+
+
+
+ + Copyright © 2015-2017 RoyalPay. All rights + reserved. +
+
+ + + diff --git a/src/main/ui/static/boot/manager-bootv2.js b/src/main/ui/static/boot/manager-bootv2.js new file mode 100644 index 000000000..44f3bd5cb --- /dev/null +++ b/src/main/ui/static/boot/manager-bootv2.js @@ -0,0 +1,90 @@ +/** + * Created by yixian on 2016-06-29. + */ +require.config({ + baseUrl: './', + waitSeconds: 30, + urlArgs: 'bust=' + new Date().getTime(), + paths: { + jquery: 'static/lib/jquery/jquery-2.1.4.min', + uiBootstrap: 'static/lib/angular-plugins/ui-bootstrap-tpls-1.2.4.min', + uiRouter: 'static/lib/angular-plugins/angular-ui-router.min', + angularChecklist: 'static/lib/angular-plugins/checklist-model', + angular: 'static/lib/angularjs/angular.min', + angularAnimate: 'static/lib/angularjs/angular-animate.min', + angularMessages: 'static/lib/angularjs/angular-messages.min', + angularSanitize: 'static/lib/angularjs/angular-sanitize.min', + angularLocale: 'static/lib/angularjs/angular-locale_zh-cn', + bootSwitch: 'static/lib/bootswitch/bootstrap-switch.min', + ngBootSwitch: 'static/lib/angular-plugins/angular-bootstrap-switch.min', + ngFileUpload: 'static/lib/ngfileupload/ng-file-upload.min', + holder: 'static/lib/holder/holder.min', + datetimePicker: 'static/lib/datetime-picker/datetime-picker.min', + colorpicker: 'static/lib/colorpicker/js/bootstrap-colorpicker-module.min', + qrcode: 'static/lib/jquery/jquery.qrcode.min', + sockjs: 'static/lib/websocket/sockjs.min', + stomp: 'static/lib/websocket/stomp.min', + uiSelect: 'static/lib/angular-plugins/select.min', + dragdrop: 'static/lib/angular-plugins/angular-drag-and-drop-lists.min', + echarts: 'static/lib/echarts/echarts.min', + ueditor: 'static/lib/ueditor/ueditor.all.min', + ueditorConfig: 'static/lib/ueditor/ueditor.config', + angularEcharts: 'static/commons/angular-echarts', + decimal: 'static/lib/decimal/decimal.min', + jstz: 'static/lib/timezone/jstz-1.0.4.min' + }, + shim: { + 'angular': {deps: ['jquery', 'decimal'], exports: 'angular'}, + 'angularLocale': ['angular'], + 'uiBootstrap': ['angular', 'angularLocale'], + 'uiRouter': ['angular'], + 'uiSelect': ['angular', 'css!static/lib/angular-plugins/select.min'], + 'angularAnimate': ['angular'], + 'angularMessages': ['angular'], + 'angularSanitize': ['angular'], + 'ngFileUpload': ['angular'], + 'angularChecklist': ['angular'], + 'datetimePicker': ['angular'], + 'ngBootSwitch': ['bootSwitch', 'angular'], + 'bootSwitch': ['jquery', 'css!static/lib/bootswitch/bootstrap-switch.min'], + 'qrcode': ['jquery'], + 'colorpicker': ['angular', 'css!static/lib/colorpicker/css/colorpicker.min'], + 'holder': ['jquery'], + 'dragdrop': ['angular'], + 'ueditor': ['ueditorConfig'] + }, + map: { + '*': { + 'css': 'static/lib/css.min' + } + } +}); + +require(['angular', 'jquery'], function (angular, $) { + $.ajax({ + url: '/global/userstatus/current_manager', + method: 'get', + dataType: 'json', + success: function (user) { + boot(user); + }, + error: function (jqXHR) { + if (jqXHR.status == 403) { + location.href = 'm_login.html?f=' + encodeURIComponent(location.href); + } + } + }); + + function boot(user) { + var paths = ['static/boot/managerMainAppv2', 'static/menu/managerMenu','static/analysis/org/analysis-org', 'static/analysis/report/analysis-report', 'static/analysis/monitoring/analysis-monitoring', 'static/analysis/bd/analysis-bd']; + var moduleNames = ['managerMainAppv2', 'listMenuApp','analysisTransaction', 'analysisBD', 'analysisOrg', 'analysisMonitoring', 'analysisReport']; + window.currentUser = user; + angular.forEach(user.modules, function (mod) { + paths.push(mod.js_path); + moduleNames.push(mod.js_module); + }); + require(paths, function () { + angular.bootstrap(document.body, moduleNames) + }) + } +}); \ No newline at end of file diff --git a/src/main/ui/static/boot/managerMainApp.js b/src/main/ui/static/boot/managerMainApp.js index ee3b4db64..b649f08a1 100644 --- a/src/main/ui/static/boot/managerMainApp.js +++ b/src/main/ui/static/boot/managerMainApp.js @@ -5,9 +5,7 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo 'use strict'; var app = angular.module('managerMainApp', ['ngSanitize', 'ngAnimate', 'ngMessages', 'ui.router', 'ui.bootstrap', 'ngFileUpload']); app.config(['$urlRouterProvider', '$httpProvider', function ($urlRouterProvider, $httpProvider) { -/* $urlRouterProvider.otherwise(((window.currentUser.role & parseInt('100000', 2)) > 0) ? '/managers' : '/dashboard'); -*/ if (!$httpProvider.defaults.headers.get) { $httpProvider.defaults.headers.get = {}; } @@ -17,19 +15,6 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo }]); app.controller('managerIndexCtrl', ['$scope', '$rootScope', '$http', '$log', '$timeout', '$interval', '$uibModal', '$filter', 'myLoginLogView', 'commonDialog', function ($scope, $rootScope, $http, $log, $timeout, $interval, $uibModal, $filter, myLoginLogView, commonDialog) { - if (window.location.hash == "" || window.location.hash == "#/") { - $scope.headerDisplay = false; - $scope.copyright = false; - }else{ - $scope.headerDisplay = true; - $scope.copyright = true; - } - - - $scope.headerShow = function () { - $scope.headerDisplay = true; - $scope.copyright = true; - }; $http.get('/sysconfig/base').then(function (resp) { $rootScope.sysParams = resp.data; }); @@ -79,7 +64,7 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo } }) }; - // $scope.getManagerTodoNotices(); + $scope.getManagerTodoNotices(); var connected; diff --git a/src/main/ui/static/boot/managerMainAppv2.js b/src/main/ui/static/boot/managerMainAppv2.js new file mode 100644 index 000000000..f0f1e5e3c --- /dev/null +++ b/src/main/ui/static/boot/managerMainAppv2.js @@ -0,0 +1,404 @@ +/** + * Created by yixian on 2016-06-29. + */ +define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRouter', 'uiBootstrap', 'ngFileUpload', 'sockjs', 'stomp'], function (angular) { + 'use strict'; + var app = angular.module('managerMainAppv2', ['ngSanitize', 'ngAnimate', 'ngMessages', 'ui.router', 'ui.bootstrap', 'ngFileUpload']); + app.config(['$urlRouterProvider', '$httpProvider', function ($urlRouterProvider, $httpProvider) { +/* + $urlRouterProvider.otherwise(((window.currentUser.role & parseInt('100000', 2)) > 0) ? '/managers' : '/dashboard'); +*/ + if (!$httpProvider.defaults.headers.get) { + $httpProvider.defaults.headers.get = {}; + } + $httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; + $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache'; + $httpProvider.defaults.headers.get['Pragma'] = 'no-cache'; + }]); + app.controller('managerIndexCtrl', ['$scope', '$rootScope', '$http', '$log', '$timeout', '$interval', '$uibModal', '$filter', 'myLoginLogView', 'commonDialog', + function ($scope, $rootScope, $http, $log, $timeout, $interval, $uibModal, $filter, myLoginLogView, commonDialog) { + if (window.location.hash == "" || window.location.hash == "#/") { + $scope.headerDisplay = false; + $scope.copyright = false; + }else{ + $scope.headerDisplay = true; + $scope.copyright = true; + } + + + $scope.headerShow = function () { + $scope.headerDisplay = true; + $scope.copyright = true; + }; + $http.get('/sysconfig/base').then(function (resp) { + $rootScope.sysParams = resp.data; + }); + var stompClient = null; + $scope.loadCurrentUser = function () { + $http.get('/global/userstatus/current_manager').then(function (resp) { + $rootScope.currentUser = resp.data; + // connectWebSocket(); + $scope.notifyCounts = 0; + if ($rootScope.currentUser.role & parseInt('110', 2)) { + $scope.loadPartnerApplyNotice(); + if (window.currentUser.role & 10000000000) { + $scope.loadRefundNotice(); + } + } + // if ($rootScope.currentUser.role ==2 || $rootScope.currentUser.role == 4){ + // $scope.loadPartnerApplyNotice(); + // } + if ($rootScope.currentUser.wx_openid == null) { + if ($filter('withRole')('100')) { + $scope.managerBindWechat('static'); + } else { + $scope.managerBindWechat(true); + } + + } + }, function (resp) { + if (resp.status == 403) { + location.href = 'm_login.html?f=' + encodeURIComponent(location.href); + } + }) + }; + $scope.loadCurrentUser(); + + $scope.getManagerTodoNotices = function () { + $http.get('/global/userstatus/manager_todo_notices').then(function (resp) { + if (resp.data.length) { + $uibModal.open({ + controller: 'managerTodoNoticeCtrl', + templateUrl: '/static/boot/templates/manager_todo.html', + resolve: { + notices: function () { + return resp.data; + } + } + }) + } + }) + }; + // $scope.getManagerTodoNotices(); + + + var connected; + $interval($scope.loadCurrentUser, 300000); + + function connectWebSocket() { + if (connected && stompClient) { + return; + } + var sock = new SockJS('/register'); + stompClient = window.Stomp.over(sock); + stompClient.connect({}, function (frame) { + $log.debug('websocket connected:' + frame); + connected = true; + stompClient.subscribe('/app/common/page_events/' + $rootScope.currentUser.manager_id, function (msg) { + $log.debug('new event notice:' + msg.body); + var msgBody = JSON.parse(msg.body); + $scope.$broadcast(msgBody.event, msgBody.data); + }); + }, function () { + $log.error('连接失败,3秒后尝试重连'); + connected = false; + $timeout(connectWebSocket, 3000); + }) + }; + connectWebSocket(); + + $scope.$on('manager_bind_success', function (evt, msg) { + if (msg.key == $scope.checkCode) { + $scope.checkModal != null && $scope.checkModal.close(); + } + }); + + $scope.showMyLoginLogs = function () { + myLoginLogView.show(); + }; + + $scope.toggleHideSideBar = function () { + $scope.hideSideBar = !$scope.hideSideBar; + }; + + $scope.showQrCode = function (data, backdrop) { + return $uibModal.open({ + template: '
请使用微信扫描

{{wx_nickname}}

', + controller: ['$scope', 'data', function ($scope, data) { + $scope.url = data.url; + $scope.wx_headimg = data.wx_headimg; + $scope.wx_nickname = data.wx_nickname; + }], + size: 'sm', + resolve: { + data: function () { + return data; + } + }, + keyboard: false, + backdrop: backdrop + + }) + }; + $scope.logout = function () { + $http.put('/global/userstatus/manager_signout').then(function () { + location.href = '/m_login.html'; + }); + }; + $scope.changePwd = function () { + $uibModal.open({ + templateUrl: '/static/boot/templates/change_pwd_dialog.html', + controller: 'changePwdCtrl', + size: 'sm' + }).result.then(function () { + commonDialog.alert({title: '操作成功', content: '您成功修改了密码', type: 'success'}) + }) + }; + $scope.currentUserHasRole = function (role) { + return ($scope.currentUser.role & role) > 0 + }; + $scope.loadPartnerApplyNotice = function () { + var params = {}; + $http.get('/partners/application/notice', {params: params}).then(function (resp) { + $scope.partner_application_new = resp.data.counts; + if ($scope.partner_application_new) { + $scope.notifyCounts = $scope.notifyCounts + 1; + } + }) + + }; + $scope.loadRefundNotice = function () { + $http.get('/api/payment/v1.0/refund/orders/notifyReview').then(function (resp) { + $scope.refundReviews = resp.data; + if ($scope.refundReviews) { + $scope.notifyCounts = $scope.notifyCounts + 1; + } + }); + } + $scope.openNotice = false; + $scope.toggleOpenNotice = function () { + var openNotice = angular.copy($scope.openNotice); + $scope.openNotice = !openNotice; + }; + + $scope.managerBindWechat = function (backdrop) { + $http.post('/system/manager_wechat_binds').then(function (resp) { + $scope.checkCode = resp.data.bind_id; + if (resp.data.wx_nickname) { + backdrop = true; + } + $scope.checkModal = $scope.showQrCode(resp.data, backdrop); + // $scope.showQrCode(resp.data.url); + }) + } + $scope.customerService = function () { + $http.put('/sys/openim/check').then(function (resp) { + window.open('/service_client.html?key='+resp.data.appkey+'&p='+resp.data.password+'&uid='+resp.data.user_id,'_blank'); + }); + } + + }]); + app.controller('changePwdCtrl', ['$scope', '$http', function ($scope, $http) { + $scope.formData = {}; + $scope.submit = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') <= 0) { + item.$dirty = true; + $scope.errmsg = '请输入密码'; + } + }); + return; + } + // $scope.errmsg = null; + // if($scope.formData.pwd && $scope.formData.pwd.length < 8){ + // $scope.errmsg = '密码必须大于8位!'; + // return; + // } + // var regex = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/; + // if($scope.formData.pwd &&!regex.test($scope.formData.pwd)){ + // $scope.errmsg = '密码需要由8-16位数字以及字母组成'; + // return; + // } + if ($scope.formData.pwd != $scope.formData.repeatpwd) { + $scope.errmsg = '两次输入密码不一致'; + return; + } + $scope.errmsg = null; + $http.put('/global/userstatus/manager_password', $scope.formData).then(function () { + $scope.$close(); + }, function (resp) { + $scope.errmsg = resp.data.message; + }) + } + }]); + app.controller('managerTodoNoticeCtrl', ['$scope', 'notices', function ($scope, notices) { + $scope.notices = notices; + }]); + + app.controller('blankCtrl', ['$scope', function ($scope) { + }]); + + app.factory('myLoginLogView', ['$uibModal', function ($uibModal) { + return { + show: function () { + $uibModal.open({ + templateUrl: '/static/boot/templates/user_login_logs.html', + controller: ['$scope', '$http', function ($scope, $http) { + $scope.pagination = {}; + $scope.getMyLoginLogs = function (page) { + var params = {page: page || $scope.pagination.page || 1}; + $http.get('/global/userstatus/current_manager/login_logs', {params: params}).then(function (resp) { + $scope.pagination = resp.data.pagination; + $scope.loginLogs = resp.data.data; + }) + }; + $scope.getMyLoginLogs(); + }] + }) + } + } + }]); + app.filter('withRole', ['$rootScope', function ($rootScope) { + return function (roleCode) { + if (angular.isNumber(roleCode)) { + var code = roleCode; + } else { + code = parseInt(roleCode, 2); + } + return ($rootScope.currentUser.role & code) > 0 + } + }]); + app.filter('withModule', ['$rootScope', function ($rootScope) { + return function (moduleName) { + return $rootScope.currentUser.module_names.indexOf(moduleName) >= 0; + } + }]); + app.filter('withFunc', ['$rootScope', function ($rootScope) { + return function (funcName) { + return $rootScope.currentUser.available_func_names.indexOf(funcName) >= 0; + } + }]); + + app.filter('tradeStatus', function () { + return function (status) { + switch (status + '') { + case '0': + return 'Creating'; + case '1': + return 'Failed Create Order'; + case '2': + return 'Wait For Payment'; + case '3': + return 'Closed'; + case '4': + return 'Payment Failed'; + case '5': + return 'Payment Successful'; + case '6': + return 'Partial Refund'; + case '7': + return 'Full Refund'; + } + } + }); + app.filter('refundStatus', function () { + return function (status) { + switch (status + '') { + case '0': + case'1': + return 'Submit Failed'; + case '2': + return 'Submit Success'; + case '3': + return 'Failed'; + case '4': + return 'Success'; + case '5': + return 'Change' + } + } + }); + app.filter('tradeGateway', function () { + return function (gateway) { + switch (gateway + '') { + case '0': + return '线下扫码'; + case '1': + return '线下扫码'; + case '2': + return '商户静态码'; + case '3': + return '线上网关'; + case '4': + return 'JSAPI网关'; + case '5': + return '线下网关'; + case '6': + return '线下网关'; + case '7': + return '商户静态码'; + case '8': + return 'Mobile H5'; + case '9': + return '第三方网关'; + case '10': + return 'APP网关'; + case '11': + return '账单码'; + case '12': + return '小程序'; + case '13': + return '原生二维码'; + case '14': + return '账单链接' + } + } + }); + + app.constant('uiDatetimePickerConfig', { + dateFormat: 'yyyy-MM-dd HH:mm', + defaultTime: '00:00:00', + html5Types: { + date: 'yyyy-MM-dd', + 'datetime-local': 'yyyy-MM-ddTHH:mm:ss.sss', + 'month': 'yyyy-MM' + }, + initialPicker: 'date', + reOpenDefault: false, + enableDate: true, + enableTime: true, + buttonBar: { + show: true, + now: { + show: true, + text: '现在' + }, + today: { + show: true, + text: '今天' + }, + clear: { + show: true, + text: '清空' + }, + date: { + show: true, + text: '日期' + }, + time: { + show: true, + text: '时间' + }, + close: { + show: true, + text: '关闭' + } + }, + closeOnDateSelection: true, + appendToBody: false, + altInputFormats: [], + ngModelOptions: {} + }); + return app; +}); \ No newline at end of file diff --git a/src/main/ui/static/menu/managerMenu.js b/src/main/ui/static/menu/managerMenu.js index 8312b18cb..a9149498e 100644 --- a/src/main/ui/static/menu/managerMenu.js +++ b/src/main/ui/static/menu/managerMenu.js @@ -8,24 +8,58 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { templateUrl: 'main_menu.html' }); }]); - app.controller('listMenuCtrl', ['$scope', '$http', '$filter','$uibModal', 'commonDialog','$stateParams', function ($scope, $http,$filter, $uibModal, commonDialog,$stateParams) { - $scope.display = function () { - var json = {}; - $(".list-group").each(function () { - var child = ($(".list-group").find('a')).length; - var label = ($(".list-group").find("label:first-child")).val(); - if (child >0) { - json[label] = true; - }else { - json[label] = false; - } - }); - return json; + app.controller('listMenuCtrl', ['$scope', '$http', '$filter','$uibModal','$location', '$anchorScroll','$stateParams', function ($scope, $http,$filter, $uibModal,$location, $anchorScroll,$stateParams) { + + var gotohash = function (role) { + switch (role) { + case "Compliance" : + $location.hash('partners'); + $anchorScroll(); + break; + case "RiskManager" : + $location.hash('risk'); + $anchorScroll(); + break; + case "AccountManager" : + $location.hash('org'); + $anchorScroll(); + break; + case "Accountant" : + $location.hash('clearing'); + $anchorScroll(); + break; + case "BDUser" : + $location.hash('bd'); + $anchorScroll(); + break; + case "Service" : + $location.hash('art'); + $anchorScroll(); + break; + case "Administrator" : + $location.hash('setting'); + $anchorScroll(); + break; + case "SiteManager" : + $location.hash('cms'); + $anchorScroll(); + break; + case "Developer" : + $location.hash('develop'); + $anchorScroll(); + break; + case "Director" : + $location.hash('staff'); + $anchorScroll(); + break; + default: + break; + } + }; - function init() { - console.log("dadadadada + " + $stateParams.role); - /*console.log("json + " + $scope.display());*/ - } + + gotohash($stateParams["role"]); + $scope.editRateConfig = function () { $uibModal.open({ templateUrl: '/static/config/bdprize/templates/rate_config_dialog.html', @@ -46,7 +80,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { }) }; - init(); + }]); app.controller('bdRateConfigCtrl', ['$scope', '$http', 'rates', function ($scope, $http, rates) {