5.查看资料和修改资料,发送私信

118 阅读1分钟

查看资料

通过api/userInfo/:username获取数据 查看自己和其他人的数据是不一样的 查看自己的有修改功能 查看他人则没有修改功能,但增加了留言
判断是否是自己的方法:username是否等于this.$router.params.username

修改资料

post就好了.

this.$api.post('users/user/changeInfo',data).then(res=>{
                if(res.code===0){
                    this.$Notice.info({
                        title:'提示',
                        desc:res.message
                    })
                }
            })

获取私信:

获取私信列表 通过api.get users/user/mailsGet 获取到mail数组里,这个mail的存放方式是m_id,users[0].users[1],存了信息的id,发送方接收方, 获取私信详细内容: 路由/mailGetter/:id 详细内容:传进来的参数有id 根据id获取私信,用this.$api.get('users/user/mailGetter'+id). 返回得到mail.
mail里保存了 对话的内容,时间,对象

发送对话&&留言功能

调用api

 this.$api.post('users/user/mail/'+this.userInfo.username,sendData).then(res=>{
                
                if(res.code===0){
                    this.textMail=''
                    this.$Notice.success({
                        title:'已发送留言',
                        desc:res.message
                    })
                   

                }else{
                    this.$Notice.info({
                        title:'提示',
                        desc:res.message
                    })
                }
            })

这个是留言功能,也可以是发送对话,都一样的