枫林 пре 2 месеци
родитељ
комит
8149a6cd8f

+ 0 - 56
auto-imports.d.ts

@@ -1,56 +0,0 @@
-// Generated by 'unplugin-auto-import'
-export {}
-declare global {
-  const EffectScope: typeof import('vue')['EffectScope']
-  const computed: typeof import('vue')['computed']
-  const createApp: typeof import('vue')['createApp']
-  const customRef: typeof import('vue')['customRef']
-  const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
-  const defineComponent: typeof import('vue')['defineComponent']
-  const effectScope: typeof import('vue')['effectScope']
-  const getCurrentInstance: typeof import('vue')['getCurrentInstance']
-  const getCurrentScope: typeof import('vue')['getCurrentScope']
-  const h: typeof import('vue')['h']
-  const inject: typeof import('vue')['inject']
-  const isProxy: typeof import('vue')['isProxy']
-  const isReactive: typeof import('vue')['isReactive']
-  const isReadonly: typeof import('vue')['isReadonly']
-  const isRef: typeof import('vue')['isRef']
-  const markRaw: typeof import('vue')['markRaw']
-  const nextTick: typeof import('vue')['nextTick']
-  const onActivated: typeof import('vue')['onActivated']
-  const onBeforeMount: typeof import('vue')['onBeforeMount']
-  const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
-  const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
-  const onDeactivated: typeof import('vue')['onDeactivated']
-  const onErrorCaptured: typeof import('vue')['onErrorCaptured']
-  const onMounted: typeof import('vue')['onMounted']
-  const onRenderTracked: typeof import('vue')['onRenderTracked']
-  const onRenderTriggered: typeof import('vue')['onRenderTriggered']
-  const onScopeDispose: typeof import('vue')['onScopeDispose']
-  const onServerPrefetch: typeof import('vue')['onServerPrefetch']
-  const onUnmounted: typeof import('vue')['onUnmounted']
-  const onUpdated: typeof import('vue')['onUpdated']
-  const provide: typeof import('vue')['provide']
-  const reactive: typeof import('vue')['reactive']
-  const readonly: typeof import('vue')['readonly']
-  const ref: typeof import('vue')['ref']
-  const resolveComponent: typeof import('vue')['resolveComponent']
-  const resolveDirective: typeof import('vue')['resolveDirective']
-  const shallowReactive: typeof import('vue')['shallowReactive']
-  const shallowReadonly: typeof import('vue')['shallowReadonly']
-  const shallowRef: typeof import('vue')['shallowRef']
-  const toRaw: typeof import('vue')['toRaw']
-  const toRef: typeof import('vue')['toRef']
-  const toRefs: typeof import('vue')['toRefs']
-  const triggerRef: typeof import('vue')['triggerRef']
-  const unref: typeof import('vue')['unref']
-  const useAttrs: typeof import('vue')['useAttrs']
-  const useCssModule: typeof import('vue')['useCssModule']
-  const useCssVars: typeof import('vue')['useCssVars']
-  const useSlots: typeof import('vue')['useSlots']
-  const watch: typeof import('vue')['watch']
-  const watchEffect: typeof import('vue')['watchEffect']
-  const watchPostEffect: typeof import('vue')['watchPostEffect']
-  const watchSyncEffect: typeof import('vue')['watchSyncEffect']
-}

+ 1 - 0
src/components/cod/index.vue

@@ -119,6 +119,7 @@ onMounted(async () => {
     }
   }
   async function init() {
+    debugger
     cod = (await getdata()) as data[]
     canvasCod()
     rendcod()

+ 7 - 1
src/components/header/hsearch.vue

@@ -23,6 +23,12 @@ const search = () => {
     // router.push(`/platelist/0?title=${input3.value}`)
     window.location.href = `/platelist/0?title=${input3.value}`
   }
+  if (select.value === '用户') {
+    ElMessage({
+      message: '暂未开放',
+      type: 'warning'
+    })
+  }
 }
 </script>
 
