Browse Source

删除无用的JS文件

移除了docs目录下的assets.index.4b5ff18c.js文件,因为它已不再被项目使用。

Signed-off-by: 宋子桓🌈 <songzihuan@song-zh.com>
SongZihuan 3 months ago
parent
commit
e9a15f2f5d

+ 2 - 0
.env.development

@@ -10,6 +10,8 @@ VITE_PROXY_TARGET=
 # api base
 VITE_API_BASE_URL=
 
+VITE_MSG_API_BASE_URL=https://message.song-zh.com/message
+
 VITE_ICP="粤ICP备2022108417号"
 
 VITE_WANGAN="粤公网安备44011402000783号"

+ 2 - 0
.env.github

@@ -7,6 +7,8 @@ VITE_VISUALIZE=false
 # api base
 VITE_API_BASE_URL=
 
+VITE_MSG_API_BASE_URL=https://message.song-zh.com/message
+
 VITE_ICP="粤ICP备2022108417号"
 
 VITE_WANGAN="粤公网安备44011402000783号"

+ 2 - 0
.env.production

@@ -7,6 +7,8 @@ VITE_VISUALIZE=true
 # api base
 VITE_API_BASE_URL=
 
+VITE_MSG_API_BASE_URL=https://message.song-zh.com/message
+
 VITE_ICP="粤ICP备2022108417号"
 
 VITE_WANGAN="粤公网安备44011402000783号"

+ 41 - 0
.github/ISSUE_TEMPLATE/1-bug.md

@@ -0,0 +1,41 @@
+---
+name: 遇到错误或反常情况
+about: 如果你遇到Bug(错误、不合理的情况)请通过此Issue反馈。
+---
+## Bug提交
+### 问题
+
+请简单概况问题。
+
+### 发生阶段
+
+* 运行(`go run`)
+* 构建(`go build`)
+* 构建后运行
+* 其他(请详细描述)
+
+(请在上述类型中选择或自行补充)
+
+### 你再做什么
+
+请详细说明你在做什么。
+
+### 项目运行的情况
+
+项目运行的情况是什么?
+
+例如:调用了某个API,数据库的写入或读取。
+
+### 发生了什么事情
+
+发生了什么错误?
+
+并且请把日志(若有)、命令行输出一并告诉我们。
+
+### 正确到结果应该是
+
+你希望正常的结果应该是什么?
+
+### 其他补充
+
+你的其他补充。

+ 15 - 0
.github/ISSUE_TEMPLATE/2-feature.md

@@ -0,0 +1,15 @@
+---
+name: 新功能请求
+about: 如果你有新功能请求,欢迎你告知我们。
+---
+## 新功能请求
+
+请简单概述你的功能请求。
+
+## 现状
+
+关于此功能的现状如何?
+
+* 我有想法,但我没办法自己实现
+* 我有想法,并且我计划自己实现并提交PR
+* 我已经提交PR

+ 7 - 0
.github/ISSUE_TEMPLATE/3-thank.md

@@ -0,0 +1,7 @@
+---
+name: 分享喜悦
+about: 如果我们的项目对你有帮助,或者你想分享一些喜悦(和项目有关的)欢迎使用此模板。
+---
+## 分享喜悦
+
+请简单叙述发生的事情,并为我们留言吧。

+ 1 - 0
.github/ISSUE_TEMPLATE/config.yaml

@@ -0,0 +1 @@
+blank_issues_enabled: true

+ 14 - 0
.github/pull-request-template.md

@@ -0,0 +1,14 @@
+<!-- 请务必在创建PR前,在右侧 Labels 选项中加上label的其中一个: [feature]、[fix]、[documentation] 。以便于Actions自动生成Releases时自动对PR进行归类。-->
+
+**在提出此拉取请求时,我确认了以下几点(请复选框):**
+
+- [ ] 我已阅读并理解[LICENSE](LICENSE),并自愿成为本项目的贡献者。
+- [ ] 我已检查没有与此请求重复的拉取请求。
+- [ ] 我已经考虑过,并确认这份呈件对其他人很有价值。
+- [ ] 我接受此提交可能不会被使用,并根据维护人员的意愿关闭拉取请求。
+
+**填写PR内容:**
+
+-
+-
+-

