| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284 |
- <template>
- <view class="container">
- <view class="header2" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx' }" v-if="headerType">
- <view class="title">靖安乡村民宿</view>
- </view>
- <!-- 顶部图片区域 -->
- <view class="header">
- <img mode="aspectFill" src="https://chtech.ncjti.edu.cn/hotelReservation/image/14.png" />
- <img class="img" src="https://chtech.ncjti.edu.cn/hotelReservation/image/16.png" />
- <img class="img2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/17.png" />
- <view class="header_msg">有一种生活叫靖安</view>
- </view>
- <view class="content">
- <!-- 条件筛选区域 -->
- <view class="search">
- <!-- 选择乡镇区域 -->
- <view class="search_town" :class="{ active: town }" @click="handleOpen">
- {{ town ? town : '请选择乡镇' }}
- <img src="../../static/index/right2.png" />
- </view>
- <!-- 关键词搜索和民宿级别区域 -->
- <view class="search_center">
- <view class="center_input">
- <input type="text" v-model="keywords" placeholder="民宿/地名/关键词" placeholder-style="color:#A6A6A6;font-weight:400;" />
- </view>
- <img class="img" src="../../static/index/right2.png" />
- |
- <view class="center_level" :class="{ active: level }" @click="handleChooseLv">{{ level ? level : '请选择民宿级别' }}</view>
- <img class="img2" src="../../static/index/right2.png" @click="handleChooseLv" />
- </view>
- <!-- 查找按钮区域 -->
- <view class="search_btn" @click="handleSearch">查找</view>
- </view>
- <!-- 轮播图区域 -->
- <swiper class="swiper" indicator-dots circular indicator-color="#BBD8FE" indicator-active-color="#1E7DFB" autoplay interval="3000" v-if="townList.length">
- <swiper-item v-for="(ele, index) in townList" :key="index">
- <view class="swiper_item">
- <view class="item_box" v-for="(swi, index2) in ele" :key="index2" @click="handleChooseTown2(swi.name)">
- <img v-if="index === 0 && index2 === 0" src="https://chtech.ncjti.edu.cn/hotelReservation/image/1.png" mode="aspectFill" />
- <img v-if="index === 0 && index2 === 1" src="https://chtech.ncjti.edu.cn/hotelReservation/image/2.png" mode="aspectFill" />
- <img v-if="index === 0 && index2 === 2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/3.png" mode="aspectFill" />
- <img v-if="index === 1 && index2 === 0" src="https://chtech.ncjti.edu.cn/hotelReservation/image/4.png" mode="aspectFill" />
- <img v-if="index === 1 && index2 === 1" src="https://chtech.ncjti.edu.cn/hotelReservation/image/5.png" mode="aspectFill" />
- <img v-if="index === 1 && index2 === 2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/6.png" mode="aspectFill" />
- <img v-if="index === 2 && index2 === 0" src="https://chtech.ncjti.edu.cn/hotelReservation/image/7.png" mode="aspectFill" />
- <img v-if="index === 2 && index2 === 1" src="https://chtech.ncjti.edu.cn/hotelReservation/image/8.png" mode="aspectFill" />
- <img v-if="index === 2 && index2 === 2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/9.png" mode="aspectFill" />
- <img v-if="index === 3 && index2 === 0" src="https://chtech.ncjti.edu.cn/hotelReservation/image/10.png" mode="aspectFill" />
- <img v-if="index === 3 && index2 === 1" src="https://chtech.ncjti.edu.cn/hotelReservation/image/11.png" mode="aspectFill" />
- <img v-if="index === 3 && index2 === 2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/12.png" mode="aspectFill" />
- <view class="box_town">{{ swi.name }}</view>
- <view class="box_count">剩{{ swi.residueNumber }}间</view>
- </view>
- </view>
- </swiper-item>
- </swiper>
- <view class="body">
- <!-- 优选民宿区域 -->
- <view class="body_top">
- <view class="circle"></view>
- <view class="circle color"></view>
- <view class="top_title">优选民宿 .</view>
- <view class="top_msg">特色优选民宿,让旅途充满乐趣</view>
- <view class="top_more" @click="handleGoHome">
- 更多
- <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/13.png" />
- </view>
- </view>
- <view class="body_list">
- <!-- 每一个民宿区域 -->
- <view class="list_item" v-for="item in hotelList.slice(0, 4)" :key="item.id" @click="goPageDetail(item)">
- <image class="item-img" :src="item.coverImg" mode="scaleToFill"></image>
- <view class="descrition">
- <text class="title">{{ item.hotel_name }}</text>
- <text class="type">{{ item.hTypeName }}</text>
- <text class="distance" v-if="showdDistance">距您直线{{ item.distance }}公里</text>
- <view class="detail">
- <img class="img" src="../../static/index/hotel.png" />
- <view class="price">
- <text class="txt1">¥{{ item.min_price }}</text>
- <text class="txt2">起</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 精选攻略区域 -->
- <view class="body_top" v-if="bestNewsInfo">
- <view class="circle"></view>
- <view class="circle color"></view>
- <view class="top_title">精选攻略 .</view>
- <view class="top_msg">宝藏分享社区</view>
- <view class="top_more" @click="handleGoPage">
- 更多
- <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/13.png" />
- </view>
- </view>
- <view v-if="bestNewsInfo" class="body_strategy" @click="handleGoDetail(bestNewsInfo)">
- <img v-if="bestNewsInfo.image" class="strategy_cover" mode="aspectFill" :src="bestNewsInfo.image" />
- <video
- v-if="bestNewsInfo.video"
- class="strategy_cover"
- :src="bestNewsInfo.video"
- :show-center-play-btn="false"
- :show-fullscreen-btn="false"
- :show-play-btn="false"
- ></video>
- <view class="strategy_info">
- <view class="info_title">{{ bestNewsInfo.title }}</view>
- <view class="info_tags">
- <view class="tag">{{ bestNewsInfo.townName }}</view>
- </view>
- <view class="info_desc">
- {{ bestNewsInfo.content }}
- </view>
- </view>
- </view>
- <!-- 招商资讯区域 -->
- <view class="body_top">
- <view class="circle"></view>
- <view class="circle color"></view>
- <view class="top_title">招商资讯 .</view>
- <view class="top_msg">以招商引资,推动镇域经济</view>
- <view class="top_more" @click="handleGoNewsList">
- 更多
- <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/13.png" />
- </view>
- </view>
- <!-- 招商资讯轮播图 -->
- <uni-swiper-dot :info="newsList" mode="round" :dotsStyles="dotsStyles" :current="current">
- <swiper circular autoplay interval="3000" class="body_news" @change="changeDot">
- <swiper-item v-for="item in newsList" :key="item.id" @click="handleGoNews(item)">
- <uv-image width="633rpx" height="332rpx" radius="8rpx" mode="aspectFill" :src="item.url" />
- <view class="news_title">
- {{ item.title ? item.title : '无标题' }}
- </view>
- <view class="news_desc">
- {{ item.desc }}
- </view>
- <mp-html v-if="item.showHtml" @load="htmlLoad(item)" :ref="item.id + 'html'" :content="item.content" />
- </swiper-item>
- </swiper>
- </uni-swiper-dot>
- <!-- 特产甄选区域 -->
- <view class="body_top">
- <view class="circle"></view>
- <view class="circle color"></view>
- <view class="top_title">特产甄选 .</view>
- <view class="top_msg">明优推荐,土的自然,购的放心</view>
- <view class="top_more">
- 更多
- <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/13.png" />
- </view>
- </view>
- <view class="body_list">
- <!-- 每一个特产区域 -->
- <view class="item_goods" v-for="item in goodsList" :key="item.id">
- <img class="goods_img" mode="acpectFill" :src="item.imgUrl" />
- <view class="goods_name">{{ item.name }}</view>
- <view class="goods_detail">
- <img class="img" src="../../static/index/goods.png" />
- <view class="price">
- <text class="txt1">¥{{ item.price }}</text>
- <text class="txt2">起</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 精选推荐区域 -->
- <view class="body_top">
- <view class="circle"></view>
- <view class="circle color"></view>
- <view class="top_title">精选推荐 .</view>
- <view class="top_msg">线上订民宿,住着玩个遍</view>
- <view class="top_more" @click="handleGoHome">
- 更多
- <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/13.png" />
- </view>
- </view>
- <view class="body_list">
- <!-- 每一个民宿区域 -->
- <view class="list_item" v-for="item in hotelList" :key="item.id" @click="goPageDetail(item)">
- <image class="item-img" :src="item.coverImg" mode="scaleToFill"></image>
- <view class="descrition">
- <text class="title">{{ item.hotel_name }}</text>
- <text class="type">{{ item.hTypeName }}</text>
- <text class="distance" v-if="showdDistance">距您直线{{ item.distance }}公里</text>
- <view class="detail">
- <img class="img" src="../../static/index/hotel.png" />
- <view class="price">
- <text class="txt1">¥{{ item.min_price }}</text>
- <text class="txt2">起</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 没有数据时展示的页面 -->
- <view class="noData" v-if="!hotelList.length">
- <img src="../../static/images/noData.png" />
- 暂无推荐数据
- </view>
- </view>
- </view>
- <!-- 选择乡镇弹窗区域 -->
- <uni-popup ref="popup" type="center">
- <view class="popup_body">
- <view class="body_header">
- <img src="../../static/my/popup_title.png" />
- <view class="header_title">请选择乡镇</view>
- <img src="../../static/my/popup_title.png" />
- </view>
- <view class="body_content">
- <view class="content_box" v-for="(item, index) in popList" :key="index" @click="handleChooseTown(item.name)">
- <img v-if="index === 0" src="https://chtech.ncjti.edu.cn/hotelReservation/image/1.png" mode="aspectFill" />
- <img v-if="index === 1" src="https://chtech.ncjti.edu.cn/hotelReservation/image/2.png" mode="aspectFill" />
- <img v-if="index === 2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/3.png" mode="aspectFill" />
- <img v-if="index === 3" src="https://chtech.ncjti.edu.cn/hotelReservation/image/4.png" mode="aspectFill" />
- <img v-if="index === 4" src="https://chtech.ncjti.edu.cn/hotelReservation/image/5.png" mode="aspectFill" />
- <img v-if="index === 5" src="https://chtech.ncjti.edu.cn/hotelReservation/image/6.png" mode="aspectFill" />
- <img v-if="index === 6" src="https://chtech.ncjti.edu.cn/hotelReservation/image/7.png" mode="aspectFill" />
- <img v-if="index === 7" src="https://chtech.ncjti.edu.cn/hotelReservation/image/8.png" mode="aspectFill" />
- <img v-if="index === 8" src="https://chtech.ncjti.edu.cn/hotelReservation/image/9.png" mode="aspectFill" />
- <img v-if="index === 9" src="https://chtech.ncjti.edu.cn/hotelReservation/image/10.png" mode="aspectFill" />
- <img v-if="index === 10" src="https://chtech.ncjti.edu.cn/hotelReservation/image/11.png" mode="aspectFill" />
- <img v-if="index === 11" src="https://chtech.ncjti.edu.cn/hotelReservation/image/12.png" mode="aspectFill" />
- <view class="box_town">{{ item.name }}</view>
- <view class="box_count">剩{{ item.residueNumber }}间</view>
- </view>
- </view>
- </view>
- </uni-popup>
- <!-- 公告弹窗区域 -->
- <uv-popup ref="popup_sale" mode="center" :closeOnClickOverlay="false" bgColor="none">
- <view class="popupClass">
- <img src="../../static/index/popup_bg.png" />
- <!-- 立即前往区域 -->
- <!-- <view class="btn_go" @click="handleGo"></view> -->
- <view class="btn_text">系统处于迭代试用状态,请勿下单预订酒店,如需预订请电联店家老板确认预订渠道。</view>
- <!-- 关闭按钮区域 -->
- <view class="btn_close" @click="handleClose"></view>
- </view>
- </uv-popup>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- // 用户定位经度
- myLng: 0,
- // 用户定位纬度
- myLat: 0,
- // 是否显示距离差
- showdDistance: false,
- // 搜索框绑定数据
- keywords: '',
- // 当前页
- page: 1,
- // 每页多少条
- rows: 6,
- // 总条数
- total: null,
- // 地区数组
- placeList: [
- {
- name: '靖安县'
- }
- ],
- // 当前选择地区索引
- placeIndex: 0,
- // 选择乡镇弹窗数据
- popList: [],
- // 民宿列表数组
- hotelList: [],
- // 当前乡镇
- town: '',
- // 民宿级别
- level: '',
- // 乡镇列表
- townList: [],
- // 顶部导航栏显示隐藏控制
- headerType: false,
- // 状态栏高度
- statusBarH: 0,
- // 胶囊按钮栏高度
- customBarH: 0,
- // 招商资讯列表
- newsList: [],
- // 精选攻略数据
- bestNewsInfo: null,
- // 招商资讯轮播图指示点样式
- dotsStyles: {
- backgroundColor: '#BBD8FE',
- selectedBackgroundColor: '#1E7DFB',
- border: 'none',
- selectedBorder: 'none'
- },
- current: 0,
- goodsList: [
- {
- id: 1,
- imgUrl: 'https://img0.baidu.com/it/u=598641720,3978772869&fm=253&fmt=auto&app=138&f=JPEG?w=600&h=447',
- name: '靖安白茶',
- price: 180
- },
- {
- id: 2,
- imgUrl: 'https://img0.baidu.com/it/u=598641720,3978772869&fm=253&fmt=auto&app=138&f=JPEG?w=600&h=447',
- name: '靖安白茶',
- price: 180
- },
- {
- id: 3,
- imgUrl: 'https://img0.baidu.com/it/u=598641720,3978772869&fm=253&fmt=auto&app=138&f=JPEG?w=600&h=447',
- name: '靖安白茶',
- price: 180
- },
- {
- id: 4,
- imgUrl: 'https://img0.baidu.com/it/u=598641720,3978772869&fm=253&fmt=auto&app=138&f=JPEG?w=600&h=447',
- name: '靖安白茶',
- price: 180
- }
- ]
- }
- },
- created() {
- // 获取系统信息
- uni.getSystemInfo({
- success: (e) => {
- // 获取状态栏高度
- this.statusBarH = e.statusBarHeight + 10
- // // 获取菜单按钮栏高度
- let custom = uni.getMenuButtonBoundingClientRect()
- this.customBarH = custom.height + 10
- }
- })
- },
- mounted() {
- // 开启转发功能
- uni.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline']
- })
- },
- onReachBottom() {
- if (this.hotelList.length < this.total) {
- this.page++
- this.getHotelList()
- } else {
- uni.showToast({
- title: '没有更多数据了',
- icon: 'none'
- })
- }
- },
- onPageScroll(e) {
- if (e.scrollTop > 100) {
- this.headerType = true
- } else {
- this.headerType = false
- }
- },
- onPullDownRefresh() {
- this.hotelList = []
- this.page = 1
- this.getLocation()
- this.getResidueCount()
- setTimeout(() => {
- uni.stopPullDownRefresh()
- }, 1000)
- },
- onLoad() {
- // 获取乡镇列表
- this.getResidueCount()
- // 获取精选攻略
- this.getBestNews()
- // 获取招商资讯列表
- this.getNews()
- // 获取定位
- this.getLocation()
- },
- methods: {
- async getBestNews() {
- const res = await this.$myRequest({
- url: '/mhotel/articlequeryMaxArticleLike.action'
- })
- // console.log(res)
- if (res.code == 200) {
- this.bestNewsInfo = res.data
- }
- },
- async getNews() {
- const res = await this.$myRequest({
- url: '/mhotel/appnewlist.action',
- data: {
- page: 1,
- rows: 3
- }
- })
- // console.log(res)
- if (res.code === 200) {
- this.newsList = res.rows
- this.newsList.forEach((ele) => {
- this.$set(ele, 'showHtml', true)
- })
- }
- },
- // 获取用户当前位置
- getLocation() {
- uni.getSetting({
- success: (res) => {
- if (!res.authSetting['scope.userLocation']) {
- uni.authorize({
- scope: 'scope.userLocation',
- success: (res) => {
- // 授权成功
- uni.getLocation({
- type: 'gcj02',
- success: (res) => {
- this.myLat = res.latitude
- this.myLng = res.longitude
- this.showdDistance = true
- this.getHotelList()
- }
- })
- },
- fail: () => {
- uni.showModal({
- content: '获取定位权限失败将会影响使用部分功能,是否去设置打开?',
- confirmText: '确认',
- cancelText: '取消',
- success: (res) => {
- if (res.confirm) {
- uni.openSetting({
- success: (res) => {
- console.log(res)
- this.getLocation()
- }
- })
- } else {
- this.showdDistance = false
- this.getHotelList()
- uni.showToast({
- title: '获取定位权限失败',
- icon: 'none'
- })
- }
- }
- })
- }
- })
- } else {
- uni.getLocation({
- type: 'gcj02',
- success: (res) => {
- this.myLat = res.latitude
- this.myLng = res.longitude
- this.showdDistance = true
- this.getHotelList()
- }
- })
- }
- },
- fail: () => {
- uni.showToast({
- title: '获取用户设置权限失败',
- icon: 'none',
- mask: true
- })
- }
- })
- },
- handleGoDetail(info) {
- let openid = uni.getStorageSync('openid')
- if (openid) {
- uni.navigateTo({
- url: `/pages/tweetDetail/tweetDetail?id=${info.id}&townId=${info.townId}`
- })
- } else {
- uni.showToast({
- title: '请先登录',
- icon: 'none',
- mask: true
- })
- setTimeout(() => {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }, 1500)
- }
- },
- // 获取民宿列表
- async getHotelList() {
- const res = await this.$myRequest({
- url: '/mhotel/ahphomePage.action',
- data: {
- // queryValue: this.keywords,
- page: this.page,
- rows: this.rows,
- type: 3,
- // hotel_township: this.placeList[this.placeIndex].id || '',
- userId: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo').id : ''
- }
- })
- // console.log(res)
- if (res.code === 200) {
- this.hotelList = [...this.hotelList, ...res.data.pageList]
- this.total = res.data.total
- // 如果定位成功则获取和民宿之间的距离
- if (this.showdDistance && this.hotelList.length) {
- this.hotelList.forEach((ele) => {
- let lat = ele.hpositionWens.split(',')[0]
- let lng = ele.hpositionWens.split(',')[1]
- ele.distance = this.calculateDistance(lat, lng)
- })
- }
- this.$refs.popup_sale.open()
- }
- },
- handleOpen() {
- this.$refs.popup.open()
- },
- // 获取乡镇
- async getResidueCount() {
- const res = await this.$myRequest({
- url: '/mhotel/ahpgetResidueCount.action'
- })
- // console.log(res)
- if (res.code === 200) {
- let temNum = 0
- res.data.forEach((ele) => {
- temNum += ele.residueNumber
- })
- res.data.unshift({
- name: '靖安县',
- residueNumber: temNum
- })
- this.popList = res.data
- this.townList = this.changeList(this.popList, 3)
- }
- },
- // 变成二维数组
- changeList(arr, num) {
- let newArr = []
- const total = Math.ceil(arr.length / num)
- for (let i = 0; i < total; i++) {
- let a = arr.slice(i * num, (i + 1) * num)
- newArr.push(a)
- }
- return newArr
- },
- // 弹窗点击选择乡镇地址回调
- handleChooseTown(name) {
- this.town = name
- this.$refs.popup.close()
- },
- handleChooseTown2(name) {
- // this.town = name
- uni.navigateTo({
- url: `/pages/home/home?town=${name}&keywords=${this.keywords}&level=${this.level}`
- })
- },
- handleChooseLv() {
- uni.showActionSheet({
- itemList: ['白金', '金宿', '银宿'],
- success: (res) => {
- if (res.tapIndex === 0) {
- this.level = '白金'
- } else if (res.tapIndex === 1) {
- this.level = '金宿'
- } else if (res.tapIndex === 2) {
- this.level = '银宿'
- }
- }
- })
- },
- handleSearch() {
- uni.navigateTo({
- url: `/pages/home/home?town=${this.town}&keywords=${this.keywords}&level=${this.level}`
- })
- },
- goPageDetail(item) {
- uni.navigateTo({
- url: `/pages/detail/detail?id=${item.id}&distance=${item.distance}`
- })
- },
- // 弹窗关闭按钮回调
- handleClose() {
- this.$refs.popup_sale.close()
- },
- // 立即前往按钮回调
- handleGo() {
- console.log(111)
- },
- // 计算两个点之间的距离
- calculateDistance(lat, lng) {
- let centerLat = lat
- let centerLng = lng
- let red1 = (this.myLat * Math.PI) / 180.0
- let red2 = (centerLat * Math.PI) / 180.0
- let a = red1 - red2
- let b = (this.myLng * Math.PI) / 180.0 - (centerLng * Math.PI) / 180.0
- let R = 6378137
- let distance = R * 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(red1) * Math.cos(red2) * Math.pow(Math.sin(b / 2), 2)))
- let res = (distance / 1000).toFixed(2) * 1
- return res
- },
- handleGoPage() {
- uni.switchTab({
- url: '/pages/community/community'
- })
- },
- handleGoNews(item) {
- let info = encodeURIComponent(JSON.stringify(item))
- uni.navigateTo({
- url: `/pages/newsDetail/newsDetail?info=${info}`
- })
- },
- handleGoNewsList() {
- uni.navigateTo({
- url: '/pages/newsList/newsList'
- })
- },
- htmlLoad(item) {
- let id = item.id + 'html'
- let ctx = this.$refs[id][0]
- let text = ctx.getText()
- let imgs = ctx.imgList[0]
- item.showHtml = false
- item.desc = text
- item.url = imgs
- },
- handleGoHome() {
- uni.navigateTo({
- url: '/pages/home/home'
- })
- },
- changeDot(e) {
- this.current = e.detail.current
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- display: flex;
- flex-direction: column;
- min-height: 100vh;
- overflow-y: auto;
- background-color: #f2f2f2;
- .header {
- position: relative;
- height: 505rpx;
- img {
- width: 100%;
- height: 100%;
- border-radius: 0 0 20rpx 20rpx;
- }
- .img {
- position: absolute;
- top: 135rpx;
- left: 61rpx;
- width: 160rpx;
- height: 40rpx;
- }
- .img2 {
- position: absolute;
- top: 193rpx;
- left: 38rpx;
- width: 268rpx;
- height: 88rpx;
- }
- .header_msg {
- position: absolute;
- top: 283rpx;
- left: 38rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 291rpx;
- height: 65rpx;
- font-size: 31rpx;
- color: #fff;
- border-radius: 16rpx;
- background: rgba(255, 255, 255, 0.2);
- }
- }
- .header2 {
- z-index: 999;
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- text-align: center;
- background-color: #fff;
- .title {
- font-size: 34rpx;
- }
- }
- .content {
- z-index: 1;
- margin: -102rpx auto 0;
- width: 690rpx;
- border-radius: 12rpx 12rpx 0 0;
- background-color: #f2f2f2;
- .search {
- box-sizing: border-box;
- padding: 0 28rpx;
- width: 690rpx;
- height: 353rpx;
- border-radius: 12rpx;
- background-color: #fff;
- .search_town {
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 89rpx;
- color: #a6a6a6;
- font-size: 32rpx;
- border-bottom: 1rpx solid #e6e6e6;
- img {
- width: 40rpx;
- height: 40rpx;
- }
- }
- .active {
- font-weight: bold;
- color: #000;
- }
- .search_center {
- display: flex;
- align-items: center;
- height: 89rpx;
- color: #a6a6a6;
- font-size: 28rpx;
- img {
- width: 40rpx;
- height: 40rpx;
- }
- .center_input {
- margin-right: 12rpx;
- width: 250rpx;
- color: #000;
- font-weight: bold;
- }
- .img {
- margin-right: 12rpx;
- }
- .center_level {
- flex: 1;
- margin-left: 24rpx;
- font-weight: 400;
- }
- .active {
- font-weight: bold;
- color: #000;
- }
- .img2 {
- margin-left: auto;
- }
- }
- .search_btn {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-top: 23rpx;
- width: 623rpx;
- height: 100rpx;
- border-radius: 57rpx;
- color: #fff;
- font-size: 32rpx;
- background: linear-gradient(90deg, #2697ef 0%, #5e35eb 100%);
- }
- }
- .swiper {
- margin: 20rpx auto 0;
- width: 690rpx;
- height: 214rpx;
- border-radius: 12rpx;
- background-color: #fff;
- .swiper_item {
- display: flex;
- justify-content: space-around;
- align-items: center;
- width: 100%;
- height: 100%;
- .item_box {
- position: relative;
- width: 195rpx;
- height: 128rpx;
- border-radius: 12rpx;
- color: #fff;
- img {
- width: 195rpx;
- height: 128rpx;
- border-radius: 12rpx;
- }
- .box_town {
- position: absolute;
- top: 30rpx;
- left: 0;
- right: 0;
- text-align: center;
- font-size: 28rpx;
- font-weight: bold;
- }
- .box_count {
- position: absolute;
- top: 75rpx;
- left: 0;
- right: 0;
- text-align: center;
- font-size: 18rpx;
- }
- }
- }
- }
- .body {
- margin: 0 auto;
- width: 690rpx;
- .body_top {
- display: flex;
- align-items: center;
- height: 89rpx;
- .circle {
- width: 30rpx;
- height: 30rpx;
- border-radius: 50%;
- background-color: #485bed;
- }
- .color {
- margin-left: -15rpx;
- opacity: 0.5;
- background-color: #fff;
- }
- .top_title {
- margin-left: 15rpx;
- font-size: 32rpx;
- font-weight: bold;
- }
- .top_msg {
- margin-top: 5rpx;
- margin-left: 12rpx;
- color: #666666;
- font-size: 24rpx;
- }
- .top_more {
- display: flex;
- align-items: center;
- margin-left: auto;
- color: #a6a6a6;
- font-size: 24rpx;
- img {
- width: 32rpx;
- height: 32rpx;
- }
- }
- }
- .body_strategy {
- display: flex;
- box-sizing: border-box;
- padding: 20rpx;
- margin-bottom: 10rpx;
- width: 690rpx;
- height: 235rpx;
- border-radius: 12rpx;
- background-color: #fff;
- .strategy_cover {
- width: 253rpx;
- height: 190rpx;
- border-radius: 7rpx;
- }
- .strategy_info {
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- margin-left: 20rpx;
- width: 500rpx;
- height: 170rpx;
- font-size: 24rpx;
- color: #666666;
- overflow: hidden;
- .info_title {
- font-size: 32rpx;
- font-weight: bold;
- color: #000;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .info_title2 {
- font-size: 32rpx;
- font-weight: bold;
- color: #000;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- }
- .info_tags {
- display: flex;
- .tag {
- margin-right: 10rpx;
- box-sizing: border-box;
- padding: 0 12rpx;
- height: 35rpx;
- color: #1e7dfb;
- font-size: 20rpx;
- border-radius: 30rpx;
- border: 1rpx solid #1e7dfb;
- }
- }
- .info_desc {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- }
- }
- }
- .body_list {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .list_item {
- width: 335rpx;
- box-sizing: border-box;
- margin-bottom: 20rpx;
- .item-img {
- width: 100%;
- height: 223rpx;
- border-radius: 18rpx 18rpx 0 0;
- box-sizing: border-box;
- }
- .descrition {
- display: flex;
- flex-direction: column;
- width: 100%;
- border-radius: 0 0 18rpx 18rpx;
- box-sizing: border-box;
- background: rgba(255, 255, 255, 1);
- margin-top: -10rpx;
- .title {
- font-size: 28rpx;
- font-weight: 600;
- padding: 20rpx 20rpx 10rpx;
- color: rgba(0, 0, 0, 1);
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .type {
- padding: 5rpx 20rpx;
- height: 40rpx;
- font-size: 24rpx;
- color: #a6a6a6;
- }
- .distance {
- padding: 10rpx 20rpx;
- font-size: 24rpx;
- color: #a6a6a6;
- }
- .detail {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- padding: 0 20rpx 20rpx 20rpx;
- color: rgba(0, 0, 0, 1);
- .img {
- width: 40rpx;
- height: 40rpx;
- }
- .price {
- .txt1 {
- font-size: 36rpx;
- font-weight: 600;
- color: rgba(255, 87, 51, 1);
- }
- .txt2 {
- font-size: 24rpx;
- font-weight: 400;
- color: #a6a6a6;
- }
- }
- .score {
- font-size: 24rpx;
- font-weight: 400;
- padding-top: 10rpx;
- color: rgba(166, 166, 166, 1);
- }
- }
- }
- }
- .item_goods {
- margin-bottom: 20rpx;
- width: 335rpx;
- height: 367rpx;
- border-radius: 10rpx;
- background-color: #fff;
- overflow: hidden;
- .goods_img {
- width: 335rpx;
- height: 223rpx;
- }
- .goods_name {
- margin: 18rpx 0 18rpx 30rpx;
- font-size: 28rpx;
- font-weight: bold;
- }
- .goods_detail {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- padding: 0 20rpx 20rpx 20rpx;
- color: rgba(0, 0, 0, 1);
- .img {
- width: 40rpx;
- height: 40rpx;
- }
- .price {
- .txt1 {
- font-size: 36rpx;
- font-weight: 600;
- color: rgba(255, 87, 51, 1);
- }
- .txt2 {
- font-size: 24rpx;
- font-weight: 400;
- color: #a6a6a6;
- }
- }
- .score {
- font-size: 24rpx;
- font-weight: 400;
- padding-top: 10rpx;
- color: rgba(166, 166, 166, 1);
- }
- }
- }
- }
- .body_news {
- box-sizing: border-box;
- padding: 25rpx;
- width: 690rpx;
- height: 566rpx;
- border-radius: 12rpx;
- background-color: #fff;
- .news_title {
- margin: 20rpx 0;
- font-size: 32rpx;
- font-weight: bold;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .news_desc {
- font-size: 24rpx;
- color: #666666;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- }
- }
- .noData {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding-bottom: 65rpx;
- img {
- margin-top: 80rpx;
- width: 600rpx;
- height: 600rpx;
- }
- }
- }
- }
- .popup_body {
- width: 618rpx;
- height: 687rpx;
- border-radius: 21rpx;
- background-color: #fff;
- .body_header {
- display: flex;
- justify-content: center;
- align-items: center;
- position: relative;
- height: 113rpx;
- border-bottom: 1rpx solid #e6e6e6;
- img {
- width: 16rpx;
- height: 16rpx;
- }
- .header_title {
- margin: 0 10rpx;
- font-size: 34rpx;
- font-weight: bold;
- color: #0f194d;
- }
- }
- .body_content {
- display: grid;
- grid-template-columns: repeat(auto-fill, 160rpx);
- gap: 28rpx;
- box-sizing: border-box;
- padding: 26rpx 40rpx 50rpx;
- .content_box {
- position: relative;
- width: 160rpx;
- height: 105rpx;
- color: #fff;
- border-radius: 10rpx;
- img {
- width: 160rpx;
- height: 105rpx;
- border-radius: 10rpx;
- }
- .box_town {
- position: absolute;
- top: 20rpx;
- left: 0;
- right: 0;
- text-align: center;
- font-size: 28rpx;
- font-weight: bold;
- }
- .box_count {
- position: absolute;
- top: 62rpx;
- left: 0;
- right: 0;
- text-align: center;
- font-size: 18rpx;
- }
- }
- }
- }
- .popupClass {
- position: relative;
- width: 481rpx;
- height: 764rpx;
- img {
- width: 100%;
- height: 665rpx;
- }
- .btn_go {
- position: absolute;
- top: 415rpx;
- left: 40rpx;
- width: 396rpx;
- height: 76rpx;
- border-radius: 43rpx;
- }
- .btn_text {
- position: absolute;
- top: 265rpx;
- left: 40rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 400rpx;
- height: 260rpx;
- color: #0f194d;
- font-size: 28rpx;
- border-radius: 43rpx;
- background-color: #fff;
- }
- .btn_close {
- position: absolute;
- top: 586rpx;
- left: 212rpx;
- width: 58rpx;
- height: 58rpx;
- border-radius: 50%;
- }
- }
- }
- </style>
|