瀏覽代碼

登录被提出处理

zweizhao 7 年之前
父節點
當前提交
299d220514
共有 4 個文件被更改,包括 143 次插入125 次删除
  1. 124 117
      components/header.vue
  2. 1 1
      pages/index/cert/freelancer.vue
  3. 17 6
      pages/index/cert/index.vue
  4. 1 1
      plugins/http.js

+ 124 - 117
components/header.vue

@@ -22,125 +22,131 @@
         <div class="dropdown" style="display:none;"></div>
         <div class="dropdown" style="display:none;"></div>
       </section>
-      <el-dropdown class="nav-dropdown">
-        <el-button type="text" style="color: #515151;">
-          <i class="el-icon-tickets"></i>工作台
-        </el-button>
-        <el-dropdown-menu slot="dropdown">
-          <el-dropdown-item>
-            <a class="workstation" href="/wo/work_todo">
-              <i class="el-icon-edit"></i>我的待办
-            </a>
-          </el-dropdown-item>
-          <el-dropdown-item>
-            <a class="workstation" href="/wo/work_platform">
-              <i class="el-icon-date"></i>我的项目
-            </a>
-          </el-dropdown-item>
-          <el-dropdown-item>
-            <a class="workstation" href="/wo/work_hire">
-              <i class="el-icon-news"></i>我的雇佣
-            </a>
-          </el-dropdown-item>
-          <el-dropdown-item>
-            <a class="workstation" href="/wo/work_cloud">
-              <i class="el-icon-service"></i>我的云端
-            </a>
-          </el-dropdown-item>
-        </el-dropdown-menu>
-      </el-dropdown>
-      <el-dropdown class="nav-dropdown">
-        <el-button type="text" class="message-box" style="color: #515151;">
-          <i class="el-icon-message"></i>消息
-          <span class="message-count message-total">{{messageCount.total}}</span>
-        </el-button>
-        <el-dropdown-menu slot="dropdown">
-          <el-dropdown-item class="message-box" @click.native="clickMessages('/message/system')">
-            <i class="circle blue"></i>系统消息
-            <span v-if="messageCount.system" class="message-count">{{messageCount.system}}</span>
-          </el-dropdown-item>
-          <el-dropdown-item class="message-box" @click.native="clickMessages('/message/project')">
-            <i class="circle orange"></i>工作通知
-            <span v-if="messageCount.work" class="message-count">{{messageCount.work}}</span>
-          </el-dropdown-item>
-          <el-dropdown-item class="message-box" @click.native="clickMessages('/message/comment')">
-            <i class="circle red"></i>评论回复
-            <span v-if="messageCount.reply" class="message-count">{{messageCount.reply}}</span>
-          </el-dropdown-item>
-          <el-dropdown-item class="message-box" @click.native="clickMessages('/message/at')">
-            <i class="circle green"></i>@我的
-            <span v-if="messageCount.at" class="message-count">{{messageCount.at}}</span>
-          </el-dropdown-item>
-          <el-dropdown-item class="message-box" @click.native="clickMessages('/message/plus')">
-            <i class="circle pink"></i>赞及其它
-            <span
-              v-if="messageCount.community_other"
-              class="message-count"
-            >{{messageCount.community_other}}</span>
-          </el-dropdown-item>
-          <el-dropdown-item class="message-box" @click.native="clickMessages('/message/coin')">
-            <i class="circle yellow"></i>收支信息
-            <span v-if="messageCount.balance" class="message-count">{{messageCount.balance}}</span>
-          </el-dropdown-item>
-        </el-dropdown-menu>
-      </el-dropdown>
-      <el-popover class="nav-popover" placement="bottom" width="226" trigger="hover">
-        <section class="ref" slot="reference">
-          <a class="nav-header" href="/wo/work_todo">
-            <img
-              class="header-user"
-              :src="userinfo.icon_url"
-              alt="header"
-            >
-            <img
-              class="header-vip-icon"
-              :src="`https://dev.test.proginn.com/Public/image/h5/vip_icon${isCom ? '_com' : ''}.png`"
-              alt="vip-icon"
-            >
-          </a>
-          <span class="nickname dib">{{userinfo.nickname}}</span>
-        </section>
-        <section class="menu">
-          <section v-if="userinfo.vip_type_id" class="vip-info vip-info-com">
-            <section class="vip-info-top">
+      <template v-if="userinfo.icon_url">
+        <el-dropdown class="nav-dropdown">
+          <el-button type="text" style="color: #515151;">
+            <i class="el-icon-tickets"></i>工作台
+          </el-button>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item>
+              <a class="workstation" href="/wo/work_todo">
+                <i class="el-icon-edit"></i>我的待办
+              </a>
+            </el-dropdown-item>
+            <el-dropdown-item>
+              <a class="workstation" href="/wo/work_platform">
+                <i class="el-icon-date"></i>我的项目
+              </a>
+            </el-dropdown-item>
+            <el-dropdown-item>
+              <a class="workstation" href="/wo/work_hire">
+                <i class="el-icon-news"></i>我的雇佣
+              </a>
+            </el-dropdown-item>
+            <el-dropdown-item>
+              <a class="workstation" href="/wo/work_cloud">
+                <i class="el-icon-service"></i>我的云端
+              </a>
+            </el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
+        <el-dropdown class="nav-dropdown">
+          <el-button type="text" class="message-box" style="color: #515151;">
+            <i class="el-icon-message"></i>消息
+            <span class="message-count message-total">{{messageCount.total}}</span>
+          </el-button>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item class="message-box" @click.native="clickMessages('/message/system')">
+              <i class="circle blue"></i>系统消息
+              <span v-if="messageCount.system" class="message-count">{{messageCount.system}}</span>
+            </el-dropdown-item>
+            <el-dropdown-item class="message-box" @click.native="clickMessages('/message/project')">
+              <i class="circle orange"></i>工作通知
+              <span v-if="messageCount.work" class="message-count">{{messageCount.work}}</span>
+            </el-dropdown-item>
+            <el-dropdown-item class="message-box" @click.native="clickMessages('/message/comment')">
+              <i class="circle red"></i>评论回复
+              <span v-if="messageCount.reply" class="message-count">{{messageCount.reply}}</span>
+            </el-dropdown-item>
+            <el-dropdown-item class="message-box" @click.native="clickMessages('/message/at')">
+              <i class="circle green"></i>@我的
+              <span v-if="messageCount.at" class="message-count">{{messageCount.at}}</span>
+            </el-dropdown-item>
+            <el-dropdown-item class="message-box" @click.native="clickMessages('/message/plus')">
+              <i class="circle pink"></i>赞及其它
+              <span
+                v-if="messageCount.community_other"
+                class="message-count"
+              >{{messageCount.community_other}}</span>
+            </el-dropdown-item>
+            <el-dropdown-item class="message-box" @click.native="clickMessages('/message/coin')">
+              <i class="circle yellow"></i>收支信息
+              <span v-if="messageCount.balance" class="message-count">{{messageCount.balance}}</span>
+            </el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
+        <el-popover class="nav-popover" placement="bottom" width="226" trigger="hover">
+          <section class="ref" slot="reference">
+            <a class="nav-header" href="/wo/work_todo">
+              <img class="header-user" :src="userinfo.icon_url" alt="header">
               <img
