userMsgList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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: 50px !important; //这个是固定的44px(所有小程序顶部高度都是 = 44px + 手机系统状态栏高度)
  92. line-height: 44px;
  93. text-align: center;
  94. // background-color: #d00;
  95. background: #eeeeee;
  96. position: fixed;
  97. top: 0;
  98. z-index: 9999;
  99. color: #ffff00;
  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: '', //状态栏的高度(可以设置为顶部导航条的padding-top)
  132. menuInfo: {},
  133. menuWidth: '',
  134. menuHeight: '',
  135. menuBorderRadius: '',
  136. menuRight: '',
  137. menuTop: '',
  138. contentTop: '',
  139. }
  140. },
  141. onLoad() {
  142. this.file_approval_flow_run_key = uni.getStorageSync('file_approval_flow_run_key')
  143. this.biz_leave_flow_run_key = uni.getStorageSync('biz_leave_flow_run_key')
  144. this.reserve_consuming_flow_run_key = uni.getStorageSync('reserve_consuming_flow_run_key')
  145. this.reserve_return_flow_run_key = uni.getStorageSync('reserve_return_flow_run_key')
  146. this.reserve_register_flow_run_key = uni.getStorageSync('reserve_register_flow_run_key')
  147. this.personnel_hire_approval_flow_run_key = uni.getStorageSync('personnel_hire_approval_flow_run_key')
  148. this.personnel_dimission_approval_flow_run_key = uni.getStorageSync(
  149. 'personnel_dimission_approval_flow_run_key')
  150. let that = this
  151. uni.getSystemInfo({
  152. success: (result) => {
  153. // 获取手机系统的状态栏高度(不同手机的状态栏高度不同) ( 不要使用uni-app官方文档的var(--status-bar-height) 官方这个是固定的20px 不对的 )
  154. // console.log('当前手机的状态栏高度',result.statusBarHeight)
  155. let statusBarHeight = result.statusBarHeight + 'px'
  156. // 获取右侧胶囊的信息 单位px
  157. const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  158. //bottom: 胶囊底部距离屏幕顶部的距离
  159. //height: 胶囊高度
  160. //left: 胶囊左侧距离屏幕左侧的距离
  161. //right: 胶囊右侧距离屏幕左侧的距离
  162. //top: 胶囊顶部距离屏幕顶部的距离
  163. //width: 胶囊宽度
  164. // console.log(menuButtonInfo.width, menuButtonInfo.height, menuButtonInfo.top)
  165. // console.log('计算胶囊右侧距离屏幕右边距离', result.screenWidth - menuButtonInfo.right)
  166. let menuWidth = menuButtonInfo.width + 60 + 'px'
  167. let menuHeight = menuButtonInfo.height + 'px'
  168. let menuBorderRadius = menuButtonInfo.height / 2 + 'px'
  169. let menuRight = result.screenWidth - menuButtonInfo.right + 'px'
  170. let menuTop = menuButtonInfo.top + 'px'
  171. let contentTop = result.statusBarHeight + 64 + 'px'
  172. let menuInfo = {
  173. statusBarHeight: statusBarHeight, //状态栏高度----用来给自定义导航条页面的顶部导航条设计padding-top使用:目的留出系统的状态栏区域
  174. menuWidth: menuWidth, //右侧的胶囊宽度--用来给自定义导航条页面的左侧胶囊设置使用
  175. menuHeight: menuHeight, //右侧的胶囊高度--用来给自定义导航条页面的左侧胶囊设置使用
  176. menuBorderRadius: menuBorderRadius, //一半的圆角--用来给自定义导航条页面的左侧胶囊设置使用
  177. menuRight: menuRight, //右侧的胶囊距离右侧屏幕距离--用来给自定义导航条页面的左侧胶囊设置使用
  178. menuTop: menuTop, //右侧的胶囊顶部距离屏幕顶部的距离--用来给自定义导航条页面的左侧胶囊设置使用
  179. contentTop: contentTop, //内容区距离页面最上方的高度--用来给自定义导航条页面的内容区定位距离使用
  180. }
  181. that.statusBarHeight = menuInfo.statusBarHeight //状态栏的高度(可以设置为顶部导航条的padding-top)
  182. that.menuWidth = menuInfo.menuWidth
  183. that.menuHeight = menuInfo.menuHeight
  184. that.menuBorderRadius = menuInfo.menuBorderRadius
  185. that.menuRight = menuInfo.menuRight
  186. that.menuTop = menuInfo.menuTop
  187. that.contentTop = menuInfo.contentTop
  188. uni.setStorageSync('menuInfo', menuInfo)
  189. that.$forceUpdate()
  190. },
  191. fail: (error) => {
  192. console.log(error)
  193. }
  194. })
  195. },
  196. onShow() {
  197. this.$refs.list.refresh()
  198. },
  199. methods: {
  200. leftBack() {
  201. let that = this
  202. uni.navigateBack({
  203. url: '../../pages/home/index',
  204. success: function(res) {
  205. },
  206. fail: function(res) {
  207. that.$goto('../../pages/home/index')
  208. },
  209. })
  210. //
  211. },
  212. confirm() {
  213. this.$httpRequest({
  214. url: '/app/doAllRead',
  215. method: 'get',
  216. urlType: this.$getUrlType()
  217. }).then(res => {
  218. this.$refs.list.refresh()
  219. })
  220. },
  221. handleTest(item) {
  222. this.readTask(item)
  223. if (this.tabType === 2) {
  224. if (item.msgType === '1') {
  225. this.orderInfo(item.remark, 1, '1')
  226. }
  227. if (item.msgType === '2') {
  228. this.orderInfo(item.remark, 1, '2')
  229. }
  230. if (item.msgType === '3') {
  231. uni.navigateTo({
  232. url: "../salary/salary"
  233. })
  234. }
  235. } else if (this.tabType === 3) {
  236. if (item.msgType) {
  237. if (item.msgType === '1') {
  238. this.gtdToId(item.remark, 1, '1')
  239. }
  240. if (item.msgType === '2') {
  241. uni.switchTab({
  242. url: "/pages/orderFood/index"
  243. })
  244. }
  245. if (item.msgType === '3') {
  246. uni.navigateTo({
  247. url: "../salary/salary"
  248. })
  249. }
  250. if (item.msgType === '4') {
  251. this.gtdToId(item.remark, 3, '4')
  252. }
  253. if (item.msgType === '5') {
  254. this.gtdToId(item.remark, 1, '5')
  255. }
  256. if (item.msgType === '6') {
  257. this.orderInfo(item.remark, 1, '6')
  258. }
  259. if (item.msgType === '7') {
  260. this.gtdToId(item.remark, 3, '7')
  261. }
  262. }
  263. }
  264. },
  265. async gtdToId(id, pageType, msgType) {
  266. // 发送请求
  267. const {
  268. data: res
  269. } = await this.$httpRequest({
  270. url: '/app/gtdToId?taskId=' + id + '&type=' + msgType,
  271. method: 'get',
  272. urlType: this.$getUrlType()
  273. });
  274. if (res.code === 200) {
  275. if (res.data[0]) {
  276. res.data[0].pageType = pageType
  277. uni.setStorageSync("approval", res.data[0])
  278. if (res.data[0].examplesId === this.file_approval_flow_run_key) {
  279. uni.navigateTo({
  280. url: "../../pageApp/ge/geNewsApproval"
  281. })
  282. } else if (res.data[0].examplesId === this.biz_leave_flow_run_key) {
  283. uni.navigateTo({
  284. url: "../../pageApp/ge/geApproval"
  285. })
  286. } else if (res.data[0].examplesId === this.reserve_consuming_flow_run_key) {
  287. uni.navigateTo({
  288. url: "../../pageApp/ge/geReserveApproval"
  289. })
  290. } else if (res.data[0].examplesId === this.reserve_return_flow_run_key) {
  291. uni.navigateTo({
  292. url: "../../pageApp/ge/geReserveApproval"
  293. })
  294. } else if (res.data[0].examplesId === this.reserve_register_flow_run_key) {
  295. uni.navigateTo({
  296. url: "../../pageApp/ge/geReserveApproval"
  297. })
  298. } else if (res.data[0].examplesId === this.personnel_hire_approval_flow_run_key) {
  299. uni.navigateTo({
  300. url: "../../pageApp/ge/geEntry"
  301. })
  302. } else if (res.data[0].examplesId === this.personnel_dimission_approval_flow_run_key) {
  303. uni.navigateTo({
  304. url: "../../pageApp/ge/geDimission"
  305. })
  306. } else if (res.data[0].examplesId === uni.getStorageSync(
  307. 'device_repairs_approval_flow_run_key')) {
  308. this.$goto("../../pageApp/ge/geDeviceRepairs")
  309. } else if (res.data[0].examplesId === uni.getStorageSync(
  310. 'device_scrap_approval_flow_run_key')) {
  311. this.$goto('../../pageApp/ge/geDeviceScrap')
  312. } else if (res.data[0].examplesId === uni.getStorageSync('purchase_approval_flow_run_key')) {
  313. this.$goto('../../pageApp/ge/gePurchase')
  314. } else if (res.data[0].examplesId === uni.getStorageSync('contract_approval_flow_run_key')) {
  315. this.$goto('../../pageApp/ge/geContract')
  316. }
  317. uni.hideLoading({
  318. mask: true
  319. })
  320. }
  321. }
  322. },
  323. async orderInfo(id, pageType, msgType) {
  324. // 发送请求
  325. const {
  326. data: res
  327. } = await this.$httpRequest({
  328. url: '/app/orderInfo?on=' + id,
  329. method: 'get',
  330. urlType: this.$getUrlType()
  331. });
  332. if (res.code === 200) {
  333. if (res.data) {
  334. uni.setStorageSync("order", res.data)
  335. if (msgType === '1') {
  336. uni.navigateTo({
  337. url: "../card/expense/details"
  338. })
  339. } else if (msgType === '2') {
  340. uni.navigateTo({
  341. url: "../card/orderProcess"
  342. })
  343. } else if (msgType === '6') {
  344. uni.navigateTo({
  345. url: "../integral/details"
  346. })
  347. }
  348. uni.hideLoading({
  349. mask: true
  350. })
  351. }
  352. }
  353. },
  354. async readTask(item) {
  355. const {
  356. data: res
  357. } = await this.$httpRequest({
  358. url: '/app/rm?id=' + item.id,
  359. method: 'get',
  360. urlType: this.$getUrlType()
  361. });
  362. if (res.code === 200) {
  363. let msgData = uni.getStorageSync("msgData")
  364. if (msgData) {
  365. if (msgData["m" + item.msgType] > 0) {
  366. --msgData["m" + item.msgType];
  367. uni.setStorageSync("msgData", msgData)
  368. }
  369. }
  370. }
  371. },
  372. async taskList(paging) {
  373. // 发送请求
  374. const {
  375. data: res
  376. } = await this.$httpRequest({
  377. url: '/app/gum?pageNum=' + paging.page + '&pageSize=' + paging.size,
  378. method: 'get',
  379. urlType: this.$getUrlType()
  380. });
  381. if (res.code === 200) {
  382. if (paging.page === 1) {
  383. this.scrollList = res.rows
  384. this.total = res.total
  385. this.$refs.list.loadSuccess({
  386. list: res.rows,
  387. total: this.total
  388. });
  389. } else if (paging.page > 1) {
  390. for (var i = 0; i < res.rows.length; i++) {
  391. this.scrollList.push(res.rows[i])
  392. }
  393. this.$refs.list.loadSuccess({
  394. list: this.scrollList,
  395. total: this.total
  396. });
  397. }
  398. }
  399. },
  400. // 刷新刷剧
  401. refresh(paging) {
  402. this.taskList(paging)
  403. },
  404. scrolltolower(e) {
  405. },
  406. load(paging) {
  407. this.taskList(paging)
  408. },
  409. loadSuccess(list) {
  410. this.list = list
  411. }
  412. }
  413. }
  414. </script>