1$(function(){ 2 if($('#pageViewId').val() == "userInfo" && isNull($('#userId').val())){ 3 openLogin(); 4 } 5 $("#stAgree").click(function(){ 6 $(this).toggleClass("active"); 7 }) 8 9 $(".loginbtn").click(function(){ 10 openLogin(); 11 }) 12 13 //ç»å½ç¹å»å ³é 14 $(".closelogin").click(function(){ 15 $(".monitor").hide(); 16 $(".loginwrap").hide(); 17 $("body").css({ 18 ãã"overflow-x":"auto", 19 ãã"overflow-y":"auto" 20 }); 21 }) 22 23 //注åæå¡åè®® 24 $(".servicebtn").click(function(){ 25 $(".monitor").show(); 26 $(".serviceAgreement").show(); 27 $("body").css({ 28 ãã"overflow-x":"hidden", 29 ãã"overflow-y":"hidden" 30 }); 31 }) 32 33 $(".define").click(function(){ 34 $(".monitor").hide(); 35 $(".serviceAgreement").hide(); 36 $("body").css({ 37 ãã"overflow-x":"auto", 38 ãã"overflow-y":"auto" 39 }); 40 }) 41 42// $(".nextstep").click(function(){ 43// $(".tempphone").hide(); 44// $(".nextstep").hide(); 45// $(".temppass,.stepdefine").show() 46// }) 47 48}) 49 50function logout(){ 51 $.ajax({ 52 type:'post', 53 url:local_host +"user/logout", 54 data:{}, 55 success:function(dataMap){ 56 window.location.reload(); 57 } 58 }) 59} 60 61function openLogin(){ 62 $(".monitor").show(); 63 $(".loginwrap").show(); 64 $("body").css({ 65 ãã"overflow-x":"hidden", 66 ãã"overflow-y":"hidden" 67 }); 68} 69 70app.controller('j-register-validate', function($scope,$http) { 71 72 //ç¦æ¢è¾å ¥ç©ºæ ¼ 73 function Trim(str, is_global) { 74 var result; 75 result = str.replace(/(^\s+)|(\s+$)/g, ""); 76 if (is_global.toLowerCase() == "g") { 77 result = result.replace(/\s/g, ""); 78 } 79 return result; 80 } 81 $scope.NoSapceInput = function (e,input_name) { 82 var curValue = e.target.value; 83 if(curValue.indexOf(" ") >= 0){ 84 $("#errorSpaceCode").css("display","block"); 85 }else{ 86 $("#errorSpaceCode").css("display","none"); 87 } 88 $scope[input_name] = curValue.replace(" ",""); 89 $scope[input_name] = Trim(curValue, "g"); 90 var keynum; 91 if (window.event) // IE 92 { 93 keynum = e.keyCode 94 } 95 else if (e.which) // Netscape/Firefox/Opera 96 { 97 keynum = e.which 98 } 99 if (keynum == 32) { 100 return false; 101 } 102 return true; 103 } 104 105 //æäº¤æ³¨åç¨æ· 106 $scope.register = function(){ 107 if($("#stAgree").hasClass("active") && $("#errorSpaceCode").attr("style").indexOf("none") > 0){ 108 $("#userProtocol").css("display","none"); 109 $http({ 110 method:'POST', 111 url:local_host +"user/register-data", 112 params:{"phone":$("input[name='phone']").val(),"email":$("input[name='email']").val(), 113 "password":$("input[name='password']").val(),"checkCode":$("input[name='checkCode']").val()} 114 }).then(function(response){ 115 if(response.data.result == "success"){ 116 var publisherId = $("#publisherId").val(); 117 if(!isNull(publisherId) && publisherId !="index"){ 118 window.location.href = local_host + "/journal/"+publisherId; 119 }else{ 120 window.location.href = local_host ; 121 } 122 123 }else{ 124 $("#errorCode").css("display","block"); 125 } 126 },function(response){ 127 console.log("ç³»ç»å¼å¸¸"); 128 alert("ç³»ç»å¼å¸¸"); 129 }); 130 }else{ 131 if(!$("#stAgree").hasClass("active")){ 132 $("#userProtocol").css("display","block"); 133 } 134 } 135 } 136 137}); 138 139/** 140 * 注åè·åéªè¯ç 141 * @param $scope 142 * @param $http 143 * @param $interval 144 * @returns 145 */ 146app.controller('registerCode', function($scope,$http,$interval) { 147 $scope.canClick=false; 148 $scope.description = "è·åéªè¯ç "; 149 $scope.loadRegister = function() { 150 if(window.localStorage.secondsf){ 151 timerHandler = $interval(function(){ 152 if(window.localStorage.secondsf <= 0){ 153 $interval.cancel(timerHandler); 154 delete window.localStorage.secondsf; 155 $scope.description="è·åéªè¯ç "; 156 $scope.canClick=false; 157 }else{ 158 $scope.description=window.localStorage.secondsf+"såéå"; 159 window.localStorage.secondsf--; 160 $scope.canClick=true; 161 $("#phoneRegister .gettestcode").prop("disabled",true); 162 } 163 },1000) 164 } 165 } 166 var timerHandler; 167 $scope.getRegisterCode = function(){ 168 $http({ 169 method:'POST', 170 url:local_host +"user/send-phone-register-code", 171 params:{"phone":$("input[name='phone']").val()} 172 }).then(function(response){ 173 if(response.data.result == "success"){ 174 if(window.localStorage.secondsf){ 175 $scope.description= window.localStorage.secondsf + "åéå"; 176 }else{ 177 $scope.description="60såéå"; 178 window.localStorage.secondsf=59; 179 } 180 timerHandler =$interval(function(){ 181 if(window.localStorage.secondsf<=0){ 182 $interval.cancel(timerHandler); 183 delete window.localStorage.secondsf; 184 $scope.description="è·åéªè¯ç "; 185 $scope.canClick=false; 186 }else{ 187 $scope.description = window.localStorage.secondsf+"såéå"; 188 window.localStorage.secondsf--; 189 $scope.canClick=true; 190 $("#phoneRegister .gettestcode").prop("disabled",true); 191 } 192 },1000) 193 } 194 },function(response){ 195 console.log("ç³»ç»å¼å¸¸"); 196 alert("ç³»ç»å¼å¸¸"); 197 }); 198 }; 199}); 200 201/** 202 * ç»å½è·åéªè¯ç 203 * @param $scope 204 * @param $http 205 * @param $interval 206 * @returns 207 */ 208app.controller('loginCode', function($scope,$http,$interval) { 209 $scope.canClick=false; 210 $scope.description = "è·åéªè¯ç "; 211 $scope.loadLogin = function() { 212 if(window.localStorage.secondsl){ 213 timerHandler = $interval(function(){ 214 if(window.localStorage.secondsl <= 0){ 215 $interval.cancel(timerHandler); 216 delete window.localStorage.secondsl; 217 $scope.description="è·åéªè¯ç "; 218 $scope.canClick=false; 219 }else{ 220 $scope.description=window.localStorage.secondsl+"såéå"; 221 window.localStorage.secondsl--; 222 $scope.canClick=true; 223 $("#phonelogin .gettestcode").prop("disabled",true); 224 } 225 },1000) 226 } 227 } 228 var timerHandler; 229 $scope.getLoginCode = function(){ 230 $http({ 231 method:'POST', 232 url:local_host +"user/send-phone-login-code", 233 params:{"phone":$("input[name='lphone']").val()} 234 }).then(function(response){ 235 if(response.data.result == "success"){ 236 if(window.localStorage.secondsl){ 237 $scope.description= window.localStorage.secondsl + "åéå"; 238 }else{ 239 $scope.description="60såéå"; 240 window.localStorage.secondsl=59; 241 } 242 timerHandler =$interval(function(){ 243 if(window.localStorage.secondsl<=0){ 244 $interval.cancel(timerHandler); 245 delete window.localStorage.secondsl; 246 $scope.description="è·åéªè¯ç "; 247 $scope.canClick=false; 248 }else{ 249 $scope.description = window.localStorage.secondsl+"såéå"; 250 window.localStorage.secondsl--; 251 $scope.canClick=true; 252 $("#phonelogin .gettestcode").prop("disabled",true); 253 } 254 },1000) 255 } 256 },function(response){ 257 console.log("ç³»ç»å¼å¸¸"); 258 alert("ç³»ç»å¼å¸¸"); 259 }); 260 }; 261}); 262 263/** 264 * å¿è®°å¯ç è·åéªè¯ç 265 * @param $scope 266 * @param $http 267 * @param $interval 268 * @returns 269 */ 270app.controller('forgetCode', function($scope,$http,$interval) { 271 $scope.canClick=false; 272 $scope.description = "è·åéªè¯ç "; 273 $scope.loadForget = function() { 274 if(window.localStorage.secondsf){ 275 timerHandler = $interval(function(){ 276 if(window.localStorage.secondsf <= 0){ 277 $interval.cancel(timerHandler); 278 delete window.localStorage.secondsf; 279 $scope.description="è·åéªè¯ç "; 280 $scope.canClick=false; 281 }else{ 282 $scope.description=window.localStorage.secondsf+"såéå"; 283 window.localStorage.secondsf--; 284 $scope.canClick=true; 285 $("#phoneForget .gettestcode").prop("disabled",true); 286 } 287 },1000) 288 } 289 } 290 var timerHandler; 291 $scope.getForgetCode = function(){ 292 $http({ 293 method:'POST', 294 url:local_host +"user/send-phone-modifypassword-code", 295 params:{"phone":$("input[name='fphone']").val()} 296 }).then(function(response){ 297 if(response.data.result == "success"){ 298 if(window.localStorage.secondsf){ 299 $scope.description= window.localStorage.secondsf + "åéå"; 300 }else{ 301 $scope.description="60såéå"; 302 window.localStorage.secondsf=59; 303 } 304 timerHandler =$interval(function(){ 305 if(window.localStorage.secondsf<=0){ 306 $interval.cancel(timerHandler); 307 delete window.localStorage.secondsf; 308 $scope.description="è·åéªè¯ç "; 309 $scope.canClick=false; 310 }else{ 311 $scope.description = window.localStorage.secondsf+"såéå"; 312 window.localStorage.secondsf--; 313 $scope.canClick=true; 314 $("#phoneForget .gettestcode").prop("disabled",true); 315 } 316 },1000) 317 } 318 },function(response){ 319 console.log("ç³»ç»å¼å¸¸"); 320 alert("ç³»ç»å¼å¸¸"); 321 }); 322 }; 323}); 324 325/** 326 * 注åéªè¯å¯ææºä¸æ§ï¼ä¸åå¨ä¸ºtrueï¼åå¨ä¸ºfalse 327 */ 328app.directive('ensureUnique', ['$http', function($http) { 329 return { 330 require: 'ngModel', 331 link: function(scope, ele, attrs, c) { 332 scope.$watch(attrs.ngModel, function() { 333 var phone = $("input[name='phone']").val(); 334 if(!isNull(phone)){ 335 $http({ 336 method: 'POST', 337 url: '/user/register-phone-validate', 338 params: {'phone': phone} 339 }).success(function(data, status, headers, cfg) { 340 if(data.result == "success"){ 341 c.$setValidity('unique', true); 342 }else{ 343 c.$setValidity('unique', false); 344 } 345 }).error(function(data, status, headers, cfg) { 346 c.$setValidity('unique', false); 347 }); 348 } 349 });
350 } 351 } 352}]); 353 354/** 355 * ç»å½,å¿è®°å¯ç éªè¯å¯ææºä¸æ§ï¼åå¨ä¸ºtrueï¼ä¸åå¨ä¸ºfalse 356 */ 357app.directive('ensureUnique2', ['$http', function($http) { 358 return { 359 require: 'ngModel', 360 link: function(scope, ele, attrs, c) { 361 scope.$watch(attrs.ngModel, function() { 362 var phone = $("input[name='fphone']").val(); 363 if(isNull(phone)){ 364 phone = $("input[name='lphone']").val(); 365 } 366 if(!isNull(phone)){ 367 $http({ 368 method: 'POST', 369 url: '/user/register-phone-validate', 370 params: {'phone': phone} 371 }).success(function(data, status, headers, cfg) { 372 if(data.result == "success"){ 373 c.$setValidity('unique', false); 374 }else{ 375 c.$setValidity('unique', true); 376 } 377 }).error(function(data, status, headers, cfg) { 378 c.$setValidity('unique', false); 379 }); 380 } 381 }); 382 } 383 } 384}]); 385 386app.controller('login', function($scope,$http,$interval) { 387 388 $scope.accountLogin = function(){ 389 $http({ 390 method:'POST', 391 url:local_host +"user/password-login", 392 params:{"loginAccount":$("input[name='account']").val(),'password':$("input[name='password']").val()} 393 }).then(function(response){ 394 if(response.data.result == "success"){ 395 if(window.location.href.indexOf("forget-pwd") > 0){ 396 window.location.href = local_host; 397 }else{ 398 window.location.reload(); 399 } 400 }else{ 401 $("#errorPassword").css("display","block"); 402 } 403 },function(response){ 404 console.log("ç³»ç»å¼å¸¸"); 405 alert("ç³»ç»å¼å¸¸"); 406 }); 407 }; 408 409 $scope.phoneLogin = function(){ 410 $http({ 411 method:'POST', 412 url:local_host +"user/checkcode-login", 413 params:{"phone":$("input[name='lphone']").val(),'checkCode':$("input[name='lcheckCode']").val()} 414 }).then(function(response){ 415 if(response.data.result == "success"){ 416 if(window.location.href.indexOf("forget-pwd") > 0){ 417 window.location.href = local_host; 418 }else{ 419 window.location.reload(); 420 } 421 }else{ 422 $("#lerrorCode").css("display","block"); 423 } 424 },function(response){ 425 console.log("ç³»ç»å¼å¸¸"); 426 alert("ç³»ç»å¼å¸¸"); 427 }); 428 }; 429}); 430 431app.controller('forgetPassword', function($scope,$http,$interval) { 432 433 $scope.nextStep = function(){ 434 $http({ 435 method:'POST', 436 url:local_host +"user/modify-password-checkcode", 437 params:{"phone":$("input[name='fphone']").val(),'checkCode':$("input[name='fcheckCode']").val()} 438 }).then(function(response){ 439 if(response.data.result == "success"){ 440 $(".tempphone").hide(); 441 $(".nextstep").hide(); 442 $(".temppass,.stepdefine").show() 443 }else{ 444 $("#ferrorCode").css("display","block"); 445 } 446 },function(response){ 447 console.log("ç³»ç»å¼å¸¸"); 448 alert("ç³»ç»å¼å¸¸"); 449 }); 450 }; 451 452 $scope.modifyPassword = function(){ 453 if($("input[name='fpassword']").val() == $("input[name='fpassword2']").val()){ 454 $http({ 455 method:'POST', 456 url:local_host +"user/modify-password", 457 params:{"phone":$("input[name='fphone']").val(),'password':$("input[name='fpassword']").val()} 458 }).then(function(response){ 459 if(response.data.result == "success"){ 460 $(".monitor").show(); 461 $(".loginwrap").show(); 462 $("body").css({ 463 ãã"overflow-x":"hidden", 464 ãã"overflow-y":"hidden" 465 }); 466 }else{ 467 alert("ç³»ç»å¼å¸¸"); 468 } 469 },function(response){ 470 console.log("ç³»ç»å¼å¸¸"); 471 alert("ç³»ç»å¼å¸¸"); 472 }); 473 }else{ 474 $("#ferrorPassword").css("display","block"); 475 } 476 }; 477}); 478 479//è·å䏿¬¡ç»å½è®°å½ 480app.controller('j-user-log', function($scope, $http) { 481 var userId = $('#userId').val(); 482 if(!isNull(userId)){ 483 $http({ 484 method:'post', 485 url:local_host +"user/latest-user-log", 486 params:{'userId':userId} 487 }).then(function(response){ 488 //æåæ¶æ§è¡ 489 if(response.data.result == 'success'){ 490 $scope.userLog = response.data.data; 491 }else{ 492 console.log(response.data.message); 493 } 494 },function(response){ 495 //å¤±è´¥æ¶æ§è¡ 496 console.log(response.data.message); 497 }); 498 } 499}); 500 501//è·åå ³æ³¨çåç±»å·ï¼å ³é®è¯ï¼ä½è ä¿¡æ¯ 502app.controller('j-user-attention', function($scope, $http) { 503 var userId = $('#userId').val(); 504 if(!isNull(userId)){ 505 $http({ 506 method:'post', 507 url:local_host +"user/user-attention-data", 508 params:{'userId':userId} 509 }).then(function(response){ 510 //æåæ¶æ§è¡ 511 if(response.data.result == 'success'){ 512 $scope.userAttention = response.data.data; 513 }else{ 514 console.log(response.data.message); 515 } 516 },function(response){ 517 //å¤±è´¥æ¶æ§è¡ 518 console.log(response.data.message); 519 }); 520 } 521
522 $scope.saveAttention = function() { 523 var classNumber = $('#classNumber').val(); 524 if(isNull(classNumber)){ 525 classNumber = ""; 526 } 527 var keyword = $('#keyword').val(); 528 if(isNull(keyword)){ 529 keyword = ""; 530 } 531 var author = $('#author').val(); 532 if(isNull(author)){ 533 author = ""; 534 } 535 $http({ 536 method:'post', 537 url:local_host +"user/save-user-attention", 538 params:{'userId':userId,'classNumber':classNumber,'keyword':keyword,'author':author} 539 }).then(function(response){ 540 //æåæ¶æ§è¡ 541 if(response.data.result == 'success'){ 542 alert("ä¿åæå!"); 543 }else{ 544 alert("ç³»ç»å¼å¸¸ï¼ä¿å失败!"); 545 } 546 },function(response){ 547 //å¤±è´¥æ¶æ§è¡ 548 console.log(response.data.message); 549 }); 550 } 551}); 552 553//ä¿åå ³æ³¨çåç±»å·ï¼å ³é®è¯åä½è 554app.controller('j-user-attention-save', function($scope, $http) { 555 var userId = $('#userId').val(); 556 if(!isNull(userId)){ 557 var classNumber = $('#classNumber').val(); 558 if(isNull(classNumber)){ 559 classNumber = ""; 560 } 561 var keyword = $('#keyword').val(); 562 if(isNull(keyword)){ 563 keyword = ""; 564 } 565 var author = $('#author').val(); 566 if(isNull(author)){ 567 author = ""; 568 } 569 $http({ 570 method:'post', 571 url:local_host +"user/save-user-attention", 572 params:{'userId':userId,'classNumber':classNumber,'keyword':keyword,'author':author} 573 }).then(function(response){ 574 //æåæ¶æ§è¡ 575 if(response.data.result == 'success'){ 576 $scope.userAttention = response.data.data; 577 }else{ 578 console.log(response.data.message); 579 } 580 },function(response){ 581 //å¤±è´¥æ¶æ§è¡ 582 console.log(response.data.message); 583 }); 584 } 585}); 586 587 588/** 589 * ç¨æ·å ³æ³¨å表ï¼åç±»å·ï¼å ³é®è¯ï¼ä½è çæç« 590 * @param $scope 591 * @param $http 592 * @returns 593 */ 594app.controller('j-user-attention-list', function($scope, $http) { 595 //è¾åºA-Z 26个大å忝 596 597 //页é¢ç¬¬ä¸æ¬¡å è½½ 598 /*setTimeout(function() { 599 $scope.paginationData(0); 600 });*/ 601 //ç¹å»é¡µç å è½½ 602 $scope.gotopage = function(page) { 603 if(isNull(page)){ 604 $scope.paginationData(1); 605 }else{ 606 $('#pageNum').val(page); 607 $scope.paginationData(2); 608 } 609 } 610 //è¾å ¥é¡µç å è½½ 611 $scope.enterEvent = function (e) { 612 if(loadCommonPagesEnter(e)){ 613 $scope.paginationData(1); 614 } 615 }; 616 617 $scope.toAttentionViewPage = function(attentionType) { 618 //0:åç±»å·;1:å ³é®è¯;2:ä½è ; 619 $('#pageNum').val(1); 620 $('#attentionType').val(attentionType); 621 $scope.paginationData(0); 622 } 623 624 $scope.paginationData = function(type) { 625 626 var currentpage = 0; 627 if(type == 1){ 628 currentpage = $("input.inputpagenum").val(); 629 }else{ 630 currentpage = $('#pageNum').val(); 631 } 632 var limit = $('#limit').val(); 633 if(isNull(limit)){ 634 limit = 10; 635 } 636 637 var attentionType = $('#attentionType').val(); 638 if(isNull(attentionType)){ 639 attentionType = ""; 640 } 641 642 var userId = $('#userId').val(); 643 if(isNull(userId)){ 644 userId = ""; 645 } 646 647 $http({ 648 method:'post', 649 url:local_host +"user/attention-list-data", 650 params:{'userId':userId,'type':attentionType,'pageNum':currentpage,'limit':limit} 651 }).then(function(response){ 652 //æåæ¶æ§è¡ 653 if(response.data.result == 'success'){ 654 if(attentionType == 0){ 655 $scope.attentionsClass = response.data.data.data; 656 }else if(attentionType == 1){ 657 $scope.attentionsKeyword = response.data.data.data; 658 }else if(attentionType == 2){
659 $scope.attentionsAuthor = response.data.data.data; 660 } 661 662 var count = response.data.data.count; 663 var totalpage = Math.ceil(count/limit); 664 $scope.count = count; 665 $scope.totalpage = totalpage; 666 $scope.currentpage = Number(currentpage); 667 $scope.pageList = new Array(); 668 $scope.pageList = loadCommonPages(count,totalpage,currentpage,limit); 669 670 $('#amount').val(count); 671 $('#totalpage').val(totalpage); 672 $('.loading-show').hide(); 673 }else{ 674 console.log(response.data.message); 675 } 676 },function(response){ 677 //å¤±è´¥æ¶æ§è¡ 678 console.log(response.data.message); 679 }); 680 } 681}); 682 683/** 684 * ç¨æ·æ¶èå表ï¼type==>0:论æ;1:å¾ä¹¦;2:讲座;3:ä¼è®®; 685 * @param $scope 686 * @param $http 687 * @returns 688 */ 689app.controller('j-user-collection-list', function($scope, $http) { 690 //è¾åºA-Z 26个大å忝 691 692 //页é¢ç¬¬ä¸æ¬¡å è½½ 693 /*setTimeout(function() { 694 $scope.paginationData(0); 695 });*/ 696 //ç¹å»é¡µç å è½½ 697 $scope.gotopage = function(page) { 698 if(isNull(page)){ 699 $scope.paginationData(1); 700 }else{ 701 $('#pageNum').val(page); 702 $scope.paginationData(2); 703 } 704 } 705 //è¾å ¥é¡µç å è½½ 706 $scope.enterEvent = function (e) { 707 if(loadCommonPagesEnter(e)){ 708 $scope.paginationData(1); 709 } 710 }; 711 712 $scope.toCollectionViewPage = function(collectionType) { 713 $('#pageNum').val(1); 714 //0:论æ;1:å¾ä¹¦;2:讲座;3:ä¼è®®; 715 $('#collectionType').val(collectionType); 716 $scope.paginationData(0); 717 } 718 719 //åæ¶æ¶è 720 $scope.toCancelCollection = function(id) { 721 if(!isNull(id)){ 722 $http({ 723 method:'post', 724 url:local_host +"user/cancel-collection-user", 725 params:{'id':id} 726 }).then(function(response){ 727 //æåæ¶æ§è¡ 728 if(response.data.result == 'success'){ 729 //$scope.collection = response.data.data; 730 alert("åæ¶æ¶èæåï¼"); 731 }else{ 732 console.log(response.data.message); 733 } 734 },function(response){ 735 //å¤±è´¥æ¶æ§è¡ 736 console.log(response.data.message); 737 }); 738 } 739 } 740 741 $scope.paginationData = function(type) { 742 743 var currentpage = 0; 744 if(type == 1){ 745 currentpage = $("input.inputpagenum").val(); 746 }else{ 747 currentpage = $('#pageNum').val(); 748 } 749 var limit = $('#limit').val(); 750 if(isNull(limit)){ 751 limit = 10; 752 } 753 754 var collectionType = $('#collectionType').val(); 755 if(isNull(collectionType)){
756 collectionType = ""; 757 } 758 759 var userId = $('#userId').val(); 760 if(isNull(userId)){ 761 userId = ""; 762 } 763 764 $http({ 765 method:'post', 766 url:local_host +"user/collection-user-data", 767 params:{'userId':userId,'type':collectionType,'pageNum':currentpage,'limit':limit} 768 }).then(function(response){ 769 //æåæ¶æ§è¡ 770 if(response.data.result == 'success'){ 771 $scope.collections = response.data.data; 772 773 var count = response.data.count; 774 var totalpage = Math.ceil(count/limit); 775 $scope.count = count; 776 $scope.totalpage = totalpage; 777 $scope.currentpage = Number(currentpage); 778 $scope.pageList = new Array(); 779 $scope.pageList = loadCommonPages(count,totalpage,currentpage,limit); 780 781 $('#amount').val(count); 782 $('#totalpage').val(totalpage); 783 $('.loading-show').hide(); 784 }else{ 785 console.log(response.data.message); 786 } 787 },function(response){ 788 //å¤±è´¥æ¶æ§è¡ 789 console.log(response.data.message); 790 }); 791 } 792}); 793 794app.controller('j-user-modify', function($scope, $http) { 795 var userId = $('#userId').val(); 796 //页é¢ç¬¬ä¸æ¬¡å è½½ 797 setTimeout(function() { 798 $scope.findUserInfo(); 799 }); 800 801 //éç½®æ¶è·åä¸ªäººä¿¡æ¯ 802 $scope.resetUserInfo = function(){ 803 $scope.findUserInfo(); 804 $('.userphoto').attr("src",$scope.userInfo.imagePath); 805 $('#imagePath').val($scope.userInfo.imagePath); 806 } 807 808 //è·åä¸ªäººä¿¡æ¯ 809 $scope.findUserInfo = function(){ 810 if(!isNull(userId)){ 811 $http({ 812 method:'post', 813 url:local_host +"user/user-info-data", 814 params:{'userId':userId} 815 }).then(function(response){ 816 //æåæ¶æ§è¡ 817 if(response.data.result == 'success'){ 818 $scope.userInfo = response.data.data; 819 if(isNull($scope.userInfo.sex)){ 820 $scope.userInfo.sex = 0; 821 } 822 $scope.phone = $scope.userInfo.phone; 823 }else{ 824 console.log(response.data.message); 825 } 826 },function(response){ 827 //å¤±è´¥æ¶æ§è¡ 828 console.log(response.data.message); 829 }); 830 } 831 } 832 833 //ä¿åä¸ªäººä¿¡æ¯ 834 $scope.modifyUserInfo = function(){ 835 //妿æºå·æªåä¿®æ¹ 836 var imagePath = $('#imagePath').val(); 837 if($scope.userInfo.phone == $scope.phone){ 838 $http({ 839 method:'post', 840 url:local_host +"user/user-modify", 841 params:{'id':userId,'realName':$scope.userInfo.realName,'realNameEn':$scope.userInfo.realNameEn, 842 'sex':$scope.userInfo.sex,'birthday':$scope.userInfo.birthday,'country':$scope.userInfo.country, 843 'province':$scope.userInfo.province,'institution':$scope.userInfo.institution, 844 'email':$scope.userInfo.email,'phone':$scope.userInfo.phone,'imagePath':imagePath} 845 }).then(function(response){ 846 //æåæ¶æ§è¡ 847 if(response.data.result == 'success'){ 848 alert("ä¿åæåï¼"); 849 }else{ 850 alert("ç³»ç»å¼å¸¸ï¼ä¿å失败ï¼"); 851 } 852 },function(response){ 853 //å¤±è´¥æ¶æ§è¡ 854 console.log(response.data.message); 855 }); 856 } 857 } 858 859 //ä¿®æ¹å¯ç 860 $scope.savePassword = function(){ 861 var oldPassword = $("input[name='oldPassword']").val(); 862 var newPassword1 = $("input[name='newPassword1']").val(); 863 var newPassword2 = $("input[name='newPassword2']").val(); 864 if(!isNull(oldPassword) && !isNull(newPassword1) && newPassword1 == newPassword2){ 865 $('#errorTwoPassword').hide(); 866 $http({ 867 method:'post', 868 url:local_host +"user/save-password", 869 params:{'userId':userId,'oldPassword':oldPassword,'newPassword':newPassword1} 870 }).then(function(response){ 871 //æåæ¶æ§è¡ 872 if(response.data.result == 'success'){ 873 $("input[name='oldPassword']").val(""); 874 $("input[name='newPassword1']").val(""); 875 $("input[name='newPassword2']").val(""); 876 alert("ä¿®æ¹æåï¼"); 877 }else{ 878 alert("æ§å¯ç é误ï¼ä¿®æ¹å¤±è´¥ï¼"); 879 } 880 },function(response){ 881 //å¤±è´¥æ¶æ§è¡ 882 console.log(response.data.message); 883 }); 884 }else{ 885 $('#errorTwoPassword').show(); 886 } 887 } 888 889 //éç½®å¯ç
890 $scope.resetPassword = function(){ 891 $("input[name='oldPassword']").val(""); 892 $("input[name='newPassword1']").val(""); 893 $("input[name='newPassword2']").val(""); 894 } 895 896 //ä¸ä¼ å¾ç 897 $scope.uploadImg = function(){ 898 var file = document.querySelector("input[name='imagePath']").files[0]; 899 if(isNull(file)){ 900 alert("请ä¸ä¼ æä»¶"); 901 return false; 902 } 903 var userId = $("input[name='userId']").val(); 904 var fd = new FormData(); 905 //var file = document.querySelector('input[type=file]').files[0]; 906 fd.append('file', file); 907 fd.append('userId', userId); 908 $http({ 909 method:'POST', 910 url:local_host +"user/upload-user-file", 911 data:fd, 912 headers: {'Content-Type':undefined}, 913 transformRequest: angular.identity 914 }).then(function(response){ 915 if(response.data.result == "success"){ 916 $scope.file = response.data.data; 917 $('.userphoto').attr("src",$scope.file.filePath); 918 $('#imagePath').val($scope.file.filePath); 919 alert("ä¸ä¼ æåï¼"); 920 }else{ 921 alert("ç³»ç»å¼å¸¸ï¼"); 922 } 923 },function(response){ 924 alert("ç³»ç»å¼å¸¸"); 925 }); 926 } 927});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.