diff --git a/Yi.BBS.Vue3/src/assets/login_images/QQ.png b/Yi.BBS.Vue3/src/assets/login_images/QQ.png new file mode 100644 index 00000000..805245e0 Binary files /dev/null and b/Yi.BBS.Vue3/src/assets/login_images/QQ.png differ diff --git a/Yi.BBS.Vue3/src/assets/login_images/WeChat.png b/Yi.BBS.Vue3/src/assets/login_images/WeChat.png new file mode 100644 index 00000000..6c2dfbbc Binary files /dev/null and b/Yi.BBS.Vue3/src/assets/login_images/WeChat.png differ diff --git a/Yi.BBS.Vue3/src/assets/login_images/login_bg_phone.png b/Yi.BBS.Vue3/src/assets/login_images/login_bg_phone.png new file mode 100644 index 00000000..addf1f2c Binary files /dev/null and b/Yi.BBS.Vue3/src/assets/login_images/login_bg_phone.png differ diff --git a/Yi.BBS.Vue3/src/assets/login_images/login_two.jpg b/Yi.BBS.Vue3/src/assets/login_images/login_two.jpg new file mode 100644 index 00000000..221a99af Binary files /dev/null and b/Yi.BBS.Vue3/src/assets/login_images/login_two.jpg differ diff --git a/Yi.BBS.Vue3/src/assets/styles/login.scss b/Yi.BBS.Vue3/src/assets/styles/login.scss new file mode 100644 index 00000000..fc04c772 --- /dev/null +++ b/Yi.BBS.Vue3/src/assets/styles/login.scss @@ -0,0 +1,206 @@ +* { + margin: 0; + padding: 0; +} +/*公共CSS*/ +.box { + + width: 100vw; + height: 100vh; + background-color: rgb(29, 67, 89); + .content { + box-shadow: 0px 1px 6px #3B4859; + .login-wrapper { + + h1 { + text-align: center; + } + .login-form { + .form-item { + margin: 20px 0; + span { + display: block; + margin: 5px 20px; + font-weight: 100; + } + .input-item { + width: 100%; + border-radius: 40px; + padding: 20px; + box-sizing: border-box; + font-size: 20px; + font-weight: 200; + &:focus { + outline: none; + } + } + } + .login-btn { + width: 100%; + border-radius: 40px; + color: #fff; + border: 0; + font-weight: 100; + margin-top: 10px; + cursor: pointer; + } + } + .divider { + width: 100%; + margin: 20px 0; + text-align: center; + display: flex; + align-items: center; + justify-content: center; + span:nth-child(1) { + flex: 1; + } + span:nth-child(3) { + flex: 1; + } + .line { + display: inline-block; + max-width: 30%; + width: 30%; + } + .divider-text { + vertical-align: middle; + margin: 0px 20px; + line-height: 0px; + display: inline-block; + width: 100px; + } + } + .other-login-wrapper { + width: 100%; + display: flex; + justify-content: center; + align-items: center; + } + .other-login-item { + border: 1px solid rgb(214, 222, 228); + padding: 10px; + margin: 10px; + cursor: pointer; + } + } + } +} +/*一般大于手机的尺寸CSS*/ +@media (min-width: 767px) { + .box { + background-color: #F0F2F5; + .content { + width: 85vw; + height: 90vh; + background: url("@/assets/login_images/login_two.jpg") no-repeat; + background-size: 90% 100%; + position: absolute; + right: 15%; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + border-radius: 20px; + background-color: #fff; + .login-wrapper { + width: 25vw; + position: absolute; + right: 15%; + top: 50%; + transform: translateY(-50%); + h1 { + text-align: center; + font-size: 45px; + color: rgb(81, 100, 115); + margin-bottom: 40px; + } + .login-form { + margin: 10px 0; + .form-item { + span { + color: rgb(81, 100, 115); + } + .input-item { + height: 60px; + border: 1px solid rgb(214, 222, 228); + } + } + .login-btn { + height: 50px; + background-color: rgb(59, 72, 89); + font-size: 20px; + } + } + .divider { + .line { + border-bottom: 1px solid rgb(214, 222, 228); + } + } + .other-login-item { + border-radius: 20px; + img { + width: 40px; + height: 40px; + } + } + } + } + } +} +/*手机端CSS*/ +@media (max-width: 768px) { + .box { + .content { + width: 100vw; + height: 100vh; + background: url("@/assets/login_images/login_bg_phone.png") no-repeat; + background-size: 100% 100%; + display: flex; + align-items: flex-start; + justify-content: center; + .login-wrapper { + width: 70%; + height: 60%; + padding-top: 15%; + h1 { + font-size: 30px; + color: #fff; + } + .login-form { + .form-item { + margin: 10px 0; + span { + color: rgb(113, 129, 141); + } + .input-item { + height: 30px; + border: 1px solid rgb(113, 129, 141); + background-color: transparent; + color: #fff; + } + } + .login-btn { + height: 40px; + background-color: rgb(235, 95, 93); + font-size: 16px; + } + } + .divider { + .line { + border-bottom: 1px solid #fff; + } + .divider-text { + color: #fff; + } + } + .other-login-item { + border-radius: 15px; + img { + width: 35px; + height: 35px; + } + } + } + } + } +} diff --git a/Yi.BBS.Vue3/src/components/DisscussCard.vue b/Yi.BBS.Vue3/src/components/DisscussCard.vue index a031b86d..c37580d4 100644 --- a/Yi.BBS.Vue3/src/components/DisscussCard.vue +++ b/Yi.BBS.Vue3/src/components/DisscussCard.vue @@ -55,12 +55,18 @@ const agree=async ()=>{ if(res.isArgee) { agreeNum.value+=1; - alert(res.message) + ElMessage({ + message: res.message, + type: 'success', + }) } else { agreeNum.value-=1; - alert(res.message) + ElMessage({ + message: res.message, + type: 'warning', + }) } } onMounted(()=>{ diff --git a/Yi.BBS.Vue3/src/layout/AppHeader.vue b/Yi.BBS.Vue3/src/layout/AppHeader.vue index 45a3e54d..513b80e9 100644 --- a/Yi.BBS.Vue3/src/layout/AppHeader.vue +++ b/Yi.BBS.Vue3/src/layout/AppHeader.vue @@ -33,8 +33,8 @@
- - 搜索 + + 搜索
@@ -59,19 +59,40 @@ import useUserStore from '@/stores/user.js' const router = useRouter() const userStore =useUserStore(); const activeIndex = ref('1') +const searchText=ref('') const handleSelect = (key, keyPath) => { console.log(key, keyPath) } -const logout=async ()=>{ - await userStore.logOut(); - router.push("/login"); +const logout= async()=>{ + ElMessageBox.confirm(`确定登出系统吗?`, "警告", { + confirmButtonText: "确认", + cancelButtonText: "取消", + type: "warning", + }).then( async() => { + //异步 + await userStore.logOut(); + //删除成功后,跳转到主页 + router.push("/login"); + ElMessage({ + type: "success", + message: "登出成功", + }); + }); + } const enterIndex=()=>{ router.push("/index"); }; const enterProfile=()=>{ router.push("/profile");} + +const search=()=>{ + var routerPer = { path: `/discuss`,query:{q:searchText.value} }; + searchText.value=''; + router.push(routerPer) +} + + \ No newline at end of file diff --git a/Yi.BBS.Vue3/src/router/index.js b/Yi.BBS.Vue3/src/router/index.js index b1dd82d7..7b5aee79 100644 --- a/Yi.BBS.Vue3/src/router/index.js +++ b/Yi.BBS.Vue3/src/router/index.js @@ -51,7 +51,7 @@ const router = createRouter({ }, { name:'discuss', - path: '/discuss/:plateId', + path: '/discuss/:plateId?', component: () => import('../views/Discuss.vue') }, { diff --git a/Yi.BBS.Vue3/src/utils/request.js b/Yi.BBS.Vue3/src/utils/request.js index 652b830d..887100ee 100644 --- a/Yi.BBS.Vue3/src/utils/request.js +++ b/Yi.BBS.Vue3/src/utils/request.js @@ -35,6 +35,19 @@ myaxios.interceptors.response.use(function (response) { return response; }, function (error) { +const response=error.response.data; +//业务异常+应用异常,统一处理 + switch(response.code) + { + + case 403: + ElMessage.error(response.message) + break; + case 500: + ElMessage.error(response.message) + break; + } + return Promise.reject(error); }); export default myaxios \ No newline at end of file diff --git a/Yi.BBS.Vue3/src/views/Discuss.vue b/Yi.BBS.Vue3/src/views/Discuss.vue index e308947c..49647607 100644 --- a/Yi.BBS.Vue3/src/views/Discuss.vue +++ b/Yi.BBS.Vue3/src/views/Discuss.vue @@ -114,6 +114,12 @@ const handleClick =async (tab, event) => { } onMounted(async()=>{ + + if(route.query.q !=undefined) + { + query.title=route.query.q??'' + router.push("/discuss") + } await loadDiscussList(); }) diff --git a/Yi.BBS.Vue3/src/views/EditArticle.vue b/Yi.BBS.Vue3/src/views/EditArticle.vue index 94f5ae49..5e7a81aa 100644 --- a/Yi.BBS.Vue3/src/views/EditArticle.vue +++ b/Yi.BBS.Vue3/src/views/EditArticle.vue @@ -1,13 +1,7 @@