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