From dbfdb7fc1cc403c54a7cc3d8b5cd9d6f597ae306 Mon Sep 17 00:00:00 2001 From: liu guang bo Date: Wed, 3 Jul 2024 20:34:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=AA=E4=BA=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module/module.js | 41 +++++++++++- core/routes/index.js | 4 +- yunyou_pavilion/src/App.vue | 1 + yunyou_pavilion/src/components/MyUser.vue | 64 +++++++++---------- .../components/MymyAttention/Attention.vue | 4 +- yunyou_pavilion/src/main.js | 1 - yunyou_pavilion/src/router/index.js | 2 +- yunyou_pavilion/src/views/My.vue | 32 +++++----- .../PersonalInformation.vue | 21 +++--- yunyou_pavilion/src/views/myserver/user.js | 8 +++ 10 files changed, 115 insertions(+), 63 deletions(-) create mode 100644 yunyou_pavilion/src/views/myserver/user.js diff --git a/core/module/module.js b/core/module/module.js index 58f14d1..8f40a98 100644 --- a/core/module/module.js +++ b/core/module/module.js @@ -1,13 +1,50 @@ const mongoose = require('./db') const UserSchema = new mongoose.Schema({ - username: String, //用户名字 - password: String, //用户密码 + username: { + type: String, + default: 'aa' + }, //用户名字 + password: { + type: String, + default: '' + }, //用户密码 phone: String, //手机号 + usersex:{ + type:String, + default:'未知' + }, + personalizedLabel: { + type: String, + default: '这个人很懒,什么都没留下~' + },//个性签名 create_time: String, //创建时间 update_time: String, //更新时间 + avatar: { + type: String, + default: 'https://picsum.photos/id/23/200/300' + }, //用户头像 + level: { + type: Number, + default: 1 + },//用户等级 + goldCoins: { + type: Number, + default: 0 + },//金币 + }) +const attention=new mongoose.Schema({ + userId:{ //w + type:mongoose.Types.ObjectId, + ref:'user' + }, + attentionId:{ //t + type:mongoose.Types.ObjectId, + ref:'user' + } +}) const UserModel = mongoose.model('user', UserSchema, 'user') diff --git a/core/routes/index.js b/core/routes/index.js index 1fd5a47..da3633b 100644 --- a/core/routes/index.js +++ b/core/routes/index.js @@ -72,6 +72,7 @@ router.post('/sendCode', (req, res) => { // 根据id获取用户信息 router.get('/getUserInfo', async (req, res) => { let { id } = req.query + console.log(id) let user = await UserModel.find({ _id: id }) res.send({ code: 200, @@ -123,7 +124,8 @@ router.post('/login', async (req, res) => { if (user.length !== 0) { res.send({ code: 200, - msg: '登录成功', + msg: '登录成功', + user_id: user[0]._id, accessToken: accessToken({ phone: phone }), refreshToken: refreshToken({ phone: phone }) }) diff --git a/yunyou_pavilion/src/App.vue b/yunyou_pavilion/src/App.vue index 66c900e..df48f46 100644 --- a/yunyou_pavilion/src/App.vue +++ b/yunyou_pavilion/src/App.vue @@ -5,6 +5,7 @@