jwyu 2 years ago
parent
commit
541371952d
2 changed files with 165 additions and 5 deletions
  1. 48 1
      pages-question/answerDetail.vue
  2. 117 4
      pages-question/hasQuestion.vue

+ 48 - 1
pages-question/answerDetail.vue

@@ -76,6 +76,9 @@
               style="width: 90rpx; height: 180rpx"
             />
             <view>无录音(录音时长超过三分钟自动结束)</view>
+
+            <view class="black-btn" style="margin-top:100rpx">转移问题</view>
+            <view class="black-btn" style="margin-top:50rpx" @click.stop="stopQuestion.show=true">终止问答</view>
           </view>
           <!-- <view class="record-time" v-else>{{ audioTime }}</view> -->
           <view class="recode-image" v-else>
@@ -248,6 +251,28 @@
 				<view class="apply" @click="handleGoApply" v-else>立即申请</view>
 			</view>
     </template>
+
+    <!-- 终止问答弹窗 -->
+    <van-dialog
+      use-slot
+      title="终止问答"
+      :show="stopQuestion.show"
+      show-cancel-button
+      confirm-button-open-type="getUserInfo"
+      @close="stopQuestion.show=false;stopQuestion.reason=''"
+      @confirm="handleConfirmStopQuestion"
+    >
+      <view style="padding:48rpx">
+        <textarea 
+          style="background: #F7F8FA;border-radius: 8px;padding: 20rpx;display:block;box-sizing:border-box;width:100%" 
+          maxlength="-1" 
+          cols="30" 
+          rows="10" 
+          placeholder="请输入终止理由"
+          v-model="stopQuestion.reason"
+        ></textarea>
+      </view>
+    </van-dialog>
   </view>
 </template>
 
@@ -321,6 +346,12 @@ export default {
 				is_suspend:1,
 				is_researcher:0,
 			}, *///mock用户信息
+
+      stopQuestion:{
+        show:false,
+        reason:'',
+      },//终止问答
+
     };
   },
   async onLoad(options) {
@@ -812,6 +843,10 @@ export default {
           }
       }
     },
+    // 终止问答
+    handleConfirmStopQuestion(){
+      console.log('stop question');
+    }
   },
 };
 </script>
@@ -842,10 +877,22 @@ export default {
         text-align: center;
         color: #999999ff;
         font-size: 28rpx;
-        height:130rpx;
+        // height:130rpx;
         image {
           width: 94rpx;
         }
+
+        .black-btn{
+          width: 100%;
+          height: 80rpx;
+          line-height: 80rpx;
+          background: #333333;
+          box-shadow: 0px 4rpx 20rpx rgba(160, 126, 84, 0.25);
+          border-radius: 40rpx;
+          color: #E3B377;
+          text-align: center;
+          font-size: 32rpx;
+        }
       }
     /*   .record-time {
         justify-self: flex-end;

+ 117 - 4
pages-question/hasQuestion.vue

@@ -1,5 +1,7 @@
 <template>
   <view class="hasquestion-wrap">
+    <van-cell title="所属品种" :value="varietyVal||'请选择问题所属品种'" is-link @click="showFilter=true"/>
+    <view style="padding:34rpx">
     <view class="title">问题描述<van-icon @click="showHint" coloe="rgba(0, 0, 0, 0.2)" name="question" />
       <view class="hint" v-if="hintShow">实际发布的问题会以提炼出的精简内容为准</view>
     </view>
@@ -14,20 +16,57 @@
     <view class="btn-wrap">
       <view class="btn" :class="{'active':textlength>0}" @click="handleClick">完成</view> 
     </view>
+    </view>
+
+    <!-- 选择品种 -->
+    <van-popup 
+      :show="showFilter" 
+      position="bottom" 
+      closeable 
+      :close-on-click-overlay="true"
+      @close="showFilter = false"
+      round
+    >
+      <view class="fliter-wrap-list">
+        <view class="flex top">
+          <text style="color:#000">选择所属品种</text>
+        </view>
+        <van-tree-select
+          :items="options"
+          :main-active-index="mainActiveIndex"
+          :active-id="activeId"
+          @click-nav="onClickNav"
+          @click-item="onClickItem"
+          main-active-class="main-active-class"
+          content-active-class="content-active-class"
+        />
+      </view>
+    </van-popup>
   </view>
 </template>
 
 <script>
 import {apiPubAsk} from '@/api/question.js'
+import {apiGetTagTree} from '@/api/common'
 export default {
   data() {
     return {
       text:'',
       textlength:0,
-      maxlength:50,
-      hintShow:false
+      maxlength:40,
+      hintShow:false,
+      
+
+      showFilter:false,
+      options:[],
+      mainActiveIndex:0,
+      activeId:0,//选择的品种id
+      varietyVal:'',
     };
   },
+  onLoad(){
+    this.getOptionsList()
+  },
   methods: {
     async handleClick(){
       if(!this.textlength){
@@ -37,6 +76,13 @@ export default {
         })
         return
       }
+      if(!this.activeId){
+        uni.showToast({
+          title: '请选择问题所属品种',
+          icon: 'none',
+        })
+        return
+      }
       const res = await apiPubAsk({
         question_content:this.text
       })
@@ -62,7 +108,48 @@ export default {
      setTimeout(()=>{
        this.hintShow = false
      },1000)
-    }
+    },
+
+    //获取品种筛选
+    async getOptionsList(){
+      const res = await apiGetTagTree()
+			if(res.code===200){
+				const arr = res.data||[]
+        this.options=arr.map(item=>{
+          let obj={
+              text:'',
+              children:[]
+          }
+          obj.text=item.classify_name
+          obj.children=item.tags.map(_item=>{
+            return {
+              text:_item.tag_name,
+              id:_item.tag_id
+            }
+          })
+          return obj
+        })
+
+			}
+    },
+    onClickNav({detail}){
+      console.log(detail);
+      this.mainActiveIndex=detail.index
+    },
+
+    onClickItem({detail}){
+      console.log(detail);
+      if(this.activeId==detail.id){
+        this.activeId=0
+        this.varietyVal=''
+      }else{
+        this.activeId=detail.id
+        this.varietyVal=detail.text
+      }
+      this.showFilter=false
+    },
+
+
   },
 };
 </script>
@@ -73,11 +160,37 @@ export default {
       color:rgba(0, 0, 0, 0.2);
     }
   }
+  .van-cell{
+    border-bottom: 1px solid #e5e5e5;
+  }
+  .fliter-wrap-list{
+        background-color: #fff;
+        padding-top: 28rpx;
+        padding-bottom: 100rpx;
+        .top{
+            font-size: 32rpx;
+            justify-content: center;
+            margin-bottom: 40rpx;
+            padding: 0 34rpx;
+            position: relative;
+        }
+        .van-sidebar{
+            flex-shrink: 0;
+        }
+        .van-tree-select__content{
+            overflow-x: hidden;
+        }
+        .main-active-class{
+            border-color: #E3B377;
+        }
+        .content-active-class{
+            color: #E3B377;
+        }
+  }
 }
 </style>
 <style scoped lang="scss">
 .hasquestion-wrap{
-  padding:40rpx 34rpx;
   .title{
     margin-bottom: 20rpx;
     font-size: 32rpx;