list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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">
  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">
  72. <image :src="nicone" class="imgb"></image>
  73. <view>回复</view>
  74. </view>
  75. </view>
  76. <view class="infotxt mb6">{{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">
  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">
  89. <image :src="nicone" class="imgb"></image>
  90. <view>回复</view>
  91. </view>
  92. </view>
  93. <view class="infotxt mb6">{{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" @click.stop="getZhanFn(ite,idx)">
  98. 展开{{ite.childrenListCount}}条回复<image :src="upimg" class="zhan"></image>
  99. </view>
  100. <view class="zhanbox flexc ml10" @click.stop="getShouFn(ite,idx)">收起<image :src="upimg"></view>
  101. </view>
  102. <view style="height: 16rpx;" v-else></view>
  103. </view>
  104. </view>
  105. </block>
  106. <view class="shax" v-if="wtdt">{{wtdt}}</view>
  107. </block>
  108. <!-- 无数据 -->
  109. <view class="nodata" v-else>
  110. <image :src="noiconpimg"></image>
  111. <view>
  112. 暂无数据
  113. </view>
  114. </view>
  115. </view>
  116. </template>
  117. <script>
  118. import {selectDictValue} from "@/utils/common.js"
  119. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  120. import config from '@/config'
  121. export default{
  122. props:{
  123. datainfo: {
  124. type: Array,
  125. default () {
  126. return []
  127. }
  128. },
  129. wtdt:{
  130. type:String,
  131. default () {
  132. return ''
  133. }
  134. },
  135. type:{
  136. type:String,
  137. default () {
  138. return 0
  139. }
  140. },
  141. tsjyList:{
  142. type:Array,
  143. default () {
  144. return []
  145. }
  146. }
  147. },
  148. data(){
  149. return{
  150. noiconpimg:require("@/static/images/nodata.png"),
  151. rimg:require('@/static/images/rimg.png'),
  152. stara:require('@/news/static/news/stara.png'),
  153. star:require('@/news/static/news/starb.png'),
  154. eye:require('@/news/static/news/eye.png'),
  155. nicona:require('@/news/static/news/nicona.png'),
  156. niconb:require('@/news/static/news/niconb.png'),
  157. niconc:require('@/news/static/news/niconc.png'),
  158. nicond:require('@/news/static/news/nicond.png'),
  159. nicone:require('@/news/static/news/nicone.png'),
  160. head:require('@/news/static/news/head.png'),
  161. upimg:require('@/mine/static/house/up.png'),
  162. baseUrl:config.baseUrl,
  163. delBtnWidth:66,//左滑默认宽度
  164. }
  165. },
  166. mounted() {
  167. },
  168. methods:{
  169. checkPermi, checkRole,
  170. kaType(data, list) {
  171. return selectDictValue(list, data);
  172. },
  173. getDetail(e){
  174. this.$emit('getDetail',e)
  175. },
  176. getZhanFn(ite,idx){
  177. var obj={
  178. ite:ite,
  179. idx:idx
  180. }
  181. this.$emit("getZhanFn",obj)
  182. },
  183. getShouFn(idx){
  184. },
  185. getPreview(idx,arr) {
  186. var newArr=[];
  187. arr.forEach(ite=>{
  188. var ds=this.baseUrl+ite
  189. newArr.push(ds)
  190. })
  191. uni.previewImage({
  192. urls: newArr,
  193. current:idx,
  194. success: function(data) {},
  195. fail: function(err) {}
  196. });
  197. },
  198. getDelFn(id){
  199. var that=this;
  200. uni.showModal({
  201. title: '确认删除',
  202. content: "是否确认删除",
  203. cancelText: '取消',
  204. confirmText: '确认',
  205. success: function(res) {
  206. if (res.confirm) {
  207. that.$emit('getDelFn',id)
  208. } else if (res.cancel) {
  209. }
  210. }
  211. });
  212. },
  213. //开始触摸滑动
  214. drawStart(e) {
  215. // console.log("开始触发");
  216. var touch = e.touches[0];
  217. this.startX = touch.clientX;
  218. },
  219. //触摸滑动
  220. drawMove(e) {
  221. // console.log("滑动");
  222. for (var index in this.datainfo) {
  223. // this.csListArrl[index].right=0
  224. this.$set(this.datainfo[index],'right',0);
  225. }
  226. var idx=e.currentTarget.dataset.idx
  227. var touch = e.touches[0];
  228. var item = this.datainfo[idx];
  229. var disX = this.startX - touch.clientX;
  230. if (disX >= 20) {
  231. if (disX > this.delBtnWidth) {
  232. disX = this.delBtnWidth;
  233. }
  234. // this.csListArrl[idx].right=disX
  235. this.$set(this.datainfo[idx],'right',disX);
  236. } else {
  237. // this.csListArrl[idx].right=0
  238. this.$set(this.datainfo[idx],'right',0);
  239. }
  240. },
  241. //触摸滑动结束
  242. drawEnd(e) {
  243. // console.log("滑动结束");
  244. var idx=e.currentTarget.dataset.idx
  245. var item = this.datainfo[idx];
  246. if (item.right >= this.delBtnWidth / 2) {
  247. // this.datainfo[idx].right=this.delBtnWidth
  248. this.$set(this.datainfo[idx],'right',this.delBtnWidth);
  249. } else {
  250. this.datainfo[idx].right=0
  251. }
  252. },
  253. }
  254. }
  255. </script>
  256. <style lang="scss" scoped>
  257. .flex{display: flex;}
  258. .flexc{display: flex;align-items: center;}
  259. .mb10{margin-bottom: 20rpx;}
  260. // 社区
  261. .walists{background: #FFFFFF;border-radius: 20rpx;margin-bottom: 24rpx; position: relative;
  262. .watop{
  263. padding: 0 36rpx 30rpx 38rpx;
  264. .watit{padding: 24rpx 0;margin-bottom: 4rpx;display: flex;
  265. .tit{font-weight: bold;font-size: 28rpx;color: #272727;flex: 1;
  266. .cir{width: 14rpx;margin-left: 8rpx;margin-bottom: 10rpx;height: 14rpx;display: inline-block;background: #FF6969;border-radius: 8rpx;}
  267. }
  268. .txt{font-weight: bold;font-size: 26rpx;flex: 0 0 auto;
  269. }
  270. }
  271. .wacoma{font-weight: 500;font-size: 26rpx;color: #666666;line-height: 36rpx;margin-bottom: 24rpx;}
  272. .wacomb{font-weight: 500;font-size: 24rpx;color: #AAAAAA;}
  273. }
  274. .watopcom{background-color: #ffffff;border-radius: 20rpx;position: relative;z-index: 1;}
  275. .wabtn{display: flex;align-items: center;justify-content: space-between;border-top: 2rpx solid #E5E5E5;height: 80rpx;padding: 0 38rpx;
  276. view{font-weight: 500;font-size: 24rpx;color: #666666;}
  277. image{width: 16rpx;height: 28rpx;}
  278. }
  279. }
  280. .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;}
  281. //资讯
  282. .newlists{
  283. background: #FFFFFF;padding: 22rpx 24rpx;margin-bottom: 24rpx;
  284. border-radius: 20rpx;
  285. .tit{font-size: 32rpx;font-weight: bold;color: #272727;line-height: 48rpx;margin-bottom:16rpx;}
  286. .txt{font-size: 24rpx;color: #666666;line-height: 36rpx;margin-bottom: 32rpx;}
  287. .stabox{
  288. .time{font-weight: 500;font-size: 24rpx;color: #AAAAAA;line-height: 36rpx;}
  289. .btns{font-weight: 500;font-size: 22rpx;color: #666666;line-height: 36rpx;min-width: 100rpx;box-sizing: border-box;margin-left: 20rpx;
  290. .imga{width: 24rpx;height: 22rpx;margin-right: 8rpx;}
  291. .imgb{width: 24rpx;height: 18rpx;margin-right: 10rpx;}
  292. }
  293. }
  294. }
  295. //评论
  296. .pllist{padding-top: 20rpx;margin-bottom: 16rpx;border-bottom: 2rpx solid #DADADA;
  297. .head{width: 40rpx;height: 40rpx;margin-right: 18rpx;flex: 0 0 auto;}
  298. .plname{font-weight: bold;font-size: 30rpx;color: #161616;}
  299. .plrbtn{margin-left: 36rpx;
  300. image{width: 26rpx;height: 24rpx;margin-right: 16rpx;
  301. &.imga{width: 26rpx;height: 26rpx;}
  302. &.imgb{width: 26rpx;height: 22rpx;}
  303. }
  304. view{font-weight: bold;font-size: 24rpx;color: #314081;}
  305. }
  306. .infotxt{font-weight: 500;font-size: 26rpx;color: #161616;line-height: 40rpx;
  307. &:before {content: "";float: right;width: 0;height: calc(100% - 16px);background: red;}
  308. .infotime{font-weight: 500;font-size: 24rpx;color: #666666; float: right;clear: both;}
  309. }
  310. .pllist{
  311. padding-top: 0;border-bottom: none;margin-bottom: 0;
  312. }
  313. .zhanbox{font-weight: 500;font-size: 24rpx;color: #AAAAAA;padding: 16rpx 0;
  314. image{width: 20rpx;height: 12rpx;margin-left: 18rpx;transition: all 0.3s;
  315. &.zhan{transform: rotate(-180deg);}
  316. }
  317. }
  318. }
  319. // 无数据
  320. .nodata{display: flex;flex-direction: column;align-items: center;
  321. image{width: 440rpx;height: 440rpx;}
  322. view{font-size: 30rpx;color: #666666;font-weight: bold;}
  323. }
  324. </style>