index1.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view class="width-100 height-100 view-page">
  3. <view class="p-10 dis-flex flex-y-center flex-x-between">
  4. <view class="search-left-btn">
  5. <u-image width="35px" height="35px" mode="aspectFit" src="@/static/images/home/logo.png"></u-image>
  6. </view>
  7. <view class="width-100">
  8. <u-search :clearabled="true" height="35px" placeholder="请输入搜索关键字" v-model="keyword" shape="round"
  9. search="doSearch" @custom="doSearch" :showAction="false" bg-color="#e9f0f8"
  10. placeholder-color="#65371b"></u-search>
  11. </view>
  12. </view>
  13. <view style="width: 100%;height: 250px;">
  14. <qiun-data-charts type="map" :opts="mapOpts" :chartData="mapDataColumn" @getIndex="clickMap" />
  15. </view>
  16. <u-tabs ref="tabs" :list="tabList" :scrollable="false" :current="currentTab" @change="tabChange" lineColor="#65371b"
  17. :activeStyle="{color:'#65371b'}" inactiveStyle="{color:'#65371b'}"></u-tabs>
  18. <u-list @scrolltolower="scrolltolower" height="calc(100% - 341px)" lowerThreshold="10">
  19. <view class="info-list">
  20. <view class="info-item" v-for="(item, index) in list" :key="index" @click="toDetail(item.id)">
  21. <view class="info-pic">
  22. <u-image width="96px" height="96px" mode="aspectFill" :src="item.cover"></u-image>
  23. </view>
  24. <view class="info-title">
  25. {{item.name || item.title}}
  26. </view>
  27. </view>
  28. </view>
  29. <u-loadmore :status="page.status" :loading-text="page.loadingText" :loadmore-text="page.loadmoreText"
  30. :nomore-text="page.nomoreText" />
  31. </u-list>
  32. </view>
  33. </template>
  34. <script>
  35. import themeMixins from '@/pages/yuecai/mixins/themeMixins.js';
  36. import mapdata from '@/mockdata/mapdata.json';
  37. export default {
  38. mixins: [themeMixins],
  39. data() {
  40. return {
  41. mapOpts: {
  42. timing: "easeOut",
  43. duration: 1000,
  44. rotate: false,
  45. rotateLock: false,
  46. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"],
  47. padding: [0, 0, 0, 0],
  48. fontSize: 13,
  49. fontColor: "#666666",
  50. dataLabel: false,
  51. dataPointShape: true,
  52. dataPointShapeType: "solid",
  53. touchMoveLimit: 60,
  54. enableScroll: false,
  55. enableMarkLine: false,
  56. extra: {
  57. map: {
  58. border: true,
  59. borderWidth: 1,
  60. borderColor: "#666666",
  61. fillOpacity: 0.6,
  62. activeBorderColor: "#F04864",
  63. activeFillColor: "#FACC14",
  64. activeFillOpacity: 1,
  65. mercator: false,
  66. active: true,
  67. activeTextColor: "#FFFFFF"
  68. },
  69. tooltip: {
  70. showBox: true,
  71. showArrow: true,
  72. showCategory: false,
  73. borderWidth: 0,
  74. borderRadius: 0,
  75. borderColor: "#000000",
  76. borderOpacity: 0.7,
  77. bgColor: "#000000",
  78. bgOpacity: 0.7,
  79. gridType: "solid",
  80. dashLength: 4,
  81. gridColor: "#CCCCCC",
  82. boxPadding: 3,
  83. fontSize: 13,
  84. lineHeight: 20,
  85. fontColor: "#FFFFFF",
  86. legendShow: true,
  87. legendShape: "auto",
  88. splitLine: true,
  89. horizentalLine: false,
  90. xAxisLabel: false,
  91. yAxisLabel: false,
  92. labelBgColor: "#FFFFFF",
  93. labelBgOpacity: 0.7,
  94. labelFontColor: "#666666"
  95. }
  96. }
  97. },
  98. mapDataColumn: {},
  99. //
  100. chartOption: {
  101. },
  102. page: {
  103. current: 1,
  104. size: 15,
  105. total: 0,
  106. // loadmore loading nomore
  107. status: 'loadmore',
  108. loadingText: '正在加载中',
  109. loadmoreText: '上拉加载更多',
  110. nomoreText: '没有更多了'
  111. },
  112. keyword: '',
  113. areaCode: '',
  114. list: [],
  115. tabList: [{
  116. name: '专业风采'
  117. }, {
  118. name: '名店',
  119. }, {
  120. name: '名菜'
  121. }, {
  122. name: '名点',
  123. }],
  124. currentTab: 0
  125. }
  126. },
  127. onReady() {
  128. setTimeout(() => {
  129. let md = {
  130. visualMap: {
  131. min: 800,
  132. max: 50000,
  133. text: ['High', 'Low'],
  134. realtime: false,
  135. calculable: true,
  136. inRange: {
  137. color: ['lightskyblue', 'yellow', 'orangered']
  138. }
  139. },
  140. series: mapdata.features
  141. };
  142. this.mapDataColumn = JSON.parse(JSON.stringify(md));
  143. }, 5000);
  144. },
  145. onLoad(options) {},
  146. onShow() {
  147. this.doRefresh()
  148. },
  149. methods: {
  150. clickMap(e) {
  151. if (e.currentIndex < 0) {
  152. this.areaCode = '';
  153. } else {
  154. this.areaCode = e.opts.series[e.currentIndex].properties.adcode || '';
  155. }
  156. this.areaSearch();
  157. },
  158. tabChange(e) {
  159. this.currentTab = e.index;
  160. this.doRefresh();
  161. },
  162. scrolltolower() {
  163. this.loadmore()
  164. },
  165. loadmore() {
  166. this.page.current++;
  167. this.getList();
  168. },
  169. areaSearch() {
  170. this.page.current = 1;
  171. this.page.status = 'loadmore';
  172. this.list = [];
  173. this.getList();
  174. },
  175. doRefresh() {
  176. this.page.current = 1;
  177. this.page.status = 'loadmore';
  178. this.areaCode = '';
  179. this.list = [];
  180. this.getList();
  181. },
  182. getList() {
  183. if (this.page.status == 'loading' || this.page.status == 'nomore') {
  184. // 防止重复下拉
  185. return;
  186. }
  187. this.page.status = 'loading';
  188. //
  189. let listFunc, params = {};
  190. switch (this.currentTab) {
  191. case 0:
  192. listFunc = this.$u.api.getProfessionalStyleList;
  193. params.title = this.keyword || '';
  194. break;
  195. case 1:
  196. listFunc = this.$u.api.getRestaurantList;
  197. params.name = this.keyword || '';
  198. params.regionId = this.areaCode || '';
  199. break;
  200. case 2:
  201. listFunc = this.$u.api.getDishList;
  202. params.name = this.keyword || '';
  203. params.regionId = this.areaCode || '';
  204. break;
  205. case 3:
  206. listFunc = this.$u.api.getSnacksList;
  207. params.name = this.keyword || '';
  208. params.regionId = this.areaCode || '';
  209. break;
  210. default:
  211. return;
  212. break;
  213. }
  214. //
  215. listFunc(this.page.current, this.page.size, params).then(res => {
  216. if (res.data.records && res.data.records.length > 0) {
  217. this.list.push(...res.data.records)
  218. }
  219. this.page.total = res.data.total || 0;
  220. if (this.page.size * this.page.current >= res.data.total) {
  221. this.page.status = 'nomore'
  222. } else {
  223. this.page.status = 'loadmore'
  224. }
  225. })
  226. },
  227. toDetail(id) {
  228. switch (this.currentTab) {
  229. case 0:
  230. uni.navigateTo({
  231. url: "/pages/yuecai/professional_style/detail/index?id=" + id,
  232. })
  233. break;
  234. case 1:
  235. uni.navigateTo({
  236. url: "/pages/yuecai/restaurant/detail/index?id=" + id,
  237. })
  238. break;
  239. case 2:
  240. uni.navigateTo({
  241. url: "/pages/yuecai/dish/detail/index?id=" + id,
  242. })
  243. break;
  244. case 3:
  245. uni.navigateTo({
  246. url: "/pages/yuecai/snacks/detail/index?id=" + id,
  247. })
  248. break;
  249. default:
  250. return;
  251. break;
  252. }
  253. }
  254. },
  255. }
  256. </script>
  257. <style scoped lang="scss">
  258. .search-left-btn {
  259. width: 35px;
  260. min-width: 35px;
  261. height: 35px;
  262. margin-right: 5px;
  263. box-sizing: border-box;
  264. }
  265. .icon-circle {
  266. border-radius: 50%;
  267. border: 4rpx solid #65371b;
  268. display: flex;
  269. justify-content: center;
  270. align-items: center;
  271. }
  272. .nav-btns {
  273. border-bottom: 1rpx solid #65371b;
  274. margin-bottom: 20rpx;
  275. padding-bottom: 50rpx;
  276. .nav-btn {
  277. width: 150rpx;
  278. .nav-btn-icon {
  279. margin: auto;
  280. width: 110rpx;
  281. height: 110rpx;
  282. }
  283. .nav-btn-text {
  284. width: 100%;
  285. color: #65371b;
  286. margin-top: 5rpx;
  287. font-weight: bolder;
  288. text-align: center;
  289. }
  290. }
  291. }
  292. .info-list {
  293. display: flex;
  294. flex-wrap: wrap;
  295. .info-item {
  296. padding: 20rpx;
  297. width: 33%;
  298. box-sizing: border-box;
  299. .info-pic {
  300. margin: auto;
  301. width: 175rpx;
  302. height: 175rpx;
  303. background: bisque;
  304. }
  305. .info-title {
  306. word-break: break-all;
  307. text-align: center;
  308. color: #65371b;
  309. font-size: 24rpx;
  310. font-weight: 300;
  311. line-height: 47rpx;
  312. word-spacing: 2rpx;
  313. overflow: hidden;
  314. text-overflow: -o-ellipsis-lastline;
  315. overflow: hidden;
  316. text-overflow: ellipsis;
  317. display: -webkit-box;
  318. -webkit-line-clamp: 1;
  319. line-clamp: 3;
  320. -webkit-box-orient: vertical;
  321. }
  322. }
  323. }
  324. </style>