Browse Source

小键盘

yangc 8 years ago
parent
commit
79619283f3

+ 3 - 0
src/main/webapp/WEB-INF/views/normal/user_center.html

@@ -20,6 +20,7 @@
 <link rel="stylesheet" href="static/css/user/base.css" />
 <link rel="stylesheet" href="static/css/user/user.css" />
 <link rel="stylesheet" href="static/lib/calendar/calendar.css">
+<link rel="stylesheet" type="text/css" href="static/lib/keyboard/css/softkeys-0.0.1.css">
 </head>
 <body>
 
@@ -109,5 +110,7 @@
 			<div class="pull-right"><a ng-click="confirm()" class="btn btn-primary" ng-disabled="!image.src">确定</a></div>
 		</div>
 	</script>
+	<script src="static/lib/jquery/jquery.min.js"></script>
+	<script src="static/lib/keyboard/js/softkeys-0.0.1.js"></script>
 </body>
 </html>

+ 25 - 0
src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js

@@ -517,6 +517,19 @@ define(['app/app'], function(app) {
 	app.register.controller('PasswordCtrl', ['$scope', '$modalInstance', 'user', 'User', 'toaster', function($scope, $modalInstance, user, User, toaster){
 		$scope.user = user;
 		$scope.checking = false;
+		$scope.showPassword = false;
+		$scope.showNewPassword = false;
+		$scope.showPassword1 = false;
+		$scope.reloadKeyboard = function (type) {
+			if (type === 'showPassword') {
+				$scope.showPassword = !$scope.showPassword;
+			} else if (type === 'showNewPassword') {
+				$scope.showNewPassword = !$scope.showNewPassword;
+			} else if (type === 'showPassword1') {
+				$scope.showPassword1 = !$scope.showPassword1;
+			}
+		}
+		$scope.reloadKeyboard();
 		//输入原密码后验证原密码是否正确
 		$scope.checkPassword = function(password) {
 			$scope.checking = true;
@@ -878,6 +891,18 @@ define(['app/app'], function(app) {
     app.register.controller('UserPayCtrl', ['$scope', '$modalInstance', 'user', 'User', 'toaster', function($scope, $modalInstance, user, User, toaster){
     	//原密码框是否显示
     	$scope.checking = true;
+		$scope.showNewUserPay = false;
+		$scope.showUserPay = false;
+		$scope.showNewUserPay1 = false;
+		$scope.reloadKeyboard = function (type) {
+			if (type === 'showNewUserPay') {
+				$scope.showNewUserPay = !$scope.showNewUserPay;
+			} else if (type === 'showUserPay') {
+				$scope.showUserPay = !$scope.showUserPay;
+			} else if (type === 'showNewUserPay1') {
+				$scope.showNewUserPay1 = !$scope.showNewUserPay1;
+			}
+		}
     	//验证是否设置密码
 		$scope.checkHaveUserPay=function(){
             $scope.userPayHidden = false;

+ 125 - 0
src/main/webapp/resources/lib/keyboard/css/softkeys-0.0.1.css

@@ -0,0 +1,125 @@
+/** 
+ * CONTENTS
+ *
+ * BASE
+ *
+ * BUTTON TYPES
+ *
+ * MODIFIERS
+ * Size
+ * Mode
+ */
+
+/*------------------------------------*\
+    BASE
+\*------------------------------------*/
+
+.softkeys {
+    display: table;
+    list-style: none;
+    margin: 2em auto;
+    padding: 0;
+    width: 100%;
+    text-align: center;
+    font-size: 1em;
+    -webkit-user-select: none;
+       -moz-user-select: none;
+        -ms-user-select: none;
+            user-select: none;
+    -webkit-touch-callout: none;
+}
+
+
+    .softkeys__btn {
+        display: inline-block;
+        text-align: center;
+        font-size: 1em;
+        line-height: 2.5em;
+        min-width: 1em;
+        padding: 0 1em;
+        margin: 0 0.1em 0.4em 0.1em;
+        border: 0.1em solid #aaa;
+        border-radius: 5px;
+        cursor: pointer;
+    }
+
+        .softkeys__btn:hover, .softkeys__btn:focus {
+            outline: none;
+            background-color: #4b94ce;
+            border-color: #4b94ce;
+            color: #fff;
+        }
+
+        .softkeys__btn span {
+            display: none;
+        }
+            .softkeys__btn span:first-child {
+                display: block;
+            }
+
+
+    .softkeys__new-row:before {
+        display: block;
+        content: ' ';
+        width: 100%;
+    }
+
+
+
+
+
+/*------------------------------------*\
+    BUTTON TYPEs
+\*------------------------------------*/
+
+.softkeys__btn--space {
+    width: 30em;
+}
+
+
+
+
+
+/*------------------------------------*\
+    SIZE MODIFIERS
+\*------------------------------------*/
+
+.softkeys--sm { font-size: 0.8em; }
+.softkeys--md { font-size: 1em;   }
+.softkeys--lg { font-size: 1.2em; }
+.softkeys--xl { font-size: 1.4em; }
+
+
+
+
+
+/*------------------------------------*\
+    MODE MODIFIERS
+\*------------------------------------*/
+
+/*.softkeys--caps*/ 
+    .softkeys--caps .softkeys__btn[data-type=capslock] {
+        background-color: #4b94ce;
+        border-color: #4b94ce;
+        color: #fff;
+    }
+
+    .softkeys--caps .softkeys__btn[data-type=letter] {
+        text-transform: uppercase;
+    }
+
+/*.softkeys--alt*/ 
+
+    .softkeys--alt .softkeys__btn[data-type=shift] {
+        background-color: #4b94ce;
+        border-color: #4b94ce;
+        color: #fff;
+    }
+
+    .softkeys--alt .softkeys__btn[data-type=symbol] span {
+        display: none;
+    }
+
+    .softkeys--alt .softkeys__btn[data-type=symbol] span:last-child {
+        display: block;
+    }

File diff suppressed because it is too large
+ 1 - 0
src/main/webapp/resources/lib/keyboard/js/jquery-1.11.0.min.js


+ 155 - 0
src/main/webapp/resources/lib/keyboard/js/softkeys-0.0.1.js

@@ -0,0 +1,155 @@
+(function ($) {
+
+    $.fn.softkeys = function(options) {
+
+        var settings = $.extend({
+                layout : [],
+                target : '',
+                rowSeperator : 'br',
+                buttonWrapper : 'li'
+            },  options);
+
+        var createRow = function(obj, buttons) {
+                for (var i = 0; i < buttons.length; i++) {
+                    createButton(obj, buttons[i]);
+                }
+
+                obj.append('<'+settings.rowSeperator+'>');
+            },
+
+            createButton = function(obj, button) {
+                var character = '',
+                    type = 'letter',
+                    styleClass = '';
+
+                switch(typeof button) {
+                    case 'array' :
+                case 'object' :
+                        if(typeof button[0] !== 'undefined') {
+                            character += '<span>'+button[0]+'</span>';
+                        }
+                        if(typeof button[1] !== 'undefined') {
+                            character += '<span>'+button[1]+'</span>';
+                        }
+                        type = 'symbol';
+                        break;
+
+                    case 'string' :
+                        switch(button) {
+                            case 'capslock' :
+                                character = '<span>caps</span>';
+                                type = 'capslock';
+                                break;
+
+                            case 'shift' :
+                                character = '<span>shift</span>';
+                                type = 'shift';
+                                break;
+
+                            case 'return' :
+                                character = '<span>return</span>';
+                                type = 'return';
+                                break;
+
+                            case 'tab' :
+                                character = '<span>tab</span>';
+                                type = 'tab';
+                                break;
+
+                            case 'space' :
+                                character = '<span>space</span>';
+                                type = 'space';
+                                styleClass = 'softkeys__btn--space';
+                                break;
+
+                            case 'delete' :
+                                character = '<span>delete</span>';
+                                type = 'delete';
+                                break;
+
+                            default :
+                                character = button;
+                                type = 'letter';
+                                break;
+                        }
+
+                        break;
+                }
+
+                obj.append('<'+settings.buttonWrapper+' class="softkeys__btn  '+styleClass+'" data-type="'+type+'">'+character+'</'+settings.buttonWrapper+'>');
+            },
+
+            bindKeyPress = function(obj) {
+                obj.children(settings.buttonWrapper).on('click touchstart', function(event){
+                    event.preventDefault();
+
+                    var character = '',
+                        type = $(this).data('type'),
+                        targetValue = $(settings.target).val();
+
+                    switch(type) {
+                        case 'capslock' :
+                            toggleCase(obj);
+                            break;
+
+                        case 'shift' :
+                            toggleCase(obj);
+                            toggleAlt(obj);
+                            break;
+
+                        case 'return' :
+                            character = '\n';
+                            break;
+
+                        case 'tab' :
+                            character = '\t';
+                            break;
+
+                        case 'space' :
+                            character = ' ';
+                            break;
+
+                        case 'delete' :
+                            targetValue = targetValue.substr(0, targetValue.length - 1);
+                            break;
+
+                        case 'symbol' :
+                            if(obj.hasClass('softkeys--alt')) {
+                                character = $(this).children('span').eq(1).html();
+                            } else {
+                                character = $(this).children('span').eq(0).html();
+                            }
+                            break;
+
+                        case 'letter' :
+                            character = $(this).html();
+
+                            if(obj.hasClass('softkeys--caps')) {
+                                character = character.toUpperCase();
+                            }
+
+                            break;
+                    }
+
+                    $(settings.target).focus().val(targetValue + character);
+                });
+            },
+
+            toggleCase = function(obj) {
+                obj.toggleClass('softkeys--caps');
+            },
+
+            toggleAlt = function(obj) {
+                obj.toggleClass('softkeys--alt');
+            };
+
+        return this.each(function(){
+            for (var i = 0; i < settings.layout.length; i++) {
+                createRow($(this), settings.layout[i]);
+            }
+
+            bindKeyPress($(this));
+        });
+    };
+
+}(jQuery));

+ 1 - 1
src/main/webapp/resources/view/home/news.html

@@ -17,4 +17,4 @@
         </ul>
         <div class="clearfix"></div>
     </div>
-</div>
+</div>

+ 149 - 6
src/main/webapp/resources/view/vendor/modal/updatePassword.html

@@ -3,6 +3,7 @@
 		line-height: 34px;
 		font-size: 14px;
 		color: #666;
+		position: relative;
 	}
 	.modal-content {
 		width: 409px;
@@ -92,6 +93,20 @@
 	.password .safe-level >span >span:nth-child(3) {
 		background: rgb(255,171,44);
 	}
+	.password .softkeys {
+		position: absolute;
+		background: #eee;
+		z-index: 10000;
+		top: 7px;
+		left: 0;
+		width: 620px;
+		box-shadow: 1px 1px 11px;
+		padding: 10px 0;
+		border-radius: 5px;
+	}
+	.modal-dialog {
+		min-height: 500px;
+	}
 </style>
 <div class="modal-header">
 	<img src="static/img/user/images/update-password.png" alt="">
@@ -109,8 +124,9 @@
 		<div class="row line" ng-class="{'has-success': checkSuccess, 'has-error': checkFailed}">
 			<label class="col-md-3 col-sm-3 col text-right">原密码:</label>
 			<div class="col-md-8 col-sm-8 col">
-				<input ng-model="user.password" class="form-control input-sm" type="password" ng-blur="checkPassword(user.password)" required placeholder="当前密码">
-				<img src="static/img/user/images/keyboard.png" alt="">
+				<input ng-model="user.password" name="password" class="form-control input-sm" type="password" ng-blur="checkPassword(user.password)" required placeholder="当前密码">
+				<img src="static/img/user/images/keyboard.png" alt="" ng-click="reloadKeyboard('showPassword');">
+				<div ng-show="showPassword" class="softkeys softkeys1" data-target="input[name='password']"></div>
 			</div>
 			<div class="col">
 				<img ng-show="checkSuccess" src="static/img/user/images/input-check-yes.png" alt="">
@@ -121,9 +137,10 @@
 		<div class="row new-password" ng-class="{'has-success': checkSuccess1, 'has-error': checkFailed1}">
 			<label class="col-md-3 col-sm-3 col text-right">新密码:</label>
 			<div class="col-md-8 col-sm-8 col">
-				<input ng-model="user.newPassword" ng-keyup="checkPasswordLevel(user.newPassword)" ng-blur="checkNewPassword(user.newPassword)" class="form-control input-sm" type="password" required  placeholder="8~20位字母、数字、符号">
+				<input ng-model="user.newPassword" name="newPassword" ng-keyup="checkPasswordLevel(user.newPassword)" ng-blur="checkNewPassword(user.newPassword)" class="form-control input-sm" type="password" required  placeholder="8~20位字母、数字、符号">
 				<!-- <div>密码复杂度</div> -->
-				<img src="static/img/user/images/keyboard.png" alt="">
+				<img src="static/img/user/images/keyboard.png" ng-click="reloadKeyboard('showNewPassword');" alt="">
+				<div ng-show="showNewPassword" class="softkeys softkeys2" data-target="input[name='newPassword']"></div>
 			</div>
 			<div class="col">
 				<img ng-show="checkSuccess1" src="static/img/user/images/input-check-yes.png" alt="">
@@ -142,8 +159,9 @@
 		<div class="row line" ng-class="{'has-success': checkSuccess2, 'has-error': checkFailed2}">
 			<label ng-model="user.newPassword1" class="col-md-3 col-sm-3 col text-right">重复新密码:</label>
 			<div class="col-md-8 col-sm-8 col">
-				<input ng-model="user.newPassword1" ng-blur="checkNewPassword1(user.newPassword1)" class="form-control input-sm" type="password" required placeholder="重复新密码">
-				<img src="static/img/user/images/keyboard.png" alt="">
+				<input ng-model="user.newPassword1" name="password1" ng-blur="checkNewPassword1(user.newPassword1)" class="form-control input-sm" type="password" required placeholder="重复新密码">
+				<img src="static/img/user/images/keyboard.png" ng-click="reloadKeyboard('showPassword1')"  alt="">
+				<div ng-show="showPassword1" class="softkeys softkeys3" data-target="input[name='password1']"></div>
 			</div>
 			<div class="col">
 				<img ng-show="checkSuccess2" src="static/img/user/images/input-check-yes.png" alt="">
@@ -158,3 +176,128 @@
 		<button ng-disabled="!checkSuccess || !checkSuccess1 || !checkSuccess2" type="submit">确定</button>
 	</div>
 </form>
+<script>
+	$('.softkeys1').softkeys({
+		target : $('.softkeys1').data('target'),
+		layout : [
+			[
+				['`','~'],
+				['1','!'],
+				['2','@'],
+				['3','#'],
+				['4','$'],
+				['5','%'],
+				['6','^'],
+				['7','&'],
+				['8','*'],
+				['9','('],
+				['0',')'],
+				['-', '_'],
+				['=','+'],
+				'delete'
+			],
+			[
+				'q','w','e','r','t','y','u','i','o','p',
+				['[','{'],
+				[']','}']
+			],
+			[
+				'capslock',
+				'a','s','d','f','g','h','j','k','l',
+				[';',':'],
+				["'",'"'],
+				['\\','|']
+			],
+			[
+				'shift',
+				'z','x','c','v','b','n','m',
+				[',','<'],
+				['.','>'],
+				['/','?'],
+				['@']
+			]
+		]
+	});
+	$('.softkeys2').softkeys({
+		target : $('.softkeys2').data('target'),
+		layout : [
+			[
+				['`','~'],
+				['1','!'],
+				['2','@'],
+				['3','#'],
+				['4','$'],
+				['5','%'],
+				['6','^'],
+				['7','&'],
+				['8','*'],
+				['9','('],
+				['0',')'],
+				['-', '_'],
+				['=','+'],
+				'delete'
+			],
+			[
+				'q','w','e','r','t','y','u','i','o','p',
+				['[','{'],
+				[']','}']
+			],
+			[
+				'capslock',
+				'a','s','d','f','g','h','j','k','l',
+				[';',':'],
+				["'",'"'],
+				['\\','|']
+			],
+			[
+				'shift',
+				'z','x','c','v','b','n','m',
+				[',','<'],
+				['.','>'],
+				['/','?'],
+				['@']
+			]
+		]
+	});
+	$('.softkeys3').softkeys({
+		target : $('.softkeys3').data('target'),
+		layout : [
+			[
+				['`','~'],
+				['1','!'],
+				['2','@'],
+				['3','#'],
+				['4','$'],
+				['5','%'],
+				['6','^'],
+				['7','&'],
+				['8','*'],
+				['9','('],
+				['0',')'],
+				['-', '_'],
+				['=','+'],
+				'delete'
+			],
+			[
+				'q','w','e','r','t','y','u','i','o','p',
+				['[','{'],
+				[']','}']
+			],
+			[
+				'capslock',
+				'a','s','d','f','g','h','j','k','l',
+				[';',':'],
+				["'",'"'],
+				['\\','|']
+			],
+			[
+				'shift',
+				'z','x','c','v','b','n','m',
+				[',','<'],
+				['.','>'],
+				['/','?'],
+				['@']
+			]
+		]
+	});
+</script>

+ 145 - 3
src/main/webapp/resources/view/vendor/modal/updateUserPay.html

@@ -66,6 +66,20 @@
         right: 20px;
         top: 8px;
     }
+    .userPay .softkeys {
+        position: absolute;
+        background: #eee;
+        z-index: 10000;
+        top: 7px;
+        left: 0;
+        width: 620px;
+        box-shadow: 1px 1px 11px;
+        padding: 10px 0;
+        border-radius: 5px;
+    }
+    .modal-dialog {
+        min-height: 500px;
+    }
 </style>
 <div class="modal-header">
     <img src="static/img/user/images/update-pay.png" alt="">
@@ -79,7 +93,8 @@
             <div class="col-md-8 col-sm-8 col">
                 <input ng-model="user.userPay"
                        class="form-control input-sm" type="password" name="userPay" ng-blur="checkUserPay(user.userPay)" required>
-                <img src="static/img/user/images/keyboard.png" alt="">
+                <img src="static/img/user/images/keyboard.png" ng-click="reloadKeyboard('showUserPay')" alt="">
+                <div ng-show="showUserPay" class="softkeys softkeys1" data-target="input[name='userPay']"></div>
             </div>
             <div class="col">
                 <img ng-show="checkSuccess" src="static/img/user/images/input-check-yes.png" alt="">
@@ -94,7 +109,8 @@
             <div class="col-md-8 col-sm-8 col">
                 <input ng-model="user.newUserPay"
                        class="form-control input-sm" type="password" name="newUserPay" ng-blur="checkNewUserPay(user.newUserPay)" required>
-                <img src="static/img/user/images/keyboard.png" alt="">
+                <img src="static/img/user/images/keyboard.png" ng-click="reloadKeyboard('showNewUserPay')" alt="">
+                <div ng-show="showNewUserPay" class="softkeys softkeys2" data-target="input[name='newUserPay']"></div>
                 <!-- <div>密码复杂度</div> -->
             </div>
             <div class="col">
@@ -109,7 +125,8 @@
             <div class="col-md-8 col-sm-8 col">
                 <input ng-model="user.newUserPay1"
                        class="form-control input-sm" name="newUserPay1"  type="password" ng-blur="checkNewUserPay1()" required>
-                <img src="static/img/user/images/keyboard.png" alt="">
+                <img src="static/img/user/images/keyboard.png" ng-click="reloadKeyboard('showNewUserPay1')" alt="">
+                <div ng-show="showNewUserPay1" class="softkeys softkeys3" data-target="input[name='newUserPay1']"></div>
             </div>
             <div class="col">
                 <img ng-show="checkSuccess2" src="static/img/user/images/input-check-yes.png" alt="">
@@ -124,3 +141,128 @@
         <button ng-disabled="(!checkSuccess && !checkSuccess1 && !checkSuccess2)" type="submit">确定</button>
     </div>
 </form>
+<script>
+    $('.softkeys1').softkeys({
+        target : $('.softkeys1').data('target'),
+        layout : [
+            [
+                ['`','~'],
+                ['1','!'],
+                ['2','@'],
+                ['3','#'],
+                ['4','$'],
+                ['5','%'],
+                ['6','^'],
+                ['7','&'],
+                ['8','*'],
+                ['9','('],
+                ['0',')'],
+                ['-', '_'],
+                ['=','+'],
+                'delete'
+            ],
+            [
+                'q','w','e','r','t','y','u','i','o','p',
+                ['[','{'],
+                [']','}']
+            ],
+            [
+                'capslock',
+                'a','s','d','f','g','h','j','k','l',
+                [';',':'],
+                ["'",'"'],
+                ['\\','|']
+            ],
+            [
+                'shift',
+                'z','x','c','v','b','n','m',
+                [',','<'],
+                ['.','>'],
+                ['/','?'],
+                ['@']
+            ]
+        ]
+    });
+    $('.softkeys2').softkeys({
+        target : $('.softkeys2').data('target'),
+        layout : [
+            [
+                ['`','~'],
+                ['1','!'],
+                ['2','@'],
+                ['3','#'],
+                ['4','$'],
+                ['5','%'],
+                ['6','^'],
+                ['7','&'],
+                ['8','*'],
+                ['9','('],
+                ['0',')'],
+                ['-', '_'],
+                ['=','+'],
+                'delete'
+            ],
+            [
+                'q','w','e','r','t','y','u','i','o','p',
+                ['[','{'],
+                [']','}']
+            ],
+            [
+                'capslock',
+                'a','s','d','f','g','h','j','k','l',
+                [';',':'],
+                ["'",'"'],
+                ['\\','|']
+            ],
+            [
+                'shift',
+                'z','x','c','v','b','n','m',
+                [',','<'],
+                ['.','>'],
+                ['/','?'],
+                ['@']
+            ]
+        ]
+    });
+    $('.softkeys3').softkeys({
+        target : $('.softkeys3').data('target'),
+        layout : [
+            [
+                ['`','~'],
+                ['1','!'],
+                ['2','@'],
+                ['3','#'],
+                ['4','$'],
+                ['5','%'],
+                ['6','^'],
+                ['7','&'],
+                ['8','*'],
+                ['9','('],
+                ['0',')'],
+                ['-', '_'],
+                ['=','+'],
+                'delete'
+            ],
+            [
+                'q','w','e','r','t','y','u','i','o','p',
+                ['[','{'],
+                [']','}']
+            ],
+            [
+                'capslock',
+                'a','s','d','f','g','h','j','k','l',
+                [';',':'],
+                ["'",'"'],
+                ['\\','|']
+            ],
+            [
+                'shift',
+                'z','x','c','v','b','n','m',
+                [',','<'],
+                ['.','>'],
+                ['/','?'],
+                ['@']
+            ]
+        ]
+    });
+</script>

Some files were not shown because too many files changed in this diff