Browse Source

我的问答页面及接口调试

cxmo 2 years ago
parent
commit
96b87b637f

+ 8 - 1
api/question.js

@@ -4,7 +4,7 @@ import { httpGet, httpPost } from "@/utils/request.js";
 /**
  * 问答列表
  * @param chart_permission_id
- * @param reply_status
+ * @param reply_status 0-全部 2-待回答 3-已回答
  */
  export const apiQuestionList=params=>{
     return httpGet('/community/question/list',params)
@@ -17,7 +17,14 @@ import { httpGet, httpPost } from "@/utils/request.js";
 }
 /**
  * 发布提问
+ * @param question_content
  */
  export const apiPubAsk=params=>{
     return httpPost('/community/question/ask',params)
 }
+/**
+ * 问答列表数量统计
+ */
+ export const apiBarTotal=params=>{
+    return httpGet('/community/question/list/total',params)
+}

+ 176 - 4
mixin/questionMixin.js

@@ -1,13 +1,32 @@
-/* 问答社区 音频播放公共逻辑 */
+/* 问答社区 公共逻辑 */
+import {
+    apiQuestionList
+} from '@/api/question'
+import { apiApplyPermission, apiUserInfo } from '@/api/user'
+const moment = require('@/utils/moment-with-locales.min')
+moment.locale('zh-cn');
 export default {
     data() {
         return {
+            moment: moment,
+            innerAudio: null, //该页面的音频
             currentAudioMsg: {
                 id: '',
                 audioCurrentTime: 0, //音频播放实时时间
                 audioTime: 0, //当前音频时间
                 audioCurrentUrl: '', //当前音频地址
             }, //当前正在播放音频的一些信息
+            pupData: {
+                show: false,
+                content: '', //弹窗html字符串
+                type: '',
+                mobile: "",
+                customer_info: {}
+            },
+            page: 1,
+            pageSize: 20,
+            finished: false,
+            selectId: -1,
         }
     },
     onLoad() {
@@ -32,18 +51,26 @@ export default {
         handleAudioFun() {
             this.innerAudio.onPlay(() => {
                 console.log('开始了')
+                this.questionList.map(i => {
+                    if (i.id === this.currentAudioMsg.id) {
+                        i.loading = false
+                    }
+                })
             })
             this.innerAudio.onTimeUpdate(() => {
                 //console.log('时间更新')
-                this.currentAudioMsg.audioCurrentTime = moment(this.innerAudio.currentTime * 1000).format('mm:ss')
+                this.currentAudioMsg.audioCurrentTime = this.innerAudio.currentTime * 1000
                 //console.log('duration',this.innerAudio.duration)
             })
+            this.innerAudio.onPause(() => {
+                console.log("暂停");
+            })
             this.innerAudio.onEnded(() => {
                 console.log('音频播放完毕')
                 const {
                     id
                 } = this.currentAudioMsg
-                this.quesionList.map(i => {
+                this.questionList.map(i => {
                     if (i.id === id) {
                         i.answer.isplay = false
                         i.answer.ispause = false
@@ -75,10 +102,155 @@ export default {
             } = item.answer
             this.currentAudioMsg = {
                 id: id,
-                audioCurrentTime: 0,
+                audioCurrentTime: 0 * 1000,
                 audioTime: audioTime,
                 audioCurrentUrl: source
             }
+            this.questionList.map(i => {
+                if (i.id === item.id) {
+                    i.loading = true
+                }
+            })
+        },
+        //获取问答列表
+        async getQuestionList(status) {
+            let questionData = []
+            const res = await apiQuestionList({
+                page_index: this.page,
+                page_size: this.pageSize,
+                chart_permission_id: this.selectId === -1 ? '' : this.selectId,
+                reply_status: status
+            })
+            if (res.code === 200) {
+                if (res.data) {
+                    questionData = res.data
+                } else {
+                    this.finished = true
+                }
+            }
+            let tempArr = []
+            questionData.forEach(item => {
+                let temp = item
+                let audio_url = '',
+                    audio_play_seconds = 0;
+                //问题状态为已回答,取audio_list第一项为音频
+                if (status === 3) {
+                    audio_url = item.audio_list[0].audio_url
+                    audio_play_seconds = item.audio_list[0].audio_play_seconds
+                }
+                //问题状态不为已回答,取默认值
+                temp.answer = {
+                    source: audio_url,
+                    audioTime: parseInt(audio_play_seconds) * 1000,
+                    isplay: false,
+                    ispause: false
+                }
+                temp.id = item.community_question_id
+                temp.loading = false
+                tempArr.push(temp)
+            })
+            if (this.page > 1) {
+                this.questionList = this.questionList.concat(tempArr)
+            } else {
+                this.questionList = tempArr
+            }
+
+        },
+        //点击某条音频
+        handleAudio(item) {
+            //如果没有权限,弹窗并return
+            if (!item.auth_ok) {
+            	this.initPupData(item)
+            	return
+            }
+            const {
+                source,
+                isplay
+            } = item.answer
+            if (isplay) {
+                //说明是播放->暂停
+                this.innerAudio.pause()
+            } else if (item.id === this.currentAudioMsg.id) {
+                //说明是暂停->播放
+                this.innerAudio.play()
+            } else {
+                console.log('aaa', source, this.innerAudio.src)
+                //说明是第一次播放或点击其他播放项
+                this.changeCurrentAudio(item)
+                this.innerAudio.stop()
+                this.innerAudio.src = source
+                /* this.innerAudio.play() */
+                this.handleAudioPlay()
+
+            }
+            this.questionList.map((i) => {
+                if (i.id === item.id) {
+                    if (i.answer.isplay) {
+                        i.answer.ispause = true
+                    }
+                    i.answer.isplay = !i.answer.isplay
+                } else {
+                    i.answer.isplay = false
+                    i.answer.ispause = false
+                    i.loading = false
+                }
+            })
+        },
+        //初始化无权限弹窗
+        initPupData(item) {
+            let str = '<p>您暂无权限查看语音回复</p>'
+            const {
+                type,
+                mobile,
+                name,
+                customer_info
+            } = item.permission_info
+            if (type === 'apply') {
+                this.pupData.type = 'apply'
+                str += '<p>若想查看可以申请开通</p>'
+            }
+            if (type === 'contact') {
+                this.pupData.mobile = mobile + ''
+                this.pupData.saleName = name
+                this.pupData.type = 'contact'
+                str += `<p>若想查看可以联系对口销售</p>`
+            }
+            this.pupData.customer_info = customer_info
+            this.pupData.content = str
+            this.pupData.show = true
+        },
+        //拨号
+        handleCallPhone(tel) {
+            uni.makePhoneCall({
+                phoneNumber: tel ? tel : '123456',
+                success: () => {
+                    this.pupData.show = false
+                }
+            });
+        },
+        //申请权限
+        async handleApply() {
+            if (this.pupData.customer_info.has_apply) { //已经申请过
+                this.pupData.content = `<p>您已提交过申请,请耐心等待</p>`
+                this.pupData.type = ''
+            } else {
+                if (!this.pupData.customer_info.status || this.pupData.customer_info.status != '流失') {
+                    uni.navigateTo({
+                        url: "/pages-applyPermission/applyPermission?source=5"
+                    })
+                } else { //主动调一次申请权限接口 
+                    const res = await apiApplyPermission({
+                        company_name: this.pupData.customer_info.company_name,
+                        real_name: this.pupData.customer_info.name,
+                        source: 2,
+                        from_page: '活动列表'
+                    })
+                    if (res.code === 200) {}
+                    this.pupData.content = `<p>申请已提交</p><p>请等待销售人员与您联系</p>`
+                    this.pupData.type = ''
+
+                }
+            }
         },
     }
 }

+ 2 - 3
pages-question/answerDetail.vue

@@ -41,8 +41,7 @@ export default {
 		this.initAudio()
 	},
 	onUnload(){
-		//this.destoryAudio()
-        //uni.reLaunch({ url: '/pages/question/question' })
+		this.destoryAudio()
 	},
     methods: {
         //初始化audio
@@ -54,7 +53,7 @@ export default {
 		//销毁audio
 		destoryAudio() {
 			if (this.innerAudio) {
-				this.innerAudio.destory()
+				this.innerAudio.destroy()
 			}
 		},
         handleAudioFun(){

+ 226 - 167
pages-question/answerList.vue

@@ -11,173 +11,189 @@
       >
     </view>
     <view class="answer-list">
-      <view class="answer-item" v-for="item in questionList" :key="item.id">
-        <view style="display: flex">
-          <text class="item-label" v-if="vistor.type===1||item.status===2">{{ item.label }}</text>
-          <text class="item-title">{{ item.text }}</text>
-        </view>
-        <text class="item-time"> 提问时间:{{ item.time }} </text>
-        <view class="item-answer">
-          <template v-if="item.status === 2">
-            <view class="answer" @click="handleAudio(item)">
-              <text>{{ item.answer.isplay ? "暂停" : "播放" }}</text>
-              <template v-if="item.answer.isplay || item.answer.ispause">
-                <text
-                  >{{ currentAudioMsg.audioCurrentTime }}/{{
-                    item.answer.audioTime
-                  }}</text
-                >
+      <view class="report-empty-box" v-if="questionList.length == 0">
+        <image :src="globalImgUrls.activityNoAuth" mode="widthFix" />
+        <view>暂无数据</view>
+      </view>
+      <view
+        class="question-item"
+        v-for="item in questionList"
+        :key="item.community_question_id"
+        @click="toDetail(item)"
+      >
+        <view class="question-info">
+          <view style="flex: 1" class="question-title">
+            <text
+              class="item-label"
+              v-if="visitor.type === 1 || item.reply_status === 3"
+              >{{ item.chart_permission_name }}</text
+            >
+            {{ item.question_content }}
+          </view>
+          <view class="item-answer" v-if="item.reply_status === 3">
+            <view class="answer" @click.stop="handleAudio(item)">
+              <template v-if="!item.loading">
+                <image
+                  class="music-img"
+                  :src="item.answer.isplay ? playImgSrc : pauseImgSrc"
+                  mode="aspectFill"
+                />
+                <template v-if="item.answer.isplay || item.answer.ispause">
+                  <text>{{
+                    moment(
+                      item.answer.audioTime - currentAudioMsg.audioCurrentTime
+                    ).format("mm:ss")
+                  }}</text>
+                </template>
+                <template v-else>
+                  <text>{{
+                    moment(item.answer.audioTime).format("mm:ss")
+                  }}</text>
+                </template>
               </template>
               <template v-else>
-                <text>{{ item.answer.audioTime }}</text>
+                <image
+                  class="load-img"
+                  src="../static/loading.png"
+                  mode="aspectFill"
+                />
+                <text>{{ moment(item.answer.audioTime).format("mm:ss") }}</text>
               </template>
             </view>
-          </template>
-          <template v-else>
-            <view class="noanswer">
-              <!-- 提问者 -->
-              <text v-if="vistor.type === 2"
-                >暂无回复,研究员正在快马加鞭的赶来</text
-              >
-              <!-- 回答者 -->
-              <view v-else
-                >暂无回复,<text class="url" @click="toDetail(item)">立即回复</text></view>
-            </view>
-          </template>
+          </view>
         </view>
-       <!--  <view class="item-type" @click="toDetail(item)">
-                        {{item.type===1?'去回答':'查看'}}
-        </view> -->
+        <text class="item-time">提问时间:{{ item.create_time }}</text>
       </view>
     </view>
+    <!-- 弹窗 -->
+    <van-popup
+      :show="pupData.show"
+      round
+      @close="pupData.show = false"
+      closeable
+      :close-on-click-overlay="false"
+    >
+      <view class="global-pup">
+        <view class="content">
+          <rich-text
+            style="flex: none; margin-bottom: 20rpx"
+            :nodes="pupData.content"
+          ></rich-text>
+          <view class="contact" v-if="pupData.type === 'contact'">
+            {{ pupData.saleName || "梁娜" }}:<text
+              @click="handleCallPhone(pupData.mobile)"
+              >{{ pupData.mobile || "123456" }}</text
+            >
+          </view>
+          <view class="apply" v-else-if="pupData.type == 'apply'">
+            <view @click="handleApply">立即申请</view>
+          </view>
+        </view>
+      </view>
+    </van-popup>
   </view>
 </template>
 <script>
 import mixin from "../mixin/questionMixin";
-const moment = require("@/utils/moment-with-locales.min");
-moment.locale("zh-cn");
+import { apiBarTotal } from "@/api/question.js";
 export default {
   mixins: [mixin],
   data() {
     return {
       questionList: [],
-      mockwaitList: [
-        {
-          id: 1, //问题id
-          text: "疫情下全球苯乙烯市场有什么动荡和影响?", //问题描述
-          time: "2022.5.23 14:40", //提问时间
-          status: 1, //问题状态:1待回答,2已回答
-          answer: {
-            source: "", // 回答音频
-            time: "", //回答时间
-            audioTime: 0, //音频长度,单位秒
-            isplay: false,
-            ispause: false,
-          },
-          label: "苯乙烯", // 问题分类
-        },
-      ], //待回答的问题
-      mockrepliedList: [
-        {
-          id: 1, //问题id
-          text: "疫情下全球苯乙烯市场有什么动荡和影响?", //问题描述
-          time: "2022.5.23 14:40", //提问时间
-          status: 2, //问题状态:1待回答,2已回答
-          answer: {
-            source:
-              "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3", // 回答音频
-            time: "2022.5.23 15:40", //回答时间
-            audioTime: moment(21 * 1000).format("mm:ss"), //音频长度,单位秒
-            isplay: false,
-            ispause: false,
-          },
-          label: "苯乙烯", // 问题分类
-        },
-      ], //已回答的问题
-      barList: [
-        {
-          label: "待回答",
-          key: "Wait",
-          num: 1,
-        },
-        {
-          label: "已回答",
-          key: "Replied",
-          num: 1,
-        },
-        {
-          label: "全部",
-          key: "Total",
-          num: 2,
-        },
-      ],
+      barList: [],
       selectKey: "Wait",
-      Wait: 1,
-      Replied: 1,
-      Total: 2,
-      vistor: {
-        type: 1, //1研究员,2客户
+      visitor: {
+        type: 2, //1研究员,2客户
       },
+      pauseImgSrc: "../static/audio-pause-2.png",
+      playImgSrc: "../static/audio-doing.png",
     };
   },
   onLoad() {
+    this.getVisitor();
+    this.getBarList();
+    this.getQuestionData();
+  },
+  onReachBottom() {
+    if (this.finished) return;
+    this.page++;
     this.getQuestionData();
   },
   methods: {
     toDetail(item) {
-      uni.navigateTo({ url: "/pages-question/answerDetail" });
+      //reply_status:1-待分配 2-待回答 3-已回答
+      if (this.visitor.type === 1 && item.reply_status === 2) {
+        uni.navigateTo({ url: "/pages-question/answerDetail?id=" + item.id });
+      }
     },
     //点击bar
     changeBar({ key }) {
       if (key === this.selectKey) return;
       this.selectKey = key;
+      this.questionList = [];
+      this.page = 1;
       this.getQuestionData();
     },
-    getQuestionData() {
-      if (this.selectKey === "Wait") {
-        this.questionList = this.mockwaitList;
-      } else if (this.selectKey === "Replied") {
-        this.questionList = this.mockrepliedList;
-      } else {
-        this.questionList = this.mockwaitList.concat(this.mockrepliedList);
+    getVisitor() {
+      if(this.visitor.type===1){
+        this.selectKey = 'Wait'
+      }else{
+        this.selectKey = 'Replied'
       }
     },
-    //点击某条音频
-    handleAudio(item) {
-      const { source, isplay } = item.answer;
-      if (isplay) {
-        //说明是播放->暂停
-        this.innerAudio.pause();
-      } else if (item.id === this.currentAudioMsg.id) {
-        //说明是暂停->播放
-        this.innerAudio.play();
-      } else {
-        console.log("aaa", source, this.innerAudio.src);
-        //说明是第一次播放或点击其他播放项
-        this.changeCurrentAudio(item);
-        this.innerAudio.stop();
-        this.innerAudio.src = source;
-        /* this.innerAudio.play() */
-        this.handleAudioPlay();
-      }
-      this.quesionList.map((i) => {
-        if (i.id === item.id) {
-          if (i.answer.isplay) {
-            i.answer.ispause = true;
-          }
-          i.answer.isplay = !i.answer.isplay;
-        } else {
-          i.answer.isplay = false;
-          i.answer.ispause = false;
-        }
-      });
+    async getBarList() {
+      const res = await apiBarTotal();
+      if (res.code !== 200) return;
+      const { replied, wait, total } = res.data;
+      //客户: 已回答 未回答 全部
+      const customBar = [
+        {
+          label: "已回答",
+          key: "Replied",
+          num: replied,
+        },
+        {
+          label: "未回答",
+          key: "Wait",
+          num: wait,
+        },
+        {
+          label: "全部",
+          key: "Total",
+          num: total,
+        },
+      ];
+      //研究员: 待回答 已回答 全部
+      const researBar = [
+        {
+          label: "待回答",
+          key: "Wait",
+          num: wait,
+        },
+        {
+          label: "已回答",
+          key: "Replied",
+          num: replied,
+        },
+        {
+          label: "全部",
+          key: "Total",
+          num: total,
+        },
+      ];
+      this.barList = this.visitor.type === 2 ? customBar : researBar;
+    },
+    getQuestionData() {
+      const reply_status = { Wait: 2, Replied: 3, Total: 0 };
+      this.getQuestionList(reply_status[this.selectKey]);
     },
   },
 };
 </script>
 <style lang="scss" scoped>
 .answer-page {
-  padding: 35rpx;
+  padding: 30rpx;
   .answer-bar {
     display: flex;
     justify-content: space-between;
@@ -196,21 +212,71 @@ export default {
   }
   .answer-list {
     margin-top: 20rpx;
-    .answer-item {
+    .question-item {
       margin-bottom: 20rpx;
-      .item-label {
-        width: 90rpx;
-        height: 41rpx;
-        font-size: 24rpx;
-        text-align: center;
-        line-height: 41rpx;
-        background-color: #333333;
-        color: #e4b478;
-      }
-      .item-title {
+      &::after {
+        content: "";
         display: block;
-        font-size: 32rpx;
-        color: #333333;
+        height: 10rpx;
+        margin: 0 -30rpx;
+        background-color: #f9f9f9;
+      }
+      &:last-child {
+        &::after {
+          background-color: #ffffff;
+        }
+      }
+      .question-info {
+        display: flex;
+        padding: 10rpx 0;
+        .question-title {
+          font-size: 32rpx;
+          color: #333333;
+          .item-label {
+            padding: 7rpx 12rpx;
+            font-size: 22rpx;
+            text-align: center;
+            background-color: #333333;
+            color: #e4b478;
+            border-radius: 21rpx;
+            margin-right: 15rpx;
+          }
+        }
+        .item-answer {
+          display: flex;
+          align-items: center;
+          .answer {
+            width: 150rpx;
+            height: 97rpx;
+            box-sizing: border-box;
+            padding: 30rpx 15rpx;
+            border-radius: 18rpx;
+            background: linear-gradient(253deg, #e3b377 0%, #fbca8e 100%);
+            display: flex;
+            justify-content: space-between;
+            color: #ffffff;
+            font-size: 24rpx;
+            .load-img {
+              width: 34rpx;
+              height: 34rpx;
+              margin-right: 10rpx;
+              animation: circle 1s linear infinite;
+            }
+            .music-img {
+              width: 34rpx;
+              height: 34rpx;
+              margin-right: 10rpx;
+            }
+            @keyframes circle {
+              0% {
+                transform: rotateZ(0);
+              }
+              100% {
+                transform: rotateZ(360deg);
+              }
+            }
+          }
+        }
       }
       .item-time {
         color: #999999;
@@ -218,35 +284,28 @@ export default {
         margin: 20rpx 0;
         display: block;
       }
-      .item-answer {
-        display: flex;
-        width: 100%;
-        box-sizing: border-box;
-        padding: 20rpx;
-        align-items: center;
-        .answer {
-          width: 340rpx;
-          height: 74rpx;
-          box-sizing: border-box;
-          padding: 20rpx 30rpx;
-          border-radius: 37rpx;
-          background: linear-gradient(253deg, #e3b377 0%, #fbca8e 100%);
-          display: flex;
-          justify-content: space-between;
-          color: #ffffff;
-        }
-        .noanswer{
-            width:100%;
-            height:145rpx;
-            text-align: center;
-            line-height: 145rpx;
-            background-color: #F5F5F5;
-            color: #666666;
-            .url{
-                color: #E3B377;
-            }
+    }
+  }
+  .global-pup {
+    .content {
+      padding: 90rpx 34rpx;
+      flex-direction: column;
+      .contact {
+        text {
+          margin-left: 15rpx;
+          color: #e6b77d;
         }
       }
+      .apply {
+        margin-top: 40rpx;
+        width: 390rpx;
+        height: 80rpx;
+        background-color: #e6b77d;
+        color: #ffffff;
+        text-align: center;
+        line-height: 80rpx;
+        border-radius: 40rpx;
+      }
     }
   }
 }

+ 3 - 1
pages-question/questionDetail.vue

@@ -1,5 +1,7 @@
 <template>
-  
+  <view class="detail-wrap">
+      提问者看到的问答详情
+  </view>
 </template>
 
 <script>

+ 7 - 1
pages.json

@@ -208,7 +208,7 @@
 				{
 					"path": "answerList",
 					"style":{
-						"navigationBarTitleText": "问答列表"
+						"navigationBarTitleText": "我的问答"
 					}
 				},
 				{
@@ -217,6 +217,12 @@
 						"navigationBarTitleText": "问答详情"
 					}
 				},
+				{
+					"path": "questionDetail",
+					"style":{
+						"navigationBarTitleText": "问答详情"
+					}
+				},
 				{
 					"path": "hasQuestion",
 					"style":{

+ 16 - 242
pages/question/question.vue

@@ -30,12 +30,12 @@
 				</view>	
 			</van-popup>		
 		</view>
-		<view class="report-empty-box" v-if="quesionList.length==0">
-      		<image :src="globalImgUrls.chartEmpty" mode="widthFix" />
-      		<view>暂无数据</view>
+		<view class="report-empty-box" v-if="questionList.length==0">
+      		<image :src="globalImgUrls.activityNoAuth" mode="widthFix" />
+      		<view>暂无提问<text v-if="visitor.type===2">,快试试提问功能吧</text></view>
     	</view>
 		<view class="question-list">
-			<view class="question-item" v-for="item in quesionList" :key="item.community_question_id">
+			<view class="question-item" v-for="item in questionList" :key="item.community_question_id">
 				<view class="question-info">
 					<view style="flex:1;" class="question-title">
 						<text class="item-label">{{item.chart_permission_name}}</text>
@@ -85,82 +85,46 @@
 </template>
 
 <script>
-import { apiApplyPermission, apiUserInfo } from '@/api/user'
-import {apiQuestionList,apiOptionList} from '@/api/question'
-const moment = require('@/utils/moment-with-locales.min')
-moment.locale('zh-cn');
+import mixin from "../../mixin/questionMixin";
+import {apiOptionList} from '@/api/question'
 export default {
+	mixins: [mixin],
 	data() {
 		return {
-			moment:moment,
-			quesionList: [],
+			questionList: [],
 			isPopupShow: false,//弹出层是否展示
 			optionList: [],
 			activeNames: [],//collapse
 			activeName:'',
-			innerAudio: null,//该页面的音频
 			vistor: {//用户信息
 				type: 1,//1研究员,2客户
 				status: '正式',//type为2的时候才判断
 			},
-			currentAudioMsg: {
-				id: '',
-				audioCurrentTime: 0,//音频播放实时时间
-				audioTime: 0,//当前音频时间
-				audioCurrentUrl: '',//当前音频地址
-			},//当前正在播放音频的一些信息
-			pupData: {
-				show: false,
-				content: '',//弹窗html字符串
-				type: '',
-				mobile: "",
-				customer_info:{}
-			},
-			selectType:'all',
 			selectName:'',
-			selectId:-1,
 			pauseImgSrc:'../../static/audio-pause-2.png',
 			playImgSrc:'../../static/audio-doing.png',
-			page:1,
-      		pageSize:20,
-      		finished:false,
 			noAuth:['潜在','流失','冻结客户','暂停试用']
 		}
 	},
 	watch:{
 		selectName(){
-			this.getQuestionList()
+			this.getQuestionList(3)
 		}
 	},
 	onLoad() {
-		this.initAudio()
 		this.getVistor()
 		this.getOptionList()
-		this.getQuestionList()
+		this.getQuestionList(3)
 	},
 	onShow() {
 		
-	},
-	onUnload() {
-		this.destroyAudio()
 	},
 	onReachBottom() {
 		if(this.finished) return
 		this.page++
-		this.getQuestionList()
+		this.getQuestionList(3)
  	},
 	methods: {
-		//初始化audio
-		initAudio() {
-			this.innerAudio = uni.createInnerAudioContext()
-			this.handleAudioFun()
-		},
-		//销毁audio
-		destroyAudio() {
-			if (this.innerAudio) {
-				this.innerAudio.destroy()
-			}
-		},
 		//获取访客信息:研究员/客户
 		getVistor() {
 			const {userInfo} = this.$store.state.user
@@ -178,169 +142,16 @@ export default {
 			if(res.code===200){
 				this.optionList = res.data
 			}
-		},
-		//获取问题列表
-		async getQuestionList(){
-			let questionData = []
-			const res = await apiQuestionList(
-				{
-					page_index:this.page,
-					page_size:this.pageSize,
-					chart_permission_id:this.selectId===-1?'':this.selectId,
-					reply_status:3
-				}
-			)
-			if(res.code===200){
-				if(res.data){
-					questionData = res.data
-				}else{
-					this.finished = true
-				}
-			}
-			let tempArr = []
-			questionData.forEach(item=>{
-				let temp = item
-				const {audio_url,audio_play_seconds} = item.audio_list[0]
-				temp.answer = {
-					source:audio_url,
-					audioTime:parseInt(audio_play_seconds)*1000,
-					isplay:false,
-					ispause:false
-				}
-				temp.id = item.community_question_id
-				temp.loading = false
-				tempArr.push(temp)
-			})
-			if(this.page>1){
-				this.quesionList = this.quesionList.concat(tempArr)	
-			}else{
-				this.quesionList= tempArr
-			}
-			
-		},
-		//audio事件
-		handleAudioFun() {
-			this.innerAudio.onPlay(() => {
-				console.log('开始了')
-				this.quesionList.map(i=>{
-				if(i.id===this.currentAudioMsg.id){
-					i.loading = false
-				}
-			})
-			})
-			this.innerAudio.onTimeUpdate(() => {
-				//console.log('时间更新')
-				this.currentAudioMsg.audioCurrentTime = this.innerAudio.currentTime * 1000
-				//console.log('duration',this.innerAudio.duration)
-			})
-			this.innerAudio.onPause(() => {
-				console.log("暂停");
-			})
-			this.innerAudio.onEnded(() => {
-				console.log('音频播放完毕')
-				const { id } = this.currentAudioMsg
-				this.quesionList.map(i => {
-					if (i.id === id) {
-						i.answer.isplay = false
-						i.answer.ispause = false
-					}
-				})
-				this.changeCurrentAudio({ id: '', answer: { source: '', audioTime: 0 } })
-			})
-		},
-		//初始化无权限弹窗
-		initPupData(item) {
-			let str = '<p>您暂无权限查看语音回复</p>'
-			const {type,mobile,name,customer_info} = item.permission_info
-			if (type==='apply') {
-				this.pupData.type = 'apply'
-				str += '<p>若想查看可以申请开通</p>'
-			}
-			if (type==='contact') {
-				this.pupData.mobile = mobile+''
-				this.pupData.saleName = name
-				this.pupData.type = 'contact'
-				str += `<p>若想查看可以联系对口销售</p>`
-			}
-			this.pupData.customer_info= customer_info
-			this.pupData.content = str
-			this.pupData.show = true
-		},
-		//拨号
-		handleCallPhone(tel) {
-			uni.makePhoneCall({
-        		phoneNumber: tel?tel:'123456',
-        		success:()=>{
-          			this.pupData.show=false
-        		}
-      		});
-		},
-		//申请权限
-		async handleApply() {
-			if (this.pupData.customer_info.has_apply) {//已经申请过
-				this.pupData.content = `<p>您已提交过申请,请耐心等待</p>`
-				this.pupData.type = ''
-			} else {
-				if (!this.pupData.customer_info.status || this.pupData.customer_info.status != '流失') {
-					uni.navigateTo({
-						url: "/pages-applyPermission/applyPermission?source=5"
-					})
-				} else {//主动调一次申请权限接口 
-					 const res=await apiApplyPermission({
-						 company_name:this.pupData.customer_info.company_name,
-						 real_name:this.pupData.customer_info.name,
-						 source:2,
-						 from_page:'活动列表'
-					 })
-					 if(res.code===200){}
-					this.pupData.content = `<p>申请已提交</p><p>请等待销售人员与您联系</p>`
-					this.pupData.type = ''
-
-				}
-			}
-		},
-		//播放音频
-		handleAudioPlay() {
-			this.innerAudio.onCanplay(() => {
-				this.innerAudio.play()
-				//console.log('音频长度:', this.innerAudio)
-				//this.currentAudioMsg.audioTime = this.innerAudio.duration
-			})
-		},
-		//切换当前播放音频
-		changeCurrentAudio(item) {
-			const { id } = item
-			const { source, audioTime } = item.answer
-			this.currentAudioMsg = {
-				id: id,
-				audioCurrentTime: 0 * 1000,
-				audioTime: audioTime,
-				audioCurrentUrl: source
-			}
-			this.quesionList.map(i=>{
-				if(i.id===item.id){
-					i.loading = true
-				}
-			})
-		},
-		//点击'热门回答'/'只看我的'/筛选弹窗的按钮
-		changeSelect(type) {
-			if(type!=='name'){
-				this.selectType = type
-			}else{
-				this.isPopupShow = false
-			}
-			//getData()
-		},
+		},	
 		//点击筛选
 		showPopup() {
 			this.isPopupShow = true
 		},
-		changeBtnShow() {
-		},
+		//点击一级分类
 		changeSelecOption(e) {
 			this.activeName = e.detail
 		},
+		//点击二级分类
 		handleOptionClick(item){
 			//重复点击代表取消
 			if(this.selectId===item.PermissionId){
@@ -353,44 +164,7 @@ export default {
 			this.page = 1
 			this.isPopupShow = false
 		},
-		//点击某条音频
-		handleAudio(item) {
-			//如果没有权限,弹窗并return
-			if (!item.auth_ok) {
-				this.initPupData(item)
-				return
-			}
-			const { source, isplay } = item.answer
-			if (isplay) {
-				//说明是播放->暂停
-				this.innerAudio.pause()
-			} else if (item.id === this.currentAudioMsg.id) {
-				//说明是暂停->播放
-				this.innerAudio.play()
-			} else {
-				console.log('aaa', source, this.innerAudio.src)
-				//说明是第一次播放或点击其他播放项
-				this.changeCurrentAudio(item)
-				this.innerAudio.stop()
-				this.innerAudio.src = source
-				/* this.innerAudio.play() */
-				this.handleAudioPlay()
-
-			}
-			this.quesionList.map((i) => {
-				if (i.id === item.id) {
-					if (i.answer.isplay) {
-						i.answer.ispause = true
-					}
-					i.answer.isplay = !i.answer.isplay
-				} else {
-					i.answer.isplay = false
-					i.answer.ispause = false
-					i.loading = false
-				}
-			})
-		},
-		//点击'我要提问'/'待回答'
+		//点击'我要提问' or '待回答'
 		toPage(item) {
 			const { type } = item
 			if (type === 1) {
@@ -400,7 +174,6 @@ export default {
 			}
 		}
 	}
-
 }
 </script>
 
@@ -525,6 +298,7 @@ page {
 			}
 			.question-info{
 				display: flex;
+				padding: 10rpx 0;
 				.question-title{
 					font-size: 32rpx;
 					color:#333333;

BIN
static/question/record.png