From 5e42046c5c15b7a4bc2d0b4bbc0a5d86db2e2ef8 Mon Sep 17 00:00:00 2001 From: Unique-Jerry <10902054+unique-jerry@user.noreply.gitee.com> Date: Fri, 20 Oct 2023 13:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=88=97=E8=A1=A8=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/question.js | 11 +++ src/api/user.js | 19 +++-- src/assets/login_title.png | Bin 0 -> 2929 bytes src/assets/main.scss | 20 +++++ src/components/PageContainer.vue | 34 ++++++++ src/main.js | 5 +- src/router/index.js | 18 +++- src/stores/index.js | 4 +- src/stores/modules/companyStore.js | 28 +++++++ src/stores/modules/userStore.js | 57 +++++++------ src/views/layout/LayoutContainer.vue | 67 ++++++++++----- src/views/login/LoginPage.vue | 4 +- src/views/question/QuestionManager.vue | 43 ++++++++++ src/views/question/QuestionTypePage.vue | 77 ++++++++++++++++++ .../question/components/QuestionTypeEdit.vue | 67 +++++++++++++++ 15 files changed, 394 insertions(+), 60 deletions(-) create mode 100644 src/api/question.js create mode 100644 src/assets/login_title.png create mode 100644 src/assets/main.scss create mode 100644 src/components/PageContainer.vue create mode 100644 src/stores/modules/companyStore.js create mode 100644 src/views/question/QuestionManager.vue create mode 100644 src/views/question/QuestionTypePage.vue create mode 100644 src/views/question/components/QuestionTypeEdit.vue diff --git a/src/api/question.js b/src/api/question.js new file mode 100644 index 0000000..4af1e91 --- /dev/null +++ b/src/api/question.js @@ -0,0 +1,11 @@ +import requset from '@/utils/request' + +export const useGetTypeList = (encoding) => + requset.get('question/get_typeList', { + params: { + encoding: encoding + } + }) + +export const useAddTypeName = (typeName, encoding, userId) => + requset.post('question/add_typeName', { typeName, encoding, userId }) diff --git a/src/api/user.js b/src/api/user.js index 5909375..6927216 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -1,8 +1,15 @@ -import request from "@/utils/request.js" +import request from '@/utils/request.js' -export const adminLogin=({phone,encoding,password})=>request.post("admin/login",{ +export const adminLogin = ({ phone, encoding, password }) => + request.post('admin/login', { + phone, + encoding, + password + }) - phone, - encoding, - password -}) \ No newline at end of file +export const useGetUserInfo = (token) => + request.get('admin/get_userInfo', { + params: { + token: token + } + }) diff --git a/src/assets/login_title.png b/src/assets/login_title.png new file mode 100644 index 0000000000000000000000000000000000000000..da720dbd022b1c0018bd6cbfc8a883c2bb37ec38 GIT binary patch literal 2929 zcmaJ@X;@Ne8$RJ~xl)Pdf}{y5g193Zh--iz;f_sdDD)t;>ZjtK%mfqs8E+EatPInN~Xjg?WN)X zKx|i-k3Y+wJ~6hK4yGV^F=1x%mViiwL%&z;@e0acrzeAd1Q&L)lT0(M&Ac2KHGOE81@yqhQd_ z5LSc@?4P3iNghxljX{N)8JQ!4(dHIV3o9dIGYbn-3qvRdZES`@o1je4NQ?>A6pb~- zK)*aNQ8otU2-eHq@k=gIWCIIjvFKP7DlRV0D9*%)#t1WKhX08pDT1i~QO} zk5C$m#tfy=p+w^6u0i4Z!lEg(I40sVheX1|@!p_W*Xl7!G`O3AY1;<2Dqgh|Mlz+LV-{o%DA&M@_Y)@r` z#ZoDb3|bWQ^R=;I->=2^yLw-^l<(Jq`7ReFDh9PN-2WQ(*CUaGHn!iaD+<1upBgQ4 zJVRt{T4*mB0HmI|*b{u%k6s@j#s2K5_@*}))v*5z4?is)Iod7|ac zy^1V1MHc91-;1ekXyZg*_X2|tQXS{B^gd|1V>lnnR<8@n1*4}6KCSExe0bwUIlC=< z_4Np@@>rXfpz(NHfEg{Kbb!-^u2<$)kF3#*XX~!jFN2M9&&wMSwNi1`Ipr}t1#mJJ zfENwuKHfdp`o@mzFfexhR^zp{wLI>;-uj8F2{tFXbPhX2JTv2mK8ZB70uo&}mwf`Q zmX)GZ056b-2^hUI0DP!)0Nh{8o1`=hI>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&+f*o-_F{)QquCDRW$opuO-Z*MKfYP}A&)yRWB7R3 zgWeW1T-NJzwaH>+jU#Azg3O%1Pq5BT*7dm8QWO__ZeD+KS>|P(Uv( zT$`5tkPYoSa2n&8i;$_;+SKd>H))bbq)lop3xuO3WpaHh*)yZ1?}{${0#C?$w67?u ziGVfFTga`feEcwAr4ivtLjG`YVL&!3ZQQKCtnfw9+Xid6M%UFby1o+$w{5@c)y)Tw z^f|J-&ER7a{D6KYC_Fmn4YDf*|5s%5^8GH73zwl&$bySnI;??%F3a0Q(2cX| zrN5~u3brhl&QI8KYqz}`t1_tJo(vFvsEaMJ4Uj6B32LfVauNu8O(dvgscK1mSzunr zyC<9QS|jgkH8*| z!=OCBRGu`NQJdJK$_Pc+kX?|Roc#&A_Q?%uPN@AgZT!bz7Jv1G&frMjTt#H%x;&x# zig6UOepCI&P00f0m3*7zx%fdxz?U!iO6Gn(XBBt$t);ExO{I5mInC zZ-B6i7p>1KXfl&r62*?DMx>4?NDn{mj4%cK3f?}IMqM}IyvZKBkbWa)j&PpG8&k`w ztAmileWVZrc7w^`X~e7^=j(u-oF=>`_uZ$TcB5wc)BXCLuHD))eN*AwPar4as3z9( zsDZv=$r9z(C%|)O^7Mmg#irwsI|qNpb2nG1%ht%Ob+wn5)Ggo5y_dIEj=0^%)Um8c zJ@s}*;$;Fb(3hL#E6GQW{{ZY)bCkSc>5qHoW-@Uv-sizWm5t%B3jW!tKF9(7l}E+7 z>SlaZdJ%CR+Z2aaQO;b~kNHTY>lMSsOdI)}2JaWdY1_J&H?dIA_w{W#^&)=oe^j^7E%q5qb3MT7SNp3@*DmxQ#DYUlki)G9+6$xU0E-{5`jer>7 X$Lk0@vAEK<@e}Og;AUTCcR1xg08r +defineProps({ + title: { + required: true, + type: String + } +}) + + + + + diff --git a/src/main.js b/src/main.js index 94fda1e..7b23c2c 100644 --- a/src/main.js +++ b/src/main.js @@ -1,10 +1,9 @@ - import { createApp } from 'vue' -import pinia from "@/stores"; +import pinia from '@/stores' import App from './App.vue' import router from './router' - +import './assets/main.scss' const app = createApp(App) app.use(pinia) diff --git a/src/router/index.js b/src/router/index.js index 71c5112..7dd44a5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,11 +1,25 @@ import { createRouter, createWebHistory } from 'vue-router' -import { useUserStore } from "@/stores"; +import { useUserStore } from '@/stores' const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: [ { path: '/login', component: () => import('@/views/login/LoginPage.vue') }, - { path: '/', component: () => import('@/views/layout/LayoutContainer.vue') } + { + path: '/', + component: () => import('@/views/layout/LayoutContainer.vue'), + + children: [ + { + path: '/question/type', + component: () => import('@/views/question/QuestionTypePage.vue') + }, + { + path: '/question/manager', + component: () => import('@/views/question/QuestionManager.vue') + } + ] + } ] }) router.beforeEach((to) => { diff --git a/src/stores/index.js b/src/stores/index.js index 4eb507d..e87bc2c 100644 --- a/src/stores/index.js +++ b/src/stores/index.js @@ -6,5 +6,5 @@ pinia.use(persist) export default pinia - -export * from "@/stores/modules/userStore.js" \ No newline at end of file +export * from '@/stores/modules/userStore.js' +export * from '@/stores/modules/companyStore.js' diff --git a/src/stores/modules/companyStore.js b/src/stores/modules/companyStore.js new file mode 100644 index 0000000..7b989b9 --- /dev/null +++ b/src/stores/modules/companyStore.js @@ -0,0 +1,28 @@ +import { defineStore } from 'pinia' +import { ref } from 'vue' + +export const useCompanyStore = defineStore( + 'interviewer-company', + () => { + const encoding = ref('') + + const setEncoding = (newEncoding) => { + encoding.value = newEncoding + } + + const removeEncoding = () => { + encoding.value = '' + } + + return { + encoding, + setEncoding, + removeEncoding + } + }, + { + persist: { + paths: ['encoding'] + } + } +) diff --git a/src/stores/modules/userStore.js b/src/stores/modules/userStore.js index 7f83b37..8042947 100644 --- a/src/stores/modules/userStore.js +++ b/src/stores/modules/userStore.js @@ -1,30 +1,39 @@ -import { defineStore } from "pinia" -import { ref } from "vue"; +import { defineStore } from 'pinia' +import { ref } from 'vue' +export const useUserStore = defineStore( + 'interviewer-user', + () => { + const token = ref('') -export const useUserStore=defineStore('interviewer-user',()=>{ + const setToken = (newToken) => { + token.value = newToken + } + const removeToken = () => { + token.value = '' + } - const token = ref('') + const userInfo = ref({}) - const setToken = (newToken) => { - token.value = newToken + const setUserInfo = (newUserInfo) => { + userInfo.value = newUserInfo + } + const removeUserInfo = () => { + userInfo.value = {} + } + return { + token, + setToken, + removeToken, + userInfo, + setUserInfo, + removeUserInfo + } + }, + { + persist: { + paths: ['token', 'userInfo'] + } } - - const removeToken = () => { - token.value = '' - } - - - return { - - token, - setToken, - removeToken - - } -},{ - persist: { - paths: ['token'] - } -}) \ No newline at end of file +) diff --git a/src/views/layout/LayoutContainer.vue b/src/views/layout/LayoutContainer.vue index 1d0ebfd..80bd71c 100644 --- a/src/views/layout/LayoutContainer.vue +++ b/src/views/layout/LayoutContainer.vue @@ -1,15 +1,25 @@ @@ -92,7 +115,7 @@ import avatar from '@/assets/default.png' background-color: #232323; &__logo { height: 120px; - background: url('@/assets/logo.png') no-repeat center / 120px auto; + background: url('@/assets/login_title.png') no-repeat center / 120px auto; } .el-menu { border-right: none; diff --git a/src/views/login/LoginPage.vue b/src/views/login/LoginPage.vue index 308424b..0e64acd 100644 --- a/src/views/login/LoginPage.vue +++ b/src/views/login/LoginPage.vue @@ -2,7 +2,7 @@ import { Lock, User } from '@element-plus/icons-vue' import { ref } from 'vue' import { adminLogin } from '@/api/user.js' -import { useUserStore } from '@/stores' +import { useUserStore, useCompanyStore } from '@/stores' import { useRouter } from 'vue-router' const form = ref() @@ -37,11 +37,13 @@ const rules = { const userStore = useUserStore() const router = useRouter() +const companyStore = useCompanyStore() const goLogin = async () => { await form.value.validate() const res = await adminLogin(formModel.value) console.log(res) userStore.setToken(res.data.data.token) + companyStore.setEncoding(res.data.data.encoding) ElMessage.success('登录成功') router.push('/') } diff --git a/src/views/question/QuestionManager.vue b/src/views/question/QuestionManager.vue new file mode 100644 index 0000000..6b1afa6 --- /dev/null +++ b/src/views/question/QuestionManager.vue @@ -0,0 +1,43 @@ + + + diff --git a/src/views/question/QuestionTypePage.vue b/src/views/question/QuestionTypePage.vue new file mode 100644 index 0000000..497ad1c --- /dev/null +++ b/src/views/question/QuestionTypePage.vue @@ -0,0 +1,77 @@ + + + diff --git a/src/views/question/components/QuestionTypeEdit.vue b/src/views/question/components/QuestionTypeEdit.vue new file mode 100644 index 0000000..6d4699b --- /dev/null +++ b/src/views/question/components/QuestionTypeEdit.vue @@ -0,0 +1,67 @@ + + +