初始化

master
chen 2021-09-01 15:52:30 +08:00
commit 9c1db5c199
132 changed files with 5575 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

18
.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
# Build and Release Folders
bin-debug/
bin-release/
[Oo]bj/
[Bb]in/
# Other files and folders
.settings/
# Executables
*.swf
*.air
*.ipa
*.apk
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
# should NOT be excluded as they contain compiler settings and other important
# information for Eclipse / Flash Builder.

36
README.en.md Normal file
View File

@ -0,0 +1,36 @@
# tanzhonghe
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

39
README.md Normal file
View File

@ -0,0 +1,39 @@
# tanzhonghe
#### 介绍
{**以下是 Gitee 平台说明,您可以替换此简介**
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

0
aa.txt Normal file
View File

31
app.js Normal file
View File

@ -0,0 +1,31 @@
//app.js
var urlPath = require('/config.js');
App({
globalData: {
userInfo: {}, //用户信息获取
code: '',
},
setOpenid: function () {
// 判断是否存在
// if(wx.getStorageSync('openid')){
// return
// }
// var that = this
},
onLaunch: function () {
var that = this;
wx.setStorageSync('urlPath', urlPath);
// this.setOpenid()
// wx.getSetting({
// success: (res) => {
// if (!res.authSetting['scope.userInfo']) { //已授权情况下
// wx.navigateTo({
// url: '/pages/auth/auth',
// })
// }
// }
// })
},
})

54
app.json Normal file
View File

@ -0,0 +1,54 @@
{
"pages": [
"pages/guide/guide",
"pages/auth/auth",
"pages/user/user",
"pages/userEdit/userEdit",
"pages/new-page/index",
"pages/footprint/footprint",
"pages/product/product",
"pages/gproduct/gproduct",
"pages/index/index",
"pages/certificate_detail/certificate_detail",
"pages/payment/payment",
"pages/certificate/certificate",
"pages/details/details"
],
"tabBar": {
"custom": true,
"color": "#7A7E83",
"selectedColor": "#3cc51f",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"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/menu.png",
"selectedIconPath": "/img/nav/menuIndex.png",
"text": "我要碳中和"
}
]
},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "我要碳中和",
"navigationBarTextStyle": "black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

121
app.wxss Normal file
View File

@ -0,0 +1,121 @@
.container{
background: #eeeeee7d;
min-height: 100vh;
padding-bottom: 40rpx;
}
view,text,input,button,scroll-view,textarea{
box-sizing: border-box;
}
.container button[disabled],.container button[disabled]:not([type]) {
background-color: #ccc;
color: #fff;
}
.top10{
margin-top: 10rpx;
}
.top20{
margin-top: 20rpx;
}
.top30{
margin-top: 30rpx;
}
.top40{
margin-top: 40rpx;
}
/**通用css**/
view{
box-sizing: border-box;
}
.view-bg{
width: 690rpx;
position: relative;
background: #fff;
margin-left:auto;
margin-right: auto;
border-radius: 10rpx;
overflow: hidden;
padding-bottom: 40rpx;
}
/**/
.countdown{
width: 100%;
text-align: center;
padding: 40rpx 0;
}
.countdown .names{
font-size: 30rpx;
}
.countdown .names text{
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfMAAAAJCAYAAAAmccWAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDAyIDc5LjE2NDQ2MCwgMjAyMC8wNS8xMi0xNjowNDoxNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjIgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Mzk0M0RGRkRGNEJDMTFFQUExNzhEOURGMjAwQUZGODIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Mzk0M0RGRkVGNEJDMTFFQUExNzhEOURGMjAwQUZGODIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozOTQzREZGQkY0QkMxMUVBQTE3OEQ5REYyMDBBRkY4MiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozOTQzREZGQ0Y0QkMxMUVBQTE3OEQ5REYyMDBBRkY4MiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhtKAecAAAElSURBVHja7Nu9asJQGMbxk+AN6FAoOHRTlGZz7A0InVoHR6eWDg6dewvq6N6OgmDpRXToVOiqOCjYoR8XUNInTQIOJe2Q4Q35/+AB5WR6Ai+exOOFYehgS3v8mn70laFyoTSUd2Wh3Cjb9KKX6wNKA8DcKTGfCszylFtlojST7zVloDwpR1QEgLmDnxvXGu1owaZzZZax/qCcUhMA5g7YmdvV/2O9q1SpCQBzBxXlWTmmikL+EDt08fssAMhD/R9z542azAnYmRfXl7KhBgA5WlNBcXfmATWYFL2Xus9Yj/5d+klNAHJ0p/Qy1ufKGTXZ43E0zZ69IyJT5fKXS1bKSboz54gIAOZOufGY3bYrFx8JeVQ+lKWLj4x0HI/YATB3kPgWYABV0EFs4jF8rAAAAABJRU5ErkJggg==") no-repeat center;
background-size:499rpx 10rpx;
display: inline-block;
width: 100%;
}
.countdown .time{
color: #666666;
font-size: 32rpx;
height: 50rpx;
line-height: 50rpx;
margin-top: 30rpx;
}
.countdown .time text{
height: 50rpx;
width: 50rpx;
display: inline-block;
background:#2a8de9;
border-radius: 4rpx;
color: #fff;
margin:0 6rpx;
}
.countdown .tab{
display: inline-block;
width: 100%;
margin-top: 40rpx;
}
.countdown .tab .list{
width: 33.33%;
float: left;
display: inline-block;
font-size: 50rpx;
border-right: 1rpx solid #ebebeb;
font-weight: bold;
}
.countdown .tab .list text{
font-size: 24rpx;
color: #333333;
font-weight: 400;
}
.countdown .tab .list text:nth-child(2){
display: block;
margin-top: 10rpx;
}
/**/
.signup{
width: 130rpx;
height: 50rpx;
line-height: 50rpx;
background: #ffc103;
color: #fff;
font-size: 26rpx;
border-radius: 15rpx 0 0 15rpx;
text-align: center;
position: fixed;
top: 460rpx;
right: 0;
box-shadow: 0 6rpx 6rpx rgba(0,0,0,.2);
}
.sign-rule{
width: 130rpx;
height: 50rpx;
line-height: 50rpx;
background: #2A8DEB;
color: #fff;
font-size: 26rpx;
border-radius: 15rpx 0 0 15rpx;
text-align: center;
position: fixed;
top: 540rpx;
right: 0;
box-shadow: 0 6rpx 6rpx rgba(0,0,0,.2);
}

BIN
components/.DS_Store vendored Normal file

Binary file not shown.

BIN
components/num-controller/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

View File

