Ver Fonte

新增权限管理 管理员

枫叶秋林 há 2 anos atrás
pai
commit
f2ae9d2f68

BIN
dump.rdb


+ 19 - 7
src/components/plate/platePostItem.vue

@@ -67,11 +67,15 @@ watch(
 
   { deep: true }
 )
-
-userinfo.value.data.user.avatar = API_URL + userinfo.value.data.user.avatar
 const to_post = () => {
   window.location.href = `/post/${dp.id}`
 }
+if (userinfo.value.data.user.avatar) {
+  userinfo.value.data.user.avatar = API_URL + userinfo.value.data.user.avatar
+} else {
+  userinfo.value.data.user.avatar =
+    'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
+}
 </script>
 
 <template>
@@ -79,9 +83,12 @@ const to_post = () => {
     <el-row>
 
       <el-col :span="4">
-        <div>
-          <el-avatar :src="userinfo.data.user.avatar? userinfo.data.user.avatar : 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'"
-                     size="large" />
+        <div class="c">
+          <div style="margin-bottom: 6px;">
+            <el-avatar :src="userinfo.data.user.avatar"
+                       :size="60" />
+          </div>
+          <el-tag type="primary">{{ userinfo.data.user.nickname?userinfo.data.user.nickname:userinfo.data.username }}</el-tag>
         </div>
 
       </el-col>
@@ -89,11 +96,9 @@ const to_post = () => {
         <span class="title"
               v-html="dp.title" />
         <p class="content">{{dp.content}}</p>
-        <!-- 左边 -->
         <div type="text"
              style="float: left">
           <el-space wrap>
-            <el-tag type="primary">作者:{{ userinfo.data.user.nickname?userinfo.data.user.nickname:userinfo.data.username }}</el-tag>
             <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>
@@ -110,6 +115,13 @@ const to_post = () => {
 </template>
 
 <style scoped>
+.c {
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  height: 100%;
+}
 .title {
   font-size: 14px;
   color: #909399;

+ 14 - 1
src/components/post/commentitem.vue

@@ -59,7 +59,20 @@ async function IsMycomment() {
       },
     })
   ).data
-  if (data.authorid === res) {
+  const jurisdiction = await (
+    await service({
+      url: `/auth/Permissions`,
+      method: 'get',
+      headers: {
+        Authorization: `Bearer ${token().token}`,
+      },
+    })
+  ).data
+  if (
+    data.authorid === res ||
+    jurisdiction.msg === '管理员' ||
+    jurisdiction.msg === '超级管理员'
+  ) {
     return true
   }
   return false

+ 2 - 1
src/config.ts

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

+ 2 - 0
src/views/plate/platelist.vue

@@ -66,6 +66,8 @@ function bt_post() {
 </script>
 
 <template>
+  <el-empty v-show="data.data.length==0"
+            description="没有找到任何帖子" />
   <div v-for="(item,i) of data.data"
        :key="i"
        style="margin: 10px 0;">

+ 10 - 3
src/views/post/authorInformation.vue

@@ -25,6 +25,13 @@ const to_gethub = () => {
 }
 const data = await (await service.get(`userinfo/getuser?id=${dp.id}`)).data
 const count = await (await service.get(`/userinfo/count?id=${dp.id}`)).data
+const avatar = ref(API_URL + data.data.user.avatar)
+if (!data.data.user.avatar) {
+  avatar.value =
+    'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
+} else {
+  avatar.value = API_URL + data.data.user.avatar
+}
 </script>
 
 <template>
@@ -32,7 +39,8 @@ const count = await (await service.get(`/userinfo/count?id=${dp.id}`)).data
            class="post-card-info">
     <template #header>
       <el-button type="text"
-                 :href="data.data.user.github">
+                 :href="data.data.user.github"
+                 @click="to_gethub">
         {{ data.data.user.nickname?data.data.user.nickname:data.data.username }}
       </el-button>
       <span v-show="numberOfReplies!==-1">
@@ -41,11 +49,10 @@ const count = await (await service.get(`/userinfo/count?id=${dp.id}`)).data
         <el-divider direction="vertical" />
         浏览:{{ views }}
       </span>
-
     </template>
 
     <div class="center">
-      <el-avatar :src="API_URL+data.data.user.avatar"
+      <el-avatar :src="avatar"
                  :size="100" />
     </div>
     <div class="left">

+ 14 - 1
src/views/post/postarticle.vue

@@ -60,7 +60,20 @@ async function IsMypost() {
       },
     })
   ).data
-  if (data.auth_id === res) {
+  const jurisdiction = await (
+    await service({
+      url: `/auth/Permissions`,
+      method: 'get',
+      headers: {
+        Authorization: `Bearer ${token().token}`,
+      },
+    })
+  ).data
+  if (
+    data.auth_id === res ||
+    jurisdiction.msg === '管理员' ||
+    jurisdiction.msg === '超级管理员'
+  ) {
     return true
   }
   return false