<template>
  <view class="page__view">

		<!-- 导航栏 -->
		<navbar :title="title" leftClick @leftClick="$utils.navigateBack" />

    <view class="list">
      <view class="list-item"
        v-for="item in list" 
        :key="item.id"
        @click="jumpToDetail(item.id, item.title)"
      >
        <image class="list-item-bg" :src="item.image" mode="scaleToFill"></image>
      </view>
    </view>
  </view>
</template>

<script>
	import mixinsList from '@/mixins/list.js'

  export default {
		mixins: [mixinsList],
    data() {
      return {
        title: '搜索',
				keyword: '',
				queryParams: {
					pageNo: 1,
					pageSize: 10,
          categoryId: '',
					title: '',
				},
        mixinsListApi: 'queryServiceArticleList',
      }
    },
    onLoad(arg) {

      const { categoryId, search, title } = arg

      if (title) {
        this.title = title
      }

      if (categoryId) {
        this.queryParams.categoryId = categoryId
      }

      if (search) {
        this.queryParams.title = search
      }

      this.getData()
    },
    methods: {
      search() {
        this.queryParams.pageNo = 1
        this.queryParams.pageSize = 10
				this.queryParams.title = this.keyword
        this.getData()
      },
      jumpToDetail(articleId) {
        uni.navigateTo({
					url: `/pages_order/serve/index?articleId=${articleId}`
				})
      },
    },
  }
</script>

<style scoped lang="scss">

  .list {
    margin: 49rpx 18rpx 17rpx 18rpx;

    &-item {
      position: relative;
      font-size: 0;
      border-radius: 25rpx;
      overflow: hidden;
      box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);

      & + & {
        margin-top: 32rpx;
      }

      &-bg {
        $w: calc(100vw - 18rpx*2);
        width: $w;
        height: calc(#{$w} * 179 / 714);
      }

    }
  }

</style>