Ver Fonte

Merge branch 'yb5.2'

Karsa há 2 anos atrás
pai
commit
0c43d9665d

+ 83 - 0
api/question/index.js

@@ -0,0 +1,83 @@
+import {
+	httpGet,
+	httpPost
+} from "@/utils/request.js"
+
+
+/**
+ * 问答列表
+ * @param {*} params 
+ * ReplyStatus 提问状态 1-待分配 2-待回答 3-已回答
+ * CommunityQuestionId
+ * Keyword
+ * CurrentIndex
+ * PageSize
+ */
+export const apiQuestionList = params => {
+   return  httpGet('/yb/community/question/list',params)
+}
+
+/**
+ * 待分配的研究员的列表
+ * @param {*} params  IncludeDisableMember 0
+ */
+export const apiRsList = () => {
+   return  httpGet('/taglib/variety_tag/tag_tree',{IncludeDisableMember: 0})
+}
+
+/**
+ * 修改问答内容
+ * QuestionId QuestionContent
+ */
+export const apiEditQuestion = params => {
+   return  httpPost('/yb/community/question/edit',params)
+}
+
+/**
+ * 删除问答  QuestionId
+ */
+export const apiDelQuestion = params => {
+   return  httpPost('/yb/community/question/delete',params)
+}
+
+/**
+ * 分配
+ * "QuestionId": 54, //问答id
+   "AdminId": 450, //研究员id
+   "ResearchGroupFirstId": 3, //一级分组id
+   "ResearchGroupSecondId": 41 //二级分组id
+ */
+export const apiDistribute = params => {
+   return  httpPost('/yb/community/question/distribute',params)
+}
+
+/**
+ * 设置精选
+ * @param {*} params  CommunityQuestionCommentId
+ */
+export const apiSetHotComment = params => {
+   return  httpPost('/yb/community/question/comment/hot',params)
+}
+
+/**
+ * 删除评论
+ * @param {*} params  CommunityQuestionCommentId
+ */
+export const apiDelComment = params => {
+   return  httpPost('/yb/community/question/comment/delete',params)
+}
+
+/**
+ * 评论列表
+ * @param {*} params 
+ * CommunityQuestionCommentId
+ * Keyword
+ * HotStatus 精选状态 -1:全部 0-未精选,1-已精选
+ * CurrentIndex
+ * PageSize
+ */
+export const apiCommentList = params => {
+   return  httpGet('/yb/community/question/comment/list',params)
+}
+
+

+ 20 - 15
pages-approve/search/index.vue

@@ -63,6 +63,14 @@
 						navBarTitle = '客户搜索'
 						this.placeholder = '客户名称'
 						break;
