Browse Source

研究员增加我要提问按钮,筛选项增加未回答项

cxmo 2 years ago
parent
commit
73fea3972f
2 changed files with 70 additions and 15 deletions
  1. 20 7
      pages-question/answerList.vue
  2. 50 8
      pages/question/question.vue

+ 20 - 7
pages-question/answerList.vue

@@ -176,7 +176,7 @@ export default {
     async getBarList() {
       const res = await apiBarTotal();
       if (res.code !== 200) return;
-      const { replied, wait, total } = res.data;
+      const { replied, wait, total,distribute } = res.data;
       //客户: 已回答 未回答 全部
       const customBar = [
         {
@@ -195,12 +195,17 @@ export default {
           num: total,
         },
       ];
-      //研究员: 待回答 已回答 全部
+      //研究员: 待回答 未回答 已回答 全部
       const researBar = [
         {
           label: "待回答",
-          key: "Wait",
-          num: wait,
+          key: "Distribute",
+          num: distribute,
+        },
+        {
+          label:'未回答',
+          key:'Wait',
+          num:wait,
         },
         {
           label: "已回答",
@@ -216,7 +221,7 @@ export default {
       this.barList = this.isUserResearcher ? researBar : customBar;
     },
     async getQuestionData() {
-      const reply_status = { Wait: 2, Replied: 3, Total: 0 };
+      const reply_status = { Wait: 2, Replied: 3, Total: 0 ,Distribute:4};
       await this.getQuestionList(reply_status[this.selectKey],1);
       this.setQuestionsRead()
     },
@@ -224,7 +229,8 @@ export default {
       //获取未读的数据,请求未读接口变为已读
       let unReadArr = []
       this.questionList.forEach(item=>{
-        let isReadKey = this.isUserResearcher?'replier_is_read':'is_read'
+        /* let isReadKey = this.isUserResearcher?'replier_is_read':'is_read' */
+        let isReadKey = item.user_id===this.userInfo.user_id?'replier_is_read':'is_read'
         if(item[isReadKey]===0){
           unReadArr.push(item.community_question_id)
         }
@@ -249,14 +255,21 @@ export default {
   padding: 30rpx;
   .answer-bar {
     display: flex;
-    justify-content: space-between;
+    /* justify-content: space-between; */
+    overflow-x: scroll;
+    &::-webkit-scrollbar{
+        width: 0;
+        display: none;
+    }
     .bar-item {
       width: 206rpx;
+      min-width: 206rpx;
       color: #666666;
       background-color: #f5f5f5;
       height: 70rpx;
       line-height: 70rpx;
       text-align: center;
+      margin-right: 20rpx;
       &.active {
         background-color: #fdf8f2;
         color: #e3b377;

+ 50 - 8
pages/question/question.vue

@@ -67,7 +67,32 @@
 					<text class="item-time">提问时间:{{ item.create_time }}</text>
 				</view>
 			</view>
-			<view class="topage-btn" @click="toPage" v-if="isUserResearcher||userInfo.status&&userAuth">
+			<template v-if="isUserResearcher">
+				<view class="btn-wrap">
+					<view class="btn topage-button" @click="toPage('question')" v-if="userInfo.status&&userAuth">
+						<image 
+							src="../../static/question/askquestion.png"
+							mode="scaleToFill"
+							style="width:34rpx;height:34rpx;"
+						/>
+						<text>我要提问</text>
+					</view>
+					<view class="btn topage-button" @click="toPage('ask')" v-if="userInfo.status&&userAuth">
+						<view>待回答<text v-if="isUserResearcher" style="margin-left:5rpx;">{{'('+waitNum+')'}}</text></view>
+					</view>
+				</view>
+			</template>
+			<template v-else>
+				<view class="topage-btn topage-button" @click="toPage('question')" v-if="userInfo.status&&userAuth">
+					<image 
+						src="../../static/question/askquestion.png"
+						mode="scaleToFill"
+						style="width:34rpx;height:34rpx;"
+					/>
+					<text>我要提问</text>
+				</view>
+			</template>
+			<!-- <view class="topage-btn" @click="toPage" v-if="isUserResearcher||userInfo.status&&userAuth">
 				<image 
 					v-if="!isUserResearcher"
 					src="../../static/question/askquestion.png"
@@ -75,7 +100,7 @@
 					style="width:34rpx;height:34rpx;"
 				/>
 				{{ isUserResearcher ? '待回答' : '我要提问' }} <text v-if="isUserResearcher" style="margin-left:5rpx;">{{'('+waitNum+')'}}</text>
-			</view>
+			</view> -->
 		</template>
 		 <!-- 没有权限 -->
 		<template v-else>
@@ -126,7 +151,7 @@ export default {
 			/* userInfo:{
 				is_inner:1,//0:外部客户;1内部员工
 				status:'试用',
-				is_suspend:1,
+				is_suspend:0,
 				is_researcher:0,
 				//seal_name:'梁娜',
 				//seal_mobile:123456,
@@ -203,12 +228,11 @@ export default {
 			this.isPopupShow = false
 		},
 		//点击'我要提问' or '待回答'
-		toPage() {
-			//const {is_inner} = this.userInfo
-			if (this.isUserResearcher) {
-				uni.navigateTo({ url: '/pages-question/answerList' })
-			} else {
+		toPage(type) {
+			if(type==='question'){
 				uni.navigateTo({ url: '/pages-question/hasQuestion' })
+			}else{
+				uni.navigateTo({ url: '/pages-question/answerList' })
 			}
 		},
 		//转发分享
@@ -349,6 +373,8 @@ page {
 		margin-left: -257rpx;
 		bottom: 215rpx;
 		width:514rpx;
+	}
+	.topage-button{
 		height: 80rpx;
 		text-align: center;
 		line-height: 80rpx;
@@ -364,6 +390,22 @@ page {
 			margin-top: -2rpx;
 		}
 	}
+
+	.btn-wrap{
+		position: fixed;
+		width:100%;
+		margin-left: -30rpx;
+		display: flex;
+		justify-content: center;
+		bottom: 215rpx;
+		.btn{
+			width:300rpx;
+			height:80rpx;
+			&:first-child{
+				margin-right: 30rpx;
+			}
+		}
+	}
 	.global-pup{
 		.content{
 			padding:90rpx 34rpx;