@ -0,0 +1,53 @@
Component({
/**
* 组件的属性列表
*/
properties: {
nameId: {
type: String
},
num: {
type: Number,
value: 0
},
int: {
type: Number,
value: 1
},
min: {
type: Number,
value: 0
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
numChange() {
this.triggerEvent('numChange', {
num: this.properties.num,
nameId: this.properties.nameId
})
},
add() {
this.setData({
num: this.properties.num + this.properties.int
})
this.numChange()
},
sub() {
this.setData({
num: this.properties.num - this.properties.int <= 0 ? 0 : this.properties.num - this.properties.int
})
this.numChange()
}
}
})

View File

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

View File

@ -0,0 +1,7 @@
<view class="num-controller">
<!-- <image src="images/minus.png" class="{{num <= min ?'hide': ''}}" bindtap="sub"></image> -->
<button class="default" size="mini" hover-class="none" class="{{num <= min ?'hide': ''}}" bindtap="sub">-</button>
<text class="num">{{num}}</text>
<!-- <image src="images/plus.png" bindtap="add"></image> -->
<button class="default" size="mini" hover-class="none" bindtap="add">+</button>
</view>

View File

@ -0,0 +1,4 @@
/*加号和减号*/
.num-controller img {
width: 19px;
}

View File

@ -0,0 +1,44 @@
Page({
data: {
// input默认是1
num: 1,
// 使用data数据对象设置样式名
minusStatus: 'disabled'
},
/* 点击减号 */
bindMinus: function() {
var num = this.data.num;
// 如果大于1时才可以减
if (num > 1) {
num --;
}
// 只有大于一件的时候才能normal状态否则disable状态
var minusStatus = num <= 1 ? 'disabled' : 'normal';
// 将数值与状态写回
this.setData({
num: num,
minusStatus: minusStatus
});
},
/* 点击加号 */
bindPlus: function() {
var num = this.data.num;
// 不作过多考虑自增1
num ++;
// 只有大于一件的时候才能normal状态否则disable状态
var minusStatus = num < 1 ? 'disabled' : 'normal';
// 将数值与状态写回
this.setData({
num: num,
minusStatus: minusStatus
});
},
/* 输入框事件 */
bindManual: function(e) {
var num = e.detail.value;
// 将数值与状态写回
this.setData({
num: num
});
}
})

View File

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

View File

@ -0,0 +1,9 @@
<!-- 主容器 -->
<view class="stepper">
<!-- 减号 -->
<button class="{{minusStatus}} default" hover-class="none" size="mini" bindtap="bindMinus">-</button>
<!-- 数值 -->
<input type="number" bindchange="bindManual" value="{{num}}" />
<!-- 加号 -->
<button class="default" size="mini" hover-class="none" bindtap="bindPlus">+</button>
</view>

View File

@ -0,0 +1,51 @@
/*全局样式*/
page {
padding: 20px 0;
}
/*主容器*/
.stepper {
width: 95px;
height: 26px;
/*给主容器设一个边框*/
border: 1px solid #ccc;
border-radius: 3px;
margin:0 auto;
}
/*加号和减号*/
.stepper text {
width: 19px;
line-height: 26px;
text-align: center;
float: left;
}
.stepper button {
width: 19px;
line-height: 22px;
text-align: center;
float: left;
}
/*数值*/
.stepper input {
width: 40px;
height: 26px;
float: left;
margin: 0 auto;
text-align: center;
font-size: 12px;
/*给中间的input设置左右边框即可*/
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
}
/*普通样式*/
.stepper .normal{
color: black;
}
/*禁用样式*/
.stepper .disabled{
color: #ccc;
}

32
config.js Normal file
View File

@ -0,0 +1,32 @@
// var host = "https://carbonneutral.bjfs.org.cn";//线上
// var host = "https://carbon.my-footprint.cn";//线上域名2
// var host = "https://tanzhonghe-admin.com";//本地
var host = "https://carbon.scdxtc.cn";//大向天诚服务器
var config = {
host: host,
appkey: '8c10f27733333fef726885b08ff9d858',//appkey
newsList: host + '/dxtc-apiCarbonArticles',
newsDetail: host + '/dxtc-apiCarbonArticleDetail',
markList: host + "/dxtc-apiFootMarkList",
upImg: host + "/dxtc-apiCustomUserAvatar",
getUserInfo: host + '/dxtc-apiUserDetail',
apiLogin: host + '/dxtc-apiLogin',
getMedal: host + '/dxtc-apiCertificates',
getTemplate: host + '/dxtc-apiCalculators',
getCertificate: host + '/dxtc-apiCertificates',
postResult: host + '/dxtc-apiCarbonCalc',
gMarketDetail: host + '/dxtc-apiFootMarkDetail',
getThreeList: host + '/dxtc-apiTreeCases',
getapiCasesV2: host + '/dxtc-apiCasesV2',
postPayData: host + '/dxtc-apiNeutralizationPay',
postPayDataV2: host + '/dxtc-apiNeutralizationPayV2',
apiEditUserInfo: host + '/dxtc-apiEditUserInfo',
apiCustomEditUserInfo: host + '/dxtc-apiCustomEditUserInfo',
apiNeutralizationPaid: host + '/dxtc-apiNeutralizationPaid',
apiNeutralizationPaidV2: host + '/dxtc-apiNeutralizationPaidV2',
apiAllUserMedal: host + '/dxtc-apiAllUserMedal',
}
module.exports = config;

41
custom-tab-bar/index.js Normal file
View File

@ -0,0 +1,41 @@
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'
});
}
},
})

View File

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

21
custom-tab-bar/index.wxml Normal file
View File

@ -0,0 +1,21 @@
<!--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>
</cover-view>

68
custom-tab-bar/index.wxss Normal file
View File

@ -0,0 +1,68 @@
.tab-bar-border {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 160rpx;
overflow: auto;
}
.tab-bar-border .border{
background: white;
border-radius: 30rpx 30rpx 0 0;
width: 750rpx;
height: 120rpx;
z-index: 1;
position: absolute;
bottom: 0;
box-shadow: 0 -5px 5px rgba(0, 0, 0, 0.20);
-webkit-box-shadow: 0 -5px 5px rgba(0, 0, 0, 0.20);
}
.tab-bar {
min-height: 160rpx;
display: flex;
position: relative;
z-index: 2;
overflow: auto;
}
.tab-bar-item {
flex: 1;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
overflow: auto;
padding-top: 49rpx;
}
.tab-bar-item cover-image {
/* width: 40rpx; */
/* height: 40rpx; */
}
.middle{
padding-top: 0!important;
position: relative;
}
.tab-bar .selected {
/* padding-top: 0; */
}
.tab-bar-item cover-view {
position: relative;
top: 0rpx;
width: 100%;
left: 0;
height: 60rpx;
line-height: 60rpx;
font-size: 30rpx;
z-index: 99;
/* margin-top: -90rpx; */
}
cover-view{
overflow: auto;
white-space: initial;
pointer-events: none;
}

BIN
img/.DS_Store vendored Normal file

Binary file not shown.

BIN
img/001.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
img/002.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
img/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 KiB

BIN
img/cheindex2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/cheindex3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/img_02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
img/img_03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
img/money.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/moren.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
img/nav/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
img/nav/content.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
img/nav/didian.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
img/nav/down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
img/nav/jianpai.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/nav/jianpaiIndex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/nav/left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
img/nav/menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/nav/menu0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/nav/menu0_t.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/nav/menu1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/nav/menu1_t.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/nav/menu2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/nav/menu2_t.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/nav/menuIndex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/nav/save.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/nav/share2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
img/nav/shumu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
img/nav/time.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/nav/tzh_default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
img/nav/user.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
img/nav/userIndex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
img/nav/xiadan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/nav/zhengshu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
img/nav/zhonghe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/nav/zhongheIndex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/share.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
img/success.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
img/weixin.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

BIN
img/xuanz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/zhengshu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

BIN
img/zhiwen.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

123
pages/auth/auth.js Normal file
View File

