addmen.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="container">
  3. <view v-if="list.length > 0" class="list-box flex_item" v-for="(ls,index) in list" :key='index' @click="nav(index)">
  4. <image :src="ls.image_input[0]"></image>
  5. <view class="list-item">
  6. <view class="title ellipsis">{{ls.title}}</view>
  7. <!-- <view class="time">{{ls.add_time}}</view> -->
  8. </view>
  9. </view>
  10. <view class="empty-box" v-show="list.length === 0"><empty></empty></view>
  11. </view>
  12. </template>
  13. <script>
  14. import { article } from '@/api/index.js';
  15. import empty from '@/components/empty';
  16. export default {
  17. components: {
  18. empty
  19. },
  20. data() {
  21. return {
  22. list:'',
  23. cid: '',
  24. };
  25. },
  26. onLoad(option){
  27. if(option.id) {
  28. this.cid = option.id
  29. }
  30. if(option.id == '1') {
  31. uni.setNavigationBarTitle({
  32. title: '加盟信息列表'
  33. });
  34. }
  35. if(option.id == '2') {
  36. uni.setNavigationBarTitle({
  37. title: '消息列表'
  38. });
  39. }
  40. this.loadData();
  41. },
  42. onShow() {
  43. },
  44. methods: {
  45. // 请求载入数据
  46. async loadData() {
  47. let obj = this;
  48. article({
  49. page:1,
  50. limit:10000
  51. },obj.cid).then(({ data }) => {
  52. console.log(data)
  53. obj.list = data;
  54. });
  55. },
  56. nav(index){
  57. uni.navigateTo({
  58. url: '/pages/user/addmenDetail?id=' + this.list[index].id
  59. })
  60. },
  61. }
  62. };
  63. </script>
  64. <style lang="scss">
  65. page {
  66. min-height: 100%;
  67. background-color: #ffffff;
  68. .container {
  69. width: 100%;
  70. padding: 25rpx 27rpx;
  71. }
  72. }
  73. .empty-box{
  74. margin-top: 100rpx;
  75. width: 100%;
  76. height: 500rpx;
  77. }
  78. .list-box{
  79. border-bottom: 1rpx solid #E3E3E3;
  80. margin-bottom: 25rpx;
  81. padding-bottom: 25rpx;
  82. image{
  83. width: 200rpx;
  84. height: 160rpx;
  85. border-radius: 15rpx;
  86. }
  87. .list-item{
  88. padding-left: 16rpx;
  89. width: 80%;
  90. .title{
  91. height: 80rpx;
  92. color: #333333;
  93. font-size: 30rpx;
  94. font-weight: 500;
  95. }
  96. .time{
  97. padding-top: 40rpx;
  98. color: #999999;
  99. font-size: 24rpx;
  100. }
  101. }
  102. }
  103. </style>