+ 10 - 0
components.d.ts

@@ -9,11 +9,21 @@ export {}
 
 declare module '@vue/runtime-core' {
   export interface GlobalComponents {
+    ElAlert: typeof import('element-plus/es')['ElAlert']
+    ElButton: typeof import('element-plus/es')['ElButton']
+    ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
+    ElCard: typeof import('element-plus/es')['ElCard']
+    ElForm: typeof import('element-plus/es')['ElForm']
+    ElFormItem: typeof import('element-plus/es')['ElFormItem']
     ElImage: typeof import('element-plus/es')['ElImage']
+    ElInput: typeof import('element-plus/es')['ElInput']
     ElText: typeof import('element-plus/es')['ElText']
     ElTooltip: typeof import('element-plus/es')['ElTooltip']
     RouterLink: typeof import('vue-router')['RouterLink']
     RouterView: typeof import('vue-router')['RouterView']
     Togithub: typeof import('./src/components/togithub.vue')['default']
   }
+  export interface ComponentCustomProperties {
+    vLoading: typeof import('element-plus/es')['ElLoadingDirective']
+  }
 }

File diff suppressed because it is too large
+ 0 - 0
docs/assets.base.e3823977.css


File diff suppressed because it is too large
+ 0 - 0
docs/assets.base.f8a1107d.js


File diff suppressed because it is too large
+ 0 - 0
docs/assets.index.0457e6b4.css


File diff suppressed because it is too large
+ 0 - 0
docs/assets.index.547dbac2.js


File diff suppressed because it is too large
+ 0 - 0
docs/assets.index.6e78d3df.css


File diff suppressed because it is too large
+ 0 - 0
docs/assets.index.a8ce2724.js


File diff suppressed because it is too large
+ 0 - 0
docs/assets.index.fe2ad5f9.js


File diff suppressed because it is too large
+ 0 - 0
docs/assets.message.05e590be.js


File diff suppressed because it is too large
+ 0 - 0
docs/assets.message.3a3988a9.css


+ 1 - 0
docs/assets.notfound.a03a4bbb.js

@@ -0,0 +1 @@
+import{_ as e}from"./assets._plugin-vue_export-helper.1b428a4d.js";import{r as s,o as a,l as t,U as l,_ as o,v as n,y as r,F as u,a1 as i,a2 as p}from"./assets.vue.b58439d2.js";const h={},c=e=>(i("data-v-cf7e57e5"),e=e(),p(),e),d=c((()=>l("h1",null,"404",-1))),f=c((()=>l("h2",null,"Oops! The page you're looking for isn't here.",-1))),g=c((()=>l("p",null,"We can't seem to find the page you were trying to reach. This might be because of:",-1))),m=c((()=>l("ul",null,[l("li",null,"An outdated link"),l("li",null,"A mistyped address"),l("li",null,"Or the page has been moved")],-1)));const _=e(h,[["render",function(e,i){const p=s("router-link");return a(),t(u,null,[d,f,g,m,l("p",null,[o("Try going back to the "),n(p,{to:"/"},{default:r((()=>[o("homepage")])),_:1}),o(" or contact us if the problem persists.")])],64)}],["__scopeId","data-v-cf7e57e5"]]);export{_ as default};

+ 0 - 1
docs/assets.notfound.fbea63ae.js

