wuhongyu 5 år sedan
förälder
incheckning
85f2ec4904
1 ändrade filer med 14 tillägg och 3 borttagningar
  1. 14 3
      src/views/communication/parts/demand.vue

+ 14 - 3
src/views/communication/parts/demand.vue

@@ -12,9 +12,7 @@
           <span>{{ item.meta | getDate }}</span>
         </el-col>
       </el-col>
-      <el-col :span="24" class="anniu">
-        <el-button type="primary" v-if="user.type == 3" round @click="$router.push({ path: '/demand/demand' })"> 我要发布</el-button></el-col
-      >
+      <el-col :span="24" class="anniu"> <el-button type="primary" round @click="onclick()"> 我要发布</el-button></el-col>
     </el-col>
   </div>
 </template>
@@ -46,6 +44,19 @@ export default {
     xuqiu(item) {
       this.$router.push({ path: '/demand/index', query: { id: item.id } });
     },
+    async onclick() {
+      if (this.user) {
+        if (this.user.type == '3') {
+          this.$router.push({ path: '/demand/demand' });
+        } else {
+          this.$message.error('您的身份不够请重新登录');
+          this.$router.push({ path: '/login' });
+        }
+      } else {
+        this.$message.error('游客不能发布需求,请登录');
+        this.$router.push({ path: '/login' });
+      }
+    },
   },
   filters: {
     getDate(meta) {