index.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <page-theme :theme="theme">
  3. <template>
  4. <view class="f-30 p-t-20 p-b-20">
  5. <view class="col-info-d t-c m-b-30">搜索框</view>
  6. <u-list @scrolltolower="scrolltolower">
  7. <u-list-item v-for="(item, index) in list" :key="index">
  8. <u-cell :title="item.name" @click="toDetail(item.id)">
  9. <u-avatar slot="icon" shape="square" size="35" :src="item.cover"
  10. customStyle="margin: -3px 5px -3px 0"></u-avatar>
  11. </u-cell>
  12. </u-list-item>
  13. </u-list>
  14. </view>
  15. </template>
  16. </page-theme>
  17. </template>
  18. <script>
  19. import themeMixins from '@/pages/yuecai/mixins/themeMixins.js';
  20. export default {
  21. mixins: [themeMixins],
  22. data() {
  23. return {
  24. page: {
  25. current: 1,
  26. size: 10,
  27. total: 0
  28. },
  29. searchKey: '',
  30. list: []
  31. }
  32. },
  33. methods: {
  34. doSearch() {
  35. this.page.current = 1;
  36. this.list = [];
  37. this.getLocationList();
  38. },
  39. scrolltolower() {
  40. this.loadmore()
  41. },
  42. loadmore() {
  43. this.page.current++;
  44. this.getLocationList();
  45. },
  46. getLocationList() {
  47. this.$u.api.getLocationList().then(res => {
  48. if (res.data.records && res.data.records.length > 0) {
  49. this.list.push(...res.data.records)
  50. }
  51. this.page.total = res.data.total || 0;
  52. })
  53. },
  54. toDetail(id) {
  55. uni.navigateTo({
  56. url: "/pages/yuecai/location/detail/index?id=" + id
  57. })
  58. }
  59. },
  60. onLoad(options) {
  61. this.getLocationList()
  62. },
  63. }
  64. </script>
  65. <style scoped lang="scss">
  66. </style>