| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- <template>
- <view class="width-100 height-100 view-page">
- <view class="p-10 dis-flex flex-y-center flex-x-between">
- <view class="search-left-btn">
- <u-image width="35px" height="35px" mode="aspectFit" src="@/static/images/home/logo.png"></u-image>
- </view>
- <view class="width-100">
- <u-search :clearabled="true" height="35px" placeholder="请输入搜索关键字" v-model="keyword" shape="round"
- search="doSearch" @custom="doSearch" :showAction="false" bg-color="#e9f0f8"
- placeholder-color="#65371b"></u-search>
- </view>
- </view>
- <view v-show="currentTab != 3" style="width: 100%;height: 250px;">
- <l-echart ref="chart" @finished="init"></l-echart>
- </view>
- <u-tabs ref="tabs" :list="tabList" :scrollable="false" :current="currentTab" @change="tabChange" lineColor="#65371b"
- :activeStyle="{color:'#65371b'}" inactiveStyle="{color:'#65371b'}"></u-tabs>
- <u-list @scrolltolower="scrolltolower" :height="currentTab != 3?'calc(100% - 341px)':'calc(100% - 91px)'"
- lowerThreshold="10">
- <view class="info-list">
- <view class="info-item" v-for="(item, index) in list" :key="index" @click="toDetail(item.id)">
- <view class="info-pic">
- <u-image width="96px" height="96px" mode="aspectFill" :src="item.cover"></u-image>
- </view>
- <view class="info-title">
- {{item.name || item.title}}
- </view>
- </view>
- </view>
- <u-loadmore :status="page.status" :loading-text="page.loadingText" :loadmore-text="page.loadmoreText"
- :nomore-text="page.nomoreText" />
- </u-list>
- </view>
- </template>
- <script>
- import * as echarts from '@/uni_modules/lime-echart/static/echarts.min'
- import * as mapJson from '@/mockdata/mapdata.json'; /*echart.min.js为在线定制*/
- let myChart;
- export default {
- data() {
- return {
- option: {
- title: {
- show: false,
- text: '',
- subtext: '',
- sublink: '',
- left: 'right'
- },
- tooltip: {
- trigger: 'item',
- formatter: '{b}'
- },
- toolbox: {
- show: false,
- },
- visualMap: {
- show: false,
- min: 0,
- max: 210,
- text: ['High', 'Low'],
- realtime: false,
- calculable: true,
- inRange: {
- color: ['#ffffff', '#3FE6B8', '#9FE6B8','#96BFFF', '#9d96f5', '#FFDB5C', '#ff9f7f', '#E062AE']
- }
- },
- series: [{
- name: 'GD',
- type: 'map',
- roam: true,
- //
- // 缩放范围限制
- scaleLimit: {
- min: 1,
- max: 5
- },
- map: 'GD',
- data: [{
- name: '汕尾市',
- value: 10,
- }, {
- name: '云浮市',
- value: 20
- }, {
- name: '河源市',
- value: 30
- }, {
- name: '梅州市',
- value: 40
- }, {
- name: '韶关市',
- value: 50
- }, {
- name: '阳江市',
- value: 60
- }, {
- name: '肇庆市',
- value: 70
- }, {
- name: '清远市',
- value: 80
- }, {
- name: '茂名市',
- value: 90
- }, {
- name: '潮州市',
- value: 100
- }, {
- name: '揭阳市',
- value: 110
- },{
- name: '湛江市',
- value: 120
- }, {
- name: '江门市',
- value: 130
- }, {
- name: '珠海市',
- value: 140
- }, {
- name: '汕头市',
- value: 150
- }, {
- name: '惠州市',
- value: 160
- }, {
- name: '中山市',
- value: 170
- }, {
- name: '佛山市',
- value: 180
- }, {
- name: '东莞市',
- value: 190
- }, {
- name: '广州市',
- value: 200
- }, {
- name: '深圳市',
- value: 210
- }],
- emphasis: {
- label: {
- show: true
- }
- },
- }],
- },
- //
- page: {
- current: 1,
- size: 15,
- total: 0,
- // loadmore loading nomore
- status: 'loadmore',
- loadingText: '正在加载中',
- loadmoreText: '上拉加载更多',
- nomoreText: '没有更多了'
- },
- keyword: '',
- areaCode: '',
- list: [],
- tabList: [{
- name: '名店',
- }, {
- name: '名菜'
- }, {
- name: '名点',
- }, {
- name: '专业风采'
- }],
- currentTab: 0
- }
- },
- onLoad(options) {},
- onShow() {
- uni.hideLoading()
- // this.doRefresh()
- },
- methods: {
- async init() {
- // chart 图表实例不能存在data里
- echarts.registerMap('GD', mapJson, {});
- const chart = await this.$refs.chart.init(echarts);
- chart.setOption(this.option)
- chart.on('click', this.clickMap);
- myChart = chart;
- },
- clickMap(e) {
- let currentAcode;
- if (e.dataIndex < 0) {
- currentAcode = '';
- } else {
- currentAcode = mapJson.features[e.dataIndex].properties.adcode;
- }
- if (this.currentTab != 3 && this.areaCode != currentAcode) {
- this.areaCode = currentAcode;
- this.areaSearch();
- } else if (this.currentTab != 3 && this.areaCode == currentAcode) {
- this.areaCode = '';
- myChart.dispatchAction({
- type: 'downplay',
- seriesIndex: e.seriesIndex
- })
- this.areaSearch();
- }
- },
- tabChange(e) {
- this.currentTab = e.index;
- this.doRefresh();
- },
- scrolltolower() {
- this.loadmore()
- },
- loadmore() {
- this.page.current++;
- this.getList();
- },
- areaSearch() {
- this.page.current = 1;
- this.page.status = 'loadmore';
- this.list = [];
- this.getList();
- },
- doRefresh() {
- this.page.current = 1;
- this.page.status = 'loadmore';
- this.areaCode = '';
- this.list = [];
- this.getList();
- },
- getList() {
- if (this.page.status == 'loading' || this.page.status == 'nomore') {
- // 防止重复下拉
- return;
- }
- this.page.status = 'loading';
- //
- let listFunc, params = {};
- switch (this.currentTab) {
- case 0:
- listFunc = this.$u.api.getRestaurantList;
- params.name = this.keyword || '';
- params.regionId = this.areaCode || '';
- break;
- case 1:
- listFunc = this.$u.api.getDishList;
- params.name = this.keyword || '';
- params.regionId = this.areaCode || '';
- break;
- case 2:
- listFunc = this.$u.api.getSnacksList;
- params.name = this.keyword || '';
- params.regionId = this.areaCode || '';
- break;
- case 3:
- listFunc = this.$u.api.getProfessionalStyleList;
- params.title = this.keyword || '';
- break;
- default:
- return;
- break;
- }
- //
- listFunc(this.page.current, this.page.size, params).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) {
- switch (this.currentTab) {
- case 0:
- uni.navigateTo({
- url: "/pages/yuecai/restaurant/detail/index?id=" + id,
- })
- break;
- case 1:
- uni.navigateTo({
- url: "/pages/yuecai/dish/detail/index?id=" + id,
- })
- break;
- case 2:
- uni.navigateTo({
- url: "/pages/yuecai/snacks/detail/index?id=" + id,
- })
- break;
- case 3:
- uni.navigateTo({
- url: "/pages/yuecai/professional_style/detail/index?id=" + id,
- })
- break;
- default:
- return;
- break;
- }
- }
- },
- }
- </script>
- <style scoped lang="scss">
- .search-left-btn {
- width: 35px;
- min-width: 35px;
- height: 35px;
- margin-right: 5px;
- box-sizing: border-box;
- }
- .icon-circle {
- border-radius: 50%;
- border: 4rpx solid #65371b;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .nav-btns {
- border-bottom: 1rpx solid #65371b;
- margin-bottom: 20rpx;
- padding-bottom: 50rpx;
- .nav-btn {
- width: 150rpx;
- .nav-btn-icon {
- margin: auto;
- width: 110rpx;
- height: 110rpx;
- }
- .nav-btn-text {
- width: 100%;
- color: #65371b;
- margin-top: 5rpx;
- font-weight: bolder;
- text-align: center;
- }
- }
- }
- .info-list {
- display: flex;
- flex-wrap: wrap;
- .info-item {
- padding: 20rpx;
- width: 33%;
- box-sizing: border-box;
- .info-pic {
- margin: auto;
- width: 175rpx;
- height: 175rpx;
- background: bisque;
- }
- .info-title {
- word-break: break-all;
- text-align: center;
- color: #65371b;
- font-size: 24rpx;
- font-weight: 300;
- line-height: 47rpx;
- word-spacing: 2rpx;
- overflow: hidden;
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- line-clamp: 3;
- -webkit-box-orient: vertical;
- }
- }
- }
- </style>
|