-                class="vip-icon"
+                class="header-vip-icon"
                 :src="`https://dev.test.proginn.com/Public/image/h5/vip_icon${isCom ? '_com' : ''}.png`"
                 alt="vip-icon"
               >
-              <span class="vip-content">
-                <span class="vip-title" :class="{'is-dev': !isCom}">{{isCom ? '企业会员' : '开发者会员'}}</span>
-                <br>
-                <span class="vip-end-date">{{vipInfo.endDate}}到期</span>
-              </span>
+            </a>
+            <span class="nickname dib">{{userinfo.nickname}}</span>
+          </section>
+          <section class="menu">
+            <section v-if="userinfo.vip_type_id" class="vip-info vip-info-com">
+              <section class="vip-info-top">
+                <img
+                  class="vip-icon"
+                  :src="`https://dev.test.proginn.com/Public/image/h5/vip_icon${isCom ? '_com' : ''}.png`"
+                  alt="vip-icon"
+                >
+                <span class="vip-content">
+                  <span class="vip-title" :class="{'is-dev': !isCom}">{{isCom ? '企业会员' : '开发者会员'}}</span>
+                  <br>
+                  <span class="vip-end-date">{{vipInfo.endDate}}到期</span>
+                </span>
+              </section>
+              <section class="vip-arcs">
+                <a class="vip-arc" :class="{'is-dev': !isCom}" href="/type/vip">查看权益</a>
+                <a
+                  class="vip-arc"
+                  :class="{'is-dev': !isCom}"
+                  href="/vip/pay?number=3&amp;product_id=1&amp;next=/type/vip"
+                >立即续费</a>
+              </section>
             </section>
-            <section class="vip-arcs">
-              <a class="vip-arc" :class="{'is-dev': !isCom}" href="/type/vip">查看权益</a>
-              <a class="vip-arc" :class="{'is-dev': !isCom}" href="/vip/pay?number=3&amp;product_id=1&amp;next=/type/vip">立即续费</a>
+            <section class="vip-items">
+              <a class="vip-item divider" href="/wo/work_platform">
+                <i class="el-icon-date"></i>我的项目
+              </a>
+              <a class="vip-item" href="/wo/work_hire">
+                <i class="el-icon-news"></i>我的雇佣
+              </a>
+              <a class="vip-item" href="/wo/work_cloud">
+                <i class="el-icon-service"></i>我的云端
+              </a>
+              <a class="vip-item divider" :href="`/wo/${userinfo.uid}`">
+                <i class="el-icon-document"></i>我的主页
+              </a>
+              <a class="vip-item" href="/index/app">
+                <i class="el-icon-view"></i>关注微信
+              </a>
+              <a class="vip-item divider" @click="clickQuit">
+                <i class="el-icon-back"></i>退出
+              </a>
             </section>
           </section>