@@ -1 +0,0 @@
-import{_ as e}from"./assets._plugin-vue_export-helper.1b428a4d.js";import{r as s,o as a,z as t,C as o,a5 as l,L as n,O as r,J as u,a8 as i,a9 as p}from"./assets.vue.9bf8535c.js";const h={},c=e=>(i("data-v-cf7e57e5"),e=e(),p(),e),d=c((()=>o("h1",null,"404",-1))),f=c((()=>o("h2",null,"Oops! The page you're looking for isn't here.",-1))),g=c((()=>o("p",null,"We can't seem to find the page you were trying to reach. This might be because of:",-1))),m=c((()=>o("ul",null,[o("li",null,"An outdated link"),o("li",null,"A mistyped address"),o("li",null,"Or the page has been moved")],-1)));const _=e(h,[["render",function(e,i){const p=s("router-link");return a(),t(u,null,[d,f,g,m,o("p",null,[l("Try going back to the "),n(p,{to:"/"},{default:r((()=>[l("homepage")])),_:1}),l(" or contact us if the problem persists.")])],64)}],["__scopeId","data-v-cf7e57e5"]]);export{_ as default};

File diff suppressed because it is too large
+ 0 - 0
docs/assets.vue.9bf8535c.js


File diff suppressed because it is too large
+ 0 - 0
docs/assets.vue.b58439d2.js


+ 2 - 2
docs/index.html

@@ -12,8 +12,8 @@
             overflow: auto;
         }
     </style>
-  <script type="module" crossorigin src="/assets.index.8681f31f.js"></script>
-  <link rel="modulepreload" crossorigin href="/assets.vue.9bf8535c.js">
+  <script type="module" crossorigin src="/assets.index.547dbac2.js"></script>
+  <link rel="modulepreload" crossorigin href="/assets.vue.b58439d2.js">
   <link rel="stylesheet" href="/assets.index.5a4f4251.css">
 </head>
 <body>

+ 9 - 0
src/api/message/sendmsg.ts

@@ -0,0 +1,9 @@
+import request from '@/utils/msgrequest'
+
+export function sendMsgToMail(name: string, message: string) {
+  return request.post('', {
+    name: name,
+    message: message,
+    refer: 'personal website (song-zh.com)'
+  })
+}

+ 15 - 0
src/router/index.ts

@@ -17,6 +17,21 @@ const routes: RouteRecordRaw[] = [
     path: '/home',
     redirect: '/'
   },
