Browse Source

tabbar组件,社区满意度自查文字大小

jw-featrue-zhanlibiao
mk 2 years ago
parent
commit
8d9027fa9e
  1. 4
      README.md
  2. 1
      app.js
  3. 50
      components/custom-tab-bar/index.js
  4. 4
      components/custom-tab-bar/index.json
  5. 17
      components/custom-tab-bar/index.wxml
  6. 38
      components/custom-tab-bar/index.wxss
  7. BIN
      images/home/message.png
  8. 3
      pages/index/index.json
  9. 2
      pages/index/index.wxml
  10. 4
      pages/mine/mine.json
  11. 1
      pages/mine/mine.wxml
  12. 4
      pages/statistics/statistics.json
  13. 3
      pages/statistics/statistics.wxml
  14. 12
      pages/work/work.js
  15. 5
      pages/work/work.json
  16. 3
      pages/work/work.wxml
  17. 3
      pages/work/work.wxss
  18. 2
      project.private.config.json
  19. 13
      subpages/communitySelfInsp/pages/synthesis/synthesis.js
  20. 2
      subpages/communitySelfInsp/pages/synthesis/synthesis.wxml

4
README.md

@ -4,10 +4,6 @@
"iconPath": "images/home/information.png", "iconPath": "images/home/information.png",
"selectedIconPath": "images/home/informationSelected.png" "selectedIconPath": "images/home/informationSelected.png"
}, },
<!-- 跳转web-view页面 -->
wx.navigateTo({
url: `/subpages/home/pages/webview/webview?url=${global.WEBROOT()}&token=${token}&deptName=${this.data.street}&gridId=${this.data.departmentId}`
})
2a43afb52996723c6517edb048de6c79 小程序密钥 2a43afb52996723c6517edb048de6c79 小程序密钥
15554200534 15554200534

1
app.js

@ -20,6 +20,7 @@ App({
this.globalData.deviceInfo.navigationHeight = menuButtonInfo.height + (menuButtonInfo.top - res.statusBarHeight) * 2 this.globalData.deviceInfo.navigationHeight = menuButtonInfo.height + (menuButtonInfo.top - res.statusBarHeight) * 2
} }
}) })
wx.hideTabBar()
}, },
globalData: { globalData: {
userInfo: null, userInfo: null,

50
components/custom-tab-bar/index.js

@ -0,0 +1,50 @@
const app = getApp()
Component({
data: {
selected: 0,
color: "#999",
selectedColor: "#3A80E7",
"list": [
{
"pagePath": "/pages/index/index",
"text": "消息",
"iconPath": "/images/home/message.png",
"selectedIconPath": "/images/home/messageSelected.png"
},
{
"pagePath": "/pages/work/work",
"text": "工作",
"iconPath": "/images/home/work.png",
"selectedIconPath": "/images/home/workSelected.png"
},
{
"pagePath": "/pages/statistics/statistics",
"text": "统计",
"iconPath": "/images/home/information.png",
"selectedIconPath": "/images/home/informationSelected.png"
},
{
"pagePath": "/pages/mine/mine",
"text": "我的",
"iconPath": "/images/home/mine.png",
"selectedIconPath": "/images/home/mineSelected.png"
}
]
},
attached() {
},
ready: function() {
this.setData({
selected: app.globalData.selected
})
},
methods: {
switchTab(e) {
console.log(e);
const data = e.currentTarget.dataset;
const url = data.path;
app.globalData.selected = data.index;
wx.switchTab({url})
}
}
})

4
components/custom-tab-bar/index.json

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

17
components/custom-tab-bar/index.wxml

@ -0,0 +1,17 @@
<view class="tab-bar">
<view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab">
<!-- <image src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image> -->
<!-- <view style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</view> -->
<!-- <view >
<image wx:if="{{index!=selected}}" src="{{item.iconPath}}"></image>
<image wx:else class="bigicon" src="{{item.selectedIconPath}}"></image>
<view wx:if="{{index!=selected}}" style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</view>
</view> -->
<view >
<image src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image>
<view style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</view>
</view>
<view class="isIPhoneXRegexBottom"></view>
</view>
</view>

38
components/custom-tab-bar/index.wxss

@ -0,0 +1,38 @@
.tab-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: auto;
background: white;
display: flex;
box-shadow: 0px 6rpx 18rpx 0px rgba(216,216,216,0.66);
}
.isIPhoneXRegexBottom {
padding-bottom: constant(safe-area-inset-bottom); /*兼容 IOS<11.2*/
padding-bottom: env(safe-area-inset-bottom); /*兼容 IOS>11.2*/
}
.tab-bar-item {
flex: 1;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding-top: 10rpx;
}
.tab-bar-item image {
width: 54rpx;
height: 54rpx;
}
/* .tab-bar-item image.bigicon{
width: 70rpx;
height: 70rpx;
} */
.tab-bar-item view {
font-size: 22rpx;
color:#999999
}

BIN
images/home/message.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

3
pages/index/index.json

@ -2,6 +2,7 @@
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": { "usingComponents": {
"load-more": "../../components/loadMore/loadMore", "load-more": "../../components/loadMore/loadMore",
"no-data": "../../components/noData/nodata" "no-data": "../../components/noData/nodata",
"custom-tab-bar":"../../components/custom-tab-bar"
} }
} }

