index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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-4">已解决</view>
  23. </view>
  24. <view class="relative ml-12.5 text-gray-5">
  25. <view class="relative mt-3" v-html="item.opinionContent"/>
  26. <hc-row :gutter="10" class="mt-3" v-if="item.returnFiles?.length > 0">
  27. <hc-col :span="8" class="h-125" v-for="(img, index) in item['returnFiles']">
  28. <hc-image class="radius" un-border="1 solid gray-2" :src="img"/>
  29. </hc-col>
  30. <hc-col :span="8" class="h-125" v-for="(img, index) in item['returnFiles']">
  31. <hc-image class="radius" un-border="1 solid gray-2" :src="img"/>
  32. </hc-col>
  33. <hc-col :span="8" class="h-125" v-for="(img, index) in item['returnFiles']">
  34. <hc-image class="radius" un-border="1 solid gray-2" :src="img"/>
  35. </hc-col>
  36. </hc-row>
  37. </view>
  38. </view>
  39. </template>
  40. </z-paging>
  41. </hc-sys>
  42. </template>
  43. <script setup>
  44. import {getCurrentInstance, ref} from "vue";
  45. import mainApi from '~api/other/work-order';
  46. import {onShow, onReady} from '@dcloudio/uni-app'
  47. import {errorToast, querySelect, successToast} from "@/utils/tools";
  48. import {arrToKey, getArrValue, getObjValue} from "js-fast-way";
  49. import {useAppStore} from "@/store";
  50. //初始变量
  51. const store = useAppStore()
  52. const projectId = ref(store.projectId);
  53. const contractId = ref(store.contractId);
  54. const instance = getCurrentInstance().proxy
  55. const isNodes = ref(false)
  56. const pageRef = ref(null)
  57. onReady(() => {
  58. setPagingStyle()
  59. isNodes.value = true
  60. })
  61. onShow(() => {
  62. if (isNodes.value) {
  63. reloadData()
  64. }
  65. })
  66. //内容区域
  67. const pagingStyle = ref({
  68. position: 'relative',
  69. width: '100%',
  70. bottom: 0,
  71. })
  72. const setPagingStyle = async () => {
  73. const {height: appHeight} = await querySelect(instance, 'app-sys')
  74. const {height: navHeight} = await querySelect(instance, 'hc-nav-bar')
  75. // #ifdef H5
  76. pagingStyle.value.height = (appHeight - navHeight) + 'px'
  77. // #endif
  78. // #ifdef APP-PLUS
  79. const {screenHeight, safeArea} = uni.getWindowInfo()
  80. const content = navHeight + (screenHeight - safeArea.bottom)
  81. pagingStyle.value.height = (screenHeight - content) + 'px'
  82. // #endif
  83. }
  84. //重载数据
  85. const reloadData = () => {
  86. pageRef.value?.reload()
  87. }
  88. //获取数据
  89. const dataList = ref([])
  90. const getDataList = async (pageNo, pageSize) => {
  91. const { data } = await mainApi.queryUserOpinionPage({
  92. projectId: projectId.value,
  93. contractId: contractId.value,
  94. current: pageNo,
  95. size: pageSize,
  96. })
  97. const res = getObjValue(data)
  98. isNodes.value = true
  99. pageRef.value?.complete(getArrValue(res?.records));
  100. }
  101. </script>
  102. <style lang="scss">
  103. @import "@/style/work-order/index.scss";
  104. </style>