detail.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view class="comdetail">
  3. <view class="cdbox mb12">
  4. <image :src="replay" class="replay" v-if="datainfo.status==2"></image>
  5. <view class="cdtop">
  6. <view class="tit">{{datainfo.title}}</view>
  7. <view class="txt">{{datainfo.createTime}}</view>
  8. </view>
  9. <view class="cdmain">
  10. <view class="tit">{{datainfo.content}}</view>
  11. <view class="imgs">
  12. <image :src="baseUrl+ite" v-for="(ite,idx) in phofile" :key="idx" @click="getPreviewImage(phofile,idx)"></image>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="cdbox mb12 hfbox pt40" v-if="datainfo.status==2">
  17. <view class="hftop">
  18. <image :src="hline"></image>
  19. <view>回复</view>
  20. </view>
  21. <view class="cdmain">
  22. <view class="tit">{{datainfo.replyContent}}</view>
  23. <block v-if="datainfo.suggestionFjList">
  24. <view class="fjlists" v-for="(fite,fidx) in datainfo.suggestionFjList" :key='fidx'>
  25. <view class="flext" @click="getDown(fite.url)">
  26. <view class="imgl"><image :src="filico" ></image></view>
  27. <view class="tit">{{fite.name}}</view>
  28. </view>
  29. </view>
  30. </block>
  31. </view>
  32. </view>
  33. <!-- 步骤条 -->
  34. <!-- <view class="hfbox mb12" >
  35. <view class="hfstep">
  36. <view class="hfslist flex">
  37. <view class="limg flexccc">
  38. <image :src="cira" class="imga"></image>
  39. </view>
  40. <view class="flex1">
  41. <view class="hfstit co01">已完成 2024-11-25 12:24</view>
  42. <view class="hfstxt co27">设备已维修,感谢您的建议!</view>
  43. </view>
  44. </view>
  45. <view class="hfslist flex">
  46. <view class="limg flexccc">
  47. <image :src="cirb" class="imgb"></image>
  48. </view>
  49. <view class="flex1">
  50. <view class="hfstit">待作业 2024-11-24 22:17</view>
  51. <view class="hfstxt">维修零件已送达,明天将会安排人员维修。</view>
  52. </view>
  53. </view>
  54. <view class="hfslist flex">
  55. <view class="limg flexccc">
  56. <image :src="cirb" class="imgb"></image>
  57. </view>
  58. <view class="flex1">
  59. <view class="hfstit">已收到 2024-11-19 09:23</view>
  60. <view class="hfstxt">收到您的建议,物业已高度重视这个问题,维修零件 正在运输中,请耐心等待!</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view> -->
  65. <!-- <view class="cdbtns">
  66. <view class="btna">不予公开</view>
  67. <view class="btnb" @click="getReplyFn">回复</view>
  68. </view> -->
  69. <loading></loading>
  70. </view>
  71. </template>
  72. <script>
  73. import config from '@/config'
  74. const baseUrl = config.baseUrl
  75. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  76. import {suggestionlDet} from "@/api/work/news.js"
  77. export default{
  78. components:{},
  79. data(){
  80. return{
  81. replay:require('@/news/static/complaint/replay.png'),
  82. hline:require('@/news/static/complaint/hline.png'),
  83. cira:require('@/news/static/complaint/cira.png'),
  84. cirb:require('@/news/static/complaint/cirb.png'),
  85. filico:require('@/news/static/complaint/filico.png'),
  86. baseUrl:config.baseUrl,
  87. type:'',
  88. datainfo:{},
  89. id:'',
  90. phofile:[],//图片合集
  91. }
  92. },
  93. onLoad: function(e) {
  94. if(e.id){
  95. this.id=e.id;
  96. this.getDetail()
  97. }
  98. },
  99. methods:{
  100. checkPermi, checkRole,
  101. getClose(){
  102. this.type='';
  103. },
  104. getSure(){
  105. this.type='';
  106. },
  107. getReplyFn(){
  108. this.type='reply'
  109. },
  110. getPreviewImage(arr,idx){
  111. var newArr=[];
  112. arr.forEach(ite=>{
  113. var ds=this.baseUrl+ite
  114. newArr.push(ds)
  115. })
  116. uni.previewImage({
  117. urls: newArr,
  118. current:idx,
  119. success: function(data) {
  120. },
  121. fail: function(err) {
  122. }
  123. });
  124. },
  125. getDetail(){
  126. var that=this;
  127. suggestionlDet(this.id).then(res=>{
  128. if(res.code==200){
  129. this.datainfo=res.data;
  130. if(res.data&&res.data.images){
  131. that.phofile=res.data.images.split(',')
  132. }
  133. }
  134. })
  135. },
  136. getDown(path,name){
  137. console.log(path,name)
  138. // #ifdef APP-PLUS
  139. self.getFilePermissions(function(res){
  140. if(res==1){
  141. uni.showLoading({
  142. title: '加载中'
  143. });
  144. var url = baseUrl + path;
  145. let dtask = plus.downloader.createDownload(url, {
  146. filename: 'file://storage/emulated/0/'+baseName+'/' + name
  147. }, (d, status) => {
  148. //d为下载的文件对象
  149. if (status == 200) {
  150. uni.hideLoading();
  151. uni.showToast({
  152. icon: 'none',
  153. mask: true,
  154. title: '已保存到文件夹:/'+baseName+'/'+ name, //保存路径
  155. duration: 3000,
  156. });
  157. //下载成功,d.filename是文件在保存在本地的相对路径,使用下面的API可转为平台绝对路径
  158. let fileSaveUrl = plus.io.convertLocalFileSystemURL(d.filename);
  159. setTimeout(() => {
  160. plus.runtime.openFile(d.filename); //选择软件打开文件
  161. }, 1500)
  162. } else {
  163. //下载失败
  164. uni.hideLoading();
  165. plus.downloader.clear(); //清除下载任务
  166. uni.showToast({
  167. icon: 'none',
  168. mask: true,
  169. title: '下载失败,请稍后重试',
  170. });
  171. }
  172. })
  173. dtask.start();
  174. }else{
  175. uni.hideLoading();
  176. uni.showToast({
  177. title: '无法获取权限,文件下载将出错!',
  178. icon: 'none',
  179. })
  180. }
  181. })
  182. // #endif
  183. // #ifndef APP-PLUS
  184. this.getDownloader(path)
  185. // #endif
  186. },
  187. getDownloader(e){
  188. uni.showLoading({
  189. title: '加载中'
  190. });
  191. var url=baseUrl+e;
  192. let index1 = e.lastIndexOf("."); // 得到一个索引值
  193. let index2 = e.length;
  194. let type = e.substring(index1, index2);
  195. if ((type.indexOf('jpg') > -1 || type.indexOf('jpeg') > -1 || type.indexOf('png') > -1)) {
  196. uni.previewImage({
  197. current: 0,
  198. urls: [url],
  199. // background: '#ffffff'
  200. });
  201. uni.hideLoading();
  202. } else {
  203. uni.downloadFile({
  204. url: url,//文件的下载路径
  205. success(result) {
  206. uni.hideLoading()
  207. var filePath = result.tempFilePath;
  208. uni.openDocument({
  209. filePath: filePath,
  210. showMenu: true,
  211. success: function (res) {
  212. // console.log('打开文档成功');
  213. }
  214. });
  215. },
  216. fail(res) {uni.hideLoading()}
  217. })
  218. }
  219. },
  220. }
  221. }
  222. </script>
  223. <style>
  224. page{background: #F3F3F0;}
  225. </style>
  226. <style lang="scss" scoped>
  227. .comdetail{padding:20rpx 18rpx 10rpx;
  228. .cdbox{background: #FFFFFF;border-radius: 20rpx;padding: 0 32rpx;box-sizing: border-box;position: relative;
  229. .replay{width: 124rpx;height: 124rpx;position: absolute;right: 0;top: 0;}
  230. .cdtop{padding: 34rpx 0rpx 24rpx;border-bottom: 2rpx solid #CDCDCD;
  231. .tit{font-weight: bold;font-size: 30rpx;color: #272727;margin-bottom: 16rpx;}
  232. .txt{font-weight: 500;font-size: 24rpx;color: #AAAAAA;}
  233. }
  234. .cdmain{padding: 24rpx 0 24rpx;
  235. .tit{font-weight: 500;font-size: 26rpx;color: #666666;line-height: 36rpx;margin-bottom: 30rpx;}
  236. .imgs{display: flex;align-items: center;flex-wrap: wrap;
  237. image{width: 142rpx;height: 142rpx;border-radius: 20rpx;margin: 0 18rpx 18rpx 0;}
  238. }
  239. }
  240. }
  241. .cdbtns{position: fixed;left: 0;right: 0;height: 98rpx;z-index: 2;display: flex;align-items: center;bottom: 0;
  242. view{flex: 1;display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 26rpx;height: 98rpx;
  243. &.btna{background: #FFFFFF;color: #0156FE;}
  244. &.btnb{background: #0156FE;color: #FFFFFF;}
  245. }
  246. }
  247. }
  248. .hfbox{background: #FFFFFF;border-radius: 20rpx;padding-top: 104rpx;position: relative;
  249. .hftop{width: 118rpx;height: 46rpx;position: absolute;left: -8rpx;top: 18rpx;
  250. image{width: 118rpx;height: 46rpx;position: absolute;left: 0;top: 0;}
  251. view{position: relative;z-index: 1;font-weight: bold;font-size: 26rpx;color: #FFFFFF;padding-top: 6rpx;text-align: center;}
  252. }
  253. }
  254. .hfstep{padding: 0 32rpx 44rpx 36rpx;
  255. .hfslist{padding-bottom: 44rpx;position: relative;
  256. &::before{content: '';position: absolute;left: 14rpx;top:14rpx;height: 100%;width: 2rpx;background: #E6E6E6;}
  257. .limg{width: 30rpx;height: 30rpx;margin-right: 22rpx;flex: 0 0 auto;margin-top:3rpx;
  258. .imga{width: 30rpx;height: 30rpx;}
  259. .imgb{width: 18rpx;height: 18rpx;}
  260. }
  261. .hfstit{font-weight: bold;font-size: 26rpx;color: #666666;line-height: 36rpx;margin-bottom: 24rpx;}
  262. .hfstxt{font-weight: 500;font-size: 26rpx;color: #666666;line-height: 36rpx;}
  263. }
  264. }
  265. .fjlists {display: flex;align-items: flex-start;justify-content: space-between;margin-bottom: 20rpx;
  266. &:last-child{margin-bottom: 0;}
  267. .imgl{width: 40rpx;height: 40rpx;display: flex;align-items: center;flex: 0 0 auto;
  268. image{width: 26rpx;height: 24rpx;}
  269. }
  270. .tit{font-size: 26rpx;color: #222327;font-weight: 500;margin-top: 4rpx;word-break: break-all;}
  271. .delimg{width: 40rpx;height:40rpx;margin-left: 16rpx;display: flex;align-items: center;justify-content: center;flex: 0 0 auto;
  272. image{width: 24rpx;height: 24rpx;}
  273. }
  274. .txta{color: #28C529;font-weight: 500;line-height: 40rpx;flex: 0 0 auto;margin-left: 18rpx;padding: 0 6rpx;}
  275. }
  276. </style>