communicationReply.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <view class="communication">
  3. <view class="bg"></view>
  4. <!-- 页面头部 -->
  5. <u-navbar
  6. back-icon-color="#fff"
  7. :back-text="$t('common.Back')"
  8. :is-back="true"
  9. :background="{background:'#1777FE'}"
  10. :back-text-style="{color:'#fff'}"
  11. :border-bottom="true"
  12. title-color="#fff"
  13. :title="title"
  14. :custom-back="back"
  15. >
  16. </u-navbar>
  17. <!-- 咨询信息 -->
  18. <view class="compnay">
  19. <view class="jtimg"><image class="img" :src="defaultImg" mode="widthFix"></image></view>
  20. <view class="jtinfo">
  21. <view class="label">{{$t(detial.senderName)}}</view>
  22. <view class="date">{{formatDate(detial.createDate)}}</view>
  23. <view class="jtques">{{detial.content}}</view>
  24. <view class="pro">
  25. <view class="proname">{{detial.columnName}}</view>
  26. <view class="icon"><u-icon name="attach" :size="24"></u-icon></view>
  27. </view>
  28. <view class="replaytag" v-if="!detial.interactiveMessageInfo && detial.senderId!=userId " @click="getFocus('textarea')">回复</view>
  29. </view>
  30. </view>
  31. <!-- 已回复信息 -->
  32. <view class="replies" v-if="detial.interactiveMessageInfo">
  33. <view class="jtimg"><image class="img" :src="detial.src?detial.src:defaultImg" mode="widthFix"></image></view>
  34. <view class="infos">
  35. <view class="whoans">我的回复:</view>
  36. <view class="date">{{formatDate(detial.interactiveMessageInfo.updateDate)}}</view>
  37. <view class="anscontent">{{detial.interactiveMessageInfo.content}}</view>
  38. </view>
  39. </view>
  40. <!-- 回复信息 -->
  41. <!-- && detial.senderId!=userId -->
  42. <view class="replyInfo" v-if="!detial.interactiveMessageInfo && detial.senderId!=userId ">
  43. <view class="uni-textarea">
  44. <textarea class="textarea" ref="textarea" :value="val" :fixed="true" placeholder-style="color:#888" :auto-height="true" @blur="showValue"
  45. @focus="showFocus" :maxlength="-1" :placeholder="$t('common.ReplyContent') +':'"/>
  46. </view>
  47. <view class="btn" @click="replyAns">发布</view>
  48. </view>
  49. <u-toast ref="uToast" />
  50. </view>
  51. </template>
  52. <script>
  53. import UNavbar from '@/components/uni-nav-bar/uni-nav-bar.vue'
  54. export default {
  55. name:'Communication',
  56. components:{
  57. UNavbar,
  58. },
  59. data(){
  60. return {
  61. title:'',
  62. count:3,
  63. lineIndex:-1,
  64. val:'',
  65. detial:'',
  66. msgFlag:false,
  67. userId:'',
  68. token:'',
  69. replies:[],
  70. defaultImg:'../../../static/missing-face.png'
  71. }
  72. },
  73. onLoad(e){
  74. this.title= this.$i18n.locale == 'zh'? '互动交流': 'Interaction'
  75. },
  76. onShow(){
  77. this.userId = uni.getStorageSync('user')?JSON.parse(uni.getStorageSync('user')).id:'';
  78. // this.token = uni.getStorageSync('Auth-Token')?'Bearer '+uni.getStorageSync('Auth-Token'):'';
  79. this.detial = uni.getStorageSync('compnayInfo');
  80. },
  81. created(){
  82. this.getToken()
  83. },
  84. onUnload(){
  85. uni.removeStorageSync('compnayInfo');
  86. },
  87. methods:{
  88. async getToken(){
  89. let res = await this.$myRequest({url:'/sys/token'})
  90. if(res.status==200) this.token=res.data
  91. },
  92. //清空列表
  93. clearList(){
  94. },
  95. // 回复的表单得到焦点
  96. getFocus(dom){
  97. let query=uni.createSelectorQuery();
  98. this.$nextTick(()=>{
  99. let doms=query.select(dom)
  100. })
  101. },
  102. showValue(e){
  103. this.val=e.detail.value;
  104. },
  105. showFocus(){
  106. },
  107. async replyAns(e){
  108. if(!this.val){
  109. this.$refs.uToast.show({
  110. title:'回复内容不能为空',
  111. icon:false,
  112. type:'error',
  113. })
  114. return ;
  115. }else{
  116. let data = {
  117. interactiveMessageInfo:JSON.stringify({
  118. content:this.val
  119. })
  120. }
  121. let res = await this.$myRequest({
  122. url:'/op/consultMessageInfos',
  123. method:'post',
  124. headers:{token:'1111'},
  125. data,
  126. })
  127. if(res.status!=200){
  128. this.$refs.uToast.show({
  129. title:'回复成功',
  130. icon:false,
  131. type:'success',
  132. })
  133. }
  134. }
  135. this.val='';
  136. },
  137. //路由后退一步
  138. back(){
  139. // #ifdef H5
  140. history.back()
  141. // #endif
  142. // #ifndef H5
  143. uni.navigateBack()
  144. // #endif
  145. },
  146. },
  147. mounted(){
  148. if(this.msgFlag==true) this.replies=[];
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .communication{
  154. .bg{
  155. position:fixed;
  156. top:0;
  157. left:0;
  158. bottom:0;
  159. right:0;
  160. background-color:#fff;
  161. z-index:-1;
  162. }
  163. width:100%;
  164. .edit{
  165. margin-right:30upx;
  166. color:#fff;
  167. }
  168. .compnay{
  169. width:100%;
  170. padding:3%;
  171. margin:20upx 0;
  172. border-bottom:2upx solid #eee;
  173. display:flex;
  174. width:100%;
  175. padding:3%;
  176. margin:20upx 0 0;
  177. border-bottom:2upx solid #eee;
  178. display:flex;
  179. .label{
  180. font-size:20upx;
  181. }
  182. .jtques{
  183. font-size:30upx;
  184. line-height:50upx;
  185. color:#333;
  186. }
  187. .jtimg{
  188. width:100upx;
  189. height:100upx;
  190. border-radius:50%;
  191. position:relative;
  192. background:#eee;
  193. margin-right:10upx;
  194. .img{
  195. display:block;
  196. width:80%;
  197. margin:10%;
  198. }
  199. }
  200. .jtinfo{
  201. flex:1;
  202. font-size:22upx;
  203. display:flex;
  204. flex-direction:column;
  205. .date{
  206. font-size:22upx;
  207. color:#aaa;
  208. line-height:50upx;
  209. }
  210. .replaytag{
  211. border:1px solid #1677FF;
  212. color: #1677FF;
  213. width:140upx;
  214. height:60upx;
  215. line-height:60upx;
  216. text-align:center;
  217. border-radius:60upx;
  218. align-self:flex-end;
  219. margin-top:50upx;
  220. }
  221. .pro{
  222. color:#1777FE;
  223. overflow:hidden;
  224. text-overflow:ellipsis;
  225. display:-webkit-box;
  226. -webkit-box-orient:vertical;
  227. -webkit-line-clamp:1000;
  228. display:flex;
  229. align-items:center;
  230. .proname{
  231. font-size:20upx;
  232. line-height:50upx;
  233. }
  234. .icon{
  235. color:#fff;
  236. background-color:#1777FE;
  237. height:32upx;
  238. line-height:32upx;
  239. width:32upx;
  240. text-align:center;
  241. border-radius:50%;
  242. margin-left:10upx;
  243. }
  244. }
  245. }
  246. }
  247. .replies{
  248. display:flex;
  249. width:100%;
  250. padding:3%;
  251. margin:20upx 0;
  252. .jtimg{
  253. width:100upx;
  254. height:100upx;
  255. border-radius:50%;
  256. position:relative;
  257. background:#eee;
  258. margin-right:10upx;
  259. .img{
  260. display:block;
  261. width:80%;
  262. margin:10%;
  263. }
  264. }
  265. .infos{
  266. flex:1;
  267. .date{
  268. font-size:22upx;
  269. color:#aaa;
  270. line-height:50upx;
  271. }
  272. }
  273. }
  274. .replyInfo{
  275. background:#fefefe;
  276. width:100%;
  277. padding:10% 0;
  278. display:flex;
  279. flex-direction:column;
  280. .uni-textarea{
  281. flex:1;
  282. min-height:160upx;
  283. margin:2% 5%;
  284. padding:16upx;
  285. border:1px solid #eee;
  286. position:relative;
  287. overflow:hidden;
  288. border-radius:10upx;
  289. .textarea{
  290. display:block;
  291. width:100%;
  292. }
  293. }
  294. .btn{
  295. width:160upx;
  296. height:70upx;
  297. line-height:70upx;
  298. border-radius:70upx;
  299. text-align:center;
  300. color:#fff;
  301. background-color:#1777FE;
  302. align-self:flex-end;
  303. margin-right:5%;
  304. font-size:28upx;
  305. }
  306. }
  307. }
  308. </style>