项目初始化
This commit is contained in:
220
pages/tabbar/components/home/actionSheet.vue
Normal file
220
pages/tabbar/components/home/actionSheet.vue
Normal file
@@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<view @touchmove.stop.prevent>
|
||||
<view class="tui-actionsheet" :class="{'tui-actionsheet-show':show,'tui-actionsheet-radius':radius}"
|
||||
:style="{zIndex:getZIndex}">
|
||||
<view class="tui-actionsheet-tips" :style="{fontSize:size+'rpx',color:color}" v-if="tips">
|
||||
{{tips}}
|
||||
</view>
|
||||
<view :class="[isCancel?'tui-operate-box':'']">
|
||||
<scroll-view class="scroll-box" :style="{height: scrollHeight}" scroll-y>
|
||||
<block v-for="(item,index) in itemList" :key="index">
|
||||
<view class="tui-actionsheet-btn"
|
||||
:class="index == 0 ? 'top' : ''"
|
||||
hover-class="tui-actionsheet-hover" :hover-stay-time="150" :data-index="index"
|
||||
:style="{color:item.color || '#2B2B2B'}" @tap="handleClickItem">{{item.text}}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="tui-actionsheet-btn tui-actionsheet-cancel" hover-class="tui-actionsheet-hover"
|
||||
:hover-stay-time="150" v-if="isCancel" @tap="handleClickCancel">取消</view>
|
||||
</view>
|
||||
<view class="tui-actionsheet-mask" :class="{'tui-mask-show':show}" :style="{background:maskColor,zIndex:zIndex}"
|
||||
@tap="handleClickMask"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "tuiActionsheet",
|
||||
emits: ['click', 'cancel'],
|
||||
props: {
|
||||
//显示操作菜单
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
//菜单按钮数组,自定义文本颜色,红色参考色:#e53a37
|
||||
itemList: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return [{
|
||||
text: "确定",
|
||||
color: "#2B2B2B"
|
||||
}]
|
||||
}
|
||||
},
|
||||
//点击遮罩 是否可关闭
|
||||
maskClosable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
//v2.1.0
|
||||
maskColor: {
|
||||
type: String,
|
||||
default: "rgba(0, 0, 0, 0.6)"
|
||||
},
|
||||
//提示文字
|
||||
tips: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
//提示文字颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: "#808080"
|
||||
},
|
||||
//提示文字大小 rpx
|
||||
size: {
|
||||
type: Number,
|
||||
default: 26
|
||||
},
|
||||
//是否需要圆角
|
||||
radius: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
//是否需要取消按钮
|
||||
isCancel: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
zIndex: {
|
||||
type: [Number, String],
|
||||
default: 998
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getZIndex() {
|
||||
return Number(this.zIndex) + 2
|
||||
},
|
||||
scrollHeight() {
|
||||
var num = 7
|
||||
if(this.itemList.length <= num){
|
||||
num = this.itemList.length-1;
|
||||
}
|
||||
var h = 100*num;
|
||||
return h + 'rpx';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClickMask() {
|
||||
if (!this.maskClosable) return;
|
||||
this.handleClickCancel();
|
||||
},
|
||||
handleClickItem(e) {
|
||||
if (!this.show) return;
|
||||
const index = Number(e.currentTarget.dataset.index);
|
||||
this.$emit('click', {
|
||||
index: index,
|
||||
...this.itemList[index]
|
||||
});
|
||||
},
|
||||
handleClickCancel() {
|
||||
this.$emit('cancel');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scroll-box {
|
||||
padding-top: 100rpx;
|
||||
|
||||
.top {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.tui-actionsheet {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
visibility: hidden;
|
||||
transform: translate3d(0, 100%, 0);
|
||||
transform-origin: center;
|
||||
transition: all 0.25s ease-in-out;
|
||||
background-color: #F7F7F7;
|
||||
min-height: 100rpx;
|
||||
}
|
||||
|
||||
.tui-actionsheet-radius {
|
||||
border-top-left-radius: 20rpx;
|
||||
border-top-right-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tui-actionsheet-show {
|
||||
transform: translate3d(0, 0, 0);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.tui-actionsheet-tips {
|
||||
width: 100%;
|
||||
padding: 40rpx 60rpx;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.tui-operate-box {
|
||||
padding-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.tui-actionsheet-btn {
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
font-size: 34rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tui-btn-last {
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.tui-actionsheet-divider::before {
|
||||
content: '';
|
||||
width: 100%;
|
||||
border-bottom: 1rpx solid #E7E7E7;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
-webkit-transform: scaleY(0.5);
|
||||
transform: scaleY(0.5);
|
||||
}
|
||||
|
||||
.tui-actionsheet-cancel {
|
||||
color: #1a1a1a;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.tui-actionsheet-hover {
|
||||
background-color: #f7f7f9;
|
||||
}
|
||||
|
||||
.tui-actionsheet-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
transition: all 0.3s ease-in-out;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.tui-mask-show {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
</style>
|
448
pages/tabbar/components/home/cardList.vue
Normal file
448
pages/tabbar/components/home/cardList.vue
Normal file
@@ -0,0 +1,448 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- #ifdef MP -->
|
||||
<view v-if="showSubscribeBtn" class="subscribe-box">
|
||||
<u-icon name="bell-fill" color="var(--ui-BG-Main)" size="44"></u-icon>
|
||||
<view class="info">获取未读消息提醒</view>
|
||||
<view class="sub-btn" @tap="subscribeMessage">立即订阅</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
<view :id="`zp-id-${item.zp_index}`" :key="item.zp_index" v-for="(item,index) in orderList" class="user-card">
|
||||
<view class="avatar-box" @click="detail(item)">
|
||||
<u-avatar size="180" :src="item.avatar"></u-avatar>
|
||||
</view>
|
||||
<view class="right-box">
|
||||
<view class="top-box">
|
||||
<view class="nickname-box">
|
||||
<view class="nickname">{{item.nickname}}</view>
|
||||
<view class="sex-nv" v-if="item.sex == 2">
|
||||
<u-icon name="ziyuan2" size="22" custom-prefix="iconfont"></u-icon>
|
||||
<text>{{item.age}}</text>
|
||||
</view>
|
||||
<view class="sex-nan" v-if="item.sex == 1">
|
||||
<u-icon name="ziyuan3" size="22" custom-prefix="iconfont"></u-icon>
|
||||
<text>{{item.age}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="map-box">
|
||||
<u-icon name="map" size="32" color="#aaa"></u-icon>
|
||||
<view class="city" v-if="item.city">
|
||||
<text class="text">{{item.city}}</text>
|
||||
</view>
|
||||
<text v-else>未知</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="oline-box">
|
||||
<view class="tag-box">
|
||||
<span class="tag">已注册{{item.day}}天</span>
|
||||
<span class="tag" v-if="item.qrcode && item.qrcodeShow == 0">可交换名片</span>
|
||||
</view>
|
||||
<view class="badge-box">
|
||||
<view v-if="item.qrcode && item.qrcodeShow == 0" class="weixin-btn" @click="getWeixin(item)">
|
||||
<u-icon name="weixin-fill" size="28" color="#fff"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tag-list">
|
||||
<img-box :file="item.photo"></img-box>
|
||||
<view class="chat-btn" @click="chat(item)">
|
||||
<u-icon name="chat" size="28" color="#fff"></u-icon>
|
||||
<view class="text">密聊</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TuiBadge from "@/components/thorui/tui-badge/tui-badge.vue";
|
||||
import ImgBox from '@/pages/tabbar/components/home/friend/imgBox.vue';
|
||||
import sheep from '@/sheep';
|
||||
import { WxaSubscribeTemplate } from '@/sheep/util/const';
|
||||
import { showAuthModal } from '@/sheep/hooks/useModal';
|
||||
import ImConversationApi from '@/sheep/api/im/memberConversation';
|
||||
import UserApi from '@/sheep/api/member/user';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from "dayjs/plugin/relativeTime";
|
||||
dayjs.extend(relativeTime);
|
||||
const audio = uni.createInnerAudioContext();
|
||||
export default {
|
||||
components: {
|
||||
TuiBadge,
|
||||
ImgBox,
|
||||
},
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
virtualList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
playId: null,
|
||||
|
||||
showSubscribeBtn: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
authType() {
|
||||
return sheep.$store('modal').auth;
|
||||
},
|
||||
orderList() {
|
||||
this.virtualList.forEach((order) => order.time = this.showDayTime(order.updateTime));
|
||||
return this.virtualList;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
// #ifdef MP
|
||||
// 订阅只能由用户主动触发,只能包一层 showModal 诱导用户点击
|
||||
this.autoSubscribeMessage();
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
playAudio(e) {
|
||||
if(this.playId == e.id){
|
||||
this.playId = null;
|
||||
audio.stop();
|
||||
return;
|
||||
}
|
||||
this.playId = e.id;
|
||||
//语音自然播放结束
|
||||
audio.onEnded((res) => {
|
||||
this.playId = null;
|
||||
});
|
||||
audio.src = e.sound;
|
||||
audio.play();
|
||||
},
|
||||
detail(e) {
|
||||
sheep.$router.go('/pages/user/detail/index',{id: e.id});
|
||||
},
|
||||
getWeixin(e) {
|
||||
var that = this;
|
||||
uni.showModal({
|
||||
title: '交换名片',
|
||||
content: '确认交换名片吗?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
that.queryWeixin(e);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
queryWeixin(e) {
|
||||
UserApi.getQrcodeByUserId(e.id).then(res => {
|
||||
if(res.data){
|
||||
uni.previewImage({
|
||||
current: 0, //预览图片的下标
|
||||
urls: [res.data], //预览图片的地址,必须要数组形式,如果不是数组形式就转换成数组形式就可以
|
||||
indicator: 'number',
|
||||
loop: true
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
chat(e) {
|
||||
const isLogin = sheep.$store('user').isLogin;
|
||||
if(!isLogin) {
|
||||
showAuthModal();
|
||||
return;
|
||||
}
|
||||
|
||||
const userInfo = sheep.$store('user').userInfo;
|
||||
// 如果用户已经有头像和昵称,不要每次登录都要重新上传头像。
|
||||
if(userInfo.visible) {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.subscribeMessage();
|
||||
// #endif
|
||||
|
||||
ImConversationApi.createMemberConversation({
|
||||
userId: e.id,
|
||||
groupType: 1,
|
||||
lastMessageContentType: 1,
|
||||
}).then(res => {
|
||||
if(res.data){
|
||||
sheep.$router.go('/pages/im/index',{groupId: res.data, receiveUserId: e.id});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 触发小程序授权信息弹框
|
||||
// #ifdef MP-WEIXIN
|
||||
showAuthModal('mpAuthorization');
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
showAuthModal('h5Authorization');
|
||||
// #endif
|
||||
},
|
||||
subscribeMessage() {
|
||||
const event = [WxaSubscribeTemplate.UNREAD_MESSAGE];
|
||||
sheep.$platform.useProvider('wechat').subscribeMessage(event, () => {
|
||||
// 订阅后记录一下订阅状态
|
||||
uni.removeStorageSync(WxaSubscribeTemplate.UNREAD_MESSAGE);
|
||||
uni.setStorageSync(WxaSubscribeTemplate.UNREAD_MESSAGE, '已订阅');
|
||||
// 隐藏订阅按钮
|
||||
this.showSubscribeBtn = false;
|
||||
});
|
||||
},
|
||||
async autoSubscribeMessage() {
|
||||
// 1. 校验是否手动订阅过
|
||||
const subscribeBtnStatus = uni.getStorageSync(WxaSubscribeTemplate.UNREAD_MESSAGE);
|
||||
if (!subscribeBtnStatus) {
|
||||
this.showSubscribeBtn = true;
|
||||
return;
|
||||
}
|
||||
},
|
||||
showDayTime(datetime) {
|
||||
if (!datetime) return "";
|
||||
return dayjs(datetime).fromNow();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.user-card {
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.user-card:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.voice-play {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.right-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
margin-left: 10px;
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
justify-content: center;
|
||||
|
||||
.top-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.nickname-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.nickname {
|
||||
font-size: 28rpx;
|
||||
font-weight: bolder;
|
||||
margin-right: 4px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
max-width: 200rpx;
|
||||
}
|
||||
|
||||
.sex-nv {
|
||||
background-color: #d5656f;
|
||||
border-radius: 40px;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
padding: 1px 5px;
|
||||
}
|
||||
|
||||
.sex-nan {
|
||||
background-color: #0081ff;
|
||||
border-radius: 40px;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
padding: 1px 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.map-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 22rpx;
|
||||
color: #aaa;
|
||||
|
||||
.city {
|
||||
display: flex;
|
||||
|
||||
.text {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
max-width: 88rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.oline-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.img-icon {
|
||||
width: 40rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
|
||||
.icon {
|
||||
background-color: #ff5ebd;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 40px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
line-height: 22rpx;
|
||||
padding: 5px 5px;
|
||||
}
|
||||
|
||||
.badge-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 26rpx;
|
||||
color: #aaa;
|
||||
|
||||
.online {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tag-list {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
display: inline-block;
|
||||
align-items: center;
|
||||
background-color: #eef2f2;
|
||||
border-radius: 3px;
|
||||
color: #aaa;
|
||||
font-size: 24rpx;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
padding: 5px 0;
|
||||
|
||||
.tag {
|
||||
white-space: nowrap;
|
||||
padding: 5px 5px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tag:after {
|
||||
content: ' ';
|
||||
border-left: 1px solid #aaa;
|
||||
display: inline-block;
|
||||
height: 10px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.tag:last-child:after{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.note-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #aaa;
|
||||
font-size: 24rpx;
|
||||
|
||||
.text {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.chat-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: var(--ui-BG-Main);
|
||||
justify-content: center;
|
||||
border-radius: 40px;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
|
||||
.text {
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.weixin-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #19be6b;
|
||||
justify-content: center;
|
||||
border-radius: 40px;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
padding: 5px;
|
||||
|
||||
.text {
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.subscribe-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: 10px;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
|
||||
.info {
|
||||
margin: 0 10rpx;
|
||||
}
|
||||
|
||||
.sub-btn {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
</style>
|
181
pages/tabbar/components/home/categoryCard.vue
Normal file
181
pages/tabbar/components/home/categoryCard.vue
Normal file
@@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<view class="user-card-box">
|
||||
|
||||
<view class="user-card">
|
||||
<view class="title">
|
||||
<view class="icon">
|
||||
<u-icon name="grid-fill" size="20" color="#aaa"></u-icon>
|
||||
</view>
|
||||
<text class="text">技能分类</text>
|
||||
</view>
|
||||
|
||||
|
||||
<uni-swiper-dot class="uni-swiper-dot-box" @clickItem="clickItem" :info="swiperList" :current="current" :dots-styles="dotsStyles" field="content">
|
||||
<swiper class="swiper-box" :class="dataList.length > 4 ? '' : 'line'" @change="change" :current="swiperDotIndex">
|
||||
<swiper-item v-for="(swiper,si) in swiperList">
|
||||
<view class="user-swiper">
|
||||
<view @click="tabClick(item)" class="user-box" v-for="(item,i) in swiper.list">
|
||||
<view class="avatar-box">
|
||||
<u-image border-radius="10" height="140" width="140" :src="item.thumb"></u-image>
|
||||
</view>
|
||||
<view class="nickname">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</uni-swiper-dot>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {
|
||||
dataList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
swiperDotIndex: 0,
|
||||
current: 0,
|
||||
dotsStyles: {
|
||||
backgroundColor: '#ddd',
|
||||
border: '1px #ddd solid',
|
||||
color: '#fff',
|
||||
selectedBackgroundColor: 'var(--ui-BG-Main)',
|
||||
selectedBorder: '1px var(--ui-BG-Main) solid'
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
swiperList() {
|
||||
return this.getSwiperList(this.dataList);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
change(e) {
|
||||
this.current = e.detail.current
|
||||
},
|
||||
getSwiperList(dataList) {
|
||||
var swiperList = [];
|
||||
var categoryList = [];
|
||||
for(var i=0;i<dataList.length;i++){
|
||||
var category = dataList[i];
|
||||
categoryList.push(category);
|
||||
if((i+1)%8 == 0 || (i+1) == dataList.length){
|
||||
var swiper = {
|
||||
list: categoryList
|
||||
};
|
||||
swiperList.push(swiper);
|
||||
categoryList = [];
|
||||
}
|
||||
}
|
||||
return swiperList;
|
||||
},
|
||||
clickItem(e) {
|
||||
this.swiperDotIndex = e
|
||||
},
|
||||
tabClick(e) {
|
||||
this.$emit('tabClick', e);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.user-card-box {
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.swiper-box {
|
||||
height: 460rpx;
|
||||
}
|
||||
|
||||
.line {
|
||||
height: 240rpx;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
padding: 10px 0;
|
||||
padding-bottom: 0;
|
||||
|
||||
.title {
|
||||
padding: 10px;
|
||||
padding-top: 0;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: 15px;
|
||||
|
||||
.icon {
|
||||
background-color: #ddd;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.user-swiper {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 0px 5px;
|
||||
|
||||
.avatar-box {
|
||||
margin-bottom: 5px;
|
||||
position: relative;
|
||||
|
||||
.badge {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-radius: 100%;
|
||||
border: 2px solid #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.user-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
width: 25%;
|
||||
|
||||
.nickname {
|
||||
font-size: 28rpx;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 140rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
67
pages/tabbar/components/home/categorySheet.vue
Normal file
67
pages/tabbar/components/home/categorySheet.vue
Normal file
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<view>
|
||||
<action-sheet zIndex="9999" :show="showActionSheet" :item-list="categoryList" @click="itemClick" @cancel="closeActionSheet"></action-sheet>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ActionSheet from '@/pages/tabbar/components/home/actionSheet.vue';
|
||||
import sheep from '@/sheep';
|
||||
export default {
|
||||
components: {
|
||||
ActionSheet,
|
||||
},
|
||||
props: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showActionSheet: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
categoryList() {
|
||||
var cateList = [];
|
||||
var cate = {
|
||||
text: "全部",
|
||||
label: '项目分类',
|
||||
value: '',
|
||||
color: "#2B2B2B"
|
||||
};
|
||||
cateList.push(cate);
|
||||
var dataList = sheep.$store('sys').categoryList;
|
||||
for(var i=0;i<dataList.length;i++){
|
||||
var category = {
|
||||
text: "",
|
||||
label: '',
|
||||
value: '',
|
||||
color: "#2B2B2B"
|
||||
};
|
||||
category.text = dataList[i].name;
|
||||
category.label = dataList[i].name;
|
||||
category.value = dataList[i].id;
|
||||
cateList.push(category);
|
||||
}
|
||||
return cateList;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
//隐藏组件
|
||||
closeActionSheet() {
|
||||
this.showActionSheet = false
|
||||
},
|
||||
//调用此方法显示组件
|
||||
openActionSheet() {
|
||||
this.showActionSheet = true;
|
||||
},
|
||||
itemClick(e) {
|
||||
this.$emit('categoryOk', e);
|
||||
this.closeActionSheet();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
49
pages/tabbar/components/home/dazi.vue
Normal file
49
pages/tabbar/components/home/dazi.vue
Normal file
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="data-box">
|
||||
<card-list :virtualList="virtualList"></card-list>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import topBox from '@/pages/tabbar/components/home/topBox.vue';
|
||||
import CardList from '@/pages/tabbar/components/home/cardList.vue';
|
||||
export default {
|
||||
components: {
|
||||
topBox,
|
||||
CardList,
|
||||
},
|
||||
props: {
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
stickyTop: {
|
||||
type: Number,
|
||||
default: uni.upx2px(80),
|
||||
},
|
||||
virtualList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.data-box {
|
||||
padding: 0 15px;
|
||||
}
|
||||
</style>
|
55
pages/tabbar/components/home/friend.vue
Normal file
55
pages/tabbar/components/home/friend.vue
Normal file
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<view>
|
||||
<top-box @tabClick="tabClick" @search="search" :scrollTop="scrollTop" :stickyTop="stickyTop"></top-box>
|
||||
<view class="data-box">
|
||||
<card-list :virtualList="virtualList"></card-list>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import topBox from '@/pages/tabbar/components/home/friend/topBox.vue';
|
||||
import CardList from '@/pages/tabbar/components/home/cardList.vue';
|
||||
export default {
|
||||
components: {
|
||||
topBox,
|
||||
CardList,
|
||||
},
|
||||
props: {
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
stickyTop: {
|
||||
type: Number,
|
||||
default: uni.upx2px(80),
|
||||
},
|
||||
virtualList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
tabClick(e) {
|
||||
this.$emit('tabClick', e);
|
||||
},
|
||||
search(e) {
|
||||
this.$emit('search', e);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.data-box {
|
||||
padding: 0 15px;
|
||||
}
|
||||
</style>
|
86
pages/tabbar/components/home/friend/imgBox.vue
Normal file
86
pages/tabbar/components/home/friend/imgBox.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="img-box" v-if="imgList.length > 0">
|
||||
<block v-for="(img,index) in imgList">
|
||||
<view @click="onPreviewTap(img)" class="img" v-if="index < 3">
|
||||
<u-image border-radius="10" width="70rpx" height="70rpx" :src="img"></u-image>
|
||||
<view class="more" v-if="imgList.length > 3">
|
||||
<text>+{{imgList.length-3}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view>暂未上传相册</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {
|
||||
file: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
computed: {
|
||||
imgList() {
|
||||
if(this.file){
|
||||
return this.file.split(',');
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 预览图片
|
||||
onPreviewTap(url) {
|
||||
uni.previewImage({
|
||||
current: url,
|
||||
urls: this.imgList,
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.img-box {
|
||||
display: flex;
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
|
||||
.img {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.more {
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
bottom: 0;
|
||||
background-color: #333333a6;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
246
pages/tabbar/components/home/friend/rankBox.vue
Normal file
246
pages/tabbar/components/home/friend/rankBox.vue
Normal file
@@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<view class="rank-box">
|
||||
<view class="tab-box">
|
||||
<tui-tabs width="200" unlined :tabs="tabList" badgeBgColor="var(--ui-BG-Main)" selectedColor="var(--ui-BG-Main)" sliderBgColor="var(--ui-BG-Main)" :currentTab="current" @change="change"></tui-tabs>
|
||||
</view>
|
||||
<view class="user-box">
|
||||
<view class="avatar-box two" @click="detail(1)">
|
||||
<view class="img-box">
|
||||
<img v-if="list[1]" class="img" :src="list[1].avatar"></img>
|
||||
<img v-else class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/a0b0a27972615aee024a6e36f0a7e9e399e477ae55b7eec2b32032a6cc8bb268.png"></img>
|
||||
<img class="two-icon" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/03072abb5a8c90a4f457549b8394d3c3db2a652410692d732b5c25f2478e3a85.png"></img>
|
||||
</view>
|
||||
<view class="nickname" v-if="list[1]">{{list[1].nickname}}</view>
|
||||
<view class="nickname" v-else>???</view>
|
||||
</view>
|
||||
<view class="avatar-box one" @click="detail(0)">
|
||||
<view class="img-box">
|
||||
<img v-if="list[0]" class="img" :src="list[0].avatar"></img>
|
||||
<img v-else class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/a0b0a27972615aee024a6e36f0a7e9e399e477ae55b7eec2b32032a6cc8bb268.png"></img>
|
||||
<img class="two-icon" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/d191aec3b3d6e95c1dcb3bace7bffe28834f4fb062a9675aeaa1ae42a9bbc366.png"></img>
|
||||
</view>
|
||||
<view class="nickname" v-if="list[0]">{{list[0].nickname}}</view>
|
||||
<view class="nickname" v-else>???</view>
|
||||
</view>
|
||||
<view class="avatar-box three" @click="detail(2)">
|
||||
<view class="img-box">
|
||||
<img v-if="list[2]" class="img" :src="list[2].avatar"></img>
|
||||
<img v-else class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/a0b0a27972615aee024a6e36f0a7e9e399e477ae55b7eec2b32032a6cc8bb268.png"></img>
|
||||
<img class="two-icon" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/27209281e1b0e00dcc112bae4d06c14b089ec2f74db14b62eca4cbc0cf741cff.png"></img>
|
||||
</view>
|
||||
<view class="nickname" v-if="list[2]">{{list[2].nickname}}</view>
|
||||
<view class="nickname" v-else>???</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="time-box">更新时间: {{updateTime}}</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tuiTabs from "@/components/thorui/tui-tabs/tui-tabs.vue"
|
||||
import sheep from '@/sheep';
|
||||
import { showAuthModal } from '@/sheep/hooks/useModal';
|
||||
import ImConversationApi from '@/sheep/api/im/memberConversation';
|
||||
import { WxaSubscribeTemplate } from '@/sheep/util/const';
|
||||
import dayjs from 'dayjs';
|
||||
export default {
|
||||
components: {
|
||||
tuiTabs
|
||||
},
|
||||
props: {
|
||||
maleWeekTopList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
femaleWeekTopList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
current: 0,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
updateTime() {
|
||||
this.list = this.femaleWeekTopList;
|
||||
|
||||
// 获取当前日期和时间
|
||||
const now = dayjs();
|
||||
const nowDays = now.format('MM/DD');
|
||||
const sevenDaysAgo = now.subtract(7, 'day').format('MM/DD');
|
||||
return sevenDaysAgo + '-' + nowDays
|
||||
},
|
||||
tabList() {
|
||||
return [{
|
||||
name: '女神榜',
|
||||
list: this.femaleWeekTopList,
|
||||
},{
|
||||
name: '男神榜',
|
||||
list: this.maleWeekTopList,
|
||||
}];
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
change(e) {
|
||||
this.current = e.index;
|
||||
this.list = this.tabList[e.index].list;
|
||||
},
|
||||
detail(e) {
|
||||
var user = this.list[e];
|
||||
sheep.$router.go('/pages/user/detail/index',{id: user.id});
|
||||
},
|
||||
chat(e) {
|
||||
var user = this.list[e];
|
||||
if(!user){
|
||||
return;
|
||||
}
|
||||
|
||||
const isLogin = sheep.$store('user').isLogin;
|
||||
if(!isLogin) {
|
||||
showAuthModal();
|
||||
return;
|
||||
}
|
||||
|
||||
const userInfo = sheep.$store('user').userInfo;
|
||||
// 如果用户已经有头像和昵称,不要每次登录都要重新上传头像。
|
||||
if(userInfo.visible) {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.subscribeMessage();
|
||||
// #endif
|
||||
ImConversationApi.createMemberConversation({
|
||||
userId: user.id,
|
||||
groupType: 1,
|
||||
lastMessageContentType: 1,
|
||||
}).then(res => {
|
||||
if(res.data){
|
||||
sheep.$router.go('/pages/im/index',{groupId: res.data, receiveUserId: user.id});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 触发小程序授权信息弹框
|
||||
// #ifdef MP-WEIXIN
|
||||
showAuthModal('mpAuthorization');
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
showAuthModal('h5Authorization');
|
||||
// #endif
|
||||
},
|
||||
subscribeMessage() {
|
||||
const event = [WxaSubscribeTemplate.UNREAD_MESSAGE];
|
||||
sheep.$platform.useProvider('wechat').subscribeMessage(event, () => {
|
||||
// 订阅后记录一下订阅状态
|
||||
uni.removeStorageSync(WxaSubscribeTemplate.UNREAD_MESSAGE);
|
||||
uni.setStorageSync(WxaSubscribeTemplate.UNREAD_MESSAGE, '已订阅');
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.rank-box {
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 15px;
|
||||
border-radius: 10px;
|
||||
padding: 15px;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-top: 5px;
|
||||
|
||||
.tab-box {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.user-box {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
|
||||
.nickname {
|
||||
margin-top: 10px;
|
||||
font-size: 28rpx;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 160rpx;
|
||||
text-align: center;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
|
||||
.point {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.img-box {
|
||||
height: 200rpx;
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.two-icon {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
position: absolute;
|
||||
bottom: -8px;
|
||||
}
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.one{
|
||||
color: #fed530;
|
||||
|
||||
.img {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border: 2px solid #fed530;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.two {
|
||||
color: #d8d8d8;
|
||||
|
||||
.img {
|
||||
border: 2px solid #d8d8d8;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.three {
|
||||
color: #ef9e3f;
|
||||
|
||||
.img {
|
||||
border: 2px solid #ef9e3f;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.time-box {
|
||||
padding-top: 15px;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
</style>
|
109
pages/tabbar/components/home/friend/stickyBox.vue
Normal file
109
pages/tabbar/components/home/friend/stickyBox.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="tag-box">
|
||||
<view class="title">
|
||||
<view class="icon">
|
||||
<u-icon name="account-fill" size="20" color="#aaa"></u-icon>
|
||||
</view>
|
||||
<text class="text">更多用户</text>
|
||||
</view>
|
||||
<view class="sticky-box">
|
||||
<view class="btn-tag" @click="searchTab">
|
||||
<text class="text">筛选</text>
|
||||
<u-icon name="shaixuan" custom-prefix="iconfont" size="20" color="#aaa"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import sheep from '@/sheep';
|
||||
import { showAuthModal } from '@/sheep/hooks/useModal';
|
||||
import $store from '@/sheep/store';
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
stickyTop: {
|
||||
type: Number,
|
||||
default: uni.upx2px(80),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
searchTab() {
|
||||
const isLogin = sheep.$store('user').isLogin;
|
||||
if(!isLogin) {
|
||||
showAuthModal();
|
||||
return;
|
||||
}
|
||||
$store('modal').$patch((state) => {
|
||||
state.search = true;
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tag-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15px;
|
||||
background-color: #fafafa;
|
||||
height: 100rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
|
||||
.icon {
|
||||
background-color: #ddd;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.sticky-box {
|
||||
display: flex;
|
||||
|
||||
.btn-tag {
|
||||
background-color: #fff;
|
||||
border-radius: 40px;
|
||||
margin-left: 5px;
|
||||
padding: 0px 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 24rpx;
|
||||
height: 48rpx;
|
||||
|
||||
.text {
|
||||
margin-right: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
260
pages/tabbar/components/home/friend/topBox.vue
Normal file
260
pages/tabbar/components/home/friend/topBox.vue
Normal file
@@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<view class="main-box">
|
||||
<view class="notice-box">
|
||||
<notice-bar></notice-bar>
|
||||
</view>
|
||||
|
||||
<!-- <view class="blind-box">
|
||||
<view class="blind-card">
|
||||
<view class="icon">
|
||||
<image style="width: 88rpx;height: 88rpx;" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/1d291d514fe8833f941924f273a5deb8f2cc8c06680fd49b6c08c58b16338c93.png"></image>
|
||||
</view>
|
||||
<view class="avatar-box">
|
||||
<image style="width: 320rpx;height: 64rpx;" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/41888275859ee7d4663bfcbd322a55ac3da9bbfc3621ca8a1137f39b2fde47bd.png"></image>
|
||||
<view @click="blindOrder" class="btn">快速匹配</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- <view>
|
||||
<rank-box :femaleWeekTopList="femaleWeekTopList" :maleWeekTopList="maleWeekTopList"></rank-box>
|
||||
</view> -->
|
||||
|
||||
<view class="card-box">
|
||||
<user-card :newList="newList" :hotList="hotList"></user-card>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<sticky-box @tabClick="tabClick" :scrollTop="scrollTop" :stickyTop="stickyTop"></sticky-box>
|
||||
</view>
|
||||
|
||||
<view class="menu-btn">
|
||||
<view class="icon" @click="slashed">
|
||||
<image class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/097d1fd05a1176fe93df9de64e416e771ff8ccba72330d90d905783dff66c376.png"></image>
|
||||
</view>
|
||||
|
||||
<!-- <view class="icon" @click="blindOrder">
|
||||
<image class="img" src="http://cos.duopei.feiniaowangluo.com/2065/shop/navbar/1727183771735mx5tNxqRg6.jpg"></image>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NoticeBar from '@/pages/tabbar/components/home/noticeBar.vue';
|
||||
import StickyBox from '@/pages/tabbar/components/home/friend/stickyBox.vue';
|
||||
import RankBox from '@/pages/tabbar/components/home/friend/rankBox.vue';
|
||||
import UserCard from '@/pages/tabbar/components/home/friend/userCard.vue';
|
||||
import UserApi from '@/sheep/api/member/user';
|
||||
import { showAuthModal } from '@/sheep/hooks/useModal';
|
||||
import ImConversationApi from '@/sheep/api/im/memberConversation';
|
||||
import { WxaSubscribeTemplate } from '@/sheep/util/const';
|
||||
import sheep from '@/sheep';
|
||||
export default {
|
||||
components: {
|
||||
NoticeBar,
|
||||
RankBox,
|
||||
StickyBox,
|
||||
UserCard,
|
||||
},
|
||||
props: {
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
stickyTop: {
|
||||
type: Number,
|
||||
default: uni.upx2px(80),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
actionStyle: {
|
||||
backgroundColor: 'var(--ui-BG-Main)',
|
||||
borderRadius: '40px',
|
||||
padding: '7px',
|
||||
color: '#fff',
|
||||
fontSize: '28rpx',
|
||||
width: '80px',
|
||||
},
|
||||
keyword: '',
|
||||
categoryList: [],
|
||||
newList: [],
|
||||
hotList: [],
|
||||
maleWeekTopList: [],
|
||||
femaleWeekTopList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getInitData();
|
||||
},
|
||||
methods: {
|
||||
tabClick(e) {
|
||||
this.$emit('tabClick', e);
|
||||
},
|
||||
getInitData() {
|
||||
this.getHomeData();
|
||||
|
||||
UserApi.getWeekTopList().then(res => {
|
||||
this.maleWeekTopList = res.data.maleWeekTopList;
|
||||
this.femaleWeekTopList = res.data.femaleWeekTopList;
|
||||
});
|
||||
|
||||
},
|
||||
search() {
|
||||
this.$emit('search', this.keyword);
|
||||
},
|
||||
blindOrder() {
|
||||
this.chat();
|
||||
},
|
||||
slashed() {
|
||||
var that = this;
|
||||
uni.showModal({
|
||||
title: '首页置顶',
|
||||
content: '每次置顶3小时,可以累计置顶时间。累计时间越多,排名越靠前',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
that.submitSlashed();
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
getHomeData() {
|
||||
UserApi.getHomeData().then(res => {
|
||||
this.newList = res.data.memberNewList;
|
||||
this.hotList = res.data.memberHotList;
|
||||
});
|
||||
},
|
||||
submitSlashed() {
|
||||
UserApi.slashed().then(res => {
|
||||
if(res.data){
|
||||
this.getHomeData();
|
||||
}
|
||||
});
|
||||
},
|
||||
chat() {
|
||||
const isLogin = sheep.$store('user').isLogin;
|
||||
if(!isLogin) {
|
||||
showAuthModal();
|
||||
return;
|
||||
}
|
||||
|
||||
const userInfo = sheep.$store('user').userInfo;
|
||||
// 如果用户已经有头像和昵称,不要每次登录都要重新上传头像。
|
||||
if(userInfo.visible) {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.subscribeMessage();
|
||||
// #endif
|
||||
ImConversationApi.getRandomMemberConversation().then(res => {
|
||||
if(res.data){
|
||||
sheep.$router.go('/pages/im/index',{groupId: res.data.groupId, receiveUserId: res.data.userId});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 触发小程序授权信息弹框
|
||||
// #ifdef MP-WEIXIN
|
||||
showAuthModal('mpAuthorization');
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
showAuthModal('h5Authorization');
|
||||
// #endif
|
||||
},
|
||||
subscribeMessage() {
|
||||
const event = [WxaSubscribeTemplate.UNREAD_MESSAGE];
|
||||
sheep.$platform.useProvider('wechat').subscribeMessage(event, () => {
|
||||
// 订阅后记录一下订阅状态
|
||||
uni.removeStorageSync(WxaSubscribeTemplate.UNREAD_MESSAGE);
|
||||
uni.setStorageSync(WxaSubscribeTemplate.UNREAD_MESSAGE, '已订阅');
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.main-box {
|
||||
|
||||
.search-box {
|
||||
background-color: #fff;
|
||||
border-radius: 40px;
|
||||
padding: 3px;
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
.notice-box {
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.card-box {
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.category-box {
|
||||
padding: 15px;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.blind-box {
|
||||
padding: 0 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.blind-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
|
||||
.icon {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex: 1;
|
||||
|
||||
.btn {
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
border-radius: 40px;
|
||||
padding: 5px 10px;
|
||||
background-color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.menu-btn {
|
||||
position: fixed;
|
||||
bottom: 220rpx;
|
||||
right: 25rpx;
|
||||
z-index: 1;
|
||||
|
||||
.icon {
|
||||
background-color: #ffff;
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 100%;
|
||||
box-shadow: 0 0 10px #cccccc;
|
||||
margin-top: 70rpx;
|
||||
}
|
||||
|
||||
.img {
|
||||
height: 80rpx;
|
||||
width: 80rpx;
|
||||
border-radius: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
210
pages/tabbar/components/home/friend/userCard.vue
Normal file
210
pages/tabbar/components/home/friend/userCard.vue
Normal file
@@ -0,0 +1,210 @@
|
||||
<template>
|
||||
<view class="user-card-box">
|
||||
<view class="user-card">
|
||||
<view class="title">
|
||||
<view class="icon">
|
||||
<u-icon name="tuijian" custom-prefix="iconfont" size="20" color="#aaa"></u-icon>
|
||||
</view>
|
||||
<text class="text">新人推荐</text>
|
||||
</view>
|
||||
<scroll-view class="scroll-box" scroll-x>
|
||||
<view class="user-swiper">
|
||||
<view @click="detail(item)" class="user-box" v-for="(item,i) in newList">
|
||||
<view class="avatar-box">
|
||||
<u-avatar mode="square" size="140" :src="item.avatar"></u-avatar>
|
||||
<view v-if="item.onlineStatus" class="badge"></view>
|
||||
</view>
|
||||
<view class="nickname">{{item.nickname}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view class="user-card">
|
||||
<view class="title">
|
||||
<view class="icon">
|
||||
<u-icon name="huo" custom-prefix="iconfont" size="20" color="#aaa"></u-icon>
|
||||
</view>
|
||||
<text class="text">置顶用户</text>
|
||||
</view>
|
||||
<scroll-view class="scroll-box" scroll-x>
|
||||
<view class="user-swiper">
|
||||
|
||||
<view @click="detail(item)" class="user-box" v-for="(item,i) in orderList">
|
||||
<view class="avatar-box">
|
||||
<u-avatar mode="square" size="140" :src="item.avatar"></u-avatar>
|
||||
<view v-if="item.onlineStatus" class="badge"></view>
|
||||
<view class="count-down">
|
||||
<u-count-down :timestamp="item.timestamp" format="HH时mm分ss秒"></u-count-down>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nickname">{{item.nickname}}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import sheep from '@/sheep';
|
||||
import { showAuthModal } from '@/sheep/hooks/useModal';
|
||||
import ImConversationApi from '@/sheep/api/im/memberConversation';
|
||||
import { WxaSubscribeTemplate } from '@/sheep/util/const';
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {
|
||||
newList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
hotList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
orderList() {
|
||||
this.hotList.forEach((order) => order.timestamp = order.slashedTime ? sheep.$helper.parseTimeData(order.slashedTime) : 0);
|
||||
return this.hotList;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
detail(e) {
|
||||
sheep.$router.go('/pages/user/detail/index',{id: e.id});
|
||||
},
|
||||
chat(e) {
|
||||
const isLogin = sheep.$store('user').isLogin;
|
||||
if(!isLogin) {
|
||||
showAuthModal();
|
||||
return;
|
||||
}
|
||||
|
||||
const userInfo = sheep.$store('user').userInfo;
|
||||
// 如果用户已经有头像和昵称,不要每次登录都要重新上传头像。
|
||||
if(userInfo.visible) {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.subscribeMessage();
|
||||
// #endif
|
||||
ImConversationApi.createMemberConversation({
|
||||
userId: e.id,
|
||||
groupType: 1,
|
||||
lastMessageContentType: 1,
|
||||
}).then(res => {
|
||||
if(res.data){
|
||||
sheep.$router.go('/pages/im/index',{groupId: res.data, receiveUserId: e.id});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 触发小程序授权信息弹框
|
||||
// #ifdef MP-WEIXIN
|
||||
showAuthModal('mpAuthorization');
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
showAuthModal('h5Authorization');
|
||||
// #endif
|
||||
},
|
||||
subscribeMessage() {
|
||||
const event = [WxaSubscribeTemplate.UNREAD_MESSAGE];
|
||||
sheep.$platform.useProvider('wechat').subscribeMessage(event, () => {
|
||||
// 订阅后记录一下订阅状态
|
||||
uni.removeStorageSync(WxaSubscribeTemplate.UNREAD_MESSAGE);
|
||||
uni.setStorageSync(WxaSubscribeTemplate.UNREAD_MESSAGE, '已订阅');
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.user-card-box {
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
padding: 10px 0;
|
||||
|
||||
.title {
|
||||
padding: 10px;
|
||||
padding-top: 0;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: 15px;
|
||||
|
||||
.icon {
|
||||
background-color: #ddd;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.user-swiper {
|
||||
display: flex;
|
||||
|
||||
.avatar-box {
|
||||
margin-bottom: 5px;
|
||||
position: relative;
|
||||
|
||||
.badge {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-radius: 100%;
|
||||
border: 2px solid #fff;
|
||||
}
|
||||
|
||||
.count-down {
|
||||
font-size: 20rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.user-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-left: 10px;
|
||||
|
||||
.nickname {
|
||||
font-size: 28rpx;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 140rpx;
|
||||
text-align: center;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
78
pages/tabbar/components/home/navBar - 副本.vue
Normal file
78
pages/tabbar/components/home/navBar - 副本.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<view>
|
||||
<tui-navigation-bar :isOpacity="false" @init="initNavigation" @change="opacityChange" :scrollTop="scrollTop" backgroundColor="#fafafa" color="#333">
|
||||
<view>
|
||||
<view class="nav-box">
|
||||
<view style="width: 200px;">
|
||||
<u-tabs :list="list" bg-color="#fafafa" font-size="36" active-color="var(--ui-BG-Main)" :is-scroll="false" v-model="current" @change="change"></u-tabs>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</tui-navigation-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tuiNavigationBar from "@/components/thorui/tui-navigation-bar/tui-navigation-bar.vue";
|
||||
export default {
|
||||
components: {
|
||||
tuiNavigationBar,
|
||||
},
|
||||
props: {
|
||||
currentValue: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [{
|
||||
name: '搭子'
|
||||
}, {
|
||||
name: '服务'
|
||||
}, {
|
||||
name: '社交',
|
||||
}],
|
||||
|
||||
top: 0, //标题图标距离顶部距离
|
||||
opacity: 1,
|
||||
height: 0,
|
||||
scrollTop: 0.5,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
current() {
|
||||
return this.currentValue;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
initNavigation(e) {
|
||||
this.height = e.height;
|
||||
this.opacity = e.opacity;
|
||||
this.top = e.top;
|
||||
this.$emit('initNav', e);
|
||||
},
|
||||
opacityChange(e) {
|
||||
this.opacity = e.opacity;
|
||||
},
|
||||
change(index) {
|
||||
this.$emit('change', index);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.nav-box {
|
||||
height: 44px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
background-color: #fafafa;
|
||||
flex-direction: column;
|
||||
font-size: 22rpx;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
|
||||
</style>
|
106
pages/tabbar/components/home/navBar.vue
Normal file
106
pages/tabbar/components/home/navBar.vue
Normal file
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<view>
|
||||
<tui-navigation-bar :isOpacity="false" @init="initNavigation" @change="opacityChange" :scrollTop="scrollTop">
|
||||
<view class="tab-box">
|
||||
<view class="zhong">
|
||||
<view class="tab-box">
|
||||
<block v-for="(item,i) in tabList" :key="i">
|
||||
<view v-if="item.enabled" class="title-label" @click="tabsChange" :data-i="i" >
|
||||
<text
|
||||
:style="{fontWeight:current==i?'bold':'',fontSize:current==i?'36rpx':'28rpx'}">
|
||||
{{item.name}}
|
||||
</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</tui-navigation-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tuiNavigationBar from "@/components/thorui/tui-navigation-bar/tui-navigation-bar.vue";
|
||||
import sheep from '@/sheep';
|
||||
export default {
|
||||
components: {
|
||||
tuiNavigationBar,
|
||||
},
|
||||
props: {
|
||||
tabList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
top: 0, //标题图标距离顶部距离
|
||||
opacity: 1,
|
||||
height: 0,
|
||||
scrollTop: 0.5,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
current: {
|
||||
get() {
|
||||
return sheep.$store('sys').homeTabIndex;
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
initNavigation(e) {
|
||||
this.height = e.height;
|
||||
this.opacity = e.opacity;
|
||||
this.top = e.top;
|
||||
this.$emit('initNav', e);
|
||||
},
|
||||
opacityChange(e) {
|
||||
this.opacity = e.opacity;
|
||||
},
|
||||
tabsChange(e) {
|
||||
var current = e.currentTarget.dataset.i;
|
||||
sheep.$store('sys').setHomeTabIndex(current);
|
||||
this.$emit('change', current);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.zhong {
|
||||
//width: 230rpx;
|
||||
}
|
||||
|
||||
.tab-box {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
left: 40rpx;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-box .title-label {
|
||||
height: 44px;
|
||||
padding: 0 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
//font-size: 34rpx;
|
||||
}
|
||||
|
||||
.tab-box .title-label text {
|
||||
transition: all 0.3s;
|
||||
}
|
||||
</style>
|
112
pages/tabbar/components/home/noticeBar.vue
Normal file
112
pages/tabbar/components/home/noticeBar.vue
Normal file
@@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<view class="tui-rolling-news">
|
||||
<view class="title">
|
||||
<u-icon name="bell-fill" size="26" color='#fff'></u-icon>
|
||||
<text class="text">最新消息</text>
|
||||
</view>
|
||||
<swiper vertical autoplay circular interval="3000" class="tui-swiper">
|
||||
<swiper-item v-for="(item,index) in newsList" :key="index" class="tui-swiper-item">
|
||||
<view class="tui-news-item">{{item}}</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import sheep from '@/sheep';
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
newsList() {
|
||||
var giftList = sheep.$store('sys').giftList;
|
||||
var newsList = [];
|
||||
var that = this;
|
||||
giftList.forEach(function(item){
|
||||
var news = "【"+item.nickname+"】收到了好友赠送 "+ that.fen2yuan(item.payMoney)+" 颗"
|
||||
if(item.rewardType){
|
||||
news = "【"+item.nickname+"】收到好友赠送 "+item.name+" x"+item.count;
|
||||
}
|
||||
newsList.push(news);
|
||||
})
|
||||
return newsList;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
fen2yuan(price) {
|
||||
var f = 0;
|
||||
var p = (price / 100.0).toFixed(0);
|
||||
var p1 = (price / 100.0).toFixed(1);
|
||||
var p2 = (price / 100.0).toFixed(2);
|
||||
if(p*100 == price){
|
||||
f = 0;
|
||||
}else if(p1*100 == price){
|
||||
f = 1;
|
||||
}else if(p2*100 == price){
|
||||
f = 2;
|
||||
}
|
||||
return (price / 100.0).toFixed(f)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tui-rolling-news {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: nowrap;
|
||||
background-color: #fff;
|
||||
border-radius: 40px;
|
||||
height: 30px;
|
||||
|
||||
.title {
|
||||
background-color: var(--ui-BG-Main);
|
||||
height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
border-top-left-radius: 20px;
|
||||
border-top-right-radius: 20px;
|
||||
border-bottom-left-radius: 20px;
|
||||
padding: 10px;
|
||||
margin-right: 10px;
|
||||
font-size: 24rpx;
|
||||
|
||||
.text {
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tui-swiper {
|
||||
font-size: 24rpx;
|
||||
height: 50rpx;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.tui-swiper-item {
|
||||
display: flex;
|
||||
align-items: center
|
||||
}
|
||||
|
||||
.tui-news-item {
|
||||
line-height: 24rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
58
pages/tabbar/components/home/peiwan.vue
Normal file
58
pages/tabbar/components/home/peiwan.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<view>
|
||||
<top-box @tabClick="tabClick" @search="search" @categoryClick="categoryClick" :scrollTop="scrollTop" :stickyTop="stickyTop"></top-box>
|
||||
<view class="data-box">
|
||||
<user-list :virtualList="virtualList"></user-list>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import topBox from '@/pages/tabbar/components/home/topBox.vue';
|
||||
import UserList from '@/pages/tabbar/components/home/userList.vue';
|
||||
export default {
|
||||
components: {
|
||||
topBox,
|
||||
UserList,
|
||||
},
|
||||
props: {
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
stickyTop: {
|
||||
type: Number,
|
||||
default: uni.upx2px(80),
|
||||
},
|
||||
virtualList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
tabClick(e) {
|
||||
this.$emit('tabClick', e);
|
||||
},
|
||||
search(e) {
|
||||
this.$emit('search', e);
|
||||
},
|
||||
categoryClick(e) {
|
||||
this.$emit('categoryClick', e);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.data-box {
|
||||
padding: 0 15px;
|
||||
}
|
||||
</style>
|
198
pages/tabbar/components/home/rankBox.vue
Normal file
198
pages/tabbar/components/home/rankBox.vue
Normal file
@@ -0,0 +1,198 @@
|
||||
<template>
|
||||
<view class="rank-box">
|
||||
<view class="tab-box">
|
||||
<tui-tabs width="200" unlined :tabs="tabList" badgeBgColor="var(--ui-BG-Main)" selectedColor="var(--ui-BG-Main)" sliderBgColor="var(--ui-BG-Main)" :currentTab="current" @change="change"></tui-tabs>
|
||||
</view>
|
||||
<view class="user-box">
|
||||
<view class="avatar-box two" @click="detail(1)">
|
||||
<view class="img-box">
|
||||
<img v-if="list[1]" class="img" :src="list[1].avatar"></img>
|
||||
<img v-else class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/a0b0a27972615aee024a6e36f0a7e9e399e477ae55b7eec2b32032a6cc8bb268.png"></img>
|
||||
<img class="two-icon" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/03072abb5a8c90a4f457549b8394d3c3db2a652410692d732b5c25f2478e3a85.png"></img>
|
||||
</view>
|
||||
<view class="nickname" v-if="list[1]">{{list[1].nickname}}</view>
|
||||
<view class="nickname" v-else>???</view>
|
||||
</view>
|
||||
<view class="avatar-box one" @click="detail(0)">
|
||||
<view class="img-box">
|
||||
<img v-if="list[0]" class="img" :src="list[0].avatar"></img>
|
||||
<img v-else class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/a0b0a27972615aee024a6e36f0a7e9e399e477ae55b7eec2b32032a6cc8bb268.png"></img>
|
||||
<img class="two-icon" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/d191aec3b3d6e95c1dcb3bace7bffe28834f4fb062a9675aeaa1ae42a9bbc366.png"></img>
|
||||
</view>
|
||||
<view class="nickname" v-if="list[0]">{{list[0].nickname}}</view>
|
||||
<view class="nickname" v-else>???</view>
|
||||
</view>
|
||||
<view class="avatar-box three" @click="detail(2)">
|
||||
<view class="img-box">
|
||||
<img v-if="list[2]" class="img" :src="list[2].avatar"></img>
|
||||
<img v-else class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/a0b0a27972615aee024a6e36f0a7e9e399e477ae55b7eec2b32032a6cc8bb268.png"></img>
|
||||
<img class="two-icon" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/27209281e1b0e00dcc112bae4d06c14b089ec2f74db14b62eca4cbc0cf741cff.png"></img>
|
||||
</view>
|
||||
<view class="nickname" v-if="list[2]">{{list[2].nickname}}</view>
|
||||
<view class="nickname" v-else>???</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="time-box">更新时间: {{updateTime}}</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tuiTabs from "@/components/thorui/tui-tabs/tui-tabs.vue"
|
||||
import dayjs from 'dayjs';
|
||||
export default {
|
||||
components: {
|
||||
tuiTabs
|
||||
},
|
||||
props: {
|
||||
maleWeekTopList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
femaleWeekTopList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
current: 0,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
updateTime() {
|
||||
this.list = this.femaleWeekTopList;
|
||||
|
||||
// 获取当前日期和时间
|
||||
const now = dayjs();
|
||||
const nowDays = now.format('MM/DD');
|
||||
const sevenDaysAgo = now.subtract(7, 'day').format('MM/DD');
|
||||
return sevenDaysAgo + '-' + nowDays
|
||||
},
|
||||
tabList() {
|
||||
return [{
|
||||
name: '女神榜',
|
||||
list: this.femaleWeekTopList,
|
||||
}, {
|
||||
name: '男神榜',
|
||||
list: this.maleWeekTopList,
|
||||
}];
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
change(e) {
|
||||
this.current = e.index;
|
||||
this.list = this.tabList[e.index].list;
|
||||
},
|
||||
detail(e) {
|
||||
if(this.list[e]){
|
||||
this.$u.route({
|
||||
url: 'pages/clerk/detail/index',
|
||||
params: {
|
||||
id: this.list[e].id,
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.rank-box {
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 15px;
|
||||
border-radius: 10px;
|
||||
padding: 15px;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-top: 5px;
|
||||
|
||||
.tab-box {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.user-box {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
|
||||
.nickname {
|
||||
margin-top: 10px;
|
||||
font-size: 28rpx;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 160rpx;
|
||||
text-align: center;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
|
||||
.img-box {
|
||||
height: 200rpx;
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.two-icon {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
position: absolute;
|
||||
bottom: -8px;
|
||||
}
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.one{
|
||||
color: #fed530;
|
||||
|
||||
.img {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border: 2px solid #fed530;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.two {
|
||||
color: #d8d8d8;
|
||||
|
||||
.img {
|
||||
border: 2px solid #d8d8d8;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.three {
|
||||
color: #ef9e3f;
|
||||
|
||||
.img {
|
||||
border: 2px solid #ef9e3f;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.time-box {
|
||||
padding-top: 15px;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
</style>
|
61
pages/tabbar/components/home/sexSheet.vue
Normal file
61
pages/tabbar/components/home/sexSheet.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<view>
|
||||
<tui-actionsheet zIndex="9999"
|
||||
:show="showActionSheet"
|
||||
:item-list="itemList"
|
||||
@click="itemClick"
|
||||
@cancel="closeActionSheet">
|
||||
</tui-actionsheet>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tuiActionsheet from "@/components/thorui/tui-actionsheet/tui-actionsheet.vue"
|
||||
export default {
|
||||
components: {
|
||||
tuiActionsheet,
|
||||
},
|
||||
props: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showActionSheet: false,
|
||||
itemList: [{
|
||||
text: "全部",
|
||||
label: '性别',
|
||||
value: '',
|
||||
color: "#2B2B2B"
|
||||
}, {
|
||||
text: "男生",
|
||||
label: '性别:男',
|
||||
value: '0',
|
||||
color: "#2B2B2B"
|
||||
}, {
|
||||
text: "女生",
|
||||
label: '性别:女',
|
||||
value: '1',
|
||||
color: "#2B2B2B"
|
||||
}],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//隐藏组件
|
||||
closeActionSheet() {
|
||||
this.showActionSheet = false
|
||||
},
|
||||
//调用此方法显示组件
|
||||
openActionSheet() {
|
||||
this.showActionSheet = true;
|
||||
},
|
||||
itemClick(e) {
|
||||
this.$emit('sexOk', e);
|
||||
this.closeActionSheet();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
118
pages/tabbar/components/home/stickyBox.vue
Normal file
118
pages/tabbar/components/home/stickyBox.vue
Normal file
@@ -0,0 +1,118 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="tag-box">
|
||||
<view class="title">
|
||||
<view class="icon">
|
||||
<u-icon name="account-fill" size="20" color="#aaa"></u-icon>
|
||||
</view>
|
||||
<text class="text">更多达人</text>
|
||||
</view>
|
||||
<view class="sticky-box">
|
||||
<view class="btn-tag" @click="tabClick('category')">
|
||||
<text class="text">{{searchTabs.categoryLabel}}</text>
|
||||
<u-icon name="arrow-down" size="20" color="#aaa"></u-icon>
|
||||
</view>
|
||||
<view class="btn-tag" @click="tabClick('sex')">
|
||||
<text class="text">{{searchTabs.sexLabel}}</text>
|
||||
<u-icon name="arrow-down" size="20" color="#aaa"></u-icon>
|
||||
</view>
|
||||
<!-- <view class="btn-tag" @click="tabClick('level')">
|
||||
<text class="text">等级</text>
|
||||
<u-icon name="arrow-down" size="20" color="#aaa"></u-icon>
|
||||
</view> -->
|
||||
<!-- <view class="btn-tag" @click="tabClick('city')">
|
||||
<text class="text">城市</text>
|
||||
<u-icon name="arrow-down" size="20" color="#aaa"></u-icon>
|
||||
</view> -->
|
||||
<!-- <view class="btn-tag" @click="tabClick('city')">
|
||||
<text class="text">筛选</text>
|
||||
<u-icon name="shaixuan" custom-prefix="iconfont" size="20" color="#aaa"></u-icon>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import sheep from '@/sheep';
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
stickyTop: {
|
||||
type: Number,
|
||||
default: uni.upx2px(80),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
searchTabs() {
|
||||
return sheep.$store('sys').searchTabs;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
tabClick(e) {
|
||||
this.$emit('tabClick', e);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tag-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15px;
|
||||
background-color: #fafafa;
|
||||
height: 100rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
|
||||
.icon {
|
||||
background-color: #ddd;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.sticky-box {
|
||||
display: flex;
|
||||
|
||||
.btn-tag {
|
||||
background-color: #fff;
|
||||
border-radius: 40px;
|
||||
margin-left: 5px;
|
||||
padding: 0px 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 24rpx;
|
||||
height: 48rpx;
|
||||
|
||||
.text {
|
||||
margin-right: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
183
pages/tabbar/components/home/topBox.vue
Normal file
183
pages/tabbar/components/home/topBox.vue
Normal file
@@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<view class="main-box">
|
||||
<view class="search-box">
|
||||
<u-search @custom="search" placeholder="可搜索达人名称/标签" bg-color="#fff" input-align="left" :action-style="actionStyle" v-model="keyword"></u-search>
|
||||
</view>
|
||||
|
||||
<view class="notice-box">
|
||||
<notice-bar></notice-bar>
|
||||
</view>
|
||||
|
||||
<view class="blind-box">
|
||||
<view class="blind-card">
|
||||
<view class="icon">
|
||||
<image style="width: 88rpx;height: 88rpx;" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/1d291d514fe8833f941924f273a5deb8f2cc8c06680fd49b6c08c58b16338c93.png"></image>
|
||||
</view>
|
||||
<view class="avatar-box">
|
||||
<image style="width: 320rpx;height: 64rpx;" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/41888275859ee7d4663bfcbd322a55ac3da9bbfc3621ca8a1137f39b2fde47bd.png"></image>
|
||||
<view @click="blindOrder" class="btn">随机下单</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<rank-box :femaleWeekTopList="femaleWeekTopList" :maleWeekTopList="maleWeekTopList"></rank-box>
|
||||
</view>
|
||||
|
||||
<view class="card-box">
|
||||
<user-card :newList="newList" :hotList="hotList"></user-card>
|
||||
</view>
|
||||
|
||||
<view class="category-box">
|
||||
<category-card @tabClick="getCategory" :dataList="categoryList"></category-card>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<sticky-box @tabClick="tabClick" :scrollTop="scrollTop" :stickyTop="stickyTop"></sticky-box>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NoticeBar from '@/pages/tabbar/components/home/noticeBar.vue';
|
||||
import StickyBox from '@/pages/tabbar/components/home/stickyBox.vue';
|
||||
import RankBox from '@/pages/tabbar/components/home/rankBox.vue';
|
||||
import UserCard from '@/pages/tabbar/components/home/userCard.vue';
|
||||
import CategoryCard from '@/pages/tabbar/components/home/categoryCard.vue';
|
||||
import ClerkApi from '@/sheep/api/worker/clerk';
|
||||
import RewardApi from '@/sheep/api/worker/reward';
|
||||
import sheep from '@/sheep';
|
||||
export default {
|
||||
components: {
|
||||
NoticeBar,
|
||||
RankBox,
|
||||
StickyBox,
|
||||
UserCard,
|
||||
CategoryCard,
|
||||
},
|
||||
props: {
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
stickyTop: {
|
||||
type: Number,
|
||||
default: uni.upx2px(80),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
actionStyle: {
|
||||
backgroundColor: 'var(--ui-BG-Main)',
|
||||
borderRadius: '40px',
|
||||
padding: '7px',
|
||||
color: '#fff',
|
||||
fontSize: '28rpx',
|
||||
width: '80px',
|
||||
},
|
||||
keyword: '',
|
||||
categoryList: [],
|
||||
newList: [],
|
||||
hotList: [],
|
||||
maleWeekTopList: [],
|
||||
femaleWeekTopList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getInitData();
|
||||
},
|
||||
methods: {
|
||||
tabClick(e) {
|
||||
this.$emit('tabClick', e);
|
||||
},
|
||||
getCategory(e) {
|
||||
ClerkApi.getCategoryListByParentId(e.id).then(res => {
|
||||
this.$emit('categoryClick', e);
|
||||
if(res.data.length > 0){
|
||||
sheep.$store('sys').setCategoryList(res.data);
|
||||
}else{
|
||||
sheep.$store('sys').setCategoryList(this.categoryList);
|
||||
}
|
||||
});
|
||||
},
|
||||
getInitData() {
|
||||
ClerkApi.getHomeData().then(res => {
|
||||
this.categoryList = res.data.categoryList;
|
||||
this.newList = res.data.clerkNewList;
|
||||
this.hotList = res.data.clerkHotList;
|
||||
sheep.$store('sys').setCategoryList(this.categoryList);
|
||||
});
|
||||
|
||||
ClerkApi.getWeekTopList().then(res => {
|
||||
this.maleWeekTopList = res.data.maleWeekTopList;
|
||||
this.femaleWeekTopList = res.data.femaleWeekTopList;
|
||||
});
|
||||
|
||||
},
|
||||
search() {
|
||||
this.$emit('search', this.keyword);
|
||||
},
|
||||
blindOrder() {
|
||||
sheep.$router.go('/pages/worker/blind/index');
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.main-box {
|
||||
|
||||
.search-box {
|
||||
background-color: #fff;
|
||||
border-radius: 40px;
|
||||
padding: 3px;
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
.notice-box {
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.card-box {
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.category-box {
|
||||
padding: 15px;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.blind-box {
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.blind-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
|
||||
.icon {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex: 1;
|
||||
|
||||
.btn {
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
border-radius: 40px;
|
||||
padding: 5px 10px;
|
||||
background-color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
153
pages/tabbar/components/home/userCard.vue
Normal file
153
pages/tabbar/components/home/userCard.vue
Normal file
@@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<view class="user-card-box">
|
||||
<view class="user-card">
|
||||
<view class="title">
|
||||
<view class="icon">
|
||||
<u-icon name="tuijian" custom-prefix="iconfont" size="20" color="#aaa"></u-icon>
|
||||
</view>
|
||||
<text class="text">新人推荐</text>
|
||||
</view>
|
||||
<scroll-view class="scroll-box" scroll-x>
|
||||
<view class="user-swiper">
|
||||
<view @click="detail(item)" class="user-box" v-for="(item,i) in newList">
|
||||
<view class="avatar-box">
|
||||
<u-avatar mode="square" size="140" :src="item.avatar"></u-avatar>
|
||||
<view v-if="item.onlineStatus" class="badge"></view>
|
||||
</view>
|
||||
<view class="nickname">{{item.nickname}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view class="user-card">
|
||||
<view class="title">
|
||||
<view class="icon">
|
||||
<u-icon name="huo" custom-prefix="iconfont" size="20" color="#aaa"></u-icon>
|
||||
</view>
|
||||
<text class="text">人气达人</text>
|
||||
</view>
|
||||
<scroll-view class="scroll-box" scroll-x>
|
||||
<view class="user-swiper">
|
||||
|
||||
<view @click="detail(item)" class="user-box" v-for="(item,i) in hotList">
|
||||
<view class="avatar-box">
|
||||
<u-avatar mode="square" size="140" :src="item.avatar"></u-avatar>
|
||||
<view v-if="item.onlineStatus" class="badge"></view>
|
||||
</view>
|
||||
<view class="nickname">{{item.nickname}}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {
|
||||
newList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
hotList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
detail(e) {
|
||||
this.$u.route({
|
||||
url: 'pages/clerk/detail/index',
|
||||
params: {
|
||||
id: e.id,
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.user-card-box {
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
padding: 10px 0;
|
||||
|
||||
.title {
|
||||
padding: 10px;
|
||||
padding-top: 0;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: 15px;
|
||||
|
||||
.icon {
|
||||
background-color: #ddd;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.user-swiper {
|
||||
display: flex;
|
||||
|
||||
.avatar-box {
|
||||
margin-bottom: 5px;
|
||||
position: relative;
|
||||
|
||||
.badge {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-radius: 100%;
|
||||
border: 2px solid #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.user-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-left: 10px;
|
||||
|
||||
.nickname {
|
||||
font-size: 28rpx;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 140rpx;
|
||||
text-align: center;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
379
pages/tabbar/components/home/userList.vue
Normal file
379
pages/tabbar/components/home/userList.vue
Normal file
@@ -0,0 +1,379 @@
|
||||
<template>
|
||||
<view @click="detail(item)" :id="`zp-id-${item.zp_index}`" :key="item.zp_index" v-for="(item,index) in virtualList" class="user-card">
|
||||
<view class="avatar-box">
|
||||
<u-avatar mode="square" size="180" :src="item.avatar"></u-avatar>
|
||||
<view class="voice-play" v-if="item.sound">
|
||||
<voice-play :sec="item.soundTime" @tap.stop="playAudio(item)" :isPlay="item.id == playId"></voice-play>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right-box">
|
||||
<view class="top-box">
|
||||
<view class="nickname-box">
|
||||
<view class="nickname">{{item.nickname}}</view>
|
||||
<view class="sex-nv" v-if="item.sex == 1">
|
||||
<u-icon name="ziyuan2" size="22" custom-prefix="iconfont"></u-icon>
|
||||
<text>{{item.age}}</text>
|
||||
</view>
|
||||
<view class="sex-nan" v-if="item.sex == 0">
|
||||
<u-icon name="ziyuan3" size="22" custom-prefix="iconfont"></u-icon>
|
||||
<text>{{item.age}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="map-box">
|
||||
<u-icon name="map" size="32" color="#aaa"></u-icon>
|
||||
<view class="city" v-if="item.city">
|
||||
<text class="text">{{item.city}}</text>
|
||||
</view>
|
||||
<text v-else>未知</text>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="oline-box">
|
||||
<view v-if="item.clerkLevel">
|
||||
<view class="img-icon" v-if="item.clerkLevel.img">
|
||||
<img style="width: 100%;height: 100%;" :src="item.clerkLevel.img"></img>
|
||||
</view>
|
||||
<view class="icon" v-else>
|
||||
<u-icon name="wode_duanwei" size="36" custom-prefix="iconfont"></u-icon>
|
||||
<text>{{item.clerkLevel.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="badge-box">
|
||||
<view class="online" v-if="item.onlineStatus">
|
||||
<tui-badge :scaleRatio="0.8" type="green" dot></tui-badge>
|
||||
<text class="text">在线</text>
|
||||
</view>
|
||||
<view class="online" v-else>
|
||||
<tui-badge :scaleRatio="0.8" type="gray" dot></tui-badge>
|
||||
<text class="text">离线</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tag-list">
|
||||
<view class="tag-box">
|
||||
<span class="tag" v-for="(categoryName,index) in item.categoryNameList">{{categoryName}}</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="note-box">
|
||||
<u-icon name="tingkebiji" custom-prefix="iconfont" size="36" color="#3cc9a4"></u-icon>
|
||||
<view class="text">{{item.intro}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-btn">
|
||||
|
||||
<!-- <view class="icon" @click="toApply">
|
||||
<image class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/9966c9c45969e2b33987642950d9061c0471c1fa352f9a60825a4e88595090b8.png"></image>
|
||||
</view>
|
||||
|
||||
<view class="icon" @click="fenxiao">
|
||||
<image class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/8225510a565cf510a4ee26c6997aa2d967de4bc35f05e12558dae9e42ce8581a.png"></image>
|
||||
</view> -->
|
||||
|
||||
<!-- <view class="icon" @click="xiadan">
|
||||
<image class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/c50c079a74fcf57d5fbadc3b3354316eab6ce6de7ac382d5e0bb587bbffabbcf.png"></image>
|
||||
</view>
|
||||
|
||||
<view class="icon" @click="toKaidian">
|
||||
<image class="img" src="https://rbtnet.oss-cn-hangzhou.aliyuncs.com/4f453e94e7bccc7a0361e4baa004beafdec4f287db010d044d860863f969f3bb.png"></image>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import VoicePlay from '@/pages/tabbar/components/home/voicePlay.vue';
|
||||
import TuiBadge from "@/components/thorui/tui-badge/tui-badge.vue";
|
||||
import sheep from '@/sheep';
|
||||
const audio = uni.createInnerAudioContext();
|
||||
export default {
|
||||
components: {
|
||||
VoicePlay,
|
||||
TuiBadge,
|
||||
},
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
virtualList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
playId: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
playAudio(e) {
|
||||
if(this.playId == e.id){
|
||||
this.playId = null;
|
||||
audio.stop();
|
||||
return;
|
||||
}
|
||||
this.playId = e.id;
|
||||
//语音自然播放结束
|
||||
audio.onEnded((res) => {
|
||||
this.playId = null;
|
||||
});
|
||||
audio.src = e.sound;
|
||||
audio.play();
|
||||
},
|
||||
detail(e) {
|
||||
this.$u.route({
|
||||
url: 'pages/clerk/detail/index',
|
||||
params: {
|
||||
id: e.id,
|
||||
}
|
||||
});
|
||||
},
|
||||
toApply() {
|
||||
uni.showModal({
|
||||
title: '达人申请',
|
||||
content: '请确认是否成年,未成年禁止申请,申请后会有客服添加进行微信实名认证!',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
sheep.$router.go('/pages/clerk/apply/index');
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
toKaidian() {
|
||||
uni.showModal({
|
||||
title: '搭建同款',
|
||||
content: '搭建同款请联系客服微信:rbtnet',
|
||||
success: function (res) {
|
||||
|
||||
},
|
||||
});
|
||||
},
|
||||
xiadan() {
|
||||
sheep.$router.go('/pages/worker/blind/index');
|
||||
},
|
||||
fenxiao() {
|
||||
uni.showModal({
|
||||
title: '分销申请',
|
||||
content: '点击邀请海报,生成海报,生成邀请码,邀请一人下单,可得下单20%佣金!',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
sheep.$router.go('/pages/commission/index');
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.user-card {
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.user-card:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.voice-play {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.right-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
margin-left: 10px;
|
||||
min-width: 0;
|
||||
|
||||
.top-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.nickname-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.nickname {
|
||||
font-size: 28rpx;
|
||||
font-weight: bolder;
|
||||
margin-right: 4px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
max-width: 200rpx;
|
||||
}
|
||||
|
||||
.sex-nv {
|
||||
background-color: #d5656f;
|
||||
border-radius: 40px;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
padding: 1px 5px;
|
||||
}
|
||||
|
||||
.sex-nan {
|
||||
background-color: #0081ff;
|
||||
border-radius: 40px;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
padding: 1px 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.map-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 22rpx;
|
||||
color: #aaa;
|
||||
|
||||
.city {
|
||||
display: flex;
|
||||
|
||||
.text {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
max-width: 88rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.oline-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.img-icon {
|
||||
width: 40rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
|
||||
.icon {
|
||||
background-color: #ff5ebd;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 40px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
line-height: 22rpx;
|
||||
padding: 5px 5px;
|
||||
}
|
||||
|
||||
.badge-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 26rpx;
|
||||
color: #aaa;
|
||||
|
||||
.online {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tag-list {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
display: inline-block;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
background-color: #eef2f2;
|
||||
border-radius: 3px;
|
||||
color: #aaa;
|
||||
font-size: 24rpx;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
padding: 5px 0;
|
||||
|
||||
.tag {
|
||||
white-space: nowrap;
|
||||
padding: 5px 5px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tag:after {
|
||||
content: ' ';
|
||||
border-left: 1px solid #aaa;
|
||||
display: inline-block;
|
||||
height: 10px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.tag:last-child:after{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.note-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #aaa;
|
||||
font-size: 24rpx;
|
||||
|
||||
.text {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.menu-btn {
|
||||
position: fixed;
|
||||
bottom: 220rpx;
|
||||
right: 25rpx;
|
||||
|
||||
.icon {
|
||||
background-color: #ffff;
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 100%;
|
||||
box-shadow: 0 0 10px #cccccc;
|
||||
margin-top: 70rpx;
|
||||
}
|
||||
|
||||
.img {
|
||||
height: 80rpx;
|
||||
width: 80rpx;
|
||||
border-radius: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
184
pages/tabbar/components/home/voicePlay.vue
Normal file
184
pages/tabbar/components/home/voicePlay.vue
Normal file
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<view class="voice-btn" @click="playBtn" :class="play?'audioplaying':''">
|
||||
<img class="play-btn" src="@/static/images/audio.png"></img>
|
||||
<view class="audio-box">
|
||||
<view class="audio1 wave1"></view>
|
||||
<view class="audio2 wave2"></view>
|
||||
<view class="audio3 wave3"></view>
|
||||
<view class="audio2 wave2"></view>
|
||||
<view class="audio1 wave1"></view>
|
||||
<view class="audio2 wave2"></view>
|
||||
<view class="audio3 wave3"></view>
|
||||
<view class="audio2 wave2"></view>
|
||||
<view class="audio1 wave1"></view>
|
||||
<view class="audio2 wave2"></view>
|
||||
<view class="audio3 wave3"></view>
|
||||
<view class="audio2 wave2"></view>
|
||||
</view>
|
||||
<view>{{sec}}"</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
emits: ['playAudio'],
|
||||
props: {
|
||||
isPlay: {
|
||||
type: [Boolean],
|
||||
default: false
|
||||
},
|
||||
sec: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
play: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
isPlay: {
|
||||
handler(newVal) {
|
||||
this.play = newVal;
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
playBtn() {
|
||||
/* if(this.play){
|
||||
this.play = false;
|
||||
}else{
|
||||
this.play = true;
|
||||
} */
|
||||
this.$emit('playAudio');
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
view{
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.voice-btn {
|
||||
background-color: #3cc9a4;
|
||||
width: 140rpx;
|
||||
border-radius: 20px;
|
||||
padding: 8rpx 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.play-btn {
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
}
|
||||
|
||||
.audio-box {
|
||||
height: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.audio1{
|
||||
margin-right: 2rpx;
|
||||
width: 1px;
|
||||
height: 33.3%;
|
||||
border-radius: 50px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.audio2{
|
||||
margin-right: 2rpx;
|
||||
width: 1px;
|
||||
height: 66.6%;
|
||||
border-radius: 50px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.audio3{
|
||||
margin-right: 2rpx;
|
||||
width: 1px;
|
||||
height: 100%;
|
||||
border-radius: 50px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.audioplaying .wave1 {
|
||||
animation: wave1 1s linear 0s infinite;
|
||||
}
|
||||
|
||||
.audioplaying .wave2 {
|
||||
animation: wave2 1s linear 0s infinite;
|
||||
}
|
||||
|
||||
.audioplaying .wave3 {
|
||||
animation: wave3 1s linear 0s infinite;
|
||||
}
|
||||
|
||||
@keyframes wave1{
|
||||
0% {
|
||||
width: 1px;
|
||||
height: 33%;
|
||||
}
|
||||
25% {
|
||||
width: 1px;
|
||||
height: 66%;
|
||||
}
|
||||
50% {
|
||||
width: 1px;
|
||||
height: 100%;
|
||||
}
|
||||
75% {
|
||||
width: 1px;
|
||||
height: 66%;
|
||||
}
|
||||
100% {
|
||||
width: 1px;
|
||||
height: 33%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes wave2{
|
||||
0% {
|
||||
width: 1px;
|
||||
height: 66%;
|
||||
}
|
||||
25% {
|
||||
width: 1px;
|
||||
height: 33%;
|
||||
}
|
||||
50% {
|
||||
width: 1px;
|
||||
height: 66%;
|
||||
}
|
||||
75% {
|
||||
width: 1px;
|
||||
height: 100%;
|
||||
}
|
||||
100% {
|
||||
width: 1px;
|
||||
height: 66%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes wave3{
|
||||
0% {
|
||||
width: 1px;
|
||||
height: 100%;
|
||||
}
|
||||
50% {
|
||||
width: 1px;
|
||||
height: 33%;
|
||||
}
|
||||
100% {
|
||||
width: 1px;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
Reference in New Issue
Block a user