Commit be373ece by 李君

自定义tabbar

1 parent 81e10957
{ {
"pages": [ "pages": [
"pages/login/index", "index/index",
"pages/tour/point/index", "index/index2",
"pages/tour/titem/index", "index/me",
"pages/homes/index", "pages/login/index",
"pages/tour/list/index", "pages/homes/index",
"pages/tour/gate/index", "pages/editPwd/editPwd",
"pages/tour/webview/index", "pages/shopSelect/index"
"pages/tour/index/index", ],
"pages/index/index", "window": {
"pages/me/index", "backgroundTextStyle": "light",
"pages/editPwd/editPwd", "navigationBarBackgroundColor": "#fff",
"pages/shopSelect/index", "navigationBarTitleText": "Weixin",
"pages/accountHome/index" "navigationBarTextStyle": "black",
], "navigationStyle": "custom"
"subPackages": [ },
{ "tabBar": {
"root": "pages/zong", "color": "#8181A5",
"name": "zong", "selectedColor": "#0069FF",
"pages": [ "borderStyle": "black",
"basic/index", "backgroundColor": "#ffffff",
"condition/index", "custom": true,
"contrast/index", "list": [{
"entry-rate/index", "pagePath": "index/index",
"holiday-comparison/index", "iconPath": "images/home.png",
"ranking/index", "selectedIconPath": "images/home-b.png",
"selectFollr/index", "text": "集团首页"
"selectGate/index", },
"selectMall/index", {
"selectZone/index", "pagePath": "index/index2",
"sequential/index", "iconPath": "images/cong.png",
"timeTravel/index" "selectedIconPath": "images/cong-b.png",
] "text": "店铺首页"
} },
], {
"window": { "pagePath": "index/me",
"backgroundTextStyle": "light", "iconPath": "images/me.png",
"navigationBarBackgroundColor": "#fff", "selectedIconPath": "images/me-b.png",
"navigationBarTitleText": "Weixin", "text": "我的"
"navigationBarTextStyle": "black", }
"navigationStyle": "custom" ]
}, },
"tabBar": { "useExtendedLib": {
"color": "#8181A5", "weui": true
"selectedColor": "#0069FF", },
"borderStyle": "black", "usingComponents": {
"backgroundColor": "#ffffff", "basic":"/components/echart/basic/index",
"custom": true, "navbar": "/components/navbar/index",
"list": [ "navbar2": "/components/navbar2/index",
{ "malllist": "/components/mallList/index",
"pagePath": "pages/accountHome/index", "van-icon": "@vant/weapp/icon/index",
"iconPath": "images/home.png", "arrow": "/components/arrow/index",
"selectedIconPath": "images/home-b.png", "van-tab": "@vant/weapp/tab/index",
"text": "集团首页" "van-tabs": "@vant/weapp/tabs/index",
}, "van-row": "@vant/weapp/row/index",
{ "van-col": "@vant/weapp/col/index",
"pagePath": "pages/homes/index", "van-cell": "@vant/weapp/cell/index",
"iconPath": "images/cong.png", "van-collapse": "@vant/weapp/collapse/index",
"selectedIconPath": "images/cong-b.png", "van-collapse-item": "@vant/weapp/collapse-item/index",
"text": "店铺首页" "van-empty": "@vant/weapp/empty/index",
}, "van-button": "@vant/weapp/button/index",
{ "van-divider": "@vant/weapp/divider/index",
"pagePath": "pages/me/index", "van-field": "@vant/weapp/field/index"
"iconPath": "images/me.png", },
"selectedIconPath": "images/me-b.png", "lazyCodeLoading": "requiredComponents",
"text": "我的" "sitemapLocation": "sitemap.json"
}
]
},
"useExtendedLib": {
"weui": true
},
"usingComponents": {
"navbar2": "/components/navbar2/index",
"malllist": "/components/mallList/index",
"van-icon": "@vant/weapp/icon/index",
"arrow": "/components/arrow/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"van-cell": "@vant/weapp/cell/index",
"van-collapse": "@vant/weapp/collapse/index",
"van-collapse-item": "@vant/weapp/collapse-item/index",
"van-empty": "@vant/weapp/empty/index",
"van-button": "@vant/weapp/button/index",
"van-divider": "@vant/weapp/divider/index",
"van-field": "@vant/weapp/field/index"
},
"lazyCodeLoading": "requiredComponents",
"sitemapLocation": "sitemap.json"
} }
\ No newline at end of file \ No newline at end of file
...@@ -4,13 +4,14 @@ view { ...@@ -4,13 +4,14 @@ view {
box-sizing: border-box; box-sizing: border-box;
} }
page{ page{
background: linear-gradient(154deg, #C7D3FF 0%, #E9F9FF 48%, #FFFFFF 100%) !important; /* background: linear-gradient(154deg, #C7D3FF 0%, #E9F9FF 48%, #FFFFFF 100%) !important; */
--tabs-bottom-bar-color:#1972F5; --tabs-bottom-bar-color:#1972F5;
} }
.backgroundColor{ .backgroundColor{
padding: 0 28rpx; padding: 0 28rpx;
width: 100%; width: 100%;
/* background: linear-gradient(154deg, #C7D3FF 0%, #E9F9FF 48%, #FFFFFF 100%); */ background: linear-gradient(154deg, #C7D3FF 0%, #E9F9FF 48%, #FFFFFF 100%);
padding-top: 120rpx;
} }
.van-picker__confirm{ .van-picker__confirm{
color: #000!important; color: #000!important;
...@@ -22,7 +23,7 @@ page{ ...@@ -22,7 +23,7 @@ page{
.ellipsis{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;} .ellipsis{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
.container { .container {
width: 100%; width: 100%;
position: relative; position: relative;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
......
Component({ Component({
/**
* 页面的初始数据
*/
data: { data: {
curClick: 1, // 判断当前点击的索引下标 curClick: 1,
color: "#7A7E83",
selectedColor: "#3cc51f",
list: [{ list: [{
"pagePath": "/pages/index/index", "pagePath": "/index/index",
"iconPath": "../images/home.png", "iconPath": "../images/home.png",
"selectedIconPath": "../images/home-b.png", "selectedIconPath": "../images/home-b.png",
"text": "首页", "text": "集团首页",
"curr": 1 "curr": 1
}, }, {
{ "pagePath": "/index/index2",
"pagePath": "/pages/home/index", "iconPath": "../images/cong.png",
"iconPath": "../images/cong.png", "selectedIconPath": "../images/cong-b.png",
"selectedIconPath": "../images/cong-b.png", "text": "店铺首页",
"text": "工作台", "curr": 2
"curr": 2 }, {
}, "pagePath": "/index/me",
{ "iconPath": "../images/me.png",
"pagePath": "/pages/me/index", "selectedIconPath": "../images/me-b.png",
"iconPath": "../images/me.png", "text": "我的",
"selectedIconPath": "../images/me-b.png", "curr": 3
"text": "我的", }]
"curr": 3
}
]
}, },
attached:function(){ attached() {
let userType = wx.getStorageSync('userrole_type'); let userType = wx.getStorageSync('userrole_type');
if(userType==3){ if(userType==3){
this.setData({ this.setData({
curClick:2, curClick:2,
list:[ list:[
{ {
"pagePath": "/pages/home/index", "pagePath": "/index/index2",
"iconPath": "../images/cong.png", "iconPath": "../images/cong.png",
"selectedIconPath": "../images/cong-b.png", "selectedIconPath": "../images/cong-b.png",
"text": "工作台", "text": "工作台",
"curr": 2 "curr": 2
}, },
{ {
"pagePath": "/pages/me/index", "pagePath": "/index/me",
"iconPath": "../images/me.png", "iconPath": "../images/me.png",
"selectedIconPath": "../images/me-b.png", "selectedIconPath": "../images/me-b.png",
"text": "我的", "text": "我的",
...@@ -52,18 +47,15 @@ Component({ ...@@ -52,18 +47,15 @@ Component({
} }
}, },
methods: { methods: {
NavChange(e) { switchTab(e) {
// 获取穿过来的参数 const data = e.currentTarget.dataset
// let curIndex = e.currentTarget.dataset.cur; const url = data.path
// 获取穿过来的参数
let path = e.currentTarget.dataset.path;
// 更新data中值
wx.switchTab({ wx.switchTab({
url: path, url
}) })
this.setData({
}, selected: data.index
})
}
} }
}) })
\ No newline at end of file \ No newline at end of file
<view class="tabbar_wrap">
<block>
<cover-view wx:for="{{list}}" wx:key="index" class="tabbar_item" bindtap="NavChange" data-cur="{{item.curr}}" data-path="{{item.pagePath}}">
<cover-image class="img" src="{{curClick==item.curr?item.selectedIconPath:item.iconPath}}"></cover-image>
<cover-view class="{{curClick==item.curr?'active text':'text'}}">
{{item.text}}
</cover-view>
</cover-view>
</block>
</view>
\ No newline at end of file \ No newline at end of file
<!--miniprogram/custom-tab-bar/index.wxml-->
<view class="tab-bar">
<view class="tab-bar-border"></view>
<view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab">
<image src="{{curClick === item.curr ? item.selectedIconPath : item.iconPath}}"></image>
<view class="{{curClick === item.curr ? 'active text' : 'text'}}">{{item.text}}</view>
</view>
</view>
.tabbar_wrap { .tab-bar {
position: fixed; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
width: 100%; height: 110rpx;
display: flex; background: white;
align-items: center; display: flex;
background-color: #FFFFFF; flex-direction: row;
height: 110rpx; padding-bottom: env(safe-area-inset-bottom);
border-top: 1px solid #CCc; pointer-events: auto;
padding-bottom: env(safe-area-inset-bottom);
} }
.tabbar_wrap .tabbar_item { .tab-bar-border {
flex: 1; background-color: rgba(0, 0, 0, 0.33);
display: flex; position: absolute;
justify-content: center; left: 0;
flex-direction: column; top: 0;
align-items: center; width: 100%;
height: 1px;
transform: scaleY(0.5);
} }
.tabbar_wrap .tabbar_item .img { .tab-bar-item {
width: 45rpx; flex: 1;
height: 45rpx; text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
} }
.tabbar_wrap .tabbar_item .text { .tab-bar-item image {
font-size: 28rpx; width: 27px;
margin-top: 5rpx; height: 27px;
} }
.tabbar_wrap .tabbar_item .active { .tab-bar-item view {
color: #597BFF; font-size: 10px;
} }
.active.text {
.tabbar_wrap .tabbar_item .addBtn { color: #597BFF;
width: 90rpx;
height: 90rpx;
padding: 10rpx;
background-color: #Ffffff;
border-radius: 100rpx;
position: absolute;
top: -40rpx;
} }
.text {
.tabbar_wrap .tabbar_item .subMsg {
font-size: 28rpx; font-size: 28rpx;
margin-top: 50rpx;
}
\ No newline at end of file \ No newline at end of file
margin-top: 5rpx;
}
{ {
"usingComponents": {
"navbar": "/components/navbar/index",
"basic":"/components/echart/basic/index",
"van-calendar": "@vant/weapp/calendar/index",
"van-progress": "@vant/weapp/progress/index",
"van-button": "@vant/weapp/button/index",
"van-grid": "@vant/weapp/grid/index",
"van-grid-item": "@vant/weapp/grid-item/index"
},
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#0268FF",
"navigationBarTextStyle": "white"
}
\ No newline at end of file \ No newline at end of file
"usingComponents": {
"navbar": "/components/navbar/index",
"basic":"/components/echart/basic/index",
"van-calendar": "@vant/weapp/calendar/index",
"van-progress": "@vant/weapp/progress/index",
"van-button": "@vant/weapp/button/index",
"van-grid": "@vant/weapp/grid/index",
"van-grid-item": "@vant/weapp/grid-item/index"
},
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#0268FF",
"navigationBarTextStyle": "white"
}
\ No newline at end of file \ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="~backgroundColor"> <view class="~backgroundColor">
<!-- 名称 --> <!-- 名称 -->
<view class="contianer_shop"> <view class="contianer_shop">
<image src="../../images/banner.png" class='images'></image> <image src="../images/banner.png" class='images'></image>
<view class="shop_name">{{selectName}}</view> <view class="shop_name">{{selectName}}</view>
<view class="shop_time"> <view class="shop_time">
<text>开业门店总数:254个</text> <text>开业门店总数:254个</text>
...@@ -19,28 +19,28 @@ ...@@ -19,28 +19,28 @@
<text class="text_tltle {{types==5?'actives':'defaults'}}" bindtap="ClickTab" data-type='5'>自定义</text> <text class="text_tltle {{types==5?'actives':'defaults'}}" bindtap="ClickTab" data-type='5'>自定义</text>
</view> </view>
<view class="time_input"> <view class="time_input">
<image src="../../images/rili.png" style="width:20px;height:20px;margin-right:20rpx"></image> <image src="../images/rili.png" style="width:20px;height:20px;margin-right:20rpx"></image>
<text>{{currentTime}}</text> <text>{{currentTime}}</text>
</view> </view>
<!-- 卡片 --> <!-- 卡片 -->
<view class="card"> <view class="card">
<view class="card_passage"> <view class="card_passage">
<image src="../../images/keliulaing.png" class="card_image"></image> <image src="../images/keliulaing.png" class="card_image"></image>
<view class="cardName"> 路过客流量</view> <view class="cardName"> 路过客流量</view>
<view class="cardNum"> 35480</view> <view class="cardNum"> 35480</view>
</view> </view>
<view class="card_passage"> <view class="card_passage">
<image src="../../images/keliuliangyellow.png" class="card_image"></image> <image src="../images/keliuliangyellow.png" class="card_image"></image>
<view class="cardName"> 客流量</view> <view class="cardName"> 客流量</view>
<view class="cardNum"> 35480</view> <view class="cardNum"> 35480</view>
</view> </view>
<view class="card_passage"> <view class="card_passage">
<image src="../../images/customer.png" class="card_image"></image> <image src="../images/customer.png" class="card_image"></image>
<view class="cardName"> 顾客人数</view> <view class="cardName"> 顾客人数</view>
<view class="cardNum"> 35480</view> <view class="cardNum"> 35480</view>
</view> </view>
<view class="card_passage"> <view class="card_passage">
<image src="../../images/jindianlv.png" class="card_image"></image> <image src="../images/jindianlv.png" class="card_image"></image>
<view class="cardName"> 进店率</view> <view class="cardName"> 进店率</view>
<view class="cardNum"> 35480</view> <view class="cardNum"> 35480</view>
</view> </view>
......
/* pages/homes/index.wxss */ /* pages/homes/index.wxss */
.container{ .container{
height: 100%; height: 100%;
} }
.contianer_shop { .contianer_shop {
width: 100%; width: 100%;
height: 168rpx; height: 168rpx;
position: relative; position: relative;
margin-top: 20rpx; margin-top: 20rpx;
} }
.images { .images {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.shop_name { .shop_name {
padding: 30rpx 0 10rpx 28rpx; padding: 30rpx 0 10rpx 28rpx;
font-size: 40rpx; font-size: 40rpx;
font-family: PingFangSC-Medium, PingFang SC; font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500; font-weight: 500;
color: #FFFFFF; color: #FFFFFF;
line-height: 56rpx; line-height: 56rpx;
position: absolute; position: absolute;
} }
.shop_time { .shop_time {
position: absolute; position: absolute;
top: 90rpx; top: 90rpx;
margin-left: 28rpx; margin-left: 28rpx;
font-size: 28rpx; font-size: 28rpx;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: rgba(255, 255, 255, 0.65); color: rgba(255, 255, 255, 0.65);
} }
.tab_tll { .tab_tll {
padding: 0 10rpx; padding: 0 10rpx;
width: 100%; width: 100%;
margin-top: 30rpx; margin-top: 30rpx;
} }
.tab_tll .text_tltle { .tab_tll .text_tltle {
font-size: 28rpx; font-size: 28rpx;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
margin-right: 30rpx; margin-right: 30rpx;
} }
.actives { .actives {
color: #000000; color: #000000;
border-bottom: 4px solid #447BFF; border-bottom: 4px solid #447BFF;
} }
.defaults { .defaults {
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
} }
.time_input { .time_input {
margin-top: 30rpx; margin-top: 30rpx;
width: 100%; width: 100%;
height: 80rpx; height: 80rpx;
background-color: rgba(131, 164, 255, 0.39); background-color: rgba(131, 164, 255, 0.39);
border-radius: 40rpx; border-radius: 40rpx;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0 0 0 50rpx; padding: 0 0 0 50rpx;
} }
.card { .card {
width: 100%; width: 100%;
margin-top: 30rpx; margin-top: 30rpx;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
} }
.card_passage { .card_passage {
width: 48%; width: 48%;
height: 148rpx; height: 148rpx;
position: relative; position: relative;
padding: 20rpx 20rpx 0; padding: 20rpx 20rpx 0;
font-size: 40rpx; font-size: 40rpx;
font-family: PingFangSC-Medium, PingFang SC; font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500; font-weight: 500;
color: #FFFFFF; color: #FFFFFF;
} }
.cardName{ .cardName{
position: absolute; position: absolute;
font-size: 28rpx; font-size: 28rpx;
} }
.cardNum{ .cardNum{
position: absolute; position: absolute;
top: 65rpx; top: 65rpx;
} }
.card>view:nth-child(n+3) { .card>view:nth-child(n+3) {
margin-top: 30rpx; margin-top: 30rpx;
} }
.card_image { .card_image {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 148rpx; height: 148rpx;
} }
.keliuliang { .keliuliang {
width: 100%; width: 100%;
padding: 20rpx; padding: 20rpx;
border-radius: 20rpx; border-radius: 20rpx;
background-color: #fff; background-color: #fff;
margin-top: 30rpx; margin-top: 30rpx;
} }
.keliuliang>text { .keliuliang>text {
height: 44rpx; height: 44rpx;
line-height: 44rpx; line-height: 44rpx;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.keliuliang>text::before { .keliuliang>text::before {
content: ''; content: '';
width: 6rpx; width: 6rpx;
height: 30rpx; height: 30rpx;
margin-right: 10rpx; margin-right: 10rpx;
background: #5889FF; background: #5889FF;
border-radius: 3rpx; border-radius: 3rpx;
} }
.title_chart { .title_chart {
font-size: 32rpx; font-size: 32rpx;
font-family: PingFangSC-Medium, PingFang SC; font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500; font-weight: 500;
color: rgba(0, 0, 0, 0.85); color: rgba(0, 0, 0, 0.85);
} }
.stome_time { .stome_time {
margin-top: 20rpx; margin-top: 20rpx;
font-size: 28rpx; font-size: 28rpx;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
} }
.stome_time text { .stome_time text {
font-size: 30rpx; font-size: 30rpx;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #5A95EC; color: #5A95EC;
} }
.indexList .desc_content { .indexList .desc_content {
padding: 0 !important; padding: 0 !important;
border: 2rpx solid #DCDFE6; border: 2rpx solid #DCDFE6;
border-radius: 100rpx; border-radius: 100rpx;
} }
.indexList .desc_info { .indexList .desc_info {
height: 50rpx; height: 50rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
border-radius: 100rpx; border-radius: 100rpx;
} }
.indexList .desc_info:nth-child(4) { .indexList .desc_info:nth-child(4) {
margin-right: 0 !important; margin-right: 0 !important;
} }
.indexList .desc_text { .indexList .desc_text {
margin-bottom: 8px; margin-bottom: 8px;
font-size: 24rpx; font-size: 24rpx;
} }
.indexList .desc_content_active { .indexList .desc_content_active {
padding: 0 !important; padding: 0 !important;
/* border: 2rpx solid#447BFF; */ /* border: 2rpx solid#447BFF; */
background-color: #447BFF; background-color: #447BFF;
border-radius: 100rpx; border-radius: 100rpx;
} }
.indexList .desc_text_active { .indexList .desc_text_active {
margin-bottom: 8px; margin-bottom: 8px;
font-size: 25rpx; font-size: 25rpx;
color: #fff; color: #fff;
} }
.van-hairline--surround::after { .van-hairline--surround::after {
border: none border: none
} }
.van-hairline--bottom::after, .van-hairline--bottom::after,
.van-hairline--left::after, .van-hairline--left::after,
.van-hairline--right::after, .van-hairline--right::after,
.van-hairline--surround::after, .van-hairline--surround::after,
.van-hairline--top-bottom::after, .van-hairline--top-bottom::after,
.van-hairline--top::after, .van-hairline--top::after,
.van-hairline::after { .van-hairline::after {
border: none !important border: none !important
} }
.list { .list {
position: relative; position: relative;
padding-top: 20rpx; padding-top: 20rpx;
} }
.list .item { .list .item {
position: relative; position: relative;
padding: 10rpx 0; padding: 10rpx 0;
border-bottom: 1rpx solid #fafafa; border-bottom: 1rpx solid #fafafa;
} }
.list .item .info { .list .item .info {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 24rpx; font-size: 24rpx;
} }
.list .item .shopName { .list .item .shopName {
color: rgba(0, 0, 0, 0.85); color: rgba(0, 0, 0, 0.85);
} }
.list .item .shopName .idx { .list .item .shopName .idx {
margin-right: 5rpx; margin-right: 5rpx;
} }
.list .item .progress { .list .item .progress {
padding: 10rpx 0rpx; padding: 10rpx 0rpx;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.list .item .progress .bar { .list .item .progress .bar {
width: 100%; width: 100%;
position: relative; position: relative;
} }
.list .item .num { .list .item .num {
color: #4C83FF; color: #4C83FF;
/* width:100rpx; */ /* width:100rpx; */
text-align: right; text-align: right;
font-size: 28rpx; font-size: 28rpx;
font-weight: 900; font-weight: 900;
} }
\ No newline at end of file \ No newline at end of file
Component({
pageLifetimes: {
show() {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
// 当前页面的 tabBar 索引
curClick: 2
})
}
}
}
})
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class="intro">接口</view>
\ No newline at end of file \ No newline at end of file
.intro {
margin: 30px;
text-align: center;
padding-top: 60px
}
\ No newline at end of file \ No newline at end of file
// index/me.js
const App = getApp();
import basicApi from '../api/basic.js'
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
navHeight: App.globalData.navHeight,
windowHeight: App.globalData.windowHeight,
accountName: '',
name: '',
menuItems: [{
name: '切换服务器地址',
icon: 'position',
}],
userForm: {},
rolesList: []
},
pageLifetimes: {
show() {
const name = wx.getStorageSync('name');
const accountName = wx.getStorageSync('accountName');
this.setData({
name: name,
accountName: accountName
})
this.getUserInfo()
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
// 当前页面的 tabBar 索引
curClick: 3
})
}
}
},
/**
* 组件的方法列表
*/
methods: {
All(e) {
console.log(e)
},
inputBlur(e) {
this.data.userForm.realName = e.detail
},
inputBlur2(e) {
this.data.userForm.tel = e.detail
},
inputBlur3(e) {
this.data.userForm.email = e.detail
},
getUserInfo() {
basicApi.singleUser(wx.getStorageSync('uid')).then(res => {
this.getRolePermission(res.data)
})
},
getRolePermission(resData) {
basicApi.getPermission(resData.unid).then(res => {
let roles = []
res.roles.forEach(item => {
roles.push(item.name)
})
resData.roles = roles.toString()
this.setData({
userForm: resData
})
})
},
onSubmit(e) {
basicApi.editUserInfo({
userId: this.data.userForm.id,
email: this.data.userForm.email,
loginName: this.data.userForm.loginName,
realName: this.data.userForm.realName,
tel: this.data.userForm.tel,
}).then(res => {
if (res.code == 200) {
wx.showToast({
title: '修改成功',
icon: 'success'
})
this.getUserInfo()
}
})
},
undatePwd() {
wx.navigateTo({
url: '/pages/editPwd/editPwd'
})
},
logout: () => {
wx.getStorageInfo({
success: (res) => {
res.keys.forEach(item => {
if (item !== 'name' && item !== 'password' && item !== 'requestUrl' && item !== 'baseUrl' && item !== 'deploymentType') {
wx.removeStorage({
key: item,
success: function (res) {}
})
}
})
}
})
wx.reLaunch({
url: '/pages/login/index'
})
},
goOtherPage: async function (e) {
const {
value
} = e.target.dataset
if (value.name === '切换服务器地址') {
await wx.setStorage({
data: 'success',
key: 'modalShow',
})
wx.getStorageInfo({
success: (res) => {
res.keys.forEach(item => {
if (item !== 'name' && item !== 'password' && item !== 'requestUrl' && item !== 'baseUrl' && item !== 'deploymentType' && item !== 'modalShow') {
wx.removeStorage({
key: item,
success: function (res) {}
})
}
})
}
})
wx.reLaunch({
url: '/pages/login/index'
})
}
}
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
"navbar": "/components/navbar/index"
},
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#0268FF",
"navigationBarTextStyle": "white"
}
\ No newline at end of file \ No newline at end of file
<view class="container" style="height:{{windowHeight}}px">
<navbar page-name="我的" bg-color="RGBA(213, 227, 255, 1)" navbar-color="#000">
</navbar>
<view class="~backgroundColor">
<view class="header">
<image src="../images/me/avatar.png" class="avatar" />
<view class="name">
<view class="username">{{name}}</view>
<view class="company">{{accountName}}</view>
</view>
</view>
<view class="zong-content">
<van-form>
<van-cell-group>
<van-field value="{{userForm.realName}}" class="vanField" name="姓名" label="姓名" label-class='label' input-class='input' placeholder="姓名" bind:change='inputBlur' right-icon="edit" right-icon-class='editClass' />
<van-field class="vanField" value="{{userForm.tel}}" name="电话号码" label-class='label' input-class='input' label="电话号码" placeholder="电话号码" bind:change='inputBlur2' right-icon="edit" right-icon-class='editClass' />
<van-field border="{{ false }}" class="vanField" value="{{userForm.email}}" name="邮箱" label-class='label' input-class='input' label="邮箱" placeholder="邮箱" bind:change='inputBlur3' right-icon="edit" right-icon-class='editClass' />
</van-cell-group>
</van-form>
</view>
<view class="items">
<view class="item" bindtap="undatePwd">
<text>修改密码</text>
<image src="../images/arrow-r.png" class="arrow" />
</view>
<view class="item logout" bindtap="logout">
<text>退出登录</text>
<image src="../images/arrow-r.png" class="arrow" />
</view>
</view>
<view class="btn">
<van-button color="#597BFF" round block type="primary" bindtap="onSubmit">提交</van-button>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* pages/me/index.wxss */
.header {
width: 100%;
height: 224rpx;
background-color: #fff;
border-radius: 16rpx;
box-sizing: border-box;
margin-top: 30rpx;
padding: 12rpx 0rpx 0 50rpx;
display: flex;
align-items: center;
}
.header .avatar {
width: 160rpx;
height: 160rpx;
border-radius: 50%;
margin-right: 32rpx;
}
.header .name {
font-family: PingFangSC-Medium, PingFang SC;
color: #000;
}
.header .username {
font-weight: 500;
font-size: 40rpx;
line-height: 40rpx;
margin-bottom: 12rpx;
}
.header .company {
box-sizing: border-box;
height: 40rpx;
line-height: 40rpx;
color: rgba(0, 0, 0, 0.55);
font-size: 28rpx;
}
.btn {
margin-top: 30rpx;
}
.zong-content {
padding: 10rpx 0;
width: 100%;
height: 324rpx;
margin-top: 24rpx;
border-radius: 16rpx;
background-color: #fff;
}
.label {
color: rgba(0, 0, 0, 0.9) !important;
font-size: 28rpx;
height: 66rpx;
line-height: 66rpx;
/* padding: 5px; */
}
.input {
color: rgba(0, 0, 0, 0.7) !important;
font-size: 28rpx;
}
.editClass{
color: #597BFF;
font-size: 32rpx !important;
font-weight: 600 !important;
right: 25rpx;
}
.vanField .van-field__body{
height: 66rpx;
line-height: 66rpx;
}
.items{
margin-top: 24rpx;
border-radius: 16rpx;
background-color: #fff;
padding: 5px 10rpx 5rpx 23rpx;
}
.items .item {
width: 100%;
height: 100rpx;
display: flex;
align-items: center;
color: rgba(0,0,0,0.9);
font-size: 28rpx;
box-sizing: border-box;
padding: 0 23rpx 0 17rpx;
position: relative;
border-bottom: 1rpx solid #E1E1E1;
}
.items .logout{
border-width: 0;
}
.items .item .arrow {
position: absolute;
right: 38rpx;
color: rgba(0, 0, 0, .2);
width: 24rpx;
height: 24rpx;
}
\ No newline at end of file \ No newline at end of file
...@@ -44,9 +44,11 @@ Page({ ...@@ -44,9 +44,11 @@ Page({
} }
const modalShow = wx.getStorageSync('modalShow'); const modalShow = wx.getStorageSync('modalShow');
if (atoken) { if (atoken) {
wx.reLaunch({ if(wx.getStorageSync('userrole_type')==3){
url: '/pages/index/index', wx.reLaunch({ url: '/index/index2' })
}) }else{
wx.reLaunch({ url: '/index/index' })
}
} else { } else {
if (!deploymentType || deploymentType === '') { if (!deploymentType || deploymentType === '') {
this.setData({ modalShow: true }) this.setData({ modalShow: true })
...@@ -132,9 +134,9 @@ Page({ ...@@ -132,9 +134,9 @@ Page({
//wx.setStorage({ data: datas, key: 'accountList' }) //wx.setStorage({ data: datas, key: 'accountList' })
wx.setStorage({ data: datas[0].name, key: 'accountName' }) wx.setStorage({ data: datas[0].name, key: 'accountName' })
if(res.data.user.type==3){ if(res.data.user.type==3){
wx.reLaunch({ url: '/pages/home/index' }) wx.reLaunch({ url: '/index/index2' })
}else{ }else{
wx.reLaunch({ url: '/pages/index/index' }) wx.reLaunch({ url: '/index/index' })
} }
} }
......
...@@ -11,11 +11,7 @@ Page({ ...@@ -11,11 +11,7 @@ Page({
{ {
name: '切换服务器地址', name: '切换服务器地址',
icon: 'position', icon: 'position',
}, }
// {
// name: '修改密码',
// icon: 'password'
// }
], ],
userForm:{}, userForm:{},
rolesList:[] rolesList:[]
......
<view class="container" style="padding-top: {{navHeight}}px;height:{{windowHeight}}px"> <view class="container" style="height:{{windowHeight}}px">
<navbar page-name="我的" bg-color="" navbar-color="#000"> <navbar page-name="我的" bg-color="RGBA(213, 227, 255, 1)" navbar-color="#000">
</navbar> </navbar>
<view class="~backgroundColor"> <view class="~backgroundColor">
<view class="header"> <view class="header">
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
background-color: #fff; background-color: #fff;
border-radius: 16rpx; border-radius: 16rpx;
box-sizing: border-box; box-sizing: border-box;
margin-top: 40rpx; margin-top: 30rpx;
padding: 12rpx 0rpx 0 50rpx; padding: 12rpx 0rpx 0 50rpx;
display: flex; display: flex;
align-items: center; align-items: center;
......
{ {
"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"packOptions": { "packOptions": {
"ignore": [], "ignore": [],
"include": [] "include": []
}, },
"setting": { "setting": {
"urlCheck": true, "urlCheck": true,
"es6": true, "es6": true,
"enhance": true, "enhance": true,
"postcss": true, "postcss": true,
"preloadBackgroundData": false, "preloadBackgroundData": false,
"minified": true, "minified": true,
"newFeature": false, "newFeature": false,
"coverView": true, "coverView": true,
"nodeModules": true, "nodeModules": true,
"autoAudits": true, "autoAudits": true,
"showShadowRootInWxmlPanel": true, "showShadowRootInWxmlPanel": true,
"scopeDataCheck": false, "scopeDataCheck": false,
"uglifyFileName": false, "uglifyFileName": false,
"checkInvalidKey": true, "checkInvalidKey": true,
"checkSiteMap": true, "checkSiteMap": true,
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
"compileHotReLoad": false, "compileHotReLoad": false,
"babelSetting": { "babelSetting": {
"ignore": [], "ignore": [],
"disablePlugins": [], "disablePlugins": [],
"outputPath": "" "outputPath": ""
}, },
"useIsolateContext": false, "useIsolateContext": false,
"useCompilerModule": false, "useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false, "userConfirmedUseCompilerModuleSwitch": false,
"lazyloadPlaceholderEnable": false, "lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true, "useMultiFrameRuntime": true,
"useApiHook": true, "useApiHook": true,
"useApiHostProcess": true, "useApiHostProcess": true,
"userConfirmedBundleSwitch": false, "userConfirmedBundleSwitch": false,
"packNpmManually": false, "packNpmManually": false,
"packNpmRelationList": [], "packNpmRelationList": [],
"minifyWXSS": true, "minifyWXSS": true,
"disableUseStrict": false, "disableUseStrict": false,
"minifyWXML": true, "minifyWXML": true,
"showES6CompileOption": false, "showES6CompileOption": false,
"useCompilerPlugins": false, "useCompilerPlugins": false,
"ignoreDevUnusedFiles": false, "ignoreDevUnusedFiles": false,
"ignoreUploadUnusedFiles": false, "ignoreUploadUnusedFiles": false,
"useStaticServer": true, "useStaticServer": true,
"condition": false "condition": false
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.14.4", "libVersion": "2.14.4",
"appid": "wx220b5d2dbb82ce64", "appid": "wx220b5d2dbb82ce64",
"projectname": "miniProject", "projectname": "miniProject",
"cloudfunctionTemplateRoot": "cloudfunctionTemplate/", "cloudfunctionTemplateRoot": "cloudfunctionTemplate/",
"editorSetting": { "editorSetting": {
"tabIndent": "insertSpaces", "tabIndent": "insertSpaces",
"tabSize": 4 "tabSize": 4
}, },
"simulatorType": "wechat", "simulatorType": "wechat",
"simulatorPluginLibVersion": {}, "simulatorPluginLibVersion": {},
"condition": { "condition": {
"search": { "miniprogram": {
"current": -1, "list": [
"list": [] {
}, "name": "pages/accountHome/index",
"conversation": { "pathName": "pages/accountHome/index",
"current": -1, "query": "",
"list": [] "scene": null
}, }
"plugin": { ]
"current": -1, }
"list": [] }
},
"game": {
"current": -1,
"list": []
},
"gamePlugin": {
"current": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": [
{
"id": -1,
"name": "pages/accountHome/index",
"pathName": "pages/accountHome/index",
"scene": null
}
]
}
}
} }
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!