list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <view>
  3. <!-- 第一种样式 人员管理-->
  4. <block v-if="datainfo.length>0">
  5. <!-- 我的互动 -->
  6. <block v-if="type=='myhd'">
  7. <view class="mb12 pr" v-for="(ite,idx) in datainfo" :key="idx"
  8. :data-idx="idx"
  9. @touchstart="drawStart" @touchmove="drawMove" @touchend="drawEnd" :style="'right:'+ite.right+'px'"
  10. >
  11. <view class="hdlist pd12 flex">
  12. <image :src="man" class="mhead flex0"></image>
  13. <view class="flex1 overh">
  14. <view class="flexc mb6">
  15. <view class="name flex1 over">{{ite.nickName}}</view>
  16. <view class="tit flex0 ml10">
  17. <block v-if="ite.targetType==1">评论了你的文章</block>
  18. <block v-if="ite.targetType==2">点赞了你的文章</block>
  19. <block v-if="ite.targetType==3">收藏了你的文章</block>
  20. <block v-if="ite.targetType==4">回复了你的评论</block>
  21. <block v-if="ite.targetType==5">点赞了你的评论</block>
  22. </view>
  23. <view class="time flex0 ml10">{{ite.createTime}}</view>
  24. </view>
  25. <view class="flexc overh mb4">
  26. <view class="line bga"></view>
  27. <view class="txt over flex1">{{ite.targetTitle}}</view>
  28. <image :src="rimg" class="rimg ml10"></image>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="spdel" v-if="ite.right>0&&checkPermi(['wuYe:residentInfo:remove'])" @click.stop="getDelFn(ite.residentId)">删除</view>
  33. </view>
  34. </block>
  35. <block v-if="type=='plsh'">
  36. <view class="mb12 pr" v-for="(ite,idx) in datainfo" :key="idx"
  37. :data-idx="idx"
  38. @touchstart="drawStart" @touchmove="drawMove" @touchend="drawEnd" :style="'right:'+ite.right+'px'"
  39. >
  40. <view class="hdlist ">
  41. <view class="pd12 flex">
  42. <image :src="ite.avatar?baseUrl+ite.avatar:man" class="mhead flex0"></image>
  43. <view class="flex1 overh">
  44. <view class="flexc mb6">
  45. <view class="name flex1 over">{{ite.nickName}}</view>
  46. <view class="time flex0 ml10">02-26</view>
  47. </view>
  48. <view class="txt mb8">{{ite.commentContent}}</view>
  49. <view class="flexc overh mb2">
  50. <view class="line bgd"></view>
  51. <view class="txta over flex1">{{ite.communityTitle}}</view>
  52. <image :src="rimg" class="rimg ml10"></image>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="shbtns flexc pd12" >
  57. <view class="btn bga" @click="getSh('4',ite)">不予展示</view>
  58. <view class="flex1"></view>
  59. <view class="btn bgb" @click="getSh('3',ite)">不通过</view>
  60. <view class="btn bgc" @click="getSh('2',ite)">通过</view>
  61. </view>
  62. </view>
  63. <view class="spdel" v-if="ite.right>0&&checkPermi(['wuYe:residentInfo:remove'])" @click.stop="getDelFn(ite.residentId)">删除</view>
  64. </view>
  65. </block>
  66. <!-- 我的点赞,收藏,评论 :data-idx="idx"
  67. @touchstart="drawStart" @touchmove="drawMove" @touchend="drawEnd" :style="'right:'+ite.right+'px'"-->
  68. <block v-if="type=='wdhd'">
  69. <view class="mb12 pr" v-for="(ite,idx) in datainfo" :key="idx" @click="getDetail(ite)">
  70. <view class="hdlist ">
  71. <view class="pd12 flex">
  72. <image :src="ite.avatar?baseUrl+ite.avatar:man" class="mhead flex0"></image>
  73. <view class="flex1 overh">
  74. <view class="flexc mb6">
  75. <view class="name flex1 over">{{ite.nickName}}</view>
  76. <view class="time flex0 ml10">{{ite.createTime}}</view>
  77. </view>
  78. <view class="txt mb8">{{ite.commentContent}}</view>
  79. <view class="flexc overh mb2">
  80. <view class="line bgd"></view>
  81. <view class="txta over flex1" v-if="tabval=='mypl'">{{ite.communityTitle}}</view>
  82. <view class="txta over flex1" v-else>{{ite.targetTitle}}</view>
  83. <image :src="rimg" class="rimg ml10"></image>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- <view class="spdel" v-if="ite.right>0&&checkPermi(['wuYe:residentInfo:remove'])" @click.stop="getDelFn(ite.residentId)">删除</view> -->
  89. </view>
  90. </block>
  91. <view class="shax" v-if="wtdt">{{wtdt}}</view>
  92. </block>
  93. <!-- 无数据 -->
  94. <view class="nodata" v-else>
  95. <image :src="noiconpimg"></image>
  96. <view>
  97. 暂无数据
  98. </view>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. import {selectDictValue} from "@/utils/common.js"
  104. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  105. import config from '@/config'
  106. export default{
  107. props:{
  108. datainfo: {
  109. type: Array,
  110. default () {
  111. return []
  112. }
  113. },
  114. wtdt:{
  115. type:String,
  116. default () {
  117. return ''
  118. }
  119. },
  120. type:{
  121. type:String,
  122. default () {
  123. return 0
  124. }
  125. },
  126. clcxList:{
  127. type: Array,
  128. default () {
  129. return []
  130. }
  131. },
  132. rymmList:{
  133. type: Array,
  134. default () {
  135. return []
  136. }
  137. },
  138. tabval:{
  139. type:String,
  140. default () {
  141. return ''
  142. }
  143. }
  144. },
  145. data(){
  146. return{
  147. noiconpimg:require("@/static/nodata.png"),
  148. man:require("@/people/static/people/man.png"),
  149. woman:require("@/people/static/people/woman.png"),
  150. rimg:require("@/static/images/rimga.png"),
  151. baseUrl:config.baseUrl,
  152. delBtnWidth:66,//左滑默认宽度
  153. }
  154. },
  155. mounted() {
  156. },
  157. methods:{
  158. checkPermi, checkRole,
  159. kaType(data, list) {
  160. return selectDictValue(list, data);
  161. },
  162. getDetail(e){
  163. console.log(222)
  164. this.$emit('getDetail',e)
  165. },
  166. getDelFn(e){
  167. var that=this;
  168. uni.showModal({
  169. title: '确认删除',
  170. content: "是否确认删除",
  171. cancelText: '取消',
  172. confirmText: '确认',
  173. success: function(res) {
  174. if (res.confirm) {
  175. that.$emit('getDelFn',e)
  176. } else if (res.cancel) {
  177. }
  178. }
  179. });
  180. },
  181. getSh(type,ite){
  182. var that=this;
  183. var str="";
  184. if(type=='2'){
  185. str="通过"
  186. }else if(type=='3'){
  187. str="不通过"
  188. }else if(type=='4'){
  189. str="下架"
  190. }
  191. uni.showModal({
  192. title: '确认'+str,
  193. content: "是否确认"+str,
  194. cancelText: '取消',
  195. confirmText: '确认',
  196. success: function(res) {
  197. if (res.confirm) {
  198. var obj={
  199. status:type,
  200. contentId:ite.contentId,
  201. commentId:ite.commentId,
  202. }
  203. that.$emit('getSh',obj)
  204. } else if (res.cancel) {
  205. }
  206. }
  207. });
  208. },
  209. getZhan(idx){
  210. // var obj=JSON.parse(JSON.stringify(this.datainfo))[idx]
  211. // obj.zhanflag=!obj.zhanflag;
  212. // this.datainfo.splice(idx,1,obj);
  213. this.datainfo[idx].zhanflag=!this.datainfo[idx].zhanflag
  214. },
  215. getDelFn(id){
  216. var that=this;
  217. uni.showModal({
  218. title: '确认删除',
  219. content: "是否确认删除",
  220. cancelText: '取消',
  221. confirmText: '确认',
  222. success: function(res) {
  223. if (res.confirm) {
  224. that.$emit('getDelFn',id)
  225. } else if (res.cancel) {
  226. }
  227. }
  228. });
  229. },
  230. getAgeFromID(idNumber) {
  231. if(idNumber){
  232. const birthDateStr = idNumber.substring(6, 14);
  233. const birthYear = parseInt(birthDateStr.substring(0, 4));
  234. const birthMonth = parseInt(birthDateStr.substring(4, 6));
  235. const birthDay = parseInt(birthDateStr.substring(6, 8));
  236. const today = new Date();
  237. const currentYear = today.getFullYear();
  238. const currentMonth = today.getMonth() + 1;
  239. const currentDay = today.getDate();
  240. let age = currentYear - birthYear;
  241. if (currentMonth < birthMonth || (currentMonth === birthMonth && currentDay < birthDay)) {
  242. age--;
  243. }
  244. return age;
  245. }
  246. },
  247. getPreview(idx,arr) {
  248. var newArr=[];
  249. arr.forEach(ite=>{
  250. var ds=this.baseUrl+ite
  251. newArr.push(ds)
  252. })
  253. uni.previewImage({
  254. urls: newArr,
  255. current:idx,
  256. success: function(data) {},
  257. fail: function(err) {}
  258. });
  259. },
  260. //开始触摸滑动
  261. drawStart(e) {
  262. // console.log("开始触发");
  263. var touch = e.touches[0];
  264. this.startX = touch.clientX;
  265. },
  266. //触摸滑动
  267. drawMove(e) {
  268. var idx=e.currentTarget.dataset.idx
  269. var aidx=e.currentTarget.dataset.aidx
  270. var type=e.currentTarget.dataset.type;
  271. for (var index in this.datainfo) {
  272. if(type&&type=='peo'){
  273. for(var i in this.datainfo[idx].residentInfoList){
  274. this.$set(this.datainfo[idx].residentInfoList[i],'right',0);
  275. }
  276. }else{
  277. this.$set(this.datainfo[index],'right',0);
  278. }
  279. }
  280. var touch = e.touches[0];
  281. var item = this.datainfo[idx];
  282. var disX = this.startX - touch.clientX;
  283. if (disX >= 20) {
  284. if (disX > this.delBtnWidth) {
  285. disX = this.delBtnWidth;
  286. }
  287. if(type&&type=='peo'){
  288. this.$set(this.datainfo[idx].residentInfoList[aidx],'right',disX);
  289. }else{
  290. this.$set(this.datainfo[idx],'right',disX);
  291. }
  292. // this.csListArrl[idx].right=disX
  293. } else {
  294. // this.csListArrl[idx].right=0
  295. this.$set(this.datainfo[idx],'right',0);
  296. }
  297. },
  298. //触摸滑动结束
  299. drawEnd(e) {
  300. // console.log("滑动结束");
  301. var idx=e.currentTarget.dataset.idx
  302. var item = this.datainfo[idx];
  303. if (item.right >= this.delBtnWidth / 2) {
  304. // this.datainfo[idx].right=this.delBtnWidth
  305. // this.$set(this.datainfo[idx],'right',this.delBtnWidth);
  306. } else {
  307. this.datainfo[idx].right=0
  308. }
  309. },
  310. }
  311. }
  312. </script>
  313. <style lang="scss" scoped>
  314. .flex{display: flex;}
  315. .flexc{display: flex;align-items: center;}
  316. .mb10{margin-bottom: 20rpx;}
  317. // 互动
  318. .pd12{padding: 24rpx;}
  319. .hdlist{background: #FFFFFF;border-radius: 20rpx;position: relative;z-index: 1;
  320. .mhead{width: 56rpx;height: 56rpx;margin-right: 20rpx;border-radius: 50%;}
  321. .name{font-size: 28rpx;font-weight: bold;color: #272727;height: 56rpx;line-height: 56rpx;}
  322. .tit{font-weight: 500;font-size: 22rpx;color: #666666;}
  323. .time{font-weight: 500;font-size: 22rpx;color: #666666;}
  324. .line{width: 6rpx;height: 28rpx;border-radius: 4rpx;margin-right: 12rpx;
  325. &.bga{background: #FACA7D;}
  326. &.bgb{background: #86AFFF;}
  327. &.bgc{background: #93E9C2;}
  328. &.bgd{background: #DADADA;}
  329. }
  330. .txt{font-weight: 500;font-size: 26rpx;color: #272727;line-height: 36rpx;}
  331. .txta{font-weight: 500;font-size: 26rpx;color: #666666;}
  332. .rimg{width: 12rpx;height: 22rpx;}
  333. .shbtns{border-top: 2rpx solid #DADADA;
  334. .btn{border-radius: 20rpx;min-width: 110rpx;box-sizing: border-box;padding: 0 16rpx;
  335. height: 52rpx;display: flex;align-items: center;justify-content: center;flex:0 0 auto;margin-left: 20rpx;
  336. &.bga{border: 2rpx solid #06C770;background: #DAEFE6;color: #06C770;margin-left: 0;}
  337. &.bgb{border: 2rpx solid #FF6969;;background: #FFE7E7;color: #FF6969;}
  338. &.bgc{background: #0256FD;color: #FFFFFF;}
  339. }
  340. }
  341. }
  342. // 无数据
  343. .nodata{display: flex;flex-direction: column;align-items: center;
  344. image{width: 440rpx;height: 440rpx;}
  345. view{font-size: 30rpx;color: #666666;font-weight: bold;}
  346. }
  347. </style>