message.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view class="center">
  3. <view class="massage" v-for="(item, index) in list" :key="index" @click="nav('/pages/index/messageInfo?id=' + item.id)">
  4. <view class="title">{{ item.title }}</view>
  5. <view class="time">{{ item.add_time }}</view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import { article } from '@/api/index.js';
  11. export default {
  12. data() {
  13. return {
  14. list: [],
  15. type: ''
  16. };
  17. },
  18. onLoad(opt) {
  19. let obj = this;
  20. if (opt.type) {
  21. this.type = opt.type;
  22. if(opt.type==1){
  23. uni.setNavigationBarTitle({
  24. title: '官方公告'
  25. });
  26. }else
  27. if(opt.type==2){
  28. uni.setNavigationBarTitle({
  29. title: '公司介紹'
  30. });
  31. }
  32. }
  33. article({ page: 1, limit: 1000 }, this.type).then(({ data }) => {
  34. this.list = data;
  35. });
  36. },
  37. methods: {
  38. nav(url) {
  39. uni.navigateTo({
  40. url
  41. });
  42. }
  43. }
  44. };
  45. </script>
  46. <style lang="less">
  47. .center {
  48. background: #f3f3f3;
  49. }
  50. .massage {
  51. background: #ffffff;
  52. padding: 30rpx;
  53. border-bottom: 1px solid #e9e9e9;
  54. .title {
  55. font-size: 28rpx;
  56. font-family: PingFang SC;
  57. font-weight: 500;
  58. color: #333333;
  59. }
  60. .time {
  61. margin-top: 18rpx;
  62. font-size: 20rpx;
  63. font-family: PingFang SC;
  64. font-weight: 500;
  65. color: #999999;
  66. }
  67. }
  68. </style>