list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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" @click.stop="getScFn(ite,idx)">
  49. <image :src="star" class="imga" v-if="ite.isStars=='Y'"></image>
  50. <image :src="stara" class="imga" v-else></image>{{ite.starsCount||0}}
  51. </view>
  52. <view class="btns flexc">
  53. <image :src="eye" class="imgb"></image>{{ite.viewCount||0}}
  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('yjhf',ite,ite.id)">
  72. <image :src="nicone" class="imgb"></image>
  73. <view>回复</view>
  74. </view>
  75. <view class="plrbtn flexc flex0" @click.stop="getDelFn(ite.id)" v-if="checkPermi(['wuYe:commentIndex:remove'])&&ite.isMyself=='Y'">
  76. <image :src="del" class="imgc"></image>
  77. <view class="cof4">删除</view>
  78. </view>
  79. </view>
  80. <view class="infotxt">
  81. <rich-text :nodes="analyzeEmoji(ite.content)"></rich-text>
  82. <view class="infotime">{{ite.createDate}}</view></view>
  83. <!-- 二级回复 -->
  84. <view class="pllist flex" v-for="(aite,aidx) in ite.childrenList" :key="`ej${aidx}`">
  85. <image :src="aite.commentUser.avatar?baseUrl+aite.commentUser.avatar:head" class="head"></image>
  86. <view class="flex1 overh">
  87. <view class="flexat mb14 ">
  88. <view class="plname flex1 over flexc">
  89. <view class="over">{{aite.commentUser.nickName}}</view>
  90. <block v-if="aite.toRoot=='Y'">
  91. <image :src="rimg" class="rimg"></image>
  92. <view class="over">{{aite.targetUser.nickName}}</view>
  93. </block>
  94. <!-- 判断是不是二级回复的回复 加字段-->
  95. <!-- <block v-if="ite."></block> -->
  96. </view>
  97. <view class="plrbtn flexc flex0" @click.stop="getDzFn(aite.id,'2',aite.content,idx,aidx,'ejdz')">
  98. <image :src="nicond" v-if="aite.isLike=='Y'"></image>
  99. <image :src="niconb" class="imga" v-else></image>
  100. <view>点赞</view>
  101. </view>
  102. <view class="plrbtn flexc flex0" @click.stop="getHfFn('ejhf',aite,ite.id)">
  103. <image :src="nicone" class="imgb"></image>
  104. <view>回复</view>
  105. </view>
  106. <view class="plrbtn flexc flex0" @click.stop="getDelFn(aite.id)" v-if="checkPermi(['wuYe:commentIndex:remove'])&&aite.isMyself=='Y'">
  107. <image :src="del" class="imgc"></image>
  108. <view class="cof4">删除</view>
  109. </view>
  110. </view>
  111. <view class="infotxt">
  112. <rich-text :nodes="analyzeEmoji(aite.content)"></rich-text>
  113. <view class="infotime">{{aite.createDate}}</view></view>
  114. </view>
  115. </view>
  116. <view class="flexc" v-if="ite.childrenListCount>0">
  117. <view class="zhanbox flexc" v-if="ite.reachflag" @click.stop="getZhanFn(ite,idx)">
  118. <block v-if="ite.childrenList&&ite.childrenList.length">展开更多</block>
  119. <block v-else>展开{{ite.childrenListCount}}条回复</block>
  120. <image :src="upimg" class="zhan"></image>
  121. </view>
  122. <view v-if="ite.childrenList&&ite.childrenList.length" class="zhanbox flexc ml10" @click.stop="getShouFn(idx)">收起<image :src="upimg"></view>
  123. </view>
  124. <!-- <view style="height: 16rpx;" v-else></view> -->
  125. </view>
  126. </view>
  127. </block>
  128. <view class="shax" v-if="wtdt">{{wtdt}}</view>
  129. </block>
  130. <!-- 无数据 -->
  131. <view class="nodata" v-else>
  132. <image :src="noiconpimg"></image>
  133. <view>
  134. 暂无数据
  135. </view>
  136. </view>
  137. </view>
  138. </template>
  139. <script>
  140. import {selectDictValue} from "@/utils/common.js"
  141. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  142. import config from '@/config'
  143. export default{
  144. props:{
  145. datainfo: {
  146. type: Array,
  147. default () {
  148. return []
  149. }
  150. },
  151. wtdt:{
  152. type:String,
  153. default () {
  154. return ''
  155. }
  156. },
  157. type:{
  158. type:String,
  159. default () {
  160. return 0
  161. }
  162. },
  163. tsjyList:{
  164. type:Array,
  165. default () {
  166. return []
  167. }
  168. }
  169. },
  170. data(){
  171. return{
  172. noiconpimg:require("@/static/images/nodata.png"),
  173. rimg:require('@/static/images/rimg.png'),
  174. stara:require('@/news/static/news/stara.png'),
  175. star:require('@/news/static/news/starb.png'),
  176. eye:require('@/news/static/news/eye.png'),
  177. nicona:require('@/news/static/news/nicona.png'),
  178. niconb:require('@/news/static/news/niconb.png'),
  179. niconc:require('@/news/static/news/niconc.png'),
  180. nicond:require('@/news/static/news/nicond.png'),
  181. nicone:require('@/news/static/news/nicone.png'),
  182. del:require('@/news/static/news/delb.png'),
  183. head:require('@/news/static/news/head.png'),
  184. upimg:require('@/mine/static/house/up.png'),
  185. baseUrl:config.baseUrl,
  186. delBtnWidth:66,//左滑默认宽度
  187. OwOlist: [
  188. //表情包和表情路径
  189. { title: "微笑", url: "weixiao.gif" },
  190. { title: "嘻嘻", url: "xixi.gif" },
  191. { title: "哈哈", url: "haha.gif" },
  192. { title: "可爱", url: "keai.gif" },
  193. { title: "可怜", url: "kelian.gif" },
  194. { title: "挖鼻", url: "wabi.gif" },
  195. { title: "吃惊", url: "chijing.gif" },
  196. { title: "害羞", url: "haixiu.gif" },
  197. { title: "挤眼", url: "jiyan.gif" },
  198. { title: "闭嘴", url: "bizui.gif" },
  199. { title: "鄙视", url: "bishi.gif" },
  200. { title: "爱你", url: "aini.gif" },
  201. { title: "泪", url: "lei.gif" },
  202. { title: "偷笑", url: "touxiao.gif" },
  203. { title: "亲亲", url: "qinqin.gif" },
  204. { title: "生病", url: "shengbing.gif" },
  205. { title: "太开心", url: "taikaixin.gif" },
  206. { title: "白眼", url: "baiyan.gif" },
  207. { title: "右哼哼", url: "youhengheng.gif" },
  208. { title: "左哼哼", url: "zuohengheng.gif" },
  209. { title: "嘘", url: "xu.gif" },
  210. { title: "衰", url: "shuai.gif" },
  211. { title: "吐", url: "tu.gif" },
  212. { title: "哈欠", url: "haqian.gif" },
  213. { title: "抱抱", url: "baobao.gif" },
  214. { title: "怒", url: "nu.gif" },
  215. { title: "疑问", url: "yiwen.gif" },
  216. { title: "馋嘴", url: "chanzui.gif" },
  217. { title: "拜拜", url: "baibai.gif" },
  218. { title: "思考", url: "sikao.gif" },
  219. { title: "汗", url: "han.gif" },
  220. { title: "困", url: "kun.gif" },
  221. { title: "睡", url: "shui.gif" },
  222. { title: "钱", url: "qian.gif" },
  223. { title: "失望", url: "shiwang.gif" },
  224. { title: "酷", url: "ku.gif" },
  225. { title: "色", url: "se.gif" },
  226. { title: "哼", url: "heng.gif" },
  227. { title: "鼓掌", url: "guzhang.gif" },
  228. { title: "晕", url: "yun.gif" },
  229. { title: "悲伤", url: "beishang.gif" },
  230. { title: "抓狂", url: "zhuakuang.gif" },
  231. { title: "黑线", url: "heixian.gif" },
  232. { title: "阴险", url: "yinxian.gif" },
  233. { title: "怒骂", url: "numa.gif" },
  234. { title: "互粉", url: "hufen.gif" },
  235. { title: "书呆子", url: "shudaizi.gif" },
  236. { title: "愤怒", url: "fennu.gif" },
  237. { title: "感冒", url: "ganmao.gif" },
  238. { title: "心", url: "xin.gif" },
  239. { title: "伤心", url: "shangxin.gif" },
  240. { title: "猪", url: "zhu.gif" },
  241. { title: "熊猫", url: "xiongmao.gif" },
  242. { title: "兔子", url: "tuzi.gif" },
  243. { title: "喔克", url: "ok.gif" },
  244. { title: "耶", url: "ye.gif" },
  245. { title: "棒棒", url: "good.gif" },
  246. { title: "不", url: "no.gif" },
  247. { title: "赞", url: "zan.gif" },
  248. { title: "来", url: "lai.gif" },
  249. { title: "弱", url: "ruo.gif" },
  250. { title: "草泥马", url: "caonima.gif" },
  251. { title: "神马", url: "shenma.gif" },
  252. { title: "囧", url: "jiong.gif" },
  253. { title: "浮云", url: "fuyun.gif" },
  254. { title: "给力", url: "geili.gif" },
  255. { title: "围观", url: "weiguan.gif" },
  256. { title: "威武", url: "weiwu.gif" },
  257. { title: "话筒", url: "huatong.gif" },
  258. { title: "蜡烛", url: "lazhu.gif" },
  259. { title: "蛋糕", url: "dangao.gif" },
  260. { title: "发红包", url: "fahongbao.gif" },
  261. ],
  262. }
  263. },
  264. mounted() {
  265. },
  266. methods:{
  267. checkPermi, checkRole,
  268. kaType(data, list) {
  269. return selectDictValue(list, data);
  270. },
  271. getDetail(e){
  272. this.$emit('getDetail',e)
  273. },
  274. analyzeEmoji(cont){
  275. //编译表情替换成图片展示出来
  276. var pattern1 = /\[[\u4e00-\u9fa5]+\]/g;
  277. var pattern2 = /\[[\u4e00-\u9fa5]+\]/;
  278. var content = cont.match(pattern1);
  279. var str = cont;
  280. if (content) {
  281. for (var i = 0; i < content.length; i++) {
  282. for (var j = 0; j < this.OwOlist.length; j++) {
  283. if ("[" + this.OwOlist[j].title + "]" == content[i]) {
  284. var src = this.OwOlist[j].url;
  285. break;
  286. }
  287. }
  288. var s = require("./img/face/" + src);
  289. var imoj = "<img src='" + s + "'/>";
  290. str = str.replace(pattern2, imoj);
  291. }
  292. }
  293. return str;
  294. },
  295. getZhanFn(ite,idx){
  296. var obj={
  297. ite:ite,
  298. idx:idx
  299. }
  300. this.$emit("getZhanFn",obj)
  301. },
  302. getDzFn(id,type,content,idx,aidx,atype){
  303. var obj={
  304. id:id,
  305. type:type,
  306. content:content,
  307. idx:idx,
  308. aidx:aidx,
  309. atype:atype
  310. }
  311. this.$emit("getDzFn",obj)
  312. },
  313. getScFn(ite,idx){
  314. var obj={
  315. ite:ite,
  316. idx:idx
  317. }
  318. this.$emit("getScFn",obj)
  319. },
  320. getHfFn(type,ite,id){
  321. var cuser=JSON.parse(JSON.stringify(ite.commentUser))
  322. var obj={
  323. parentId:id,
  324. toUserId:cuser.id,
  325. toNickName:cuser.nickName,
  326. toAvatar:cuser.avatar,
  327. type:type||""
  328. }
  329. this.$emit("getHfFn",obj)
  330. },
  331. getShouFn(idx){
  332. this.$emit("getShouFn",idx)
  333. },
  334. // getPreview(idx,arr) {
  335. // var newArr=[];
  336. // arr.forEach(ite=>{
  337. // var ds=this.baseUrl+ite
  338. // newArr.push(ds)
  339. // })
  340. // uni.previewImage({
  341. // urls: newArr,
  342. // current:idx,
  343. // success: function(data) {},
  344. // fail: function(err) {}
  345. // });
  346. // },
  347. getDelFn(id){
  348. var that=this;
  349. uni.showModal({
  350. title: '确认删除',
  351. content: "是否确认删除",
  352. cancelText: '取消',
  353. confirmText: '确认',
  354. success: function(res) {
  355. if (res.confirm) {
  356. that.$emit('getDelFn',id)
  357. } else if (res.cancel) {
  358. }
  359. }
  360. });
  361. },
  362. //开始触摸滑动
  363. drawStart(e) {
  364. // console.log("开始触发");
  365. var touch = e.touches[0];
  366. this.startX = touch.clientX;
  367. },
  368. //触摸滑动
  369. drawMove(e) {
  370. // console.log("滑动");
  371. for (var index in this.datainfo) {
  372. // this.csListArrl[index].right=0
  373. this.$set(this.datainfo[index],'right',0);
  374. }
  375. var idx=e.currentTarget.dataset.idx
  376. var touch = e.touches[0];
  377. var item = this.datainfo[idx];
  378. var disX = this.startX - touch.clientX;
  379. if (disX >= 20) {
  380. if (disX > this.delBtnWidth) {
  381. disX = this.delBtnWidth;
  382. }
  383. // this.csListArrl[idx].right=disX
  384. this.$set(this.datainfo[idx],'right',disX);
  385. } else {
  386. // this.csListArrl[idx].right=0
  387. this.$set(this.datainfo[idx],'right',0);
  388. }
  389. },
  390. //触摸滑动结束
  391. drawEnd(e) {
  392. // console.log("滑动结束");
  393. var idx=e.currentTarget.dataset.idx
  394. var item = this.datainfo[idx];
  395. if (item.right >= this.delBtnWidth / 2) {
  396. // this.datainfo[idx].right=this.delBtnWidth
  397. this.$set(this.datainfo[idx],'right',this.delBtnWidth);
  398. } else {
  399. this.datainfo[idx].right=0
  400. }
  401. },
  402. }
  403. }
  404. </script>
  405. <style lang="scss" scoped>
  406. .flex{display: flex;}
  407. .flexc{display: flex;align-items: center;}
  408. .mb10{margin-bottom: 20rpx;}
  409. // 社区
  410. .walists{background: #FFFFFF;border-radius: 20rpx;margin-bottom: 24rpx; position: relative;
  411. .watop{
  412. padding: 0 36rpx 30rpx 38rpx;
  413. .watit{padding: 24rpx 0;margin-bottom: 4rpx;display: flex;
  414. .tit{font-weight: bold;font-size: 28rpx;color: #272727;flex: 1;
  415. .cir{width: 14rpx;margin-left: 8rpx;margin-bottom: 10rpx;height: 14rpx;display: inline-block;background: #FF6969;border-radius: 8rpx;}
  416. }
  417. .txt{font-weight: bold;font-size: 26rpx;flex: 0 0 auto;
  418. }
  419. }
  420. .wacoma{font-weight: 500;font-size: 26rpx;color: #666666;line-height: 36rpx;margin-bottom: 24rpx;}
  421. .wacomb{font-weight: 500;font-size: 24rpx;color: #AAAAAA;}
  422. }
  423. .watopcom{background-color: #ffffff;border-radius: 20rpx;position: relative;z-index: 1;}
  424. .wabtn{display: flex;align-items: center;justify-content: space-between;border-top: 2rpx solid #E5E5E5;height: 80rpx;padding: 0 38rpx;
  425. view{font-weight: 500;font-size: 24rpx;color: #666666;}
  426. image{width: 16rpx;height: 28rpx;}
  427. }
  428. }
  429. .rimg{width: 16rpx;height: 28rpx;margin: 0 10rpx;flex: 0 0 auto;}
  430. .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;}
  431. //资讯
  432. .newlists{
  433. background: #FFFFFF;padding: 22rpx 24rpx;margin-bottom: 24rpx;
  434. border-radius: 20rpx;
  435. .tit{font-size: 32rpx;font-weight: bold;color: #272727;line-height: 48rpx;margin-bottom:16rpx;}
  436. .txt{font-size: 24rpx;color: #666666;line-height: 36rpx;margin-bottom: 32rpx;}
  437. .stabox{
  438. .time{font-weight: 500;font-size: 24rpx;color: #AAAAAA;line-height: 36rpx;}
  439. .btns{font-weight: 500;font-size: 22rpx;color: #666666;line-height: 36rpx;min-width: 100rpx;box-sizing: border-box;margin-left: 20rpx;
  440. .imga{width: 24rpx;height: 22rpx;margin-right: 8rpx;}
  441. .imgb{width: 24rpx;height: 18rpx;margin-right: 10rpx;}
  442. .imgc{width: 26rpx;height: 26rpx;margin-right: 10rpx;}
  443. }
  444. }
  445. }
  446. //评论
  447. .pllist{padding-top: 20rpx;margin-bottom: 16rpx;border-bottom: 2rpx solid #DADADA;
  448. .head{width: 40rpx;height: 40rpx;margin-right: 18rpx;flex: 0 0 auto;}
  449. .plname{font-weight: bold;font-size: 30rpx;color: #161616;
  450. view{max-width: 50%;}
  451. }
  452. .plrbtn{margin-left: 36rpx;
  453. image{width: 26rpx;height: 24rpx;margin-right: 16rpx;
  454. &.imga{width: 26rpx;height: 26rpx;}
  455. &.imgb{width: 26rpx;height: 22rpx;}
  456. }
  457. view{font-weight: bold;font-size: 24rpx;color: #314081;}
  458. }
  459. .infotxt{font-weight: 500;font-size: 26rpx;color: #161616;line-height: 40rpx;margin-bottom: 30rpx;
  460. &:before {content: "";float: right;width: 0;height: calc(100% - 16px);background: red;}
  461. .infotime{font-weight: 500;font-size: 24rpx;color: #666666; float: right;clear: both;}
  462. image{width: 44rpx;height: 44rpx;}
  463. }
  464. .pllist{
  465. padding-top: 0;border-bottom: none;margin-bottom: 0;
  466. }
  467. .zhanbox{font-weight: 500;font-size: 24rpx;color: #AAAAAA;padding: 16rpx 0;
  468. image{width: 20rpx;height: 12rpx;margin-left: 18rpx;transition: all 0.3s;
  469. &.zhan{transform: rotate(-180deg);}
  470. }
  471. }
  472. }
  473. // 无数据
  474. .nodata{display: flex;flex-direction: column;align-items: center;
  475. image{width: 440rpx;height: 440rpx;}
  476. view{font-size: 30rpx;color: #666666;font-weight: bold;}
  477. }
  478. </style>