first commit
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
// launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||||
|
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||||
|
"version" : "0.0",
|
||||||
|
"configurations" : [
|
||||||
|
{
|
||||||
|
"app-plus" :
|
||||||
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
|
"default" :
|
||||||
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
|
"mp-weixin" :
|
||||||
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
|
"type" : "uniCloud"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"playground" : "standard",
|
||||||
|
"type" : "uni-app:app-android"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
onLaunch: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
onShow: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
onHide: function() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* 项目样式 start */
|
||||||
|
@import url("./common/style.css");
|
||||||
|
/* 项目样式 end */
|
||||||
|
</style>
|
After Width: | Height: | Size: 198 KiB |
After Width: | Height: | Size: 198 KiB |
After Width: | Height: | Size: 198 KiB |
|
@ -0,0 +1,686 @@
|
||||||
|
image{
|
||||||
|
/* 照顾低版本浏览器 如果图片外面包含了链接会有边框的问题 */
|
||||||
|
border: 0;
|
||||||
|
/* 取消图片底侧有空白缝隙的问题 ① */
|
||||||
|
vertical-align: middle;
|
||||||
|
/* 取消图片底侧有空白缝隙的问题 ② */
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
.main{
|
||||||
|
width: 100vw;
|
||||||
|
min-height: 1920px;
|
||||||
|
background-image: url('/static/page-bg.jpg');
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
.header{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-end;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding-top: 26px;
|
||||||
|
}
|
||||||
|
.header .logo{
|
||||||
|
width: 197px;
|
||||||
|
padding: 0 0 6px 39px;
|
||||||
|
}
|
||||||
|
.header .title{
|
||||||
|
width: 480px;
|
||||||
|
}
|
||||||
|
.header .position{
|
||||||
|
width: 161px;
|
||||||
|
padding: 0 60px 6px 25px;
|
||||||
|
}
|
||||||
|
.header view image{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 轮播 */
|
||||||
|
.banner{
|
||||||
|
width: calc(100% - 150px);
|
||||||
|
box-shadow: 0 0 38px 5px #447406;
|
||||||
|
margin: 33px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 尾部 */
|
||||||
|
.footer{
|
||||||
|
background-color: #31742f;
|
||||||
|
line-height: 62px;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24px;
|
||||||
|
text-align: center;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
}
|
||||||
|
.footer>text{
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 计算器 */
|
||||||
|
.calculator-bg{
|
||||||
|
padding: 0 75px;
|
||||||
|
margin-top: 48px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.calculator-bg .bg-img{
|
||||||
|
width: 100%;
|
||||||
|
height: 350px;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.calculator-bg .bg-img>image{
|
||||||
|
width: 100%;
|
||||||
|
height: 350px;
|
||||||
|
}
|
||||||
|
.calculator{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 47px;
|
||||||
|
background-color: #fcfbd2;
|
||||||
|
}
|
||||||
|
.calculator .cate{
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 398px;
|
||||||
|
height: 771px;
|
||||||
|
margin-left: 26px;
|
||||||
|
border: 2px solid #659436;
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.calculator .cate .list{
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calculator .cate .list .title{
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.calculator .cate .list .title text{
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
.calculator .cate .list:nth-of-type(1) .title text{
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
.calculator .cate .list .title::before{
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
width: 128px;
|
||||||
|
margin-left: 12px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: left center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calculator .cate .list:nth-of-type(1) .title::before{
|
||||||
|
background-image: url('/static/icon-clothing.png');
|
||||||
|
background-size: auto 59px;
|
||||||
|
height: 59px;
|
||||||
|
}
|
||||||
|
.calculator .cate .list:nth-of-type(2) .title::before{
|
||||||
|
background-image: url('/static/icon-food.png');
|
||||||
|
background-size: auto 45px;
|
||||||
|
height: 45px;
|
||||||
|
}
|
||||||
|
.calculator .cate .list:nth-of-type(3) .title::before{
|
||||||
|
background-image: url('/static/icon-live.png');
|
||||||
|
background-size: auto 42px;
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
.calculator .cate .list:nth-of-type(4) .title::before{
|
||||||
|
background-image: url('/static/icon-go.png');
|
||||||
|
background-size: auto 36px;
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
.calculator .cate .list:nth-of-type(5) .title::before{
|
||||||
|
background-image: url('/static/icon-use.png');
|
||||||
|
background-size: auto 37px;
|
||||||
|
height: 37px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calculator .cate .list .item{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 110px;
|
||||||
|
height: 29px;
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 15px 9px 0;
|
||||||
|
background-image: url('/static/icon-btns.png');
|
||||||
|
background-size: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calculator .interface{
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 456px;
|
||||||
|
height: 768px;
|
||||||
|
padding: 40px 38px 0;
|
||||||
|
margin-right: 26px;
|
||||||
|
background-color: #669438;
|
||||||
|
border: 1px solid #31742f;
|
||||||
|
border-radius: 70px;
|
||||||
|
box-shadow: 5px 5px 0 2px #2d5305;
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 计算器界面 */
|
||||||
|
.interface .result{
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
height: 350px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border: 1px solid #31742f;
|
||||||
|
border-radius: 15px;
|
||||||
|
padding: 6px 26px;
|
||||||
|
font-size: 24px;
|
||||||
|
line-height: 1.4;
|
||||||
|
color: #659437;
|
||||||
|
}
|
||||||
|
.interface .result .individual{
|
||||||
|
padding: 6px 0;
|
||||||
|
border-bottom: 1px solid #ddd949;
|
||||||
|
}
|
||||||
|
.interface .result .subtotal{
|
||||||
|
padding: 6px 0;
|
||||||
|
}
|
||||||
|
.interface .result .total{
|
||||||
|
padding: 18px 0 15px;
|
||||||
|
border-top: 1px solid #ddd949;
|
||||||
|
}
|
||||||
|
.interface .result .item{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.interface .result .item view:first-child{
|
||||||
|
width: 118px;
|
||||||
|
margin-right: 28px;
|
||||||
|
}
|
||||||
|
.interface .result .item view:nth-of-type(2){
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
.interface .result .subtotal .item view:first-child{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.interface .result .individual .item view:first-child{
|
||||||
|
width: 146px;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
.interface .result .item view:nth-of-type(2){
|
||||||
|
width: calc(100% - 240px);
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.interface .result .item view:last-child{
|
||||||
|
width: 74px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.interface .result .total .item view:first-child{
|
||||||
|
letter-spacing: 5px;
|
||||||
|
}
|
||||||
|
.interface .result .item view input{
|
||||||
|
width: 100%;
|
||||||
|
font-size: 24px;
|
||||||
|
/* white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
direction: rtl */;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 计算器按钮 */
|
||||||
|
.interface-btns{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interface-btns .num,
|
||||||
|
.interface-btns .operate{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: 260px;
|
||||||
|
}
|
||||||
|
.interface-btns .num .btn,
|
||||||
|
.interface-btns .operate .btn{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 71px;
|
||||||
|
height: 71px;
|
||||||
|
margin-top: 12px;
|
||||||
|
background-image: url('/static/icon-btn-01.png');
|
||||||
|
background-size: cover;
|
||||||
|
font-size: 26px;
|
||||||
|
color: #1c5e2e;
|
||||||
|
}
|
||||||
|
.interface-btns .num .btn:last-child{
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-bottom: 22px;
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interface-btns .operate{
|
||||||
|
width: 90px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interface-btns .operate .btn{
|
||||||
|
width: 90px;
|
||||||
|
height: 153px;
|
||||||
|
margin-top: 12px;
|
||||||
|
background-image: url('/static/icon-btn-02.png');
|
||||||
|
}
|
||||||
|
.interface-btns .operate .btn:last-child{
|
||||||
|
writing-mode: tb-rl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 切换按钮 */
|
||||||
|
.calculator .nav-btns{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 46px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.calculator .nav-btns .btn{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 271px;
|
||||||
|
height: 73px;
|
||||||
|
background-image: url('/static/icon-tabbar.png');
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
.calculator .nav-btns .btn.active{
|
||||||
|
background-image: url('/static/icon-tabbar-active.png');
|
||||||
|
}
|
||||||
|
.calculator .nav-btns .btn image{
|
||||||
|
height: 27px;
|
||||||
|
margin-top: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 操作说明 */
|
||||||
|
.calculator .explain{
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 32px;
|
||||||
|
line-height: 51px;
|
||||||
|
font-size: 20px;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #31742f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 评估碳足迹 */
|
||||||
|
.calculator-other{
|
||||||
|
padding: 26px 0 16px;
|
||||||
|
}
|
||||||
|
.assess,
|
||||||
|
.eliminate{
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
/* 标题 */
|
||||||
|
.assess-title,
|
||||||
|
.eliminate-title{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 26px;
|
||||||
|
}
|
||||||
|
.assess-title>image,
|
||||||
|
.eliminate-title>image{
|
||||||
|
height: 29px;
|
||||||
|
}
|
||||||
|
.total-num{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.total-num .num{
|
||||||
|
width: 39px;
|
||||||
|
line-height: 33px;
|
||||||
|
margin: 0 7px;
|
||||||
|
background-color: #31742f;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.total-num .num:nth-last-of-type(3){
|
||||||
|
background: none;
|
||||||
|
color: #31742f;
|
||||||
|
font-size: 24px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.total-num image{
|
||||||
|
height: 24px;
|
||||||
|
margin-left: 7px;
|
||||||
|
}
|
||||||
|
.assess-form,
|
||||||
|
.assess-contrast{
|
||||||
|
padding: 0 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 柱状图 */
|
||||||
|
.assess-form{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.histogram{
|
||||||
|
width: calc(100% - 400px);
|
||||||
|
height: 370px;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
.histogram .form-list{
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
height: 300px;
|
||||||
|
border-bottom: 2px solid #31742f;
|
||||||
|
}
|
||||||
|
.histogram .form-item{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
height: 280px;
|
||||||
|
width: calc(100%/5);
|
||||||
|
overflow: hidden;
|
||||||
|
animation-name: changeHeight;
|
||||||
|
animation-duration: 1.2s;
|
||||||
|
animation-iteration-count:1;
|
||||||
|
}
|
||||||
|
.histogram .form-item text{
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.histogram .form-item view{
|
||||||
|
width: 28px;
|
||||||
|
border-radius: 14px;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes changeHeight {
|
||||||
|
from {height: 0;}
|
||||||
|
to {height: 280px;}
|
||||||
|
}
|
||||||
|
|
||||||
|
.histogram .form-item:nth-of-type(1) view{
|
||||||
|
background-image: linear-gradient(to top,rgba(166,254,165,0),rgba(166,254,165,1));
|
||||||
|
}
|
||||||
|
.histogram .form-item:nth-of-type(2) view{
|
||||||
|
background-image: linear-gradient(to top,rgba(255,181,76,0),rgba(255,181,76,1));
|
||||||
|
}
|
||||||
|
.histogram .form-item:nth-of-type(3) view{
|
||||||
|
background-image: linear-gradient(to top,rgba(148,223,222,0),rgba(148,223,222,1));
|
||||||
|
}
|
||||||
|
.histogram .form-item:nth-of-type(4) view{
|
||||||
|
background-image: linear-gradient(to top,rgba(255,218,173,0),rgba(255,218,173,1));
|
||||||
|
}
|
||||||
|
.histogram .form-item:nth-of-type(5) view{
|
||||||
|
background-image: linear-gradient(to top,rgba(136,136,172,0),rgba(136,136,172,1));
|
||||||
|
}
|
||||||
|
.form-title{
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
.form-title view{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: calc(100%/5);
|
||||||
|
}
|
||||||
|
.form-title image{
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 饼图 */
|
||||||
|
.pie-chart{
|
||||||
|
width: 400px;
|
||||||
|
height: 400px;
|
||||||
|
margin-right: -30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 对比 */
|
||||||
|
.assess-txt{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 26px;
|
||||||
|
margin: 15px 0 42px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.assess-btns{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
box-shadow: 1px 1px 0 1px rgba(45, 83, 5, .35);
|
||||||
|
width: 110px;
|
||||||
|
height: 30px;
|
||||||
|
border: 1px solid #959795;
|
||||||
|
border-radius: 7px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 0 7px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
.assess-btns .btn{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 32px;
|
||||||
|
height: 30px;
|
||||||
|
background-image: linear-gradient(to top,#d0cfd1,#f7f7f7);
|
||||||
|
}
|
||||||
|
.assess-btns .btn image{
|
||||||
|
width: 19px;
|
||||||
|
}
|
||||||
|
.assess-btns input{
|
||||||
|
width: calc(100% - 70px);
|
||||||
|
height: 30px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.assess-txt text{
|
||||||
|
color: #327531;
|
||||||
|
}
|
||||||
|
.assess-contrast>image{
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 1px solid #98b992;
|
||||||
|
}
|
||||||
|
.assess-contrast .list{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px solid #31742f;
|
||||||
|
}
|
||||||
|
.assess-contrast .item{
|
||||||
|
text-align: center;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
.assess-contrast .item:nth-of-type(1) text{
|
||||||
|
color: #327531;
|
||||||
|
}
|
||||||
|
.assess-contrast .item:nth-of-type(1){
|
||||||
|
width: 104px;
|
||||||
|
}
|
||||||
|
.assess-contrast .item:nth-of-type(2){
|
||||||
|
width: 134px;
|
||||||
|
}
|
||||||
|
.assess-contrast .item:nth-of-type(3){
|
||||||
|
width: 176px;
|
||||||
|
}
|
||||||
|
.assess-contrast .item:nth-of-type(4){
|
||||||
|
width: 138px;
|
||||||
|
}
|
||||||
|
.assess-contrast .item:nth-of-type(5){
|
||||||
|
width: 262px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 消除碳足迹 */
|
||||||
|
.eliminate .tips{
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: calc(100% - 52px);
|
||||||
|
margin: 20px auto 0;
|
||||||
|
padding: 20px 35px;
|
||||||
|
background-image: linear-gradient(to top,rgba(181,250,172,1),rgba(181,250,172,0));
|
||||||
|
font-size: 19px;
|
||||||
|
line-height: 2.2;
|
||||||
|
}
|
||||||
|
.eliminate .tips text{
|
||||||
|
color: #337632;
|
||||||
|
margin: 0 32px;
|
||||||
|
}
|
||||||
|
.eliminate-img{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 63px 26px 45px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.eliminate-img>image{
|
||||||
|
height: 495px;
|
||||||
|
}
|
||||||
|
.eliminate-img .payment-btn{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 271px;
|
||||||
|
height: 67px;
|
||||||
|
background-image: url(/static/icon-payment.png);
|
||||||
|
background-size: cover;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: -10px;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
||||||
|
.eliminate-img .payment-btn image{
|
||||||
|
height: 27px;
|
||||||
|
margin-top: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 在线支付 */
|
||||||
|
.contribution{
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.contribution .hot{
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.contribution .hot>image{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.contribution .tit{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 45px;
|
||||||
|
background-color: #31742f;
|
||||||
|
}
|
||||||
|
.contribution .tit>image{
|
||||||
|
margin-left: 32px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
.contribution .tips{
|
||||||
|
font-size: 22px;
|
||||||
|
line-height: 40px;
|
||||||
|
padding: 20px 0;
|
||||||
|
text-indent: 32px;
|
||||||
|
color: #09881d;
|
||||||
|
}
|
||||||
|
.form-bg{
|
||||||
|
height: 625px;
|
||||||
|
background-image: url('/static/contribution-bg.png');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center bottom;
|
||||||
|
background-size: 761px 625px;
|
||||||
|
}
|
||||||
|
.form-bg .form{
|
||||||
|
width: 564px;
|
||||||
|
padding: 45px 28px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
margin: 0 auto;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
.form-bg .form .item{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
.form-bg .form .left{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
width: 96px;
|
||||||
|
}
|
||||||
|
.form-bg .form .colon{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 44px;
|
||||||
|
}
|
||||||
|
.form-bg .form .right{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: calc(100% - 140px);
|
||||||
|
}
|
||||||
|
.form-bg .form .right>picker{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.form-bg .form .addr-input{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.form-bg .form .right .input,
|
||||||
|
.form-bg .form .right .input-box{
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 180px;
|
||||||
|
height: 27px;
|
||||||
|
padding: 0 8px;
|
||||||
|
border: 1px solid #a5a5a5;
|
||||||
|
}
|
||||||
|
.form-bg .form .right .input-box{
|
||||||
|
display: flex;
|
||||||
|
width: 207px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.form-bg .form .right .input-box>input{
|
||||||
|
width: calc(100% - 27px);
|
||||||
|
height: 100%;
|
||||||
|
text-align: center;
|
||||||
|
letter-spacing: 10px;
|
||||||
|
text-indent: 10px;
|
||||||
|
}
|
||||||
|
.form-bg .form .right .arrow{
|
||||||
|
width: 27px;
|
||||||
|
height: 25px;
|
||||||
|
background-image: url('/static/icon-arrow-down.png');
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
.form-bg .form .right text{
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
.calculator .nav-btns-other{
|
||||||
|
margin-top: 13px;
|
||||||
|
}
|
||||||
|
.form-bg .form .submit-btn{
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
line-height: 40px;
|
||||||
|
padding: 0 8px;
|
||||||
|
border: 1px solid #a5a5a5;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<template>
|
||||||
|
<view class="banner-swiper">
|
||||||
|
<swiper class="swiper" autoplay="true" circular="true" interval="3000" duration="500">
|
||||||
|
<swiper-item>
|
||||||
|
<view class="img">
|
||||||
|
<image class="animated fadeIn" src="../../common/banner/banner-01.jpg" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
</swiper-item>
|
||||||
|
<swiper-item>
|
||||||
|
<view class="img">
|
||||||
|
<image class="animated fadeIn" src="../../common/banner/banner-02.jpg" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
</swiper-item>
|
||||||
|
<swiper-item>
|
||||||
|
<view class="img">
|
||||||
|
<image class="animated fadeIn" src="../../common/banner/banner-03.jpg" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "swiper-pull",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.banner-swiper{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.banner-swiper .swiper{
|
||||||
|
height: 550px;
|
||||||
|
}
|
||||||
|
.banner-swiper .img>image{
|
||||||
|
width: 100%;
|
||||||
|
height: 550px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,20 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<script>
|
||||||
|
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||||
|
CSS.supports('top: constant(a)'))
|
||||||
|
document.write(
|
||||||
|
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||||
|
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||||
|
</script>
|
||||||
|
<title></title>
|
||||||
|
<!--preload-links-->
|
||||||
|
<!--app-context-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"><!--app-html--></div>
|
||||||
|
<script type="module" src="/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,21 @@
|
||||||
|
import App from './App'
|
||||||
|
|
||||||
|
// #ifndef VUE3
|
||||||
|
import Vue from 'vue'
|
||||||
|
Vue.config.productionTip = false
|
||||||
|
App.mpType = 'app'
|
||||||
|
const app = new Vue({
|
||||||
|
...App
|
||||||
|
})
|
||||||
|
app.$mount()
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef VUE3
|
||||||
|
import { createSSRApp } from 'vue'
|
||||||
|
export function createApp() {
|
||||||
|
const app = createSSRApp(App)
|
||||||
|
return {
|
||||||
|
app
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #endif
|
|
@ -0,0 +1,108 @@
|
||||||
|
{
|
||||||
|
"name" : "碳中和",
|
||||||
|
"appid" : "__UNI__DB95977",
|
||||||
|
"description" : "",
|
||||||
|
"versionName" : "1.0.0",
|
||||||
|
"versionCode" : "100",
|
||||||
|
"transformPx" : false,
|
||||||
|
/* 5+App特有相关 */
|
||||||
|
"app-plus" : {
|
||||||
|
"usingComponents" : true,
|
||||||
|
"nvueStyleCompiler" : "uni-app",
|
||||||
|
"compilerVersion" : 3,
|
||||||
|
"splashscreen" : {
|
||||||
|
"alwaysShowBeforeRender" : true,
|
||||||
|
"waiting" : true,
|
||||||
|
"autoclose" : true,
|
||||||
|
"delay" : 0
|
||||||
|
},
|
||||||
|
/* 模块配置 */
|
||||||
|
"modules" : {},
|
||||||
|
/* 应用发布信息 */
|
||||||
|
"distribute" : {
|
||||||
|
/* android打包配置 */
|
||||||
|
"android" : {
|
||||||
|
"permissions" : [
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
/* ios打包配置 */
|
||||||
|
"ios" : {
|
||||||
|
"dSYMs" : false
|
||||||
|
},
|
||||||
|
/* SDK配置 */
|
||||||
|
"sdkConfigs" : {
|
||||||
|
"ad" : {}
|
||||||
|
},
|
||||||
|
"icons" : {
|
||||||
|
"android" : {
|
||||||
|
"hdpi" : "unpackage/res/icons/72x72.png",
|
||||||
|
"xhdpi" : "unpackage/res/icons/96x96.png",
|
||||||
|
"xxhdpi" : "unpackage/res/icons/144x144.png",
|
||||||
|
"xxxhdpi" : "unpackage/res/icons/192x192.png"
|
||||||
|
},
|
||||||
|
"ios" : {
|
||||||
|
"appstore" : "unpackage/res/icons/1024x1024.png",
|
||||||
|
"ipad" : {
|
||||||
|
"app" : "unpackage/res/icons/76x76.png",
|
||||||
|
"app@2x" : "unpackage/res/icons/152x152.png",
|
||||||
|
"notification" : "unpackage/res/icons/20x20.png",
|
||||||
|
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||||
|
"proapp@2x" : "unpackage/res/icons/167x167.png",
|
||||||
|
"settings" : "unpackage/res/icons/29x29.png",
|
||||||
|
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||||
|
"spotlight" : "unpackage/res/icons/40x40.png",
|
||||||
|
"spotlight@2x" : "unpackage/res/icons/80x80.png"
|
||||||
|
},
|
||||||
|
"iphone" : {
|
||||||
|
"app@2x" : "unpackage/res/icons/120x120.png",
|
||||||
|
"app@3x" : "unpackage/res/icons/180x180.png",
|
||||||
|
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||||
|
"notification@3x" : "unpackage/res/icons/60x60.png",
|
||||||
|
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||||
|
"settings@3x" : "unpackage/res/icons/87x87.png",
|
||||||
|
"spotlight@2x" : "unpackage/res/icons/80x80.png",
|
||||||
|
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* 快应用特有相关 */
|
||||||
|
"quickapp" : {},
|
||||||
|
/* 小程序特有相关 */
|
||||||
|
"mp-weixin" : {
|
||||||
|
"appid" : "",
|
||||||
|
"setting" : {
|
||||||
|
"urlCheck" : false
|
||||||
|
},
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"mp-alipay" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"mp-baidu" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"mp-toutiao" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
},
|
||||||
|
"vueVersion" : "2"
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||||
|
{
|
||||||
|
"path": "pages/index/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "设备判断"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/count/count",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "计算碳足迹"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/assess/assess",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "评估碳足迹"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/eliminate/eliminate",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "消除碳足迹"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/contribution/contribution",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "在线捐款"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"globalStyle": {
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"navigationBarTitleText": "碳足迹计算器",
|
||||||
|
"navigationBarBackgroundColor": "#F8F8F8",
|
||||||
|
"backgroundColor": "#F8F8F8",
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": false, //禁用原生导航栏,APP和H5可用
|
||||||
|
"bounce": "none",
|
||||||
|
"scrollIndicator": "none"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uniIdRouter": {}
|
||||||
|
}
|
|
@ -0,0 +1,290 @@
|
||||||
|
<template>
|
||||||
|
<view class="main">
|
||||||
|
<!-- 头部 -->
|
||||||
|
<view class="header">
|
||||||
|
<view class="logo">
|
||||||
|
<image src="/static/logo.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="title">
|
||||||
|
<image src="/static/count-title.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="position">
|
||||||
|
<image src="/static/icon-home.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 评估碳足迹 -->
|
||||||
|
<view class="calculator-bg">
|
||||||
|
<view class="bg-img">
|
||||||
|
<image src="/static/count-bg.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="calculator calculator-other">
|
||||||
|
<view class="assess">
|
||||||
|
<view class="assess-title">
|
||||||
|
<image src="/static/icon-title-01.png" mode="heightFix"></image>
|
||||||
|
<view class="total-num">
|
||||||
|
<view class="num" v-for="(item,index) in showTotal" :key="index">{{item}}</view>
|
||||||
|
<image src="/static/kg.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="assess-form">
|
||||||
|
<!-- 柱状图 -->
|
||||||
|
<view class="histogram">
|
||||||
|
<view class="form-list">
|
||||||
|
<view class="form-item">
|
||||||
|
<text>{{subTotal[0]}}kg</text>
|
||||||
|
<view :style="{'height':heightList[0]}"></view>
|
||||||
|
</view>
|
||||||
|
<view class="form-item">
|
||||||
|
<text>{{subTotal[1]}}kg</text>
|
||||||
|
<view :style="{'height':heightList[1]}"></view>
|
||||||
|
</view>
|
||||||
|
<view class="form-item">
|
||||||
|
<text>{{subTotal[2]}}kg</text>
|
||||||
|
<view :style="{'height':heightList[2]}"></view>
|
||||||
|
</view>
|
||||||
|
<view class="form-item">
|
||||||
|
<text>{{subTotal[3]}}kg</text>
|
||||||
|
<view :style="{'height':heightList[3]}"></view>
|
||||||
|
</view>
|
||||||
|
<view class="form-item">
|
||||||
|
<text>{{subTotal[4]}}kg</text>
|
||||||
|
<view :style="{'height':heightList[4]}"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="form-title">
|
||||||
|
<view>
|
||||||
|
<image src="/static/icon-font-01.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<image src="/static/icon-font-02.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<image src="/static/icon-font-03.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<image src="/static/icon-font-04.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<image src="/static/icon-font-05.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 饼图 -->
|
||||||
|
<view class="pie-chart">
|
||||||
|
<uni-chart :option="pie" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="assess-title">
|
||||||
|
<image src="/static/icon-title-02.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="assess-txt">
|
||||||
|
<view class="">您全家一年的碳足迹(碳排放)为<text>{{total}}</text>kg,家庭人数</view>
|
||||||
|
<view class="assess-btns">
|
||||||
|
<view class="btn" @tap="changeNum('reduce')">
|
||||||
|
<image src="/static/icon-reduce.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<input type="number" @blur="averageEv" v-model="member">
|
||||||
|
<view class="btn" @tap="changeNum('add')">
|
||||||
|
<image src="/static/icon-add.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="">,人均碳足迹为<text>{{average}}</text>kg。</view>
|
||||||
|
</view>
|
||||||
|
<view class="assess-contrast">
|
||||||
|
<image src="/static/assess.png" mode="widthFix"></image>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item">
|
||||||
|
<view>您的碳足迹为</view>
|
||||||
|
<view><text>{{average}}</text>kg</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view>中国人均碳足迹为</view>
|
||||||
|
<view><text>6230</text>kg</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view>工业国家人均碳足迹为</view>
|
||||||
|
<view><text>11460</text>kg</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view>全球人均碳足迹为</view>
|
||||||
|
<view><text>4840</text>kg</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view>应对气候变化全球人均目标碳足迹为</view>
|
||||||
|
<view><text>2330</text>kg</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="nav-btns">
|
||||||
|
<view class="btn" @tap="toPage('/pages/count/count')">
|
||||||
|
<image src="/static/icon-tabbar-01.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="btn active" @tap="toPage('/pages/assess/assess')">
|
||||||
|
<image src="/static/icon-tabbar-02.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="btn" @tap="toPage('/pages/eliminate/eliminate')">
|
||||||
|
<image src="/static/icon-tabbar-03.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 轮播 -->
|
||||||
|
<view class="banner">
|
||||||
|
<swiper-pull></swiper-pull>
|
||||||
|
</view>
|
||||||
|
<!-- 底部 -->
|
||||||
|
<view class="footer">
|
||||||
|
<text>中国绿色碳汇基金会低碳旅游专项基金监制,北京凯来美气候技术咨询有限公司开发。</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import swiperPull from '@/components/swiper/swiper-pull.vue';
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
swiperPull
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
statusHeight: uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
||||||
|
member: 1, //家庭成员
|
||||||
|
total: 0, //总计
|
||||||
|
subTotal: [], //小计
|
||||||
|
average: 0, //平均值
|
||||||
|
showTotal: [], //显示总计
|
||||||
|
histogram: {}, //柱状图数据
|
||||||
|
pie: {}, //饼图数据
|
||||||
|
heightList: [], //柱状高度
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(op) {
|
||||||
|
if (op.total) {
|
||||||
|
this.total = op.total;
|
||||||
|
this.showTotal = op.total.toString().split('');
|
||||||
|
// 计算平均值
|
||||||
|
this.averageEv();
|
||||||
|
}
|
||||||
|
if (uni.getStorageSync('subTotal')) {
|
||||||
|
this.subTotal = uni.getStorageSync('subTotal');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算柱状高度
|
||||||
|
let height01 = `${(this.subTotal[0]/this.total*280).toFixed(2)}%`;
|
||||||
|
let height02 = `${(this.subTotal[1]/this.total*280).toFixed(2)}%`;
|
||||||
|
let height03 = `${(this.subTotal[2]/this.total*280).toFixed(2)}%`;
|
||||||
|
let height04 = `${(this.subTotal[3]/this.total*280).toFixed(2)}%`;
|
||||||
|
let height05 = `${(this.subTotal[4]/this.total*280).toFixed(2)}%`;
|
||||||
|
this.heightList = [height01, height02, height03, height04, height05];
|
||||||
|
// 绘制饼图
|
||||||
|
this.pieEv();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 绘制饼图
|
||||||
|
pieEv() {
|
||||||
|
this.pie = {
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'item'
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
type: 'pie',
|
||||||
|
color: [
|
||||||
|
'#a6fea5',
|
||||||
|
'#ffb0ae',
|
||||||
|
'#92dede',
|
||||||
|
'#ffdaad',
|
||||||
|
'#8888ac'
|
||||||
|
],
|
||||||
|
radius: '50%',
|
||||||
|
label: {
|
||||||
|
fontSize: 15,
|
||||||
|
color: '#000',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
},
|
||||||
|
data: [{
|
||||||
|
value: this.subTotal[0],
|
||||||
|
name: `${(this.subTotal[0]/this.total*100).toFixed(2)}%`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: this.subTotal[1],
|
||||||
|
name: `${(this.subTotal[1]/this.total*100).toFixed(2)}%`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: this.subTotal[2],
|
||||||
|
name: `${(this.subTotal[2]/this.total*100).toFixed(2)}%`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: this.subTotal[3],
|
||||||
|
name: `${(this.subTotal[3]/this.total*100).toFixed(2)}%`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: this.subTotal[4],
|
||||||
|
name: `${(this.subTotal[4]/this.total*100).toFixed(2)}%`
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 改变数量
|
||||||
|
changeNum(type) {
|
||||||
|
if (type == 'reduce') {
|
||||||
|
if (this.member > 1) {
|
||||||
|
this.member--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (type == 'add') {
|
||||||
|
this.member++
|
||||||
|
}
|
||||||
|
// 计算平均值
|
||||||
|
this.averageEv();
|
||||||
|
},
|
||||||
|
|
||||||
|
// 计算平均值
|
||||||
|
averageEv() {
|
||||||
|
let averageNum = this.total / this.member * 1;
|
||||||
|
this.average = averageNum.toFixed(2);
|
||||||
|
uni.setStorageSync('average', this.average);
|
||||||
|
},
|
||||||
|
|
||||||
|
//跳转
|
||||||
|
toPage(url) {
|
||||||
|
if (url == '/pages/count/count') {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (url == '/pages/assess/assess') {
|
||||||
|
if (uni.getStorageSync('subTotal')) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `${url}?total=${this.total}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先计算碳足迹',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (url == '/pages/eliminate/eliminate') {
|
||||||
|
if (uni.getStorageSync('average')) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `${url}?total=${this.total}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先评估碳足迹',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
|
@ -0,0 +1,225 @@
|
||||||
|
<template>
|
||||||
|
<view class="main">
|
||||||
|
<!-- 头部 -->
|
||||||
|
<view class="header">
|
||||||
|
<view class="logo">
|
||||||
|
<image src="/static/logo.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="title">
|
||||||
|
<image src="/static/count-title.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="position">
|
||||||
|
<image src="/static/icon-home.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 计算器 -->
|
||||||
|
<view class="calculator-bg">
|
||||||
|
<view class="bg-img">
|
||||||
|
<image src="/static/count-bg.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="calculator calculator-other" style="padding-top: 0;">
|
||||||
|
<view class="contribution">
|
||||||
|
<view class="hot">
|
||||||
|
<image src="/static/contribution.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="tit">
|
||||||
|
<image src="/static/icon-title-04.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="tips">购买碳汇,履行义务;足不出户,低碳植树。中国绿色碳汇基金会助你实现低碳生活!</view>
|
||||||
|
<view class="form-bg">
|
||||||
|
<view class="form">
|
||||||
|
<view class="item">
|
||||||
|
<view class="left">
|
||||||
|
<text>购</text>
|
||||||
|
<text>买</text>
|
||||||
|
<text>者</text>
|
||||||
|
</view>
|
||||||
|
<view class="colon">:</view>
|
||||||
|
<view class="right">
|
||||||
|
<input class="input" type="text">
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="left">
|
||||||
|
<text>所</text>
|
||||||
|
<text>在</text>
|
||||||
|
<text>地</text>
|
||||||
|
</view>
|
||||||
|
<view class="colon">:</view>
|
||||||
|
<view class="right">
|
||||||
|
<picker mode="multiSelector" @change="changeAddress">
|
||||||
|
<view class="addr-input">
|
||||||
|
<view class="input-box">
|
||||||
|
<input class="input-flex clips1" type="text" v-model="addrObj.province"
|
||||||
|
disabled="true">
|
||||||
|
<view class="arrow"></view>
|
||||||
|
</view>
|
||||||
|
<view class="input-box">
|
||||||
|
<input class="input-flex clips1" type="text" v-model="addrObj.city"
|
||||||
|
disabled="true">
|
||||||
|
<view class="arrow"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="left">
|
||||||
|
<text>联</text>
|
||||||
|
<text>系</text>
|
||||||
|
<text>方</text>
|
||||||
|
<text>式</text>
|
||||||
|
</view>
|
||||||
|
<view class="colon">:</view>
|
||||||
|
<view class="right">
|
||||||
|
<input class="input" type="text">
|
||||||
|
<text>(手机或邮件)</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="left">
|
||||||
|
<text>金</text>
|
||||||
|
<text>额</text>
|
||||||
|
</view>
|
||||||
|
<view class="colon">:</view>
|
||||||
|
<view class="right">
|
||||||
|
<input class="input" type="text">
|
||||||
|
<text>元</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="left">
|
||||||
|
<text>获</text>
|
||||||
|
<text>得</text>
|
||||||
|
<text>碳</text>
|
||||||
|
<text>汇</text>
|
||||||
|
</view>
|
||||||
|
<view class="colon">:</view>
|
||||||
|
<view class="right">
|
||||||
|
<input class="input" type="text">
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="left">
|
||||||
|
<text>付</text>
|
||||||
|
<text>款</text>
|
||||||
|
<text>方</text>
|
||||||
|
<text>式</text>
|
||||||
|
</view>
|
||||||
|
<view class="colon">:</view>
|
||||||
|
<view class="right">
|
||||||
|
<picker @change="changePay" :value="payIndex" :range="payList">
|
||||||
|
<view class="input-box">
|
||||||
|
<input class="input-flex clips1" type="text" v-model="payList[payIndex]"
|
||||||
|
disabled="true" style="letter-spacing: 0;text-indent: 0;">
|
||||||
|
<view class="arrow"></view>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="submit-btn">提交并打开支付宝收银台页面</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="nav-btns nav-btns-other">
|
||||||
|
<view class="btn" @tap="toPage('/pages/count/count')">
|
||||||
|
<image src="/static/icon-tabbar-01.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="btn" @tap="toPage('/pages/assess/assess')">
|
||||||
|
<image src="/static/icon-tabbar-02.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="btn active" @tap="toPage('/pages/eliminate/eliminate')">
|
||||||
|
<image src="/static/icon-tabbar-03.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 轮播 -->
|
||||||
|
<view class="banner">
|
||||||
|
<swiper-pull></swiper-pull>
|
||||||
|
</view>
|
||||||
|
<!-- 底部 -->
|
||||||
|
<view class="footer">
|
||||||
|
<text>中国绿色碳汇基金会低碳旅游专项基金监制,北京凯来美气候技术咨询有限公司开发。</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import swiperPull from '@/components/swiper/swiper-pull.vue';
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
swiperPull
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
statusHeight: uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
||||||
|
member: 0, //家庭成员
|
||||||
|
total: 0, //总计
|
||||||
|
subTotal: [], //小计
|
||||||
|
addrObj: {
|
||||||
|
province: '不限',
|
||||||
|
city: '不限'
|
||||||
|
},
|
||||||
|
payList: ['支付宝网上捐赠', '微信网上捐赠'], //支付方式
|
||||||
|
payIndex: 0, //当前选择
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(op) {
|
||||||
|
if (op.total) {
|
||||||
|
this.total = op.total;
|
||||||
|
}
|
||||||
|
if (uni.getStorageSync('subTotal')) {
|
||||||
|
this.subTotal = uni.getStorageSync('subTotal');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 选择省市
|
||||||
|
changeAddress(e) {
|
||||||
|
this.addrObj.province = e.detail.value[0];
|
||||||
|
this.addrObj.city = e.detail.value[1];
|
||||||
|
},
|
||||||
|
changePay(e) {
|
||||||
|
this.payIndex = e.detail.value
|
||||||
|
},
|
||||||
|
//跳转
|
||||||
|
toPage(url) {
|
||||||
|
if (url == '/pages/count/count') {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (url == '/pages/assess/assess') {
|
||||||
|
if (uni.getStorageSync('subTotal')) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `${url}?total=${this.total}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先计算碳足迹',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (url == '/pages/eliminate/eliminate') {
|
||||||
|
if (uni.getStorageSync('average')) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `${url}?total=${this.total}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先评估碳足迹',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
|
@ -0,0 +1,489 @@
|
||||||
|
<template>
|
||||||
|
<view class="main">
|
||||||
|
<!-- 头部 -->
|
||||||
|
<view class="header">
|
||||||
|
<view class="logo">
|
||||||
|
<image src="/static/logo.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="title">
|
||||||
|
<image src="/static/count-title.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="position">
|
||||||
|
<image src="/static/icon-home.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 计算碳足迹 -->
|
||||||
|
<view class="calculator-bg">
|
||||||
|
<view class="bg-img">
|
||||||
|
<image src="/static/count-bg.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="calculator">
|
||||||
|
<view class="cate">
|
||||||
|
<view class="list" v-for="(item,index) in cateList" :key="index">
|
||||||
|
<view class="title">
|
||||||
|
<text>{{index}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="item" v-for="(item1,index1) in item" :key="index1" @tap="changeEv(index,index1)">
|
||||||
|
{{item1.title}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="interface">
|
||||||
|
<scroll-view class="result" scroll-y="true">
|
||||||
|
<view class="individual" v-if="cateTagList.length>0">
|
||||||
|
<view class="list" v-for="(item,index) in cateList" :key="index">
|
||||||
|
<view class="item" v-for="(item1,index1) in item" :key="index1"
|
||||||
|
v-if="cateTagList.indexOf(item1.tag)!==-1">
|
||||||
|
<view>{{item1.title}}</view>
|
||||||
|
<view>
|
||||||
|
<input type="text" focus="true" v-model="item1.num" placeholder="0"
|
||||||
|
@tap="changeFocus(index,index1)">
|
||||||
|
</view>
|
||||||
|
<view>{{item1.company}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="subtotal">
|
||||||
|
<view class="item">
|
||||||
|
<view>衣<text>排碳</text></view>
|
||||||
|
<view>{{subTotal[0]?subTotal[0].toFixed(2):0}}</view>
|
||||||
|
<view>kg</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view>食<text>排碳</text></view>
|
||||||
|
<view>{{subTotal[1]?subTotal[1].toFixed(2):0}}</view>
|
||||||
|
<view>kg</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view>住<text>排碳</text></view>
|
||||||
|
<view>{{subTotal[2]?subTotal[2].toFixed(2):0}}</view>
|
||||||
|
<view>kg</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view>行<text>排碳</text></view>
|
||||||
|
<view>{{subTotal[3]?subTotal[3].toFixed(2):0}}</view>
|
||||||
|
<view>kg</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view>用<text>排碳</text></view>
|
||||||
|
<view>{{subTotal[4]?subTotal[4].toFixed(2):0}}</view>
|
||||||
|
<view>kg</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="total">
|
||||||
|
<view class="item">
|
||||||
|
<view>合计排碳</view>
|
||||||
|
<view>{{total>0?total.toFixed(2):0}}</view>
|
||||||
|
<view>kg</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="interface-btns">
|
||||||
|
<view class="num">
|
||||||
|
<view class="btn" v-for="(item,index) in numlist" :key="index" @tap="chengeNum(item)">
|
||||||
|
{{item}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="operate">
|
||||||
|
<view class="btn" v-for="(item,index) in operateList" :key="index" @tap="choseEv(index)">
|
||||||
|
{{item}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="nav-btns">
|
||||||
|
<view class="btn active" @tap="toPage('/pages/count/count')">
|
||||||
|
<image src="/static/icon-tabbar-01.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="btn" @tap="toPage('/pages/assess/assess')">
|
||||||
|
<image src="/static/icon-tabbar-02.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="btn" @tap="toPage('/pages/eliminate/eliminate')">
|
||||||
|
<image src="/static/icon-tabbar-03.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="explain">操作说明:点击图标,计算您的碳足迹。</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 轮播 -->
|
||||||
|
<view class="banner">
|
||||||
|
<swiper-pull></swiper-pull>
|
||||||
|
</view>
|
||||||
|
<!-- 底部 -->
|
||||||
|
<view class="footer">
|
||||||
|
<text>中国绿色碳汇基金会低碳旅游专项基金监制,北京凯来美气候技术咨询有限公司开发。</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import swiperPull from '@/components/swiper/swiper-pull.vue';
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
swiperPull
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
statusHeight: uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
||||||
|
cateList: {
|
||||||
|
'衣': [{
|
||||||
|
'title': '购买衣服数量',
|
||||||
|
'company': '件',
|
||||||
|
'carbon': 6.34,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'a1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '洗衣服使用量',
|
||||||
|
'company': '千克',
|
||||||
|
'carbon': 1.786,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'a2'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'食': [{
|
||||||
|
'title': '吸烟数量',
|
||||||
|
'company': '包',
|
||||||
|
'carbon': 0.021,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'b1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '喝白酒数量',
|
||||||
|
'company': '千克',
|
||||||
|
'carbon': 2,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'b2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '喝啤酒数量',
|
||||||
|
'company': '瓶',
|
||||||
|
'carbon': 0.426,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'b3'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '肉类消费',
|
||||||
|
'company': '千克',
|
||||||
|
'carbon': 1.4,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'b4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '粮食消费',
|
||||||
|
'company': '千克',
|
||||||
|
'carbon': 0.94,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'b5'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'住': [{
|
||||||
|
'title': '用电',
|
||||||
|
'company': '度',
|
||||||
|
'carbon': 0.872,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'c1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '煤气',
|
||||||
|
'company': '立方米',
|
||||||
|
'carbon': 0.71,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'c2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '天然气',
|
||||||
|
'company': '立方米',
|
||||||
|
'carbon': 2.186,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'c3'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '燃煤',
|
||||||
|
'company': '千克',
|
||||||
|
'carbon': 3.5,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'c4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '集中取暖',
|
||||||
|
'company': '立方米',
|
||||||
|
'carbon': 32.6,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'c5'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '装修用木材',
|
||||||
|
'company': '立方米',
|
||||||
|
'carbon': 1830,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'c6'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '装修用陶瓷',
|
||||||
|
'company': '千克',
|
||||||
|
'carbon': 15.4,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'c7'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '装修用钢材',
|
||||||
|
'company': '千克',
|
||||||
|
'carbon': 1.9,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'c8'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '装修用铝材',
|
||||||
|
'company': '平方米',
|
||||||
|
'carbon': 24.7,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'c9'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'行': [{
|
||||||
|
'title': '飞机',
|
||||||
|
'company': '公里',
|
||||||
|
'carbon': 0.119,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'd1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '火车',
|
||||||
|
'company': '公里',
|
||||||
|
'carbon': 0.063,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'd2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '轮船',
|
||||||
|
'company': '公里',
|
||||||
|
'carbon': 0.01,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'd3'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '地铁',
|
||||||
|
'company': '公里',
|
||||||
|
'carbon': 0.079,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'd4'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '公共汽车',
|
||||||
|
'company': '公里',
|
||||||
|
'carbon': 0.018,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'd5'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '低油耗小轿车',
|
||||||
|
'company': '公里',
|
||||||
|
'carbon': 0.156,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'd6'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '中油耗小轿车',
|
||||||
|
'company': '公里',
|
||||||
|
'carbon': 0.283,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'd7'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '高油耗小轿车',
|
||||||
|
'company': '公里',
|
||||||
|
'carbon': 0.334,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'd8'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'用': [{
|
||||||
|
'title': '塑料袋使用量',
|
||||||
|
'company': '个',
|
||||||
|
'carbon': 0.021,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'e1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '纸制品',
|
||||||
|
'company': '千克',
|
||||||
|
'carbon': 3.5,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'e2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '一次性筷子',
|
||||||
|
'company': '双',
|
||||||
|
'carbon': 0.0228,
|
||||||
|
'num': '',
|
||||||
|
'tag': 'e3'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
numlist: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '00', '.'],
|
||||||
|
operateList: ['CE', '计算'],
|
||||||
|
cateTagList: [], //分类标题
|
||||||
|
subTotal: [0, 0, 0, 0, 0], //小计
|
||||||
|
total: 0, //总计
|
||||||
|
|
||||||
|
focusIndex: '', //选中一级分类
|
||||||
|
focusIndex1: 0, //选中二级分类
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
if (uni.getStorageSync('subTotal')) {
|
||||||
|
uni.removeStorageSync('subTotal');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 选择分类
|
||||||
|
changeEv(index, index1) {
|
||||||
|
this.cateTagList.push(this.cateList[index][index1].tag);
|
||||||
|
this.focusIndex = index;
|
||||||
|
this.focusIndex1 = index1;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取光标
|
||||||
|
changeFocus(index, index1) {
|
||||||
|
this.focusIndex = index;
|
||||||
|
this.focusIndex1 = index1;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 计算器按钮
|
||||||
|
chengeNum(num) {
|
||||||
|
if (this.cateTagList.length > 0) {
|
||||||
|
let curNum = this.cateList[this.focusIndex][this.focusIndex1].num;
|
||||||
|
if (curNum.indexOf('.') == -1 && curNum !== '') {
|
||||||
|
this.cateList[this.focusIndex][this.focusIndex1].num = curNum + num;
|
||||||
|
} else {
|
||||||
|
if (num !== '.') {
|
||||||
|
this.cateList[this.focusIndex][this.focusIndex1].num = curNum + num;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 计算 || 清除
|
||||||
|
choseEv(index) {
|
||||||
|
if (this.cateTagList.length > 0) {
|
||||||
|
if (index == 0) {
|
||||||
|
this.cateList[this.focusIndex][this.focusIndex1].num = '';
|
||||||
|
// 计算
|
||||||
|
this.calculationEv();
|
||||||
|
} else {
|
||||||
|
// 计算
|
||||||
|
this.calculationEv();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 计算
|
||||||
|
calculationEv() {
|
||||||
|
// 小计
|
||||||
|
let subTotalArr1 = this.cateList['衣'].filter(item => {
|
||||||
|
return item.num !== ''
|
||||||
|
});
|
||||||
|
let subTotalNum1 = 0;
|
||||||
|
subTotalArr1.forEach(item => {
|
||||||
|
subTotalNum1 += item.num * item.carbon * 1;
|
||||||
|
})
|
||||||
|
this.subTotal[0] = parseFloat(subTotalNum1);
|
||||||
|
|
||||||
|
let subTotalArr2 = this.cateList['食'].filter(item => {
|
||||||
|
return item.num !== ''
|
||||||
|
});
|
||||||
|
let subTotalNum2 = 0;
|
||||||
|
subTotalArr2.forEach(item => {
|
||||||
|
subTotalNum2 += item.num * item.carbon * 1;
|
||||||
|
})
|
||||||
|
this.subTotal[1] = parseFloat(subTotalNum2);
|
||||||
|
|
||||||
|
let subTotalArr3 = this.cateList['住'].filter(item => {
|
||||||
|
return item.num !== ''
|
||||||
|
});
|
||||||
|
let subTotalNum3 = 0;
|
||||||
|
subTotalArr3.forEach(item => {
|
||||||
|
subTotalNum3 += item.num * item.carbon * 1;
|
||||||
|
})
|
||||||
|
this.subTotal[2] = parseFloat(subTotalNum3);
|
||||||
|
|
||||||
|
let subTotalArr4 = this.cateList['行'].filter(item => {
|
||||||
|
return item.num !== ''
|
||||||
|
});
|
||||||
|
let subTotalNum4 = 0;
|
||||||
|
subTotalArr4.forEach(item => {
|
||||||
|
subTotalNum4 += item.num * item.carbon * 1;
|
||||||
|
})
|
||||||
|
this.subTotal[3] = parseFloat(subTotalNum4);
|
||||||
|
|
||||||
|
let subTotalArr5 = this.cateList['用'].filter(item => {
|
||||||
|
return item.num !== ''
|
||||||
|
});
|
||||||
|
let subTotalNum5 = 0;
|
||||||
|
subTotalArr5.forEach(item => {
|
||||||
|
subTotalNum5 += item.num * item.carbon * 1;
|
||||||
|
})
|
||||||
|
this.subTotal[4] = parseFloat(subTotalNum5);
|
||||||
|
|
||||||
|
// 总计
|
||||||
|
let totalArr = this.subTotal.filter(item => {
|
||||||
|
return item !== 0
|
||||||
|
});
|
||||||
|
let totalNum = 0;
|
||||||
|
totalArr.forEach(item => {
|
||||||
|
totalNum += item * 1;
|
||||||
|
})
|
||||||
|
this.total = parseFloat(totalNum);
|
||||||
|
|
||||||
|
// 缓存小计数据
|
||||||
|
let cacheTotal = [];
|
||||||
|
cacheTotal[0] = this.subTotal[0].toFixed(2);
|
||||||
|
cacheTotal[1] = this.subTotal[1].toFixed(2);
|
||||||
|
cacheTotal[2] = this.subTotal[2].toFixed(2);
|
||||||
|
cacheTotal[3] = this.subTotal[3].toFixed(2);
|
||||||
|
cacheTotal[4] = this.subTotal[4].toFixed(2);
|
||||||
|
uni.setStorageSync('subTotal', cacheTotal);
|
||||||
|
},
|
||||||
|
|
||||||
|
//跳转
|
||||||
|
toPage(url) {
|
||||||
|
if (url == '/pages/count/count') {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (url == '/pages/assess/assess') {
|
||||||
|
if (uni.getStorageSync('subTotal')) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `${url}?total=${this.total.toFixed(2)}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先计算碳足迹',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (url == '/pages/eliminate/eliminate') {
|
||||||
|
if (uni.getStorageSync('average')) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `${url}?total=${this.total.toFixed(2)}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先评估碳足迹',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
|
@ -0,0 +1,139 @@
|
||||||
|
<template>
|
||||||
|
<view class="main">
|
||||||
|
<!-- 头部 -->
|
||||||
|
<view class="header">
|
||||||
|
<view class="logo">
|
||||||
|
<image src="/static/logo.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="title">
|
||||||
|
<image src="/static/count-title.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="position">
|
||||||
|
<image src="/static/icon-home.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 消除碳足迹 -->
|
||||||
|
<view class="calculator-bg">
|
||||||
|
<view class="bg-img">
|
||||||
|
<image src="/static/count-bg.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="calculator calculator-other">
|
||||||
|
<view class="eliminate">
|
||||||
|
<view class="eliminate-title">
|
||||||
|
<image src="/static/icon-title-03.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="tips">
|
||||||
|
<view class="item">
|
||||||
|
您全家一年的碳足迹(碳排放)为<text>{{total}}</text>kg,人均碳足迹为<text>{{average}}</text>kg。
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
消除掉您的家庭碳足迹需要指数<text>{{total}}</text>棵,您需要捐款<text>{{total}}</text>元人民币用于中国绿色碳汇基金会低碳旅游专项基金。
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
谢谢您在应对气候变化方面所做的贡献,您是一位有责任的的人。
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="eliminate-img">
|
||||||
|
<image src="/static/eliminate.png" mode="heightFix"></image>
|
||||||
|
<view class="payment-btn" @tap="toEliminate">
|
||||||
|
<image src="/static/icon-tabbar-04.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="nav-btns">
|
||||||
|
<view class="btn" @tap="toPage('/pages/count/count')">
|
||||||
|
<image src="/static/icon-tabbar-01.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="btn" @tap="toPage('/pages/assess/assess')">
|
||||||
|
<image src="/static/icon-tabbar-02.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="btn active" @tap="toPage('/pages/eliminate/eliminate')">
|
||||||
|
<image src="/static/icon-tabbar-03.png" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 轮播 -->
|
||||||
|
<view class="banner">
|
||||||
|
<swiper-pull></swiper-pull>
|
||||||
|
</view>
|
||||||
|
<!-- 底部 -->
|
||||||
|
<view class="footer">
|
||||||
|
<text>中国绿色碳汇基金会低碳旅游专项基金监制,北京凯来美气候技术咨询有限公司开发。</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import swiperPull from '@/components/swiper/swiper-pull.vue';
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
swiperPull
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
statusHeight: uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
||||||
|
member: 0, //家庭成员
|
||||||
|
total: 0, //总计
|
||||||
|
average: 0, //平均值
|
||||||
|
treeNum: 0, //树数量
|
||||||
|
money: 0, //捐款额
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(op) {
|
||||||
|
if (op.total) {
|
||||||
|
this.total = op.total;
|
||||||
|
}
|
||||||
|
if (uni.getStorageSync('average')) {
|
||||||
|
this.average = uni.getStorageSync('average');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 去捐款
|
||||||
|
toEliminate() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/contribution/contribution?money=${this.money}&total=${this.total}`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
//跳转
|
||||||
|
toPage(url) {
|
||||||
|
if (url == '/pages/count/count') {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (url == '/pages/assess/assess') {
|
||||||
|
if (uni.getStorageSync('subTotal')) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `${url}?total=${this.total}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先计算碳足迹',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (url == '/pages/eliminate/eliminate') {
|
||||||
|
if (uni.getStorageSync('average')) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `${url}?total=${this.total}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先评估碳足迹',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
|
@ -0,0 +1,67 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="" style="font-size: 30rpx; text-align: center; line-height: 100rpx; background-color: aqua;">{{macStr}}</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
macStr:'', //设备mac
|
||||||
|
allowMac:'00:db:8a:db:71:69', //允许设备mac
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
// #ifdef APP
|
||||||
|
// 导入Java类。Networklnterface类表示一个由名称和分配给此接口的IP地址列表组成的网络接口
|
||||||
|
const net = plus.android.importClass('java.net.NetworkInterface');
|
||||||
|
// 搜索具有指定名称的网络接口
|
||||||
|
const wlan0 = net.getByName('wlan0');
|
||||||
|
// 获得网卡的硬件地址
|
||||||
|
const macByte = wlan0.getHardwareAddress();
|
||||||
|
//转换MAC地址
|
||||||
|
let baseMac = '';
|
||||||
|
macByte.forEach(item => { //.toString(16)数字以十六进制值显示
|
||||||
|
let temp = '';
|
||||||
|
if (item < 0){
|
||||||
|
temp = (256 + item).toString(16);
|
||||||
|
}else{
|
||||||
|
temp = item.toString(16);if (temp.length == 1) temp = `0${temp}`;
|
||||||
|
}
|
||||||
|
baseMac += temp;
|
||||||
|
});
|
||||||
|
// 格式转换
|
||||||
|
let finalMac = baseMac;
|
||||||
|
for (let i = 2; i < finalMac.length; i += 3) {
|
||||||
|
finalMac = finalMac.slice(0, i) + ':' + finalMac.slice(i);
|
||||||
|
}
|
||||||
|
// 赋值MAC
|
||||||
|
this.macStr = finalMac;
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 判断当前设备是否可用
|
||||||
|
uni.reLaunch({
|
||||||
|
url:'/pages/count/count'
|
||||||
|
})
|
||||||
|
// if(this.macStr == this.allowMac){
|
||||||
|
// uni.reLaunch({
|
||||||
|
// url:'/pages/count/count'
|
||||||
|
// })
|
||||||
|
// }else{
|
||||||
|
// uni.showToast({
|
||||||
|
// title:'当前设备不可使用',
|
||||||
|
// icon: 'none',
|
||||||
|
// duration:2000
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 311 KiB |
After Width: | Height: | Size: 255 KiB |
After Width: | Height: | Size: 145 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 290 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 941 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 200 KiB |
|
@ -0,0 +1,76 @@
|
||||||
|
/**
|
||||||
|
* 这里是uni-app内置的常用样式变量
|
||||||
|
*
|
||||||
|
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||||
|
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||||
|
*
|
||||||
|
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 颜色变量 */
|
||||||
|
|
||||||
|
/* 行为相关颜色 */
|
||||||
|
$uni-color-primary: #007aff;
|
||||||
|
$uni-color-success: #4cd964;
|
||||||
|
$uni-color-warning: #f0ad4e;
|
||||||
|
$uni-color-error: #dd524d;
|
||||||
|
|
||||||
|
/* 文字基本颜色 */
|
||||||
|
$uni-text-color:#333;//基本色
|
||||||
|
$uni-text-color-inverse:#fff;//反色
|
||||||
|
$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
|
||||||
|
$uni-text-color-placeholder: #808080;
|
||||||
|
$uni-text-color-disable:#c0c0c0;
|
||||||
|
|
||||||
|
/* 背景颜色 */
|
||||||
|
$uni-bg-color:#ffffff;
|
||||||
|
$uni-bg-color-grey:#f8f8f8;
|
||||||
|
$uni-bg-color-hover:#f1f1f1;//点击状态颜色
|
||||||
|
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
|
||||||
|
|
||||||
|
/* 边框颜色 */
|
||||||
|
$uni-border-color:#c8c7cc;
|
||||||
|
|
||||||
|
/* 尺寸变量 */
|
||||||
|
|
||||||
|
/* 文字尺寸 */
|
||||||
|
$uni-font-size-sm:12px;
|
||||||
|
$uni-font-size-base:14px;
|
||||||
|
$uni-font-size-lg:16;
|
||||||
|
|
||||||
|
/* 图片尺寸 */
|
||||||
|
$uni-img-size-sm:20px;
|
||||||
|
$uni-img-size-base:26px;
|
||||||
|
$uni-img-size-lg:40px;
|
||||||
|
|
||||||
|
/* Border Radius */
|
||||||
|
$uni-border-radius-sm: 2px;
|
||||||
|
$uni-border-radius-base: 3px;
|
||||||
|
$uni-border-radius-lg: 6px;
|
||||||
|
$uni-border-radius-circle: 50%;
|
||||||
|
|
||||||
|
/* 水平间距 */
|
||||||
|
$uni-spacing-row-sm: 5px;
|
||||||
|
$uni-spacing-row-base: 10px;
|
||||||
|
$uni-spacing-row-lg: 15px;
|
||||||
|
|
||||||
|
/* 垂直间距 */
|
||||||
|
$uni-spacing-col-sm: 4px;
|
||||||
|
$uni-spacing-col-base: 8px;
|
||||||
|
$uni-spacing-col-lg: 12px;
|
||||||
|
|
||||||
|
/* 透明度 */
|
||||||
|
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
|
||||||
|
|
||||||
|
/* 文章场景相关 */
|
||||||
|
$uni-color-title: #2C405A; // 文章标题颜色
|
||||||
|
$uni-font-size-title:20px;
|
||||||
|
$uni-color-subtitle: #555555; // 二级标题颜色
|
||||||
|
$uni-font-size-subtitle:26px;
|
||||||
|
$uni-color-paragraph: #3F536E; // 文章段落颜色
|
||||||
|
$uni-font-size-paragraph:15px;
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 xbmlz
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -0,0 +1,166 @@
|
||||||
|
# 在 uni-app 中使用 Apache ECharts
|
||||||
|
|
||||||
|
本项目是 [Apache ECharts](https://github.com/apache/echarts) 的uni-app版本,支持 [Vue.js](https://vuejs.org/) 2/3,以及使用的示例。
|
||||||
|
|
||||||
|
开发者可以通过熟悉的 ECharts 配置方式,快速开发图表,满足各种可视化需求.
|
||||||
|
|
||||||
|
## 快速开始
|
||||||
|
|
||||||
|
### 方式一: 使用 uni_modules 安装(推荐)
|
||||||
|
|
||||||
|
使用 `uni_modules` 方式安装组件库,可以直接通过插件市场导入,通过右键菜单快速更新组件,不需要引用、注册,直接在页面中使用 `echarts-for-uniapp` 组件。[点击安装 echarts-for-uniapp 组件库](https://ext.dcloud.net.cn/plugin?name=echarts-for-uniapp)
|
||||||
|
|
||||||
|
### 方式二: 使用 npm 安装
|
||||||
|
|
||||||
|
在 `vue-cli` 项目中可以使用 `npm` 安装 `echarts-for-uniapp` 库 ,或者直接在 `HBuilderX` 项目中使用 `npm` 。(不推荐后一种方式)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm i uniapp-echarts
|
||||||
|
```
|
||||||
|
|
||||||
|
### 创建图表
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<uni-chart :option="option" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
option: {
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value'
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
data: [120, 200, 150, 80, 70, 110, 130],
|
||||||
|
type: 'bar',
|
||||||
|
showBackground: true,
|
||||||
|
backgroundStyle: {
|
||||||
|
color: 'rgba(180, 180, 180, 0.2)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.content {
|
||||||
|
width: 375px;
|
||||||
|
height: 375px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
这对于所有 ECharts 图表都是通用的,用户只需要修改上面 `option` 的内容,即可改变图表。`option` 的使用方法参见 [ECharts 配置项文档](https://echarts.apache.org/zh/option.html)。对于不熟悉 ECharts 的用户,可以参见 [5 分钟上手 ECharts](https://echarts.apache.org/zh/tutorial.html#5%20%E5%88%86%E9%92%9F%E4%B8%8A%E6%89%8B%20ECharts) 教程。
|
||||||
|
|
||||||
|
完整的例子请参见 [xbmlz/echarts-for-uniapp](https://github.com/xbmlz/echarts-for-uniapp) 项目。
|
||||||
|
|
||||||
|
|
||||||
|
### 支持平台
|
||||||
|
|
||||||
|
| Vue2 | Vue3 |
|
||||||
|
| --- | --- |
|
||||||
|
| ✔️ | ✔️ |
|
||||||
|
|
||||||
|
|
||||||
|
| APP-VUE | APP-NVUE | 小程序 | WEB/H5 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| ✔️ | ❌ | ✔ | ✔ |
|
||||||
|
|
||||||
|
### 参数
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 默认值 | 描述 |
|
||||||
|
| :--: | :--: | :--: | :-- |
|
||||||
|
| forceUseOldCanvas | Boolean | false | 强制使用旧版Canvas(不推荐) |
|
||||||
|
| option | Object | | [ECharts Option](https://echarts.apache.org/zh/option.html) |
|
||||||
|
| theme | String| | [Eharts Theme](https://echarts.apache.org/zh/download-theme.html) |
|
||||||
|
| map | Object| | 使用地图组件时,注册地图,详见:[registerMap](https://echarts.apache.org/en/api.html#echarts.registerMap) |
|
||||||
|
|
||||||
|
|
||||||
|
### 事件
|
||||||
|
|
||||||
|
| 事件名 | 参数 | 返回数据 | 描述 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| inited | | chart | 初始化后返回 chart 对象 |
|
||||||
|
| click | | event | 点击 |
|
||||||
|
| touchstart | | event | 按下 |
|
||||||
|
| touchmove | | event | 移动 |
|
||||||
|
| touchend | | event | 松开 |
|
||||||
|
| mousedown | | event | 按下 |
|
||||||
|
| mousemove | | event | 移动 |
|
||||||
|
| mouseup | | event | 松开 |
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### 如何获取图表实例?
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<uni-chart @inited="inited" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
inited(chart) {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 如何延迟加载图表?
|
||||||
|
|
||||||
|
参见 [pages/lazyLoad](./pages/lazyLoad/index.vue) 的例子,可以在获取数据后再初始化数据。
|
||||||
|
|
||||||
|
### 如何在一个页面中加载多个图表?
|
||||||
|
|
||||||
|
参见 [pages/multiCharts](./pages/multiCharts/index.vue) 的例子。
|
||||||
|
|
||||||
|
### 如何使用 Tooltip?
|
||||||
|
|
||||||
|
具体使用方法和 ECharts 相同,例子参见 [pages/line](./pages/line/index.vue)
|
||||||
|
|
||||||
|
### 如何保存为图片?
|
||||||
|
|
||||||
|
参见 [pages/saveCanvas](./pages/saveCanvas/index.vue) 的例子。
|
||||||
|
|
||||||
|
### 多主题色
|
||||||
|
|
||||||
|
参见 [pages/themeColor](./pages/themeColor/index.vue) 的例子 。
|
||||||
|
|
||||||
|
### 完整示例
|
||||||
|
|
||||||
|
参见 [pages](./pages)
|
||||||
|
|
||||||
|
### 文件太大怎么办?
|
||||||
|
|
||||||
|
本项目默认提供的 ECharts 文件是最新版本的包含所有组件文件。可以下载不同版本的 [ECharts](https://github.com/apache/echarts/blob/master/dist/) 进行替换。建议调试时使用未压缩版本,发布时使用压缩版本,否则文件会太大无法发布。
|
||||||
|
|
||||||
|
发布时,如果对文件大小要求更高,可以在 [ECharts 在线定制](https://echarts.apache.org/zh/builder.html)网页下载仅包含必要组件的包,并且选择压缩。
|
||||||
|
|
||||||
|
下载的文件放在 `uni_modules/echarts-for-uniapp/static/echarts.min.js`,**注意一定需要重命名为 `echarts.min.js`**。
|
||||||
|
|
||||||
|
此外,还可考虑使用微信小程序的[分包策略](https://developers.weixin.qq.com/miniprogram/dev/framework/subpackages/independent.html)
|
||||||
|
|
||||||
|
|
||||||
|
如有其它问题,也欢迎在 [issue](https://github.com/xbmlz/echarts-for-uniapp/issues) 中反馈,谢谢!
|
|
@ -0,0 +1,17 @@
|
||||||
|
## 1.0.2(2022-11-20)
|
||||||
|
- 新增 `pages` 文件夹下新增组件示例
|
||||||
|
- 新增 保存到相册方法
|
||||||
|
- 新增 地图注册方法
|
||||||
|
- 新增 多主题色功能
|
||||||
|
- 修复 修复点击事件报错
|
||||||
|
- 优化 优化部分细节
|
||||||
|
## 1.0.1(2022-11-20)
|
||||||
|
- 新增 支持vue2.x, 旧版微信小程序
|
||||||
|
- 新增 h5点击事件
|
||||||
|
- 新增 小程序触摸事件
|
||||||
|
- 新增 forceUseOldCanvas参数:强制使用旧版Canvas
|
||||||
|
- 移除 width、height属性,用style代替
|
||||||
|
|
||||||
|
## 1.0.0(2022-11-18)
|
||||||
|
|
||||||
|
- 在uni-app中可以以组件的形式使用 ECharts, 支持touch事件。
|
|
@ -0,0 +1,3 @@
|
||||||
|
<template>
|
||||||
|
<view></view>
|
||||||
|
</template>
|
|
@ -0,0 +1,106 @@
|
||||||
|
export class UniCanvas {
|
||||||
|
|
||||||
|
constructor(ctx, canvasNode) {
|
||||||
|
this.ctx = ctx
|
||||||
|
this.chart = {}
|
||||||
|
this.canvasNode = canvasNode
|
||||||
|
if (!canvasNode) {
|
||||||
|
this._initStyle(ctx)
|
||||||
|
}
|
||||||
|
this._initEvent()
|
||||||
|
}
|
||||||
|
|
||||||
|
getContext(contextType) {
|
||||||
|
if (contextType === '2d') {
|
||||||
|
return this.ctx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setChart(chart) {
|
||||||
|
this.chart = chart
|
||||||
|
}
|
||||||
|
|
||||||
|
attachEvent() {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
|
detachEvent() {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
|
addEventListener() {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
|
removeEventListener() {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
|
_initCanvas(zrender, ctx) {
|
||||||
|
zrender.util.getContext = () => {
|
||||||
|
return ctx
|
||||||
|
}
|
||||||
|
zrender.util.$override('measureText', (text, font) => {
|
||||||
|
ctx.font = font || '12px sans-serif'
|
||||||
|
return ctx.measureText(text)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
_initStyle(ctx) {
|
||||||
|
ctx.createCircularGradient = (x, y, r) => {
|
||||||
|
return ctx.createCircularGradient(x, y, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_initEvent() {
|
||||||
|
this.event = {}
|
||||||
|
const eventNames = [{
|
||||||
|
wxName: 'touchStart',
|
||||||
|
ecName: 'mousedown',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
wxName: 'touchMove',
|
||||||
|
ecName: 'mousemove',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
wxName: 'touchEnd',
|
||||||
|
ecName: 'mouseup',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
wxName: 'touchEnd',
|
||||||
|
ecName: 'click',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
eventNames.forEach((name) => {
|
||||||
|
this.event[name.wxName] = (e) => {
|
||||||
|
const touch = e.touches[0]
|
||||||
|
this.chart.getZr().handler.dispatch(name.ecName, {
|
||||||
|
zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
|
||||||
|
zrY: name.wxName === 'tap' ? touch.clientY : touch.y,
|
||||||
|
preventDefault: () => {},
|
||||||
|
stopImmediatePropagation: () => {},
|
||||||
|
stopPropagation: () => {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
get width() {
|
||||||
|
if (this.canvasNode) return this.canvasNode.width
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
set width(w) {
|
||||||
|
if (this.canvasNode) this.canvasNode.width = w
|
||||||
|
}
|
||||||
|
|
||||||
|
get height() {
|
||||||
|
if (this.canvasNode) return this.canvasNode.height
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
set height(h) {
|
||||||
|
if (this.canvasNode) this.canvasNode.height = h
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,351 @@
|
||||||
|
<template>
|
||||||
|
<!-- #ifdef APP-VUE || H5 -->
|
||||||
|
<view v-if="systemInfo.deviceType === 'pc'" :id="canvasId" class="uni-canvas" @click="emits('click', $event)" />
|
||||||
|
<view
|
||||||
|
v-else
|
||||||
|
:id="canvasId"
|
||||||
|
class="uni-canvas"
|
||||||
|
@click="click"
|
||||||
|
@touchstart="touchStart"
|
||||||
|
@touchmove.stop="touchMove"
|
||||||
|
@touchend="touchEnd"
|
||||||
|
/>
|
||||||
|
<!-- #endif -->
|
||||||
|
|
||||||
|
<!-- #ifdef MP-WEIXIN || MP-QQ -->
|
||||||
|
<canvas
|
||||||
|
v-if="useNewCanvas"
|
||||||
|
type="2d"
|
||||||
|
:id="canvasId"
|
||||||
|
class="uni-canvas"
|
||||||
|
:canvas-id="canvasId"
|
||||||
|
@click="click"
|
||||||
|
@touchstart="touchStart"
|
||||||
|
@touchmove.stop="touchMove"
|
||||||
|
@touchend="touchEnd"
|
||||||
|
/>
|
||||||
|
<canvas
|
||||||
|
v-else
|
||||||
|
:id="canvasId"
|
||||||
|
class="uni-canvas"
|
||||||
|
:canvas-id="canvasId"
|
||||||
|
@click="click"
|
||||||
|
@touchstart="touchStart"
|
||||||
|
@touchmove.stop="touchMove"
|
||||||
|
@touchend="touchEnd"
|
||||||
|
/>
|
||||||
|
<!-- #endif -->
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// #ifdef VUE3
|
||||||
|
import '../../static/echarts.min.js'
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef VUE2 || MP-WEIXIN
|
||||||
|
const echarts = require('../../static/echarts.min.js')
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
import { UniCanvas } from './uni-canvas.js'
|
||||||
|
|
||||||
|
let chart = null
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'uni-chart',
|
||||||
|
emits: ['inited', 'click', 'touchStart', 'touchMove', 'touchEnd'],
|
||||||
|
props: {
|
||||||
|
// 是否强制使用旧版本 canvas 绘制(不推荐)
|
||||||
|
forceUseOldCanvas: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 主题名称,内置
|
||||||
|
theme: {
|
||||||
|
type: [String, Object],
|
||||||
|
},
|
||||||
|
// 图表配置
|
||||||
|
option: {
|
||||||
|
type: Object,
|
||||||
|
require: true,
|
||||||
|
default() {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 地图注册配置
|
||||||
|
map: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
canvasId: `uni-canvas-${Date.now()}`,
|
||||||
|
systemInfo: uni.getSystemInfoSync(),
|
||||||
|
useNewCanvas: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.registerPreprocessor()
|
||||||
|
this.registerMap()
|
||||||
|
this.$nextTick(() => {
|
||||||
|
// #ifdef APP-VUE || H5
|
||||||
|
this.initH5()
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN || MP-QQ
|
||||||
|
this.initMiniProgram()
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.dispose()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// register echarts preprocessor
|
||||||
|
registerPreprocessor() {
|
||||||
|
echarts.registerPreprocessor(option => {
|
||||||
|
if (option && option.series) {
|
||||||
|
if (option.series.length > 0) {
|
||||||
|
option.series.forEach(series => {
|
||||||
|
series.progressive = 0
|
||||||
|
})
|
||||||
|
} else if (typeof option.series === 'object') {
|
||||||
|
option.series.progressive = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// register geo json
|
||||||
|
registerMap() {
|
||||||
|
if (JSON.stringify(this.$props.map) === '{}') return
|
||||||
|
echarts.registerMap(this.$props.map.name, this.$props.map.opt)
|
||||||
|
},
|
||||||
|
// register theme color
|
||||||
|
registerTheme(name, opt) {
|
||||||
|
console.log('registerTheme', name, opt)
|
||||||
|
echarts.registerTheme(name, opt)
|
||||||
|
},
|
||||||
|
// init H5 app-vue
|
||||||
|
initH5() {
|
||||||
|
const canvasNode = document.getElementById(this.canvasId)
|
||||||
|
chart = echarts.init(canvasNode, this.$props.theme)
|
||||||
|
this.$emit('inited', chart)
|
||||||
|
chart.setOption(this.$props.option)
|
||||||
|
},
|
||||||
|
// init mini program
|
||||||
|
initMiniProgram() {
|
||||||
|
const version = this.systemInfo.SDKVersion
|
||||||
|
console.log(`当前基础库版本为: ${version}`)
|
||||||
|
|
||||||
|
const oldVersion = '1.9.91'
|
||||||
|
const baseVersion = '2.9.0'
|
||||||
|
|
||||||
|
let canUseNewCanvas = this.compareVersion(version, baseVersion) >= 0
|
||||||
|
|
||||||
|
if (this.$props.forceUseOldCanvas) {
|
||||||
|
if (canUseNewCanvas) console.warn('开发者强制使用旧canvas,建议关闭')
|
||||||
|
canUseNewCanvas = false
|
||||||
|
}
|
||||||
|
this.useNewCanvas = canUseNewCanvas && !this.forceUseOldCanvas
|
||||||
|
if (this.useNewCanvas) {
|
||||||
|
// 2.9.0 可以使用 <canvas type="2d"></canvas>
|
||||||
|
this.initNewCanvas()
|
||||||
|
} else {
|
||||||
|
const isValid = this.compareVersion(version, oldVersion) >= 0
|
||||||
|
if (!isValid) {
|
||||||
|
console.error(`基础库版本过低,需大于等于 ${oldVersion}。`)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
console.warn(`建议将基础库调整大于等于${baseVersion}版本。升级后绘图将有更好性能`)
|
||||||
|
this.initOldCanvas()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// initNewCanvas
|
||||||
|
initNewCanvas() {
|
||||||
|
const query = uni.createSelectorQuery().in(this)
|
||||||
|
query
|
||||||
|
.select(`#${this.canvasId}`)
|
||||||
|
.node(res => {
|
||||||
|
const canvasNode = res.node
|
||||||
|
const ctx = canvasNode?.getContext('2d')
|
||||||
|
canvasNode.width = canvasNode.width * this.systemInfo.pixelRatio
|
||||||
|
canvasNode.height = canvasNode.height * this.systemInfo.pixelRatio
|
||||||
|
ctx.scale(this.pixelRatio, this.pixelRatio)
|
||||||
|
const canvas = new UniCanvas(ctx, canvasNode)
|
||||||
|
this.initECharts(canvas, canvasNode.width, canvasNode.width, this.pixelRatio)
|
||||||
|
})
|
||||||
|
.exec()
|
||||||
|
},
|
||||||
|
// initOldCanvas
|
||||||
|
initOldCanvas() {
|
||||||
|
// 1.9.91 <= sdkVersion < 2.9.0:原来的方式初始化
|
||||||
|
const ctx = uni.createCanvasContext(`#${this.canvasId}`, this)
|
||||||
|
const canvas = new UniCanvas(ctx)
|
||||||
|
const query = uni.createSelectorQuery().in(this)
|
||||||
|
query
|
||||||
|
.select(`#${this.canvasId}`)
|
||||||
|
.boundingClientRect(res => {
|
||||||
|
// 微信旧的canvas不能传入dpr
|
||||||
|
this.initECharts(res.width, res.height, 1)
|
||||||
|
})
|
||||||
|
.exec()
|
||||||
|
},
|
||||||
|
// init
|
||||||
|
initECharts(canvas, width, height, dpr) {
|
||||||
|
echarts.setPlatformAPI({ createCanvas: () => canvas })
|
||||||
|
const theme = this.$props.theme
|
||||||
|
let themeName = ''
|
||||||
|
console.log('typeof theme', typeof theme)
|
||||||
|
if (typeof theme === 'object') {
|
||||||
|
this.registerTheme(theme.name, theme.opt)
|
||||||
|
themeName = theme.name
|
||||||
|
}
|
||||||
|
if (typeof theme === 'string') {
|
||||||
|
themeName = theme
|
||||||
|
}
|
||||||
|
chart = echarts.init(canvas, themeName, {
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
devicePixelRatio: dpr
|
||||||
|
})
|
||||||
|
this.$emit('inited', chart)
|
||||||
|
this.setOption(this.$props.option)
|
||||||
|
},
|
||||||
|
canvasToTempFilePath(opt) {
|
||||||
|
if (this.useNewCanvas) {
|
||||||
|
const query = uni.createSelectorQuery().in(this)
|
||||||
|
query
|
||||||
|
.select(`#${this.canvasId}`)
|
||||||
|
.node(res => {
|
||||||
|
const canvasNode = res.node
|
||||||
|
opt.canvas = canvasNode
|
||||||
|
uni.canvasToTempFilePath(opt)
|
||||||
|
})
|
||||||
|
.exec()
|
||||||
|
} else {
|
||||||
|
if (!opt.canvasId) {
|
||||||
|
opt.canvasId = this.canvasId
|
||||||
|
}
|
||||||
|
// TODO
|
||||||
|
chart.ctx.draw(true, () => {
|
||||||
|
uni.canvasToTempFilePath(opt, this)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setOption(opt) {
|
||||||
|
chart.setOption(opt)
|
||||||
|
},
|
||||||
|
dispose() {
|
||||||
|
chart && chart.dispose()
|
||||||
|
},
|
||||||
|
// event
|
||||||
|
wrapTouch(event) {
|
||||||
|
for (let i = 0; i < event.touches.length; ++i) {
|
||||||
|
const touch = event.touches[i]
|
||||||
|
touch.offsetX = touch.x
|
||||||
|
touch.offsetY = touch.y
|
||||||
|
}
|
||||||
|
return event
|
||||||
|
},
|
||||||
|
click(e) {
|
||||||
|
this.$emit('click', e)
|
||||||
|
},
|
||||||
|
touchStart(e) {
|
||||||
|
if (chart && e.touches.length > 0) {
|
||||||
|
const touch = e.touches[0]
|
||||||
|
const handler = chart.getZr().handler
|
||||||
|
handler.dispatch('mousedown', {
|
||||||
|
zrX: touch.x,
|
||||||
|
zrY: touch.y,
|
||||||
|
preventDefault: () => {},
|
||||||
|
stopPropagation: () => {}
|
||||||
|
})
|
||||||
|
handler.dispatch('mousemove', {
|
||||||
|
zrX: touch.x,
|
||||||
|
zrY: touch.y,
|
||||||
|
preventDefault: () => {},
|
||||||
|
stopPropagation: () => {}
|
||||||
|
})
|
||||||
|
handler.processGesture(this.wrapTouch(e), 'start')
|
||||||
|
this.$emit('touchStart', e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
touchMove(e) {
|
||||||
|
if (chart && e.touches.length > 0) {
|
||||||
|
let touch = e.touches[0]
|
||||||
|
const {
|
||||||
|
target: { offsetLeft, offsetTop }
|
||||||
|
} = e
|
||||||
|
touch.x = touch.pageX - offsetLeft
|
||||||
|
touch.y = touch.pageY - offsetTop
|
||||||
|
const handler = chart.getZr().handler
|
||||||
|
if (handler) {
|
||||||
|
handler.dispatch('mousemove', {
|
||||||
|
zrX: touch.x,
|
||||||
|
zrY: touch.y
|
||||||
|
})
|
||||||
|
handler.processGesture(this.wrapTouch(e), 'change')
|
||||||
|
}
|
||||||
|
this.$emit('touchMove', e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
touchEnd(e) {
|
||||||
|
if (chart) {
|
||||||
|
const touch = e.changedTouches ? e.changedTouches[0] : {}
|
||||||
|
const {
|
||||||
|
target: { offsetLeft, offsetTop }
|
||||||
|
} = e
|
||||||
|
touch.x = touch.pageX - offsetLeft
|
||||||
|
touch.y = touch.pageY - offsetTop
|
||||||
|
var handler = chart.getZr().handler
|
||||||
|
if (handler) {
|
||||||
|
handler.dispatch('mouseup', {
|
||||||
|
zrX: touch.x,
|
||||||
|
zrY: touch.y
|
||||||
|
})
|
||||||
|
handler.dispatch('click', {
|
||||||
|
zrX: touch.x,
|
||||||
|
zrY: touch.y
|
||||||
|
})
|
||||||
|
handler.processGesture(this.wrapTouch(e), 'end')
|
||||||
|
}
|
||||||
|
this.$emit('touchEnd', e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// utils
|
||||||
|
compareVersion(v1, v2) {
|
||||||
|
v1 = v1.split('.')
|
||||||
|
v2 = v2.split('.')
|
||||||
|
const len = Math.max(v1.length, v2.length)
|
||||||
|
|
||||||
|
while (v1.length < len) {
|
||||||
|
v1.push('0')
|
||||||
|
}
|
||||||
|
while (v2.length < len) {
|
||||||
|
v2.push('0')
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
const num1 = parseInt(v1[i])
|
||||||
|
const num2 = parseInt(v2[i])
|
||||||
|
if (num1 > num2) {
|
||||||
|
return 1
|
||||||
|
} else if (num1 < num2) {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
.uni-canvas {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,89 @@
|
||||||
|
{
|
||||||
|
"id": "echarts-for-uniapp",
|
||||||
|
"name": "uniapp-echarts",
|
||||||
|
"displayName": "echarts-for-uniapp",
|
||||||
|
"version": "1.0.2",
|
||||||
|
"description": "uni-app 版本 echarts, 支持 Vue2/3, 开发者可以通过熟悉的 ECharts 配置方式,快速开发图表,满足各种可视化需求.",
|
||||||
|
"keywords": [
|
||||||
|
"echarts-uniapp",
|
||||||
|
"echarts",
|
||||||
|
"echarts",
|
||||||
|
"图表",
|
||||||
|
"可视化"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"release": "bumpp && npm publish"
|
||||||
|
},
|
||||||
|
"repository": "https://github.com/xbmlz/echarts-for-uniapp",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": "^3.2.13"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"type": "component-vue",
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": "997909544"
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "插件不采集任何数据",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": "https://www.npmjs.com/package/echarts-for-uniapp"
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "y",
|
||||||
|
"vue3": "y"
|
||||||
|
},
|
||||||
|
"App": {
|
||||||
|
"app-vue": "y",
|
||||||
|
"app-nvue": "u"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "y",
|
||||||
|
"Android Browser": "y",
|
||||||
|
"微信浏览器(Android)": "y",
|
||||||
|
"QQ浏览器(Android)": "y"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "y",
|
||||||
|
"IE": "u",
|
||||||
|
"Edge": "y",
|
||||||
|
"Firefox": "y",
|
||||||
|
"Safari": "y"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "y",
|
||||||
|
"阿里": "u",
|
||||||
|
"百度": "u",
|
||||||
|
"字节跳动": "u",
|
||||||
|
"QQ": "u",
|
||||||
|
"钉钉": "u",
|
||||||
|
"快手": "u",
|
||||||
|
"飞书": "u",
|
||||||
|
"京东": "u"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
https://ide.dcloud.net.cn/build/download/7320b1c0-a364-11ed-ae60-6bec5014a8d3
|
|
@ -0,0 +1 @@
|
||||||
|
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
|
|
@ -0,0 +1,3 @@
|
||||||
|
andrCertfile=D:/HbuilderX/HBuilderX/plugins/app-safe-pack/Test.keystore
|
||||||
|
andrCertAlias=android
|
||||||
|
andrCertPass=ep/Tdjka4Y7WYqDB6/S7dw==
|
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1,25 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<script>
|
||||||
|
var __UniViewStartTime__ = Date.now();
|
||||||
|
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||||
|
CSS.supports('top: constant(a)'))
|
||||||
|
document.write(
|
||||||
|
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||||
|
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||||
|
</script>
|
||||||
|
<title>View</title>
|
||||||
|
<link rel="stylesheet" href="view.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script src="__uniappes6.js"></script>
|
||||||
|
<script src="view.umd.min.js"></script>
|
||||||
|
<script src="app-view.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
var isReady=false;var onReadyCallbacks=[];
|
||||||
|
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
||||||
|
var __uniConfig = {"pages":["pages/index/index","pages/count/count","pages/assess/assess","pages/eliminate/eliminate","pages/contribution/contribution"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"碳足迹计算器","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8","titleNView":false,"bounce":"none","scrollIndicator":"none"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"碳中和","compilerVersion":"3.6.18","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||||
|
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"设备判断"}},{"path":"/pages/count/count","meta":{},"window":{"navigationBarTitleText":"计算碳足迹"}},{"path":"/pages/assess/assess","meta":{},"window":{"navigationBarTitleText":"评估碳足迹"}},{"path":"/pages/eliminate/eliminate","meta":{},"window":{"navigationBarTitleText":"消除碳足迹"}},{"path":"/pages/contribution/contribution","meta":{},"window":{"navigationBarTitleText":"在线捐款"}}];
|
||||||
|
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||||
|
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||||
|
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
|
@ -0,0 +1 @@
|
||||||
|
(function(e){function r(r){for(var n,l,i=r[0],p=r[1],a=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in p)Object.prototype.hasOwnProperty.call(p,n)&&(e[n]=p[n]);f&&f(r);while(s.length)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var p=t[i];0!==o[p]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={"app-config":0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e["default"]}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonp"]=this["webpackJsonp"]||[],p=i.push.bind(i);i.push=r,i=i.slice();for(var a=0;a<i.length;a++)r(i[a]);var f=p;t()})([]);
|
After Width: | Height: | Size: 198 KiB |
After Width: | Height: | Size: 198 KiB |
After Width: | Height: | Size: 198 KiB |
|
@ -0,0 +1 @@
|
||||||
|
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__DB95977","name":"碳中和","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"autoclose":true,"delay":0,"target":"id:1","waiting":true},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"icons":{"android":{"hdpi":"icon-android-hdpi.png","xhdpi":"icon-android-xhdpi.png","xxhdpi":"icon-android-xxhdpi.png","xxxhdpi":"icon-android-xxxhdpi.png"},"ios":{"appstore":"unpackage/res/icons/1024x1024.png","ipad":{"app":"unpackage/res/icons/76x76.png","app@2x":"unpackage/res/icons/152x152.png","notification":"unpackage/res/icons/20x20.png","notification@2x":"unpackage/res/icons/40x40.png","proapp@2x":"unpackage/res/icons/167x167.png","settings":"unpackage/res/icons/29x29.png","settings@2x":"unpackage/res/icons/58x58.png","spotlight":"unpackage/res/icons/40x40.png","spotlight@2x":"unpackage/res/icons/80x80.png"},"iphone":{"app@2x":"unpackage/res/icons/120x120.png","app@3x":"unpackage/res/icons/180x180.png","notification@2x":"unpackage/res/icons/40x40.png","notification@3x":"unpackage/res/icons/60x60.png","settings@2x":"unpackage/res/icons/58x58.png","settings@3x":"unpackage/res/icons/87x87.png","spotlight@2x":"unpackage/res/icons/80x80.png","spotlight@3x":"unpackage/res/icons/120x120.png"},"prerendered":"false"}},"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"],"packagename":"uni.UNIDB95977","aliasname":"","password":"","keystore":"html5plus://test","custompermissions":true},"apple":{"dSYMs":false,"devices":"universal"},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}},"orientation":"portrait-primary"},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.6.18","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html","adid":"124662120805"}}
|
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 311 KiB |
After Width: | Height: | Size: 255 KiB |
After Width: | Height: | Size: 145 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 290 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 3.4 KiB |