@ -0,0 +1,123 @@
var app = getApp();
var urlPath = require('../../config.js');
Page({
data: {
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
// onAuth() {
// let that = this
// wx.getSetting({
// success: (res) => {
// // console.log(res, '设置信息')
// // if (res.authSetting['scope.userInfo']) {
// wx.getUserInfo({
// lang: "zh_CN",
// success: function(res) {
// // console.log(res, '用户信息')
// getApp().globalData.userInfo = res.userInfo
// wx.setStorageSync('nickname', res.userInfo.nickName);
// wx.setStorageSync('address', res.userInfo.province + " · " + res.userInfo.city);
// wx.setStorageSync('wx_avatar', res.userInfo.avatarUrl);
// //保存用户资料
// wx.request({
// url: urlPath.apiEditUserInfo,
// method: 'post',
// header: {
// 'content-type': 'application/x-www-form-urlencoded',
// 'openid': wx.getStorageSync('openid')
// },
// dataType: 'json', // 添加这个配置
// data: {
// 'openid': wx.getStorageSync('openid'),
// nick_name: res.userInfo.nickName,
// address: res.userInfo.province + " · " + res.userInfo.city,
// wx_avatar: res.userInfo.avatarUrl,
// },
// success(res) {
// wx.reLaunch({
// url: '/pages/guide/guide',
// })
// }
// })
// }
// })
// // }
// }
// })
// },
getUserProfile(e) {
let that = this
wx.getUserProfile({
desc: '用于完善会员资料',
lang: "zh_CN",
success: (res) => {
getApp().globalData.userInfo = res.userInfo
wx.setStorageSync('nickname', res.userInfo.nickName);
wx.setStorageSync('address', res.userInfo.province + " · " + res.userInfo.city);
wx.setStorageSync('wx_avatar', res.userInfo.avatarUrl);
//保存用户资料
wx.request({
url: urlPath.apiEditUserInfo,
method: 'post',
header: {
'content-type': 'application/x-www-form-urlencoded',
'openid': wx.getStorageSync('openid')
},
dataType: 'json', // 添加这个配置
data: {
'openid': wx.getStorageSync('openid'),
appkey:urlPath.appkey,
nick_name: res.userInfo.nickName,
province: res.userInfo.province ,
city: res.userInfo.city,
county:'',
wx_avatar:res.userInfo.avatarUrl
},
success(res) {
// that.onShow()
wx.reLaunch({
url: '/pages/new-page/index',
})
}
})
}
})
},
onShow:function(){
wx.login({
success(res) {
if (res.code) {
console.log(res)
//发起网络请求
wx.request({
url: urlPath.apiLogin,
method: 'post',
header: {
'content-type': 'application/x-www-form-urlencoded' // 改变默认值为这个配置
},
dataType: 'json', // 添加这个配置
data: {
code: res.code,
appkey:urlPath.appkey
},
success(res) {
var openid = JSON.parse(res.data.data).openid;
getApp().globalData.userInfo = JSON.parse(res.data.data)
wx.setStorageSync('openid', openid);
}
})
} else {
console.log('登录失败!' + res.code)
}
},
fail(res){
console.log(res)
}
})
}
})

3
pages/auth/auth.json Normal file
View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

7
pages/auth/auth.wxml Normal file
View File

@ -0,0 +1,7 @@
<view class="auth">
<image src="/img/weixin.jpg" class="img" mode="aspectFill"></image>
<view class="title">微信授权页面</view>
<view class="describe">此页面是微信授权页面,点击下方按钮弹出授权或跳转页面</view>
<button class="btn" open-type='getUserInfo' wx:if="{{canIUse}}" bindtap="getUserProfile">点击微信授权</button>
<navigator wx:if="{{!canIUse}}" class="btn" url="/pages/auth/auth" open-type="reLaunch" hover-class="other-navigator-hover">已经授权点击调转</navigator>
</view>

68
pages/auth/auth.wxss Normal file
View File

@ -0,0 +1,68 @@
/* 开始 */
page {
height: 100%;
display: table;
}
.auth {
margin-top: 0;
text-align: center;
display: table-cell;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
align-items: flex-start;
padding: 100rpx;
vertical-align: middle;
}
.img {
border-radius: 50%;
border: 1px solid #fff;
background-color: #fff;
margin: 0 0 60rpx;
display: inline-block;
width: 200rpx;
height: 200rpx;
line-height: 0;
}
.title {
display: inline-block;
width: 100%;
margin: 0 0 60rpx;
}
.describe {
color: #a7aaa9;
font-size: 26rpx;
margin: 0 0 60rpx;
border-radius: 50%;
text-align: center;
display: inline-block;
width: 100%;
}
.btn {
padding: 0 60rpx;
background-color: #19be6b;
margin: 20rpx 0 200rpx;
text-align: center;
vertical-align: middle;
touch-action: manipulation;
cursor: pointer;
background-image: none;
white-space: nowrap;
user-select: none;
font-size: 14px;
border: 0 !important;
position: relative;
text-decoration: none;
height: 44px;
line-height: 44px;
box-shadow: inset 0 0 0 1px #19be6b;
background: #fff !important;
color: #19be6b !important;
display: inline-block;
border-radius: 10rpx;
}

View File

@ -0,0 +1,86 @@
// pages/certificate/certificate.js
var urlPath = require('../../config.js');
Page({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
host: urlPath.host,
list: [],
page: 1,
size: 10,
},
// 获取证书列表信息
getList: function() {
var that = this
that.getNewsData();
},
getNewsData: function() {
var that = this
wx.request({
url: urlPath.getCertificate,
header: {
'content-type': 'application/x-www-form-urlencoded'
},
dataType: 'json', // 添加这个配置
method: 'post',
data: {
openid: wx.getStorageSync('openid'),
page: that.data.page,
size: that.data.size
},
success(res) {
var list = that.data.list;
var this_data = JSON.parse(res.data.data);
if (res.data.result == 'success' && this_data.length > 0) {
console.log(list.concat(this_data));
that.setData({
list: list.concat(this_data),
page: that.data.page + 1
})
}
}
});
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
this.getNewsData()
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.getList()
},
/**
* 组件的方法列表
*/
methods: {
},
img_url: function(e) {
var imgurl = e.currentTarget.dataset.imgurl;
// console.log('/pages/certificate_detail/certificate_detail?imgurl='+imgurl)
wx.navigateTo({
url: '/pages/certificate_detail/certificate_detail?imgurl='+imgurl,
})
}
})

View File

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

View File

@ -0,0 +1,10 @@
<!--pages/certificate/certificate.wxml-->
<view class="centent">
<!-- <image src="item.img?'':'img/zhengshu.png'" wx:for="{{list}}"></image> -->
<block wx:for="{{list}}" wx:key ="index">
<image mode="aspectFit" bindtap="img_url" data-imgurl="{{item.img!=''?(host+item.img):'/img/zhengshu.png'}}" src="{{item.img!=''?(host+item.img):'/img/zhengshu.png'}}"></image>
</block>
<view wx:if="{{list.length<=0}}" style="text-align: center;">当前没有证书</view>
</view>

View File

@ -0,0 +1,14 @@
/* pages/certificate/certificate.wxss */
.centent{
width: 98%;
margin: 20rpx auto;
}
.centent image{
width: 44%;
margin: 2%;
padding: 1%;
height:600rpx;
box-shadow: 5rpx 0rpx 10rpx 10rpx #eee;
float: left;
}

View File

@ -0,0 +1,64 @@
// pages/certificate/certificate.js
var urlPath = require('../../config.js');
Page({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
img: "/img/zhengshu.png"
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
if(options.imgurl!=undefined){
this.setData({
img:options.imgurl
})
}
},
/**
* 组件的方法列表
*/
methods: {
},
// 3 button 的开放功能<button open-type="share">分享</button>
onShareAppMessage: function(res) {
var that = this;
// 返回数据
return {
title: "碳中和达人",
path: '/pages/guide/guide' ,
success: function(res) {
// 转发成功,可以把当前页面的链接发送给后端,用于记录当前页面被转发了多少次或其他业务
},
fail: function(res) {
// 转发失败
}
}
},
})

View File

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

View File

