lijj 2 سال پیش
والد
کامیت
f4a11d8428

+ 82 - 0
admin/src/main/java/org/springblade/modules/ycwh/controller/wx/WXCollectInfoController.java

@@ -0,0 +1,82 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.ycwh.controller.wx;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.excel.util.ExcelUtil;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.constant.BladeConstant;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.ycwh.entity.CollectInfoEntity;
+import org.springblade.modules.ycwh.excel.CollectInfoExcel;
+import org.springblade.modules.ycwh.service.ICollectInfoService;
+import org.springblade.modules.ycwh.vo.CollectInfoVO;
+import org.springblade.modules.ycwh.wrapper.CollectInfoWrapper;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 名菜名点名店收藏 控制器
+ *
+ * @author BladeX
+ * @since 2023-08-29
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("collect_info")
+@Api(value = "名菜名点名店收藏", tags = "名菜名点名店收藏接口")
+public class WXCollectInfoController extends BladeController {
+
+	private final ICollectInfoService collectInfoService;
+
+
+	/**
+	 * 名菜名点名店收藏 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入collectInfo")
+	public R<IPage<CollectInfoVO>> list(@ApiIgnore @RequestParam Map<String, Object> collectInfo, Query query) {
+//		BladeUser user = AuthUtil.getUser();
+//		if (Func.isEmpty(user)) {
+//			return R.fail("未登录");
+//		}
+		QueryWrapper<CollectInfoEntity> qw = Condition.getQueryWrapper(collectInfo, CollectInfoEntity.class);
+//		qw.eq("create_user", user.getUserId());
+		IPage<CollectInfoEntity> pages = collectInfoService.page(Condition.getPage(query), qw);
+		return R.data(CollectInfoWrapper.build().pageVO(pages));
+	}
+
+
+}

+ 40 - 0
miniapp/api/collection.js

@@ -0,0 +1,40 @@
+import http from '@/http/api.js'
+import {
+  bizConst
+} from './biz/biz.js'
+import {
+  clientId,
+  tenantId
+} from '@/common/setting'
+
+const getCollectionList = (current, size, vo) => {
+  return http.request({
+    url: bizConst.basicPrefix + '/collect_info/list',
+    method: 'GET',
+    header: {
+      'Tenant-Id': tenantId
+    },
+    params: {
+      current,
+      size,
+      ...vo
+    },
+  })
+}
+
+const getCollectionDetail = (id) => {
+  return http.request({
+    url: bizConst.basicPrefix + '/collect_info/detail',
+    method: 'GET',
+    header: {
+      'Tenant-Id': tenantId
+    },
+    params: {
+      id
+    },
+  })
+}
+export default {
+  getCollectionList,
+  getCollectionDetail
+}

+ 96 - 0
miniapp/pages/yuecai/collection/index.vue

@@ -0,0 +1,96 @@
+<template>
+  <view class="width-100 height-100 view-page">
+    <view class="p-10">
+      <u-search :clearabled="true" placeholder="请输入搜索关键字" v-model="keyword" :shape="square" search="doRefresh"
+        @custom="doRefresh"></u-search>
+    </view>
+    <u-list @scrolltolower="scrolltolower" height="calc(100% - 180px)" lowerThreshold="10">
+      <u-list-item v-for="(item, index) in list" :key="index">
+        <u-cell :title="item.name" @click="toDetail(item.id)">
+          <u-avatar slot="icon" shape="square" size="35" :src="item.cover"
+            customStyle="margin: -3px 5px -3px 0"></u-avatar>
+        </u-cell>
+      </u-list-item>
+      <u-loadmore :status="page.status" :loading-text="page.loadingText" :loadmore-text="page.loadmoreText"
+        :nomore-text="page.nomoreText" />
+    </u-list>
+  </view>
+</template>
+
+<script>
+  import themeMixins from '@/pages/yuecai/mixins/themeMixins.js';
+  export default {
+    mixins: [themeMixins],
+    data() {
+      return {
+        page: {
+          current: 1,
+          size: 10,
+          total: 0,
+          // loadmore loading nomore
+          status: 'loadmore',
+          loadingText: '正在加载中',
+          loadmoreText: '上拉加载更多',
+          nomoreText: '没有更多了'
+        },
+        keyword: '',
+        list: []
+      }
+    },
+    onLoad(options) {
+      this.collectionType = options.type || '';
+    },
+    onShow() {
+      this.keyword = '';
+      this.doRefresh();
+    },
+    methods: {
+      scrolltolower() {
+        this.loadmore()
+      },
+      loadmore() {
+        this.page.current++;
+        this.getCollectionList();
+      },
+      doRefresh() {
+        this.page.current = 1;
+        this.page.status = 'loadmore'
+        this.list = [];
+        this.getCollectionList();
+      },
+      getCollectionList() {
+
+        if (this.page.status == 'loading' || this.page.status == 'nomore') {
+          // 防止重复下拉
+          return;
+        }
+        this.page.status = 'loading';
+        //
+        this.$u.api.getCollectionList(this.page.current, this.page.size, {
+          name: this.keyword || ''
+        }).then(res => {
+          if (res.data.records && res.data.records.length > 0) {
+            this.list.push(...res.data.records)
+          }
+          this.page.total = res.data.total || 0;
+          if (this.page.size * this.page.current >= res.data.total) {
+            this.page.status = 'nomore'
+          } else {
+            this.page.status = 'loadmore'
+          }
+        })
+      },
+      toDetail(id) {
+        uni.navigateTo({
+          url: "/pages/yuecai/dish/detail/index?id=" + id,
+        })
+      }
+    },
+  }
+</script>
+
+<style scoped lang="scss">
+  .view-page {
+    overflow: hidden;
+  }
+</style>