您的位置:首页 > 其它

22

2014-12-11 23:13 162 查看
//Javascript Code : User add/delete information
var member = function(userId, name, sex, age, password, remark){
this.userId = userId;
this.name = name;
this.sex = sex;
this.age = age;
this.password = password;
this.remark = remark;
};
member.prototype = {
addInfo:function(userId, infoBody, date){
//addInfo(userId, infoBody, date);
},
deleteInfo:function(infoId){
//deleteInfo(infoId);
},
addComment:function(userId, commentBody, date){
//addComment(userId, commentBody, date);
},
deleteComment:function(commentId){
//deleteComment(commentId)''
},
addLike:function(userId, infoId){
//addLike(userId, infoId);
},
deleteLike:function(likeId){
//deleteLike(likeId);
}
}

function user(){
member.call(this);
this.isAdmin = false;
}

user.prototype = new member();

function admin(name, sex, age, password, isAdmin, remark){
member.call(this);
this.isAdmin = true;
}

admin.prototype = new member();
admin.prototype.addUser = function(userName, userPwd){
//addUser(userName, userPwd);
}
admin.prototype.deleteUser = function(userId){
//deleteUser(userId);
}

//create user & admin
var User = new user(1, 'user', 1, 22, '123456', 0, 'this is a normal user.');
var Admin = new admin(2 , 'admin', 1, 22, '123456', 0, 'this is a super admin.');

//addinfo
//if success, console.log('this is a information by user at 2014-12-10');
User.addInfo(1, 'this is a information', new Date('2014-12-10'));

//addComment
//if success, console.log('this is a comment by user at 2014-12-10');
User.addComment(1, 'this is a comment', new Date('2014-12-10'));

//deleteLike
//if success, console.log('the likeId 2 has been delete.');
User.deleteLike(2);

//deleteUser
//if success, console.log('the userId 1 has been deleted by admin.');
admin.deleteUser(1);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: