question.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <view class="question-wrap">
  3. <view class="question-top">
  4. <view @click="showPopup" v-if="vistor.type===1||vistor.status&&!noAuth.includes(vistor.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" />
  35. <view>暂无提问<text v-if="visitor.type===2">,快试试提问功能吧</text></view>
  36. </view>
  37. <view class="question-list">
  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. <!-- <text>{{ item.answer.isplay ? '暂停' : '播放' }}</text> -->
  48. <image class="music-img" :src="item.answer.isplay?playImgSrc:pauseImgSrc" mode="aspectFill"/>
  49. <template v-if="item.answer.isplay || item.answer.ispause">
  50. <!-- <text>{{ currentAudioMsg.audioCurrentTime }}/{{ item.answer.audioTime }}</text> -->
  51. <text>{{moment(item.answer.audioTime - currentAudioMsg.audioCurrentTime).format('mm:ss')}}</text>
  52. </template>
  53. <template v-else>
  54. <text>{{ moment(item.answer.audioTime).format('mm:ss') }}</text>
  55. </template>
  56. </template>
  57. <template v-else>
  58. <image class="load-img" src="../../static/loading.png" mode="aspectFill" />
  59. <text>{{ moment(item.answer.audioTime).format('mm:ss') }}</text>
  60. </template>
  61. </view>
  62. </view>
  63. </view>
  64. <text class="item-time">提问时间:{{ item.create_time }}</text>
  65. </view>
  66. </view>
  67. <view class="topage-btn" @click="toPage(vistor)" v-if="vistor.type===1||vistor.status&&!noAuth.includes(vistor.status)">
  68. {{ vistor.type === 1 ? '待回答' : '我要提问' }}
  69. </view>
  70. <!-- 弹窗 -->
  71. <van-popup :show="pupData.show" round @close="pupData.show = false" closeable :close-on-click-overlay="false">
  72. <view class="global-pup">
  73. <view class="content">
  74. <rich-text style="flex:none;margin-bottom:20rpx;" :nodes="pupData.content"></rich-text>
  75. <view class="contact" v-if="pupData.type == 'contact'">
  76. {{pupData.saleName||'梁娜'}}:<text @click="handleCallPhone(pupData.mobile)">{{pupData.mobile||'123456'}}</text>
  77. </view>
  78. <view class="apply" v-else-if="pupData.type == 'apply'">
  79. <view @click="handleApply">立即申请</view>
  80. </view>
  81. </view>
  82. </view>
  83. </van-popup>
  84. </view>
  85. </template>
  86. <script>
  87. import mixin from "../../mixin/questionMixin";
  88. import {apiOptionList} from '@/api/question'
  89. export default {
  90. mixins: [mixin],
  91. data() {
  92. return {
  93. questionList: [],
  94. isPopupShow: false,//弹出层是否展示
  95. optionList: [],
  96. activeNames: [],//collapse
  97. activeName:'',
  98. vistor: {//用户信息
  99. type: 1,//1研究员,2客户
  100. status: '正式',//type为2的时候才判断
  101. },
  102. selectName:'',
  103. pauseImgSrc:'../../static/audio-pause-2.png',
  104. playImgSrc:'../../static/audio-doing.png',
  105. noAuth:['潜在','流失','冻结客户','暂停试用']
  106. }
  107. },
  108. watch:{
  109. selectName(){
  110. this.getQuestionList(3)
  111. }
  112. },
  113. onLoad() {
  114. this.getVistor()
  115. this.getOptionList()
  116. this.getQuestionList(3)
  117. },
  118. onShow() {
  119. },
  120. onReachBottom() {
  121. if(this.finished) return
  122. this.page++
  123. this.getQuestionList(3)
  124. },
  125. methods: {
  126. //获取访客信息:研究员/客户
  127. getVistor() {
  128. const {userInfo} = this.$store.state.user
  129. //如果用户在ficc研究部下(departmentId:1),则为研究员.其他情况为客户
  130. if(userInfo.admin_info&&userInfo.admin_info.departmentId===1){
  131. this.vistor.type = 1
  132. }else{
  133. this.vistor.type = 2
  134. }
  135. //this.vistor.status = userInfo.status
  136. },
  137. //获取筛选列表
  138. async getOptionList(){
  139. const res = await apiOptionList()
  140. if(res.code===200){
  141. this.optionList = res.data
  142. }
  143. },
  144. //点击筛选
  145. showPopup() {
  146. this.isPopupShow = true
  147. },
  148. //点击一级分类
  149. changeSelecOption(e) {
  150. this.activeName = e.detail
  151. },
  152. //点击二级分类
  153. handleOptionClick(item){
  154. //重复点击代表取消
  155. if(this.selectId===item.PermissionId){
  156. this.selectId=-1
  157. this.selectName=''
  158. }else{
  159. this.selectId = item.PermissionId
  160. this.selectName = item.PermissionName
  161. }
  162. this.page = 1
  163. this.isPopupShow = false
  164. },
  165. //点击'我要提问' or '待回答'
  166. toPage(item) {
  167. const { type } = item
  168. if (type === 1) {
  169. uni.navigateTo({ url: '/pages-question/answerList' })
  170. } else {
  171. uni.navigateTo({ url: '/pages-question/hasQuestion' })
  172. }
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="scss">
  178. .question-wrap {
  179. .van-popup--bottom{
  180. padding-bottom: 0 !important;
  181. }
  182. /deep/ .van-cell__title,
  183. .van-cell__value {
  184. flex: none !important;
  185. }
  186. .van-collapse-item{
  187. &.van-hairline--top{
  188. &::after{
  189. border: none !important;
  190. }
  191. }
  192. .van-cell{
  193. padding-left:0 !important;
  194. }
  195. }
  196. .van-collapse-item__content{
  197. padding:0;
  198. }
  199. }
  200. page {
  201. padding-bottom: env(safe-area-inset-bottom);
  202. }
  203. </style>
  204. <style lang="scss" scoped>
  205. .question-wrap {
  206. padding: 0 30rpx 80rpx 30rpx;
  207. background-color: #FFFFFF;
  208. .question-top {
  209. display: flex;
  210. flex: auto;
  211. align-items: center;
  212. height: 100rpx;
  213. background-color: white;
  214. position: sticky;
  215. top: 0;
  216. left: 0;
  217. margin:0 -30rpx;
  218. z-index: 99;
  219. border-top: 1rpx solid rgba(0, 0, 0, 0.1);
  220. .text{
  221. width:240rpx;
  222. height:70rpx;
  223. line-height: 70rpx;
  224. background-color: #F5F5F5;
  225. border-radius: 4rpx;
  226. color:#666666;
  227. text-align: center;
  228. &.active{
  229. color:#E3B377;
  230. background-color: #FDF8F2;
  231. }
  232. }
  233. .auth-box {
  234. flex: 1;
  235. }
  236. .menu-icon {
  237. width: 34rpx;
  238. height:34rpx;
  239. }
  240. .pop-wrap{
  241. height: 100%;
  242. padding: 50rpx 34rpx;
  243. .pop-option-list {
  244. .option-btn-wrap {
  245. display: flex;
  246. justify-content: space-between;
  247. flex-wrap: wrap;
  248. margin-bottom: 20rpx;
  249. .option-btn {
  250. min-width: 145rpx;
  251. height:76rpx;
  252. line-height: 76rpx;
  253. text-align: center;
  254. color: black;
  255. background-color: #F6F6F6;
  256. border-radius: 4rpx;
  257. margin-top: 10rpx;
  258. &.active{
  259. background-color: #FAEEDE;
  260. }
  261. &.full{
  262. width:100%;
  263. }
  264. }
  265. }
  266. }
  267. .pop-btn{
  268. height:80rpx;
  269. margin:0 -34rpx;
  270. text-align: center;
  271. line-height: 80rpx;
  272. color:#FFFFFF;
  273. background-color: #E6B77D;
  274. }
  275. }
  276. }
  277. .question-list {
  278. .question-item {
  279. margin-bottom: 20rpx;
  280. &::after{
  281. content: '';
  282. display: block;
  283. height:10rpx;
  284. margin:0 -30rpx;
  285. background-color: #F9F9F9;
  286. }
  287. &:last-child{
  288. &::after{
  289. background-color: #FFFFFF;
  290. }
  291. }
  292. .question-info{
  293. display: flex;
  294. padding: 10rpx 0;
  295. .question-title{
  296. font-size: 32rpx;
  297. color:#333333;
  298. .item-label{
  299. padding:7rpx 12rpx;
  300. font-size: 22rpx;
  301. text-align: center;
  302. background-color: #333333;
  303. color: #E4B478;
  304. border-radius: 21rpx;
  305. margin-right:15rpx ;
  306. }
  307. }
  308. .item-answer {
  309. display: flex;
  310. align-items: center;
  311. .answer {
  312. width:150rpx;
  313. height: 97rpx;
  314. box-sizing: border-box;
  315. padding:30rpx 15rpx;
  316. border-radius: 18rpx;
  317. background:linear-gradient(253deg, #E3B377 0%, #FBCA8E 100%);
  318. display: flex;
  319. justify-content: space-between;
  320. color: #FFFFFF;
  321. font-size: 24rpx;
  322. .load-img{
  323. width: 34rpx;
  324. height: 34rpx;
  325. margin-right: 10rpx;
  326. animation: circle 1s linear infinite;
  327. }
  328. .music-img{
  329. width: 34rpx;
  330. height: 34rpx;
  331. margin-right: 10rpx;
  332. }
  333. @keyframes circle {
  334. 0%{
  335. transform: rotateZ(0);
  336. }
  337. 100%{
  338. transform: rotateZ(360deg);
  339. }
  340. }
  341. }
  342. }
  343. }
  344. .item-time {
  345. color: #999999;
  346. font-size: 24rpx;
  347. margin:20rpx 0;
  348. display: block;
  349. }
  350. }
  351. }
  352. .topage-btn {
  353. position: fixed;
  354. left:50%;
  355. margin-left: -257rpx;
  356. bottom: 215rpx;
  357. width:514rpx;
  358. height: 80rpx;
  359. text-align: center;
  360. line-height: 80rpx;
  361. border-radius: 40rpx;
  362. background-color: #333333;
  363. box-shadow: 0px 4px 20px 1px rgba(160, 126, 84, 0.25);
  364. color: #E3B377;
  365. }
  366. .global-pup{
  367. .content{
  368. padding:90rpx 34rpx;
  369. flex-direction: column;
  370. .contact{
  371. text{
  372. margin-left: 15rpx;
  373. color:#E6B77D;
  374. }
  375. }
  376. .apply{
  377. margin-top: 40rpx;
  378. width:390rpx;
  379. height:80rpx;
  380. background-color: #E6B77D;
  381. color: #FFFFFF;
  382. text-align: center;
  383. line-height: 80rpx;
  384. border-radius: 40rpx;
  385. }
  386. }
  387. }
  388. }
  389. </style>