@ -0,0 +1,14 @@
<!--pages/certificate/certificate.wxml-->
<view class="centent">
<!-- <image src="item.img?'':'img/zhengshu.png'" wx:for="{{list}}"></image> -->
<image src="{{img}}"></image>
</view>
<view class="share-content">
<button class="share" open-type="share" >
<image src="/img/nav/share2.jpg"></image>
分享给好友
</button>
</view>

View File

@ -0,0 +1,41 @@
/* pages/certificate/certificate.wxss */
.centent {
width: 598rpx;
margin: 20rpx auto;
}
.centent image {
width: 598rpx;
height: 989rpx;
margin: auto;
display: block;
}
.share-content{
width: 750rpx;
height: 120rpx;
box-shadow: 0 -10rpx 10rpx rgba(0,0,0,.1);
position: fixed;
bottom: 0;
left: ;
}
.share {
width:700rpx!important;
height: 80rpx!important;
line-height: 80rpx !important;
padding: 0!important;
margin: 10px auto!important;
text-align: center;
color: #fff;
background: #4bb547;
font-size: 28rpx !important;
border-radius: 10rpx;
}
.share image{
width: 33rpx;
height: 33rpx;
/* float: left; */
vertical-align:middle;
padding: 0 5rpx;
}

101
pages/details/details.js Normal file
View File