2
pages/index/index.wxml

@ -36,5 +36,5 @@
<load-more loadVisible="{{loadMoreVisible}}" loadType="{{loadMoreType}}" ></load-more> <load-more loadVisible="{{loadMoreVisible}}" loadType="{{loadMoreType}}" ></load-more>
<no-data isShow="{{nodata}}" wx:if="{{nodata}}"></no-data> <no-data isShow="{{nodata}}" wx:if="{{nodata}}"></no-data>
</scroll-view> </scroll-view>
</view> </view>
<custom-tab-bar></custom-tab-bar>

4
pages/mine/mine.json

@ -1,4 +1,6 @@
{ {
"usingComponents": {}, "usingComponents": {
"custom-tab-bar":"../../components/custom-tab-bar"
},
"navigationStyle": "custom" "navigationStyle": "custom"
} }

1
pages/mine/mine.wxml

@ -46,3 +46,4 @@
</view> </view>
</view> </view>
</view> </view>
<custom-tab-bar></custom-tab-bar>

4
pages/statistics/statistics.json

@ -1,4 +1,6 @@
{ {
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": {} "usingComponents": {
"custom-tab-bar":"../../components/custom-tab-bar"
}
} }

3
pages/statistics/statistics.wxml

@ -2,6 +2,5 @@
<view class="navigation" style="height: {{navigationHeight}}px; top: {{statusHeight}}px;"> <view class="navigation" style="height: {{navigationHeight}}px; top: {{statusHeight}}px;">
<image src="../../images/work/header_left.png" mode=""/> {{agencyName}} <image src="../../images/work/header_left.png" mode=""/> {{agencyName}}
</view> </view>
</view> </view>
<custom-tab-bar></custom-tab-bar>

12
pages/work/work.js

@ -183,5 +183,17 @@ Page({
wx.navigateTo({ wx.navigateTo({
url: `/pages/webView/webView?url=${this.data.communitySelfInspTop.questionnaireUrl}`, url: `/pages/webView/webView?url=${this.data.communitySelfInspTop.questionnaireUrl}`,
}) })
},
handelClickCopy() {
wx.setClipboardData({
data: this.data.communitySelfInspTop.questionnaireUrl,
success: function(res) {
wx.showToast({
title: '已将链接复制至剪切板',
duration: 2000,
icon:'none'
});
}
});
} }
}) })

5
pages/work/work.json

@ -1,3 +1,6 @@
{ {
"navigationStyle": "custom" "navigationStyle": "custom",
"usingComponents": {
"custom-tab-bar":"../../components/custom-tab-bar"
}
} }

3
pages/work/work.wxml

