liuyongli 3 years ago
parent 7ad3d81dc4
commit b52c85a3f7

@ -3,12 +3,9 @@
"pages/index/index",
"pages/bar/index",
"pages/insight/index",
<<<<<<< HEAD
=======
"pages/brandSearch/index",
"pages/varComm/index",
"pages/mine/index",
>>>>>>> 275ac3229537c1c42647ab6a5f402be5c1ea5aee
"pages/logs/logs"
],
"window": {

@ -4,45 +4,50 @@ const app = getApp()
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo'),
canIUseGetUserProfile: false,
canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false
},
// 事件处理函数
bindViewTap() {
wx.navigateTo({
url: '../logs/logs'
})
condition: ['二十四小时','最近七天','最近三十天','自定义'],
toplist: [
{
url: '',
title: '入库数据总量',
num: '0'
}, {
url: '',
title: '微博数据',
num: '0'
}, {
url: '',
title: '其他数据',
num: '0'
},
{
url: '',
title: '短视频数据',
num: '0'
},
{
url: '',
title: '微信数据',
num: '0'
},
{
url: '',
title: 'APP数据',
num: '0'
},
{
url: '',
title: '论坛数据',
num: '0'
},
{
url: '',
title: '新闻数据',
num: '0'
},
],
},
onLoad() {
if (wx.getUserProfile) {
this.setData({
canIUseGetUserProfile: true
})
}
},
getUserProfile(e) {
// 推荐使用wx.getUserProfile获取用户信息开发者每次通过该接口获取用户个人信息均需用户确认开发者妥善保管用户快速填写的头像昵称避免重复弹窗
wx.getUserProfile({
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
console.log(res)
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
},
getUserInfo(e) {
// 不推荐使用getUserInfo获取用户信息预计自2021年4月13日起getUserInfo将不再弹出弹窗并直接返回匿名的用户个人信息
console.log(e)
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
})

@ -1,3 +1,7 @@
{
"usingComponents": {}
"usingComponents": {},
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#006BFF",
"navigationBarTitleText": "硕为思汽车智能洞查",
"navigationBarTextStyle": "white"
}

@ -1,23 +1,21 @@
<!--index.wxml-->
<view class="container">
<view class="userinfo">
<block wx:if="{{canIUseOpenData}}">
<view class="userinfo-avatar" bindtap="bindViewTap">
<open-data type="userAvatarUrl"></open-data>
<scroll-view class="scrollList" scroll-x="true" enable-flex="true">
<text wx:for="{{condition}}" class="{{index === 0 ? 'actived' : ''}}">{{item}}</text>
</scroll-view>
<view class="top">
<!-- <view style="width: 100%;position: fixed;left: 0rpx;">
<image class="logo1" src="" style="width: 286rpx;height: 24rpx;"></image>
<image class="logo2" src="" style="width: 750rpx;height: 100rpx;"></image>
</view> -->
<view wx:for="{{toplist}}" wx:key="url" class="top_box">
<view class="box_image">
<image style="width: 100%;height: 100%;" src="{{item.url}}"></image>
</view>
<open-data type="userNickName"></open-data>
</block>
<block wx:elif="{{!hasUserInfo}}">
<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
<button wx:elif="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<view wx:else> 请使用1.4.4及以上版本基础库 </view>
</block>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
<view class="box_bot">
<view class="box_title">{{item.title}}</view>
<view class="box_num">{{item.num}}</view>
</view>
</view>
</view>
</view>
</view>

@ -1,19 +1,95 @@
/**index.wxss**/
.userinfo {
.scrollList{
width: calc(100% - 48rpx);
display: flex;
text-align: center;
justify-content: center;
height: 80rpx;
background: #fff;
}
.scrollList text{
background: #F6F6F6;
border-radius: 2px;
font-size: 28rpx;
color: #999999;
margin:0 8rpx;
padding: 18rpx 24rpx;
height: min-content;
flex-shrink: 0;
}
.scrollList .actived{
font-size: 12px;
font-weight: bold;
color: #027AFF;
background: #F0F5FF;
}
/* .condition{
height: 50rpx;
background-color: #027AFF;
margin: 32rpx 32rpx 48rpx 32rpx;
display: grid;
grid-template-columns: repeat(4,1fr);
grid-gap: 32rpx;
} */
.condition text{
text-align: center;
background: #FAFBFD;
border-radius: 4rpx;
font-size: 10px;
color: #333333;
padding: 16rpx 24rpx;
}
.condition .active{
color: #027AFF;
}
.top {
/* background-color: #006BFF; */
height: 556rpx;
width: 100%;
border-bottom-left-radius: 56rpx;
display: flex;
/* overflow: scroll; */
padding-left: 1rem;
padding-right: 1rem;
/* position: sticky; */
top: 0rpx;
z-index: 5;
}
::-webkit-scrollbar {
/*隐藏滚轮*/
display: none;
}
.top_box {
background-color: white;
padding-top: 0.4rem;
flex-shrink: 0;
width: 160rpx;
height: 228rpx;
border-radius: 10%;
margin-top: 266rpx;
display: flex;
flex-direction: column;
align-items: center;
color: #aaa;
justify-content: space-around;
padding-left: 36rpx;
margin-right: 1rem;
z-index: 10;
}
.userinfo-avatar {
overflow: hidden;
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
.box_image {
width: 70rpx;
height: 70rpx;
border-radius: 6rem;
box-shadow: #FFDEC5 0rem 0.5rem 1rem;
}
.usermotto {
margin-top: 200px;
}
.box_title {
color: #999999;
font-size: 24rpx;
margin-bottom: 16rpx;
}
.box_num {
font-weight: 900;
font-size: 28rpx;
}

Loading…
Cancel
Save