+  {
+    path: '/message',
+    component: () => import('@/views/message.vue'),
+    meta: {
+      title: '首页'
+    }
+  },
+  {
+    path: '/msg',
+    redirect: '/message'
+  },
+  {
+    path: '/mail',
+    redirect: '/message'
+  },
   {
     path: '/:catchAll(.*)',
     component: () => import('@/views/notfound.vue'),

+ 1 - 1
src/utils/build_time.json

@@ -1 +1 @@
-{"compile_time":1737983686005,"time_zone":"Asia/Shanghai"}
+{"compile_time":1738062074607,"time_zone":"Asia/Shanghai"}

+ 64 - 0
src/utils/msgrequest.ts

@@ -0,0 +1,64 @@
+import axios, { AxiosInstance, AxiosError, AxiosResponse } from 'axios'
+import { ElMessageBox } from 'element-plus'
+
+export const config = {
+  baseURL: import.meta.env.VITE_MSG_API_BASE_URL || '/message'
+}
+
+const msgservice: AxiosInstance = axios.create(config)
+
+msgservice.interceptors.request.use(
+  (config): any => {
+    const headers = {
+      ...config.headers,
+      'Content-Type': 'application/json;charset=utf-8',
+      Accept: 'application/json;charset=utf-8'
+    }
+
+    return {
+      ...config,
+      headers: headers
+    }
+  },
+  (error: AxiosError) => {
+    return Promise.reject(error)
+  }
+)
+
+msgservice.interceptors.response.use(
+  (response: AxiosResponse) => {
+    if (response.status === 200) {
+      return Promise.resolve(response)
+    } else if (response.status <= 599 && response.status >= 500) {
+      ElMessageBox.alert('服务器出错啦', '提示', {
+        confirmButtonText: '好的',
+        callback: () => {}
+      })
+    } else {
+      ElMessageBox.alert('网站暂时无法处理你的请求', '提示', {
+        confirmButtonText: '好的',
+        callback: () => {}
+      })
+    }
+
+    return Promise.reject(response)
+  },
+  (error: AxiosError) => {
+    ElMessageBox.alert('网站暂时无法处理你的请求', '提示', {
+      confirmButtonText: '好的',
+      callback: () => {}
+    })
+    return Promise.reject(error)
+  }
+)
+
+export type Result = Promise<ResultData> | any
+export type ResultData = AxiosResponse<result> | any
+
+export interface result {
+  message: string
+  code: number
+  success: boolean
+}
+
+export default msgservice

+ 16 - 5
src/utils/request.ts

@@ -12,7 +12,7 @@ service.interceptors.request.use(
     const headers = {
       ...config.headers,
       'Content-Type': 'application/form-data',
-      Accept: 'application/json'
+      Accept: 'application/json;charset=utf-8'
     }
 
     return {
@@ -29,14 +29,25 @@ service.interceptors.response.use(
   (response: AxiosResponse) => {
     if (response.status === 200) {
       return Promise.resolve(response)
+    } else if (response.status <= 599 && response.status >= 500) {
+      ElMessageBox.alert('服务器出错啦', '提示', {
+        confirmButtonText: '好的',
+        callback: () => {}
+      })
+    } else {
+      ElMessageBox.alert('网站暂时无法处理你的请求', '提示', {
+        confirmButtonText: '好的',
+        callback: () => {}
+      })
     }
-    ElMessageBox.alert('您遇到了未知的错误', '提示', {
-      confirmButtonText: '好的',
-      callback: () => {}
-    })
+
     return Promise.reject(response)
   },
   (error: AxiosError) => {
+    ElMessageBox.alert('网站暂时无法处理你的请求', '提示', {
+      confirmButtonText: '好的',
+      callback: () => {}
+    })
     return Promise.reject(error)
   }
 )

+ 18 - 33
src/views/index.vue

@@ -40,35 +40,11 @@
   })
 
   function handleWindowResize() {
-    if (window.innerWidth < 240) {
-      show.value = false
-    } else {
-      show.value = true
-    }
-
-    if (window.innerWidth < 268) {
-      showStack.value = false
-    } else {
-      showStack.value = true
-    }
-
-    if (window.innerWidth < 788) {
-      statusHorizontal.value = false
-    } else {
-      statusHorizontal.value = true
-    }
-
-    if (window.innerWidth < 478) {
-      showGithubStats.value = false
-    } else {
-      showGithubStats.value = true
-    }
-
-    if (window.innerWidth < 322) {
-      showGithubLanguage.value = false
-    } else {
-      showGithubLanguage.value = true
-    }
+    show.value = window.innerWidth >= 240
+    showStack.value = window.innerWidth >= 268
+    statusHorizontal.value = window.innerWidth >= 788
+    showGithubStats.value = window.innerWidth >= 478
+    showGithubLanguage.value = window.innerWidth >= 322
   }
   window.addEventListener('resize', handleWindowResize)
   handleWindowResize()
@@ -142,6 +118,10 @@
           <a href="mailto://songzihuan@song-zh.com" target="_blank">songzihuan@song-zh.com</a> 联系我。
           <br />
 
+          您可以通过我主页的
+          <router-link to="/message">电子信箱</router-link> 联系我。
+          <br />
+
           同时,您可以浏览我的个人网站
           <a href="https://song-zh.com" target="_blank">https://song-zh.com</a> 。尽管有些时候他可能还未准备好提供服务。
           <br />
@@ -619,7 +599,8 @@
     text-align: center;
   }
 
