index.vue 4.3 KB

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