|
@@ -9,7 +9,6 @@ Page({
|
|
*/
|
|
*/
|
|
data: {
|
|
data: {
|
|
bannerList:[], //轮播图列表
|
|
bannerList:[], //轮播图列表
|
|
- newNoticeTitle:'', //滚动显示的公告标题
|
|
|
|
naxiImgUrl:'', //纳溪介绍的图片
|
|
naxiImgUrl:'', //纳溪介绍的图片
|
|
macunImgUrl:'', //马村介绍的图片
|
|
macunImgUrl:'', //马村介绍的图片
|
|
hotScenicList:[], //热门景点列表
|
|
hotScenicList:[], //热门景点列表
|
|
@@ -30,51 +29,6 @@ Page({
|
|
this.setData({
|
|
this.setData({
|
|
bannerList:banners
|
|
bannerList:banners
|
|
})
|
|
})
|
|
-
|
|
|
|
- //获取公告列表
|
|
|
|
- let result = await request('/front/notificationFront')
|
|
|
|
- // console.log(result);
|
|
|
|
- // 对公告列表按id降序排序(即按发布时间由近到远排序)
|
|
|
|
- if(result.length == 0){ //如果公告列表长度为0,则显示无公告
|
|
|
|
- this.setData({
|
|
|
|
- newNoticeTitle:'暂无公告内容'
|
|
|
|
- })
|
|
|
|
- }else if(result.length == 1 && result[0].status == 1){ //如果有一条公告,且状态为1,则展示标题
|
|
|
|
- this.setData({
|
|
|
|
- newNoticeTitle:result[0].title
|
|
|
|
- })
|
|
|
|
- }else if(result.length == 1 && result[0].status == 0){ //如果有一条公告,且状态为0,则展示无公告
|
|
|
|
- this.setData({
|
|
|
|
- newNoticeTitle:'暂无公告内容'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- else{ //超过2条公告时,根据公告id进行降序排序(即根据时间由近到远排序)
|
|
|
|
- for(let i = 0;i < result.length-1;i++){
|
|
|
|
- for(let j = 0;j < result.length-1-i;j++){
|
|
|
|
- if(result[j].id < result[j+1].id){
|
|
|
|
- let temp = result[j]
|
|
|
|
- result[j] = result[j+1]
|
|
|
|
- result[j+1] = temp
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // console.log(result);
|
|
|
|
- // 遍历重新排序后的列表,取出第一个状态为1的标题,即为最新发布的公告
|
|
|
|
- for(let i = 0;i < result.length;i++){
|
|
|
|
- if(result[i].status == 1){
|
|
|
|
- this.setData({
|
|
|
|
- newNoticeTitle:result[0].title
|
|
|
|
- })
|
|
|
|
- break;
|
|
|
|
- }else{//如果状态都为0,则展示无公告
|
|
|
|
- console.log();
|
|
|
|
- this.setData({
|
|
|
|
- newNoticeTitle:'暂无公告内容'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
//获取纳溪照片(默认取第一张)
|
|
//获取纳溪照片(默认取第一张)
|
|
let naxiImg = await request('/front/introduce/files/1')
|
|
let naxiImg = await request('/front/introduce/files/1')
|
|
@@ -90,23 +44,10 @@ Page({
|
|
macunImgUrl:macunImg[0].iconPath
|
|
macunImgUrl:macunImg[0].iconPath
|
|
})
|
|
})
|
|
|
|
|
|
- //获取景点列表和照片
|
|
|
|
|
|
+ //获取景点列表
|
|
let sceneryImgList = await request('/front/scenicSpotAndCallout')
|
|
let sceneryImgList = await request('/front/scenicSpotAndCallout')
|
|
// console.log(sceneryImgList);
|
|
// console.log(sceneryImgList);
|
|
- let imagePath = [] //景点照片列表
|
|
|
|
- let imageList = [] //景点照片列表
|
|
|
|
- // console.log(sceneryImgList);
|
|
|
|
- for(let i = 0;i < sceneryImgList.length;i++){
|
|
|
|
- let id = sceneryImgList[i].id
|
|
|
|
- // console.log(id);
|
|
|
|
- imagePath = await request('/front/findAllScenicSpotFilesPath/'+id)
|
|
|
|
- // console.log(imagePath);
|
|
|
|
- imageList[i] = imagePath
|
|
|
|
- // console.log(imageList);
|
|
|
|
- // 将景点照片添加到景点列表
|
|
|
|
- Object.assign(sceneryImgList[i],imagePath)
|
|
|
|
- // console.log(sceneryImgList);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
// 按景点热度降序重新排列
|
|
// 按景点热度降序重新排列
|
|
for(let i = 0;i < sceneryImgList.length - 1;i++){
|
|
for(let i = 0;i < sceneryImgList.length - 1;i++){
|
|
for(let j = 0;j < sceneryImgList.length - 1 - i;j++){
|
|
for(let j = 0;j < sceneryImgList.length - 1 - i;j++){
|
|
@@ -140,18 +81,7 @@ Page({
|
|
|
|
|
|
//获取商户信息
|
|
//获取商户信息
|
|
let foodList = await request('/front/merchantAndCallout')
|
|
let foodList = await request('/front/merchantAndCallout')
|
|
- // console.log(foodList);
|
|
|
|
- let foodImagePath = []
|
|
|
|
- for(let i = 0;i < foodList.length;i++){
|
|
|
|
- let id = foodList[i].id
|
|
|
|
- foodImagePath = await request('/front/findAllMerchantFilesPath/'+id)
|
|
|
|
- // console.log(foodImagePath);
|
|
|
|
- // 将图片地址添加到商户列表对应的店铺内
|
|
|
|
- // Object.assign(foodList[i],imagePath)
|
|
|
|
- foodList[i].iconPath = foodImagePath
|
|
|
|
- // console.log(result);
|
|
|
|
- }
|
|
|
|
- // console.log(foodList);
|
|
|
|
|
|
+ console.log(foodList);
|
|
|
|
|
|
// 按商户热度进行降序重新排列
|
|
// 按商户热度进行降序重新排列
|
|
for(let i = 0;i < foodList.length - 1;i++){
|
|
for(let i = 0;i < foodList.length - 1;i++){
|
|
@@ -174,7 +104,7 @@ Page({
|
|
this.setData({
|
|
this.setData({
|
|
hotFoodList
|
|
hotFoodList
|
|
})
|
|
})
|
|
- // console.log(this.data.hotFoodList);
|
|
|
|
|
|
+ console.log(this.data.hotFoodList);
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|