index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <hc-sys id="app-sys" class="hc-work-order-page" navBarUi='work-order-nav-bar'>
  3. <template #navBar>
  4. <hc-nav-back-bar ui='work-order-nav' title="消息动态圈">
  5. <text class="i-ri-add-circle-fill text-40 mr-1"/>
  6. <text class="i-ri-message-3-fill text-40 ml-2"/>
  7. </hc-nav-back-bar>
  8. </template>
  9. <!--下拉刷新区域-->
  10. <z-paging ref="pageRef" :style="pagingStyle" v-model="dataList" @query="getDataList">
  11. <template v-for="item in dataList" :key="item.id">
  12. <view class="relative bg-white mb-2 p-3">
  13. <view class="hc-flex">
  14. <view class="hc-flex-center mr-3">
  15. <hc-img class="round" :width="40" :height="40" :src="item.avatar" v-if="item.avatar"/>
  16. <hc-img class="round" :width="40" :height="40" src="/static/image/avatar.png" v-else/>
  17. </view>
  18. <view class="relative flex-1">
  19. <view class="text-black mb-1">{{item['createUserName'] ?? '用户名异常'}}</view>
  20. <view class="text-24 text-gray-4">{{item['createTime']}}</view>
  21. </view>
  22. <view class="text-24 text-gray-5" v-if="parseInt(item['isSolve']) === 1">已解决</view>
  23. </view>
  24. <view class="relative ml-12.5 text-gray-5">
  25. <view class="relative mt-3" v-html="item['opinionContent']"/>
  26. <view class="mt-3" v-if="item['returnFiles']?.length > 0">
  27. <hc-row :gutter="10">
  28. <hc-col :span="8" class="h-125" v-for="(img, index) in item['returnFiles']">
  29. <hc-image class="radius" un-border="1 solid gray-2" :src="img" @click="previewImage(item['returnFiles'], index)"/>
  30. </hc-col>
  31. </hc-row>
  32. </view>
  33. </view>
  34. <view class="hc-flex ml-12.5 mt-4 text-gray-5">
  35. <view class="hc-flex text-34" @click="commentExpanded(item)">
  36. <text class="i-ri-message-2-fill" v-if="item['commentExpanded']"/>
  37. <text class="i-ri-message-2-line" v-else/>
  38. <text class="text-26 text-gray-5 ml-1" v-if="item['commentsNumber'] >= 1">{{ item['commentsNumber'] }}</text>
  39. </view>
  40. <view class="flex-1"/>
  41. <view class="hc-flex text-34" @click="goodLikeClick(item)">
  42. <text class="i-ri-thumb-up-fill" v-if="item['currentUserGood']"/>
  43. <text class="i-ri-thumb-up-line" v-else/>
  44. <text class="text-26 text-gray-5 ml-1" v-if="item['goodNumber'] >= 1">{{ item['goodNumber'] }}</text>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. </z-paging>
  50. </hc-sys>
  51. </template>
  52. <script setup>
  53. import {getCurrentInstance, ref} from "vue";
  54. import mainApi from '~api/other/work-order';
  55. import {onShow, onReady} from '@dcloudio/uni-app'
  56. import {errorToast, querySelect, successToast} from "@/utils/tools";
  57. import {arrToKey, getArrValue, getObjValue} from "js-fast-way";
  58. import {useAppStore} from "@/store";
  59. //初始变量
  60. const store = useAppStore()
  61. const projectId = ref(store.projectId);
  62. const contractId = ref(store.contractId);
  63. const instance = getCurrentInstance().proxy
  64. const isNodes = ref(false)
  65. const pageRef = ref(null)
  66. onReady(() => {
  67. setPagingStyle()
  68. isNodes.value = true
  69. })
  70. onShow(() => {
  71. /*if (isNodes.value) {
  72. reloadData()
  73. }*/
  74. })
  75. //内容区域
  76. const pagingStyle = ref({
  77. position: 'relative',
  78. width: '100%',
  79. bottom: 0,
  80. })
  81. const setPagingStyle = async () => {
  82. const {height: appHeight} = await querySelect(instance, 'app-sys')
  83. const {height: navHeight} = await querySelect(instance, 'hc-nav-bar')
  84. // #ifdef H5
  85. pagingStyle.value.height = (appHeight - navHeight) + 'px'
  86. // #endif
  87. // #ifdef APP-PLUS
  88. const {screenHeight, safeArea} = uni.getWindowInfo()
  89. const content = navHeight + (screenHeight - safeArea.bottom)
  90. pagingStyle.value.height = (screenHeight - content) + 'px'
  91. // #endif
  92. }
  93. //重载数据
  94. const reloadData = () => {
  95. pageRef.value?.reload()
  96. }
  97. //获取数据
  98. const dataList = ref([])
  99. const getDataList = async (pageNo, pageSize) => {
  100. uni.showLoading({title: '获取数据中...', mask: true});
  101. const { data } = await mainApi.queryUserOpinionPage({
  102. projectId: projectId.value,
  103. contractId: contractId.value,
  104. current: pageNo,
  105. size: pageSize,
  106. })
  107. const res = getObjValue(data)
  108. isNodes.value = true
  109. pageRef.value?.complete(getArrValue(res?.records));
  110. uni.hideLoading();
  111. }
  112. //预览图片
  113. const previewImage = (imgs, index) => {
  114. uni.previewImage({
  115. urls: imgs,
  116. current: index
  117. });
  118. }
  119. //评论展开或收起
  120. const commentExpanded = (item) => {
  121. }
  122. //点赞或取消点赞
  123. const goodLikeClick = (item) => {
  124. }
  125. </script>
  126. <style lang="scss">
  127. @import "@/style/work-order/index.scss";
  128. </style>