-  a {
+  a,
+  router-link {
     color: black;
     text-decoration: none;
     cursor: pointer;
@@ -627,16 +608,20 @@
     font-weight: bold;
   }
 
-  a:active {
+  a:active,
+  router-link:active {
     color: #72767b;
   }
 
-  a:hover {
+  a:hover,
+  router-link:hover {
     color: #f56c6c;
   }
 
   a:hover,
-  a:active {
+  a:active,
+  router-link:hover,
+  router-link:active {
     font-size: 1.05em;
     font-weight: bold;
     text-decoration: underline dotted;

+ 150 - 0
src/views/message.vue

@@ -0,0 +1,150 @@
+<script setup lang="ts">
+  import { ElDivider, ElMessage } from 'element-plus'
+  import { sendMsgToMail } from '@/api/message/sendmsg'
+
+  const router = useRouter()
+
+  const loading = ref(false)
+  const show = ref(true)
+  const form = ref({
+    name: '',
+    message: ''
+  })
+
+  const checkMessage = computed(() => form.value.message.length >= 1 && form.value.message.length <= 150)
+  const checkName = computed(() => form.value.name.length <= 25)
+  const checkAll = computed(() => checkMessage.value && checkName.value)
+
+  function handleWindowResize() {
+    show.value = window.innerWidth >= 240
+  }
+  window.addEventListener('resize', handleWindowResize)
+  handleWindowResize()
+
+  const reset = () => {
+    form.value.message = ''
+  }
+
+  const backToHome = () => {
+    router.push('/')
+  }
+
+  const sendMsg = () => {
+    if (!checkAll.value) {
+      return
+    }
+
+    loading.value = true
+    sendMsgToMail(form.value.name, form.value.message)
+      .then((response) => {
+        const data = response.data
+        if (data.success) {
+          reset()
+          ElMessage({
+            message: data.message || '留言成功',
+            type: 'success'
+          })
+        } else {
+          ElMessage({
+            message: data.message || '留言失败',
+            type: 'error'
+          })
+        }
+      })
+      .finally(() => (loading.value = false))
+  }
+</script>
+
+<template>
+  <div v-if="show" class="outside_box">
+    <div class="inner_box">
+      <div class="title_a">宋子桓-电子信箱📧</div>
+
+      <el-divider direction="horizontal" class="divider_horizontal"></el-divider>
+
+      <div v-loading="loading" class="card_outside">
+        <el-card class="card_box">
+          <el-form :model="form" label-width="auto">
+            <el-form-item label="你的名字(Your name)">
+              <el-input v-model="form.name" :maxlength="25" clearable show-word-limit />
+            </el-form-item>
+
+            <el-form-item label="你的留言(Your message)">
+              <el-input
+                v-model="form.message"
+                type="textarea"
+                :minlength="1"
+                :maxlength="150"
+                :rows="10"
+                clearable
+                show-word-limit
+              />
+            </el-form-item>
+          </el-form>
+          <div class="center_btn_box">
+            <el-button-group>
+              <el-button size="large" type="primary" :disabled="loading" @click="backToHome"> 返回主页 </el-button>
+              <el-button size="large" type="success" :disabled="!checkAll || loading" @click="sendMsg">
+                提交
+              </el-button>
+            </el-button-group>
+          </div>
+          <div class="center_tips_box">
+            <div class="tips_box">
+              <div v-if="!checkName" class="tip_box" style="display: flex; justify-content: center">
+                <el-alert title="名字不能超过25位!" :closable="false" type="warning" center show-icon> </el-alert>
+              </div>
+              <div v-if="!checkMessage" class="tip_box" style="display: flex; justify-content: center">
+                <el-alert title="消息的长度要在1-150个字符!" :closable="false" type="warning" center show-icon>
+                </el-alert>
+              </div>
+            </div>
+          </div>
+        </el-card>
+      </div>
+    </div>
+  </div>
+</template>
+
+<style scoped lang="scss">
+  .outside_box {
+    display: flex;
+    justify-content: center;
+    width: 100%;
+  }
+
+  .inner_box {
+    width: 80%;
+  }
+
+  .title_a {
+    width: 100%;
+    font-size: 2.5rem;
+    color: black;
+    text-align: center;
+    margin-top: 20px;
+    margin-bottom: 20px;
+  }
+
+  .card_outside {
+    display: flex;
+    justify-content: center;
+    width: 100%;
+  }
+
+  .card_box {
+    width: calc(min(75%, 800px));
+  }
+
+  .center_btn_box,
+  .center_tips_box {
+    display: flex;
+    justify-content: center;
+    width: 100%;
+  }
+
+  .tips_box {
+    width: 75%;
+    margin-top: 5px;
+  }
+</style>

Some files were not shown because too many files changed in this diff