master
parent
d0d831ec74
commit
ce969720e5
6
app.json
6
app.json
|
@ -40,6 +40,12 @@
|
|||
"iconPath": "/img/nav/menu.png",
|
||||
"selectedIconPath": "/img/nav/menuIndex.png",
|
||||
"text": "我要碳中和"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/gproduct/gproduct",
|
||||
"iconPath": "/img/nav/menu.png",
|
||||
"selectedIconPath": "/img/nav/menuIndex.png",
|
||||
"text": "我要碳中和"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -1,41 +1,48 @@
|
|||
Component({
|
||||
data: {
|
||||
selected: 0,
|
||||
color: "#7A7E83",
|
||||
selectedColor: "#4bb547",
|
||||
list: [{
|
||||
pagePath: "/pages/index/index",
|
||||
iconPath: "/img/nav/menu.png",
|
||||
selectedIconPath: "/img/nav/menuIndex.png",
|
||||
text: "碳知道"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/user/user",
|
||||
iconPath: "/img/nav/user.png",
|
||||
selectedIconPath: "/img/nav/userIndex.png",
|
||||
text: "我的"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/new-page/index",
|
||||
iconPath: "/img/nav/tzh_default.png",
|
||||
selectedIconPath: "/img/nav/content.png",
|
||||
text: "碳中和"
|
||||
},
|
||||
]
|
||||
},
|
||||
attached() {
|
||||
},
|
||||
methods: {
|
||||
switchTab(e) {
|
||||
// console.log(e)
|
||||
const data = e.currentTarget.dataset
|
||||
const url = data.path
|
||||
wx.switchTab({url}) //可能是改变样式的原因
|
||||
},
|
||||
gotPageNew(){
|
||||
wx.switchTab({
|
||||
url: '/pages/new-page/index'
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
data: {
|
||||
selected: 0,
|
||||
color: "#7A7E83",
|
||||
selectedColor: "#4bb547",
|
||||
list: [{
|
||||
pagePath: "/pages/index/index",
|
||||
iconPath: "/img/nav/menu.png",
|
||||
selectedIconPath: "/img/nav/menuIndex.png",
|
||||
text: "碳知道"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/user/user",
|
||||
iconPath: "/img/nav/user.png",
|
||||
selectedIconPath: "/img/nav/userIndex.png",
|
||||
text: "我的"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/new-page/index",
|
||||
iconPath: "/img/nav/tzh_default.png",
|
||||
selectedIconPath: "/img/nav/content.png",
|
||||
text: "碳中和"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/gproduct/gproduct",
|
||||
"iconPath": "/img/nav/menu.png",
|
||||
"selectedIconPath": "/img/nav/menuIndex.png",
|
||||
"text": "我要碳中和"
|
||||
}
|
||||
]
|
||||
},
|
||||
attached() {},
|
||||
methods: {
|
||||
switchTab(e) {
|
||||
// console.log(e)
|
||||
const data = e.currentTarget.dataset
|
||||
const url = data.path
|
||||
wx.switchTab({
|
||||
url
|
||||
}) //可能是改变样式的原因
|
||||
},
|
||||
gotPageNew() {
|
||||
wx.switchTab({
|
||||
url: '/pages/new-page/index'
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
<!--miniprogram/custom-tab-bar/index.wxml-->
|
||||
<cover-view class="tab-bar-border">
|
||||
<cover-view class="border">
|
||||
|
||||
|
||||
</cover-view>
|
||||
<cover-view class="tab-bar">
|
||||
<cover-view class="tab-bar-item {{selected === 0 ? 'selected' : ''}}" data-path="{{list[0].pagePath}}" data-index="0" bindtap="switchTab">
|
||||
<cover-image style="width:40rpx; height: 40rpx" src="{{selected === 0 ? list[0].selectedIconPath : list[0].iconPath}}"></cover-image>
|
||||
<cover-view style="color: {{selected === 0 ? selectedColor : color}}">{{list[0].text}}</cover-view>
|
||||
</cover-view>
|
||||
<cover-view class="tab-bar-item middle {{selected === 2 ? 'selected' : ''}}" bindtap="switchTab" data-index="2" data-path="{{list[2].pagePath}}">
|
||||
<cover-image style="width:85rpx; height: 92rpx;" src="{{selected === 2 ? '/img/nav/content.png' : '/img/nav/tzh_default.png'}}"></cover-image>
|
||||
<cover-view style="color: {{selected === 2 ? selectedColor : color}}">{{list[2].text}}</cover-view>
|
||||
</cover-view>
|
||||
<cover-view class="tab-bar-item {{selected === 1 ? 'selected' : ''}}" data-path="{{list[1].pagePath}}" data-index="1" bindtap="switchTab">
|
||||
<cover-image style="width:40rpx; height: 40rpx" src="{{selected === 1 ? list[1].selectedIconPath : list[1].iconPath}}"></cover-image>
|
||||
<cover-view style="color: {{selected === 1 ? selectedColor : color}}">{{list[1].text}}</cover-view>
|
||||
</cover-view>
|
||||
<cover-view class="tab-bar-item {{selected === 0 ? 'selected' : ''}}" data-path="{{list[0].pagePath}}"
|
||||
data-index="0" bindtap="switchTab">
|
||||
<cover-image style="width:40rpx; height: 40rpx"
|
||||
src="{{selected === 0 ? list[0].selectedIconPath : list[0].iconPath}}"></cover-image>
|
||||
<cover-view style="color: {{selected === 0 ? selectedColor : color}}">{{list[0].text}}</cover-view>
|
||||
</cover-view>
|
||||
<cover-view class="tab-bar-item middle {{selected === 2 ? 'selected' : ''}}" bindtap="switchTab" data-index="2"
|
||||
data-path="{{list[2].pagePath}}">
|
||||
<cover-image style="width:85rpx; height: 92rpx;"
|
||||
src="{{selected === 2 ? '/img/nav/content.png' : '/img/nav/tzh_default.png'}}"></cover-image>
|
||||
<cover-view style="color: {{selected === 2 ? selectedColor : color}}">{{list[2].text}}</cover-view>
|
||||
</cover-view>
|
||||
<cover-view class="tab-bar-item {{selected === 1 ? 'selected' : ''}}" data-path="{{list[1].pagePath}}"
|
||||
data-index="1" bindtap="switchTab">
|
||||
<cover-image style="width:40rpx; height: 40rpx"
|
||||
src="{{selected === 1 ? list[1].selectedIconPath : list[1].iconPath}}"></cover-image>
|
||||
<cover-view style="color: {{selected === 1 ? selectedColor : color}}">{{list[1].text}}</cover-view>
|
||||
</cover-view>
|
||||
</cover-view>
|
||||
</cover-view>
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ Page({
|
|||
isShif: false,
|
||||
cases_position_id: ''
|
||||
},
|
||||
senChange(event) {
|
||||
senChange(event) {
|
||||
this.setData({
|
||||
senIndex: event.detail.value,
|
||||
newType: this.data.senList[event.detail.value].type,
|
||||
|
@ -47,7 +47,7 @@ Page({
|
|||
tree_num: {},
|
||||
flag:true,
|
||||
})
|
||||
if (event.detail.value == 1) {
|
||||
if (this.data.senList[event.detail.value].type == 'forest_management') {
|
||||
this.setData({
|
||||
isShif: true,
|
||||
newDo_type: this.data.senList[this.data.senIndex].type
|
||||
|
@ -226,7 +226,14 @@ Page({
|
|||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
onLoad: function(options) {
|
||||
console.log('options',options);
|
||||
if (typeof this.getTabBar === 'function' &&
|
||||
this.getTabBar()) {
|
||||
this.getTabBar().setData({
|
||||
selected: 2
|
||||
})
|
||||
}
|
||||
if (options.icon != undefined) {
|
||||
this.setData({
|
||||
icon: options.icon,
|
||||
|
@ -254,14 +261,14 @@ Page({
|
|||
id: id,
|
||||
'openid': wx.getStorageSync('openid'),
|
||||
},
|
||||
success(res) {
|
||||
success(res) {
|
||||
console.log('res213',res);
|
||||
if (res.data.result == 'success') {
|
||||
console.log(JSON.parse(res.data.data))
|
||||
that.setData({
|
||||
list: JSON.parse(res.data.data),
|
||||
carbon: carbon,
|
||||
id: id
|
||||
})
|
||||
})
|
||||
} else {
|
||||
console.log(res.data.msg); //失败
|
||||
}
|
||||
|
@ -277,26 +284,38 @@ Page({
|
|||
'openid': wx.getStorageSync('openid')
|
||||
},
|
||||
success(res) {
|
||||
console.log('res:',res);
|
||||
if (res.data.result == 'success') {
|
||||
var threeList = JSON.parse(res.data.data).cases;
|
||||
console.log(threeList);
|
||||
if(threeList[0].type=='forest_management'){
|
||||
that.setData({
|
||||
isXiangm:true
|
||||
})
|
||||
}
|
||||
}
|
||||
let arr = that.data.senList
|
||||
arr.forEach((item,index)=>{
|
||||
if(item.type == threeList[that.data.curCaseIndex].default_type){
|
||||
let obj = arr[index];
|
||||
arr.splice(index,1)
|
||||
arr.unshift(obj)
|
||||
}
|
||||
})
|
||||
if(arr[0].type=='forest_management'){
|
||||
that.setData({
|
||||
isShif:true
|
||||
})
|
||||
}
|
||||
that.setData({
|
||||
senList:arr
|
||||
})
|
||||
that.setData({
|
||||
threeList: threeList,
|
||||
newDo_type: threeList[that.data.curCaseIndex].type,
|
||||
cases_position_id: threeList[that.data.curCaseIndex].address[that.data.addressIndex].id,
|
||||
newDo_type:that.data.senList[0].type,
|
||||
newDo_type:arr[0].type,
|
||||
//TODO 这里赋值应该用数组
|
||||
// curThreeCode: [JSON.parse(res.data.data).trees[0].coding],
|
||||
// carbon:JSON.parse(res.data.data).trees[0].carbon_base,
|
||||
// paid_money: money.toFixed(2)
|
||||
})
|
||||
console.log(that.data.threeList);
|
||||
} else {
|
||||
console.log(res.data.msg); //失败
|
||||
}
|
||||
|
@ -341,7 +360,6 @@ Page({
|
|||
var that = this
|
||||
var tree_items = []
|
||||
var management_items = []
|
||||
console.log(this.data.newDo_type);
|
||||
if (this.data.newDo_type == 'afforestation') {
|
||||
for (var p in this.data.priceList) {
|
||||
tree_items.push({
|
||||
|
@ -356,7 +374,7 @@ Page({
|
|||
amount: this.data.priceList[p].num
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
wx.request({
|
||||
url: urlPath.postPayDataV2,
|
||||
data: {
|
||||
|
|
|
@ -200,26 +200,27 @@
|
|||
}
|
||||
|
||||
.bottom-nav {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
/* position: fixed; */
|
||||
/* left: 0; */
|
||||
/* right: 0; */
|
||||
/* bottom: 0; */
|
||||
height: 120rpx;
|
||||
box-shadow: 0rpx 10rpx 20rpx 0rpx #4bb547;
|
||||
/* box-shadow: 0rpx 10rpx 20rpx 0rpx #4bb547; */
|
||||
background: #fff;
|
||||
z-index: 99;
|
||||
line-height: 120rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
font-size: 36rpx;
|
||||
padding-left: 20rpx;
|
||||
padding-left: 0rpx;
|
||||
margin-top: 20rpx;
|
||||
/* background-color: red; */
|
||||
}
|
||||
|
||||
.xiadan {
|
||||
float: right;
|
||||
height: 120rpx;
|
||||
line-height: 100rpx;
|
||||
line-height: 84rpx;
|
||||
width: 80rpx;
|
||||
background: #4bb547;
|
||||
color: #fff;
|
||||
|
|
|
@ -284,7 +284,7 @@ Page({
|
|||
url: '/pages/footprint/footprint?',
|
||||
})
|
||||
} else {
|
||||
wx.navigateTo({
|
||||
wx.reLaunch({
|
||||
url: '/pages/gproduct/gproduct?id=' + JSON.parse(res.data.data)
|
||||
.id + "&&carbon=" + that.data.actual_total_carbon +
|
||||
"&&icon=" + that.data.icon,
|
||||
|
|
Loading…
Reference in New Issue