diff --git a/Front/vue-unilife/public/images/个人.png b/Front/vue-unilife/public/images/个人.png deleted file mode 100644 index f63e5e8..0000000 Binary files a/Front/vue-unilife/public/images/个人.png and /dev/null differ diff --git a/Front/vue-unilife/public/images/默认头像.jpg b/Front/vue-unilife/public/images/默认头像.jpg deleted file mode 100644 index 11eead7..0000000 Binary files a/Front/vue-unilife/public/images/默认头像.jpg and /dev/null differ diff --git a/Front/vue-unilife/src/components/Personal.vue b/Front/vue-unilife/src/components/Personal.vue deleted file mode 100644 index 081645f..0000000 --- a/Front/vue-unilife/src/components/Personal.vue +++ /dev/null @@ -1,201 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Front/vue-unilife/src/components/Personal/AcountManager.vue b/Front/vue-unilife/src/components/Personal/AcountManager.vue deleted file mode 100644 index 162b2a5..0000000 --- a/Front/vue-unilife/src/components/Personal/AcountManager.vue +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Front/vue-unilife/src/routers.ts b/Front/vue-unilife/src/routers.ts deleted file mode 100644 index 43a18a4..0000000 --- a/Front/vue-unilife/src/routers.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { RouteRecord, RouteRecordRaw } from 'vue-router'; -import { createWebHashHistory, createRouter,createWebHistory } from 'vue-router'; -import LogPage from './components/LogPage.vue'; -import Personal from './components/Personal.vue'; -import Manager from './components/Personal/AcountManager.vue'; - -const routes:Array = [ - { - path:'/log', - name: 'LogPage', - component: LogPage - }, - { - path:'/personal', - name: 'Personal', - component: Personal, - children: [ - { - path:'manager', - name: 'Manager', - component:Manager, - } - ] - } -]; - -const router = createRouter({ - history: createWebHistory(import.meta.env.BASE_URL), - routes -}); - -export default router; diff --git a/unilife-server/src/main/java/com/unilife/config/WebMvcConfig.java b/unilife-server/src/main/java/com/unilife/config/WebMvcConfig.java deleted file mode 100644 index e59ecf6..0000000 --- a/unilife-server/src/main/java/com/unilife/config/WebMvcConfig.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.unilife.config; - -import com.unilife.interceptor.JwtInterceptor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class WebMvcConfig implements WebMvcConfigurer { - @Autowired - private JwtInterceptor jwtInterceptor; - - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(jwtInterceptor).addPathPatterns("/**") - .excludePathPatterns( - "/users/login", - "/users/register", - "/users/code", - "/users/login/code", - "/swagger-resources/**", - "/v2/api-docs/**", - "/doc.html", - "/webjars/**" - ); - } - - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**") - .allowedOriginPatterns("*") // 允许所有来源,生产环境建议限制为特定域名 - .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") - .allowedHeaders("*") - .allowCredentials(true) - .maxAge(3600); - } - -} diff --git a/unilife-server/src/main/java/com/unilife/interceptor/JwtInterceptor.java b/unilife-server/src/main/java/com/unilife/interceptor/JwtInterceptor.java deleted file mode 100644 index 33bcea9..0000000 --- a/unilife-server/src/main/java/com/unilife/interceptor/JwtInterceptor.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.unilife.interceptor; - -import cn.hutool.core.util.StrUtil; -import com.unilife.utils.BaseContext; -import com.unilife.utils.JwtUtil; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.stereotype.Component; -import org.springframework.web.servlet.HandlerInterceptor; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -@Component -@Slf4j -public class JwtInterceptor implements HandlerInterceptor { - @Autowired - private JwtUtil jwtUtil; - - @Autowired - private StringRedisTemplate stringRedisTemplate; - - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - - log.info("JwtInterceptor preHandle"); - String token = request.getHeader("Authorization"); - - if(StrUtil.isBlank(token)){ - response.setStatus(401); - return false; - } - - boolean verified = jwtUtil.verifyToken(token); - if (!verified) { - response.setStatus(401); - return false; - } - - //从token中获取userid并存入threadlocal - Long userId = jwtUtil.getUserIdFromToken(token); - BaseContext.setId(userId); - - - return true; - } - - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { - BaseContext.removeId(); - } -} diff --git a/unilife-server/src/main/java/com/unilife/model/vo/LoginVO.java b/unilife-server/src/main/java/com/unilife/model/vo/LoginVO.java deleted file mode 100644 index fbb63d9..0000000 --- a/unilife-server/src/main/java/com/unilife/model/vo/LoginVO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.unilife.model.vo; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class LoginVO { - private Long id; - private String username; - private String nickname; - private String avatar; - private Byte role; - private Byte isVerified; - private Byte status; - private String token; - private String LoginIp; -} - diff --git a/unilife-server/src/main/java/com/unilife/model/vo/RegisterVO.java b/unilife-server/src/main/java/com/unilife/model/vo/RegisterVO.java deleted file mode 100644 index dfc60ad..0000000 --- a/unilife-server/src/main/java/com/unilife/model/vo/RegisterVO.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.unilife.model.vo; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class RegisterVO { - private Long id; - private String username; - private String nickname; - private String loginIp; -} diff --git a/unilife-server/src/main/java/com/unilife/utils/BaseContext.java b/unilife-server/src/main/java/com/unilife/utils/BaseContext.java deleted file mode 100644 index dbfed21..0000000 --- a/unilife-server/src/main/java/com/unilife/utils/BaseContext.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.unilife.utils; - -public class BaseContext { - - public static ThreadLocal threadLocal = new ThreadLocal<>(); - - public static void setId(Long id) { - threadLocal.set(id); - } - - public static Long getId() { - return threadLocal.get(); - } - - public static void removeId() { - threadLocal.remove(); - } - -} diff --git a/unilife-server/src/main/java/com/unilife/utils/JwtUtil.java b/unilife-server/src/main/java/com/unilife/utils/JwtUtil.java deleted file mode 100644 index 6d3974d..0000000 --- a/unilife-server/src/main/java/com/unilife/utils/JwtUtil.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.unilife.utils; - -import cn.hutool.core.date.DateTime; -import cn.hutool.jwt.JWTUtil; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import java.util.HashMap; -import java.util.Map; - -@Component -public class JwtUtil { - @Value("${jwt.secret}") - private String secret; - - @Value("${jwt.expiration}") - public long expiration; - - public String generateToken(Long id) { - DateTime now = DateTime.now(); - DateTime expireTime = new DateTime(now.getTime() + expiration * 1000); - - Map payload = new HashMap<>(); - payload.put("userId", id); - payload.put("created",now.getTime()); - return JWTUtil.createToken(payload,secret.getBytes()); - } - - public boolean verifyToken(String token) { - try{ - JWTUtil.verify(token,secret.getBytes()); - return true; - }catch (Exception e){ - return false; - } - } - public Long getUserIdFromToken(String token) { - try { - return (Long)JWTUtil.parseToken(token).getPayload("userId"); - }catch (Exception e){ - return null; - } - } - -} diff --git a/.idea/.gitignore b/unilife/.idea/.gitignore similarity index 100% rename from .idea/.gitignore rename to unilife/.idea/.gitignore diff --git a/.idea/ApifoxUploaderProjectSetting.xml b/unilife/.idea/ApifoxUploaderProjectSetting.xml similarity index 100% rename from .idea/ApifoxUploaderProjectSetting.xml rename to unilife/.idea/ApifoxUploaderProjectSetting.xml diff --git a/.idea/compiler.xml b/unilife/.idea/compiler.xml similarity index 100% rename from .idea/compiler.xml rename to unilife/.idea/compiler.xml diff --git a/.idea/dataSources.xml b/unilife/.idea/dataSources.xml similarity index 100% rename from .idea/dataSources.xml rename to unilife/.idea/dataSources.xml diff --git a/.idea/encodings.xml b/unilife/.idea/encodings.xml similarity index 100% rename from .idea/encodings.xml rename to unilife/.idea/encodings.xml diff --git a/.idea/jarRepositories.xml b/unilife/.idea/jarRepositories.xml similarity index 100% rename from .idea/jarRepositories.xml rename to unilife/.idea/jarRepositories.xml diff --git a/.idea/misc.xml b/unilife/.idea/misc.xml similarity index 100% rename from .idea/misc.xml rename to unilife/.idea/misc.xml diff --git a/.idea/modules.xml b/unilife/.idea/modules.xml similarity index 100% rename from .idea/modules.xml rename to unilife/.idea/modules.xml diff --git a/.idea/unilife.iml b/unilife/.idea/unilife.iml similarity index 100% rename from .idea/unilife.iml rename to unilife/.idea/unilife.iml diff --git a/.idea/vcs.xml b/unilife/.idea/vcs.xml similarity index 100% rename from .idea/vcs.xml rename to unilife/.idea/vcs.xml diff --git a/Front/vue-unilife/.gitignore b/unilife/Front/vue-unilife/.gitignore similarity index 100% rename from Front/vue-unilife/.gitignore rename to unilife/Front/vue-unilife/.gitignore diff --git a/Front/vue-unilife/.vscode/extensions.json b/unilife/Front/vue-unilife/.vscode/extensions.json similarity index 100% rename from Front/vue-unilife/.vscode/extensions.json rename to unilife/Front/vue-unilife/.vscode/extensions.json diff --git a/Front/vue-unilife/README.md b/unilife/Front/vue-unilife/README.md similarity index 100% rename from Front/vue-unilife/README.md rename to unilife/Front/vue-unilife/README.md diff --git a/Front/vue-unilife/index.html b/unilife/Front/vue-unilife/index.html similarity index 100% rename from Front/vue-unilife/index.html rename to unilife/Front/vue-unilife/index.html diff --git a/Front/vue-unilife/package.json b/unilife/Front/vue-unilife/package.json similarity index 95% rename from Front/vue-unilife/package.json rename to unilife/Front/vue-unilife/package.json index 6b23c2e..cf6438a 100644 --- a/Front/vue-unilife/package.json +++ b/unilife/Front/vue-unilife/package.json @@ -14,7 +14,6 @@ "element-plus": "^2.9.7", "vee-validate": "^4.15.0", "vue": "^3.5.13", - "vue-router": "^4.5.0", "yup": "^1.6.1" }, "devDependencies": { diff --git a/Front/vue-unilife/pnpm-lock.yaml b/unilife/Front/vue-unilife/pnpm-lock.yaml similarity index 98% rename from Front/vue-unilife/pnpm-lock.yaml rename to unilife/Front/vue-unilife/pnpm-lock.yaml index 9a44cde..9d06602 100644 --- a/Front/vue-unilife/pnpm-lock.yaml +++ b/unilife/Front/vue-unilife/pnpm-lock.yaml @@ -8,9 +8,6 @@ importers: .: dependencies: - '@vue/shared': - specifier: ^3.5.13 - version: 3.5.13 axios: specifier: ^1.8.3 version: 1.8.3 @@ -23,9 +20,6 @@ importers: vue: specifier: ^3.5.13 version: 3.5.13(typescript@5.7.3) - vue-router: - specifier: ^4.5.0 - version: 4.5.0(vue@3.5.13(typescript@5.7.3)) yup: specifier: ^1.6.1 version: 1.6.1 @@ -377,9 +371,6 @@ packages: '@vue/compiler-vue2@2.7.16': resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==} - '@vue/devtools-api@6.6.4': - resolution: {integrity: sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==} - '@vue/devtools-api@7.7.2': resolution: {integrity: sha512-1syn558KhyN+chO5SjlZIwJ8bV/bQ1nOVTG66t2RbG66ZGekyiYNmRO7X9BJCXQqPsFHlnksqvPhce2qpzxFnA==} @@ -742,11 +733,6 @@ packages: '@vue/composition-api': optional: true - vue-router@4.5.0: - resolution: {integrity: sha512-HDuk+PuH5monfNuY+ct49mNmkCRK4xJAV9Ts4z9UFc4rzdDnxQLyCMGGc8pKhZhHTVzfanpNwB/lwqevcBwI4w==} - peerDependencies: - vue: ^3.2.0 - vue-tsc@2.2.8: resolution: {integrity: sha512-jBYKBNFADTN+L+MdesNX/TB3XuDSyaWynKMDgR+yCSln0GQ9Tfb7JS2lr46s2LiFUT1WsmfWsSvIElyxzOPqcQ==} hasBin: true @@ -994,8 +980,6 @@ snapshots: de-indent: 1.0.2 he: 1.2.0 - '@vue/devtools-api@6.6.4': {} - '@vue/devtools-api@7.7.2': dependencies: '@vue/devtools-kit': 7.7.2 @@ -1361,11 +1345,6 @@ snapshots: dependencies: vue: 3.5.13(typescript@5.7.3) - vue-router@4.5.0(vue@3.5.13(typescript@5.7.3)): - dependencies: - '@vue/devtools-api': 6.6.4 - vue: 3.5.13(typescript@5.7.3) - vue-tsc@2.2.8(typescript@5.7.3): dependencies: '@volar/typescript': 2.4.12 diff --git a/Front/vue-unilife/public/images/LogPage1.jpg b/unilife/Front/vue-unilife/public/images/LogPage1.jpg similarity index 100% rename from Front/vue-unilife/public/images/LogPage1.jpg rename to unilife/Front/vue-unilife/public/images/LogPage1.jpg diff --git a/Front/vue-unilife/public/images/LogPage2.jpg b/unilife/Front/vue-unilife/public/images/LogPage2.jpg similarity index 100% rename from Front/vue-unilife/public/images/LogPage2.jpg rename to unilife/Front/vue-unilife/public/images/LogPage2.jpg diff --git a/Front/vue-unilife/public/vite.svg b/unilife/Front/vue-unilife/public/vite.svg similarity index 100% rename from Front/vue-unilife/public/vite.svg rename to unilife/Front/vue-unilife/public/vite.svg diff --git a/Front/vue-unilife/src/App.vue b/unilife/Front/vue-unilife/src/App.vue similarity index 58% rename from Front/vue-unilife/src/App.vue rename to unilife/Front/vue-unilife/src/App.vue index 4d17c70..52b6107 100644 --- a/Front/vue-unilife/src/App.vue +++ b/unilife/Front/vue-unilife/src/App.vue @@ -1,9 +1,10 @@