+               case 'question':
+               	navBarTitle = '分配提问'
+               	this.placeholder = '提问内容'
+               	break;
+               case 'comment':
+               	navBarTitle = '评论管理'
+               	this.placeholder = '评论管理'
+               	break;
 				}
 				uni.setNavigationBarTitle({
 					title: navBarTitle
@@ -77,9 +85,6 @@
 						url:"/pages-approve/contract/search?val="+e
 					})
 				}else if(this.type==='roadshow'){
-					// uni.navigateTo({
-					// 	url:"/pages-approve/contract/search?val="+e
-					// })
 					let id = uni.setStorageSync('roadshow_compantyId',e.CompanyId)
 					uni.navigateBack({
 						delta: 1
@@ -154,6 +159,16 @@
 			onChange(e) {
 				this.value = e.detail
 			},
+         
+         /* 跳回问答和评论 */
+         questionBackHandle() {
+            uni.$emit('questionListUpdate', {
+               key_word: this.value
+            })
+            uni.navigateBack({
+            	delta: 1
+            });
+         },
 
 			onSearch() {
 				if(!this.value){
@@ -164,23 +179,13 @@
 					return
 				}
 				
-				// if (this.type === 'custome') {
-				// 	this.handleCustome()
-				// }
-
-				// if (this.type === 'contract') {
-				// 	this.handleContract()
-				// }
-				
-				// if(this.type==='seal'){
-				// 	this.handleSeal()
-				// }
-				
 				const handleFn = {
 					custome: this.handleCustome,
 					contract: this.handleContract,
 					seal: this.handleSeal,
 					roadshow: this.companySearchHandle,
+               question: this.questionBackHandle,
+               comment: this.questionBackHandle
 				}
 				
 				handleFn[this.type]();

+ 210 - 0
pages-question/components/pickerThreeColumn.vue

@@ -0,0 +1,210 @@
+<!-- 三级联动picker -->
+<template>
+   <view v-if="visible">
+      <view :class="{'pickerMask':visible}" @click="pickerCancel" catchtouchmove="true"></view>
+      <view :class="['picker-cont',{'picker-view-show':visible}]">
+         <view class="picker-top">
+            <view style="color:#999" @click="pickerCancel">取消</view>
+            <view style="color:#576b95" @click="pickerEnsure">确认</view>
+         </view>
+         <picker-view 
+            indicator-style="height: 40px;" 
+            class="picker-view-cont" 
+            :value="value" 
+            @change="pickerChangeHandle"
+         >
+            <picker-view-column>
+               <view class="picker-item" v-for="(item,index) in pickerOne" :key="index">{{item.label}}
+               </view>
+            </picker-view-column>
+            <picker-view-column>
+               <view class="picker-item" v-for="(item,index) in pickerTwo" :key="index">{{item.label}}
+               </view>
+            </picker-view-column>
+            <picker-view-column>
+               <view class="picker-item" v-for="(item,index) in pickerThree" :key="index">
+                  {{item.label}}
+               </view>
+            </picker-view-column>
+         </picker-view>
+         
+      </view>
+      
+   </view>
+</template>
+
+<script>
+   export default {
+      props:{
+         data: {
+            type: Array
+         },
+         visible: {
+            type: Boolean
+         },
+         default_picker_val:{
+            type: Array
+         }
+      },
+      watch: {
+         visible(newval) {
+            newval && this.init()
+         },
+         default_picker_val(newval) {
+            this.val = newval;
+         }
+      },
+      data() {
+         return {
+            value: [],
+            pickerOne:[],
+            pickerTwo:[],
+            pickerThree: []
+         };
+      },
+      mounted() {
+      },
+      methods: {
+         /* 值改变时 */
+         pickerChangeHandle(e) {
+            let data = this.data;
+            let changeValue = e.detail.value;
+            let pickerTwo = [];
+            let pickerThree = [];
+            // 重新渲染第二列
+            // 如果是第一列滚动
+            if (changeValue[0] !== this.value[0]) {
+               this.pickerTwo = [];
+               for (let i = 0, length = data[changeValue[0]].children.length; i < length; i++) {
+                  pickerTwo.push(data[changeValue[0]].children[i]);
+               }
+               // 重新渲染第三列
+               for (let i = 0, length = data[changeValue[0]].children[0].children.length; i <
+                  length; i++) {
+                  pickerThree.push(data[changeValue[0]].children[0].children[i]);
+               }
+               changeValue[1] = 0;
+               changeValue[2] = 0;
+               this.pickerTwo = pickerTwo;
+               this.pickerThree = pickerThree;
+            } else if (changeValue[1] !== this.value[1]) {
+               // 第二列滚动
+               // 重新渲染第三列
+               this.pickerThree = [];
+               pickerTwo = this.pickerTwo;
+               for (let i = 0, length = data[changeValue[0]].children[changeValue[1]].children
+                     .length; i <
+                  length; i++) {
+                  pickerThree.push(data[changeValue[0]].children[changeValue[1]]
+                     .children[
+                        i]);
+               }
+               changeValue[2] = 0;
+               this.pickerThree = pickerThree;
+            }
+            this.value = changeValue;
+         },
+         
+         /* 取消*/
+         pickerCancel() {
+           this.$emit('cancel') 
+         },
+         
+         /* 确定*/
+         pickerEnsure() {
+            console.log(this.value)
+            let val = this.value;
+            if(!this.data[val[0]].children.length ||  !this.data[val[0]].children[val[1]].children.length) return this.pickerCancel();
+            
+            // this.pickerValueDefault = this.value;
+            this.$emit('ensure',this.value)
+            this.pickerCancel();
+            
+         },
+         
+         init() {
+            let pickerOne = [];
+            let pickerTwo = [];
+            let pickerThree = [];
+            // 第一列
+            for (let i = 0, length = this.data.length; i < length; i++) {
+               pickerOne.push(this.data[i]);
+            }
+            // 渲染第二列
+            this.value = this.default_picker_val.length ? this.default_picker_val : [0, 0, 0];
+            let num = this.value[0];
+            for (let i = 0, length = this.data[num].children.length; i < length; i++) {
+               if( this.data[num].children === 0) {
+                  pickerTwo = []
+                  return
+               }
+               pickerTwo.push(this.data[num].children[i]);
+            }
+            // 第三列
+            let numSecond = this.value[1];
+            if(this.data[num].children.length) for (let i = 0, length = this.data[num].children[numSecond].children.length; i <
+               length; i++) {
+               if( this.data[num].children[numSecond].children.length === 0) {
+                  pickerThree = []
+                  return
+               }
+               pickerThree.push(
+                  this.data[num].children[numSecond].children[i]
+               );
+            }
+            this.pickerOne = pickerOne;
+            this.pickerTwo = pickerTwo;
+            this.pickerThree = pickerThree;
+         }
+      }
+   }
+</script>
+
+<style lang="scss" scoped>
+
+.pickerMask {
+   position: fixed;
+   z-index: 1000;
+   top: 0;
+   right: 0;
+   left: 0;
+   bottom: 0;
+   background: rgba(0, 0, 0, 0.6);
+}
+.picker-cont {
+   position: fixed;
+   bottom: 0;
+   left: 0;
+   width: 100%;
+   height: 250px;
+   transition: all 0.5s;
+   transform: translateY(100%);
+   z-index: 3000;
+   background-color: #fff;
+   .picker-top {
+      display: flex;
+      height: 100rpx;
+      padding: 0 30rpx;
+      justify-content: space-between;
+      align-items: center;
+   }
+}
+.picker-view-show {
+   transform: translateY(0);
+}
+.picker-view-cont {
+   position: relative;
+   bottom: 0;
+   left: 0;
+   width: 100%;
+   height: 238px;
+   background-color: rgba(255, 255, 255, 1);
+   
+   .picker-item {
+      height: 40px;
+      text-align: center;
+      line-height: 40px;
+      color: #333;
+   }
+}
+</style>

+ 211 - 0
pages-question/components/questionItem.vue

@@ -0,0 +1,211 @@
+<template>
+   <view class="question-item">
+      <view class="cont">
+         
+         <!-- 提问item -->
+         <template v-if="type==='question'">
+            <veiw class="item-title">{{data.QuestionContent}}</veiw>
+            <view class="row">提问人:{{ data.RealName }}</view>
+            <view class="row">提问时间:{{ data.CreateTime }}</view>
+            <view class="item-bottom row flex">
+               <view class="flex">
+                  回答者:
+                  <view class="select-wrapper" @click="openPicker" v-if="!data.ReplierRealName">
+                     <input type="text" placeholder="请选择研究员" disabled class="ipt" v-model="data.select_users.user_name">
+                     <van-icon name="play" color="#999" style="transform: rotate(90deg);position: absolute;right: 20rpx;top: 30%;"/>
+                  </view>
+                  <view v-else> {{data.ReplierRealName}}</view>
+               </view>
+               <view class="status blue-color">{{statusMap[data.ReplyStatus]}}</view>
+            </view>
+            
+         </template>
+         
+         <!-- 评论item -->
+        <template v-else>
+            <veiw class="item-title">{{data.Content}}</veiw>
+            <view class="row">所属提问:{{data.QuestionContent}}</view>
+            <view class="row">评论人:{{data.UserName}}</view>
+            <view class="row">客户信息:{{data.CompanyName}} <text v-if="data.CompanyProductStatus">({{data.CompanyProductStatus}})</text> </view>
+            <view class="row">评论时间:{{data.CreateTime | formatTime}}</view>
+         </template>
+      </view>
+      <view class="action-bot flex">
+         <text class="red-color" @click="actionHandle('del')">删除</text>
+         <template v-if="data.ReplyStatus === 1 && type === 'question'">
+            <text class="blue-color" @click="actionHandle('edit')">编辑</text>
+            <text :class="data.select_users.user_id ? 'blue-color' : 'grey-color'" @click="actionHandle('send')" >分配并通知</text>
+         </template>
+         <text class="blue-color" @click="actionHandle('hot')" v-if="type === 'comment'">{{ data.IsHot ? '取消精选': '精选' }}</text>
+         
+      </view>
+      
+   </view>
+</template>
+
+<script>
+   import * as $api from '@/api/question/index.js'
+   const moment = require('@/pages-roadshow/utils/_moment.js');
+   moment.locale('zh-cn'); 
+   export default {
+      props: {
+         type: String,
+         status: String,
+         item: Object
+      },
+      filters: {
+         formatTime(val) {
+            return moment(val).format('YYYY-MM-DD HH:mm:ss')
+         }
+      },
+      watch: {
+         item(newval) {
+            this.data = newval;
+         },
+      },
+      data() {
+         return {
+            data: this.item,
+            users_obj: this.select_users,
+            statusMap: {
+               1: '待分配',
+               2: '待回答',
+               3: '已回答'
+            },
+         };
+      },
+      methods: {
+         /* 打开弹窗 */
+         openPicker() {
+            const { CommunityQuestionId } = this.data;
+            this.$emit('open_picker',CommunityQuestionId)
+         },
+         
+         /* 操作*/
+         actionHandle(key) {
+            const actionmap = {
+               'del': this.delHandle,
+               'edit': this.editHandle,
+               'send': this.sendQuestionHandle,
+               'hot': this.setHotHandle
+            }
+            actionmap[key]()
+         },
+         
+         /* 编辑 */
+         editHandle() {
+            this.$emit('edit',this.data)
+         },
+         
+         /* 删除 */
+         delHandle() {
+            wx.showModal({
+               title: "",
+               content: `${this.type === 'question' ? '提问' : '评论'}删除后不可恢复,确认删除吗`,
+               confirmColor: "#EE3636",
+               cancelColor: '#333',
+               success: async (res) => {
+                  if(res.cancel) return
+                  
+                  const { CommunityQuestionId,CommunityQuestionCommentId } = this.data;
+                  const { code } = this.type === 'question' 
+                     ? await $api.apiDelQuestion({ QuestionId: CommunityQuestionId })
+                     : await $api.apiDelComment({ CommunityQuestionCommentId: CommunityQuestionCommentId });
+                  if( code !== 200 ) return
+                  
+                  wx.showToast({title: '删除成功'});
+                  this.$emit('del', this.type === 'question' ? CommunityQuestionId : CommunityQuestionCommentId)
+               }
+            })
+         },
+         
+         /* 分配研究员 */
+         async sendQuestionHandle() {
+            console.log(this.data.select_users)
+            if(!this.data.select_users) return
+            
+            const {first_id,second_id,user_id} = this.data.select_users;
+            const { code } =  await $api.apiDistribute({
+               ResearchGroupFirstId: first_id,
+               ResearchGroupSecondId: second_id,
+               AdminId: user_id,
+               QuestionId: this.data.CommunityQuestionId
+            })
+            
+            if(code !== 200) return
+            wx.showToast({title: '分配成功'})
+            this.$emit('del', this.data.CommunityQuestionId)
+          },  
+          
+         /* 设置精选 */
+         async setHotHandle() {
+            const { CommunityQuestionCommentId } = this.data;
+            const { code } = await $api.apiSetHotComment({CommunityQuestionCommentId})
+            
+            if(code !== 200) return
+            wx.showToast({title: '设置成功'})
+            this.$emit('hot',CommunityQuestionCommentId)
+            
+         }
+      }
+   }
+</script>
+
+<style lang="scss" scoped>
+.blue-color {
+   color: #3385FF;
+}
+.red-color {
+   color: #D63535;
+}
+.grey-color {
+    color: #999;
+}
+
+.flex {
+   display: flex;
+   align-items: center;
+}
+.question-item {
+   background: #fff;
+   padding: 20rpx 0 0;
+   border-radius: 8rpx;
+   font-size: 28rpx;
+   margin-bottom: 20rpx;
+   color: #666;
+   .cont {
+      padding: 0 20rpx;
+   }
+   .item-title {
+      color: #333;
+      font-size: 32rpx;
+   }
+   .row {
+      margin: 15rpx 0;
+   }
+   .item-bottom {
+      justify-content: space-between;
+      .select-wrapper {
+         width: 250rpx;
+         border: 1px solid #F1F2F6;
+         padding: 0 40rpx 0 20rpx;
+         position: relative;
+         .ipt {
+            height: 80rpx;
+            line-height: 80rpx;
+         }
+      }
+   }
+   .action-bot {
+      border-top: 1px solid #EAEAEA;
+      margin-top: 30rpx;
+      text {
+         padding: 24rpx 0;
+         flex: 1;
+         text-align: center;
+         border-right: 1px solid #EAEAEA;
+         &:last-child { border: none; }
+      }
+   }
+}
+</style>

+ 345 - 0
pages-question/detail/index.vue

@@ -0,0 +1,345 @@
+<template>
+   <view class="question-detail-page">
+      <van-sticky v-if="!id">
+         <view class="" @click="goSearch">
+            <van-search :value="key_word" shape="round" :placeholder="type==='question' ? '提问内容' : '评论内容'" disabled />
+  
+         </view>
+         <van-tabs id="tabs" :active="status" title-active-color="#3385FF" color="#3385FF" @change="typeChange" >
+            <template v-if="tabs.length">
+               <van-tab :title="item.label" :name="item.key" v-for="item in tabs" :key="item.key"></van-tab>
+            </template>
+         </van-tabs>
+      </van-sticky>
+      
+      <!-- list -->
+      <view class="list-cont">
+        <question-item 
+            v-for="item in list"
+            :key="item.CommunityQuestionId"
+            :item="item"
+            :status="status"
+            :type="type"
+            :select_users="select_users"
+            @open_picker="openPicker"
+            @del="delHandle"
+            @edit="editHandle"
+            @hot="setHotHandle"
+         />
+      </view>
+      
+      <van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="finished&&list.length===0"/>
+      
+      <!-- 研究员选择弹窗 -->
+      <pickerThreeColumn 
+         :data="researcherList" 
+         v-if="researcherList.length" 
+         :visible="isShowrsPicker"
+         :default_picker_val="default_picker_val"
+         @cancel="cancelPicker"
+         @ensure="confirmPicker"
+      />
+      
+      <!-- 编辑框 -->
+      <van-popup :show="showEditPicker" bind:close="onClose">
+         <view class="edit-cont">
+            <view class="editor-wrapper">
+               <textarea
+                  v-model="edit_item.QuestionContent" 
+                  placeholder="请输入提问内容"
+                  :show-confirm-bar="false"
+                  :cursor-spacing="20"
+                  class="editor"
+               />
+            </view>
+            <view class="edit-bottom">
+               <view class="cancel-color" @click="showEditPicker=false">取消</view>
+               <view class="blue-color" @click="editQuestionHandle">确定</view>
+            </view>
+         </view>
+      </van-popup>
+   </view>
+</template>
+
+<script>
+   import * as $api from '@/api/question/index.js';
+   import questionItem from '../components/questionItem.vue'
+   import pickerThreeColumn from '../components/pickerThreeColumn.vue'
+   export default {
+      data() {
+         return {
+            id: '',//消息列表进入带的id
+            type:'',//页面类型 question  comment
+            key_word: '',
+            status: 1,
+            tabs: [],
+            page_no: 1,
+            pageSize: 10,
+            list:[],
+            finished: false,
+            researcherList: [],
+            
+            isShowrsPicker: false,
+            select_item: {},
+            default_picker_val:[],
+            
+            showEditPicker: false,//编辑弹窗
+            edit_item:{}
+         };
+      },
+      components: { questionItem,pickerThreeColumn },
+      onLoad(options) {
+         this.initState(options)
+         
+         // 搜索返回 
+         uni.$on('questionListUpdate',({key_word})=>{
+            
+            this.key_word = key_word;
+            this.tabs = [];
+            this.status = -1;
+            this.page_no = 1;
+            this.getList()
+           
+         })
+      },
+      onUnload() {
+         uni.$off('questionListUpdate')
+      },
+      onShow() {
+         this.$nextTick(()=>{
+         	this.selectComponent('#tabs').resize();// 解决初始渲染 vant tab 底部条
+         })
+      },
+      onPullDownRefresh() {
+      	this.page_no=1
+      	this.finished=false
+      	this.list=[]
+      	this.getList()
+      	setTimeout(()=>{
+      		uni.stopPullDownRefresh()
+      	},1500)
+      },
+      onReachBottom() {
+      	if(this.finished) return
+      	this.page_no++
+      	this.getList()
+      },
+      methods: {
+         /*  待分配研究员列表 */
+         async getResearcherList() {
+            const { code,data } = await $api.apiRsList();
+            if(code !== 200) return
+            data && data.forEach(_ => {
+               _.children = _.tags || [];
+               _.label = _.classify_name;
+               _.tags.forEach(_sub => {
+                  _sub.children = _sub.researcher_list;
+                  _sub.label = _sub.tag_name
+                  _sub.researcher_list.forEach(_ths => {
+                     _ths.label = _ths.admin_name
+                  })
+               })
+            })
+            this.researcherList = data;
+         },
+         
+         async getList() {
+            const params = {
+               Keyword: this.key_word || '',
+               CurrentIndex: this.page_no,
+               PageSize: this.pageSize
+            }
+           const {code,data} = this.type==='question' 
+               ? await $api.apiQuestionList({...params,ReplyStatus: this.status,
+               CommunityQuestionId: Number(this.id) || '',})
+               : await $api.apiCommentList({...params,HotStatus: this.status,CommunityQuestionCommentId: Number(this.id)});
+           
+           if(code !== 200) return
+           this.finished = this.page_no >= data.Paging.Pages;
+           
+           this.list = this.page_no === 1 ? (data.List || []) : this.list.concat(data.List);
+         },
+         
+         /* 改变类型 */
+         typeChange({ detail }) {
+            this.status=detail.name
+            this.page_no=1
+            this.list=[]
+            this.getList()
+         },
+         
+          /* 搜索 */
+         goSearch() {
+            uni.navigateTo({
+               url: `/pages-approve/search/index?type=question`,
+            })
+         },
+         
+         
+         // 删除
+         delHandle(id) {
+            let index = this.type === 'question' ? this.list.findIndex(_ => _.CommunityQuestionId === id) : this.list.findIndex(_ => _.CommunityQuestionCommentId === id);
+            this.list.splice(index,1)
+         },
+         
+         /* 设置精选*/
+         setHotHandle(id) {
+            let index = this.list.findIndex(_ => _.CommunityQuestionCommentId === id);
+            if(this.status === -1) {
+               this.list[index].IsHot = this.list[index].IsHot ? 0 : 1
+            }else {
+               this.list.splice(index,1)
+            }
+         },
+         
+         /* 修改问题 */
+         editHandle(item) {
+            this.edit_item =  JSON.parse(JSON.stringify(item));
+            this.showEditPicker = true;
+         },
+         
+         /* 修改问题*/
+         async editQuestionHandle() {
+            
+            const { CommunityQuestionId,QuestionContent } = this.edit_item;
+            if(QuestionContent.length > 25)  return uni.showToast({
+               title: '字数超限,请修改问题后重试',
+               icon: 'none'
+            })
+            
+            const {code,data} = await $api.apiEditQuestion({
+               QuestionId: CommunityQuestionId,
+               QuestionContent
+            })
+            
+            if( code !== 200) return
+            uni.showToast({title: '修改成功'})
+            this.showEditPicker = false;
+            
+            let obj = this.list.find(_ => _.CommunityQuestionId === CommunityQuestionId);
+            obj.QuestionContent = QuestionContent;
+            console.log(obj)
+         },
+         
+         // 打开弹窗
+         openPicker(id) {
+            this.select_item =  this.list.find(_ => _.CommunityQuestionId === id);
+            this.default_picker_val =  this.select_item.select_users ? this.select_item.select_users.val : [];
+            this.isShowrsPicker = true;
+         },
+         
+         cancelPicker() {
+            this.isShowrsPicker = false;
+         },
+         
+         /* 确认*/
+         confirmPicker(val) {
+            console.log(val)
+            let data = this.researcherList;
+            if(data[val[0]].children.length && data[val[0]].children[val[1]].children.length) {
+               let select_users = {
+                  val,
+                  first_id: data[val[0]].tag_id,
+                  second_id: data[val[0]].children[val[1]].tag_id,
+                  user_id: data[val[0]].children[val[1]].children[val[2]].admin_id,
+                  user_name: data[val[0]].children[val[1]].children[val[2]].admin_name
+               }
+               
+               if(this.select_item.select_users) this.select_item.select_users = select_users
+                  else this.$set(this.select_item,'select_users',select_users)
+            }
+         },
+         
+         /* init*/
+         initState({ type,id }) {
+            const titleMap = {
+               'question': '分配提问',
+               'comment': '评论管理'
+            }
+            const tabMap = {
+               'question': [
+                  {
+                     label: '待分配',
+                     key: 1
+                  },
+                  {
+                     label: '待回答',
+                     key: 2
+                  },
+                  {
+                     label: '已回答',
+                     key: 3
+                  },
+                  
+               ],
+               'comment': [
+                  {
+                     label: '全部',
+                     key: -1
+                  },
+                  {
+                     label: '已精选',
+                     key: 1
+                  },
+                  {
+                     label: '未精选',
+                     key: 0
+                  },
+                  
+               ]
+            }
+            
+            this.type = type;
+            this.id = id;
+            this.tabs = id ? [] : tabMap[type];
+            this.status = this.tabs.length ? this.tabs[0].key : -1;
+            type === 'question' && this.getResearcherList();
+            this.getList();
+            
+            uni.setNavigationBarTitle({
+            	title: titleMap[type]
+            });
+         }
+      }
+   }
+</script>
+
+<style lang="scss" scoped>
+.blue-color {
+   color: #3385FF;
+}
+.cancel-color {
+   color: #999;
+}
+.list-cont {
+   padding: 40rpx 20rpx;
+}
+.edit-cont {
+   .editor-wrapper {
+      padding: 40rpx 34rpx 0;
+   }
+   .editor {
+      height: 300rpx;
+      border: 1px solid #EAEAEA;
+      border-radius: 4px;
+      padding: 20rpx;
+      
+   }
+   .edit-bottom {
+      border-top: 1px solid #EAEAEA;
+      display: flex;
+      align-items: center;
+      margin-top: 30rpx;
+      view {
+         flex: 1;
+         padding: 30rpx 0;
+         text-align: center;
+         font-size: 30rpx;
+         border-right: 1px solid #EAEAEA;
+         &:last-child {
+            border: none;
+         }
+      }
+   }
+}
+</style>

+ 67 - 36
pages-todomessages/list/list.vue

@@ -7,20 +7,41 @@
 				<view class="flex">
 				<image :src="avatar" mode="aspectFill" style="width: 88rpx;height: 88rpx;"></image>
 				<view class="message-content">
-					<view style="color:#666;font-size: 12px;">审批小助手</view>
+					<view style="color:#666;font-size: 12px;">小助手</view>
 					<view class="message-card white-wrap" @click="handleGoDetail(item)">
-						<view class="type">{{item.ApprovalInfo.Type}}</view>
-						<view class="title">{{item.CompanyName}}</view>
-						<view v-if="item.MessageType===3">
-							<view class="info">{{item.Content}}</view>
-							<view class="info">修改时间:{{item.CreateTime|formatTime}}</view>
-						</view>
-						<view v-else>
-						<view class="info">申请销售:{{item.ApprovalInfo.ApplyName}}</view>
-						<view class="info" v-if="item.statusName==='待审批'">提交时间:{{item.ApprovalInfo.ApplyTime|formatTime}}</view>
-						<view class="info" v-else>审批时间:{{item.ApprovalInfo.ApprovalTime|formatTime}}</view>
-						</view>
-						<image :src="item.statusImg" mode="aspectFill" class="status-img"></image>
+                  <!-- 问答 -->
+                  <template v-if="type === 5">
+                     <view class="title">{{item.ApprovalInfo.Title}}</view>
+                     <view class="info">提问人:{{item.ApprovalInfo.ApplyName}}</view>
+                     <view class="info">提问时间:{{item.ApprovalInfo.ApplyTime|formatTime}}</view>
+                     <image src="@/static/icon-distribute.png" mode="aspectFill" class="new-status" v-if="item.ApprovalStatus === 1"></image>
+                  </template>
+                  
+                  <!-- 评论 -->
+                  <template v-else-if="type === 6">
+                     <view class="title">{{item.ApprovalInfo.Title}}</view>
+                     <view class="info">所属提问:{{item.ApprovalInfo.Content}}</view>
+                     <view class="info">评论人:{{item.ApprovalInfo.ApplyName}}</view>
+                     <view class="info">客户信息:{{item.ApprovalInfo.CompanyName}}</view>
+                     <view class="info">评论时间:{{item.ApprovalInfo.ApplyTime|formatTime}}</view>
+                     <image src="@/static/icon-look.png" mode="aspectFill" class="new-status" v-if="item.ApprovalStatus === 1"></image>
+                     
+                  </template>
+                  
+                  <template v-else> 
+                     <view class="type">{{item.ApprovalInfo.Type}}</view>
+                     <view class="title">{{item.CompanyName}}</view>
+                     <view v-if="item.MessageType===3">
+                        <view class="info">{{item.Content}}</view>
+                        <view class="info">修改时间:{{item.CreateTime|formatTime}}</view>
+                     </view>
+                     <view v-else>
+                     <view class="info">申请销售:{{item.ApprovalInfo.ApplyName}}</view>
+                     <view class="info" v-if="item.statusName==='待审批'">提交时间:{{item.ApprovalInfo.ApplyTime|formatTime}}</view>
+                     <view class="info" v-else>审批时间:{{item.ApprovalInfo.ApprovalTime|formatTime}}</view>
+                     </view>
+                     <image :src="item.statusImg" mode="aspectFill" class="status-img"></image>
+                  </template>
 					</view>
 				</view>
 				</view>
@@ -46,8 +67,8 @@
 			return {
 				scrollViewId:'',
 
-				type: null, //类型对应的数字: 1客户(custome)、2合同(contract)、3用印(seal)
-				typeName:null,//类型对应的英文 客户(custome)、合同(contract)、用印(seal)
+				type: null, //类型对应的数字: 1客户(custome)、2合同(contract)、3用印(seal) 5问答 6问答评论
+				typeName:null,//类型对应的英文 客户(custome)、合同(contract)、用印(seal) question questionComment
 				page: 1, //页码
 				list: [],
 				finished: false, //是否列表为最后一页
@@ -81,23 +102,15 @@
 			},
 
 			handleGoDetail(e){
-				if(this.typeName==='custome'){
-					uni.navigateTo({
-						url:'/pages-approve/custome/detail?id='+e.CompanyApprovalId
-					})
-				}
-				
-				if(this.typeName==='contract'){
-					uni.navigateTo({
-						url:`/pages-approve/contract/detail?ContractApprovalId=0&ContractId=0&ContractApprovalRecordId=${e.CompanyApprovalId}`
-					})
-				}
-				
-				if(this.typeName==='seal'){
-					uni.navigateTo({
-						url:`/pages-approve/seal/detail?ContractApprovalId=0&ContractApprovalRecordId=${e.CompanyApprovalId}`
-					})
-				}
+            const urlMap = {
+               'custome': '/pages-approve/custome/detail?id='+e.CompanyApprovalId,
+               'contract': `/pages-approve/contract/detail?ContractApprovalId=0&ContractId=0&ContractApprovalRecordId=${e.CompanyApprovalId}`,
+               'seal': `/pages-approve/seal/detail?ContractApprovalId=0&ContractApprovalRecordId=${e.CompanyApprovalId}`,
+               'question':`/pages-question/detail/index?type=question&id=${e.CompanyApprovalId}`,
+               'questionComment':`/pages-question/detail/index?type=comment&id=${e.CompanyApprovalId}`,
+            }
+            	
+            uni.navigateTo({url:urlMap[this.typeName]})
 			},
 			
 			//获取列表数据
@@ -126,12 +139,13 @@
 									statusName='已驳回'
 									break
 							}
+                     
 
 							// 处理消息时间
 							let msgTime=this.handleMsgTime(item.CreateTime)
 							return {
-								statusImg:statusImg,
-								statusName:statusName,
+								statusImg,
+								statusName,
 								...item,
 								msgTime:msgTime
 							}
@@ -200,6 +214,18 @@
 						_this.typeName='seal'
 						_this.avatar=require('../../static/icon-3.png')
 						break;
+               case '5':
+                  navBarTitle = '待分配提问'
+                  _this.type = 5
+                  _this.typeName='question'
+                  _this.avatar=require('../../static/icon-question.png')
+                  break;
+               case '6':
+                  navBarTitle = '待查看评论'
+                  _this.type = 6
+                  _this.typeName='questionComment'
+                  _this.avatar=require('../../static/icon-comment.png')
+                  break;
 				}
 				uni.setNavigationBarTitle({
 					title: navBarTitle
@@ -269,12 +295,17 @@
 			.info{
 				margin-top: 20rpx;
 			}
-			.status-img{
+			.status-img,.new-status{
 				position: absolute;
-				top: 0;
 				right: 0;
 				width: 145rpx;
 				height: 145rpx;
+            &.status-img {
+               top: 0;
+            }
+            &.new-status {
+               bottom: 0;
+            }
 			}
 		}
 	}

+ 13 - 1
pages.json

@@ -182,7 +182,19 @@
 				}
 			 }
 		 ]
