userMsgList.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <view>
  3. <!-- paddingTop不生效可换成marginTop -->
  4. <view class="tab_title" :style="{ paddingTop: statusBarHeight}">
  5. <!-- 左上角自定义样式 -->
  6. <view class="menu_btn flex-betwee box-sizing"
  7. :style="{ position: 'fixed', top: menuTop, left: menuRight, width: menuWidth, height: menuHeight, borderRadius: menuBorderRadius}">
  8. <!-- <image class="logo" src="/static/logo.png" @click="goStepPage"></image> -->
  9. <uni-row>
  10. <uni-col :span="8">
  11. <view @click="leftBack">
  12. <u-icon name="arrow-left" size="30" color="rgb(138, 138, 138)">
  13. </u-icon>
  14. </view>
  15. </uni-col>
  16. <uni-col :span="16">
  17. <view class="tit" @click="confirm">全部已读</view>
  18. </uni-col>
  19. </uni-row>
  20. </view>
  21. </view>
  22. <scroll-list :style="{ paddingTop: statusBarHeight}" ref="list" :option="option" @load="load" @refresh="refresh"
  23. @loadSuccess="loadSuccess" @scrolltolower="scrolltolower">
  24. <view v-for="(item, index) in list" :key="index" @click="handleTest(item)">
  25. <view class="infoBody">
  26. <view>
  27. <view style="border-bottom: 1px #b8b8b8 solid;">
  28. <uni-row class="demo-uni-row">
  29. <uni-col :span="19">
  30. <view class="demo-uni-col dark"
  31. style="font-size: 36rpx;margin: -20rpx 0 0 0;font-weight: bold;letter-spacing:5rpx;">
  32. {{item.msgTitle}}
  33. </view>
  34. </uni-col>
  35. <uni-col v-if="item.msgIsRead === '0'" :span="5">
  36. <view class="demo-uni-col light"
  37. style="color: rgb(55,186,189);margin-bottom: 10rpx;">
  38. 点击查看
  39. </view>
  40. </uni-col>
  41. </uni-row>
  42. </view>
  43. <uni-row class="demo-uni-row">
  44. <uni-col>
  45. <view class="demo-uni-col light" style="padding: 36rpx;color: #676767;">
  46. <view v-html="item.msgContent"></view>
  47. </view>
  48. </uni-col>
  49. </uni-row>
  50. <uni-row class="demo-uni-row">
  51. <uni-col :span="24">
  52. <view class="demo-uni-col light" style="color: #727272;">
  53. {{item.createTime}}
  54. </view>
  55. </uni-col>
  56. </uni-row>
  57. </view>
  58. </view>
  59. </view>
  60. </scroll-list>
  61. </view>
  62. </template>
  63. <style lang="scss">
  64. .page-wrap {}
  65. .infoBody {
  66. background-color: #ffffff;
  67. padding: 40rpx;
  68. border-radius: 20rpx;
  69. margin: 20rpx;
  70. box-shadow: 0px 2px 10px #cccccc;
  71. }
  72. .tit {
  73. margin: 0 10rpx;
  74. text-align: center;
  75. color: #999999;
  76. border: 1px #cccccc solid;
  77. border-radius: 20rpx;
  78. }
  79. .tit:active {
  80. background: #d4d4d4;
  81. }
  82. .box-sizing {
  83. box-sizing: border-box;
  84. }
  85. .index-page {
  86. width: 100vw;
  87. height: calc(100vh - 64px); // 解决页面无内容时上下滚动问题 高度默认44px + padding-top 20px
  88. // padding: 32rpx;
  89. .tab_title {
  90. width: 100%;
  91. height: 44px !important; //这个是固定的44px(所有小程序顶部高度都是 = 44px + 手机系统状态栏高度)
  92. line-height: 44px;
  93. text-align: center;
  94. // background-color: #d00;
  95. background-color: #f8f8f8 !important;
  96. position: fixed;
  97. top: 0;
  98. z-index: 9999;
  99. color: #000;
  100. font-weight: 500;
  101. .menu_btn {
  102. width: 414rpx !important;
  103. // background-color: #ffffff; //这个是小程序默认的标题栏背景色
  104. overflow: hidden;
  105. }
  106. }
  107. }
  108. </style>
  109. <script>
  110. export default {
  111. data() {
  112. return {
  113. option: {
  114. page: 1,
  115. size: 5,
  116. auto: true
  117. },
  118. msgTypes: uni.getStorageSync('app_msg_type'),
  119. page: 1,
  120. list: [],
  121. scrollList: [],
  122. total: 0,
  123. status: '',
  124. tabType: uni.getStorageSync('tabType'),
  125. file_approval_flow_run_key: '',
  126. biz_leave_flow_run_key: '',
  127. reserve_consuming_flow_run_key: '',
  128. reserve_return_flow_run_key: '',
  129. reserve_register_flow_run_key: '',
  130. personnel_hire_approval_flow_run_key: '',
  131. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight, //状态栏的高度(可以设置为顶部导航条的padding-top)
  132. menuWidth: uni.getStorageSync('menuInfo').menuWidth,
  133. menuHeight: uni.getStorageSync('menuInfo').menuHeight,
  134. menuBorderRadius: uni.getStorageSync('menuInfo').menuBorderRadius,
  135. menuRight: uni.getStorageSync('menuInfo').menuRight,
  136. menuTop: uni.getStorageSync('menuInfo').menuTop,
  137. contentTop: uni.getStorageSync('menuInfo').contentTop
  138. }
  139. },
  140. onLoad() {
  141. this.file_approval_flow_run_key = uni.getStorageSync('file_approval_flow_run_key')
  142. this.biz_leave_flow_run_key = uni.getStorageSync('biz_leave_flow_run_key')
  143. this.reserve_consuming_flow_run_key = uni.getStorageSync('reserve_consuming_flow_run_key')
  144. this.reserve_return_flow_run_key = uni.getStorageSync('reserve_return_flow_run_key')
  145. this.reserve_register_flow_run_key = uni.getStorageSync('reserve_register_flow_run_key')
  146. this.personnel_hire_approval_flow_run_key = uni.getStorageSync('personnel_hire_approval_flow_run_key')
  147. this.personnel_dimission_approval_flow_run_key = uni.getStorageSync(
  148. 'personnel_dimission_approval_flow_run_key')
  149. },
  150. onShow() {
  151. this.$refs.list.refresh()
  152. },
  153. methods: {
  154. leftBack() {
  155. uni.navigateBack()
  156. },
  157. confirm() {
  158. this.$httpRequest({
  159. url: '/app/doAllRead',
  160. method: 'get',
  161. urlType: this.$getUrlType()
  162. }).then(res => {
  163. this.$refs.list.refresh()
  164. })
  165. },
  166. handleTest(item) {
  167. this.readTask(item)
  168. if (this.tabType === 2) {
  169. if (item.msgType === '1') {
  170. this.orderInfo(item.remark, 1, '1')
  171. }
  172. if (item.msgType === '2') {
  173. this.orderInfo(item.remark, 1, '2')
  174. }
  175. if (item.msgType === '3') {
  176. uni.navigateTo({
  177. url: "../salary/salary"
  178. })
  179. }
  180. } else if (this.tabType === 3) {
  181. if (item.msgType) {
  182. if (item.msgType === '1') {
  183. this.gtdToId(item.remark, 1, '1')
  184. }
  185. if (item.msgType === '2') {
  186. uni.switchTab({
  187. url: "/pages/orderFood/index"
  188. })
  189. }
  190. if (item.msgType === '3') {
  191. uni.navigateTo({
  192. url: "../salary/salary"
  193. })
  194. }
  195. if (item.msgType === '4') {
  196. this.gtdToId(item.remark, 3, '4')
  197. }
  198. if (item.msgType === '5') {
  199. this.gtdToId(item.remark, 1, '5')
  200. }
  201. if (item.msgType === '6') {
  202. this.orderInfo(item.remark, 1, '6')
  203. }
  204. if (item.msgType === '7') {
  205. this.gtdToId(item.remark, 3, '7')
  206. }
  207. }
  208. }
  209. },
  210. async gtdToId(id, pageType, msgType) {
  211. // 发送请求
  212. const {
  213. data: res
  214. } = await this.$httpRequest({
  215. url: '/app/gtdToId?taskId=' + id + '&type=' + msgType,
  216. method: 'get',
  217. urlType: this.$getUrlType()
  218. });
  219. if (res.code === 200) {
  220. if (res.data[0]) {
  221. res.data[0].pageType = pageType
  222. uni.setStorageSync("approval", res.data[0])
  223. if (res.data[0].examplesId === this.file_approval_flow_run_key) {
  224. uni.navigateTo({
  225. url: "../../pageApp/ge/geNewsApproval"
  226. })
  227. } else if (res.data[0].examplesId === this.biz_leave_flow_run_key) {
  228. uni.navigateTo({
  229. url: "../../pageApp/ge/geApproval"
  230. })
  231. } else if (res.data[0].examplesId === this.reserve_consuming_flow_run_key) {
  232. uni.navigateTo({
  233. url: "../../pageApp/ge/geReserveApproval"
  234. })
  235. } else if (res.data[0].examplesId === this.reserve_return_flow_run_key) {
  236. uni.navigateTo({
  237. url: "../../pageApp/ge/geReserveApproval"
  238. })
  239. } else if (res.data[0].examplesId === this.reserve_register_flow_run_key) {
  240. uni.navigateTo({
  241. url: "../../pageApp/ge/geReserveApproval"
  242. })
  243. } else if (res.data[0].examplesId === this.personnel_hire_approval_flow_run_key) {
  244. uni.navigateTo({
  245. url: "../../pageApp/ge/geEntry"
  246. })
  247. } else if (res.data[0].examplesId === this.personnel_dimission_approval_flow_run_key) {
  248. uni.navigateTo({
  249. url: "../../pageApp/ge/geDimission"
  250. })
  251. } else if (res.data[0].examplesId === uni.getStorageSync(
  252. 'device_repairs_approval_flow_run_key')) {
  253. uni.navigateTo({
  254. url: "../../pageApp/ge/geDeviceRepairs"
  255. })
  256. }
  257. uni.hideLoading({
  258. mask: true
  259. })
  260. }
  261. }
  262. },
  263. async orderInfo(id, pageType, msgType) {
  264. // 发送请求
  265. const {
  266. data: res
  267. } = await this.$httpRequest({
  268. url: '/app/orderInfo?on=' + id,
  269. method: 'get',
  270. urlType: this.$getUrlType()
  271. });
  272. if (res.code === 200) {
  273. if (res.data) {
  274. uni.setStorageSync("order", res.data)
  275. if (msgType === '1') {
  276. uni.navigateTo({
  277. url: "../card/expense/details"
  278. })
  279. } else if (msgType === '2') {
  280. uni.navigateTo({
  281. url: "../card/orderProcess"
  282. })
  283. } else if (msgType === '6') {
  284. uni.navigateTo({
  285. url: "../integral/details"
  286. })
  287. }
  288. uni.hideLoading({
  289. mask: true
  290. })
  291. }
  292. }
  293. },
  294. async readTask(item) {
  295. const {
  296. data: res
  297. } = await this.$httpRequest({
  298. url: '/app/rm?id=' + item.id,
  299. method: 'get',
  300. urlType: this.$getUrlType()
  301. });
  302. if (res.code === 200) {
  303. let msgData = uni.getStorageSync("msgData")
  304. if (msgData) {
  305. if (msgData["m" + item.msgType] > 0) {
  306. --msgData["m" + item.msgType];
  307. uni.setStorageSync("msgData", msgData)
  308. }
  309. }
  310. }
  311. },
  312. async taskList(paging) {
  313. // 发送请求
  314. const {
  315. data: res
  316. } = await this.$httpRequest({
  317. url: '/app/gum?pageNum=' + paging.page + '&pageSize=' + paging.size,
  318. method: 'get',
  319. urlType: this.$getUrlType()
  320. });
  321. if (res.code === 200) {
  322. if (paging.page === 1) {
  323. this.scrollList = res.rows
  324. this.total = res.total
  325. this.$refs.list.loadSuccess({
  326. list: res.rows,
  327. total: this.total
  328. });
  329. } else if (paging.page > 1) {
  330. for (var i = 0; i < res.rows.length; i++) {
  331. this.scrollList.push(res.rows[i])
  332. }
  333. this.$refs.list.loadSuccess({
  334. list: this.scrollList,
  335. total: this.total
  336. });
  337. }
  338. }
  339. },
  340. // 刷新刷剧
  341. refresh(paging) {
  342. this.taskList(paging)
  343. },
  344. scrolltolower(e) {
  345. },
  346. load(paging) {
  347. this.taskList(paging)
  348. },
  349. loadSuccess(list) {
  350. this.list = list
  351. }
  352. }
  353. }
  354. </script>