Skip to content

Commit f0b6e22

Browse files
author
Administrator
committed
修改用户信息
1 parent efb8919 commit f0b6e22

File tree

10 files changed

+66
-84
lines changed

10 files changed

+66
-84
lines changed

app/models/student.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ var studentSchema = new Schema({
77
password:{type:String,require:true},
88
job:{type:String,require:true},
99
gender:{type:String,require:true},
10+
signature:{type:String,require:true},
1011
prefix:{type:String},
1112
headPic:{type:String,default:''},
12-
signature:{type:String},
1313
createDt:{type:Date,default:Date.now},
1414
lastModifiedDate:{type:Date}
1515
});
1616

1717

1818
var Student= mongoose.model('student',studentSchema);
19-
2019
module.exports = {Student};

app/route/Student.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class StudentLogic extends Logic {
2727
async getStudentList(req,res){
2828
var result ={state:1,issuccess:false};
2929
var students = await this.db.Student.find({}).exec();
30-
3130
result.issuccess= true;
3231
result.data = students;
3332
res.json(result);
@@ -52,10 +51,10 @@ class StudentLogic extends Logic {
5251
async changePersonalInformation(req,res){
5352

5453
var result = {state:1,issuccess:false};
55-
var {name,phone,signature,gender}= req.query;
56-
var student = await this.db.Student.update({phone:phone},{name:name,signature:signature,gender:gender},{},function(){}).exec();
54+
var {name,phone,signature,gender,job}= req.query;
55+
var student = await this.db.Student.update({phone:phone},{name:name,signature:signature,gender:gender,job:job},{},function(){}).exec();
5756
result.issuccess = true;
58-
result.msg="成功修改用户名!";
57+
result.msg="成功修改用户信息!";
5958

6059
res.json(result);
6160

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"gulp-sequence": "^0.4.5",
2424
"http": "0.0.0",
2525
"method-override": "^2.3.6",
26+
"module": "^1.2.5",
2627
"moment": "^2.14.1",
2728
"mongoose": "^4.5.1",
2829
"morgan": "^1.7.0",

www/js/app/controller.js

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -50,53 +50,41 @@ angular.module('app.controller',[])
5050
$state.go("menu2.tab-friends");
5151
};
5252
})
53-
.controller('SettingCtrl', function($scope,$ionicPopover,$timeout,$ionicModal,userService,$rootScope) {
53+
.controller('SettingCtrl', function($scope,$ionicPopover,$timeout,$ionicModal,userService,$rootScope,$state) {
5454
// userService.signIn={"15671624774","www123"};
5555
// $rootScope.user={};
5656
$scope.user = {};
5757
$scope.changePersonalInformation = function() {
5858
userService.changePersonalInformation($scope.user);
5959
}
6060

61-
//头像预览弹窗
62-
$scope.popover = $ionicPopover.fromTemplateUrl('setting2.html', {
63-
scope: $scope
64-
});
65-
// .fromTemplateUrl() 方法
66-
$ionicPopover.fromTemplateUrl('setting2.html', {
67-
scope: $scope
68-
}).then(function(popover) {
69-
$scope.popover = popover;
70-
});
71-
$scope.openPopover = function($event) {
72-
$scope.popover.show($event);
73-
};
74-
$scope.closePopover = function() {
75-
$scope.popover.hide();
76-
};
77-
// 清除浮动框
78-
$scope.$on('$destroy', function() {
79-
$scope.popover.remove();
80-
});
81-
82-
61+
$scope.exit=function(){
62+
$state.go("sign-in");
8363

64+
}
8465

85-
// // 在隐藏浮动框后执行
86-
// $scope.$on('popover.hidden', function() {
87-
// // 执行代码
66+
//头像预览弹窗
67+
// $scope.popover = $ionicPopover.fromTemplateUrl('setting2.html', {
68+
// scope: $scope
69+
// });
70+
// // .fromTemplateUrl() 方法
71+
// $ionicPopover.fromTemplateUrl('setting2.html', {
72+
// scope: $scope
73+
// }).then(function(popover) {
74+
// $scope.popover = popover;
8875
// });
89-
// // 移除浮动框后执行
90-
// $scope.$on('popover.removed', function() {
91-
// // 执行代码
76+
// $scope.openPopover = function($event) {
77+
// $scope.popover.show($event);
78+
// };
79+
// $scope.closePopover = function() {
80+
// $scope.popover.hide();
81+
// };
82+
// // 清除浮动框
83+
// $scope.$on('$destroy', function() {
84+
// $scope.popover.remove();
9285
// });
9386

9487

95-
// $scope.contacts = [
96-
// { name: 'Gordon Freeman' },
97-
// { name: 'Barney Calhoun' },
98-
// { name: 'Lamarr the Headcrab' },
99-
// ];
10088

10189

10290
//个人信息设置
@@ -165,7 +153,7 @@ angular.module('app.controller',[])
165153
// $scope.modal.hide();
166154
// };
167155

168-
156+
//
169157
$scope.jobs = [
170158
"网页设计师",
171159
"前端工程师",
@@ -177,6 +165,15 @@ angular.module('app.controller',[])
177165
"其他"
178166
]
179167

168+
$scope.clientSideList = [
169+
{ text: "男", value: "男" },
170+
{ text: "女", value: "女" }
171+
172+
];
173+
$scope.user = {
174+
gender: '女'
175+
};
176+
180177

181178
})
182179

www/js/app/service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ angular.module('app.service',['ionic','ngCordova'])
8686
$http({
8787
method:'GET',
8888
url:config.serverUrl+"student/changePersonalInformation",
89-
params:{phone:$rootScope.user.phone,name:user.name}
89+
params:{phone:$rootScope.user.phone,name:user.name,signature:user.signature,job:user.job,gender:user.gender}
9090
}).success(function(rtn){
9191
if(rtn.issuccess) {
9292
$state.go('app.setting');

www/js/app/tool.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
angular.module('app.service').
22
factory('config',function(){
33
return {
4-
serverUrl:'http://192.168.1.46:3000/',
4+
serverUrl:'http://192.168.1.25:3000/',
55
phoneRegex:/^(13[0-9]|14[0-9]|15[0-9]|18[0-9])\d{8}$/,
66
passwordRegex:/^[a-zA-Z]\w{5,17}$/,
7-
userNameRegex:/^[a-zA-Z]\w{5,17}$/
7+
userNameRegex:/^[a-zA-Z]\w{5,17}$/,
8+
// defaultUserName:$rootScope.user.name,
9+
// defaultUserJob:$rootScope.user.job,
10+
// defaultUserGender:$rootScope.user.gender,
11+
// defaultUserSignatue:$rootScope.user.signature,
812
}
913
})
1014
.factory('camera',function($cordovaCamera) {

www/templates/app/menu.html

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div class="padding text-center">
1313
<div class="avatar">
1414
<img ng-click="changeHeader()" style="border-radius: 200px;width:200px;height:200px;"
15-
src=" {{ user.headpic ||'img/wh.jpg'}}" alt="" class="img-responsive" />
15+
src=" {{ user.headpic ||'img/me.png'}}" alt="" class="img-responsive" />
1616
</div>
1717
<strong class="no-margin">{{user.name}}</strong>
1818
<strong class="no-margin">{{user.job}}</strong>
@@ -24,19 +24,19 @@
2424
<a class="item item-icon-left" ui-sref="app.tab.message" ui-sref-active="active" menu-close>
2525
<i class="icon mdi mdi-account-circle font-icon-md"></i>
2626
消息
27-
<span class="badge badge-royal">7</span>
27+
<span class="badge badge-positive">7</span>
2828
</a>
2929

3030
<a class="item item-icon-left" ui-sref="app.templateyun" ui-sref-active="active" menu-close>
3131
<i class="icon mdi mdi-bell-ring font-icon-md"></i>
3232
云模板
33-
<span class="badge badge-assertive">新增10</span>
33+
<span class="badge badge-positive">新增10</span>
3434
</a>
3535

3636
<a class="item item-icon-left" ui-sref="app.menu4" ui-sref-active="active" menu-close>
3737
<i class="icon mdi mdi-message-processing font-icon-md"></i>
3838
旅烨视闻
39-
<span class="badge badge-assertive">67</span>
39+
<span class="badge badge-positive">67</span>
4040
</a>
4141

4242
<a class="item item-icon-left" ui-sref="app.menu6" ui-sref-active="active" menu-close>
@@ -48,7 +48,7 @@
4848
<a class="item item-icon-left" ui-sref="app.music" ui-sref-active="active" menu-close>
4949
<i class="icon mdi mdi-library-music font-icon-md"></i>
5050
Music
51-
<span class="badge badge-balanced">36</span>
51+
<span class="badge badge-positive">36</span>
5252
</a>
5353
</div>
5454
<div class="list border-top">
@@ -80,17 +80,6 @@
8080
</ion-slide-box>
8181
</ion-view>
8282
</script>
83-
<script id="setting2.html" type="text/ng-template">
84-
<ion-popover-view style="width: 100%; height: 430px;" >
85-
<ion-header-bar>
86-
<h1 class="title">我的头像</h1>
87-
</ion-header-bar>
88-
<ion-content>
89-
<img src="{{'img/ben.png'}}" class="img-responsive" style="width: 100%; height: auto; margin: 0 auto"/>
90-
</ion-content>
91-
</ion-popover-view>
92-
</script>
93-
9483

9584
<script id="templates/headpic.html" type="text/ng-template">
9685
<ion-modal-view>
@@ -103,7 +92,6 @@ <h1 class="title">头像设置</h1>
10392
<img src=" {{ user.headpic ||'templates/app/img/200_taylor_swift_spl811605_.jpg'}}" class="img-responsive" style="width: 100%; height: auto; margin: 0 auto" >
10493
<div class="list">
10594

106-
10795
<ul class="list text-center">
10896
<li class="item">
10997
拍照
@@ -149,29 +137,27 @@ <h1 class="title">个人信息</h1>
149137
<div class="list">
150138
<label class="item item-input">
151139
<strong class="input-label">用户名</strong>
152-
<input type="text" placeholder="{{user.name}}" ng-model="user.name" >
140+
<input type="text" placeholder="{{user.name||'修改用户名'}}" ng-model="user.name" >
153141
</label>
154-
155-
<label class="item item-input">
156-
<strong class="input-label">手机号</strong>
157-
<input type="text" placeholder="{{user.phone}}" ng-model="user.phone" >
158-
</label>
159142
</div>
160143

161-
162-
163144
<div class="list card" >
164145
<div class="item item-button-right">
165146
<strong> 编辑个性签名</strong>
166147
</div>
167-
<textarea class="padding" style="width:94%; height: 80px; border: 1px solid #ccc;resize: none; margin:10px;" placeholder="{{user.signature}}"></textarea>
148+
<textarea class="padding" ng-model="user.signature" placeholder="{{user.signature||'说说现在的心情呗......'}}" style="width:94%; height: auto; border: 1px solid #ccc; margin:10px;resize:none;"></textarea>
168149
</div>
169150

170151
<div class="list">
171-
<label class="item "><strong class="input-label">性别</strong></label>
172-
<ion-list>
173-
<ion-radio ng-model="choice" ng-value="'男'"></ion-radio>
174-
<ion-radio ng-model="choice" ng-value="'女'"></ion-radio>
152+
<label class="item " ><strong class="input-label" >性别</strong></label>
153+
<ion-list >
154+
<!--<ion-radio ng-model="user.gender" ng-value="'男'" >男</ion-radio>-->
155+
<!--<ion-radio ng-model="user.gender" ng-value="'女'">女</ion-radio>-->
156+
<ion-radio ng-repeat="item in clientSideList"
157+
ng-value="item.value"
158+
ng-model="user.gender">
159+
{{ item.text }}
160+
</ion-radio>
175161
</ion-list>
176162
</div>
177163

@@ -180,8 +166,8 @@ <h1 class="title">个人信息</h1>
180166
<strong class="input-label">
181167
职业类型
182168
</strong>
183-
<select ng-model="user.job" convert-to-number>
184-
<option ng-repeat="x in jobs">{{x}}</option>
169+
<select convert-to-number ng-model="user.job" >
170+
<option ng-repeat="x in jobs" selected="">{{x}}</option>
185171
</select>
186172
</label>
187173
</div>

www/templates/app/states/setting.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ <h3 style="display: inline-block; line-height: 36px; ">头像设置</h3>
100100

101101

102102
<div class="list">
103-
<button class="button button-full button-positive">
104-
退出登录
103+
<button class="button button-full button-positive" ng-click="exit()">
104+
退出账号
105105
</button>
106106
</div>
107107

www/templates/forgot-password.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
<span class="icon ion-locked"></span>
1212
<input type="password" ng-model="user.password" placeholder="输入新密码,英文字母加数字长度为6到12位">
1313
</label>
14-
<!--<label class="item item-input">-->
15-
<!--<span class="icon ion-locked"></span>-->
16-
<!--<input type="password" ng-model="user.password2" placeholder="请确认密码">-->
17-
<!--</label>-->
1814
</div>
1915

2016
<div class="padding send-identifying">

www/templates/sign-up.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<span class="icon ion-heart"></span>
2222
<span style="color:#111" >职业类型</span>
2323
</div>
24-
<select ng-model="user.job" convert-to-number >
25-
<option ng-repeat="x in jobs">{{x}}</option>
24+
<select convert-to-number >
25+
<option ng-repeat="x in jobs" ng-model="user.job">{{x}}</option>
2626
</select>
2727

2828
</div>

0 commit comments

Comments
 (0)