Browse Source

专业风采对接

lijj 2 years ago
parent
commit
9b7f47dca7

+ 2 - 2
miniapp/pages.json

@@ -6,7 +6,7 @@
   // "requiredBackgroundModes": ["audio", "location"],
   "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
    {
-        "path": "pages/yuecai/home/index",
+        "path": "pages/yuecai/professional_style/index",
         "style": {
           "navigationBarTitleText": "专业风采",
           "enablePullDownRefresh": false
@@ -80,7 +80,7 @@
       "iconPath": "@iconPath1",
       "selectedIconPath": "@selectedIconPath1",
       "text": "专业风采",
-      "pagePath": "pages/yuecai/home/index"
+      "pagePath": "pages/yuecai/professional_style/index"
     },{
       "iconPath": "@iconPath2",
       "selectedIconPath": "@selectedIconPath2",

+ 11 - 8
miniapp/pages/yuecai/home/index.vue

@@ -1,9 +1,9 @@
 <template>
   <page-theme :theme="theme">
     <template>
-      <u-swiper :list="list1" @click="click"></u-swiper>
       <view class="f-30 p-40 flex-dir-column flex-x-center">
-        <view class="col-info-d t-c m-b-30">其他内容展示</view>
+        <view>{{detailVO.address}}</view>
+        <view class="col-info-d t-c m-b-30" v-html="detailVO.content"></view>
       </view>
     </template>
   </page-theme>
@@ -15,16 +15,19 @@
     mixins: [themeMixins],
     data() {
       return {
-        list1: [
-          'https://cdn.uviewui.com/uview/swiper/swiper1.png',
-          'https://cdn.uviewui.com/uview/swiper/swiper2.png',
-          'https://cdn.uviewui.com/uview/swiper/swiper3.png',
-        ]
+        detailVO: {},
       }
     },
     methods: {
+      getProfessionalStyleDetail() {
+        this.$u.api.getProfessionalStyleDetail().then(res => {
+          this.detailVO = res.data || {}
+        })
+      }
+    },
+    onLoad(options) {
+      this.getProfessionalStyleDetail(options.id);
     },
-    onLoad(options) {},
   }
 </script>
 

+ 90 - 0
miniapp/pages/yuecai/professional_style/index.vue

@@ -0,0 +1,90 @@
+<template>
+  <view class="width-100 height-100 view-page">
+    <u-swiper :list="list1" @click="click"></u-swiper>
+    <u-list @scrolltolower="scrolltolower" height="calc(100% - 50px)" 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 {
+        list1: [
+          'https://cdn.uviewui.com/uview/swiper/swiper1.png',
+          'https://cdn.uviewui.com/uview/swiper/swiper2.png',
+          'https://cdn.uviewui.com/uview/swiper/swiper3.png',
+        ],
+        page: {
+          current: 1,
+          size: 10,
+          total: 0,
+          // loadmore loading nomore
+          status: 'loadmore',
+          loadingText: '正在加载中',
+          loadmoreText: '上拉加载更多',
+          nomoreText: '没有更多了'
+        },
+        keyword: '',
+        list: []
+      }
+    },
+    onShow() {
+      this.getProfessionalStyleList();
+    },
+    methods: {
+      scrolltolower() {
+        this.loadmore()
+      },
+      loadmore() {
+        this.page.current++;
+        this.getProfessionalStyleList();
+      },
+      doRefresh() {
+        this.page.current = 1;
+        this.page.status = 'loadmore'
+        this.list = [];
+        this.getProfessionalStyleList();
+      },
+      getProfessionalStyleList() {
+        if (this.page.status == 'loading' || this.page.status == 'nomore') {
+          // 防止重复下拉
+          return;
+        }
+        this.page.status = 'loading';
+        //
+        this.$u.api.getProfessionalStyleList(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">
+</style>

+ 1 - 1
miniapp/utils/func.js

@@ -16,7 +16,7 @@ const install = (Vue, vm) => {
 	//跳到首页。所有地方都不要写死这个页面的地址,统一由这个方法管理
 	const toHome = () => {
 		uni.switchTab({
-			url: '/pages/jiuhub/home/home'
+			url: '/pages/yuecai/professional_style/index'
 		})
 	}