@ -67,7 +67,7 @@
<view class="bg_left"> <view class="bg_left">
<view class="h2" bind:tap="toWebView" >{{communitySelfInspTop.agencyName}}{{communitySelfInspTop.monthName}}月份满意度自查</view> <view class="h2" bind:tap="toWebView" >{{communitySelfInspTop.agencyName}}{{communitySelfInspTop.monthName}}月份满意度自查</view>
<view class="submit">已提交 <b>{{communitySelfInspTop.personQty}}</b> 人</view> <view class="submit">已提交 <b>{{communitySelfInspTop.personQty}}</b> 人</view>
<view class="btn_Box"> <view class="btn_fx">一键分享</view> <view class="btn_tj" bind:tap="toSynthesis">查看统计</view> <view class="btn_Box"> <view class="btn_fx" bind:tap="handelClickCopy">一键分享</view> <view class="btn_tj" bind:tap="toSynthesis">查看统计</view>
</view> </view>
</view> </view>
<view class="bg_right"> <view class="bg_right">
@ -89,3 +89,4 @@
</view> </view>
</view> </view>
</view> </view>
<custom-tab-bar></custom-tab-bar>

3
pages/work/work.wxss

@ -197,13 +197,11 @@ page {
text-align: left; text-align: left;
} }
.body{ .body{
height: auto;
padding: 0 20rpx 20rpx; padding: 0 20rpx 20rpx;
position: relative; position: relative;
top: -20rpx; top: -20rpx;
box-sizing: border-box; box-sizing: border-box;
overflow: hidden; overflow: hidden;
} }
.body .top{ .body .top{
width: 100%; width: 100%;
@ -330,6 +328,7 @@ page {
border-radius: 20rpx; border-radius: 20rpx;
box-sizing: border-box; box-sizing: border-box;
margin-top:20rpx ; margin-top:20rpx ;
margin-bottom: 100rpx;
padding: 0 30rpx 20rpx; padding: 0 30rpx 20rpx;
} }
.body .bto .content{ .body .bto .content{

2
project.private.config.json

@ -109,5 +109,5 @@
] ]
} }
}, },
"libVersion": "2.27.3" "libVersion": "2.28.1"
} }

13
subpages/communitySelfInsp/pages/synthesis/synthesis.js

@ -12,7 +12,8 @@ Page({
monthName:'',//月份 monthName:'',//月份
personQty:'',//提交人数 personQty:'',//提交人数
synthesisScore:'',//综合得分 synthesisScore:'',//综合得分
inspRecordId:''//自查表Id inspRecordId:'',//自查表Id
fontSize:''
}, },
/** /**
@ -23,6 +24,7 @@ Page({
statusHeight: app.globalData.deviceInfo.statusHeight, statusHeight: app.globalData.deviceInfo.statusHeight,
navigationHeight: app.globalData.deviceInfo.navigationHeight, navigationHeight: app.globalData.deviceInfo.navigationHeight,
}) })
this.getSynthesis() this.getSynthesis()
}, },
@ -40,7 +42,12 @@ Page({
agencyName:res.data.agencyName, agencyName:res.data.agencyName,
inspRecordId:res.data.inspRecordId inspRecordId:res.data.inspRecordId
}) })
const textContent = res.data.agencyName; // 替换为你实际的内容
if (textContent.length > 5) { // 选择一个合适的长度作为调整字体大小的标准
this.setData({
fontSize: '38rpx' // 选择一个适当的较小字体大小
});
}
}).catch((err)=>{ }).catch((err)=>{
console.log(err); console.log(err);
}) })
@ -105,5 +112,5 @@ Page({
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
}) })
} },
}) })

2
subpages/communitySelfInsp/pages/synthesis/synthesis.wxml

@ -5,7 +5,7 @@
社区满意度自查 社区满意度自查
</view> </view>
<view class="content"> <view class="content">
<view class="h2">{{agencyName}}{{monthName}}月份满意度自查</view> <view class="h2" style="font-size: {{fontSize}};">{{agencyName}}{{monthName}}月份满意度自查</view>
<view class="tag"> <image src="../../../../images/tag.png" mode=""/> 进行中</view> <view class="tag"> <image src="../../../../images/tag.png" mode=""/> 进行中</view>
</view> </view>
</view> </view>

Loading…
Cancel
Save