index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <view class="uni-container-bg uni-container ">
  3. <view class="padding-tb-sm" style="">
  4. <uni-row class="demo-uni-row " :gutter="20" width="100%">
  5. <uni-col :span="24">
  6. <view class="u-page__tag-item">
  7. <u-search v-model="keyword" :show-action="true" @custom="handleQuery"></u-search>
  8. </view>
  9. </uni-col>
  10. </uni-row>
  11. </view>
  12. <view class="" v-if="tableData.length>0 && isLoaded">
  13. <uni-card v-for="(item, index) in tableData" :key="index" @click.native="onNoticeClick(item)">
  14. <view class="titles">{{item.title}}</view>
  15. <view style="float: left;">重要提醒内容:</view>
  16. <!-- <text class="conts">{{item.taskContent}}</text> -->
  17. <rich-text :nodes="item.content?item.content:''" class="font-12"></rich-text>
  18. <view style="float: left;">发布日期:{{item}}</view>
  19. <view class="an-niu">
  20. <view class="an-niu-street" @click.native="uploadButton" link>
  21. <text class="bianji">上传</text>
  22. </view>
  23. <text @click="isRead" class="detail isread">已阅</text>
  24. <text @click.native="onNoticeClick(item)" class="detail">查看详情</text>
  25. </view>
  26. </uni-card>
  27. </view>
  28. <view v-else-if="tableData.length==0 && isLoaded" style="text-align: center;">
  29. <view class="text-gray" style="padding-top: 20px;">
  30. <img :src="tan90" alt="暂无数据" />
  31. </view>
  32. </view>
  33. <view>
  34. <!-- <image :src="Group" @click="addClick" class="tiantupian"></image> -->
  35. </view>
  36. <!--
  37. <u-list @scrolltolower="scrolltolower" class="card">
  38. <u-list-item v-for="(item, index) in tableData" :key="index" @click.native="onNoticeClick(item)" link>
  39. <uni-row class="demo-uni-row padding-top text-sm" :gutter="20" width="100%">
  40. <uni-col :span="24" class="text-1cut">
  41. <rich-text :nodes="item.title" class="font-12"></rich-text>
  42. <text class="uni-body font-14 text-bold ">{{item.title}}</text>
  43. </uni-col>
  44. </uni-row>
  45. <uni-row class="demo-uni-row padding-top text-sm" :gutter="20" width="100%">
  46. <uni-col :span="24" class="text-2cut">
  47. <rich-text :nodes="item.content" class="font-12"></rich-text>
  48. <text class="uni-body">{{item.comContent}}</text>
  49. </uni-col>
  50. </uni-row>
  51. <uni-row class="demo-uni-row padding-tb-sm text-sm" :gutter="20" width="100%">
  52. <uni-col :span="24" class=" text-grey1 ">
  53. <text class="uni-body flex justify-end ">{{item.createTime}}</text>
  54. <text class="uni-body flex justify-end ">09-26</text>
  55. </uni-col>
  56. </uni-row>
  57. <u-button type="primary" text="详情" plain size="small" style="width: 20%;float: right;"></u-button>
  58. </u-list-item>
  59. </u-list> -->
  60. <tarBar :totarBer='tar'></tarBar>
  61. <u-popup :show="showDel" title="完成提醒" mode="center">
  62. <view style="width: 400rpx;height: 200rpx;margin: 20rpx 20rpx;">
  63. <view>完成描述</view>
  64. <u--textarea v-model="eventContent" placeholder="请输入内容" :disabled="isview" :maxlength="1000" count
  65. height="150">
  66. <view class="">
  67. 附件上传
  68. </view>
  69. <uni-file-picker v-model="formData.attId" del-icon limit="5" auto-upload file-mediatype="all"
  70. @select="selectFile" @delete="deleteFile">
  71. <button type="primary" class="selectBtn">选择文件</button>
  72. <!-- 加载中 -->
  73. <isLodingModel v-if="loading"></isLodingModel>
  74. </uni-file-picker>
  75. </u--textarea>
  76. <view style="display: flex;justify-content: space-around;align-items: center;margin-top: 40rpx;">
  77. <button class="antherBtn" @click="makeSureDel" style="background-color: red;">确认</button>
  78. <button class="antherBtn" @click="showDel = false">取消</button>
  79. </view>
  80. </view>
  81. </u-popup>
  82. <!-- 加载中 -->
  83. <isLodingModel></isLodingModel>
  84. </view>
  85. </template>
  86. <script>
  87. import tarBar from '@/components/tabBar/index' //先把tabBar.vue组件导入
  88. import {
  89. getRemindBroadPage, // 通知公告列表
  90. } from "@/api/remind";
  91. import {
  92. uploadFile
  93. } from '@/utils/common.js';
  94. let that = null;
  95. import config from '@/config'
  96. const baseUrlImg = config.baseUrlImg
  97. export default {
  98. components: {
  99. tarBar
  100. },
  101. data() {
  102. return {
  103. isLoaded: false,
  104. tar: {
  105. color: '#07A7E3',
  106. id: 1
  107. }, //向子组件发送的值
  108. // 数据
  109. tableData: [],
  110. // 每页数据量
  111. pageSize: 20,
  112. // 当前页
  113. pageNo: 1,
  114. // 数据总量
  115. total: 0,
  116. // tableData数据加载中
  117. loading: false,
  118. // 初始化时搜索框的值
  119. keyword: '',
  120. ids: '0',
  121. title: '1',
  122. tan90: `${baseUrlImg}/tan90.png`,
  123. eventContent: '', //上传描述内容
  124. fileUrls: [], //上传附件
  125. formData: {
  126. attId: []
  127. },
  128. }
  129. },
  130. // 在 vue页面,向起始页通过事件传递数据
  131. onLoad: function(option) {
  132. this.ids = option.id
  133. },
  134. onShow() {
  135. this.tableData = []
  136. // this.tableD
  137. this.getData(this.pageNo)
  138. },
  139. watch: {
  140. loading: {
  141. handler(newLength, oldLength) {
  142. this.$modal.isLoadingModel(this.loading)
  143. },
  144. immediate: true
  145. }
  146. },
  147. methods: {
  148. handleQuery() { //搜索
  149. this.isLoaded = false
  150. this.loading = true
  151. this.tableData = []
  152. this.getData(1)
  153. },
  154. // 获取数据
  155. getData(pageNo, value = '') {
  156. this.loading = true
  157. this.pageNo = pageNo
  158. const deptId = uni.getStorageSync('getUserInfo_key')?.streetInfo?.id;
  159. const userId = uni.getStorageSync('getUserInfo_key')?.userInfo?.id;
  160. getRemindBroadPage({
  161. pageNo: this.pageNo,
  162. pageSize: 10,
  163. reciver: deptId,
  164. userId: userId
  165. }).then(response => {
  166. this.isLoaded = true
  167. // 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
  168. this.tableData = [...this.tableData, ...response.data.list]
  169. // this.tableData = response.data.list;
  170. this.total = response.data.total;
  171. this.loading = false;
  172. });
  173. },
  174. // 移出图片函数
  175. async deleteFile(e) {
  176. this.formData.attId = [];
  177. },
  178. selectFile(e) {
  179. let promises = [];
  180. for (let i = 0; i < e.tempFilePaths.length; i++) {
  181. const promise = uploadFile(e.tempFilePaths, i, this);
  182. promises.push(promise);
  183. }
  184. Promise.all(promises).then(result => {
  185. // 处理上传文件成功的结果
  186. }).catch(error => {
  187. // 处理上传文件失败的错误
  188. });
  189. },
  190. // 单个公告详情点击事件
  191. onNoticeClick(val) {
  192. this.isLoaded = false
  193. uni.navigateTo({
  194. url: `/pagesA/fire/remind/details/details?id=${val.id}`,
  195. success: function(res) {
  196. // 通过eventChannel向被打开页面传送数据
  197. res.eventChannel.emit('acceptDataFromOpenerPage', val)
  198. }
  199. })
  200. },
  201. // scrolltolower() {
  202. // // 判断是否还有下一页数据
  203. // if (this.pageNo * this.pageSize >= this.total) return uni.showToast({
  204. // title: `数据加载完毕`
  205. // })
  206. // // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  207. // if (this.loading) return
  208. // this.pageNo += 1
  209. // this.getData(this.pageNo)
  210. // },
  211. },
  212. // 触底的事件
  213. onReachBottom() {
  214. // 判断是否还有下一页数据
  215. if (this.pageNo * this.pageSize >= this.total) return uni.showToast({
  216. title: `数据加载完毕`
  217. })
  218. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  219. if (this.loading) return
  220. this.pageNo += 1
  221. this.getData(this.pageNo)
  222. },
  223. }
  224. </script>
  225. <style lang="scss" scoped>
  226. body {
  227. background-color: #F5F7F9;
  228. }
  229. page {
  230. background-color: #F5F7F9;
  231. }
  232. .an-niu {
  233. float: right;
  234. font-size: 10px;
  235. text-align: center;
  236. display: flex;
  237. padding-bottom: 30rpx;
  238. margin-top: 50rpx;
  239. color: #fff;
  240. cursor: pointer;
  241. .detail {
  242. width: 72px;
  243. height: 60rpx;
  244. border-radius: 30px;
  245. background-color: #F7C41E;
  246. margin-right: 20rpx;
  247. text-align: center;
  248. line-height: 60rpx;
  249. }
  250. .isread {
  251. background-color: #18a2f7;
  252. }
  253. }
  254. //列表样式
  255. .titles {
  256. font-weight: 600;
  257. margin-bottom: 10rpx;
  258. font-size: 14px;
  259. }
  260. /deep/.uni-card {
  261. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  262. border-radius: 30rpx;
  263. }
  264. rich-text {
  265. display: -webkit-box;
  266. -webkit-box-orient: vertical;
  267. -webkit-line-clamp: 1;
  268. overflow: hidden;
  269. }
  270. </style>