diff --git a/im-platform/src/main/java/com/bx/implatform/config/MvcConfig.java b/im-platform/src/main/java/com/bx/implatform/config/MvcConfig.java index ccf7192..71561d2 100644 --- a/im-platform/src/main/java/com/bx/implatform/config/MvcConfig.java +++ b/im-platform/src/main/java/com/bx/implatform/config/MvcConfig.java @@ -17,7 +17,7 @@ public class MvcConfig implements WebMvcConfigurer { public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(authInterceptor()) .addPathPatterns("/**") - .excludePathPatterns( "/image/upload","/login","/logout","/register","/refreshToken", + .excludePathPatterns("/login","/logout","/register","/refreshToken", "/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**"); } diff --git a/im-platform/src/main/java/com/bx/implatform/service/impl/SecurityUserDetailsServiceImpl.java b/im-platform/src/main/java/com/bx/implatform/service/impl/SecurityUserDetailsServiceImpl.java deleted file mode 100644 index 053e254..0000000 --- a/im-platform/src/main/java/com/bx/implatform/service/impl/SecurityUserDetailsServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.bx.implatform.service.impl; - - -import com.alibaba.fastjson.JSON; -import com.bx.implatform.entity.User; -import com.bx.implatform.service.IUserService; -import com.bx.implatform.session.UserSession; -import com.bx.implatform.util.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; - -@Service -public class SecurityUserDetailsServiceImpl implements UserDetailsService { - - @Autowired - private IUserService userService; - - /** - * 加载用户数据,用户登录时,由spring security调用 - * - * @param username 用户名 - * @throws UsernameNotFoundException 用户不存在时抛出 - * @return - */ - @Override - public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { - User user = userService.findUserByName(username); - if(user == null) { - throw new UsernameNotFoundException("用户不存在"); - } - //定义权限列表. - List authorities = new ArrayList(); - // 用户可以访问的资源名称(或者说用户所拥有的权限) 注意:必须"ROLE_"开头 - authorities.add(new SimpleGrantedAuthority("ROLE_XX")); - - UserSession session = BeanUtils.copyProperties(user,UserSession.class); - String strJson = JSON.toJSONString(session); - UserDetails userDetails = new org.springframework.security.core.userdetails.User(strJson,user.getPassword(),authorities); - return userDetails; - } -} diff --git a/im-ui/src/components/common/FileUpload.vue b/im-ui/src/components/common/FileUpload.vue index 55ab801..e3bd406 100644 --- a/im-ui/src/components/common/FileUpload.vue +++ b/im-ui/src/components/common/FileUpload.vue @@ -1,11 +1,6 @@ @@ -15,7 +10,8 @@ name: "fileUpload", data() { return { - loading: null + loading: null, + uploadHeaders: {"accessToken":sessionStorage.getItem('accessToken')} } }, props: { @@ -45,17 +41,17 @@ this.loading && this.loading.close(); if (res.code == 200) { this.$emit("success", res, file); - }else{ + } else { this.$message.error(res.message); this.$emit("fail", res, file); } }, - handleError(err,file){ + handleError(err, file) { this.$emit("fail", err, file); }, beforeUpload(file) { // 校验文件类型 - if(this.fileTypes && this.fileTypes.length > 0){ + if (this.fileTypes && this.fileTypes.length > 0) { let fileType = file.type; let t = this.fileTypes.find((t) => t.toLowerCase() === fileType); if (t === undefined) { @@ -80,6 +76,8 @@ this.$emit("before", file); return true; } + + }, computed: { fileSizeStr() { diff --git a/im-ui/src/store/friendStore.js b/im-ui/src/store/friendStore.js index 3377c25..0a3ff74 100644 --- a/im-ui/src/store/friendStore.js +++ b/im-ui/src/store/friendStore.js @@ -25,7 +25,9 @@ export default { state.friends.forEach((f,index)=>{ if(f.id==friend.id){ // 拷贝属性 + let online = state.friends[index].online; Object.assign(state.friends[index], friend); + state.friends[index].online =online; } }) }, @@ -43,6 +45,7 @@ export default { }, refreshOnlineStatus(state){ let userIds = []; + console.log("refreshOnlineStatus") if(state.friends.length ==0){ return; } @@ -62,6 +65,7 @@ export default { },30000) }, setOnlineStatus(state,onlineIds){ + console.log("setOnlineStatus") state.friends.forEach((f)=>{ let onlineFriend = onlineIds.find((id)=> f.id==id); f.online = onlineFriend != undefined;