diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4d654ee..958b913 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,7 +4,7 @@ on: push: branches: - main - + jobs: build-and-deploy: runs-on: ubuntu-latest @@ -14,7 +14,7 @@ jobs: - name: 设置 Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: 登录 Docker Hub uses: docker/login-action@v3 with: @@ -33,10 +33,10 @@ jobs: with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USERNAME }} - key: ${{ secrets.SSH_PASSWORD }} + password: ${{ secrets.SSH_PASSWORD }} port: ${{ secrets.SSH_PORT }} script: | docker pull lihazi/weilai docker stop weilai || true docker rm weilai || true - docker run -d --name weilai -p 80:80 lihazi/weilai + docker run -d --name weilai -p 80:80 lihazi/weilai \ No newline at end of file diff --git a/.gitignore b/.gitignore index a547bf3..eee7d15 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ dist-ssr *.njsproj *.sln *.sw? +#lock-package +pnpm-lock.yaml \ No newline at end of file diff --git a/.husky/_/pre-commit b/.husky/_/pre-commit index d0a7784..16aae78 100755 --- a/.husky/_/pre-commit +++ b/.husky/_/pre-commit @@ -1 +1,2 @@ -npx lint-staged \ No newline at end of file +#!/usr/bin/env sh +. "$(dirname "$0")/h" \ No newline at end of file diff --git a/package.json b/package.json index 104202b..352fff3 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "eslint": "^9.13.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-vue": "^9.29.1", - "husky": "^9.1.6", + "husky": "^9.1.7", "lint-staged": "^15.2.10", "sass-embedded": "^1.80.3", "shadcn-vue": "^0.11.0", diff --git a/src/assets/styles/index.css b/src/assets/styles/index.css new file mode 100644 index 0000000..db3d3d4 --- /dev/null +++ b/src/assets/styles/index.css @@ -0,0 +1,31 @@ +:root { + --background: hsl(0, 0%, 100%); + --foreground: hsl(222.2, 47.4%, 11.2%); + --muted: hsl(210, 40%, 96.1%); + --muted-foreground: hsl(215.4, 16.3%, 46.9%); + --card: hsl(0, 0%, 100%); + --card-foreground: hsl(222.2, 47.4%, 11.2%); + --popover: hsl(0, 0%, 100%); + --popover-foreground: hsl(222.2, 47.4%, 11.2%); + --border: hsl(214.3, 31.8%, 91.4%); + --input: hsl(214.3, 31.8%, 91.4%); + --primary: hsl(200deg, 60%, 94.1%); + --primary-foreground: hsl(200deg, 62.8%, 61%); + --secondary: hsl(240deg, 4.76%, 95.9%); + --secondary-foreground: hsl(206deg, 6.6%, 41.6%); + --accent: hsl(210, 40%, 96.1%); + --accent-foreground: hsl(222.2, 47.4%, 11.2%); + --destructive: hsl(0, 100%, 50%); + --destructive-foreground: hsl(210, 40%, 98%); + --ring: hsl(215, 20.2%, 65.1%); + --radius: 0.5rem; +} + +* { + margin: 0; + padding: 0; +} + +@tailwind base; +@tailwind components; +@tailwind utilities; /*# sourceMappingURL=index.css.map */ diff --git a/src/assets/styles/recruitment.scss b/src/assets/styles/recruitment.scss index 79c1900..89341b3 100644 --- a/src/assets/styles/recruitment.scss +++ b/src/assets/styles/recruitment.scss @@ -6,7 +6,11 @@ $undertone: #647499;//浅灰 设置为非强调色 +*{ + margin: 0; + padding: 0; +} // 复选框样式 .checkbox { position: relative; @@ -36,10 +40,8 @@ .btn-style { width: 100px; height: 40px; - background-color: var(--primary); cursor: pointer; border: var(--border) 1px solid; - &:hover, &:active { color: var(--primary-foreground); @@ -48,11 +50,18 @@ } +// 长虚线边框样式 +.long-dashed-border { + border-radius: var(--radius); + border: 1px solid transparent; + background: linear-gradient(white,white) padding-box, + repeating-linear-gradient(-45deg,var(--border) 0,var(--border) 0.5em,white 0,white 0.75em); +} + //后台样式 .content { padding: 20px; - width: 100%; background-color: var(--background); position: relative; } @@ -65,11 +74,19 @@ align-items: center; position: relative; gap: 20px; - + min-width: 920px; .search-input { - position: absolute; - right: 0; + position: relative; + display: inline-flex; + align-items: center; + gap: 10px; + width: 300px; + height: 40px; + @media screen and (max-width: 1300px) { + display: none; + } } + } .reset { @@ -90,7 +107,6 @@ justify-content: flex-start; align-items: center; gap: 20px; - .toggle-button { width: 100px; height: 40px; @@ -99,22 +115,13 @@ .handle-btns { position: absolute; - right: 0; + right: 20px; display: flex; gap: 20px; - - .handle-btn { - width: 100px; - height: 40px; - background-color: var(--primary); - cursor: pointer; - border: var(--border) 1px solid; - - &:hover, - &:active { - color: var(--primary-foreground); - border: var(--primary-foreground) 1px solid; - } + @media screen and (max-width: 1300px) { + position: relative; + right: 0; + margin-left: 40px; } } } @@ -129,6 +136,7 @@ //卡片展示 .main-content-show{ display: flex; + padding: 20px; flex-direction: column; justify-content: flex-start; align-items: flex-start; @@ -139,21 +147,23 @@ position: relative; top: 20px; gap: 20px; - + @extend .long-dashed-border; } + + //滚动条样式 /* 定义滚动条的轨道样式 */ ::-webkit-scrollbar { - width: 2px; /* 滚动条轨道的宽度 */ + width: 1px; /* 滚动条轨道的宽度 */ } /* 定义滚动条的滑块样式 */ ::-webkit-scrollbar-thumb { - background-color:var(--accent); /* 滑块的颜色 */ + background-color:skyblue; /* 滑块的颜色 */ border-radius: 2px; /* 滑块的圆角 */ } /* 定义滚动条的轨道样式(当滑块处于悬停状态时) */ ::-webkit-scrollbar-track { - background: #f1f1f1; /* 轨道的颜色 */ + background: var(--background); /* 轨道的颜色 */ } diff --git a/src/features/community/components/application/ApplicationFrom.vue b/src/components/application/ApplicationFrom.vue similarity index 81% rename from src/features/community/components/application/ApplicationFrom.vue rename to src/components/application/ApplicationFrom.vue index 6ef0c1a..a02a666 100644 --- a/src/features/community/components/application/ApplicationFrom.vue +++ b/src/components/application/ApplicationFrom.vue @@ -15,10 +15,11 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' +import { useAlert } from '@/composables/alert' const useApplicationStore = applicationStore() - useApplicationStore.isGetCode() +const { showAlert } = useAlert() interface Data { data: ApplicationFrom; @@ -43,12 +44,12 @@ const { getClass, classListData, getCode, sentStuInfo } = UseApplication() getClass() const stuInform = ref({ - clazz: '', + clazz: '计科241', code: '', email: '', name: '', qqNumber: '', - sex: '', + sex: '男', studentId: '', file: null as unknown as File }) @@ -85,6 +86,39 @@ const applicationGetCode = (email: string) => { function submitForm() { console.log(stuInform); + // const infoInput = document.getElementsByTagName("input"); + // for (let i = 0; i < infoInput.length; i++) { + // if (infoInput[i].value === "") { + // infoInput[i].className += ' noWrite' + // } + // } + // stuInform.forEach((input) => { + // }); + + let isValid = true; + // 判断输入框是否为空,并添加 'noWrite' 类 + const inputs = document.querySelectorAll('input, select'); + inputs.forEach((input) => { + const element = input as HTMLInputElement; + if (!element.value && element.type !== 'file') { + element.classList.add('noWrite'); + isValid = false; + element.addEventListener('focusin', function (event) { + element.classList.remove('noWrite'); + }) + } else { + element.classList.remove('noWrite'); + } + }); + + if (!isValid) { + showAlert('请填写所有必填项', 'waring'); + return; + } + if (stuInform.value.file == null) { + showAlert('请上传您的简介', 'waring'); + return; + } const formData = new FormData(); formData.append('clazz', stuInform.value.clazz); formData.append('code', stuInform.value.code); @@ -94,8 +128,7 @@ function submitForm() { formData.append('sex', stuInform.value.sex); formData.append('studentId', stuInform.value.studentId); formData.append('file', stuInform.value.file); - sentStuInfo(formData).then((res) => { - }) + sentStuInfo(formData) } @@ -186,8 +219,36 @@ function submitForm() { - \ No newline at end of file diff --git a/src/features/community/components/application/ComboBox.vue b/src/components/application/ComboBox.vue similarity index 100% rename from src/features/community/components/application/ComboBox.vue rename to src/components/application/ComboBox.vue diff --git a/src/components/community/tag/TagHeader.vue b/src/components/community/tag/TagHeader.vue deleted file mode 100644 index 9320e3d..0000000 --- a/src/components/community/tag/TagHeader.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/components/layouts/AppSidebar.vue b/src/components/layouts/AppSidebar.vue index c23f820..f64a97d 100644 --- a/src/components/layouts/AppSidebar.vue +++ b/src/components/layouts/AppSidebar.vue @@ -100,7 +100,7 @@ interface SubItemInterface {
-
- -
+
+ +
+ \ No newline at end of file diff --git a/src/features/community/components/NewsContent.vue b/src/features/community/components/NewsContent.vue index a849fa4..ee98782 100644 --- a/src/features/community/components/NewsContent.vue +++ b/src/features/community/components/NewsContent.vue @@ -101,7 +101,6 @@ const props = defineProps({ type: Number, default: 0, }, - page: { type: Number, default: 1, @@ -111,12 +110,10 @@ const props = defineProps({ default: "", }, }); -// let postArr = ref([]); -getArticle(props.type, props.page, props.condition); -checkType(props.type); +console.log(props.type); -// console.log(articleList.value); -// postArr.value = articleList.value; +getArticle(props.type, props.condition, props.page); +checkType(props.type); diff --git a/src/features/community/components/tag/TagContent.vue b/src/features/community/components/tag/TagContent.vue new file mode 100644 index 0000000..73d5364 --- /dev/null +++ b/src/features/community/components/tag/TagContent.vue @@ -0,0 +1,72 @@ + + + + + \ No newline at end of file diff --git a/src/features/community/composables/CommunityTag.ts b/src/features/community/composables/CommunityTag.ts index 8fed7af..79906da 100644 --- a/src/features/community/composables/CommunityTag.ts +++ b/src/features/community/composables/CommunityTag.ts @@ -37,7 +37,7 @@ export default function () { useTagList.value = res.data } - async function getRecommendTag(){ + async function getRecommendTag() { await executeRequest({ url: `/community_tag/recommend`, method: 'get' }) const res = data.value as TagData; likeTagList.value = res.data @@ -47,8 +47,12 @@ export default function () { await executeRequest({ url: `/community_tag/relativePost?tagName=${tag}`, method: 'get' }) const res = data.value as Data; // postList.splice(0, postList.length) - tagPostList.value = res.data.records - console.log(tagPostList); + if (res.code == 50016) { + tagPostList.value = [] + } else { + tagPostList.value = res.data.records + } + } return { diff --git a/src/features/community/composables/search.ts b/src/features/community/composables/search.ts index 80798b4..b8ee83e 100644 --- a/src/features/community/composables/search.ts +++ b/src/features/community/composables/search.ts @@ -4,6 +4,7 @@ import { ref } from "vue"; const { executeRequest, error, loading, data } = useRequest(); let articleList = ref([]); let searchResult = ref([]); +let userInfo = ref({} as Data); export function debounce( func: (this: T, ...args: any[]) => void, wait: number, @@ -27,17 +28,16 @@ export function debounce( }, wait); }; } -export async function getArticle(type = 0, page = 1, condition = "") { +export async function getArticle(type = 0, condition = "", page = 1, sort = 0) { await executeRequest({ - url: `/post/selectAll?condition=${condition}&page=${page}&type=${type}`, + url: `/post/selectAll?condition=${condition}&page=${page}&sort=${sort}&type=${type}`, method: "get", }); const res = data.value as Data; console.log(res); - articleList.value = res.data.records; console.log(articleList.value); - return articleList.value; + return res.data; } export function checkType(type: any) { if (type == 1) { @@ -59,4 +59,10 @@ export async function SearchArticle(condition = "") { searchResult.value = res.data.records; console.log(searchResult.value); } +export async function getUserList(content = "", pageNumber = 1, pageSize = 10) { + executeRequest({ url: "/user/searchUser", method: "get" }).then((res) => { + console.log(res); + }); +} + export { articleList, searchResult }; diff --git a/src/features/community/pages/blog/index.vue b/src/features/community/pages/blog/index.vue index 3ecbfe7..5551f23 100644 --- a/src/features/community/pages/blog/index.vue +++ b/src/features/community/pages/blog/index.vue @@ -196,12 +196,12 @@ + color: #909ba6; + font-size: 14px; + .label-item { + margin: 0 5px; + } + } + } + } + .news-footer { + display: flex; + align-items: center; + padding: 5px 55px; + & > div { + color: var(--secondary-foreground); + display: flex; + align-items: center; + font-size: 13px; + margin-right: 10px; + } + &-icon { + color: var(--secondary-foreground); + font-size: 17px; + margin-right: 5px; + } + } + } +} +@media screen and (max-width: 768px) { + .content { + padding: 0 0; + .bg { + position: fixed; + top: 0; + z-index: 0; + width: 100%; + height: 20%; + background-color: #fafafa; + &-top { + background-image: linear-gradient(#dfe9f3, #ffffff00 100%); + height: 30%; + } + } + } +} + diff --git a/src/features/community/pages/comprehensive/[title].vue b/src/features/community/pages/comprehensive/[title].vue index 5930e2d..614d375 100644 --- a/src/features/community/pages/comprehensive/[title].vue +++ b/src/features/community/pages/comprehensive/[title].vue @@ -83,7 +83,7 @@ import type { ArticleList } from "@/types/Community"; import { ref } from "vue"; import { useRoute } from "vue-router"; import NewsContent from "../../components/NewsContent.vue"; -import Search from "../../components/Search.vue"; +import Search from "../../components/SearchArticle.vue"; const route = useRoute(); const { executeRequest, error, loading, data } = useRequest(); let articleList = ref([]); @@ -109,7 +109,7 @@ if ("title" in route.params) { \ No newline at end of file + \ No newline at end of file diff --git a/src/layouts/DefaultLayout.vue b/src/layouts/DefaultLayout.vue index 0711b03..872ef3d 100644 --- a/src/layouts/DefaultLayout.vue +++ b/src/layouts/DefaultLayout.vue @@ -6,7 +6,7 @@ import SidebarTrigger from "@/components/ui/sidebar/SidebarTrigger.vue";