@ -0,0 +1,101 @@
// pages/details.js
var urlPath = require('../../config.js');
Page({
/**
* 页面的初始数据
*/
data: {
oneData: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.getOneData(options.id)
},
getOneData: function(id) {
var that = this
wx.request({
url: urlPath.newsDetail,
header: {
'content-type': 'application/x-www-form-urlencoded' // 改变默认值为这个配置
},
dataType: 'json', // 添加这个配置
method: 'post',
data: {
id: id
},
success(res) {
var oneData = res.data.data;
var jsonDa = JSON.parse(oneData).content.replace(/<img/gi,
"< img class='richImg'style='width:auto!important;height:auto!important;max-height:100%;width:100%;'"
);
//遍历得到的数据给img添加CSS和style
var newResData = (jsonDa);
// console.log(newResData); //得到的数据含有img标签的都有richImg类
that.setData({
newResData: newResData,
})
if (res.data.result == 'success') {
that.setData({
oneData: JSON.parse(res.data.data)
})
} else {
console.log(res.data.msg); //失败
}
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,15 @@
<!--pages/details.wxml-->
<nav-page ></nav-page>
<view class="details">
<view class="title">
{{oneData.title}}
</view>
<view class="time">
{{oneData.addedDate}}-
{{oneData.author}}
</view>
<view class="desc">
摘要: {{oneData.summary}}
</view>
<rich-text nodes="{{newResData}}"> </rich-text>
</view>

View File

@ -0,0 +1,28 @@
/* pages/details.wxss */
.details{
padding: 20rpx;
}
.title{
font-weight: bold;
font-size: 50rpx;
}
.time{
color: #ccc;
padding: 20rpx;
}
.desc{
background: #f5f5f5;
padding: 30rpx;
margin-bottom: 20rpx;
font-size: 24rpx;
}
rich-text{
line-height: 48rpx;
}
rich-text .richImg{
max-width: 100%;
max-height: 100%;
vertical-align: middle;
height: auto!important;
width: auto!important;
}

View File

@ -0,0 +1,106 @@
// pages/footprint/footprint.js
var urlPath = require('../../config.js');
Page({
/**
* 页面的初始数据
*/
data: {
host:urlPath.host,
data_list: [
// {
// name:'低碳婚礼',
// icon:'/img/nav/huaindex.png',
// time:'2020年12月12日',
// img:'/img/001.png',
// num1:'300KG',
// num2:'300KG',
// num3:'300元',
// num4:'油松',
// address:'北京一环碳中和林(妍清洁的)',
// },{
// name:'低碳婚礼',
// icon:'/img/nav/time.png',
// time:'2020年12月12日',
// img:'/img/001.png',
// num1:'300KG',
// num2:'300KG',
// num3:'300元',
// num4:'油松',
// address:'北京一环碳中和林(妍清洁的)',
// },{
// name:'低碳婚礼',
// icon:'/img/nav/cheindex.png',
// time:'2020年12月12日',
// img:'/img/001.png',
// num1:'300KG',
// num2:'300KG',
// num3:'300元',
// num4:'油松',
// address:'北京一环碳中和林(妍清洁的)',
// }
],
page: 1,
},
timestampToTime: function(timestamp) {
var date = new Date(timestamp * 1000); //时间戳为10位需*1000时间戳为13位的话不需乘1000
var Y = date.getFullYear() ;
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) ;
var D = date.getDate() ;
var h = date.getHours() + ':';
var m = date.getMinutes() + ':';
var s = date.getSeconds();
return Y+'年' + M+'月' + D+'日' ;//+ h + m + s;
},
onLoad: function(options) {
this.getData(options)
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
this.setData({
page: this.data.page + 1
})
this.getData()
},
getData: function(openid) {
var that = this
wx.request({
url: urlPath.markList,
header: {
'content-type': 'application/x-www-form-urlencoded' // 改变默认值为这个配置
},
dataType: 'json', // 添加这个配置
method: 'post',
data: {
openid: wx.getStorageSync('openid'),
page: that.data.page,
size: '10'
},
success(res) {
if (res.data.result == 'success') {
let data_list = JSON.parse(res.data.data)
.list; // that.data.data_list.concat(JSON.parse(res.data.data).list)
data_list.forEach(function(item) {
item.created_time = that.timestampToTime(item.created_time);
item.start_date_time = that.timestampToTime(item.start_date_time);
item.end_date_time = that.timestampToTime(item.end_date_time);
})
console.log(data_list,'data_list')
that.setData({
data_list: that.data.data_list.concat(data_list),
})
} else {
console.log(res.msg); //失败
}
}
});
},
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,30 @@
<!--pages/footprint/footprint.wxml-->
<view class="content">
<view class="list-item" wx:for="{{data_list}}" wx:key="unique">
<view class="item-title">
<view class="name">
<image src="{{item.template_icon_img!=''?host+item.template_icon_img:'/img/nav/menu2.png'}}" role="img"></image>
<view>{{item.template_name}}</view>
</view>
<view class="time">
{{item.start_date_time}} — {{item.end_date_time}}
</view>
</view>
<view class="info">
<image src="{{item.neutralization && item.neutralization.tree_info.length > 0 ? item.neutralization.tree_info[0].tree_img:host+item.template_footmark_img}}"></image>
<view class="info-list">
<view class="info-left green ">减排量:{{item.reduction_amount}}</view>
<view class="info-right orange">实际排放量:{{item.discharge_amount}}</view>
</view>
<view class="info-list">
<view class="info-left ">碳中和捐款:{{item.neutralization?item.neutralization.paid_money:'0.00'}}</view>
<view class="info-right ">树种选择:{{item.neutralization && item.neutralization.tree_info.length > 0 ? item.neutralization.tree_info[0].tree_name:'暂无'}}</view>
</view>
<view class="info-list">
参与项目:{{item.neutralization?item.neutralization.case_info.name:'暂无'}}
</view>
</view>
</view>
<view wx:if="{{data_list.length<=0}}" style="text-align: center;">当前没有足迹</view>
</view>

View File

@ -0,0 +1,62 @@
/* pages/footprint/footprint.wxss */
.list-item{
border: 1rpx solid #dee;
box-shadow: 0 0rpx 10rpx 0rpx #ccc;
margin: 20rpx;
padding: 0 20rpx;
}
.item-title{
display: inline-block;
width: 100%;
padding: 20rpx 0;
border-bottom: 1rpx solid #eee;
}
.item-title .name{
float: left;
width: 50%;
}
.item-title image{
width: 30rpx;
height: 30rpx;
float: left;
padding-right: 20rpx;
padding-top: 5rpx;
}
.item-title .time{
float: right;
font-size: 24rpx;
}
.info{
display: inline-block;
padding: 20rpx 0;
font-size: 22rpx;
width: 100%;
}
.info image{
width: 170rpx;
height: 170rpx;
float: left;
}
.info-list{
width: calc(100% - 170rpx);
float: right;
/* height: 50rpx; */
padding:15rpx 0rpx 15rpx 30rpx;
}
.info-list .info-left{
float: left;
width: 50%;
}
.info-list .green{
color: #0a4519;
font-weight: bold;
}
.info-list .orange{
font-weight: bold;
color: #ffab0b;
}
.info-list .info-right{
width: 50%;
float: right;
}

401
pages/gproduct/gproduct.js Normal file
View File

@ -0,0 +1,401 @@
// pages/product/produst.js
var urlPath = require('../../config.js');
Page({
/**
* 页面的初始数据
*/
data: {
host: urlPath.host,
list: {},
isXiangm: false,
newDo_type: '',
threeList: [],
curCaseIndex: 0,
addressIndex: 0,
curThreeCode: [],
carbon: 0,
paid_money: '0',
id: 0,
tree_num: {},
icon: "/img/nav/menu1.png",
priceList: {},
carbon_neutralization: 0,
carbon_efficiency: '0.00',
senIndex: 0,
senList: [{
name: '补植补造',
type: 'afforestation'
},
{
name: '森林管护',
type: 'forest_management'
},
],
newType: '',
isShif: false,
cases_position_id: ''
},
senChange(event) {
this.setData({
senIndex: event.detail.value,
newType: this.data.senList[event.detail.value].type,
priceList: {},
curThreeCode: [],
tree_num: {},
})
if (event.detail.value == 1) {
this.setData({
isShif: true,
newDo_type: this.data.senList[this.data.senIndex].type
})
} else {
this.setData({
isShif: false,
newDo_type: this.data.senList[this.data.senIndex].type
})
}
},
casesChange(event) {
this.setData({
curCaseIndex: event.detail.value,
isShif: false,
senIndex: 0,
addressIndex:0,
priceList: {},
curThreeCode: [],
tree_num: {},
paid_money: 0,
carbon_neutralization: 0,
carbon_efficiency: "0.00",
})
if (event.detail.value == 1) {
this.setData({
isXiangm: true,
newDo_type: this.data.senList[this.data.senIndex].type,
cases_position_id:this.data.threeList[this.data.curCaseIndex].address[0].id
})
} else {
this.setData({
isXiangm: false,
newDo_type: this.data.threeList[this.data.curCaseIndex].type,
cases_position_id:this.data.threeList[this.data.curCaseIndex].address[0].id
})
}
},
addrressChange(event) {
this.setData({
addressIndex: event.detail.value,
cases_position_id: this.data.threeList[this.data.curCaseIndex].address[event.detail.value]
.id,
priceList: {},
curThreeCode: [],
tree_num: {},
})
},
numChange(event) {
const {
num,
nameId
} = event.detail
const {
price,
name,
carbon_base
} = event.mark
let all_list = {}
all_list = Object.assign({}, this.data.priceList, all_list)
if (this.data.curThreeCode.indexOf(nameId) != -1) {
if (num == 0) {
delete all_list[nameId]
this.data.curThreeCode.splice(this.data.curThreeCode.indexOf(nameId), 1)
this.setData({
curThreeCode: this.data.curThreeCode
})
} else {
all_list[nameId] = {
id: nameId,
price: price,
num: num,
name: name,
all: price * num,
carbon_base: carbon_base * num
}
}
} else {
if (num > 0) {
var data = this.data.curThreeCode
data.push(nameId)
this.setData({
curThreeCode: data
})
all_list[nameId] = {
id: nameId,
price: price,
num: num,
name: name,
all: price * num,
carbon_base: carbon_base * num
}
}
}
this.setMoneyNum(all_list);
},
setMoneyNum: function(all_list) {
var all_price = 0
var carbon_neutralization = 0,
carbon_efficiency = 100
for (var p in all_list) {
all_price = all_price + all_list[p].all
carbon_neutralization = parseFloat(carbon_neutralization) + all_list[p].carbon_base;
}
carbon_efficiency = (parseFloat(carbon_neutralization) / parseFloat(this.data.carbon)) * 100
this.setData({
priceList: all_list,
paid_money: all_price,
carbon_neutralization: parseInt((carbon_neutralization * 100)) / 100,
carbon_efficiency: carbon_efficiency.toFixed(2),
})
},
setMoney: function(e) {
//数量= 排放量 / 植物的碳汇量基数
// ,价格 = 每棵树价格 * 数量
var that = this
var {
money,
name,
carbon_base,
id
} = e.currentTarget.dataset;
let i = that.data.curThreeCode.indexOf(e.currentTarget.dataset.code);
this.data.tree_num[e.currentTarget.dataset.code] = 1
if (i == -1) {
that.data.curThreeCode.push(e.currentTarget.dataset.code);
} else {
//取消选中
that.data.curThreeCode.splice(i, 1);
delete this.data.priceList[e.currentTarget.dataset.code]
this.data.tree_num[e.currentTarget.dataset.code] = 0
}
var new_att = []
// 拿出已经存在的价格数量判断取消的内容
for (var p in this.data.priceList) {
new_att.push(p)
}
// 计算不在列表的数据加入默认数量1科
that.data.curThreeCode.map(item => {
if (new_att.indexOf(item) == -1) {
this.data.priceList[item] = {
id: id,
price: money,
num: 1,
name: name,
all: money * 1,
carbon_base: parseFloat(carbon_base)
}
}
})
this.setData({
curThreeCode: that.data.curThreeCode,
priceList: that.data.priceList,
tree_num: that.data.tree_num,
carbon_neutralization: 0
})
// 重新计算数目的结果
this.setMoneyNum(this.data.priceList)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
if (options.icon != undefined) {
this.setData({
icon: options.icon,
})
}
this.getOne(options)
},
moneyset: function(e) {
this.setData({
paid_money: e.detail.value
})
},
getOne: function(options) {
var that = this
var carbon = (options.carbon != undefined ? options.carbon : "");
var id = (options.id != undefined ? options.id : "");
wx.request({
url: urlPath.gMarketDetail,
header: {
'content-type': 'application/x-www-form-urlencoded'
},
method: 'post',
dataType: 'json', // 添加这个配置
data: {
id: id,
'openid': wx.getStorageSync('openid'),
},
success(res) {
if (res.data.result == 'success') {
that.setData({
list: JSON.parse(res.data.data),
carbon: carbon,
id: id
})
} else {
console.log(res.data.msg); //失败
}
}
})
wx.request({
url: urlPath.getapiCasesV2,
header: {'content-type': 'application/x-www-form-urlencoded'},
method: 'post',
dataType: 'json', // 添加这个配置
data: {
id: id,
'openid': wx.getStorageSync('openid')
},
success(res) {
console.log('res:',res);
if (res.data.result == 'success') {
var threeList = JSON.parse(res.data.data).cases;
that.setData({
threeList: threeList,
newDo_type: threeList[that.data.curCaseIndex].type,
cases_position_id: threeList[that.data.curCaseIndex].address[that.data.addressIndex].id
//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); //失败
}
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {},
toPay() {
var that = this
var tree_items = []
var management_items = []
if (this.data.newDo_type == 'afforestation') {
for (var p in this.data.priceList) {
tree_items.push({
coding: p,
amount: this.data.priceList[p].num
})
}
} else {
for (var p in this.data.priceList) {
management_items.push({
id: this.data.priceList[p].id,
amount: this.data.priceList[p].num
})
}
}
wx.request({
url: urlPath.postPayDataV2,
data: {
'openid': wx.getStorageSync('openid'),
footmark_id: this.data.list.id,
do_type: this.data.newDo_type,
case_coding: this.data.threeList[this.data.curCaseIndex].coding,
tree_items: JSON.stringify(tree_items) || '',
forest_management_items: JSON.stringify(management_items) || '',
paid_money: this.data.paid_money,
cases_position_id: this.data.cases_position_id
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
dataType: 'json', // 添加这个配置
method: 'post',
success(res) {
if (res.data.result == 'fail') {
wx.showModal({
title: '提示',
content: res.data.message,
})
} else {
var data = JSON.parse(res.data.data)
wx.requestPayment({
timeStamp: String(data.prepay_data.timeStamp),
nonceStr: data.prepay_data.nonceStr,
package: data.prepay_data.package,
signType: data.prepay_data.signType,
paySign: data.prepay_data.paySign,
success(res) {
//支付成功
wx.request({
url: urlPath.apiNeutralizationPaid, //查询
data: {
'openid': wx.getStorageSync('openid'),
neutralization_id: data.neutralization_id,
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
dataType: 'json', // 添加这个配置
method: 'post',
success(res) {
if (res.data.result == "success") {
wx.navigateTo({
url: '/pages/payment/payment?paid_money=' +
that.data.paid_money + "&&id=" +
that.data.id
})
}
}
})
},
fail(res) {
wx.showToast({
title: '支付失败',
icon: 'error',
duration: 2000
})
}
})
}
}
})
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"stepper": "/components/stepper/stepper",
"num-controller": "/components/num-controller"
}
}

View File

@ -0,0 +1,123 @@
<!--pages/product/produst.wxml-->
<view class="centent">
<view class="title-top">
<view>
<image style="width:38rpx;height:35rpx" src="{{icon}}"></image>
<view class="title-info">
我的{{list.template_name}}
</view>
<view class="num">
<view class="other">碳足迹数量为</view>
<view class="danwei">千克</view>
<view class="size">{{carbon}}</view>
</view>
</view>
</view>
<view class="address">
<view>
<image style="width:38rpx;height:35rpx" src="/img/nav/didian.png"></image>
<view class="title">碳中和项目</view>
<view class="info">
<picker bindchange="casesChange" value="{{curCaseIndex}}" range-key="name" range="{{threeList}}">
<view class="picker">{{threeList[curCaseIndex].name}}</view>
</picker>
</view>
</view>
</view>
<!-- 项目选择 -->
<view class="address" wx:if="{{isXiangm}}">
<view class="title">森林经营项目</view>
<view class="info">
<picker bindchange="senChange" value="{{senIndex}}" range-key="name" range="{{senList}}">
<view class="picker">
{{senList[senIndex].name}}
</view>
</picker>
</view>
</view>
<!-- 地址选择 -->
<view class="address">
<view class="title">地址选择</view>
<view class="info">
<picker bindchange="addrressChange" value="{{addressIndex}}" range-key="info" range="{{threeList[curCaseIndex].address}}">
<view class="picker">
<!-- address -->
{{threeList[curCaseIndex].address[addressIndex].info}}
</view>
</picker>
</view>
</view>
<view class="address">
<view>
<image style="width:38rpx;height:35rpx" src="/img/nav/shumu.png"></image>
<view class="title">可选树种</view>
</view>
</view>
<!-- 植树 -->
<scroll-view wx:if="{{!isShif}}" scroll-x scroll-with-animation class="shuList">
<view wx:for="{{threeList[curCaseIndex].address[addressIndex].trees}}" wx:key="index" wx:for-index="unique" class="item"
data-num="2">
<view bindtap="setMoney" data-carbon_base="{{item.carbon_base}}" data-id="{{item.id}}" data-money="{{item.price}}"
data-code="{{item.coding}}" data-key="{{unique}}" data-name="{{item.name}}"
data-carbon="{{item.carbon_base}}">
<image mode="aspectFit" src="{{host}}{{item.img}}"></image>
<view class="title">{{item.name}}</view>
<view class="money1">碳汇能力:<view class="red">{{item.carbon_base}}</view>Kg/棵</view>
<view class="money1">造林费用: <view class="red">{{item.price}}</view> 元/棵</view>
</view>
<view style="font-size:24rpx" class="num_input">
<view class="shuzhi">栽植数量:</view>
<num-controller mark:carbon_base="{{item.carbon_base}}" mark:name="{{item.name}}"
mark:price="{{item.price}}" nameId="{{item.coding}}" num="{{tree_num[item.coding]}}"
bindnumChange="numChange"></num-controller>
</view>
<view wx:for="{{curThreeCode}}" wx:key="i" wx:for-index="i" wx:for-item="e" wx:if="{{e == item.coding}}">
<image class="icon" mode="aspectFit" src="/img/xuanz.png"></image>
</view>
</view>
</scroll-view>
<!-- 浇水、施肥 -->
<scroll-view wx:if="{{isShif}}" scroll-x scroll-with-animation class="shuList">
<view wx:for="{{threeList[curCaseIndex].address[addressIndex].forest_management}}" wx:key="index" wx:for-index="unique" class="item"
data-num="2">
<view bindtap="setMoney" data-carbon_base="{{item.carbon_base}}" data-id="{{item.id}}" data-money="{{item.price}}"
data-code="{{item.id}}" data-key="{{unique}}" data-name="{{item.name}}"
data-carbon="{{item.carbon_base}}">
<image mode="aspectFit" src="{{host}}{{item.img}}"></image>
<view class="title">{{item.name}}</view>
<view class="money1">增汇能力:<view class="red">{{item.carbon_base}}</view></view>
<view class="money1">管护费用: <view class="red">{{item.price}}</view> 元/次</view>
</view>
<view style="font-size:24rpx" class="num_input">
<view class="shuzhi">数量:</view>
<num-controller mark:carbon_base="{{item.carbon_base}}" mark:name="{{item.name}}"
mark:price="{{item.price}}" nameId="{{item.id}}" num="{{tree_num[item.id]}}"
bindnumChange="numChange"></num-controller>
</view>
<view wx:for="{{curThreeCode}}" wx:key="i" wx:for-index="i" wx:for-item="e" wx:if="{{e == item.id}}">
<image class="icon" mode="aspectFit" src="/img/xuanz.png"></image>
</view>
</view>
</scroll-view>
<view class="money">
<view class="tips">碳中和</view>
<view class="all_num ">
<view class="green">{{carbon_neutralization}}Kg</view>
<view class="efficiency">碳中和率:{{carbon_efficiency}}%</view>
</view>
</view>
<view class="money">
<view class="tips">支付</view>
<view class="all_num">
<view wx:for="{{priceList}}" wx:key="index">
{{item.name}}{{item.num}}*{{item.price}}={{item.all}}
</view>
</view>
</view>
<view class="bottom-nav">
合计支付:¥{{paid_money}}
<button class="xiadan" bindtap="toPay">
立即支付
</button>
</view>
</view>

View File

@ -0,0 +1,298 @@
/* pages/product/produst.wxss */
.centent {
width: 95%;
margin: auto;
padding-bottom: 250rpx;
}
.title-top {
width: 100%;
display: inline-block;
border-bottom: 2rpx solid #e3e3e3ab;
padding: 30rpx 0 0 0;
}
.title-top image {
float: left;
margin-right: 20rpx;
margin-top: 5rpx;
background: #e1e1e16e;
padding: 10rpx;
border-radius: 100%;
}
.title-info {
/* float: left; */
/* height: 84rpx; */
font-weight: bold;
font-size: 38rpx;
}
.other {
float: left;
color: #999;
font-size: 24rpx;
font-weight: 400;
padding-top: 5rpx;
line-height: 60rpx;
padding-left:0rpx;
}
.num {
/* float: right; */
width: 100%;
color: #020101;
height: 84rpx;
/* display: table-cell; */
vertical-align: bottom;
}
.num .size {
float: right;
font-weight: bold;
font-size: 56rpx;
height: 84rpx;
/* display: table-cell; */
vertical-align: bottom;
color:#ffab0b;
}
.danwei {
color:#ffab0b;
float: right;
padding-top: 30rpx;
font-size: 24rpx;
height: 84rpx;
/* display: table-cell; */
vertical-align: bottom;
}
.address {
width: 100%;
display: inline-block;
border-bottom: 2rpx solid #e3e3e3ab;
padding: 20rpx 0;
line-height: 40rpx;
}
.address image {
float: left;
margin-right: 20rpx;
margin-top: -5rpx;
background: #e1e1e16e;
padding: 10rpx;
border-radius: 100%;
}
.address .title {
color: #226742;
font-weight: bold;
float: left;
font-size: 28rpx;
line-height: 25px;
/* height: 27rpx; */
}
.address .info {
font-size: 24rpx;
float: right;
max-width: 65%;
overflow: hidden;
}
.shuList {
margin-top: 20rpx;
white-space: nowrap;
overflow: hidden;
height: 680rpx;
}
.shuList .item {
display: inline-block;
/* float: left; */
width: 46%;
margin: 2%;
text-align: center;
border: 2rpx solid #e3e3e3ab;
border-radius: 10rpx;
box-shadow: 0rpx 0rpx 10rpx 5rpx #ddd;
}
.item {
color: #999;
line-height: 50rpx;
position: relative;
padding-bottom: 10rpx;
}
.item image {
height: 300rpx;
width: 90%;
/* margin-top: 20rpx; */
background: #e1e1e12b;
padding: 10rpx;
/* border-radius: 100%; */
margin-top: 10rpx;
}
.item .title {
color: #333;
font-size: 28rpx;
font-weight: bold;
}
.item .title_a {
color: #226742;
font-size: 28rpx;
font-weight: bold;
}
.item .money {
font-weight: bold;
color: #226742;
}
.num_input{
/* width: 200rpx; */
/* margin:auto; */
padding: 50rpx 0 0 5rpx;
}
.num_input .shuzhi{
float: left;width: 115rpx;
line-height: 60rpx;
}
.num_input num-contorller{
width: 200rpx;
margin:auto;
}
.num_input button{
height: 60rpx;
padding: 10rpx 20rpx !important;
line-height: 40rpx !important;
/* display: inline-block; */
float: left;
border: 2rpx solid #ccc;
border-radius: 0;
width: 70rpx;
}
.num_input text{
width: 65rpx;
line-height: 60rpx !important;
float: left;
padding: 0 10rpx;
position: relative;
height: 60rpx;
/* display: inline-block; */
/* top: -15rpx; */
border: 2rpx solid #ccc;
border-left: none;
border-right: none;
}
.item .icon {
width: 59rpx;
height: 59rpx;
position: absolute;
top: -10rpx;
right: 5rpx;
background: none;
}
.bottom-nav {
position: fixed;
left: 0;
right: 0;
bottom: 0;
height: 120rpx;
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;
/* background-color: red; */
}
.xiadan {
float: right;
height: 120rpx;
line-height: 100rpx;
width: 80rpx;
background: #4bb547;
color: #fff;
border-radius: 0;
}
.money {
line-height: 60rpx;
clear: both;
border-top: 2rpx solid #e3e3e3ab;
border-bottom: 2rpx solid #e3e3e3ab;
margin: 50rox auto;
padding: 20rpx 0;
display: inline-block;
width: 100%;
}
.money image {
width: 60rpx;
height: 60rpx;
display: inline-block;
vertical-align: middle;
border-radius: 100%;
transform: scale(0.8);
background-color: rgba(0, 0, 0, 0.05);
}
.money input {
width: 200rpx;
height: 0rpx;
line-height: 40px;
display: inline-block;
vertical-align: middle;
font-size: 25rpx;
/* color: #291d1d; */
text-align: right;
}
.money .tips {
font-weight: bold;
color: #291d1d;
width: 200rpx;
height: 40rpx;
vertical-align: middle;
line-height: 40rpx;
display: inline-block;
text-align: left;
}
.all_num{
/* display: inline-block; */
width: 70%;
text-align: right;
float: right;
}
.red{
color: #f12526;
font-weight: bold;
display: inline-block;
padding: 0 5rpx;
}
.green{
color: #4bb547;
font-size: 40rpx;
font-weight: bold;
display: inline-block;
padding: 0 5rpx;
}
.efficiency{
font-size: 22rpx;
color: #4bb547;
line-height: 20rpx;
}
.money1{
font-size:24rpx
}

79
pages/guide/guide.js Normal file
View File

@ -0,0 +1,79 @@
// pages/sign/sign.js
Page({
picture() {
wx.getSetting({
success: (res) => {
if (!res.authSetting['scope.userInfo']||!wx.getStorageSync('openid')) {
wx.redirectTo({
url:"/pages/auth/auth"
})
}else{
wx.reLaunch({
url: '/pages/new-page/index'
});
}
}
})
},
data: {
title:"我要碳中和",
// visit_history:[], //品牌浏览历史
// is_iphone:'',//苹果刘海适配
// statusBarHeight: wx.getSystemInfoSync()['statusBarHeight'],
// base_info:'',
// 状态栏高度
statusBarHeight: wx.getStorageSync('statusBarHeight') + 'px',
// 导航栏高度
navigationBarHeight: wx.getStorageSync('navigationBarHeight') + 'px',
// 胶囊按钮高度
menuButtonHeight: wx.getStorageSync('menuButtonHeight') + 'px',
// 导航栏和状态栏高度
navigationBarAndStatusBarHeight:
wx.getStorageSync('statusBarHeight') +
wx.getStorageSync('navigationBarHeight') +
'px'
},
onLoad(){
const { statusBarHeight, platform } = wx.getSystemInfoSync()
const { top, height } = wx.getMenuButtonBoundingClientRect()
// 状态栏高度
wx.setStorageSync('statusBarHeight', statusBarHeight)
// 胶囊按钮高度 一般是32 如果获取不到就使用32
wx.setStorageSync('menuButtonHeight', height ? height : 32)
// 判断胶囊按钮信息是否成功获取
if (top && top !== 0 && height && height !== 0) {
const navigationBarHeight = (top - statusBarHeight) * 2 + height
// 导航栏高度
wx.setStorageSync('navigationBarHeight', navigationBarHeight)
} else {
wx.setStorageSync(
'navigationBarHeight',
platform === 'android' ? 48 : 40
)
}
},
onShow(){
this.setData({
// 状态栏高度
statusBarHeight: wx.getStorageSync('statusBarHeight') + 'px',
// 导航栏高度
navigationBarHeight: wx.getStorageSync('navigationBarHeight') + 'px',
// 胶囊按钮高度
menuButtonHeight: wx.getStorageSync('menuButtonHeight') + 'px',
// 导航栏和状态栏高度
navigationBarAndStatusBarHeight:
wx.getStorageSync('statusBarHeight') +
wx.getStorageSync('navigationBarHeight') +
'px'
})
}
})

4
pages/guide/guide.json Normal file
View File

@ -0,0 +1,4 @@
{
"navigationStyle": "custom",
"usingComponents": {}
}

37
pages/guide/guide.wxml Normal file
View File

@ -0,0 +1,37 @@
<!--guide/index.wxml-->
<!--navigationBar.wxml-->
<view class="navigation-container" style="{{'height: ' + navigationBarAndStatusBarHeight}}">
<!--空白来占位状态栏-->
<view style="{{'height: ' + statusBarHeight}}"></view>
<!--自定义导航栏-->
<view class="navigation-bar" style="{{'height:' + navigationBarHeight}}">
<view class="navigation-title" style="{{'line-height:' + navigationBarHeight}}">{{title}}</view>
</view>
</view>
<!--空白占位fixed空出的位置-->
<!-- <view style="{{'height: ' + navigationBarAndStatusBarHeight}}; background: #ffffff"></view> -->
<view class="container">
<image src="../../img/banner.png" class="bac_img"></image>
<view class="content">
<view class="page-title">
<!-- 我要碳中和 -->
</view>
<image src="../../img/logo.png" style="width:187rpx;margin:auto;display: block;height: 196rpx;"></image>
<!--内容-->
<view class="page-title1">高碳渐成过往</view>
<view class="page-title2">低碳已成时尚</view>
<view class="page-title3">‘瘦身’生活碳排放,实现绿色碳中和</view>
</view>
<view class="page-url" bindtap="picture">
<image src="../../img/zhiwen.png" class="page-url-img" ></image>
<view class="page-url-title">
开启我的碳中和之路
</view>
<view class="page-url-title-border"></view>
</view>
</view>

137
pages/guide/guide.wxss Normal file
View File

@ -0,0 +1,137 @@
/* navigationBar.wxss */
.navigation-container {
position: fixed;
width: 100%;
z-index: 99;
top: 0;
left: 0;
background-color: rgba(0,0,0,0);
}
.navigation-bar {
position: relative;
display: flex;
flex-direction: row;
align-items: center;
}
.navigation-buttons {
display: flex;
align-items: center;
margin-left: 10px;
border: 1px solid rgba(0, 0, 0, 0.05);
box-sizing: border-box;
border-radius: 15px;
background-color: rgba(0,0,0,0);
}
.nav-img{
height: 16px;
width: 16px;
}
.navigation-title {
position: absolute;
left: 104px;
right: 104px;
text-align: center;
font-size: 16px;
font-weight: bold;
color: #fff;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* pages/index.wxss */
.container{
width: 100%;
height: 100%;
/* background-image:url("~@/img/banner.png");
background-repeat: no-repeat;
background-size: 100%; */
/* background:red; */
position: relative;
padding-top: 20rpx;
}
.container .bac_img{
width:100%;
height: 911rpx;
margin:auto;
position: absolute;
z-index: 1;
top: 0;
left: 0;
}
.container .content{
width:100%;
height: 911rpx;
margin:auto;
position: relative;
z-index: 1;
top: 0;
left: 0;
}
.page-title{
color: #fff;
text-align: center;
padding:100rpx 0;
}
.page-title1{
margin-top: 50rpx;
color: #fff;
font-size: 36rpx;
width: 90%;
margin: auto;
padding:10rpx 20rpx;
padding-top: 100rpx;
}
.page-title2{
color: #fff;
font-weight: bold;
font-size: 54rpx;
width: 90%;
margin: auto;
padding:10rpx 20rpx;
}
.page-title3{
color: #fff;
background:#14c121;
padding:10rpx 20rpx;
width: 90%;
margin:20rpx auto;
font-weight: bold;
font-size: 36rpx;
border-radius: 10rpx;
}
.page-url{
position: relative;
top: 70rpx;
width: 100%;
height: auto;
/* height: 500rpx; */
/* background: red; */
text-align: center;
}
.page-url .page-url-img{
width:120rpx;
margin:auto auto 50rpx auto;
height: 120rpx;
}
.page-url-title{
padding: 20rpx 0;
/* border-bottom: 10rpx solid #14c121; */
/* display: inline; */
/* width: 100%; */
/* margin: auto; */
}
.page-url-title-border{
margin: 20rpx 0;
top: 10rpx;
border-bottom: 6rpx solid #14c121;
width: 35%;
border-radius: 10rpx;
/* display: inline; */
margin: auto;
}

109
pages/index/index.js Normal file
View File

@ -0,0 +1,109 @@
// pages/index.js
var urlPath = require('../../config.js');
const app = getApp();
Page({
goDetails(e) {
wx.navigateTo({
url: '../details/details?id=' + e.mark.id
});
},
/**
* 页面的初始数据
*/
data: {
//列表
host: urlPath.host,
works_list: [],
page: 1,
},
getNewsData: function() {
var that = this
wx.request({
url: urlPath.newsList,
header: {
'content-type': 'application/x-www-form-urlencoded'
},
dataType: 'json', // 添加这个配置
method: 'post',
data: {
page: that.data.page,
size: '10'
},
success(res) {
if (res.data.result == 'success') {
// console.log(JSON.parse(res.data.data))
that.setData({
works_list: that.data.works_list.concat(JSON.parse(res.data.data).list),
page: that.data.page + 1
})
} else {
console.log(res.msg); //失败
}
}
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.getNewsData()
//that.countDown()//倒计时监听
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
if (typeof this.getTabBar === 'function' &&
this.getTabBar()) {
this.getTabBar().setData({
selected: 0
})
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
this.setData({
page: this.data.page + 1
})
this.getNewsData()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
})

3
pages/index/index.json Normal file
View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

17
pages/index/index.wxml Normal file
View File

@ -0,0 +1,17 @@
<!--pages/index.wxml-->
<view class="container ">
<view class="index-list">
<view wx:for="{{works_list}}" wx:key="index" class="index-item" bindtap="goDetails"
data-path="/pages/details/details" data-index="{{index}}" mark:id="{{item.id}}">
<cover-image src="{{item.image ? host+item.image.primary.smallURL : '../../img/img_03.png'}}">
</cover-image>
<view class="item-content">
<view class="title">{{item.title}}</view>
<view class="time">{{item.addedDate}}</view>
<view class="content">{{item.summary}}</view>
</view>
</view>
</view>
</view>

44
pages/index/index.wxss Normal file
View File

@ -0,0 +1,44 @@
.index-list{
padding-bottom: 120rpx;
}
.index-item{
background: #fff;
margin: 10px;
padding: 15rpx;
border: 2rpx solid #e6e6e6;
border-radius: 10rpx;
}
.index-item cover-image{
float: left;
width: 210rpx;
height: 150rpx;
border-radius: 10rpx;
margin-right: 24rpx;
}
.index-item>cover-view{
float: left;
width: 62%;
padding: 0 15rpx;
line-height: 50rpx;
}
.title{
font-weight: bold;
padding: 0 10rpx 10rpx;
font-size: 30rpx;
}
.time,.content{
line-height: 35rpx;
padding: 0 10rpx 0rpx;
font-size: 25rpx;
color:rgb(122, 122, 122);
font-size: 24rpx;
}
.content{
padding-bottom: 0;
overflow: hidden;
word-wrap:break-word;
white-space: initial;
text-overflow:ellipsis;
overflow:hidden;
height: 70rpx;
}

Some files were not shown because too many files have changed in this diff Show More