list.vue 10 KB

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