Browse Source

修复更换头像失败的bug

master
xie.bx 2 years ago
parent
commit
3e1cdd9032
  1. 2
      im-ui/.env.development
  2. 1
      im-ui/src/components/common/HeadImage.vue
  3. 9
      im-ui/src/components/setting/Setting.vue
  4. 6
      im-ui/src/view/Group.vue
  5. 28
      im-ui/src/view/Login.vue
  6. 6
      im-ui/src/view/Register.vue
  7. 2
      im-uniapp/components/chat-message-item/chat-message-item.vue

2
im-ui/.env.development

@ -2,7 +2,7 @@
ENV = 'development' ENV = 'development'
# app名称 # app名称
VUE_APP_NAME = "盒子IM" VUE_APP_NAME = "盒子IM"
// 接口请求地址 # 接口请求地址
VUE_APP_BASE_API = '/api' VUE_APP_BASE_API = '/api'
# ws地址 # ws地址
VUE_APP_WS_URL = 'ws://localhost:8878/im' VUE_APP_WS_URL = 'ws://localhost:8878/im'

1
im-ui/src/components/common/HeadImage.vue

@ -41,7 +41,6 @@
}, },
methods:{ methods:{
showUserInfo(e){ showUserInfo(e){
console.log(this.id)
if(this.id && this.id>0){ if(this.id && this.id>0){
this.$http({ this.$http({
url: `/user/find/${this.id}`, url: `/user/find/${this.id}`,

9
im-ui/src/components/setting/Setting.vue

@ -7,7 +7,6 @@
:showLoading="true" :showLoading="true"
:maxSize="maxSize" :maxSize="maxSize"
@success="onUploadSuccess" @success="onUploadSuccess"
:fileTypes="['image/jpeg', 'image/png', 'image/jpg','image/webp']"> :fileTypes="['image/jpeg', 'image/png', 'image/jpg','image/webp']">
<img v-if="userInfo.headImage" :src="userInfo.headImage" class="avatar"> <img v-if="userInfo.headImage" :src="userInfo.headImage" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i> <i v-else class="el-icon-plus avatar-uploader-icon"></i>
@ -38,13 +37,11 @@
</template> </template>
<script> <script>
import HeadImage from "../common/HeadImage.vue";
import FileUpload from "../common/FileUpload.vue"; import FileUpload from "../common/FileUpload.vue";
export default { export default {
name: "setting", name: "setting",
components: { components: {
HeadImage,
FileUpload FileUpload
}, },
data() { data() {
@ -84,9 +81,9 @@
}) })
}); });
}, },
onUploadSuccess(res, file) { onUploadSuccess(data, file) {
this.userInfo.headImage = res.data.originUrl; this.userInfo.headImage = data.originUrl;
this.userInfo.headImageThumb = res.data.thumbUrl; this.userInfo.headImageThumb = data.thumbUrl;
} }
}, },
props: { props: {

6
im-ui/src/view/Group.vue

@ -158,9 +158,9 @@
onCloseAddGroupMember() { onCloseAddGroupMember() {
this.showAddGroupMember = false; this.showAddGroupMember = false;
}, },
onUploadSuccess(res) { onUploadSuccess(data) {
this.activeGroup.headImage = res.data.originUrl; this.activeGroup.headImage =data.originUrl;
this.activeGroup.headImageThumb = res.data.thumbUrl; this.activeGroup.headImageThumb = data.thumbUrl;
}, },
onSaveGroup() { onSaveGroup() {
this.$refs['groupForm'].validate((valid) => { this.$refs['groupForm'].validate((valid) => {

28
im-ui/src/view/Login.vue

@ -1,5 +1,6 @@
<template> <template>
<div class="login-view"> <div class="login-view">
<div class="login-content">
<div class="login-intro"> <div class="login-intro">
<div> <div>
<h3>盒子IM 2.0版本正式发布</h3> <h3>盒子IM 2.0版本正式发布</h3>
@ -47,11 +48,13 @@
<el-input type="terminal" v-model="loginForm.terminal" autocomplete="off"></el-input> <el-input type="terminal" v-model="loginForm.terminal" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="用户名" prop="userName"> <el-form-item label="用户名" prop="userName">
<el-input type="userName" v-model="loginForm.userName" autocomplete="off" placeholder="用户名"></el-input> <el-input type="userName" v-model="loginForm.userName" autocomplete="off"
placeholder="用户名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码" prop="password"> <el-form-item label="密码" prop="password">
<el-input type="password" v-model="loginForm.password" autocomplete="off" placeholder="密码"></el-input> <el-input type="password" v-model="loginForm.password" autocomplete="off"
placeholder="密码"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="submitForm('loginForm')">登陆</el-button> <el-button type="primary" @click="submitForm('loginForm')">登陆</el-button>
@ -61,13 +64,19 @@
<router-link to="/register">没有账号,前往注册</router-link> <router-link to="/register">没有账号,前往注册</router-link>
</div> </div>
</el-form> </el-form>
</div> </div>
<icp></icp>
</div>
</template> </template>
<script> <script>
import Icp from '../components/common/Icp.vue'
export default { export default {
name: "login", name: "login",
components: {
Icp
},
data() { data() {
var checkUsername = (rule, value, callback) => { var checkUsername = (rule, value, callback) => {
if (!value) { if (!value) {
@ -162,21 +171,25 @@
<style scoped lang="scss"> <style scoped lang="scss">
.login-view { .login-view {
position: relative;
display: flex;
justify-content: space-around;
align-items: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgb(232, 242, 255); background: rgb(232, 242, 255);
background-size: cover; background-size: cover;
box-sizing: border-box; box-sizing: border-box;
.login-content {
position: relative;
display: flex;
justify-content: space-around;
align-items: center;
padding: 10%; padding: 10%;
.login-intro { .login-intro {
flex: 1; flex: 1;
padding: 40px; padding: 40px;
max-width: 600px; max-width: 600px;
.login-title { .login-title {
text-align: center; text-align: center;
font-weight: 600; font-weight: 600;
@ -223,4 +236,5 @@
} }
} }
} }
}
</style> </style>

6
im-ui/src/view/Register.vue

@ -1,7 +1,6 @@
<template> <template>
<el-container class="register-view"> <el-container class="register-view">
<div> <div>
<el-form :model="registerForm" status-icon :rules="rules" ref="registerForm" label-width="80px" class="web-ruleForm"> <el-form :model="registerForm" status-icon :rules="rules" ref="registerForm" label-width="80px" class="web-ruleForm">
<div class="register-brand">欢迎成为盒子IM的用户</div> <div class="register-brand">欢迎成为盒子IM的用户</div>
<el-form-item label="用户名" prop="userName"> <el-form-item label="用户名" prop="userName">
@ -25,12 +24,17 @@
</div> </div>
</el-form> </el-form>
</div> </div>
<icp></icp>
</el-container> </el-container>
</template> </template>
<script> <script>
import Icp from '../components/common/Icp.vue'
export default { export default {
name: "login", name: "login",
components: {
Icp
},
data() { data() {
var checkUserName = (rule, value, callback) => { var checkUserName = (rule, value, callback) => {
if (!value) { if (!value) {

2
im-uniapp/components/chat-message-item/chat-message-item.vue

@ -7,7 +7,7 @@
<view class="chat-msg-normal" v-if="msgInfo.type>=0 && msgInfo.type<10" <view class="chat-msg-normal" v-if="msgInfo.type>=0 && msgInfo.type<10"
:class="{'chat-msg-mine':msgInfo.selfSend}"> :class="{'chat-msg-mine':msgInfo.selfSend}">
<head-image class="avatar" @longpress="$emit('longPressHead')" :id="msgInfo.sendId" :url="headImage" :name="showName" :size="80"></head-image> <head-image class="avatar" @longpress.prevent="$emit('longPressHead')" :id="msgInfo.sendId" :url="headImage" :name="showName" :size="80"></head-image>
<view class="chat-msg-content" @longpress="onShowMenu($event)"> <view class="chat-msg-content" @longpress="onShowMenu($event)">
<view v-if="msgInfo.groupId && !msgInfo.selfSend" class="chat-msg-top"> <view v-if="msgInfo.groupId && !msgInfo.selfSend" class="chat-msg-top">
<text>{{showName}}</text> <text>{{showName}}</text>

Loading…
Cancel
Save