list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <view>
  3. <!-- 第一种样式 人员管理-->
  4. <block v-if="datainfo.length>0">
  5. <!-- 社区资讯 -->
  6. <block v-if="type=='newssq'">
  7. <view class="walists" v-for="(ite,idx) in datainfo" :key="idx" @click="getDetail(ite.communityId)">
  8. <view class="watop">
  9. <view class="watit">
  10. <view class="tit">{{ite.communityTitle}}<text class="cir"></text></view>
  11. </view>
  12. <view class="wacoma overtwo"><rich-text :nodes="ite.communityContent"></rich-text></view>
  13. <view class="wacomb">{{ite.publishTime}}</view>
  14. </view>
  15. <view class="wabtn">
  16. <view>查看详情</view>
  17. <image :src="rimg"></image>
  18. </view>
  19. </view>
  20. </block>
  21. <!-- 投诉建议 -->
  22. <block v-if="type=='complaint'">
  23. <view class="walists" v-for="(ite,idx) in datainfo" :key="idx" @click="getDetail(ite.suggestionId)"
  24. :data-idx="idx"
  25. @touchstart="drawStart" @touchmove="drawMove" @touchend="drawEnd" :style="'right:'+ite.right+'px'"
  26. >
  27. <view class="watop watopcom">
  28. <view class="watit">
  29. <view class="tit">{{ite.title}}</view>
  30. <view class="txt" :class="ite.status==1?'co01':'coa'">{{kaType(ite.status,tsjyList)}}</view>
  31. </view>
  32. <view class="wacoma overtwo">{{ite.content}}</view>
  33. <view class="wacomb">{{ite.createTime}}</view>
  34. </view>
  35. <!-- -->
  36. <view class="spdel" v-if="ite.right>0&&checkPermi(['wuYe:suggestion:remove'])" @click.stop="getDelFn(ite.suggestionId)">删除</view>
  37. </view>
  38. <!-- checkPermi(['system:menuFood:remove'])&& -->
  39. </block>
  40. <!-- 党建资讯 -->
  41. <block v-if="type=='newsdj'">
  42. <view class="newlists" v-for="(ite,idx) in datainfo" :key="idx" @click="getDetail(ite.partyId)"
  43. >
  44. <view class="tit">{{ite.partyTitle}}</view>
  45. <view class="txt overtwo"><rich-text :nodes="ite.partyContent"></rich-text></view>
  46. <view class="stabox flexc">
  47. <view class="time flex1">{{ite.publishTime}}</view>
  48. <view class="btns flexc">
  49. <image :src="star" class="imga"></image>42
  50. <!-- <image :src="stara" class="imga"></image>42 -->
  51. </view>
  52. <view class="btns flexc">
  53. <image :src="eye" class="imgb"></image>1361
  54. </view>
  55. </view>
  56. </view>
  57. <!-- checkPermi(['system:menuFood:remove'])&& -->
  58. </block>
  59. <!-- 评论信息 -->
  60. <block v-if="type=='comment'">
  61. <view class="pllist flex" v-for="(ite,idx) in datainfo" :key="`yj${idx}`">
  62. <image :src="ite.commentUser.avatar?baseUrl+ite.commentUser.avatar:head" class="head"></image>
  63. <view class="flex1 overh">
  64. <view class="flexat mb14 ">
  65. <view class="plname flex1 over">{{ite.commentUser.nickName}}</view>
  66. <view class="plrbtn flexc flex0" @click.stop="getDzFn(ite.id,'2',ite.content,idx)">
  67. <image :src="nicond" v-if="ite.isLike=='Y'"></image>
  68. <image :src="niconb" class="imga" v-else></image>
  69. <view>点赞</view>
  70. </view>
  71. <view class="plrbtn flexc flex0" @click.stop="getHfFn(ite)">
  72. <image :src="nicone" class="imgb"></image>
  73. <view>回复</view>
  74. </view>
  75. </view>
  76. <view class="infotxt">{{ite.content}}<view class="infotime">{{ite.createDate}}</view></view>
  77. <!-- 二级回复 -->
  78. <view class="pllist flex" v-for="(aite,aidx) in ite.childrenList" :key="`ej${aidx}`">
  79. <image :src="aite.commentUser.avatar?baseUrl+aite.commentUser.avatar:head" class="head"></image>
  80. <view class="flex1 overh">
  81. <view class="flexat mb14 ">
  82. <view class="plname flex1 over">{{aite.commentUser.nickName}}</view>
  83. <view class="plrbtn flexc flex0" @click.stop="getDzFn(aite.id,'2',aite.content,idx,aidx,'ejdz')">
  84. <image :src="nicond" v-if="aite.isLike=='Y'"></image>
  85. <image :src="niconb" class="imga" v-else></image>
  86. <view>点赞</view>
  87. </view>
  88. <view class="plrbtn flexc flex0" @click.stop="getHfFn(aite)">
  89. <image :src="nicone" class="imgb"></image>
  90. <view>回复</view>
  91. </view>
  92. </view>
  93. <view class="infotxt">{{aite.content}}<view class="infotime">{{aite.createDate}}</view></view>
  94. </view>
  95. </view>
  96. <view class="flexc" v-if="ite.childrenListCount>0">
  97. <view class="zhanbox flexc" v-if="ite.reachflag" @click.stop="getZhanFn(ite,idx)">
  98. <block v-if="ite.childrenList&&ite.childrenList.length">展开更多</block>
  99. <block v-else>展开{{ite.childrenListCount}}条回复</block>
  100. <image :src="upimg" class="zhan"></image>
  101. </view>
  102. <view v-if="ite.childrenList&&ite.childrenList.length" class="zhanbox flexc ml10" @click.stop="getShouFn(idx)">收起<image :src="upimg"></view>
  103. </view>
  104. <!-- <view style="height: 16rpx;" v-else></view> -->
  105. </view>
  106. </view>
  107. </block>
  108. <view class="shax" v-if="wtdt">{{wtdt}}</view>
  109. </block>
  110. <!-- 无数据 -->
  111. <view class="nodata" v-else>
  112. <image :src="noiconpimg"></image>
  113. <view>
  114. 暂无数据
  115. </view>
  116. </view>
  117. </view>
  118. </template>
  119. <script>
  120. import {selectDictValue} from "@/utils/common.js"
  121. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  122. import config from '@/config'
  123. export default{
  124. props:{
  125. datainfo: {
  126. type: Array,
  127. default () {
  128. return []
  129. }
  130. },
  131. wtdt:{
  132. type:String,
  133. default () {
  134. return ''
  135. }
  136. },
  137. type:{
  138. type:String,
  139. default () {
  140. return 0
  141. }
  142. },
  143. tsjyList:{
  144. type:Array,
  145. default () {
  146. return []
  147. }
  148. }
  149. },
  150. data(){
  151. return{
  152. noiconpimg:require("@/static/images/nodata.png"),
  153. rimg:require('@/static/images/rimg.png'),
  154. stara:require('@/news/static/news/stara.png'),
  155. star:require('@/news/static/news/starb.png'),
  156. eye:require('@/news/static/news/eye.png'),
  157. nicona:require('@/news/static/news/nicona.png'),
  158. niconb:require('@/news/static/news/niconb.png'),
  159. niconc:require('@/news/static/news/niconc.png'),
  160. nicond:require('@/news/static/news/nicond.png'),
  161. nicone:require('@/news/static/news/nicone.png'),
  162. head:require('@/news/static/news/head.png'),
  163. upimg:require('@/mine/static/house/up.png'),
  164. baseUrl:config.baseUrl,
  165. delBtnWidth:66,//左滑默认宽度
  166. }
  167. },
  168. mounted() {
  169. },
  170. methods:{
  171. checkPermi, checkRole,
  172. kaType(data, list) {
  173. return selectDictValue(list, data);
  174. },
  175. getDetail(e){
  176. this.$emit('getDetail',e)
  177. },
  178. getZhanFn(ite,idx){
  179. var obj={
  180. ite:ite,
  181. idx:idx
  182. }
  183. this.$emit("getZhanFn",obj)
  184. },
  185. getDzFn(id,type,content,idx,aidx,atype){
  186. var obj={
  187. id:id,
  188. type:type,
  189. content:content,
  190. idx:idx,
  191. aidx:aidx,
  192. atype:atype
  193. }
  194. this.$emit("getDzFn",obj)
  195. },
  196. getHfFn(ite){
  197. var cuser=JSON.parse(JSON.stringify(ite.commentUser))
  198. var obj={
  199. parentId:ite.id,
  200. toUserId:cuser.id,
  201. toNickName:cuser.nickName,
  202. toAvatar:cuser.avatar,
  203. }
  204. this.$emit("getHfFn",obj)
  205. },
  206. getShouFn(idx){
  207. this.$emit("getShouFn",idx)
  208. },
  209. getPreview(idx,arr) {
  210. var newArr=[];
  211. arr.forEach(ite=>{
  212. var ds=this.baseUrl+ite
  213. newArr.push(ds)
  214. })
  215. uni.previewImage({
  216. urls: newArr,
  217. current:idx,
  218. success: function(data) {},
  219. fail: function(err) {}
  220. });
  221. },
  222. getDelFn(id){
  223. var that=this;
  224. uni.showModal({
  225. title: '确认删除',
  226. content: "是否确认删除",
  227. cancelText: '取消',
  228. confirmText: '确认',
  229. success: function(res) {
  230. if (res.confirm) {
  231. that.$emit('getDelFn',id)
  232. } else if (res.cancel) {
  233. }
  234. }
  235. });
  236. },
  237. //开始触摸滑动
  238. drawStart(e) {
  239. // console.log("开始触发");
  240. var touch = e.touches[0];
  241. this.startX = touch.clientX;
  242. },
  243. //触摸滑动
  244. drawMove(e) {
  245. // console.log("滑动");
  246. for (var index in this.datainfo) {
  247. // this.csListArrl[index].right=0
  248. this.$set(this.datainfo[index],'right',0);
  249. }
  250. var idx=e.currentTarget.dataset.idx
  251. var touch = e.touches[0];
  252. var item = this.datainfo[idx];
  253. var disX = this.startX - touch.clientX;
  254. if (disX >= 20) {
  255. if (disX > this.delBtnWidth) {
  256. disX = this.delBtnWidth;
  257. }
  258. // this.csListArrl[idx].right=disX
  259. this.$set(this.datainfo[idx],'right',disX);
  260. } else {
  261. // this.csListArrl[idx].right=0
  262. this.$set(this.datainfo[idx],'right',0);
  263. }
  264. },
  265. //触摸滑动结束
  266. drawEnd(e) {
  267. // console.log("滑动结束");
  268. var idx=e.currentTarget.dataset.idx
  269. var item = this.datainfo[idx];
  270. if (item.right >= this.delBtnWidth / 2) {
  271. // this.datainfo[idx].right=this.delBtnWidth
  272. this.$set(this.datainfo[idx],'right',this.delBtnWidth);
  273. } else {
  274. this.datainfo[idx].right=0
  275. }
  276. },
  277. }
  278. }
  279. </script>
  280. <style lang="scss" scoped>
  281. .flex{display: flex;}
  282. .flexc{display: flex;align-items: center;}
  283. .mb10{margin-bottom: 20rpx;}
  284. // 社区
  285. .walists{background: #FFFFFF;border-radius: 20rpx;margin-bottom: 24rpx; position: relative;
  286. .watop{
  287. padding: 0 36rpx 30rpx 38rpx;
  288. .watit{padding: 24rpx 0;margin-bottom: 4rpx;display: flex;
  289. .tit{font-weight: bold;font-size: 28rpx;color: #272727;flex: 1;
  290. .cir{width: 14rpx;margin-left: 8rpx;margin-bottom: 10rpx;height: 14rpx;display: inline-block;background: #FF6969;border-radius: 8rpx;}
  291. }
  292. .txt{font-weight: bold;font-size: 26rpx;flex: 0 0 auto;
  293. }
  294. }
  295. .wacoma{font-weight: 500;font-size: 26rpx;color: #666666;line-height: 36rpx;margin-bottom: 24rpx;}
  296. .wacomb{font-weight: 500;font-size: 24rpx;color: #AAAAAA;}
  297. }
  298. .watopcom{background-color: #ffffff;border-radius: 20rpx;position: relative;z-index: 1;}
  299. .wabtn{display: flex;align-items: center;justify-content: space-between;border-top: 2rpx solid #E5E5E5;height: 80rpx;padding: 0 38rpx;
  300. view{font-weight: 500;font-size: 24rpx;color: #666666;}
  301. image{width: 16rpx;height: 28rpx;}
  302. }
  303. }
  304. .spdel{width: 164rpx;background: #EA2D2D;font-weight: bold;font-size: 26rpx;color: #FFFFFF;display: flex;align-items: center;justify-content: center;position: absolute;right: -146rpx;top: 0;bottom: 0;padding-left: 14rpx;}
  305. //资讯
  306. .newlists{
  307. background: #FFFFFF;padding: 22rpx 24rpx;margin-bottom: 24rpx;
  308. border-radius: 20rpx;
  309. .tit{font-size: 32rpx;font-weight: bold;color: #272727;line-height: 48rpx;margin-bottom:16rpx;}
  310. .txt{font-size: 24rpx;color: #666666;line-height: 36rpx;margin-bottom: 32rpx;}
  311. .stabox{
  312. .time{font-weight: 500;font-size: 24rpx;color: #AAAAAA;line-height: 36rpx;}
  313. .btns{font-weight: 500;font-size: 22rpx;color: #666666;line-height: 36rpx;min-width: 100rpx;box-sizing: border-box;margin-left: 20rpx;
  314. .imga{width: 24rpx;height: 22rpx;margin-right: 8rpx;}
  315. .imgb{width: 24rpx;height: 18rpx;margin-right: 10rpx;}
  316. }
  317. }
  318. }
  319. //评论
  320. .pllist{padding-top: 20rpx;margin-bottom: 16rpx;border-bottom: 2rpx solid #DADADA;
  321. .head{width: 40rpx;height: 40rpx;margin-right: 18rpx;flex: 0 0 auto;}
  322. .plname{font-weight: bold;font-size: 30rpx;color: #161616;}
  323. .plrbtn{margin-left: 36rpx;
  324. image{width: 26rpx;height: 24rpx;margin-right: 16rpx;
  325. &.imga{width: 26rpx;height: 26rpx;}
  326. &.imgb{width: 26rpx;height: 22rpx;}
  327. }
  328. view{font-weight: bold;font-size: 24rpx;color: #314081;}
  329. }
  330. .infotxt{font-weight: 500;font-size: 26rpx;color: #161616;line-height: 40rpx;margin-bottom: 30rpx;
  331. &:before {content: "";float: right;width: 0;height: calc(100% - 16px);background: red;}
  332. .infotime{font-weight: 500;font-size: 24rpx;color: #666666; float: right;clear: both;}
  333. }
  334. .pllist{
  335. padding-top: 0;border-bottom: none;margin-bottom: 0;
  336. }
  337. .zhanbox{font-weight: 500;font-size: 24rpx;color: #AAAAAA;padding: 16rpx 0;
  338. image{width: 20rpx;height: 12rpx;margin-left: 18rpx;transition: all 0.3s;
  339. &.zhan{transform: rotate(-180deg);}
  340. }
  341. }
  342. }
  343. // 无数据
  344. .nodata{display: flex;flex-direction: column;align-items: center;
  345. image{width: 440rpx;height: 440rpx;}
  346. view{font-size: 30rpx;color: #666666;font-weight: bold;}
  347. }
  348. </style>