userMsgList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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. console.log(item.msgType)
  237. if (item.msgType) {
  238. if (item.msgType === '1') {
  239. this.gtdToId(item.remark, 1, '1')
  240. }
  241. if (item.msgType === '2') {
  242. uni.switchTab({
  243. url: "/pages/orderFood/index"
  244. })
  245. }
  246. if (item.msgType === '3') {
  247. uni.navigateTo({
  248. url: "../salary/salary"
  249. })
  250. }
  251. if (item.msgType === '4') {
  252. this.gtdToId(item.remark, 3, '4')
  253. }
  254. if (item.msgType === '5') {
  255. this.gtdToId(item.remark, 1, '5')
  256. }
  257. if (item.msgType === '6') {
  258. this.orderInfo(item.remark, 1, '6')
  259. }
  260. if (item.msgType === '7') {
  261. this.gtdToId(item.remark, 3, '7')
  262. }
  263. if (item.msgType === '8') {
  264. uni.navigateTo({
  265. url: "../club/welfareList"
  266. })
  267. }
  268. if (item.msgType === '9') {
  269. uni.navigateTo({
  270. url: "../club/index"
  271. })
  272. }
  273. }
  274. }
  275. },
  276. async gtdToId(id, pageType, msgType) {
  277. // 发送请求
  278. const {
  279. data: res
  280. } = await this.$httpRequest({
  281. url: '/app/gtdToId?taskId=' + id + '&type=' + msgType,
  282. method: 'get',
  283. urlType: this.$getUrlType()
  284. });
  285. if (res.code === 200) {
  286. if (res.data[0]) {
  287. res.data[0].pageType = pageType
  288. uni.setStorageSync("approval", res.data[0])
  289. if (res.data[0].examplesId === this.file_approval_flow_run_key) {
  290. uni.navigateTo({
  291. url: "../../pageApp/ge/geNewsApproval"
  292. })
  293. } else if (res.data[0].examplesId === this.biz_leave_flow_run_key) {
  294. uni.navigateTo({
  295. url: "../../pageApp/ge/geApproval"
  296. })
  297. } else if (res.data[0].examplesId === this.reserve_consuming_flow_run_key) {
  298. uni.navigateTo({
  299. url: "../../pageApp/ge/geReserveApproval"
  300. })
  301. } else if (res.data[0].examplesId === this.reserve_return_flow_run_key) {
  302. uni.navigateTo({
  303. url: "../../pageApp/ge/geReserveApproval"
  304. })
  305. } else if (res.data[0].examplesId === this.reserve_register_flow_run_key) {
  306. uni.navigateTo({
  307. url: "../../pageApp/ge/geReserveApproval"
  308. })
  309. } else if (res.data[0].examplesId === this.personnel_hire_approval_flow_run_key) {
  310. uni.navigateTo({
  311. url: "../../pageApp/ge/geEntry"
  312. })
  313. } else if (res.data[0].examplesId === this.personnel_dimission_approval_flow_run_key) {
  314. uni.navigateTo({
  315. url: "../../pageApp/ge/geDimission"
  316. })
  317. } else if (res.data[0].examplesId === uni.getStorageSync(
  318. 'device_repairs_approval_flow_run_key')) {
  319. this.$goto("../../pageApp/ge/geDeviceRepairs")
  320. } else if (res.data[0].examplesId === uni.getStorageSync(
  321. 'device_scrap_approval_flow_run_key')) {
  322. this.$goto('../../pageApp/ge/geDeviceScrap')
  323. } else if (res.data[0].examplesId === uni.getStorageSync('purchase_approval_flow_run_key')) {
  324. this.$goto('../../pageApp/ge/gePurchase')
  325. } else if (res.data[0].examplesId === uni.getStorageSync('contract_approval_flow_run_key')) {
  326. this.$goto('../../pageApp/ge/geContract')
  327. } else if (res.data[0].examplesId === uni.getStorageSync('use_seal_approval_flow_run_key')) {
  328. this.$goto('../../pageApp/ge/geUseSeal')
  329. }else if (res.data[0].examplesId === uni.getStorageSync('phone_card_apply_flow_run_key')) {
  330. this.$goto('../../pageApp/ge/gePhoneApply')
  331. } else if (res.data[0].examplesId === uni.getStorageSync('letter_dispose_flow_run_key')) {
  332. console.log("测试")
  333. this.$goto('../../pageApp/ge/geLetterDispose')
  334. }
  335. uni.hideLoading({
  336. mask: true
  337. })
  338. }
  339. }
  340. },
  341. async orderInfo(id, pageType, msgType) {
  342. // 发送请求
  343. const {
  344. data: res
  345. } = await this.$httpRequest({
  346. url: '/app/orderInfo?on=' + id,
  347. method: 'get',
  348. urlType: this.$getUrlType()
  349. });
  350. if (res.code === 200) {
  351. if (res.data) {
  352. uni.setStorageSync("order", res.data)
  353. if (msgType === '1') {
  354. uni.navigateTo({
  355. url: "../card/expense/details"
  356. })
  357. } else if (msgType === '2') {
  358. uni.navigateTo({
  359. url: "../card/orderProcess"
  360. })
  361. } else if (msgType === '6') {
  362. uni.navigateTo({
  363. url: "../integral/details"
  364. })
  365. }
  366. uni.hideLoading({
  367. mask: true
  368. })
  369. }
  370. }
  371. },
  372. async readTask(item) {
  373. const {
  374. data: res
  375. } = await this.$httpRequest({
  376. url: '/app/rm?id=' + item.id,
  377. method: 'get',
  378. urlType: this.$getUrlType()
  379. });
  380. if (res.code === 200) {
  381. let msgData = uni.getStorageSync("msgData")
  382. if (msgData) {
  383. if (msgData["m" + item.msgType] > 0) {
  384. --msgData["m" + item.msgType];
  385. uni.setStorageSync("msgData", msgData)
  386. }
  387. }
  388. }
  389. },
  390. async taskList(paging) {
  391. // 发送请求
  392. const {
  393. data: res
  394. } = await this.$httpRequest({
  395. url: '/app/gum?pageNum=' + paging.page + '&pageSize=' + paging.size,
  396. method: 'get',
  397. urlType: this.$getUrlType()
  398. });
  399. if (res.code === 200) {
  400. if (paging.page === 1) {
  401. this.scrollList = res.rows
  402. this.total = res.total
  403. this.$refs.list.loadSuccess({
  404. list: res.rows,
  405. total: this.total
  406. });
  407. } else if (paging.page > 1) {
  408. for (var i = 0; i < res.rows.length; i++) {
  409. this.scrollList.push(res.rows[i])
  410. }
  411. this.$refs.list.loadSuccess({
  412. list: this.scrollList,
  413. total: this.total
  414. });
  415. }
  416. }
  417. },
  418. // 刷新刷剧
  419. refresh(paging) {
  420. this.taskList(paging)
  421. },
  422. scrolltolower(e) {
  423. },
  424. load(paging) {
  425. this.taskList(paging)
  426. },
  427. loadSuccess(list) {
  428. this.list = list
  429. }
  430. }
  431. }
  432. </script>