@@ -78,7 +84,7 @@ const search = () => {
       </el-select>
     </template>
     <template #append>
-      <el-button :icon="Search" />
+      <el-button :icon="Search" @click="search" />
     </template>
   </el-input>
 </template>

+ 4 - 1
src/components/plate/platePostItem.vue

@@ -2,6 +2,7 @@
 import service from '../../plugins/axios'
 import { defineProps, ref, watch } from 'vue'
 import { API_URL } from '../../config'
+import { log } from 'console'
 
 const dp = defineProps({
   id: {
@@ -40,6 +41,7 @@ const dp = defineProps({
 })
 //格式化时间几天前
 function formatDate(date: any) {
+  console.log(date);
   const d = new Date(date)
   const now = Date.now()
   const diff = (now - d.getTime()) / 1000
@@ -106,7 +108,8 @@ if (userinfo.value.data.user.avatar) {
         <div type="text"
              style="float: left">
           <el-space wrap>
-            <el-tag type="info">{{ formatDate(dp.time) }}</el-tag>
+            <!-- {{ dp.time }} -->
+            <!-- <el-tag type="info">{{ formatDate(dp.time) }}</el-tag> -->
             <el-tag type="success">回复{{ dp.numberOfReplies?numberOfReplies:0 }}</el-tag>
             <el-tag type="warning">浏览量{{ dp.views }}</el-tag>
           </el-space>

+ 2 - 2
src/config.ts

@@ -1,9 +1,9 @@
 // 生产环境api地址
-const PROD_API_URL = "http://43.138.12.187:3000/";
+const PROD_API_URL = "http://127.0.0.1:3000/";
 // 开发环境api地址
 const DEV_API_URL = "http://127.0.0.1:3000/";
 //判断当前环境
 const isProd = process.env.NODE_ENV === "production";
 //根据环境判断api地址
-console.log;
+// console.log;
 export const API_URL = isProd ? PROD_API_URL : DEV_API_URL;

+ 1 - 1
src/layouts/auth.vue

@@ -75,7 +75,7 @@ onMounted(() => {
       target.style.paddingRight = '20px'
       login.addEventListener('mouseenter', card_move)
       login.addEventListener('mouseleave', card_leave)
-      console.log(target.className, login.className)
+      // console.log(target.className, login.className)
       login.style.zIndex = '-1'
       target.style.zIndex = '1'
     }

+ 1 - 1
src/layouts/reply.vue

@@ -6,7 +6,7 @@ import { token } from '../plugins/pinia'
 import { ElMessage, FormInstance } from 'element-plus'
 
 const { postid, commentid } = useRoute().query
-console.log('接收' + JSON.stringify(useRoute().query))
+// console.log('接收' + JSON.stringify(useRoute().query))
 
 const submit = async (formEl: FormInstance | undefined) => {
   formEl?.validate(async (valid, e) => {

+ 3 - 3
src/layouts/userinfo.vue

@@ -7,15 +7,15 @@ const avatarimg = 'https://jsonplaceholder.typicode.com/posts/'
 const gotoPlate = (id: number) => {
   switch (id) {
     case 1:
-      console.log('修改资料')
+      // console.log('修改资料')
       window.location.href = `/user/userinfo`
       break
     case 2:
-      console.log('我的帖子')
+      // console.log('我的帖子')
       window.location.href = `/user/postlist/0?type=user`
       break
     case 3:
-      console.log('账户安全')
+      // console.log('账户安全')
       break
   }
 }

+ 9 - 0
src/plugins/axios.ts

@@ -20,6 +20,15 @@ service.interceptors.response.use(
     const { status, data, statusCode } = error.response;
     switch (status) {
       case 400:
+        //判断data.message 为数组
+        if (Array.isArray(data.message)) {
+          data.message.forEach((item: any) => {
+            item.msg.forEach((msg: any) => {
+              ElMessage.error(msg);
+            });
+          });
+          return;
+        }
         ElMessage.error(data.message);
         break;
       case 401:

+ 2 - 1
src/plugins/crypto.ts

@@ -1,4 +1,5 @@
 import { AES, enc, mode, pad } from "crypto-js";
+// 加密
 export function encrypt(
   word: string | Object,
   keyStr: string = import.meta.env.VITE_CODE_KEY
@@ -13,7 +14,7 @@ export function encrypt(
   });
   return encryptedObj.toString();
 }
-// 解密函數
+// 解密
 export function decrypt(
   word: string,
   keyStr: string = import.meta.env.VITE_CODE_KEY

+ 3 - 3
src/plugins/pinia.ts

@@ -33,13 +33,13 @@ export const userdata = defineStore({
     enabled: true,
     strategies: [
       {
-        storage: localStorage,
+        storage: sessionStorage,
       },
     ],
   },
 });
 export const Avatar = defineStore({
-  id: "userdata",
+  id: "userAvatar",
   state: () => {
     return {
       URL: "",
@@ -49,7 +49,7 @@ export const Avatar = defineStore({
     enabled: true,
     strategies: [
       {
-        storage: localStorage,
+        storage: sessionStorage,
       },
     ],
   },

+ 11 - 5
src/views/plate/platelist.vue

@@ -62,6 +62,12 @@ const page = async (v: number) => {
   ).data
 }
 function bt_post() {
+  
+  if (!token().token) {
+    debugger
+    window.location.href = `/auth?type=login`
+    return;
+  }
   window.location.href = `/posting?plate=${id === 0 ? 1 : id}`
 }
 const topPost = ref([] as any)
@@ -83,10 +89,10 @@ if (id != 0) {
            :body-style="{ padding: '0px' }">
     {{ platename }}
   </el-card>
-  <el-empty v-show="data.data.length==0"
+  <el-empty v-show="data.data.length==0 && topPost.length==0"
             description="没有找到任何帖子" />
   <div v-show="topPost.length > 0">
-    <el-divider>置顶帖子</el-divider>
+    <el-divider v-show="topPost.length > 0" >置顶帖子</el-divider>
     <div v-for="(item,i) of topPost"
          :key="i"
          style="margin: 10px 0;">
@@ -94,14 +100,14 @@ if (id != 0) {
                      :title="item.title"
                      :content="item.content"
                      :authorid="item.authorId"
-                     :time="item.updatedAt"
+                     :time="item.updatedTime"
                      :numberOfReplies="item.comments"
                      :views="item.views"
                      :istop="false" />
     </div>
   </div>
-  <el-divider>普通帖子</el-divider>
-
+  <el-divider v-show="data.data.length > 0">普通帖子</el-divider>
+  
   <div v-for="(item,i) of data.data"
        :key="i"
        style="margin: 10px 0;">

+ 3 - 4
src/views/post/postarticle.vue

@@ -149,12 +149,11 @@ function formatDate(date: any) {
   }
   return Math.ceil(diff / (3600 * 24)) + '天前'
 }
-const isadmin = ref()
+const isadmin = ref(false)
 if (jurisdiction.value) {
-  isadmin.value = ref(
+  isadmin.value = 
     jurisdiction.value.msg === '管理员' ||
-      jurisdiction.value.msg === '超级管理员'
-  )
+    jurisdiction.value.msg === '超级管理员'
 }
 </script>
 

+ 1 - 1
src/views/userinfo/putuserinfo.vue

@@ -37,7 +37,7 @@ const data = (
 const form = ref(data)
 const sub = async (req: any) => {
   const { QQ, github, signature, nickname } = form.value.user
-  console.log(QQ, github, signature, nickname)
+  // console.log(QQ, github, signature, nickname)
 
   const res = (
     await service({

+ 1 - 1
vite.config.ts

@@ -12,7 +12,7 @@ export default defineConfig({
   },
   //  配置服务器
   server: {
-    port: 8080,
+    port: 88849,
   },
   plugins: [
     vue(),