From 7e0b3b9682e7761092f5b1adf4f263dd5170f27c Mon Sep 17 00:00:00 2001 From: liuchen <2468216537@qq.com> Date: Tue, 12 Nov 2024 22:39:42 +0800 Subject: [PATCH] complete rightclick menu --- .../src/components/ContentBase.vue | 4 +- .../src/components/ContentShow.vue | 72 -------- .../src/components/FileFiled.vue | 92 ++++++++++ .../src/components/FileTitle.vue | 43 +++++ .../src/components/FolderFiled.vue | 91 ++++++++++ coeditor_frontend/src/components/NavBar.vue | 37 +++- .../src/components/RightMenu.vue | 130 ++++++++++++++ coeditor_frontend/src/router/index.js | 30 +++- coeditor_frontend/src/store/user.js | 59 ++++++- coeditor_frontend/src/views/HomeView.vue | 163 ++++++++++++++++-- coeditor_frontend/src/views/LoginView.vue | 73 ++++++++ coeditor_frontend/src/views/NotFoundView.vue | 19 ++ coeditor_frontend/src/views/RegisterView.vue | 96 +++++++++++ .../src/views/UserProfileView.vue | 29 ++++ 14 files changed, 842 insertions(+), 96 deletions(-) delete mode 100644 coeditor_frontend/src/components/ContentShow.vue create mode 100644 coeditor_frontend/src/components/FileFiled.vue create mode 100644 coeditor_frontend/src/components/FileTitle.vue create mode 100644 coeditor_frontend/src/components/FolderFiled.vue create mode 100644 coeditor_frontend/src/components/RightMenu.vue create mode 100644 coeditor_frontend/src/views/LoginView.vue create mode 100644 coeditor_frontend/src/views/NotFoundView.vue create mode 100644 coeditor_frontend/src/views/RegisterView.vue create mode 100644 coeditor_frontend/src/views/UserProfileView.vue diff --git a/coeditor_frontend/src/components/ContentBase.vue b/coeditor_frontend/src/components/ContentBase.vue index 179a7f8..277781e 100644 --- a/coeditor_frontend/src/components/ContentBase.vue +++ b/coeditor_frontend/src/components/ContentBase.vue @@ -1,12 +1,10 @@ diff --git a/coeditor_frontend/src/components/ContentShow.vue b/coeditor_frontend/src/components/ContentShow.vue deleted file mode 100644 index 359ad31..0000000 --- a/coeditor_frontend/src/components/ContentShow.vue +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - diff --git a/coeditor_frontend/src/components/FileFiled.vue b/coeditor_frontend/src/components/FileFiled.vue new file mode 100644 index 0000000..1fadfe9 --- /dev/null +++ b/coeditor_frontend/src/components/FileFiled.vue @@ -0,0 +1,92 @@ + + + + + + diff --git a/coeditor_frontend/src/components/FileTitle.vue b/coeditor_frontend/src/components/FileTitle.vue new file mode 100644 index 0000000..4f0ee8f --- /dev/null +++ b/coeditor_frontend/src/components/FileTitle.vue @@ -0,0 +1,43 @@ + + + + + + diff --git a/coeditor_frontend/src/components/FolderFiled.vue b/coeditor_frontend/src/components/FolderFiled.vue new file mode 100644 index 0000000..67052cb --- /dev/null +++ b/coeditor_frontend/src/components/FolderFiled.vue @@ -0,0 +1,91 @@ + + + + + + diff --git a/coeditor_frontend/src/components/NavBar.vue b/coeditor_frontend/src/components/NavBar.vue index 88998df..471252e 100644 --- a/coeditor_frontend/src/components/NavBar.vue +++ b/coeditor_frontend/src/components/NavBar.vue @@ -1,5 +1,5 @@ diff --git a/coeditor_frontend/src/components/RightMenu.vue b/coeditor_frontend/src/components/RightMenu.vue new file mode 100644 index 0000000..33be347 --- /dev/null +++ b/coeditor_frontend/src/components/RightMenu.vue @@ -0,0 +1,130 @@ + + + + + + diff --git a/coeditor_frontend/src/router/index.js b/coeditor_frontend/src/router/index.js index 6b37cae..20c137c 100644 --- a/coeditor_frontend/src/router/index.js +++ b/coeditor_frontend/src/router/index.js @@ -1,11 +1,39 @@ import { createRouter, createWebHistory } from 'vue-router' import HomeView from '../views/HomeView.vue' +import LoginView from '../views/LoginView' +import RegisterView from '../views/RegisterView' +import NotFoundView from '../views/NotFoundView' +import UserProfileView from '../views/UserProfileView' const routes = [ { path: '/', name: 'home', - component: HomeView + component: HomeView, + }, + { + path: '/login/', + name: 'login', + component: LoginView, + }, + { + path: '/register/', + name: 'register', + component: RegisterView, + }, + { + path: '/userprofile/', + name:'userprofile', + component:UserProfileView, + }, + { + path: '/404/', + name: '404', + component: NotFoundView + }, + { + path: '/:catchAll(.*)', + redirect: '/404/', } ] diff --git a/coeditor_frontend/src/store/user.js b/coeditor_frontend/src/store/user.js index 1a62814..a96e356 100644 --- a/coeditor_frontend/src/store/user.js +++ b/coeditor_frontend/src/store/user.js @@ -1,20 +1,71 @@ -// import $ from 'jquery'; -// import { jwtDecode } from 'jwt-decode'; +import $ from 'jquery'; const ModulerUser = { state: { - id:'', username:'', - photo:'', access: "", refresh: "", is_login: false, + path:['~/users/'], }, getters: { }, mutations: { + updateUser(state,user){ + state.username = user.username, + state.access = user.access, + state.refresh = user.refresh, + state.is_login = user.is_login; + }, + logout(state){ + state.username = '', + state.access = "", + state.refresh = "", + state.is_login = false, + state.path = ['~/users/'] + }, + forwardPath(state,item){ + state.path.push(item); + }, + backPath(state){ + state.path.pop(); + } }, actions: { + login(context,data){ + $.ajax({ + url:'http://47.106.113.194:8000/token/', + type:'POST', + data:{ + username:data.username, + password:data.password, + }, + success:resp => { + const {access,refresh} = resp; + $.ajax({ + url:' http://47.106.113.194:8000/getinfo/', + type:'GET', + headers:{ + 'Authorization': "Bearer " + access, + }, + success(resp){ + context.commit('updateUser',{ + ...resp, + access:access, + refresh:refresh, + is_login: true, + }); + context.commit('forwardPath',resp.username + '/' + ); + data.success(); + } + }); + }, + error(){ + data.error(); + } + }); + } }, modules: { } diff --git a/coeditor_frontend/src/views/HomeView.vue b/coeditor_frontend/src/views/HomeView.vue index c7ad895..8fee7cc 100644 --- a/coeditor_frontend/src/views/HomeView.vue +++ b/coeditor_frontend/src/views/HomeView.vue @@ -1,49 +1,149 @@ + + + diff --git a/coeditor_frontend/src/views/NotFoundView.vue b/coeditor_frontend/src/views/NotFoundView.vue new file mode 100644 index 0000000..0345dc9 --- /dev/null +++ b/coeditor_frontend/src/views/NotFoundView.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/coeditor_frontend/src/views/RegisterView.vue b/coeditor_frontend/src/views/RegisterView.vue new file mode 100644 index 0000000..05e1446 --- /dev/null +++ b/coeditor_frontend/src/views/RegisterView.vue @@ -0,0 +1,96 @@ + + + + + + diff --git a/coeditor_frontend/src/views/UserProfileView.vue b/coeditor_frontend/src/views/UserProfileView.vue new file mode 100644 index 0000000..f28f42b --- /dev/null +++ b/coeditor_frontend/src/views/UserProfileView.vue @@ -0,0 +1,29 @@ + + + + + +