-	 }
+	 },
+    {
+      "root": "pages-question",//问答社区
+      "pages": [
+         {
+            "path": "detail/index",
+            "style": {
+              "navigationBarTitleText": "分配提问",
+              "enablePullDownRefresh": true
+            }
+         }
+      ]
+    }
   ],
   "globalStyle": {
     "navigationBarTextStyle": "black",

+ 9 - 10
pages/index/index.vue

@@ -49,17 +49,16 @@
 				const res=await apiMessageCount()
 				this.loading=false
 				if(res.code===200){
+               const imgMap = {
+                  1: require('../../static/icon-1.png'),
+                  2: require('../../static/icon-2.png'),
+                  3: require('../../static/icon-3.png'),
+                  5: require('../../static/icon-question.png'),
+                  6: require('../../static/icon-comment.png'),
+               }
 					this.list=res.data&&res.data.map(item=>{
-						let img=''
-						if(item.SourceType===1){
-							img=require('../../static/icon-1.png')
-						}
-						if(item.SourceType===2){
-							img=require('../../static/icon-2.png')
-						}
-						if(item.SourceType===3){
-							img=require('../../static/icon-3.png')
-						}
+						let img=imgMap[item.SourceType]
+                  
 						return {
 							...item,
 							img

+ 35 - 32
pages/workbench/index.vue

@@ -1,30 +1,14 @@
 <template>
 	<view class="workbench-page">
-		<!-- <view class="section white-wrap" @click="handleGoNext('custome')">
-			<image src="../../static/icon-1.png" mode="aspectFill" class="icon"></image>
-			<view class="label">客户审批</view>
-		</view>
-		<view class="section white-wrap" @click="handleGoNext('contract')">
-			<image src="../../static/icon-2.png" mode="aspectFill" class="icon"></image>
-			<view class="label">合同审批</view>
-		</view>
-		<view class="section white-wrap" @click="handleGoNext('seal')">
-			<image src="../../static/icon-3.png" mode="aspectFill" class="icon"></image>
-			<view class="label">用印审批</view>
-		</view>
-		<view class="section white-wrap" @click="handleGoNext('activity')">
-			<image src="../../static/icon-4.png" mode="aspectFill" class="icon"></image>
-			<view class="label">活动审批</view>
-		</view> -->
 
-		<view class="section white-wrap" v-for="item in tabs" :key="item.label">
-			<view class="tab-title">{{item.label}}</view>
-			<view class="tab-ul">
-				<view class="tab-item" @click="handleGoNext(tab.url)" v-for="tab in item.child" :key="tab.label">
-					<image :src="tab.img" mode="aspectFill" class="icon"/>
-					<view class="label">{{tab.label}}</view>
-				</view>
-			</view>
+		<view class="section white-wrap" v-for="item in my_tabs" :key="item.label">
+         <view class="tab-title">{{item.label}}</view>
+         <view class="tab-ul">
+            <view class="tab-item" @click="handleGoNext(tab.url)" v-for="tab in item.child" :key="tab.label">
+               <image :src="tab.img" mode="aspectFill" class="icon"/>
+               <view class="label">{{tab.label}}</view>
+            </view>
+         </view>
 		</view>
 
 	</view>
@@ -35,6 +19,7 @@
 	export default{
 		data() {
 			return {
+            my_tabs: [],
 				tabs: [
 					{
 						label: '审批',
@@ -54,11 +39,6 @@
 								url: '/pages-approve/seal/list',
 								img: require('@/static/icon-3.png')
 							},
-							// {
-							// 	label: '活动审批',
-							// 	url: '/pages-approve/activity/list',
-							// img: require('@/static/icon-4.png')
-							// },
 						]
 					},
 					{
@@ -75,21 +55,44 @@
 								img: require('@/static/icon-6.png')
 							}
 						]
-					}
+					},
+               {
+               	label: '问答社区',
+               	child: [
+               		{
+               			label: '分配提问',
+               			url: '/pages-question/detail/index?type=question',
+               			img: require('@/static/icon-question.png')
+               		},
+               		{
+               			label: '评论管理',
+               			url: '/pages-question/detail/index?type=comment',
+               			img: require('@/static/icon-comment.png')
+               		}
+               	]
+               }
 				]
 			}
 		},
+      onLoad() {
+         
+        this.init()
+      },
+      
 		onShareAppMessage() {
 			return shareData
 		},
 		methods: {
 			handleGoNext(url) {
-				
 					uni.navigateTo({
 						url
 					})
 
-			}
+			},
+         init() {
+            const userInfo = this.$store.state.userInfo;
+            this.my_tabs =  !['ficc_admin','admin'].includes(userInfo.RoleTypeCode) ? this.tabs.filter(_ => _.label !== '问答社区') : this.tabs;
+         }
 		},
 	}
 </script>

BIN
static/icon-comment.png


BIN
static/icon-distribute.png


BIN
static/icon-look.png


BIN
static/icon-question.png