Commit 7ab1362f authored by liwei's avatar liwei

修改了排行榜页面

parent a8b82e47
......@@ -23,9 +23,7 @@
"navigationStyle": "custom",
"backgroundColor": "#F4F5F9",
"backgroundColorTop": "#F4F5F9",
"backgroundColorBottom": "#F4F5F9",
"enablePullDownRefresh": false,
"onReachBottomDistance": 50
"backgroundColorBottom": "#F4F5F9"
}
},
{
......@@ -35,10 +33,7 @@
"navigationStyle": "custom",
"backgroundColor": "#F4F5F9",
"backgroundColorTop": "#F4F5F9",
"backgroundColorBottom": "#F4F5F9",
"enablePullDownRefresh": false,
"onReachBottomDistance": 50,
"disableScroll": true
"backgroundColorBottom": "#F4F5F9"
}
},
{
......@@ -48,10 +43,7 @@
"navigationStyle": "custom",
"backgroundColor": "#F4F5F9",
"backgroundColorTop": "#F4F5F9",
"backgroundColorBottom": "#F4F5F9",
"enablePullDownRefresh": false,
"onReachBottomDistance": 50,
"disableScroll": true
"backgroundColorBottom": "#F4F5F9"
}
},
{
......
......@@ -5,23 +5,22 @@
<!-- 轮播图 后面放banner里的图-->
<view class="box">
<view class="swiper">
<ls-swiper :list="userData.imgList" imgKey="" :loop="true" :dots="true" :autoplay="true"
:height="200" />
<ls-swiper :list="bannerList" imgKey="" :loop="true" :dots="true" :autoplay="true" :height="200" />
</view>
</view>
<!-- 活动列表-->
<view class="card" v-for="(item,index) in businessList" :key="index" @click="gotodetail(item)">
<view class="card" v-for="(item,index) in activityList" :key="index" @click="gotodetail(item)">
<view class="contentBody">
<view class="leftlist">
<image src="/static/images/home/gonggao.png" class="leftlistimage"/>
</view>
<view class="rightlist">
<view class="rightlist-title">{{item.name}}</view>
<view class="rightlist-title">{{item.title}}</view>
<view class="rightlist-time">
<view class="timeicon">
<u-icon name="clock" color="#666666;" size="15"></u-icon>
</view>
<view class="timetext">{{item.createTime}}</view>
<view class="timetext">{{item.publishDate}}</view>
</view>
<view class="rightlist-address">
<view class="addressicon">
......@@ -36,21 +35,29 @@
<view class="bussiness-nomore">~ 没有更多啦 ~</view>
</view>
<!-- <login @change="getUserInfo" :isLoginPop="isLoginPop" class="my-select"></login>-->
</view>
</view>
</template>
<script>
let util = require('@/util/means.js');
import LsSwiper from '../../components/ls-swiper/index.vue';
import {bannerList} from '../../api/banner/index'
import {activityList} from '../../api/activity/index'
export default {
components: {
LsSwiper
},
data() {
return {
businessList: [
//分页查询参数
queryParam:{
page:1,
rows:10
},
//banner轮播图
bannerList:[],
//活动列表
activityList: [
{
name:'测试1',
createTime:'2024-10-12',
......@@ -96,33 +103,17 @@ export default {
createTime:'2024-10-12',
address:'天津'
}
] ,// 商家列表
notice:'这里是公告这里是公告这里是公告这里是公告这里是公告这里是公告这里是公告这里是公告',
showBtn: true,
],
showArrowDown: true,
showTabbar: true,
scrollTop: 0,
isLoginPop: false,
userData: {
userArticleViewResponse: {
articleContent: null,
articleImg: []
}
},
data: [],
count: 0,
};
},
onHide() {
},
onShow() {
this.getRecUserInfo();
this.getBannerList()
this.getActivityList()
},
onPageScroll(e) {
if (!this.isInit) {
return;
}
const _this = this;
if (e.scrollTop <= 0) {
this.showArrowDown = true;
......@@ -159,156 +150,31 @@ export default {
_this.flag = true;
},
methods: {
// 页面跳转
gotopage(url) {
uni.reLaunch({
url: url
});
},
//热门推荐 跳转
gotodetail(item){
uni.navigateTo({
url: '/pages2/business/business/id='+item.businessId
})
},
async getUnRead() {
const res = await this.$myRequest({
url: `/message/un/read`,
withToken: true,
method: 'GET'
});
this.count = res.data.data
uni.setTabBarBadge({ //显示数字
index: 1, //tabbar下标
text: `${res.data.data}` //数字
})
},
getUserInfo(e) {
if (e == 0) {
this.isLoginPop = false;
return;
//获取公告列表
getBannerList() {
const query = {
page:this.queryParam.page,
rows:this.queryParam.rows
}
// #ifdef MP-WEIXIN
try {
wx.getUserProfile({
desc: '用于完善会员资料',
success: resinfo => {
wx.login({
success: res => {
if (res.code) {
console.log(res.code, resinfo);
this.setCode(res.code, resinfo);
} else {}
},
fail: err => {
}
});
},
fail: errinfo => {
this.setCode(this.generateRandomString(10), 'null');
}
});
} catch {
wx.getUserInfo({
success: resinfo => {
wx.login({
success: res => {
if (res.code) {
console.log(res.code, resinfo);
this.setCode(res.code, resinfo);
} else {}
},
fail: err => {}
});
},
fail: errinfo => {}
});
}
// #endif
// #ifndef MP-WEIXIN
this.setCode("ip", 'null');
// #endif
bannerList(query).then(res =>{
//将res.data.rows集合里的bannerPicture取出来,放到集合中
this.bannerList = res.data.rows.map(item => item.bannerPicture)
}).catch(e => {
console.log(e)
})
},
getRecUserInfo() {
console.log("开始获取用户信息")
// 获取推荐用户信息
let age = 20;
if (this.age) {
age = util.mymethod(uni.getStorageSync('itemobj').birthday);
//获取活动列表
getActivityList() {
const query = {
page:this.queryParam.page,
rows:this.queryParam.rows
}
let loginType;
uni.getStorageSync('token') ? (loginType = true) : (loginType = false);
this.$myRequest({
url: 'nostalgia/fruser/recommendUserInfo',
withToken: loginType,
data: {
age,
gender: this.gender == undefined ? "FEMALE" : this.gender
},
method: 'GET'
}).then(res => {
console.log("获取用户信息完成")
if (res.data.code == 200) {
if (res.data.data == null) {
this.showArrowDown = false;
this.isInit = false;
// this.data = [];
this.userData = {};
this.nextData = {};
uni.setTabBarBadge({
index: 0,
text: '0'
});
} else {
this.showArrowDown = true;
this.isInit = true;
this.userData = res.data.data;
if(this.userData.userArticleViewResponse.articleImg.length>3){
this.userData.userArticleViewResponse.articleImg = this.userData.userArticleViewResponse.articleImg.splice(0,3)
}
uni.setTabBarBadge({
index: 0,
text: `${res.data.data.surplusNum}`
});
this.showBtn = true;
console.log(
`console.log("获取用户信息完成") 用户id${res.data.data.id}****剩余次数${res.data.data.surplusNum}`
);
}
} else {
this.$refs.elm.showDialog();
}
activityList(query).then(res =>{
this.activityList = res.data.rows
}).catch(e => {
console.log(e)
})
},
generateRandomString(length) {
let result = uni.getStorageSync('touristopenid');
if (result != null&&result!="") {
return result;
}else{
result='';
}
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; // 包含大小写字母和数字的所有字符集合
for (let i = 0; i < length; i++) {
const randomIndex = Math.floor(Math.random() * characters.length);
result += characters[randomIndex];
}
var now = new Date();
var year = now.getFullYear(); // 年份
var month = (now.getMonth() + 1).toString().padStart(2, '0'); // 月份(注意要加上1)
var day = now.getDate().toString().padStart(2, '0'); // 天数
var hours = now.getHours().toString().padStart(2, '0'); // 小时
var minutes = now.getMinutes().toString().padStart(2, '0'); // 分钟
var seconds = now.getSeconds().toString().padStart(2, '0'); // 秒数
result = "touristopenid" + result + (+year + month + day + hours + minutes + seconds);
uni.setStorageSync('touristopenid', result);
return result;
}
},
};
</script>
......@@ -409,6 +275,13 @@ page {
font-weight: 500;
color: #222222;
margin-bottom: 12rpx;
/* 超出两行省略 */
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; /* 控制行数 */
}
.rightlist-message {
......
......@@ -139,24 +139,15 @@
</view>
</view>
</view>
<ELM ref="elm" :msg="tipMsg" :isConfirm="isConfirm" @confirm="confirma"></ELM>
</view>
</template>
<script>
let util = require('@/util/means.js');
import ELM from '@/components/elm-toast/index.vue';
import LsSwiper from '../../components/ls-swiper/index.vue';
import login from '../../components/login/login.vue';
import {
WS
} from '@/util/wsConfig.js'
import {noticeList} from '../../api/notice/index'
import {bannerList} from '../../api/banner/index'
export default {
components: {
ELM,
login,
LsSwiper
},
data() {
......@@ -226,7 +217,7 @@
},
//TODO 接口会调两次
onLoad() {
onShow() {
this.getNoticeList()
this.getBannerList()
this.showAnima = false;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment