question.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view class="question-wrap">
  3. <view class="question-top">
  4. <view @click="showPopup" v-if="userInfo.is_inner===1||userInfo.status&&!noAuth.includes(userInfo.status)"
  5. style="display:flex;align-items: center;margin-left:30rpx;">
  6. <image src="../../static/question/select.png" mode="widthFix" class="menu-icon"/>
  7. <text style="color:#E3B377;font-size:28rpx;">筛选</text>
  8. </view>
  9. <van-popup :show="isPopupShow" position="left" :close-on-click-overlay="true"
  10. @close="isPopupShow = false"
  11. custom-style="height: 100%;width:50%;"
  12. @touchmove.stop.prevent>
  13. <view class="pop-wrap">
  14. <view class="pop-option-list">
  15. <van-collapse :value="activeName" @change="changeSelecOption" accordion :border="false">
  16. <van-collapse-item :border="false" :title="item.ClassifyName" :name="index" v-for="(item, index) in optionList"
  17. :key="index">
  18. <view class="option-btn-wrap">
  19. <view class="option-btn"
  20. v-for=" i in item.Items" :key="i.PermissionId"
  21. @click="handleOptionClick(i)"
  22. :class="{'active':selectName===i.PermissionName,'full':i.PermissionName.length>4}"
  23. >
  24. {{ i.PermissionName }}
  25. </view>
  26. </view>
  27. </van-collapse-item>
  28. </van-collapse>
  29. </view>
  30. </view>
  31. </van-popup>
  32. </view>
  33. <view class="report-empty-box" v-if="questionList.length==0">
  34. <image :src="globalImgUrls.activityNoAuth" mode="widthFix" style="width:100%;"/>
  35. <view>暂无提问<text v-if="userInfo.is_inner!==1">,快试试提问功能吧</text></view>
  36. </view>
  37. <view class="question-list" :class="{'last':finished}">
  38. <view class="question-item" v-for="item in questionList" :key="item.community_question_id">
  39. <view class="question-info">
  40. <view style="flex:1;" class="question-title">
  41. <text class="item-label">{{item.chart_permission_name}}</text>
  42. <!-- <text class="item-title"> -->{{ item.question_content }}<!-- </text> -->
  43. </view>
  44. <view class="item-answer">
  45. <view class="answer" @click="handleAudio(item)">
  46. <template v-if="!item.loading">
  47. <image class="music-img" :src="item.answer.isplay?playImgSrc:pauseImgSrc" mode="widthFix"/>
  48. <template v-if="item.answer.isplay || item.answer.ispause">
  49. <text>{{
  50. item.answer.audioTime - currentAudioMsg.audioCurrentTime>0?
  51. moment(item.answer.audioTime - currentAudioMsg.audioCurrentTime).format('mm:ss')
  52. :'00:00'}}
  53. </text>
  54. </template>
  55. <template v-else>
  56. <text>{{ moment(item.answer.audioTime).format('mm:ss') }}</text>
  57. </template>
  58. </template>
  59. <template v-else>
  60. <image class="load-img" src="../../static/loading.png" mode="aspectFill" />
  61. <text>{{ moment(item.answer.audioTime).format('mm:ss') }}</text>
  62. </template>
  63. </view>
  64. </view>
  65. </view>
  66. <text class="item-time">提问时间:{{ item.create_time }}</text>
  67. </view>
  68. </view>
  69. <view class="topage-btn" @click="toPage" v-if="userInfo.is_inner===1||userInfo.status&&!noAuth.includes(userInfo.status)">
  70. <image
  71. v-if=" userInfo.is_inner!==1"
  72. src="../../static/question/askquestion.png"
  73. mode="scaleToFill"
  74. style="width:34rpx;height:34rpx;"
  75. />
  76. {{ userInfo.is_inner===1 ? '待回答' : '我要提问' }} <text v-if="userInfo.is_inner===1" style="margin-left:5rpx;">{{'('+waitNum+')'}}</text>
  77. </view>
  78. <!-- 弹窗 -->
  79. <van-popup :show="pupData.show" round @close="pupData.show = false" closeable :close-on-click-overlay="false">
  80. <view class="global-pup">
  81. <view class="content">
  82. <rich-text style="flex:none;margin-bottom:20rpx;" :nodes="pupData.content"></rich-text>
  83. <view class="contact" v-if="pupData.type == 'contact'">
  84. {{pupData.saleName||''}}:<text @click="handleCallPhone(pupData.mobile)">{{pupData.mobile||''}}</text>
  85. </view>
  86. <view class="apply" v-else-if="pupData.type == 'apply'">
  87. <view @click="handleApply">立即申请</view>
  88. </view>
  89. </view>
  90. </view>
  91. </van-popup>
  92. </view>
  93. </template>
  94. <script>
  95. import mixin from "../../mixin/questionMixin";
  96. import {apiOptionList,apiBarTotal} from '@/api/question'
  97. export default {
  98. mixins: [mixin],
  99. data() {
  100. return {
  101. questionList: [],
  102. isPopupShow: false,//弹出层是否展示
  103. optionList: [],
  104. activeNames: [],//collapse
  105. activeName:'',
  106. selectName:'',
  107. pauseImgSrc:'../../static/question/recordplay.png',
  108. playImgSrc:'../../static/question/recordpause.png',
  109. noAuth:['潜在','流失','冻结客户','暂停试用'],
  110. waitNum:0
  111. }
  112. },
  113. watch:{
  114. selectName(){
  115. this.getQuestionList(3)
  116. }
  117. },
  118. onLoad() {
  119. /* this.getVistor()
  120. this.getOptionList()
  121. this.getQuestionList(3) */
  122. },
  123. onShow() {
  124. this.getWaitNum()
  125. this.getOptionList()
  126. this.getQuestionList(3)
  127. },
  128. onReachBottom() {
  129. if(this.finished) return
  130. this.page++
  131. this.getQuestionList(3)
  132. },
  133. methods: {
  134. //获取研究员问答列表数量统计
  135. getWaitNum() {
  136. if(this.userInfo.is_inner!==1) return
  137. //如果是研究员,则请求问答列表数量统计
  138. apiBarTotal().then(res=>{
  139. if(res.code===200){
  140. this.waitNum = res.data.wait
  141. }
  142. })
  143. },
  144. //获取筛选列表
  145. async getOptionList(){
  146. const res = await apiOptionList()
  147. if(res.code===200){
  148. this.optionList = res.data
  149. }
  150. },
  151. //点击筛选
  152. showPopup() {
  153. this.isPopupShow = true
  154. },
  155. //点击一级分类
  156. changeSelecOption(e) {
  157. this.activeName = e.detail
  158. },
  159. //点击二级分类
  160. handleOptionClick(item){
  161. //重复点击代表取消
  162. if(this.selectId===item.PermissionId){
  163. this.selectId=-1
  164. this.selectName=''
  165. }else{
  166. this.selectId = item.PermissionId
  167. this.selectName = item.PermissionName
  168. }
  169. this.page = 1
  170. this.isPopupShow = false
  171. },
  172. //点击'我要提问' or '待回答'
  173. toPage() {
  174. const {is_inner} = userInfo
  175. if (is_inner === 1) {
  176. uni.navigateTo({ url: '/pages-question/answerList' })
  177. } else {
  178. uni.navigateTo({ url: '/pages-question/hasQuestion' })
  179. }
  180. }
  181. }
  182. }
  183. </script>
  184. <style lang="scss">
  185. .question-wrap {
  186. .van-popup--bottom{
  187. padding-bottom: 0 !important;
  188. }
  189. /deep/ .van-cell__title,
  190. .van-cell__value {
  191. flex: none !important;
  192. }
  193. .van-collapse-item{
  194. &.van-hairline--top{
  195. &::after{
  196. border: none !important;
  197. }
  198. }
  199. .van-cell{
  200. padding-left:0 !important;
  201. }
  202. }
  203. .van-collapse-item__content{
  204. padding:0;
  205. }
  206. }
  207. page {
  208. padding-bottom: env(safe-area-inset-bottom);
  209. }
  210. </style>
  211. <style lang="scss" scoped>
  212. .question-wrap {
  213. padding: 0 30rpx 80rpx 30rpx;
  214. background-color: #FFFFFF;
  215. .question-top {
  216. display: flex;
  217. flex: auto;
  218. align-items: center;
  219. height: 100rpx;
  220. background-color: white;
  221. position: sticky;
  222. top: 0;
  223. left: 0;
  224. margin:0 -30rpx;
  225. z-index: 99;
  226. border-top: 1rpx solid rgba(0, 0, 0, 0.1);
  227. .text{
  228. width:240rpx;
  229. height:70rpx;
  230. line-height: 70rpx;
  231. background-color: #F5F5F5;
  232. border-radius: 4rpx;
  233. color:#666666;
  234. text-align: center;
  235. &.active{
  236. color:#E3B377;
  237. background-color: #FDF8F2;
  238. }
  239. }
  240. .auth-box {
  241. flex: 1;
  242. }
  243. .menu-icon {
  244. width: 34rpx;
  245. height:34rpx;
  246. }
  247. .pop-wrap{
  248. height: 100%;
  249. padding: 50rpx 34rpx;
  250. .pop-option-list {
  251. .option-btn-wrap {
  252. display: flex;
  253. justify-content: space-between;
  254. flex-wrap: wrap;
  255. margin-bottom: 20rpx;
  256. .option-btn {
  257. min-width: 145rpx;
  258. height:76rpx;
  259. line-height: 76rpx;
  260. text-align: center;
  261. color: black;
  262. background-color: #F6F6F6;
  263. border-radius: 4rpx;
  264. margin-top: 10rpx;
  265. &.active{
  266. background-color: #FAEEDE;
  267. }
  268. &.full{
  269. width:100%;
  270. }
  271. }
  272. }
  273. }
  274. .pop-btn{
  275. height:80rpx;
  276. margin:0 -34rpx;
  277. text-align: center;
  278. line-height: 80rpx;
  279. color:#FFFFFF;
  280. background-color: #E6B77D;
  281. }
  282. }
  283. }
  284. .question-list {
  285. padding-bottom: 34rpx;
  286. &.last{
  287. padding-bottom: 260rpx;
  288. }
  289. }
  290. .topage-btn {
  291. position: fixed;
  292. left:50%;
  293. margin-left: -257rpx;
  294. bottom: 215rpx;
  295. width:514rpx;
  296. height: 80rpx;
  297. text-align: center;
  298. line-height: 80rpx;
  299. border-radius: 40rpx;
  300. background-color: #333333;
  301. box-shadow: 0px 4px 20px 1px rgba(160, 126, 84, 0.25);
  302. color: #E3B377;
  303. display: flex;
  304. justify-content: center;
  305. align-items: center;
  306. image{
  307. margin-right: 10rpx;
  308. margin-top: -2rpx;
  309. }
  310. }
  311. .global-pup{
  312. .content{
  313. padding:90rpx 34rpx;
  314. flex-direction: column;
  315. .contact{
  316. text{
  317. margin-left: 15rpx;
  318. color:#E6B77D;
  319. }
  320. }
  321. .apply{
  322. margin-top: 40rpx;
  323. width:390rpx;
  324. height:80rpx;
  325. background-color: #E6B77D;
  326. color: #FFFFFF;
  327. text-align: center;
  328. line-height: 80rpx;
  329. border-radius: 40rpx;
  330. }
  331. }
  332. }
  333. }
  334. </style>