-          <section class="vip-items">
-            <a class="vip-item divider" href="/wo/work_platform">
-              <i class="el-icon-date"></i>我的项目
-            </a>
-            <a class="vip-item" href="/wo/work_hire">
-              <i class="el-icon-news"></i>我的雇佣
-            </a>
-            <a class="vip-item" href="/wo/work_cloud">
-              <i class="el-icon-service"></i>我的云端
-            </a>
-            <a class="vip-item divider" :href="`/wo/${userinfo.uid}`">
-              <i class="el-icon-document"></i>我的主页
-            </a>
-            <a class="vip-item" href="/index/app">
-              <i class="el-icon-view"></i>关注微信
-            </a>
-            <a class="vip-item divider" @click="clickQuit">
-              <i class="el-icon-back"></i>退出
-            </a>
-          </section>
-        </section>
-      </el-popover>
+        </el-popover>
+      </template>
+      <section v-else>
+        <a class="account-ctrl" href="/?loginbox=show">登录</a>
+        <a class="account-ctrl" style="margin-left: 40px;" href="/user/register">注册</a>
+      </section>
     </section>
   </section>
 </template>
@@ -184,9 +190,7 @@ export default {
       location.href = url
     },
     async getUserinfo() {
-      let res = await this.$get('/api/user/getInfo')
-      // console.log(JSON.stringify(res.data))
-      // console.log(res.data)
+      let res = await this.$get('/api/user/getInfo', { neverLogout: true })
       this.updateUserinfo({
         userinfo: res.data
       })
@@ -200,7 +204,7 @@ export default {
       })
     },
     async getMessageCount() {
-      let res = await this.$get('/api/message/getUnreadCount')
+      let res = await this.$get('/api/message/getUnreadCount', { neverLogout: true })
       this.messageCount = res.data
     }
   }
@@ -392,9 +396,12 @@ span.other-icon {
   cursor: pointer;
 }
 .vip-info-com .is-dev {
-  color: #CB9D53;
+  color: #cb9d53;
 }
 .workstation {
   color: #606266;
 }
+.account-ctrl {
+  color: #606266;
+}
 </style>

+ 1 - 1
pages/index/cert/freelancer.vue

@@ -42,7 +42,7 @@ import http from '@/plugins/http'
 export default {
   async asyncData(ctx) {
     let id = ctx.query.id
-      , { data } = await http.post(`${ctx.isDev ? '' : http.host}/api/cert/getDetail`, { id })
+      , { data } = await http.post(`${ctx.isDev ? '' : http.host}/api/cert/getDetail`, { id, neverLogout: true })
     return {
       detail: data,
     }

+ 17 - 6
pages/index/cert/index.vue

@@ -17,8 +17,19 @@
               <span class="vip-tag" v-if="item.is_vip_discount">会员¥{{item.vip_price}}</span>
             </section>
             <section class="cert-status">
-              <button class="cer-ctrl" :class="{disabled: btnDisabled(item)}" :disabled="btnDisabled(item)" @click="clickLancer(item)">{{item.btn_name}}</button>
-              <span class="userful-time" v-if='item.end_date && item.is_cert_validate && item.cert_no'>有效期至{{item.end_date}}<a :href="`/cert/id?no=${item.cert_no}`">查看证书</a></span>
+              <button
+                class="cer-ctrl"
+                :class="{disabled: btnDisabled(item)}"
+                :disabled="btnDisabled(item)"
+                @click="clickLancer(item)"
+              >{{item.btn_name}}</button>
+              <span
+                class="userful-time"
+                v-if="item.end_date && item.is_cert_validate && item.cert_no"
+              >
+                有效期至{{item.end_date}}
+                <a :href="`/cert/id?no=${item.cert_no}`">查看证书</a>
+              </span>
             </section>
           </section>
         </section>
@@ -37,7 +48,7 @@ export default {
       list: [],
     }
   },
-  head () {
+  head() {
     return {
       title: this.title,
       meta: [
@@ -49,7 +60,7 @@ export default {
     this.getList()
   },
   methods: {
-    clickLancer({id}) {
+    clickLancer({ id }) {
       this.$router.push({
         path: '/cert/freelancer',
         query: {
@@ -61,7 +72,7 @@ export default {
       return item.btn_name !== "申请认证" || !item.can_click
     },
     async getList() {
-      let res = await this.$post('/api/cert/getList', {page})
+      let res = await this.$post('/api/cert/getList', { page, neverLogout: true })
       if(res.status) {
         let list = res.data.list
         this.list = list
@@ -121,7 +132,7 @@ h1 {
   cursor: pointer;
 }
 .cer-title:hover {
-  color: #308EFF;
+  color: #308eff;
 }
 .cer-remind {
   width: 680px;

+ 1 - 1
plugins/http.js

@@ -71,7 +71,7 @@ const request = async (method, path, data, payload = {}) => {
   if(typeof rData !== 'object') rData = JSON.parse(rData)
   // consoleFormat({ rData })
   if(rData.status === 1) return rData
-  else if(rData.status === -99) {
+  else if(rData.status === -99 && !data.neverLogout) {
     location.href = '/login'
     return
   } else {