ufutx_love_mp/src/pages/tabBar/home.wpy

927 lines
29 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<style lang="less" scoped>
@import url(../../styles/theme.less);
page {
background-color: #ffffff;
}
.ui-home{
padding-bottom: 45rpx;
}
.ui-swiper-box{
margin:32rpx 32rpx 0;
height: 200rpx;
border-radius:32rpx!important;
overflow: hidden;
}
.ui-swiper-list{
width: 100%;
overflow: hidden;
height: 200rpx;
border-radius:32rpx;
}
.ui-top-up{
width: 174rpx;
height: 36rpx;
display: block;
}
.ui-top-box{
display: flex;
overflow-x: auto;
margin-left: 6rpx;
.ui-top-bg{
flex-shrink: 0;
margin-right: -20rpx;
width: 248rpx;
height: 328rpx;
background-image: url("https://image.fulllinkai.com/202409/24/420219e731c8a9cd64cf115f42192180.png");
background-position: center;
background-size: cover;
background-repeat: no-repeat;
.ui-top-user-pic{
width: 132rpx;
height: 132rpx;
display: block;
border-radius: 50%;
margin: 46rpx auto 16rpx auto;
}
.ui-top-user-nam{
width: 168rpx;
margin: 0 auto;
}
.ui-top-city{
max-width: 110rpx;
}
}
}
.ui-prefecture-title{
padding: 24rpx 0 20rpx 30rpx;
}
.ui-prefecture-box{
display: flex;
overflow-x: auto;
margin-left: 30rpx;
.ui-prefecture-item{
width: 270rpx;
height: 180rpx;
border-radius: 16rpx;
margin-right: 16rpx;
flex-shrink: 0;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
.ui-prefecture-mask{
width: 270rpx;
height: 180rpx;
border-radius: 16rpx;
background: rgba(0, 0, 0, 0.1);
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
}
}
.ui-referrals-box{
padding: 52rpx 30rpx 0 30rpx;
.ui-require-icon{
width: 220rpx;
height: 48rpx;
display: block;
margin-top: -8rpx;
}
}
.box_swiper {
transform: translateY(0);
.card-swiper{
min-height: 900rpx !important;
margin-top: -16rpx;
swiper-item{
width: 640rpx !important;
left: 60rpx;
padding: 0 12zrpx;
}
.ui-swiper-item{
left: 30rpx!important;
}
}
.card-swiper swiper-item.cur .swiper-item, .swiper-item{
transition: all .2s ease-in 0s;
min-height: 828rpx !important;
border-radius: 28rpx !important;
transform: translateY(0);
box-shadow: 4rpx 8rpx 28rpx 0 rgba(0, 0, 0, 0.06);
overflow: hidden;
backface-visibility: hidden;
}
.t_title{
width: 90%;
margin: auto;
padding: 24rpx 12rpx;
border-bottom: 2rpx solid #F8F8F8;
text-align: center;
}
.t_dot{
width: 48rpx;
height: 12rpx;
background: #FF5380;
border-radius: 9px;
margin: auto auto 12rpx auto;
}
.t_r_btn{
width: 312rpx;
height: 80rpx;
background: #FFF4F7;
border-radius: 40rpx;
color: #F33B6C;
margin: 12rpx auto;
._icon{
width: 32rpx;
height: auto;
margin-right: 12rpx;
}
}
.t_bg{
width: 100%;
height: 600rpx;
margin-top: -82rpx;
background-image: url("https://image.fulllinkai.com/202206/09/07e06b19c240c8903586a03f6d935990.png");
background-size: cover;
}
.t_btn {
width: 416rpx;
height: 72rpx;
line-height: 72rpx;
background: linear-gradient(270deg, #FEB8BD 0%, #FE8992 100%);
box-shadow: 0 4rpx 20rpx 0 rgba(254, 154, 162, 0.45);
border-radius: 36rpx;
margin: auto;
color: white;
}
.bc_img{
width: 100%;
height: 640rpx;
background-size: cover;
background-position: top;
background-image: url("https://image.fulllinkai.com/202204/01/3949b098e12738b067d665fe95e0d949.png");
border-top-left-radius: 24rpx !important;
border-top-right-radius: 24rpx !important;
transform: translateY(0);
}
.d_user_data{
padding: 0 22rpx;
.reality_icon,.real_icon,.vip_icon{
width: 80rpx;
height: auto;
margin-right: 10rpx;
}
.vip_icon{
width: 32rpx;
margin-left: 10rpx
}
.address {
.address_icon {
width: 20rpx;
height: 24rpx;
margin-right: 4rpx;
}
}
}
.lastPic{
transform: rotateY(26deg);
box-shadow: none;
}
.noneBor{
box-shadow: none;
}
.nextPic {
transform: rotateY(26deg);
}
}
.perfect_data_box{
position: relative;
display: inline-block;
vertical-align: middle;
margin-left: auto;
margin-right: auto;
width: 600rpx;
max-width: 100%;
background-color: #ffffff;
border-radius: 24rpx;
overflow: hidden;
padding: 56rpx 0 40rpx;
.cancel_icon_box{
width: 60rpx;
height: 60rpx;
position: absolute;
right: 4rpx;
top: 4rpx;
.cancel_icon{
width: 26rpx;
height: 26rpx;
margin-top: 20rpx;
}
}
.perfect_head_box{
background: #f2f2f2;
.perfect_title{
padding: 60rpx 0 16rpx 0;
font-weight: bold;
color: #333333;
}
}
.perfect_end_box{
background: #ffffff;
padding: 0 0 50rpx 0;
.triangle_icon{
width: 28rpx;
height: 16rpx;
display: block;
margin: 0 auto 20rpx auto;
}
.perfect_list_box{
margin: 30rpx 30rpx 0 30rpx;
background: #f2f2f2;
border-radius: 16rpx;
.perfect_li{
font-size: 30rpx;
color: #333333;
padding: 0 30rpx;
height: 100rpx;
line-height: 100rpx;
overflow: hidden;
}
.line{
margin: 0 30rpx;
height: 4rpx;
background: #eeeeee;
}
.perfect_button{
padding: 0 24rpx;
height: 56rpx;
line-height: 56rpx;
background: #ff5380;
color: #fff;
font-size: 26rpx;
border-radius: 30rpx;
}
.ui-active-button{
background: #c2c2c2;
}
}
}
}
.ui-refresh{
width: 30rpx;
height: 30rpx;
}
.ui-adv-box{
position: fixed;
bottom: 270rpx;
right: 8rpx;
width: 120rpx;
height: 144rpx;
color:#ffffff;
z-index: 1000;
background: url('https://images.health.ufutx.com/202502/21/5f8a2d1d65bec51b00ff04f268b93e16.png');
background-size: cover;
}
.ui-adv-message{
width: 120rpx;
height: 120rpx;
background: url('https://image.fulllinkai.com/202501/07/2294cafbfe5261dad430371f0aed9b52.png');
background-size: cover;
}
.ui-adv-close{
position: absolute;
width: 32rpx;
height: 32rpx;
bottom: -44rpx;
left: 50%;
transform: translateX(-50%);
background: url('https://image.fulllinkai.com/202501/07/3a14b8cc539285e3ba96b0977749bfc5.png');
background-size: cover;
}
.ui--message-fade{
animation: adv-message-shake 1s infinite linear;
}
@keyframes adv-message-shake {
0% {
transform:rotate(0deg);
}
25% {
transform:rotate(15deg);
}
50% {
transform:rotate(0deg);
}
75% {
transform:rotate(-15deg);
}
//100% {
// transform:rotate(0deg);
//}
}
.ui-fade-in {
opacity: 0;
animation: enter-x-left 0.4s ease-in-out 0.3s;
animation-fill-mode: forwards;
transform: translateX(120rpx);
}
.ui-fade-out {
opacity: 1;
animation: enter-x-right 0.4s ease-in-out 0.3s;
animation-fill-mode: forwards;
}
@keyframes enter-x-left {
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes enter-x-right {
to {
opacity: 0;
transform: translateX(120rpx);
}
}
.login_prompt_box {
position: fixed;
top:50%;
left: 50%;
transform: translate(-50%,-50%);
.ui-adv-modal{
width: 600rpx;
height: auto;
}
.loginCancelIcon {
width: 56rpx;
height: 56rpx;
position: absolute;
bottom:-60rpx;
left: 50%;
transform: translateX(-50%);
z-index: 99;
}
}
</style>
<template>
<!-- <scroll-view scroll-y="true" bindscroll="" class="scroll-content">-->
<view class="ui-home" v-if="pageLoading" @scroll="onPageScroll">
<cuCustom :searchName="'寻找心仪的Ta'" @tap="jumpPath('/pages/home/searchUsers')"></cuCustom>
<swiper class="ui-swiper-box" circular="true" autoplay="true" indicator-dots="true" indicator-color="#c5c5c5" indicator-active-color="#ffffff">
<block v-for="(item,index) in swiperList" :key="index">
<swiper-item class=" ui-relative ">
<image :src="item.img" class="ui-swiper-list" mode="aspectFill" @tap.stop="goToShop(item)"></image>
</swiper-item>
</block>
</swiper>
<view class="f-fbc ui-pl-30 ui-pt-40 ui-pr-30">
<view class="font_34 color333 bold">置顶推荐</view>
<image class="ui-top-up" src="https://image.fulllinkai.com/202409/24/9c5a93366fc9e24dec02ba62c87ecf15.png" mode="widthFix" @tap="applyTopUp" v-if="topUpState != 2"></image>
</view>
<view class="f-fcl ui-top-box">
<view class="ui-top-bg" v-for="(item,index) in topList" :key="index" @tap="jumpPath(`/pages/home/information?id=${item.id}`)">
<image class="ui-top-user-pic" :src="item.photo" mode="aspectFill"></image>
<view class="ui-top-user-nam ellipsis_1 font_30 bold color333 text-center">{{item.nickname}}</view>
<view class="f-fcc font_24 color666">
<view>{{item.year}}<text decode>&nbsp;·&nbsp;</text></view>
<view class="ellipsis_1 ui-top-city">{{item.city}}</view>
</view>
</view>
</view>
<view class="ui-prefecture-title font_34 color333 bold">专区推荐</view>
<view class="f-fcl ui-prefecture-box">
<view class="ui-prefecture-item ui-relative" :style="{backgroundImage:'url('+(item.pic)+');'}" v-for="(item,index) in prefectureList" :key="index" @tap="jumpPath(`/pages/home/singleSquare?id=${item.id}&title=${item.title}`)">
<view class="ui-prefecture-mask font_28 colorF bold f-fcc">{{item.title}}</view>
</view>
</view>
<block v-if="referrals && referrals.length > 1">
<view class="f-fbc ui-referrals-box">
<view class="font_34 color333 bold">为你推荐</view>
<image class="ui-require-icon" src="https://image.fulllinkai.com/202409/24/4f52d791e75a7e89a5696754f37e51f7.png" mode="widthFix" @tap="jumpPath('/pages/users/selfTextarea?text=期望对方&placeText=写下你心中理想的对象')"></image>
</view>
<view class="box_swiper">
<swiper class="card-swiper" bindchange="cardSwiper" :current="cardCur" previousMargin="-2px" nextMargin="10px">
<swiper-item v-for="(item,index) in referrals" :key="index" class="{{cardCur==index?'cur':'noneBor'}} {{cardCur==index+1?'lastPic':''}} {{cardCur==index-1?'nextPic':''}} {{cardCur == 0 ? 'ui-swiper-item' : ''}}">
<block v-if="item.type && item.type == 'time'">
<view class="swiper-item radius shadow">
<view class="t_title color999 font_26">福恋会在每天 12 点为你推荐 7 个用户</view>
<view class="text-center ui-mt-26">
<view class="t_dot"></view>
<view class="font_28 color666">下次推荐时间</view>
</view>
<view class="text-center bold font_52 ui-mt-24" style="letter-spacing: 6rpx;" v-if="countdown">
{{ countdown.h}}:{{ countdown.m}}:{{ countdown.s}}
</view>
<block v-if="countdown.d == '0' && countdown.h == '00' && countdown.m == '00' && countdown.s == '00'">
<view class="t_r_btn text-center f-fcc" @tap="refreshFn">
<image src="https://image.fulllinkai.com/202206/09/c68f69b89269c604a3671b81ff1c14a5.png" class="_icon" mode="widthFix"></image>
手动更新每日推荐
</view>
</block>
<block v-else>
<view class="t_r_btn text-center f-fcc" @tap="backFirst">
<image src="https://image.fulllinkai.com/202206/09/c68f69b89269c604a3671b81ff1c14a5.png" class="_icon" mode="widthFix"></image>
回看今日推荐
</view>
</block>
<view class="t_bg"></view>
<view class="t_btn text-center" @tap="goto_2('/pages/users/qualitySingle','other')">点击查看更多优质单身</view>
</view>
</block>
<block v-else-if="item.type && item.type == 'activity'">
<view class="swiper-item radius shadow activityCard">
<view class="bc_img" :style="{backgroundImage:'url('+(item.photo)+');'}"></view>
</view>
</block>
<block v-else>
<view class="swiper-item radius shadow" @tap="jumpPath(`/pages/home/information?id=${item.id}`)">
<view class="bc_img" :style="{backgroundImage:'url('+(item.photo)+');'}"></view>
<view class="f-fbc d_user_data ui-mt-18">
<view class="f-fbc ">
<span class="bold color333 font_32 ellipsis_1" style="max-width: 30vw;">{{ item.nickname }}{{cardCur}}</span>
<image src="https://image.fulllinkai.com/202206/10/d0913df8b234057229ab3dd102497a50.png" class="vip_icon" mode="widthFix" v-if="item.is_rank"></image>
<image src="https://image.fulllinkai.com/202206/10/bfad7e2a8e86cf7912ff280234a35606.png" class="vip_icon" mode="widthFix" v-else></image>
<image src="https://image.fulllinkai.com/202206/10/5cb84879a0dc81757dc526ebeb61bc0e.png" class="real_icon" mode="widthFix" v-if="item.is_approved == 1"></image>
<image src="https://image.fulllinkai.com/202206/10/279ade8a42810a91eb80a0717823dffa.png" class="reality_icon" mode="widthFix" v-if="item.is_real_approved == 1"></image>
</view>
<view class="address f-fbc">
<image src="https://image.fulllinkai.com/202206/07/817a393539ee854226eef79defef2fc4.png" class="address_icon" mode="aspectFit"></image>
<span class="font_24">{{ item.city }}</span>
</view>
</view>
<view class="f-fbc d_user_data ui-mt-8">
<span class="color333 font_28 ellipsis_1">
<block v-if="item.year">{{ item.year }}</block>
<block v-if="item.stature">{{ ' · ' + item.stature }}</block>
<block v-if="item.degree">{{ ' · ' +item.degree }}</block>
<block v-if="item.industry_sub">{{ ' · ' + item.industry_sub }}</block>
</span>
</view>
<view class="f-fbc d_user_data ui-mt-6">
<span class="color666 font_28 ellipsis_1" style="width: 80vw;">{{ item.introduction || '介绍:未填写' }}</span>
</view>
</view>
</block>
</swiper-item>
</swiper>
</view>
</block>
<view class="ui-prefecture-title font_34 color333 bold" v-if="squareList && squareList.length > 0">单身广场</view>
<block v-for="(item,index) in squareList" :key="index">
<view class="box_swiper ui-pl-30 ui-pr-30 ui-mb-40">
<view class="swiper-item radius shadow" @tap="jumpPath(`/pages/home/information?id=${item.id}`)">
<view class="bc_img" :style="{backgroundImage:'url('+(item.photo)+');'}"></view>
<view class="f-fbc d_user_data ui-mt-18">
<view class="f-fbc ">
<span class="bold color333 font_32 ellipsis_1" style="max-width: 30vw;">{{ item.nickname }}</span>
<image src="https://image.fulllinkai.com/202206/10/d0913df8b234057229ab3dd102497a50.png" class="vip_icon" mode="widthFix" v-if="item.is_rank"></image>
<image src="https://image.fulllinkai.com/202206/10/bfad7e2a8e86cf7912ff280234a35606.png" class="vip_icon" mode="widthFix" v-else></image>
<image src="https://image.fulllinkai.com/202206/10/5cb84879a0dc81757dc526ebeb61bc0e.png" class="real_icon" mode="widthFix" v-if="item.is_approved == 1"></image>
<image src="https://image.fulllinkai.com/202206/10/279ade8a42810a91eb80a0717823dffa.png" class="reality_icon" mode="widthFix" v-if="item.is_real_approved == 1"></image>
</view>
<view class="address f-fbc">
<image src="https://image.fulllinkai.com/202206/07/817a393539ee854226eef79defef2fc4.png" class="address_icon" mode="aspectFit"></image>
<span class="font_24">{{ item.city }}</span>
</view>
</view>
<view class="f-fbc d_user_data ui-mt-8">
<span class="color333 font_28 ellipsis_1">
<block v-if="item.year">{{ item.year }}</block>
<block v-if="item.stature">{{ ' · ' + item.stature }}</block>
<block v-if="item.degree">{{ ' · ' +item.degree }}</block>
<block v-if="item.industry_sub">{{ ' · ' + item.industry_sub }}</block>
</span>
</view>
<view class="f-fbc d_user_data ui-mt-6">
<span class="color666 font_28 ellipsis_1" style="width: 80vw;">{{ item.introduction || '介绍:未填写' }}</span>
</view>
</view>
</view>
</block>
<view v-if="no_more " class="text-c f-fcc" style="color: #F33B6C;" @tap="toRefresh">
<image src="https://image.fulllinkai.com/202411/05/97b41d06d255edc1ecfecec71cd15ba1.png" class="ui-refresh ui-mr-8"></image>
<view>更换一批</view>
</view>
<view class="cu-modal {{perfectModal ? 'show' : ''}}">
<view class="perfect_data_box" style="padding: 0;">
<view class="cancel_icon_box" @tap="perfectModal = false">
<image src="https://images.ufutx.com/202012/21/7bc531d74f41cce95ede5582232fd2f3.png" mode="widthFix" class="cancel_icon"></image>
</view>
<view class="perfect_head_box">
<view class="perfect_title font_36">当前处于未完善资料状态</view>
<view class="font_30 color999 ui-pb-40">无法进行申请</view>
<view class="perfect_end_box">
<image class="triangle_icon" src="https://images.ufutx.com/202012/24/d59e22e4e2f713d943989faa60205e97.png" mode="widthFix"></image>
<view class="font_30 color333 bold text-black ui-pt-8">完善资料 获得推荐 更快交友</view>
<view class="perfect_list_box">
<view class="perfect_li f-fbc">
<view class="flo_l font_28">完善资料</view>
<view class="flo_r perfect_button font_28 ui-active-button" v-if="userInfo.is_compeleted_profile">已填写</view>
<view class="flo_r perfect_button font_28" v-else @tap="jumpPath('/pages/users/unmarriV2')">去填写</view>
</view>
<view class="line"></view>
<view class="perfect_li f-fbc">
<view class="flo_l font_28">完成真人认证</view>
<view class="flo_r perfect_button font_28 ui-active-button" v-if="userInfo.is_real_approved == 1">已认证</view>
<view class="flo_r perfect_button font_28" style="background: #FFBB00;" v-else-if="userInfo.is_real_approved == 2">审核中</view>
<view class="flo_r perfect_button font_28" v-else @tap="jumpPath('/pages/users/realName')">去认证</view>
</view>
</view>
</view>
</view>
</view>
</view>
<loginDialog :loginShow="loginShow" @hiddenLogin="hiddenLogin"></loginDialog>
<view :class="{'show':modalName=='showAdv'}" class="cu-modal">
<view class="login_prompt_box">
<image class="ui-adv-modal" :src="advModal.pic"
mode="widthFix" @tap="goToShop(advModal)">
</image><image class="loginCancelIcon" src="https://image.fulllinkai.com/202501/07/3a14b8cc539285e3ba96b0977749bfc5.png"
mode="widthFix" @tap="hideModal"></image>
</view>
</view>
</view>
<!-- </scroll-view>-->
</template>
<script>
import wepy from '@wepy/core'
import https from '../../mixins/https'
import base from '../../mixins/base'
import {service} from '../../config'
import {formatRemainTimeData} from '../../mixins/plugins'
wepy.page({
config: {},
mixins: [https, base],
data: {
pageLoading: false,
loginShow: false,
perfectModal: false,
userInfo: {},
throttle: true,
topUpState: null,
topList: [], // 置顶推荐
prefectureList: [], // 专区推荐
squareList: [], // 单身广场
noMoreSquare: false, // 单身广场更多
squarePage: 1,
no_more: false,
isScroll: false,
isClickClose: false, // 是否点击关闭了
cardCur: 0, // 为你推荐轮播下标
referrals: [], // 为你推荐
countdown: {d: '0', h: '00', m: '00', s: '00'},
timer: null,
swiperList: [
// {url: 'https://health.ufutx.com/go_html/store_common#/agentHome', img: 'https://images.health.ufutx.com/202501/10/77128459dc40babf165f8bb2cc44be1d.jpeg'},
{url: 'https://health.ufutx.com/go_html/store_common#/agentHome', img: 'https://images.health.ufutx.com/202501/09/cd369bc6aa8ca9cb9626bb75e9d5ab6c.jpeg'},
// {url: 'https://health.ufutx.com/go_html/store_common#/agentHome', img: 'https://images.health.ufutx.com/202412/31/81b8f50c7e8a03a5aaf9310f02470660.jpeg'},
{url: 'https://health.ufutx.com/go_html/store_common#/agentHome', img: 'https://images.health.ufutx.com/202412/20/68a61ecd8f5255ab557747d95cf2cae6.jpeg'}
],
modalName: '', //
advModal: {
id: 0,
pic: '',
shop_id: null
}, //
url: 'other/user/square' // 精准推荐
},
methods: {
hideModal() {
this.modalName = ''
},
onPageScroll(e) {
let vm = this.$wepy
// 根据滚动位置来设置按钮的隐藏状态
// 这里的scrollTop是滚动条垂直滚动的距离
vm.isScroll = true
clearTimeout(this.scrollTimeout)
this.scrollTimeout = setTimeout(() => {
// 定时器时间到后,如果没有新的滚动事件触发,则认为滚动停止
vm.isScroll = false
// 这里可以执行滚动停止后的逻辑,比如显示某个按钮
}, 200) // 200毫秒后判断滚动是否停止,这个时间可以根据需要调整
},
// 获取置顶推荐用户
getTopUser() {
let vm = this
console.log(this, 'topthis')
vm.$get({url: `${service.host}/area/top/users`}).then(({code, data}) => {
if (code === 0) {
vm.topList = data || []
}
vm.pageLoading = true
wx.hideLoading()
}).catch(err => {
vm.pageLoading = true
wx.hideLoading()
console.log(err)
})
},
// 获取专区推荐
getArea() {
let vm = this
vm.$get({url: `${service.host}/area/class`}).then(({code, data}) => {
if (code === 0) {
vm.prefectureList = data || []
}
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
console.log(err)
})
},
// 获取每日推荐
getEveryday() {
let vm = this
vm.$get({url: `${service.host}/other/user/recommend`}).then(({code, data}) => {
if (code === 0) {
vm.referrals = data
vm.referrals.push({type: 'time'})
}
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
console.log(err)
})
},
// 获取广场
getSquare() {
let vm = this
vm.$get({url: `${service.host}/${vm.url}?page=${vm.squarePage}`}).then(({code, data}) => {
if (code === 0) {
if (vm.squareList.length === 0 || vm.squarePage === 1) {
vm.squareList = data.data
} else {
data.data.map(function (item) {
vm.squareList.push(item)
})
}
if (vm.squarePage == data.total_pages) {
vm.no_more = true
vm.noMoreSquare = true
}
vm.squarePage++
}
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
console.log(err)
})
},
toRefresh() {
console.log('---9')
let vm = this
vm.squareList = []
vm.squarePage = 1
vm.$showLoading('更新中')
setTimeout(() => {
vm.no_more = false
vm.url = 'other/user/rand/square' // 随机推荐
vm.getSquare()
}, 300)
},
// 申请置顶推荐状态
applyTopUpState () {
let vm = this
vm.$get({url: `${service.host}/area/top/users/status`}).then(({code, data}) => {
if (code === 0) {
vm.topUpState = data.status
}
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
console.log(err)
})
},
// 申请置顶推荐
applyTopUp () {
let vm = this
// 校验是否完成注册资料
if (!vm.$signInVerify()) {
vm.loginShow = true
return
}
if (!vm.userInfo.is_compeleted_profile || !vm.userInfo.is_real_approved) {
vm.perfectModal = true
return
}
if (vm.topUpState == 1) {
vm.$showToast('你已申请,等待审核')
return
}
wx.showModal({
title: '温馨提示',
content: '是否确认申请“我也要上推荐”?',
success: function (res) {
if (res.confirm) {
vm.$showLoading('')
vm.$post({url: `${service.host}/area/top/users`}).then((code, data) => {
if (code == 0) {
vm.$showToast('申请已提交')
}
wx.hideLoading()
}).catch(() => {
wx.hideLoading()
})
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
getTimeFn() {
let vm = this
let date = new Date()
date.setDate(date.getDate() + 1)// 获取明天的日期
let year = date.getFullYear()
let month = date.getMonth() + 1
if (month < 10) {
month = '0' + month
}
let day = date.getDate()
if (day < 10) {
day = '0' + day
}
let time = `${year}-${month}-${day} 12:00:00`
vm.timer = setInterval(() => {
vm.countdown = formatRemainTimeData(time)
if (vm.countdown.d == 0 && vm.countdown.h == '00' && vm.countdown.m == '00' && vm.countdown.s == '00') {
clearInterval(vm.timer)
vm.timer = null
}
}, 1000)
},
cardSwiper(e) {
let vm = this
let source = e.$wx.detail.source
if (source == 'autoplay' || source == 'touch') {
vm.cardCur = e.$wx.detail.current
}
},
// 初始化每日推荐
refreshFn() {
let vm = this
vm.getEveryday()
},
// 每日推荐回到第一张
backFirst() {
let vm = this
vm.cardCur = 0
},
jumpPath(url) {
let vm = this
// // 校验是否完成注册资料
// if (!vm.$signInVerify()) {
// vm.loginShow = true
// return
// }
wx.navigateTo({url: url})
},
hiddenLogin() {
let vm = this
vm.loginShow = false
},
getBannerList() {
let vm = this
vm.$get({url: `${service.host}/dma/carousel/list`}).then(({code, data}) => {
if (code === 0) {
vm.swiperList = data.map(item => {
return {
img: item.icon,
shop_id: item.shop_id,
program: item.program
}
}).filter((item) => {
return !item.program
})
}
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
console.log(err)
})
},
goToShop(item) {
let name = wx.getStorageSync('userInfo').name || ''
let mobile = wx.getStorageSync('mobile') || ''
console.log(item, 'ite-==')
if (item && item.shop_id) {
wx.navigateToMiniProgram({
appId: 'wxe486777f4379507e',
path: `/pages/sub_page/shopDetail?id=${item.shop_id}&name=${name}&mobile=${mobile}`
})
return
}
wx.navigateToMiniProgram({
appId: 'wxe486777f4379507e',
path: `/pages/sub_page/shopListV2?name=${name}&mobile=${mobile}`
})
return
console.log('111')
// wx.navigateTo({url: item.url})
// wx.navigateTo({url: '/pages/books/bookDetail?url=' + encodeURIComponent(item.url)})
wx.navigateTo({url: '/pages/books/bookDetail?url=' + encodeURIComponent('https://health.ufutx.com/go_html/store_common#/agentHome')})
}
},
// 上拉获取更多数据
onReachBottom() {
let vm = this
if (!vm.no_more) {
vm.getSquare()
}
},
// 下拉刷新
onPullDownRefresh() {
let vm = this
vm.squarePage = 1
vm.no_more = false
vm.getSquare()
},
onShow() {
let vm = this
console.log('222')
vm.getTimeFn()
if (wx.getStorageSync('logoutCode')) {
wx.redirectTo({url: '/pages/users/logoutDefault'})
}
// if (vm.userInfo) {
// console.log('444')
// setTimeout(() => {
// wx.switchTab({url: '/pages/tabBar/home'})
// }, 3000)
// }
},
onLoad() {
let vm = this
vm.userInfo = wx.getStorageSync('userInfo')
console.log(vm.userInfo, 'vm.userInfo')
if (!vm.userInfo) {
console.log('444')
setTimeout(() => {
vm.getTopUser()
vm.getArea()
vm.getEveryday()
vm.getSquare()
vm.applyTopUpState()
vm.getBannerList()
vm.advModal = wx.getStorageSync('adv')
if ((vm.advModal.id - 0) > 0) {
vm.modalName = 'showAdv'
}
}, 1200)
} else {
vm.getTopUser()
vm.getArea()
vm.getEveryday()
vm.getSquare()
vm.applyTopUpState()
vm.getBannerList()
vm.advModal = wx.getStorageSync('adv')
if ((vm.advModal.id - 0) > 0) {
vm.modalName = 'showAdv'
}
}
}
})
</script>
<config>
{
navigationBarTitleText: '推荐',
navigationStyle: 'custom',
enablePullDownRefresh: true,
backgroundColorTop: '#ffffff',
backgroundColorBottom: '#ffffff',
usingComponents: {
cuCustom: '~@/components/cuCustom',
loginDialog: '~@/components/loginDialog',
}
}
</config>