├── pages
├── finance
│ ├── func
│ │ ├── func.json
│ │ └── func.wxss
│ ├── finance.json
│ ├── finance.wxss
│ ├── finance.wxml
│ └── finance.js
├── components
│ ├── icon
│ │ ├── index.json
│ │ ├── index.wxss
│ │ ├── index.wxml
│ │ └── index.js
│ ├── loading
│ │ ├── loading.json
│ │ ├── loading.js
│ │ └── loading.wxml
│ ├── tooltip
│ │ ├── tooltip.json
│ │ ├── tooltip.wxml
│ │ ├── tooltip.wxss
│ │ └── tooltip.js
│ ├── add-tips-main
│ │ ├── index.json
│ │ ├── index.wxml
│ │ ├── index.wxss
│ │ ├── assets
│ │ │ └── cancle.svg
│ │ └── index.js
│ └── ec-canvas
│ │ ├── ec-canvas.json
│ │ ├── ec-canvas.wxss
│ │ ├── ec-canvas.wxml
│ │ ├── wx-canvas.js
│ │ └── ec-canvas.js
├── setting
│ ├── setting.json
│ ├── about
│ │ ├── about.json
│ │ ├── about.wxss
│ │ ├── about.js
│ │ └── about.wxml
│ ├── setting.wxss
│ ├── setting.js
│ └── setting.wxml
├── mortgage
│ ├── mortgage.json
│ ├── detail
│ │ ├── detail.json
│ │ ├── detail.wxss
│ │ ├── detail.js
│ │ └── detail.wxml
│ ├── mortgage.wxss
│ ├── mortgage.js
│ └── mortgage.wxml
├── weather
│ ├── city
│ │ ├── city.json
│ │ ├── city.wxml
│ │ ├── city.wxss
│ │ └── city.js
│ ├── components
│ │ ├── daily7
│ │ │ ├── daily7.json
│ │ │ ├── daily7.wxml
│ │ │ ├── daily7.wxss
│ │ │ └── daily7.js
│ │ └── hourly24
│ │ │ ├── hourly24.json
│ │ │ ├── hourly24.wxml
│ │ │ ├── hourly24.wxss
│ │ │ └── hourly24.js
│ ├── days30
│ │ ├── days30.json
│ │ ├── days30.wxml
│ │ ├── days30.wxss
│ │ └── days30.js
│ ├── weather.json
│ ├── weather.wxml
│ ├── weather.wxss
│ └── weather.js
├── wuxian-yijin
│ ├── wxyj.json
│ ├── wxyj.wxss
│ └── wxyj.wxml
└── index.wxss
├── image
├── email.png
├── github.png
├── weather.png
├── wechat.jpg
├── wechat.png
├── wechat-fill.png
├── tab-icon
│ ├── tool.png
│ ├── tool-hl.png
│ ├── weather.png
│ └── weather-hl.png
├── icon
│ ├── icon-arrow.png
│ ├── icon-danger.png
│ ├── icon-refresh.png
│ ├── icon-search.png
│ ├── icon-question.png
│ ├── icon-search-grey.png
│ └── icon-fixed-position.png
├── weather-icon
│ ├── 100.png
│ ├── 101.png
│ ├── 102.png
│ ├── 103.png
│ ├── 104.png
│ ├── 150.png
│ ├── 151.png
│ ├── 152.png
│ ├── 153.png
│ ├── 154.png
│ ├── 300.png
│ ├── 301.png
│ ├── 302.png
│ ├── 303.png
│ ├── 304.png
│ ├── 305.png
│ ├── 306.png
│ ├── 307.png
│ ├── 308.png
│ ├── 309.png
│ ├── 310.png
│ ├── 311.png
│ ├── 312.png
│ ├── 313.png
│ ├── 314.png
│ ├── 315.png
│ ├── 316.png
│ ├── 317.png
│ ├── 318.png
│ ├── 350.png
│ ├── 351.png
│ ├── 399.png
│ ├── 400.png
│ ├── 401.png
│ ├── 402.png
│ ├── 403.png
│ ├── 404.png
│ ├── 405.png
│ ├── 406.png
│ ├── 407.png
│ ├── 408.png
│ ├── 409.png
│ ├── 410.png
│ ├── 499.png
│ ├── 500.png
│ ├── 501.png
│ ├── 502.png
│ ├── 503.png
│ └── 504.png
└── weather-city
│ ├── haze--day.png
│ ├── rain--day.png
│ ├── snow--day.png
│ └── cloudy--day.png
├── github-image
├── qrcode.jpg
└── qweather.png
├── utils
├── type.js
├── api.js
├── constant.js
├── system.js
├── util.js
└── calculatorForHouseLoan.js
├── style
├── widget
│ ├── weui-cell
│ │ ├── weui-switch.wxss
│ │ ├── weui-check.wxss
│ │ ├── weui-form
│ │ │ ├── weui-vcode.wxss
│ │ │ ├── weui-form_common.wxss
│ │ │ ├── weui-select.wxss
│ │ │ └── weui-form-preview.wxss
│ │ ├── weui-access.wxss
│ │ ├── weui-cell.wxss
│ │ ├── weui-uploader.wxss
│ │ └── weui-form.wxss
│ ├── weui-button
│ │ └── weui-button.wxss
│ ├── weui-flex
│ │ └── weui-flex.wxss
│ ├── weui-tips
│ │ ├── weui-badge.wxss
│ │ └── weui-loadmore.wxss
│ ├── weui-progress
│ │ └── weui-progress.wxss
│ ├── weui-page
│ │ ├── weui-article.wxss
│ │ └── weui-msg.wxss
│ ├── weui-agree
│ │ └── weui-agree.wxss
│ ├── weui-grid
│ │ └── weui-grid.wxss
│ ├── weui-footer
│ │ └── weui-footer.wxss
│ ├── weui-panel
│ │ └── weui-panel.wxss
│ ├── weui-tab
│ │ ├── weui-navbar.wxss
│ │ └── weui-tab.wxss
│ ├── weui-searchbar
│ │ └── weui-searchbar.wxss
│ ├── weui-animate
│ │ └── weui-animate.wxss
│ ├── weui-media-box
│ │ └── weui-media-box.wxss
│ └── weui-loading
│ │ └── weui-loading.wxss
└── base
│ └── reset.wxss
├── .gitignore
├── project.private.config.json
├── project.config.json
├── README.md
├── app.wxss
├── app.json
├── app.js
└── service
└── request.js
/pages/finance/func/func.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/components/icon/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/pages/components/loading/loading.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/pages/components/tooltip/tooltip.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/pages/setting/setting.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "更多工具"
3 | }
--------------------------------------------------------------------------------
/pages/finance/finance.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "金融公式"
3 | }
--------------------------------------------------------------------------------
/pages/mortgage/mortgage.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "房贷计算"
3 | }
--------------------------------------------------------------------------------
/pages/setting/about/about.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "关于"
3 | }
--------------------------------------------------------------------------------
/pages/weather/city/city.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "选择城市"
3 | }
--------------------------------------------------------------------------------
/pages/weather/components/daily7/daily7.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/pages/wuxian-yijin/wxyj.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "五险一金"
3 | }
--------------------------------------------------------------------------------
/pages/mortgage/detail/detail.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "房贷详情"
3 | }
--------------------------------------------------------------------------------
/pages/components/icon/index.wxss:
--------------------------------------------------------------------------------
1 | .icon {
2 | width: 64rpx;
3 | height: 64rpx;
4 | }
--------------------------------------------------------------------------------
/image/email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/email.png
--------------------------------------------------------------------------------
/image/github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/github.png
--------------------------------------------------------------------------------
/image/weather.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather.png
--------------------------------------------------------------------------------
/image/wechat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/wechat.jpg
--------------------------------------------------------------------------------
/image/wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/wechat.png
--------------------------------------------------------------------------------
/pages/components/add-tips-main/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/pages/components/ec-canvas/ec-canvas.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/pages/components/ec-canvas/ec-canvas.wxss:
--------------------------------------------------------------------------------
1 | .ec-canvas {
2 | width: 100%;
3 | height: 100%;
4 | }
5 |
--------------------------------------------------------------------------------
/pages/components/icon/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/image/wechat-fill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/wechat-fill.png
--------------------------------------------------------------------------------
/pages/weather/days30/days30.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "30天天气",
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/github-image/qrcode.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/github-image/qrcode.jpg
--------------------------------------------------------------------------------
/image/tab-icon/tool.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/tab-icon/tool.png
--------------------------------------------------------------------------------
/github-image/qweather.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/github-image/qweather.png
--------------------------------------------------------------------------------
/image/icon/icon-arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/icon/icon-arrow.png
--------------------------------------------------------------------------------
/image/icon/icon-danger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/icon/icon-danger.png
--------------------------------------------------------------------------------
/image/icon/icon-refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/icon/icon-refresh.png
--------------------------------------------------------------------------------
/image/icon/icon-search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/icon/icon-search.png
--------------------------------------------------------------------------------
/image/tab-icon/tool-hl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/tab-icon/tool-hl.png
--------------------------------------------------------------------------------
/image/tab-icon/weather.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/tab-icon/weather.png
--------------------------------------------------------------------------------
/image/weather-icon/100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/100.png
--------------------------------------------------------------------------------
/image/weather-icon/101.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/101.png
--------------------------------------------------------------------------------
/image/weather-icon/102.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/102.png
--------------------------------------------------------------------------------
/image/weather-icon/103.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/103.png
--------------------------------------------------------------------------------
/image/weather-icon/104.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/104.png
--------------------------------------------------------------------------------
/image/weather-icon/150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/150.png
--------------------------------------------------------------------------------
/image/weather-icon/151.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/151.png
--------------------------------------------------------------------------------
/image/weather-icon/152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/152.png
--------------------------------------------------------------------------------
/image/weather-icon/153.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/153.png
--------------------------------------------------------------------------------
/image/weather-icon/154.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/154.png
--------------------------------------------------------------------------------
/image/weather-icon/300.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/300.png
--------------------------------------------------------------------------------
/image/weather-icon/301.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/301.png
--------------------------------------------------------------------------------
/image/weather-icon/302.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/302.png
--------------------------------------------------------------------------------
/image/weather-icon/303.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/303.png
--------------------------------------------------------------------------------
/image/weather-icon/304.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/304.png
--------------------------------------------------------------------------------
/image/weather-icon/305.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/305.png
--------------------------------------------------------------------------------
/image/weather-icon/306.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/306.png
--------------------------------------------------------------------------------
/image/weather-icon/307.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/307.png
--------------------------------------------------------------------------------
/image/weather-icon/308.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/308.png
--------------------------------------------------------------------------------
/image/weather-icon/309.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/309.png
--------------------------------------------------------------------------------
/image/weather-icon/310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/310.png
--------------------------------------------------------------------------------
/image/weather-icon/311.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/311.png
--------------------------------------------------------------------------------
/image/weather-icon/312.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/312.png
--------------------------------------------------------------------------------
/image/weather-icon/313.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/313.png
--------------------------------------------------------------------------------
/image/weather-icon/314.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/314.png
--------------------------------------------------------------------------------
/image/weather-icon/315.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/315.png
--------------------------------------------------------------------------------
/image/weather-icon/316.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/316.png
--------------------------------------------------------------------------------
/image/weather-icon/317.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/317.png
--------------------------------------------------------------------------------
/image/weather-icon/318.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/318.png
--------------------------------------------------------------------------------
/image/weather-icon/350.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/350.png
--------------------------------------------------------------------------------
/image/weather-icon/351.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/351.png
--------------------------------------------------------------------------------
/image/weather-icon/399.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/399.png
--------------------------------------------------------------------------------
/image/weather-icon/400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/400.png
--------------------------------------------------------------------------------
/image/weather-icon/401.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/401.png
--------------------------------------------------------------------------------
/image/weather-icon/402.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/402.png
--------------------------------------------------------------------------------
/image/weather-icon/403.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/403.png
--------------------------------------------------------------------------------
/image/weather-icon/404.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/404.png
--------------------------------------------------------------------------------
/image/weather-icon/405.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/405.png
--------------------------------------------------------------------------------
/image/weather-icon/406.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/406.png
--------------------------------------------------------------------------------
/image/weather-icon/407.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/407.png
--------------------------------------------------------------------------------
/image/weather-icon/408.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/408.png
--------------------------------------------------------------------------------
/image/weather-icon/409.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/409.png
--------------------------------------------------------------------------------
/image/weather-icon/410.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/410.png
--------------------------------------------------------------------------------
/image/weather-icon/499.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/499.png
--------------------------------------------------------------------------------
/image/weather-icon/500.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/500.png
--------------------------------------------------------------------------------
/image/weather-icon/501.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/501.png
--------------------------------------------------------------------------------
/image/weather-icon/502.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/502.png
--------------------------------------------------------------------------------
/image/weather-icon/503.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/503.png
--------------------------------------------------------------------------------
/image/weather-icon/504.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-icon/504.png
--------------------------------------------------------------------------------
/image/icon/icon-question.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/icon/icon-question.png
--------------------------------------------------------------------------------
/image/tab-icon/weather-hl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/tab-icon/weather-hl.png
--------------------------------------------------------------------------------
/image/icon/icon-search-grey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/icon/icon-search-grey.png
--------------------------------------------------------------------------------
/image/weather-city/haze--day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-city/haze--day.png
--------------------------------------------------------------------------------
/image/weather-city/rain--day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-city/rain--day.png
--------------------------------------------------------------------------------
/image/weather-city/snow--day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-city/snow--day.png
--------------------------------------------------------------------------------
/image/icon/icon-fixed-position.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/icon/icon-fixed-position.png
--------------------------------------------------------------------------------
/image/weather-city/cloudy--day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fxxqq/weather-and-house-loan/HEAD/image/weather-city/cloudy--day.png
--------------------------------------------------------------------------------
/pages/finance/finance.wxss:
--------------------------------------------------------------------------------
1 | /* pages/finance/finance.wxss */
2 | .page__bd,
3 | .weui-grid__label {
4 | color: #427BFF;
5 | }
--------------------------------------------------------------------------------
/pages/components/icon/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | type: {
4 | type: String,
5 | value: ''
6 | }
7 | }
8 | });
9 |
--------------------------------------------------------------------------------
/pages/weather/components/hourly24/hourly24.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "ec-canvas": "../../../components/ec-canvas/ec-canvas"
5 | }
6 | }
--------------------------------------------------------------------------------
/utils/type.js:
--------------------------------------------------------------------------------
1 | function isObject(val) {
2 | return val != null && typeof val === 'object' && Array.isArray(val) === false;
3 | };
4 |
5 |
6 | module.exports = {
7 | isObject
8 | }
9 |
--------------------------------------------------------------------------------
/style/widget/weui-cell/weui-switch.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-cell_switch{padding-top:6px;padding-bottom:6px}
--------------------------------------------------------------------------------
/style/base/reset.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | page{line-height:1.6;font-family:-apple-system-font,Helvetica Neue,sans-serif}icon{vertical-align:middle}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows
2 | [Dd]esktop.ini
3 | Thumbs.db
4 | $RECYCLE.BIN/
5 |
6 | # macOS
7 | .DS_Store
8 | .fseventsd
9 | .Spotlight-V100
10 | .TemporaryItems
11 | .Trashes
12 |
13 | # Node.js
14 | node_modules/
15 | utils/private-key.js
16 | /utils/private.js
17 |
--------------------------------------------------------------------------------
/style/widget/weui-button/weui-button.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-btn{margin-top:15px}.weui-btn:first-child{margin-top:0}.weui-btn-area{margin:1.17647059em 15px .3em}
--------------------------------------------------------------------------------
/style/widget/weui-flex/weui-flex.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-flex{display:-webkit-box;display:-webkit-flex;display:flex}.weui-flex__item{-webkit-box-flex:1;-webkit-flex:1;flex:1}
--------------------------------------------------------------------------------
/pages/components/tooltip/tooltip.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ tips }}
4 |
5 |
6 |
--------------------------------------------------------------------------------
/pages/components/loading/loading.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | Component({
4 | properties: {
5 | type: {
6 | type: Number,
7 | value: Math.floor(Math.random() * 12 + 1)
8 | }
9 | },
10 | ready: function () {
11 |
12 | },
13 | /**
14 | * 组件的方法列表
15 | */
16 | methods: {
17 |
18 |
19 |
20 | }
21 | })
--------------------------------------------------------------------------------
/project.private.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3 | "projectname": "weather-and-house-loan",
4 | "setting": {
5 | "compileHotReLoad": true,
6 | "autoAudits": true,
7 | "preloadBackgroundData": false
8 | }
9 | }
--------------------------------------------------------------------------------
/style/widget/weui-tips/weui-badge.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-badge{display:inline-block;padding:.15em .4em;min-width:8px;border-radius:18px;background-color:#e64340;color:#fff;line-height:1.2;text-align:center;font-size:12px;vertical-align:middle}.weui-badge_dot{padding:.4em;min-width:0}
--------------------------------------------------------------------------------
/pages/components/add-tips-main/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{text}}
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/pages/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | .userinfo {
3 | display: flex;
4 | flex-direction: column;
5 | align-items: center;
6 | }
7 |
8 | .userinfo-avatar {
9 | width: 128rpx;
10 | height: 128rpx;
11 | margin: 20rpx;
12 | border-radius: 50%;
13 | }
14 |
15 | .userinfo-nickname {
16 | color: #aaa;
17 | }
18 |
19 | .usermotto {
20 | margin-top: 200px;
21 | }/* pages/index.wxss */
--------------------------------------------------------------------------------
/pages/weather/weather.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "天气查询",
3 | "usingComponents": {
4 | "loading-global": "../components/loading/loading",
5 | "icon": "../components/icon/index",
6 | "add-tips-main": "../components/add-tips-main/index",
7 | "hourly24": "./components/hourly24/hourly24",
8 | "daily7": "./components/daily7/daily7",
9 | "tooltip":"../components/tooltip/tooltip"
10 | }
11 | }
--------------------------------------------------------------------------------
/style/widget/weui-progress/weui-progress.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-progress{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-progress__bar{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-progress__opr{margin-left:15px;font-size:0}
--------------------------------------------------------------------------------
/utils/api.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 逆经纬度查询
4 | * @param {*} lat
5 | * @param {*} lon
6 | */
7 | export const geocoder = (lat, lon, success = () => { }, fail = () => { }) => {
8 | return wx.request({
9 | url: 'https://apis.map.qq.com/ws/geocoder/v1/',
10 | data: {
11 | location: `${lat},${lon}`,
12 | key: QQ_MAP_KEY,
13 | get_poi: 0
14 | },
15 | success,
16 | fail
17 | })
18 | }
19 |
--------------------------------------------------------------------------------
/style/widget/weui-cell/weui-check.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-icon-radio{margin-left:3.2px;margin-right:3.2px}.weui-icon-checkbox_circle,.weui-icon-checkbox_success{margin-left:4.6px;margin-right:4.6px}.weui-check__label:active{background-color:#ececec}.weui-check{position:absolute;left:-9999px}.weui-check__hd_in-checkbox{padding-right:.35em}.weui-cell__ft_in-radio{padding-left:.35em}
--------------------------------------------------------------------------------
/style/widget/weui-cell/weui-form/weui-vcode.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-cell_vcode{padding-right:0}.weui-vcode-btn,.weui-vcode-img{margin-left:5px;height:2.58823529em;vertical-align:middle}.weui-vcode-btn{display:inline-block;padding:0 .6em 0 .7em;border-left:1px solid #e5e5e5;line-height:2.58823529em;font-size:17px;color:#427BFF;white-space:nowrap}.weui-vcode-btn:active{color:#52a341}
--------------------------------------------------------------------------------
/style/widget/weui-page/weui-article.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-article{padding:20px 15px;font-size:15px}.weui-article__section{margin-bottom:1.5em}.weui-article__h1{font-size:18px;font-weight:400;margin-bottom:.9em}.weui-article__h2{font-size:16px;font-weight:400;margin-bottom:.34em}.weui-article__h3{font-weight:400;font-size:15px;margin-bottom:.34em}.weui-article__p{margin:0 0 .8em}
--------------------------------------------------------------------------------
/pages/finance/func/func.wxss:
--------------------------------------------------------------------------------
1 | .table {
2 | /* background: #EBEBEB; */
3 | font-size: 14px;
4 | padding: 0 10px;
5 | text-align: center;
6 | /* color: #6e6e6e; */
7 | }
8 | .table .weui-flex {
9 | padding: 5px 0;
10 | }
11 | .table .weui-flex + .weui-flex {
12 | border-top: 1px dashed #cfcfcf;
13 | }
14 | .table .weui-flex:last-child {
15 | padding-top: 10px;
16 | font-size: 12px;
17 | color: #353535;
18 | }
19 |
20 | .table .weui-flex__item + .weui-flex__item {
21 | border-left: 1px dashed #cfcfcf;
22 | flex-grow: 2;
23 | }
--------------------------------------------------------------------------------
/utils/constant.js:
--------------------------------------------------------------------------------
1 | /* 请求地址 */
2 | export const freeUrl = 'https://devapi.qweather.com' //免费订阅api 用于调试
3 | export const httpUrl = 'https://api.qweather.com' //计费api
4 | export const geoapiUrl = 'https://geoapi.qweather.com' //城市api
5 | // /* http错误码 */
6 | export const errCodeArr = [500, 502, 503, 504, 403, 404, 400, 401]
7 | export const errMsgMap = {
8 | 400: '参数错误。',
9 | 401: '登录失效',
10 | 403: '拒绝访问',
11 | 404: '地址不存在',
12 | 500: '服务器繁忙',
13 | 502: '网关错误',
14 | 503: '服务不可用',
15 | 504: '网关超时'
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/pages/components/tooltip/tooltip.wxss:
--------------------------------------------------------------------------------
1 | .tooltip-box {
2 | position: relative;
3 | }
4 |
5 | .tooltip-box .hidden {
6 | display: none;
7 | }
8 |
9 | .tooltip-box .tips {
10 | position: absolute;
11 | background: rgba(0, 0, 0, 1);
12 | padding: 20rpx;
13 | color: #fff;
14 | border-radius: 15rpx;
15 | }
16 |
17 | .tooltip-box .tips.top {
18 | top: 30rpx;
19 | }
20 |
21 | .tooltip-box .tips.bottom {
22 | bottom: 30rpx;
23 | }
24 |
25 | .tooltip-box .tips.left {
26 | left: 30rpx;
27 | }
28 |
29 | .tooltip-box .tips.right {
30 | right: 30rpx;
31 | }
--------------------------------------------------------------------------------
/style/widget/weui-agree/weui-agree.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-agree{display:block;padding:.5em 15px;font-size:13px}.weui-agree__text{color:#999}.weui-agree__link{display:inline;color:#586c94}.weui-agree__checkbox{position:absolute;left:-9999px}.weui-agree__checkbox-icon{position:relative;top:2px;display:inline-block;border:1px solid #d1d1d1;background-color:#fff;border-radius:3px;width:11px;height:11px}.weui-agree__checkbox-icon-check{position:absolute;top:1px;left:1px}
--------------------------------------------------------------------------------
/pages/components/ec-canvas/ec-canvas.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/style/widget/weui-grid/weui-grid.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-grids{border-top:1rpx solid #d9d9d9;border-left:1rpx solid #d9d9d9;overflow:hidden}.weui-grid{position:relative;float:left;padding:20px 10px;width:33.33333333%;box-sizing:border-box;border-right:1rpx solid #d9d9d9;border-bottom:1rpx solid #d9d9d9}.weui-grid_active{background-color:#ececec}.weui-grid__icon{display:block;width:28px;height:28px;margin:0 auto}.weui-grid__label{margin-top:5px;display:block;text-align:center;color:#000;font-size:14px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
--------------------------------------------------------------------------------
/style/widget/weui-page/weui-msg.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-msg{padding-top:36px;text-align:center}.weui-msg__link{display:inline;color:#586c94}.weui-msg__icon-area{margin-bottom:30px}.weui-msg__text-area{margin-bottom:25px;padding:0 20px}.weui-msg__title{margin-bottom:5px;font-weight:400;font-size:20px}.weui-msg__desc{font-size:14px;color:#999}.weui-msg__opr-area{margin-bottom:25px}.weui-msg__extra-area{margin-bottom:15px;font-size:14px;color:#999}@media screen and (min-height:438px){.weui-msg__extra-area{position:fixed;left:0;bottom:0;width:100%;text-align:center}}
--------------------------------------------------------------------------------
/style/widget/weui-cell/weui-access.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-cell_access{color:inherit}.weui-cell__ft_in-access{padding-right:13px;position:relative}.weui-cell__ft_in-access:after{content:" ";display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8cd;border-style:solid;-webkit-transform:matrix(.71,.71,-.71,.71,0,0);transform:matrix(.71,.71,-.71,.71,0,0);position:relative;top:-2px;position:absolute;top:50%;margin-top:-4px;right:2px}.weui-cell_link{color:#586c94;font-size:14px}.weui-cell_link:active{background-color:#ececec}.weui-cell_link:first-child:before{display:block}
--------------------------------------------------------------------------------
/style/widget/weui-footer/weui-footer.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-footer{color:#999;font-size:14px;text-align:center}.weui-footer_fixed-bottom{position:fixed;bottom:.52em;left:0;right:0}.weui-footer__links{font-size:0}.weui-footer__link{display:inline-block;vertical-align:top;margin:0 .62em;position:relative;font-size:14px;color:#586c94}.weui-footer__link:before{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #c7c7c7;color:#c7c7c7;left:-.65em;top:.36em;bottom:.36em}.weui-footer__link:first-child:before{display:none}.weui-footer__text{padding:0 .34em;font-size:12px}
--------------------------------------------------------------------------------
/style/widget/weui-panel/weui-panel.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-panel{background-color:#fff;margin-top:10px;position:relative;overflow:hidden}.weui-panel:first-child{margin-top:0}.weui-panel:before{top:0;border-top:1rpx solid #e5e5e5}.weui-panel:after,.weui-panel:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#e5e5e5}.weui-panel:after{bottom:0;border-bottom:1rpx solid #e5e5e5}.weui-panel__hd{padding:14px 15px 10px;color:#999;font-size:13px;position:relative}.weui-panel__hd:after{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1rpx solid #e5e5e5;color:#e5e5e5;left:15px}
--------------------------------------------------------------------------------
/style/widget/weui-tips/weui-loadmore.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-loadmore{width:65%;margin:1.5em auto;line-height:1.6em;font-size:14px;text-align:center}.weui-loadmore__tips{display:inline-block;vertical-align:middle}.weui-loadmore_line{border-top:1px solid #e5e5e5;margin-top:2.4em}.weui-loadmore__tips_in-line{position:relative;top:-.9em;padding:0 .55em;background-color:#fff;color:#999}.weui-loadmore__tips_in-dot{position:relative;padding:0 .16em;width:4px;height:1.6em}.weui-loadmore__tips_in-dot:before{content:" ";position:absolute;top:50%;left:50%;margin-top:-1px;margin-left:-2px;width:4px;height:4px;border-radius:50%;background-color:#e5e5e5}
--------------------------------------------------------------------------------
/pages/mortgage/detail/detail.wxss:
--------------------------------------------------------------------------------
1 | page,
2 | .page,
3 | .page__bd {
4 | height: 100%;
5 | }
6 |
7 | .page__bd {
8 | padding-bottom: 0;
9 | }
10 |
11 | .weui-tab__content {
12 | padding-top: 15px;
13 | display: block;
14 | }
15 |
16 | .table {
17 | /* background: #EBEBEB; */
18 | font-size: 14px;
19 | padding: 0 10px;
20 | text-align: center;
21 | /* color: #6e6e6e; */
22 | }
23 |
24 | .table .weui-flex {
25 | padding: 5px 0;
26 | }
27 |
28 | .table .weui-flex+.weui-flex {
29 | border-top: 1px dashed #cfcfcf;
30 | }
31 |
32 | .table .weui-flex:last-child {
33 | padding-top: 10px;
34 | font-size: 12px;
35 | color: #353535;
36 | }
37 |
38 | .table .weui-flex__item+.weui-flex__item {
39 | border-left: 1px dashed #cfcfcf;
40 | flex-grow: 2;
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/style/widget/weui-cell/weui-form/weui-form_common.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-cell_input{padding-top:0;padding-bottom:0}.weui-label{width:105px;word-wrap:break-word;word-break:break-all}.weui-input{height:2.58823529em;min-height:2.58823529em;line-height:2.58823529em}.weui-toptips{position:fixed;-webkit-transform:translateZ(0);transform:translateZ(0);top:0;left:0;right:0;padding:5px;font-size:14px;text-align:center;color:#fff;z-index:5000;word-wrap:break-word;word-break:break-all}.weui-toptips_warn{background-color:#e64340}.weui-textarea{display:block;width:100%}.weui-textarea-counter{color:#b2b2b2;text-align:right}.weui-cell_warn,.weui-textarea-counter_warn{color:#e64340}
--------------------------------------------------------------------------------
/style/widget/weui-cell/weui-form/weui-select.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-cell_select{padding:0}.weui-select{position:relative;padding-left:15px;padding-right:30px;height:2.58823529em;min-height:2.58823529em;line-height:2.58823529em;border-right:1rpx solid #d9d9d9}.weui-select:before{content:" ";display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8cd;border-style:solid;-webkit-transform:matrix(.71,.71,-.71,.71,0,0);transform:matrix(.71,.71,-.71,.71,0,0);position:relative;top:-2px;position:absolute;top:50%;right:15px;margin-top:-4px}.weui-select_in-select-after{padding-left:0}.weui-cell__bd_in-select-before,.weui-cell__hd_in-select-after{padding-left:15px}
--------------------------------------------------------------------------------
/pages/finance/finance.wxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 | {{item.abbr}}
12 | {{item.name}}
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件。",
3 | "setting": {
4 | "urlCheck": false,
5 | "es6": true,
6 | "postcss": true,
7 | "minified": true,
8 | "newFeature": true,
9 | "babelSetting": {
10 | "ignore": [],
11 | "disablePlugins": [],
12 | "outputPath": ""
13 | },
14 | "coverView": false,
15 | "enhance": false,
16 | "showShadowRootInWxmlPanel": false,
17 | "packNpmRelationList": [],
18 | "ignoreUploadUnusedFiles": true,
19 | "condition": false
20 | },
21 | "compileType": "miniprogram",
22 | "condition": {},
23 | "editorSetting": {
24 | "tabIndent": "insertSpaces",
25 | "tabSize": 2
26 | },
27 | "libVersion": "2.25.3",
28 | "packOptions": {
29 | "ignore": [],
30 | "include": []
31 | },
32 | "appid": "wx6a99bc78d5634950"
33 | }
--------------------------------------------------------------------------------
/style/widget/weui-tab/weui-navbar.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-navbar{display:-webkit-box;display:-webkit-flex;display:flex;position:absolute;z-index:500;top:0;width:100%;border-bottom:1rpx solid #ccc}.weui-navbar__item{position:relative;display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;padding:13px 0;text-align:center;font-size:0}.weui-navbar__item.weui-bar__item_on{color:#427BFF}.weui-navbar__slider{position:absolute;content:" ";left:0;bottom:0;width:6em;height:3px;background-color:#427BFF;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}.weui-navbar__title{display:inline-block;font-size:15px;max-width:8em;width:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap:normal}
--------------------------------------------------------------------------------
/pages/weather/days30/days30.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{item}}
5 |
6 |
7 |
8 |
12 |
13 | {{item.tempMax}}°~ {{item.tempMin}}°
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/wuxian-yijin/wxyj.wxss:
--------------------------------------------------------------------------------
1 | /* pages/wuxian-yijin/wxyj.wxss */
2 |
3 | .warn-tail {
4 | font-size: 12px;
5 | color: darkorange;
6 | }
7 |
8 | .baseline-explanation {
9 | padding: 25px;
10 | }
11 |
12 | .baseline-explanation .page__desc {
13 | text-indent: 2em;
14 | }
15 |
16 | .baseline-explanation .page__desc:nth-child(2) {
17 | color: red;
18 | }
19 |
20 | .table {
21 | /* background: #EBEBEB; */
22 | font-size: 14px;
23 | padding: 0 10px;
24 | text-align: center;
25 | /* color: #6e6e6e; */
26 | }
27 |
28 | .table .weui-flex {
29 | padding: 5px 0;
30 | }
31 |
32 | .table .weui-flex+.weui-flex {
33 | border-top: 1px dashed #cfcfcf;
34 | }
35 |
36 | .table .weui-flex:last-child {
37 | padding-top: 10px;
38 | font-size: 12px;
39 | color: #353535;
40 | }
41 |
42 | .weui-btn-area {
43 | margin-top: 15px 25px .3em;
44 | }
45 |
46 | .weui-cell__bd {
47 | margin-right: 100rpx
48 | }
--------------------------------------------------------------------------------
/utils/system.js:
--------------------------------------------------------------------------------
1 | let systemInfo
2 |
3 | export const getSystemInfoSync = () => {
4 | if (systemInfo === null) {
5 | systemInfo = wx.getSystemInfoSync()
6 | }
7 |
8 | console.log(systemInfo)
9 | return systemInfo
10 | }
11 |
12 | export function getRect(context, selector) {
13 | return new Promise(resolve => {
14 | wx.createSelectorQuery()
15 | .in(context)
16 | .select(selector)
17 | .boundingClientRect()
18 | .exec((rect = []) => resolve(rect[0]))
19 | })
20 | }
21 |
22 | export function requestAnimationFrame(cb) {
23 | const system = getSystemInfoSync()
24 |
25 | if (system.platform === 'devtools') {
26 | return setTimeout(() => {
27 | cb()
28 | }, 1000 / 30)
29 | }
30 | return wx
31 | .createSelectorQuery()
32 | .selectViewport()
33 | .boundingClientRect()
34 | .exec(() => cb())
35 | }
36 |
37 | export const getNetworkType = async () => {
38 | return await wx.getNetworkType()
39 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## 天气查询小程序
2 |
3 | 是一款好用方便的线上天气预报服务平台软件,你可以对当日地域天气查询,能将天气误差优化至小时,而且还出示天气预报、大暴雨和风险预警、天气指数值服务项目等作用,让用户能够更好地掌握和了解天气。而且在这里了解到该城市的天气情况,及时提醒亲人注意保暖;同时还提供风级、空气质量等数据信息,根据天气变化情况和这里数据来参考,做好出行准备。此外,熊猫天气随时了解明天的天气情况,能够查看明天的最高气温和最低气温,还能根据不同天气的情况,设置符合天气的动图,方便了解,简直就是生活必备工具,为你的生活带来很多的便利,出门更加方便。觉得不错的小伙伴赶紧下载试试!
4 |
5 | ## 软件功能
6 |
7 | 1、精准即时与24小时逐小时天气预报,溫度转变冷热早知;
8 | 2、将来2小时雨雪天气气象预报,精准到分鐘级別,让您出行无忧;
9 | 3、较长一个月天气预测分析,预料阴晴为您的生活起居早做准备;
10 | 4、空气指数实时查询,从容面对雾霾问题。
11 |
12 |
13 |
14 | ## 小程序亮点
15 |
16 | ## 运行&部署
17 |
18 | 第 1 步:注册和风天气 API 及卡拉云
19 | (1)注册和风天气 API
20 | 打开和风天气开放平台注册账号
21 | 在和风天气控制台创建你的应用,获得 API Key
22 |
23 |
24 | ```js
25 | //部分接口要用到收费api
26 | export const privateKey = '收费api'
27 |
28 | export const freeKeyList = [
29 | //因为和风天气免费api日调取次数有限制,所以可以多申请几个账户
30 | '免费api1',
31 | '免费api2',
32 | ]
33 |
34 | ```
35 |
36 | 接下来就是走微信小程序的部署流程
37 |
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | @import "style/weui.wxss";
3 | page{
4 | background-color: #F8F8F8;
5 | font-size: 16px;
6 | font-family: -apple-system-font,Helvetica Neue,Helvetica,sans-serif;
7 | }
8 | .page__hd {
9 | padding: 40px;
10 | }
11 | .page__bd {
12 | padding-bottom: 40px;
13 | }
14 | .page__bd_spacing {
15 | padding-left: 15px;
16 | padding-right: 15px;
17 | }
18 |
19 | .page__ft{
20 | padding-bottom: 10px;
21 | text-align: center;
22 | }
23 |
24 | .page__title {
25 | text-align: left;
26 | font-size: 20px;
27 | font-weight: 400;
28 | }
29 |
30 | .page__desc {
31 | margin-top: 5px;
32 | color: #888888;
33 | text-align: left;
34 | font-size: 14px;
35 | }
36 | .btn-area{
37 | margin-top: 60rpx;
38 | box-sizing: border-box;
39 | width: 100%;
40 | padding: 0 30rpx;
41 | }
42 | button{
43 | margin-top: 20rpx;
44 | margin-bottom: 20rpx;
45 | }
46 | .weui-navbar {
47 | background-color: rgba(255, 255, 255, .8);
48 | }
--------------------------------------------------------------------------------
/pages/mortgage/mortgage.wxss:
--------------------------------------------------------------------------------
1 | page,
2 | .page,
3 | .page__bd {
4 | height: 100%;
5 | }
6 |
7 | .page__bd {
8 | padding-bottom: 0;
9 | }
10 |
11 | .weui-tab__content {
12 | padding-top: 15px;
13 | display: block;
14 | }
15 |
16 | .page__desc {
17 | text-indent: 2em;
18 | color: red;
19 | }
20 |
21 | .weui-cell__flex {
22 | display: flex;
23 | }
24 |
25 | .weui-cell__ft {
26 | line-height: 44px;
27 | }
28 |
29 | .weui-cell__flex .weui-input {
30 | text-align: right;
31 | }
32 |
33 | .weui-input-hand {
34 | width: 100%;
35 | margin-right: 10rpx;
36 | }
37 |
38 | .footer {
39 | color: #888888;
40 | display: flex;
41 | justify-content: space-around;
42 | align-items: center;
43 | font-size: 24rpx;
44 | margin: 0 40rpx;
45 | }
46 |
47 | .weui-cell__bd {
48 | margin-right: 75rpx
49 | }
50 |
51 | .weui-label {
52 | white-space: nowrap;
53 | font-size: 28rpx;
54 | }
--------------------------------------------------------------------------------
/pages/weather/components/hourly24/hourly24.wxml:
--------------------------------------------------------------------------------
1 |
2 | 24小时天气预报
3 | {{startRainTime}}左右预计有雨
4 |
5 |
6 |
7 | {{item.fxTimeFormat}}
8 | {{item.temp}}℃
9 |
10 | {{item.text}}
11 |
12 |
13 | {{item.windDir}}
14 | {{item.windScale}}级
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/style/widget/weui-tab/weui-tab.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-navbar{display:-webkit-box;display:-webkit-flex;display:flex;position:absolute;z-index:500;top:0;width:100%;border-bottom:1rpx solid #ccc}.weui-navbar__item{position:relative;display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;padding:13px 0;text-align:center;font-size:0}.weui-navbar__item.weui-bar__item_on{color:#427BFF}.weui-navbar__slider{position:absolute;content:" ";left:0;bottom:0;width:6em;height:3px;background-color:#427BFF;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}.weui-navbar__title{display:inline-block;font-size:15px;max-width:8em;width:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap:normal}.weui-tab{position:relative;height:100%}.weui-tab__panel{box-sizing:border-box;height:100%;padding-top:50px;overflow:auto;-webkit-overflow-scrolling:touch}
--------------------------------------------------------------------------------
/style/widget/weui-searchbar/weui-searchbar.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-search-bar{position:relative;padding:8px 10px;display:-webkit-box;display:-webkit-flex;display:flex;box-sizing:border-box;background-color:#efeff4;border-top:1rpx solid #d7d6dc;border-bottom:1rpx solid #d7d6dc}.weui-icon-search{margin-right:8px;font-size:inherit}.weui-icon-search_in-box{position:absolute;left:10px;top:7px}.weui-search-bar__text{display:inline-block;font-size:14px;vertical-align:middle}.weui-search-bar__form{position:relative;-webkit-box-flex:1;-webkit-flex:auto;flex:auto;border-radius:5px;background:#fff;border:1rpx solid #e6e6ea}.weui-search-bar__box{position:relative;padding-left:30px;padding-right:30px;width:100%;box-sizing:border-box;z-index:1}.weui-search-bar__input{height:28px;line-height:28px;font-size:14px}.weui-icon-clear{position:absolute;top:0;right:0;padding:7px 8px;font-size:0}.weui-search-bar__label{position:absolute;top:0;right:0;bottom:0;left:0;z-index:2;border-radius:3px;text-align:center;color:#9b9b9b;background:#fff;line-height:28px}.weui-search-bar__cancel-btn{margin-left:10px;line-height:28px;color:#09bb07;white-space:nowrap}
--------------------------------------------------------------------------------
/pages/weather/components/hourly24/hourly24.wxss:
--------------------------------------------------------------------------------
1 | .hourly .hourlys {
2 | display: flex;
3 | flex-direction: row;
4 | justify-content: flex-start;
5 | align-items: flex-start;
6 | font-size: 24rpx;
7 | padding-top: 20rpx;
8 | background: #F7F8F9;
9 | margin-bottom: 20rpx;
10 | overflow-x: scroll;
11 | }
12 |
13 | .hourly .title {
14 | margin-left: 40rpx;
15 | margin-top: 20rpx;
16 | }
17 |
18 | .hourly .hourlys .item {
19 | display: flex;
20 | flex-direction: column;
21 | justify-content: flex-start;
22 | align-items: center;
23 | width: 140rpx;
24 | flex-shrink: 0;
25 | }
26 |
27 | .hourly .hourlys .temperature,
28 | .hourly .hourlys .weather {
29 | font-size: 28rpx;
30 | }
31 |
32 | .hourly .hourlys .date {
33 | color: rgba(0, 0, 0, 0.5);
34 | }
35 |
36 | .hourly .hourlys .wind {
37 | color: rgba(0, 0, 0, 0.5);
38 | font-size: 24rpx;
39 | }
40 |
41 | .hourly-24-item-icon {
42 | width: 48rpx;
43 | height: 48rpx;
44 | }
45 |
46 | .hourly-line-chart {
47 |
48 | height: 200rpx;
49 | display: block;
50 | }
51 |
52 | ec-canvas {
53 | width: 100%;
54 | height: 100%;
55 | background-color: #fff;
56 | }
57 |
58 | .start-rain {
59 | margin-left: 40rpx
60 | }
--------------------------------------------------------------------------------
/pages/weather/components/daily7/daily7.wxml:
--------------------------------------------------------------------------------
1 |
2 | 7 天天气预报
3 |
4 |
5 | {{item.fxDateFormat}}
6 | {{item.tempMax}}/{{item.tempMin}}℃
7 |
8 |
9 |
10 | {{item.textDay===item.textNight?item.textDay:item.textDay+'转'+item.textNight}}
11 |
12 |
13 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/components/loading/loading.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/style/widget/weui-animate/weui-animate.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | @-webkit-keyframes a{0%{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}to{-webkit-transform:translateZ(0);transform:translateZ(0)}}@keyframes a{0%{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}to{-webkit-transform:translateZ(0);transform:translateZ(0)}}.weui-animate-slide-up{-webkit-animation:a ease .3s forwards;animation:a ease .3s forwards}@-webkit-keyframes b{0%{-webkit-transform:translateZ(0);transform:translateZ(0)}to{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}@keyframes b{0%{-webkit-transform:translateZ(0);transform:translateZ(0)}to{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}.weui-animate-slide-down{-webkit-animation:b ease .3s forwards;animation:b ease .3s forwards}@-webkit-keyframes c{0%{opacity:0}to{opacity:1}}@keyframes c{0%{opacity:0}to{opacity:1}}.weui-animate-fade-in{-webkit-animation:c ease .3s forwards;animation:c ease .3s forwards}@-webkit-keyframes d{0%{opacity:1}to{opacity:0}}@keyframes d{0%{opacity:1}to{opacity:0}}.weui-animate-fade-out{-webkit-animation:d ease .3s forwards;animation:d ease .3s forwards}
--------------------------------------------------------------------------------
/style/widget/weui-cell/weui-cell.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-cells{position:relative;margin-top:1.17647059em;background-color:#fff;line-height:1.41176471;font-size:17px}.weui-cells:before{top:0;border-top:1rpx solid #d9d9d9}.weui-cells:after,.weui-cells:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#d9d9d9}.weui-cells:after{bottom:0;border-bottom:1rpx solid #d9d9d9}.weui-cells__title{margin-top:.77em;margin-bottom:.3em;padding-left:15px;padding-right:15px;color:#999;font-size:14px}.weui-cells_after-title{margin-top:0}.weui-cells__tips{margin-top:.3em;color:#999;padding-left:15px;padding-right:15px;font-size:14px}.weui-cell{padding:10px 15px;position:relative;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-cell:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid #d9d9d9;color:#d9d9d9;left:15px}.weui-cell:first-child:before{display:none}.weui-cell_active{background-color:#ececec}.weui-cell_primary{-webkit-box-align:start;-webkit-align-items:flex-start;align-items:flex-start}.weui-cell__bd{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-cell__ft{text-align:right;color:#999}
--------------------------------------------------------------------------------
/pages/weather/components/daily7/daily7.wxss:
--------------------------------------------------------------------------------
1 | .daily .dailys {
2 | display: flex;
3 | flex-direction: row;
4 | flex-direction: column;
5 | justify-content: flex-start;
6 | align-items: flex-start;
7 | font-size: 24rpx;
8 | padding-top: 20rpx;
9 | background: #F7F8F9;
10 | margin-bottom: 20rpx;
11 | overflow-x: scroll;
12 | margin: 0 40rpx;
13 | }
14 |
15 | .daily .dailys .item {
16 | border-right: 1px dashed rgba(255, 255, 255, 0.22);
17 | display: flex;
18 | justify-content: flex-start;
19 | justify-content: space-between;
20 | align-items: center;
21 | flex-shrink: 0;
22 | }
23 |
24 | .daily .dailys .temperature {
25 | flex: 1;
26 | margin: 20rpx;
27 | }
28 |
29 | .daily .dailys .temperature,
30 | .daily .dailys .weather {
31 | font-size: 28rpx;
32 | }
33 |
34 | .daily .dailys .date {
35 | color: rgba(0, 0, 0, 0.5);
36 | }
37 |
38 | .daily .dailys .wind {
39 | color: rgba(0, 0, 0, 0.5);
40 | font-size: 24rpx;
41 | }
42 |
43 | .daily-line-chart-box {
44 | width: 600rpx;
45 | height: 400rpx;
46 | }
47 |
48 | .day-30-title {
49 | color: rgba(255, 255, 255, 0.54);
50 | text-align: center;
51 | }
52 |
53 | .day-7-item-icon {
54 | width: 48rpx;
55 | height: 48rpx;
56 | }
57 |
58 | .daily .title {
59 | margin-left: 40rpx;
60 | margin-top: 20rpx;
61 | }
--------------------------------------------------------------------------------
/pages/weather/days30/days30.wxss:
--------------------------------------------------------------------------------
1 | .days-30-page {
2 | background-image: radial-gradient(circle farthest-side at 10% 90%, #FFE8EA, #EDF3FF 70%, #EDF2FB);
3 | padding: 20rpx;
4 | overflow: hidden;
5 | }
6 |
7 | .week-list {
8 | display: flex;
9 | width: 100%;
10 | margin-bottom: 30rpx;
11 |
12 | }
13 |
14 | .week-list-item {
15 | width: 13%;
16 | text-align: center;
17 | margin-right: 1.5%;
18 | }
19 |
20 | .day-30-list {
21 | width: 100%;
22 | flex-wrap: wrap;
23 |
24 | text-align: center;
25 | }
26 |
27 | .day-list-item {
28 | width: 13%;
29 | height: 120rpx;
30 | font-size: 24rpx;
31 | margin: 5px auto;
32 | margin-right: 1.5%;
33 | text-align: center;
34 | float: left;
35 | background: #fff;
36 | border-radius: 8px;
37 | white-space: nowrap;
38 | }
39 |
40 | .day-list-item.none {
41 | background: transparent;
42 | }
43 |
44 | .day-list-item:nth-child(7n+7) {
45 | margin-right: 0;
46 | }
47 |
48 | .weather-icon {
49 | width: 50rpx;
50 | height: 50rpx;
51 | margin-left: 5rpx;
52 | }
53 |
54 | .day-list-item-header {
55 | display: flex;
56 | font-size: 30rpx;
57 | line-height: 50rpx;
58 | justify-content: space-around;
59 | margin-top: 10rpx;
60 | }
61 |
62 | .day-list-item-body {
63 | font-size: 24rpx;
64 | margin-top: 20rpx;
65 | }
--------------------------------------------------------------------------------
/pages/components/add-tips-main/index.wxss:
--------------------------------------------------------------------------------
1 | .box {
2 | position: fixed;
3 | top: 0;
4 | /* left: 0; */
5 | right: 0;
6 | z-index: 999;
7 | display: flex;
8 | justify-content: flex-end;
9 | align-items: flex-end;
10 | flex-direction: column;
11 | width: 600rpx;
12 | }
13 |
14 | .arrow {
15 | width: 0;
16 | height: 0;
17 | margin-right: 120rpx;
18 | border-width: 10rpx;
19 | border-style: solid;
20 | border-color: transparent transparent rgba(0, 0, 0, 0.7)transparent;
21 | }
22 |
23 | .body {
24 | background-color: rgba(0, 0, 0, 0.7);
25 | /* box-shadow: 0 10rpx 20rpx -10rpx #34b5e2; */
26 | border-radius: 8rpx;
27 | display: flex;
28 | align-items: center;
29 | justify-content: center;
30 | height: 70rpx;
31 | padding: 0 18rpx 0 30rpx;
32 | margin-right: 60rpx;
33 | }
34 |
35 | .textContent {
36 | color: #FFF;
37 | font-size: 26rpx;
38 | font-weight: 400;
39 | /* padding: 0 10rpx; */
40 | }
41 |
42 | .split-line {
43 | padding: 0 20rpx;
44 | height: 100%;
45 | }
46 |
47 | .split-line:after {
48 | content: '';
49 | position: absolute;
50 | top: 34rpx;
51 | /* right: 0; */
52 | width: 2rpx;
53 | height: 40rpx;
54 | background: #A6A6A6;
55 | }
56 |
57 | .cancle_btn {
58 | /* padding: 0 24rpx 0 10rpx; */
59 | display: flex;
60 | justify-content: center;
61 | }
62 |
63 | .cancle_btn image {
64 | width: 22rpx;
65 | height: 22rpx;
66 | }
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/weather/weather",
4 | "pages/mortgage/mortgage",
5 | "pages/setting/setting",
6 | "pages/finance/func/func",
7 | "pages/finance/finance",
8 | "pages/wuxian-yijin/wxyj",
9 | "pages/mortgage/detail/detail",
10 | "pages/weather/city/city",
11 | "pages/setting/about/about",
12 | "pages/weather/days30/days30"
13 | ],
14 | "window": {
15 | "navigationBarTextStyle": "white",
16 | "navigationBarBackgroundColor": "#427BFF",
17 | "backgroundTextStyle": "dark",
18 | "backgroundColor": "#f8f8f8",
19 | "navigationBarTitleText": "天气月供查询"
20 | },
21 | "tabBar": {
22 | "color": "#7A7E83",
23 | "selectedColor": "#427BFF",
24 | "borderStyle": "black",
25 | "backgroundColor": "#ffffff",
26 | "list": [
27 | {
28 | "pagePath": "pages/weather/weather",
29 | "iconPath": "image/tab-icon/weather.png",
30 | "selectedIconPath": "image/tab-icon/weather-hl.png",
31 | "text": "实时天气"
32 | },
33 | {
34 | "pagePath": "pages/setting/setting",
35 | "iconPath": "image/tab-icon/tool.png",
36 | "selectedIconPath": "image/tab-icon/tool-hl.png",
37 | "text": "更多工具"
38 | }
39 | ]
40 | },
41 | "permission": {
42 | "scope.userLocation": {
43 | "desc": "你的位置信息将用于小程序位置接口的效果展示"
44 | }
45 | },
46 | "lazyCodeLoading": "requiredComponents",
47 | "requiredPrivateInfos": [
48 | "getLocation"
49 | ],
50 | "useExtendedLib": {
51 | "weui": true
52 | }
53 | }
--------------------------------------------------------------------------------
/pages/finance/finance.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | grids: [
4 | { key: 0, abbr: "0-AM", name: "Amortization" },
5 | { key: 1, abbr: "1-CAGR", name: "Compound Annual Growth Rate" },
6 | { key: 2, abbr: "2-CI", name: "Compound Interest" },
7 | { key: 3, abbr: "3-DF", name: "Discount Factor" },
8 | { key: 4, abbr: "4-FV", name: "Future Value" },
9 | { key: 5, abbr: "5-IRR", name: "Internal Rate of Return" },
10 | { key: 6, abbr: "6-XIRR", name: "..." },
11 | { key: 7, abbr: "7-LR", name: "Leverage Ratio" },
12 | { key: 8, abbr: "8-NPV", name: "Net Present Value" },
13 | { key: 9, abbr: "9-PP", name: "Payback Period" },
14 | { key: 10, abbr: "10-PV", name: "Present Value" },
15 | { key: 11, abbr: "11-PI", name: "Profitability Index" },
16 | { key: 12, abbr: "12-ROI", name: "Return on Investment" },
17 | { key: 13, abbr: "13-R72", name: "Rule of 72" },
18 | { key: 14, abbr: "14-WACC", name: "Weighted Average Cost of Capital" },
19 | { key: 15, abbr: "15-PMT", name: "Loan Payment Per Period" },
20 | { key: 16, abbr: "16-IAR", name: "Inflation-adjusted Return" },
21 | { key: 17, abbr: "17-RATE", name: "RATE" }
22 | ]
23 | },
24 | /**
25 | * 用户点击右上角分享
26 | */
27 | onShareAppMessage: function () {
28 | return {
29 | title: '金融公式',
30 | path: '/pages/finance/finance',
31 | success: function (res) {
32 | // 转发成功
33 | },
34 | fail: function (res) {
35 | // 转发失败
36 | }
37 | }
38 | }
39 | });
--------------------------------------------------------------------------------
/style/widget/weui-media-box/weui-media-box.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-media-box{padding:15px;position:relative}.weui-media-box:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid #e5e5e5;color:#e5e5e5;left:15px}.weui-media-box:first-child:before{display:none}.weui-media-box__title{font-weight:400;font-size:17px;width:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap:normal;word-wrap:break-word;word-break:break-all}.weui-media-box__desc{color:#999;font-size:13px;line-height:1.2;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.weui-media-box__info{margin-top:15px;padding-bottom:5px;font-size:13px;color:#cecece;line-height:1em;list-style:none;overflow:hidden}.weui-media-box__info__meta{float:left;padding-right:1em}.weui-media-box__info__meta_extra{padding-left:1em;border-left:1px solid #cecece}.weui-media-box__title_in-text{margin-bottom:8px}.weui-media-box_appmsg{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-media-box__thumb{width:100%;height:100%;vertical-align:top}.weui-media-box__hd_in-appmsg{margin-right:.8em;width:60px;height:60px;line-height:60px;text-align:center}.weui-media-box__bd_in-appmsg{-webkit-box-flex:1;-webkit-flex:1;flex:1;min-width:0}.weui-media-box_small-appmsg{padding:0}.weui-cells_in-small-appmsg{margin-top:0}.weui-cells_in-small-appmsg:before{display:none}
--------------------------------------------------------------------------------
/style/widget/weui-cell/weui-uploader.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-uploader__hd{display:-webkit-box;display:-webkit-flex;display:flex;padding-bottom:10px;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-uploader__title{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-uploader__info{color:#b2b2b2}.weui-uploader__bd{margin-bottom:-4px;margin-right:-9px;overflow:hidden}.weui-uploader__file{float:left;margin-right:9px;margin-bottom:9px}.weui-uploader__img{display:block;width:79px;height:79px}.weui-uploader__file_status{position:relative}.weui-uploader__file_status:before{content:" ";position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgba(0,0,0,.5)}.weui-uploader__file-content{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);color:#fff}.weui-uploader__input-box{float:left;position:relative;margin-right:9px;margin-bottom:9px;width:77px;height:77px;border:1px solid #d9d9d9}.weui-uploader__input-box:after,.weui-uploader__input-box:before{content:" ";position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background-color:#d9d9d9}.weui-uploader__input-box:before{width:2px;height:39.5px}.weui-uploader__input-box:after{width:39.5px;height:2px}.weui-uploader__input-box:active{border-color:#999}.weui-uploader__input-box:active:after,.weui-uploader__input-box:active:before{background-color:#999}.weui-uploader__input{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;opacity:0}
--------------------------------------------------------------------------------
/pages/components/add-tips-main/assets/cancle.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/pages/components/add-tips-main/index.js:
--------------------------------------------------------------------------------
1 | const STORAGE_KEY_ONE = 'ADD-MYAPP-KEY-ONE';
2 |
3 | Component({
4 | /**
5 | * 组件的属性列表
6 | */
7 | properties: {
8 | // 提示文字
9 | text: {
10 | type: String,
11 | value: '「添加小程序」访问更便捷!'
12 | }
13 | },
14 |
15 | /**
16 | * 组件的初始数据
17 | */
18 | data: {
19 | SHOW_TOP: false,
20 | SHOW_TOP_key: 1,
21 | marRight: 66
22 | },
23 | ready: function () {
24 | this.initTips();
25 | },
26 | /**
27 | * 组件的方法列表
28 | */
29 | methods: {
30 | initTips: function () {
31 | // 判断是否已经显示过
32 | let cacheOne = wx.getStorageSync(STORAGE_KEY_ONE);
33 | const now = +new Date();
34 | // 校验缓存数据 以及缓存时间是否过期(关闭后缓存一个月 一个月后重新提示用户)
35 | if (cacheOne && (now - cacheOne < 30 * 24 * 3600000)) return;
36 | // 处理根据系统信息处理位移箭头位置(重点)
37 | let systemInfo = wx.getSystemInfoSync();
38 | let client = wx.getMenuButtonBoundingClientRect();
39 | if (systemInfo && client) {
40 | this.setData({
41 | marRight: systemInfo.screenWidth - client.left - 28
42 | });
43 | }
44 | // 没显示过,则进行展示
45 | this.setData({
46 | SHOW_TOP: true
47 | });
48 | },
49 | // 显示全屏添加说明
50 | showModal: function () {
51 | this.setData({
52 | SHOW_TOP: false,
53 | SHOW_MODAL: true
54 | });
55 | },
56 | okHandler: function () {
57 | const storage_key = this.data.SHOW_TOP_key;
58 | let key = STORAGE_KEY_ONE;
59 | this.setData({
60 | SHOW_TOP: false
61 | });
62 | wx.setStorage({
63 | key,
64 | data: + new Date,
65 | });
66 | }
67 | }
68 | })
--------------------------------------------------------------------------------
/pages/setting/about/about.wxss:
--------------------------------------------------------------------------------
1 | .about {
2 | font-size: 30rpx;
3 | color: #666;
4 | /* padding: 0 40rpx 40rpx; */
5 | display: flex;
6 | flex-direction: column;
7 | justify-content: space-between;
8 | min-height: 100vh;
9 | }
10 |
11 | swiper {
12 | background: #fff;
13 | margin-bottom: 20rpx;
14 | }
15 |
16 | .info {
17 | display: flex;
18 | flex-direction: column;
19 | justify-content: center;
20 | align-items: center;
21 | font-size: 32rpx;
22 | color: #333;
23 | padding: 60rpx 40rpx;
24 | }
25 |
26 | .info image {
27 | width: 200rpx;
28 | height: 200rpx;
29 | border-radius: 50%;
30 | margin-bottom: 30rpx;
31 | }
32 |
33 | .item {
34 | line-height: 2.2em;
35 | padding: 0 40rpx;
36 | overflow: hidden;
37 | background: #fff;
38 | margin-bottom: 20rpx;
39 | }
40 |
41 | .item .title {
42 | font-size: 32rpx;
43 | color: #40a7e7;
44 | margin: 26rpx 0;
45 | }
46 |
47 | .item .i {
48 | display: flex;
49 | flex-direction: row;
50 | justify-content: flex-start;
51 | align-items: flex-start;
52 | position: relative;
53 | padding-bottom: 16rpx;
54 | }
55 |
56 | .i .icon {
57 | display: flex;
58 | justify-content: space-around;
59 | align-items: center;
60 | height: 2.2em;
61 | }
62 |
63 | .attention .i {
64 | margin-left: 0;
65 | }
66 |
67 | .i image {
68 | width: 32rpx;
69 | height: 32rpx;
70 | margin-right: 20rpx;
71 | }
72 |
73 | .footer {
74 | display: flex;
75 | justify-content: space-around;
76 | align-items: center;
77 | height: 80rpx;
78 | font-size: 22rpx;
79 | color: #333;
80 | }
81 |
82 | .wechat button {
83 | color: #fff;
84 | border: none;
85 | font-size: 30rpx;
86 | margin: 0;
87 | }
--------------------------------------------------------------------------------
/style/widget/weui-cell/weui-form/weui-form-preview.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-form-preview{position:relative;background-color:#fff}.weui-form-preview:before{top:0;border-top:1rpx solid #d9d9d9}.weui-form-preview:after,.weui-form-preview:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#d9d9d9}.weui-form-preview:after{bottom:0;border-bottom:1rpx solid #d9d9d9}.weui-form-preview__value{font-size:14px}.weui-form-preview__value_in-hd{font-size:26px}.weui-form-preview__hd{position:relative;padding:10px 15px;text-align:right;line-height:2.5em}.weui-form-preview__hd:after{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1rpx solid #d9d9d9;color:#d9d9d9;left:15px}.weui-form-preview__bd{padding:10px 15px;font-size:.9em;text-align:right;color:#999;line-height:2}.weui-form-preview__ft{position:relative;line-height:50px;display:-webkit-box;display:-webkit-flex;display:flex}.weui-form-preview__ft:after{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid #d5d5d6;color:#d5d5d6}.weui-form-preview__item{overflow:hidden}.weui-form-preview__label{float:left;margin-right:1em;min-width:4em;color:#999;text-align:justify;text-align-last:justify}.weui-form-preview__value{display:block;overflow:hidden;word-break:normal;word-wrap:break-word}.weui-form-preview__btn{position:relative;display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;color:#427BFF;text-align:center}.weui-form-preview__btn:after{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #d5d5d6;color:#d5d5d6}.weui-form-preview__btn:first-child:after{display:none}.weui-form-preview__btn_active{background-color:#eee}.weui-form-preview__btn_default{color:#999}.weui-form-preview__btn_primary{color:#0bb20c}
--------------------------------------------------------------------------------
/pages/weather/city/city.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 清空
9 |
10 |
11 |
12 | 热门城市
13 |
14 |
15 |
16 | 当前定位
17 |
18 |
19 | {{item.name}}
20 |
21 |
22 | {{item.name}}
23 |
24 |
25 | 历史查找
26 |
27 |
28 | {{item.name}}
29 |
30 |
31 |
32 |
33 |
34 |
35 | {{item.name}}
36 |
37 |
38 |
39 | 暂无城市可以选择
40 |
--------------------------------------------------------------------------------
/pages/setting/about/about.js:
--------------------------------------------------------------------------------
1 | let utils = require("../../../utils/util")
2 | Page({
3 | data: {
4 | // projectAddress: 'https://github.com/fxxqq/weather-and-house-loan',
5 | // github: 'https://github.com/fxxqq',
6 | email: '188105274@qq.com',
7 | qq: 'babelparser',
8 | swiperHeight: 'auto',
9 | bannerImgList: [
10 | {
11 | src: 'https://raw.githubusercontent.com/zhangliwen1101/Images/master/img/weather.jpg',
12 | title: 'Weather Widget',
13 | },
14 | {
15 | src: 'https://raw.githubusercontent.com/zhangliwen1101/Images/master/img/weather.jpg',
16 | title: 'Weather Widget',
17 | },
18 | {
19 | src: 'https://raw.githubusercontent.com/zhangliwen1101/Images/master/img/wait.jpg',
20 | title: 'Weather Widget',
21 | },
22 | ],
23 | },
24 | onLoad () {
25 | this.initSwiper()
26 | },
27 | previewImages (e) {
28 | let index = e.currentTarget.dataset.index || 0
29 | let urls = this.data.bannerImgList
30 | let arr = []
31 | let imgs = urls.forEach(item => {
32 | arr.push(item.src)
33 | })
34 | wx.previewImage({
35 | current: arr[index],
36 | urls: arr,
37 | success: function (res) { },
38 | fail: function (res) {
39 | console.error('previewImage fail: ', res)
40 | }
41 | })
42 | },
43 | initSwiper () {
44 | let systeminfo = getApp().globalData.systeminfo
45 | if (utils.isEmptyObject(systeminfo)) {
46 | wx.getSystemInfo({
47 | success: (res) => {
48 | this.setSwiperHeight(res)
49 | },
50 | })
51 | } else {
52 | this.setSwiperHeight(systeminfo)
53 | }
54 | },
55 | setSwiperHeight (res) {
56 | this.setData({
57 | swiperHeight: `${(res.windowWidth || res.screenWidth) / 375 * 200}px`
58 | })
59 | },
60 | copy(e) {
61 | let dataset = (e.currentTarget || {}).dataset || {}
62 | let title = dataset.title || ''
63 | let content = dataset.content || ''
64 | wx.setClipboardData({
65 | data: content,
66 | success () {
67 | wx.showToast({
68 | title: `已复制${title}`,
69 | duration: 2000,
70 | })
71 | },
72 | })
73 | },
74 | })
--------------------------------------------------------------------------------
/pages/setting/about/about.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
14 |
15 | 代码已开源
16 |
17 |
18 |
19 |
20 |
21 | github链接(点击复制)
22 | {{projectAddress}}
23 |
24 |
25 |
26 |
27 | 联系开发者
28 |
29 |
30 |
31 |
32 |
33 | 通过 Email 反馈
34 | {{email}}
35 |
36 |
37 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | 鸣谢
55 |
56 |
57 |
58 |
59 | 气象数据来源:和风天气
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 | // 展示本地存储能力
5 | var logs = wx.getStorageSync('logs') || []
6 | logs.unshift(Date.now())
7 | wx.setStorageSync('logs', logs)
8 |
9 | // 登录
10 | // wx.login({
11 | // success: res => {
12 | // // 发送 res.code 到后台换取 openId, sessionKey, unionId
13 | // }
14 | // })
15 | // 获取用户信息
16 | // wx.getSetting({
17 | // success: res => {
18 | // if (res.authSetting['scope.userInfo']) {
19 | // // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
20 | // wx.getUserInfo({
21 | // success: res => {
22 | // // 可以将 res 发送给后台解码出 unionId
23 | // this.globalData.userInfo = res.userInfo
24 |
25 | // // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
26 | // // 所以此处加入 callback 以防止这种情况
27 | // if (this.userInfoReadyCallback) {
28 | // this.userInfoReadyCallback(res)
29 | // }
30 | // }
31 | // })
32 | // }
33 | // }
34 | // })
35 | //获取设备信息
36 | wx.getSystemInfo({
37 | success: (res) => {
38 | this.globalData.systeminfo = res
39 | this.globalData.isIPhoneX = /iphonex/gi.test(res.model.replace(/\s+/, ''))
40 | },
41 | })
42 | },
43 | onShow: function () {
44 | this.upDataApp()
45 | },
46 | upDataApp: function () {//版本更新
47 | if (wx.canIUse('getUpdateManager')) {//判断当前微信版本是否支持版本更新
48 | const updateManager = wx.getUpdateManager();
49 | updateManager.onCheckForUpdate(function (res) {
50 | if (res.hasUpdate) { // 请求完新版本信息的回调
51 | updateManager.onUpdateReady(function () {
52 | wx.showModal({
53 | title: '更新提示',
54 | content: '新版本已经准备好,是否重启应用?',
55 | success: function (res) {
56 | if (res.confirm) {// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
57 | updateManager.applyUpdate()
58 | }
59 | }
60 | })
61 | });
62 |
63 | updateManager.onUpdateFailed(function () {
64 | wx.showModal({// 新的版本下载失败
65 | title: '已经有新版本了哟~',
66 | content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
67 | })
68 | })
69 | }
70 | })
71 | } else {
72 | wx.showModal({// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
73 | title: '提示',
74 | content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
75 | })
76 | }
77 | },
78 | globalData: {
79 | userInfo: null,
80 | isIPhoneX: false,
81 | }
82 | })
--------------------------------------------------------------------------------
/pages/weather/days30/days30.js:
--------------------------------------------------------------------------------
1 | import request from '../../../service/request'
2 |
3 | import jsonData from './data'
4 | Page({
5 | data: {
6 | weekList: ['一', '二', '三', '四', '五', '六', '日'],
7 | daily30Datas: []
8 | },
9 | onLoad() {
10 | let cacheData = wx.getStorageSync('cache-data') ? JSON.parse(wx.getStorageSync('cache-data')) : null;
11 | let nowTimeDaily30 = +new Date()
12 | if (cacheData && cacheData.daily30Datas) {
13 | if (nowTimeDaily30 - cacheData.nowTimeDaily30 < 60 * 60 * 1000) {
14 | this.setData({
15 | daily30Datas: cacheData.daily30Datas
16 | })
17 | } else {
18 | this.getDaily(nowTimeDaily30)
19 | }
20 | } else {
21 | this.getDaily(nowTimeDaily30)
22 | }
23 | },
24 |
25 |
26 | async getDaily(nowTimeDaily30, day = 30) {
27 | console.log("this", this)
28 | let dailyRes = await request({
29 | apiType: 'qweather',
30 | isVip: true,
31 | url: `/v7/weather/${day}d`,
32 | data: {
33 | location: wx.getStorageSync('location') || '',
34 | },
35 | })
36 | console.log("dailyRes", JSON.stringify(dailyRes))
37 | // let dailyRes = jsonData
38 |
39 | console.log("dailyRes", dailyRes)
40 | let prefix = []
41 | if (new Date(dailyRes.daily[0].fxDate).getDay()) {
42 | prefix = new Array(new Date(dailyRes.daily[0].fxDate).getDay() - 1)
43 | }
44 |
45 | dailyRes.daily.map((item, index) => {
46 | dailyRes.daily[index] = {
47 | day: new Date(item.fxDate).getDate() === 1 ? new Date(item.fxDate).getMonth() + 1 + '月' : new Date(item.fxDate).getDate(),
48 | iconDay: item.iconDay,
49 | iconNight: item.iconNight,
50 | tempMin: item.tempMin,
51 | tempMax: item.tempMax,
52 | textDay: item.textDay,
53 | textNight: item.textNight
54 | }
55 | if (index === 0) {
56 | dailyRes.daily[index].day = '今天'
57 | }
58 | })
59 |
60 | console.log("dailyRes.daily", dailyRes.daily)
61 | this.setData({
62 | daily30Datas: [...prefix, ...dailyRes.daily]
63 | })
64 |
65 | let cacheData = wx.getStorageSync('cache-data') ? JSON.parse(wx.getStorageSync('cache-data')) : null;
66 | cacheData.nowTimeDaily30 = nowTimeDaily30
67 | cacheData.daily30Datas = [...prefix, ...dailyRes.daily]
68 | wx.setStorageSync("cache-data", JSON.stringify(cacheData))
69 | // this.initChart()
70 |
71 | },
72 | })
--------------------------------------------------------------------------------
/pages/components/ec-canvas/wx-canvas.js:
--------------------------------------------------------------------------------
1 | export default class WxCanvas {
2 | constructor(ctx, canvasId, isNew, canvasNode) {
3 | this.ctx = ctx;
4 | this.canvasId = canvasId;
5 | this.chart = null;
6 | this.isNew = isNew
7 | if (isNew) {
8 | this.canvasNode = canvasNode;
9 | }
10 | else {
11 | this._initStyle(ctx);
12 | }
13 |
14 | // this._initCanvas(zrender, ctx);
15 |
16 | this._initEvent();
17 | }
18 |
19 | getContext(contextType) {
20 | if (contextType === '2d') {
21 | return this.ctx;
22 | }
23 | }
24 |
25 | // canvasToTempFilePath(opt) {
26 | // if (!opt.canvasId) {
27 | // opt.canvasId = this.canvasId;
28 | // }
29 | // return wx.canvasToTempFilePath(opt, this);
30 | // }
31 |
32 | setChart(chart) {
33 | this.chart = chart;
34 | }
35 |
36 | addEventListener() {
37 | // noop
38 | }
39 |
40 | attachEvent() {
41 | // noop
42 | }
43 |
44 | detachEvent() {
45 | // noop
46 | }
47 |
48 | _initCanvas(zrender, ctx) {
49 | zrender.util.getContext = function () {
50 | return ctx;
51 | };
52 |
53 | zrender.util.$override('measureText', function (text, font) {
54 | ctx.font = font || '12px sans-serif';
55 | return ctx.measureText(text);
56 | });
57 | }
58 |
59 | _initStyle(ctx) {
60 | ctx.createRadialGradient = () => {
61 | return ctx.createCircularGradient(arguments);
62 | };
63 | }
64 |
65 | _initEvent() {
66 | this.event = {};
67 | const eventNames = [{
68 | wxName: 'touchStart',
69 | ecName: 'mousedown'
70 | }, {
71 | wxName: 'touchMove',
72 | ecName: 'mousemove'
73 | }, {
74 | wxName: 'touchEnd',
75 | ecName: 'mouseup'
76 | }, {
77 | wxName: 'touchEnd',
78 | ecName: 'click'
79 | }];
80 | eventNames.forEach(name => {
81 | this.event[name.wxName] = e => {
82 | const touch = e.touches[0];
83 | this.chart.getZr().handler.dispatch(name.ecName, {
84 | zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
85 | zrY: name.wxName === 'tap' ? touch.clientY : touch.y,
86 | preventDefault: () => {},
87 | stopImmediatePropagation: () => {},
88 | stopPropagation: () => {}
89 | });
90 | };
91 | });
92 | }
93 |
94 | set width(w) {
95 | if (this.canvasNode) this.canvasNode.width = w
96 | }
97 | set height(h) {
98 | if (this.canvasNode) this.canvasNode.height = h
99 | }
100 |
101 | get width() {
102 | if (this.canvasNode)
103 | return this.canvasNode.width
104 | return 0
105 | }
106 | get height() {
107 | if (this.canvasNode)
108 | return this.canvasNode.height
109 | return 0
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/pages/setting/setting.wxss:
--------------------------------------------------------------------------------
1 | .setting {
2 | font-size: 28rpx;
3 | color: #666;
4 | }
5 |
6 | .avatarInfo {
7 | display: flex;
8 | align-items: center;
9 | padding: 0 50rpx;
10 | }
11 |
12 | .avatarInfo .avatar {
13 | display: block;
14 | overflow: hidden;
15 | width: 60rpx;
16 | height: 60rpx;
17 | border-radius: 50%;
18 | }
19 |
20 | .avatarInfo .name {
21 | padding: 0 20rpx;
22 | font-size: 30rpx;
23 | }
24 |
25 | .avatarInfo .downArrow {
26 | width: 20rpx;
27 | height: 20rpx;
28 | }
29 |
30 | .more {
31 | width: 32rpx;
32 | height: 32rpx;
33 | }
34 |
35 | .item {
36 | display: flex;
37 | justify-content: space-between;
38 | align-items: center;
39 | height: 100rpx;
40 | }
41 |
42 | .sub.content .item {
43 | padding-left: 20rpx;
44 | }
45 |
46 | .item .right {
47 | display: flex;
48 | justify-content: flex-end;
49 | align-items: center;
50 | }
51 |
52 | .item .tip {
53 | font-size: 22rpx;
54 | color: #999;
55 | display: flex;
56 | justify-content: flex-start;
57 | align-items: center;
58 | }
59 |
60 | .item .tip image {
61 | width: 24rpx;
62 | height: 24rpx;
63 | margin-right: 10rpx;
64 | }
65 |
66 | .item slider {
67 | width: 100%;
68 | margin: 0;
69 | }
70 |
71 | .title {
72 | font-size: 32rpx;
73 | color: #427BFF;
74 | margin: 26rpx 0;
75 | }
76 |
77 | .subtitle {
78 | font-size: 28rpx;
79 | color: #427BFF;
80 | }
81 |
82 | .toast .mask {
83 | position: fixed;
84 | z-index: 9;
85 | top: 0;
86 | right: 0;
87 | bottom: 0;
88 | left: 0;
89 | margin: auto;
90 | background: rgba(0, 0, 0, .5);
91 | }
92 |
93 | .toast .wrapper {
94 | position: fixed;
95 | z-index: 10;
96 | top: 0;
97 | right: 0;
98 | bottom: 0;
99 | left: 0;
100 | margin: auto;
101 | background: #fff;
102 | font-size: 24rpx;
103 | color: #333;
104 | width: 60%;
105 | height: 400rpx;
106 | border-radius: 14rpx;
107 | padding: 46rpx 28rpx;
108 | }
109 |
110 | .toast .box {
111 | height: 400rpx;
112 | overflow: scroll;
113 | }
114 |
115 | .t {
116 | overflow: hidden;
117 | padding: 0 40rpx;
118 | background: #fff;
119 | margin-bottom: 20rpx;
120 | }
121 |
122 | .toast .t {
123 | font-size: 28rpx;
124 | color: #40a7e7;
125 | margin: 20rpx 0;
126 | padding: 0;
127 | }
128 |
129 | .toast .content {
130 | line-height: 1.8em;
131 | text-align: justify;
132 | }
133 |
134 | .toast .content text {
135 | display: block;
136 | margin-bottom: 10rpx;
137 | }
138 |
139 | .wx-switch-input {
140 | width: 84rpx !important;
141 | height: 43rpx !important;
142 | }
143 |
144 | .wx-switch-input::before {
145 | width: 82rpx !important;
146 | height: 38rpx !important;
147 | }
148 |
149 | .wx-switch-input::after {
150 | width: 38rpx !important;
151 | height: 38rpx !important;
152 | }
--------------------------------------------------------------------------------
/pages/components/tooltip/tooltip.js:
--------------------------------------------------------------------------------
1 |
2 | const screenWidth = wx.getSystemInfoSync().windowWidth // 获取设备信息(宽度)
3 | Component({
4 | externalClasses: ['tooltip-box1'],
5 | // 启用插槽
6 | options: {
7 | multipleSlots: true
8 | },
9 | properties: {
10 | placement: {
11 | type: String,
12 | value: 'top' // right bottom left
13 | },
14 | content: String,
15 | tips: String,
16 | maxWidth: {
17 | type: Number,
18 | value: 354
19 | },
20 | duration: {
21 | type: Number,
22 | value: 2000
23 | }
24 | },
25 | data() {
26 | return {
27 | tooltipWidth: 100
28 | }
29 | },
30 | lifetimes: {
31 | attached() {
32 | this.getTooltipWidth()
33 | this.judgePosition()
34 | }
35 | },
36 | methods: {
37 | getTooltipWidth() {
38 | const contentRPXWidth = this.data.tips.length * 28 + 36 * 2 // 自定义的一个tips宽度
39 | const conetntPXWidth = (contentRPXWidth / 750) * screenWidth // 根据屏幕适配的宽度
40 |
41 | wx.createSelectorQuery().in(this).select('.tooltip-box').boundingClientRect(({ width }) => {
42 | console.log("width", width)
43 | const {
44 | maxWidth
45 | } = this.data
46 | let tooltipWidth = 0
47 | // 获取自定义元素的宽度 与 屏幕适配宽度做比较
48 | // 最终参考使用一个合适的宽度作为 tips 的宽度
49 | if (conetntPXWidth < width) {
50 | tooltipWidth = contentRPXWidth
51 | } else {
52 | tooltipWidth = contentRPXWidth < maxWidth ? contentRPXWidth : maxWidth
53 | }
54 | this.setData({
55 | tooltipWidth
56 | })
57 | }).exec()
58 | },
59 | // 判断tips是否在某个位置上有足够的空间放置
60 | judgePosition() {
61 | // 同理通过 wx.createSelectorQuery().in(this).select('').boundingClientRect去获取自定义元素的位置元素信息以及tips的位置元素信息去做处理
62 | // 在这里只列举了其中一种情况的例子进行判断来设置该tips的实际放置位置
63 | // 以下情况可能出现的场景是:自定义元素放置的位置过于偏左 导致上下的tips没办法放置 因此设置tips到右边 别的情况同理
64 | if (this.placement === 'top' || this.placement === 'bottom') {
65 | let targetLeftCenter = targetLeft + targetWidth / 2 // 点击元素的中间位置坐标
66 | if (targetLeftCenter < tipWidth / 2) {
67 | this.setData({
68 | placement: 'right'
69 | })
70 | }
71 | }
72 |
73 |
74 | },
75 | clickTips() {
76 | const { duration } = this.data
77 | this.setData({ isNeedTips: true }) // 显示tips
78 | let timer = setTimeout(() => {
79 | this.setData({
80 | isNeedTips: false // 在duration毫秒后隐藏tips
81 | })
82 | wx.nextTick(() => {
83 | clearTimeout(timer) && (timer = null) // 清理定时器
84 | })
85 | }, duration)
86 | this.triggerEvent('click') // 抛出一个点击事件
87 | }
88 | },
89 |
90 |
91 |
92 | })
--------------------------------------------------------------------------------
/pages/weather/components/daily7/daily7.js:
--------------------------------------------------------------------------------
1 | import { formatDate } from '../../../../utils/util'
2 | import request from '../../../../service/request'
3 |
4 | Component({
5 | properties: {
6 | location: {
7 | type: String,
8 | value: '',
9 | observer(val) {
10 | if (val) {
11 | let nowTimeDaily7 = +new Date()
12 | this.getDaily(nowTimeDaily7)
13 | }
14 | }
15 | }
16 | },
17 | lifetimes: {
18 | ready() {
19 | let cacheData = wx.getStorageSync('cache-data') ? JSON.parse(wx.getStorageSync('cache-data')) : null;
20 | let nowTimeDaily7 = +new Date()
21 | if (cacheData && cacheData.daily7Datas) {
22 | if (nowTimeDaily7 - cacheData.nowTimeDaily7 < 10 * 60 * 1000) {
23 | this.setData({
24 | daily7Datas: cacheData.daily7Datas
25 | })
26 | } else {
27 | this.getDaily(nowTimeDaily7)
28 | }
29 | } else {
30 | this.getDaily(nowTimeDaily7)
31 | }
32 |
33 |
34 | },
35 | },
36 | data: {
37 | daily7Datas: [],
38 |
39 | },
40 | observers: {
41 | location() {
42 |
43 | }
44 | },
45 |
46 |
47 | methods: {
48 | async getDaily(nowTimeDaily7, day = 7) {
49 | let dailyRes = await request({
50 | apiType: 'qweather',
51 | url: `/v7/weather/${day}d`,
52 | data: {
53 | location: this.data.location,
54 |
55 | },
56 | })
57 | dailyRes.daily.map((item, index) => {
58 | item.fxDateFormat = '周' + '日一二三四五六'.charAt(new Date(item.fxDate).getDay()) + ' ' + formatDate(new Date(item.fxDate), 'MM-dd')
59 | dailyRes.daily[index] = {
60 | fxDateFormat: item.fxDateFormat,
61 | iconDay: item.iconDay,
62 | iconNight: item.iconNight,
63 | tempMin: item.tempMin,
64 | tempMax: item.tempMax,
65 | textDay: item.textDay,
66 | textNight: item.textNight
67 | }
68 | if (index === 0) {
69 | dailyRes.daily[index].fxDateFormat = '今天' + ' ' + formatDate(new Date(item.fxDate), 'MM-dd')
70 | }
71 | if (index === 1) {
72 | dailyRes.daily[index].fxDateFormat = '明天' + ' ' + formatDate(new Date(item.fxDate), 'MM-dd')
73 | }
74 |
75 | })
76 | console.log("dailyRes.daily", dailyRes.daily)
77 | this.setData({
78 | daily7Datas: dailyRes.daily
79 | })
80 |
81 | let cacheData = wx.getStorageSync('cache-data') ? JSON.parse(wx.getStorageSync('cache-data')) : null;
82 | cacheData.nowTimeDaily7 = nowTimeDaily7
83 | cacheData.daily7Datas = dailyRes.daily
84 | wx.setStorageSync("cache-data", JSON.stringify(cacheData))
85 |
86 |
87 | },
88 |
89 |
90 |
91 | }
92 | })
93 |
--------------------------------------------------------------------------------
/style/widget/weui-cell/weui-form.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-cell_input{padding-top:0;padding-bottom:0}.weui-label{width:105px;word-wrap:break-word;word-break:break-all}.weui-input{height:2.58823529em;min-height:2.58823529em;line-height:2.58823529em}.weui-toptips{position:fixed;-webkit-transform:translateZ(0);transform:translateZ(0);top:0;left:0;right:0;padding:5px;font-size:14px;text-align:center;color:#fff;z-index:5000;word-wrap:break-word;word-break:break-all}.weui-toptips_warn{background-color:#e64340}.weui-textarea{display:block;width:100%}.weui-textarea-counter{color:#b2b2b2;text-align:right}.weui-cell_warn,.weui-textarea-counter_warn{color:#e64340}.weui-form-preview{position:relative;background-color:#fff}.weui-form-preview:before{top:0;border-top:1rpx solid #d9d9d9}.weui-form-preview:after,.weui-form-preview:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#d9d9d9}.weui-form-preview:after{bottom:0;border-bottom:1rpx solid #d9d9d9}.weui-form-preview__value{font-size:14px}.weui-form-preview__value_in-hd{font-size:26px}.weui-form-preview__hd{position:relative;padding:10px 15px;text-align:right;line-height:2.5em}.weui-form-preview__hd:after{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1rpx solid #d9d9d9;color:#d9d9d9;left:15px}.weui-form-preview__bd{padding:10px 15px;font-size:.9em;text-align:right;color:#999;line-height:2}.weui-form-preview__ft{position:relative;line-height:50px;display:-webkit-box;display:-webkit-flex;display:flex}.weui-form-preview__ft:after{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid #d5d5d6;color:#d5d5d6}.weui-form-preview__item{overflow:hidden}.weui-form-preview__label{float:left;margin-right:1em;min-width:4em;color:#999;text-align:justify;text-align-last:justify}.weui-form-preview__value{display:block;overflow:hidden;word-break:normal;word-wrap:break-word}.weui-form-preview__btn{position:relative;display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;color:#427BFF;text-align:center}.weui-form-preview__btn:after{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #d5d5d6;color:#d5d5d6}.weui-form-preview__btn:first-child:after{display:none}.weui-form-preview__btn_active{background-color:#eee}.weui-form-preview__btn_default{color:#999}.weui-form-preview__btn_primary{color:#0bb20c}.weui-cell_select{padding:0}.weui-select{position:relative;padding-left:15px;padding-right:30px;height:2.58823529em;min-height:2.58823529em;line-height:2.58823529em;border-right:1rpx solid #d9d9d9}.weui-select:before{content:" ";display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8cd;border-style:solid;-webkit-transform:matrix(.71,.71,-.71,.71,0,0);transform:matrix(.71,.71,-.71,.71,0,0);position:relative;top:-2px;position:absolute;top:50%;right:15px;margin-top:-4px}.weui-select_in-select-after{padding-left:0}.weui-cell__bd_in-select-before,.weui-cell__hd_in-select-after{padding-left:15px}.weui-cell_vcode{padding-right:0}.weui-vcode-btn,.weui-vcode-img{margin-left:5px;height:2.58823529em;vertical-align:middle}.weui-vcode-btn{display:inline-block;padding:0 .6em 0 .7em;border-left:1px solid #e5e5e5;line-height:2.58823529em;font-size:17px;color:#427BFF;white-space:nowrap}.weui-vcode-btn:active{color:#52a341}
--------------------------------------------------------------------------------
/pages/weather/city/city.wxss:
--------------------------------------------------------------------------------
1 | .container {
2 | min-height: 100vh;
3 | display: flex;
4 | flex-direction: column;
5 | margin-bottom: 20rpx;
6 | }
7 |
8 | .wrapper {
9 | font-size: 0;
10 | background: #fff;
11 | padding: 30rpx;
12 | position: relative;
13 | height: 128rpx;
14 | box-sizing: border-box;
15 | }
16 |
17 | .wrapper .search {
18 | display: flex;
19 | justify-content: flex-start;
20 | align-items: center;
21 | }
22 |
23 | .inner {
24 | background: #f4f6f9;
25 | font-size: 30rpx;
26 | padding: 16rpx 0 16rpx 20rpx;
27 | box-sizing: border-box;
28 | border-radius: 8rpx;
29 | flex: 1;
30 | display: flex;
31 | align-items: center;
32 | }
33 |
34 | .inner input {
35 | background: #f4f6f9;
36 | font-size: 30rpx;
37 | height: 38rpx;
38 | /* 覆盖默认样式 min-height */
39 | min-height: 38rpx;
40 | line-height: 38rpx;
41 | width: 100%;
42 | box-sizing: border-box;
43 | }
44 |
45 | .icon {
46 | width: 28rpx;
47 | height: 28rpx;
48 | margin-right: 10rpx;
49 | }
50 |
51 | .cancel {
52 | font-size: 30rpx;
53 | display: inline-block;
54 | color: #666;
55 | width: 2.5em;
56 | text-align: right;
57 | }
58 |
59 | .items {
60 | display: flex;
61 | flex-direction: row;
62 | justify-content: flex-start;
63 | flex-wrap: wrap;
64 | }
65 |
66 | .items .item {
67 | border: 1rpx solid rgb(242, 242, 242);
68 | background: #efefef;
69 | border-radius: 10rpx;
70 | padding: 8rpx 40rpx;
71 | margin-right: 30rpx;
72 | margin-bottom: 36rpx;
73 | }
74 |
75 | .top .title {
76 | margin-bottom: 30rpx;
77 | }
78 |
79 | .top {
80 | padding: 30rpx 96rpx 20rpx 30rpx;
81 | }
82 |
83 | .top,
84 | .bottom {
85 | font-size: 32rpx;
86 | color: #333;
87 | background: #fff;
88 | }
89 |
90 | .hot {
91 | background: #fff;
92 | margin-top: 10rpx;
93 | padding: 30rpx 30rpx 20rpx;
94 | }
95 |
96 | .hot .title {
97 | font-size: 32rpx;
98 | }
99 |
100 | .hot .title.history {
101 | margin-top: 15rpx;
102 | }
103 |
104 | .hot .cities {
105 | display: flex;
106 | align-items: center;
107 | flex-wrap: wrap;
108 | }
109 |
110 | .hot .item {
111 | display: flex;
112 | justify-content: center;
113 | align-items: center;
114 | width: 22%;
115 | height: 50rpx;
116 | background: #f4f6f9;
117 | border-radius: 8rpx;
118 | color: #333;
119 | font-size: 26rpx;
120 | margin-top: 20rpx;
121 | margin-left: 2%;
122 | margin-right: 2%;
123 | white-space: nowrap;
124 | }
125 |
126 | .hot .item .icon {
127 | width: 24rpx;
128 | height: 24rpx;
129 | margin-right: 8rpx;
130 | }
131 |
132 | .hot .item.active {
133 | background: #427BFF;
134 | color: #fff;
135 | }
136 |
137 | .hot .item:nth-child(4n+1) {
138 | margin-left: 0;
139 | }
140 |
141 | .hot .item:nth-child(4n) {
142 | margin-right: 0;
143 | }
144 |
145 | .bottom .key {
146 | background: #f4f6f9;
147 | height: 50rpx;
148 | display: flex;
149 | align-items: center;
150 | padding: 0 30rpx;
151 | }
152 |
153 | .bottom .values .value {
154 | border-bottom: 1rpx solid #efefef;
155 | height: 104rpx;
156 | display: flex;
157 | align-items: center;
158 | padding: 0 30rpx;
159 | }
160 |
161 | .bottom .values .value:last-child {
162 | border-bottom: none;
163 | }
164 |
165 | .hover {
166 | background: #f4f6f9;
167 | }
168 |
169 | .empty {
170 | margin-top: 100rpx;
171 | font-size: 30rpx;
172 | text-align: center;
173 | color: #666;
174 | }
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | const formatTime = date => {
2 | const year = date.getFullYear()
3 | const month = date.getMonth() + 1
4 | const day = date.getDate()
5 | const hour = date.getHours()
6 | const minute = date.getMinutes()
7 | const second = date.getSeconds()
8 |
9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
10 | }
11 |
12 | const formatNumber = n => {
13 | n = n.toString()
14 | return n[1] ? n : '0' + n
15 | }
16 |
17 | const isEmptyObject = (obj) => {
18 | for (let i in obj) {
19 | return false
20 | }
21 | return true
22 | }
23 | const formatDate = (nDate, date) => {
24 | if (isNaN(nDate.getTime())) {
25 | // 不是时间格式
26 | return '--'
27 | }
28 | let o = {
29 | 'M+': nDate.getMonth() + 1,
30 | 'd+': nDate.getDate(),
31 | 'h+': nDate.getHours(),
32 | 'm+': nDate.getMinutes(),
33 | 's+': nDate.getSeconds(),
34 | // 季度
35 | 'q+': Math.floor((nDate.getMonth() + 3) / 3),
36 | 'S': nDate.getMilliseconds()
37 | }
38 | if (/(y+)/.test(date)) {
39 | date = date.replace(RegExp.$1, (nDate.getFullYear() + '').substr(4 - RegExp.$1.length))
40 | }
41 | for (let k in o) {
42 | if (new RegExp('(' + k + ')').test(date)) {
43 | date = date.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
44 | }
45 | }
46 | return date
47 | }
48 |
49 | // 比较版本号:left > right 1, left < right -1, left == right 0
50 | // 用途:旧版本不执行写入、删除 日历操作
51 | const cmpVersion = (left, right) => {
52 | if (typeof left + typeof right !== 'stringstring') {
53 | return false
54 | }
55 | let a = left.split('.')
56 | let b = right.split('.')
57 | let i = 0
58 | let len = Math.max(a.length, b.length)
59 | for (; i < len; i++) {
60 | if ((a[i] && !b[i] && parseInt(a[i]) > 0) || (parseInt(a[i]) > parseInt(b[i]))) {
61 | return 1
62 | } else if ((b[i] && !a[i] && parseInt(b[i]) > 0) || (parseInt(a[i]) < parseInt(b[i]))) {
63 | return -1
64 | }
65 | }
66 | return 0
67 | }
68 |
69 | const getQueryParams = (url) => {
70 | console.log("url", url)
71 | const sUrl = url.split('?');
72 | // 取最后一位,兼容全链接有?和纯参数无?
73 | const sParams = sUrl[sUrl.length - 1];
74 | const arr = sParams.split('&'); // ['a=1', 'b=2']
75 | const result = {};
76 | arr.forEach((item) => {
77 | const keyVal = item.split('=');
78 | // key值
79 | const key = keyVal.shift();
80 | // value值,兼容参数没encode时有=,例如'a=b=1' => [a, b, 1] => key: a,value: b=1
81 | const value = decodeURIComponent(keyVal.join('='));
82 | result[key] = value;
83 | })
84 | return result;
85 | }
86 |
87 | const getDayName = (d) => {
88 | var td = new Date();
89 | td = new Date(td.getFullYear(), td.getMonth(), td.getDate());
90 | var od = new Date(d);
91 | od = new Date(od.getFullYear(), od.getMonth(), od.getDate());
92 | var xc = (od - td) / 1000 / 60 / 60 / 24;
93 | if (xc < -2) {
94 | return -xc + "天前";
95 | } else if (xc < -1) {
96 | return "前天";
97 | } else if (xc < 0) {
98 | return "昨天";
99 | } else if (xc == 0) {
100 | return "今天";
101 | } else if (xc < 2) {
102 | return "明天";
103 | } else if (xc < 3) {
104 | return "后天";
105 | } else {
106 | return xc + "天后";
107 | }
108 | }
109 | module.exports = {
110 | formatTime,
111 | formatDate,
112 | isEmptyObject,
113 | cmpVersion,
114 | getQueryParams,
115 | getDayName
116 | }
117 |
--------------------------------------------------------------------------------
/pages/mortgage/detail/detail.js:
--------------------------------------------------------------------------------
1 | // pages/mortgage/detail/detail.js
2 | var CFHL = require("../../../utils/calculatorForHouseLoan.js");
3 | var sliderWidth = 96; // 需要设置slider的宽度,用于计算中间位置
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 | tabs: ["等额本息", "等额本金", "本息/本金"],
11 | activeIndex: 0,
12 | sliderOffset: 0,
13 | sliderLeft: 0,
14 |
15 | hiddenDetail: true,
16 |
17 | parentActiveIndex: 0,
18 | commercialTotal: 0,
19 | gjjTotal: 0,
20 | interestRatePerMou0: 0,
21 | interestRatePerMou1: 0,
22 | totalMouths: 0,
23 |
24 | loanTotal: 0, //贷款总额
25 | totalInterestAi: 0, //等额本息总还款利息
26 | totalRepayAi: 0, //总还本带息
27 | repayPerMouAi: 0, //等额本息月均还本带息
28 | totalInterestAp: 0, //等额本金总还款利息
29 | totalRepayPriceAp: 0, //等额本金总还款金额
30 | //等额本金第一个月还款
31 | repayPerMouthAp: 0,
32 | //之后每个月递减额
33 | decreasePerMouAp: 0,
34 | //等额本息详情
35 | repayPerMouObjAi: {},
36 | //等额本金详情
37 | repayPerMouObjAp: {}
38 |
39 | },
40 | showDetail: function() {
41 | this.data.hiddenDetail = !this.data.hiddenDetail;
42 | this.setData({
43 | hiddenDetail: this.data.hiddenDetail
44 | });
45 | },
46 | /**
47 | * 生命周期函数--监听页面加载
48 | */
49 | onLoad: function (e) {
50 | wx.showLoading({
51 | title: "数据加载中...",
52 | mask: true
53 | })
54 |
55 | var detail;
56 | if (e.parentActiveIndex == 0) {
57 | detail = CFHL.calculate(+e.commercialTotal, +e.interestRatePerMou0 / 12, +e.totalMouths);
58 | } else if (e.parentActiveIndex == 1) {
59 | detail = CFHL.calculate(+e.gjjTotal, +e.interestRatePerMou1 / 12, +e.totalMouths);
60 | } else {
61 | var tmp = CFHL.calculate(+e.commercialTotal, +e.interestRatePerMou0 / 12, +e.totalMouths);
62 | detail = CFHL.calculate(+e.gjjTotal, +e.interestRatePerMou1 / 12, +e.totalMouths);
63 | for(let key in detail) {
64 | if (detail.hasOwnProperty(key)) {
65 | if (typeof detail[key] === "string") {
66 | detail[key] = (+detail[key] + +tmp[key]).toFixed(2);
67 | }
68 | else {
69 | for(let arr in detail[key]) {
70 | if (detail[key].hasOwnProperty(arr)) {
71 | for (let i = 0; i < detail[key][arr].length; i++) {
72 | detail[key][arr][i] = (+detail[key][arr][i] + +tmp[key][arr][i]).toFixed(2);
73 | }
74 | }
75 | }
76 | }
77 | }
78 | }
79 | }
80 | console.log(detail);
81 | this.setData({ ...e, ...detail }, () => { wx.hideLoading() });
82 | var that = this;
83 | wx.getSystemInfo({
84 | success: function (res) {
85 | that.setData({
86 | sliderLeft: (res.windowWidth / that.data.tabs.length - sliderWidth) / 2,
87 | sliderOffset: res.windowWidth / that.data.tabs.length * that.data.activeIndex
88 | });
89 | }
90 | });
91 | },
92 | tabClick: function (e) {
93 | this.setData({
94 | sliderOffset: e.currentTarget.offsetLeft,
95 | activeIndex: e.currentTarget.id
96 | });
97 | },
98 |
99 | /**
100 | * 生命周期函数--监听页面初次渲染完成
101 | */
102 | onReady: function () {
103 |
104 | },
105 |
106 | /**
107 | * 生命周期函数--监听页面显示
108 | */
109 | onShow: function () {
110 |
111 | },
112 |
113 | /**
114 | * 生命周期函数--监听页面隐藏
115 | */
116 | onHide: function () {
117 |
118 | },
119 |
120 | /**
121 | * 生命周期函数--监听页面卸载
122 | */
123 | onUnload: function () {
124 |
125 | },
126 |
127 | /**
128 | * 页面相关事件处理函数--监听用户下拉动作
129 | */
130 | onPullDownRefresh: function () {
131 |
132 | },
133 |
134 | /**
135 | * 页面上拉触底事件的处理函数
136 | */
137 | onReachBottom: function () {
138 |
139 | },
140 |
141 | /**
142 | * 用户点击右上角分享
143 | */
144 | /*onShareAppMessage: function () {
145 | return {
146 | title: '房贷计算',
147 | path: '/pages/mortgage/mortgage',
148 | success: function (res) {
149 | // 转发成功
150 | },
151 | fail: function (res) {
152 | // 转发失败
153 | }
154 | }
155 | }*/
156 | })
--------------------------------------------------------------------------------
/style/widget/weui-loading/weui-loading.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | .weui-loading{margin:0 5px;width:20px;height:20px;display:inline-block;vertical-align:middle;-webkit-animation:a 1s steps(12) infinite;animation:a 1s steps(12) infinite;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat;background-size:100%}.weui-loading.weui-loading_transparent{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect xmlns='http://www.w3.org/2000/svg' width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.56)' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.5)' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.43)' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.38)' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.32)' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.28)' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.25)' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.2)' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.17)' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.14)' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.1)' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.03)' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E")}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}
--------------------------------------------------------------------------------
/service/request.js:
--------------------------------------------------------------------------------
1 | import { httpUrl, errCodeArr, errMsgMap, freeUrl, geoapiUrl } from '../utils/constant'
2 | // 这几个方法主要是从本次取出后台返回的token、判断变量是否是Object、返回网络情况,代码就不展示了
3 | // import { getToken } from '../utils/storage'
4 | import { privateKey, freeKeyList } from '../utils/private-key'
5 | import { isObject } from '../utils/type'
6 | import { getNetworkType } from '../utils/system'
7 |
8 | export default function request(options, finishCb) {
9 | let isFree = true //是否使用免费开发api
10 |
11 |
12 | return new Promise(async (resolve, reject) => {
13 | const networkRes = await getNetworkType()
14 | if (networkRes.networkType === 'none') {
15 | wx.showToast({
16 | title: '无网络!',
17 | icon: 'none'
18 | })
19 | reject(networkRes)
20 | return
21 | }
22 |
23 | // const token = getToken()
24 | // if (!token) {
25 | // wx.showToast({
26 | // title: '暂未登录',
27 | // icon: 'none'
28 | // })
29 | // return
30 | // }
31 |
32 | let {
33 | apiType,
34 | url,
35 | method = 'GET',
36 | title = '加载中...', // loading文字
37 | failText = '请求数据失败', // 请求失败描述
38 | errTip = 'toast', // 错误提示,是Toast还说Modal
39 | data = {},
40 | header = {},
41 | isHideErrorTip = false,
42 | mask = false, // 是否开启mask
43 | loading = false, // 是否loading
44 | timeout = 8000, // 超时时间
45 | hideLoadingTime = 500, // 多少毫秒隐藏loading
46 | isVip = false
47 | } = options
48 | if (isVip) {
49 | isFree = false
50 | }
51 | const tHeader = {
52 | // 'cookie': token,
53 | ...header
54 | }
55 | if (apiType) {
56 | data = {
57 | ...data,
58 | key: isFree ? freeKeyList[Math.floor(Math.random() * freeKeyList.length + 0)] : privateKey
59 | }
60 | }
61 | if (apiType === 'qweather') {
62 | url = (isFree ? freeUrl : httpUrl) + url
63 | } else if (apiType === 'geo') {
64 | url = geoapiUrl + url
65 | }
66 |
67 | loading && wx.showLoading({ title, mask })
68 | wx.request({
69 | url,
70 | method,
71 | timeout,
72 | data,
73 | header: tHeader,
74 | success(res) {
75 | wx.hideLoading()
76 | if (!isObject(res.data)) {
77 | wx.showToast({
78 | title: '服务端异常',
79 | icon: 'error'
80 | })
81 | return
82 | }
83 | // 针对错误码进行处理
84 | const { data = {} } = res
85 | const statusCode = Number(data.code)
86 |
87 | if (errCodeArr.includes(statusCode)) {
88 | if (!isHideErrorTip) {
89 | wx.showToast({
90 | title: data.msg || errMsgMap[statusCode] || '',
91 | icon: 'error'
92 | })
93 | }
94 |
95 | return Promise.reject(res)
96 | }
97 |
98 |
99 |
100 | resolve(data)
101 | },
102 | fail(err) {
103 | console.log("err", err)
104 | wx.showToast({
105 | title: failText || '',
106 | icon: 'error',
107 | duration: 250000,
108 | })
109 |
110 | reject(err)
111 | },
112 | complete() {
113 | const timer = setTimeout(() => {
114 | wx.hideLoading()
115 | clearTimeout(timer)
116 | }, hideLoadingTime)
117 | options.finishCb && options.finishCb()
118 | }
119 | })
120 | })
121 | }
122 |
123 |
--------------------------------------------------------------------------------
/pages/wuxian-yijin/wxyj.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 参保城市
6 |
7 |
8 |
9 | {{cities[cityIndex]}}
10 |
11 |
12 |
13 |
14 | 参保类型
15 | {{types[cityIndex]}}
16 |
17 |
18 |
19 | 社保基数
20 |
21 |
22 |
23 |
24 | 区间:{{datas[cityIndex].shebao.min}}~{{datas[cityIndex].shebao.max}}
25 |
26 |
27 |
28 | 公积金基数
29 |
30 |
31 |
32 |
33 | 区间:{{datas[cityIndex].gjj.min}}~{{datas[cityIndex].gjj.max}}
34 |
35 |
36 |
37 |
38 |
39 | 类型
40 |
41 |
42 | 个人
43 |
44 |
45 | 公司
46 |
47 |
48 | 合计
49 |
50 |
51 |
52 |
53 |
54 | {{item.name}}
55 |
56 |
57 | {{item.person===''? '': item.person + ' / '}}{{item.personTip}}
58 |
59 |
60 | {{item.company===''? '': item.company + ' / '}}{{item.companyTip}}
61 |
62 |
63 | {{item.total}}
64 |
65 |
66 |
67 |
68 |
69 | 合计
70 |
71 |
72 | {{personTotal}}
73 |
74 |
75 | {{companyTotal}}
76 |
77 |
78 | {{total}}
79 |
80 |
81 |
82 |
83 | 结果仅供参考,不保障绝对准确。
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | 社保公积金解释
93 |
94 | 社保真正隐含的承诺是:只要你入我圈子,给你最底的生活保障,最底的生活费。 注意:社会基本养老保险是一门保险而不是理财。保险的作用是对抗风险,例如今天猪肉 15 一斤今天给你发 1500 块能给你购买 100 斤猪肉, 哪怕不久猪肉涨到 15000 一斤,政府就给你发 1500000 元,你依然能够买 100 斤猪肉吃,这样的投资回报率秒杀一切商业保险。
95 |
96 |
97 | 公积金最好的用法,就是不要过度关注。
98 |
99 |
100 | 社保、公积金(五险一金)应该按照职工的实际收入缴纳,职工工资低于当地平均工资的 60% ,按照平均工资的 60% 缴纳, 高于当地平均工资的 300% ,按照平均工资的 300% 缴纳,在两者之间的按照实际工资缴纳。很多企业为了减少支出,一般会按当地最低或压低基数缴纳。 个人缴纳(满足“社保连续”或者当地缴纳社保的各种福利政策),一般直接按照最低基数缴纳。
101 |
102 |
103 |
--------------------------------------------------------------------------------
/pages/weather/weather.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
25 |
26 | {{weatherData.warning.length}}条预警信息
27 |
28 |
29 |
30 |
31 | {{weatherData.temp || '-'}}
32 | ℃
33 |
34 |
35 | {{weatherData.text || '--'}}
36 |
37 |
38 | {{weatherData.aqi +weatherData.category}}
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | 体感温度
47 |
48 |
49 |
50 | {{weatherData.feelsLike}}℃
51 |
52 |
53 | 降水量
54 | {{weatherData.precip}}mm
55 |
56 |
57 | 相对湿度
58 | {{weatherData.humidity}}%
59 |
60 |
61 | {{weatherData.windDir}}
62 | {{weatherData.windScale}}级
63 |
64 |
65 | 能见度
66 | {{weatherData.vis}}km
67 |
68 |
69 |
70 | {{isRainfall? weatherData.rainfall:'查看未来两小时降雨预报>'}}
71 |
72 | {{weatherData.comfText}}
73 |
74 |
75 |
76 |
77 |
78 | 30日天气预报
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 | {{item.title}}
87 | {{item.text}}
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/pages/mortgage/mortgage.js:
--------------------------------------------------------------------------------
1 | var sliderWidth = 96; // 需要设置slider的宽度,用于计算中间位置
2 |
3 | Page({
4 | data: {
5 | commercialTotal: 1000000,
6 | gjjTotal: 500000,
7 | tabs: ["公积金贷款", "商业贷款", "组合贷款"],
8 | activeIndex: 0,
9 | loansType: ['按房价总额', '按贷款总额'],
10 | loanIndex: 0,
11 | ratesName: [
12 | ['基准利率(3.25%)', '基准利率7折(2.27%)', '基准利率75折(2.44%)', '基准利率8折(2.60%)',
13 | '基准利率85折(2.76%)', '基准利率9折(2.93%)', '基准利率95折(3.09%)', '基准利率1.05倍(3.41%)',
14 | '基准利率1.1倍(3.58%)', '基准利率1.2倍(3.90%)', '基准利率1.3倍(4.23%)', '其他利率(可输入)'],
15 | ['基准利率(4.9%)', '基准利率7折(3.43%)', '基准利率75折(3.68%)', '基准利率8折(3.92%)',
16 | '基准利率85折(4.17%)', '基准利率9折(4.41%)', '基准利率95折(4.66%)', '基准利率1.05倍(5.15%)',
17 | '基准利率1.1倍(5.39%)', '基准利率1.2倍(5.88%)', '基准利率1.3倍(6.37%)', '其他利率(可输入)']
18 | ],
19 | rates: [
20 | [0.0325, 0.0227, 0.0244, 0.026, 0.0276, 0.0293, 0.0309, 0.0341, 0.0358, 0.039, 0.0423],
21 | [0.049, 0.034, 0.0368, 0.0392, 0.0417, 0.0441, 0.0466, 0.0515, 0.0539, 0.0588, 0.0637]
22 | ],
23 | rateIndex0: 0,
24 | rateIndex1: 0,
25 | percentArr: [7, 6, 5, 4, 3, 2],
26 | percentIndex: 0,
27 | years: [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19.18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
28 | yearIndex: 0,
29 | sliderOffset: 0,
30 | sliderLeft: 0,
31 | MDI_commercial_loan: null,//手动输入商贷
32 | MDI_provident_fund_loan: null,//手动输入商贷: null,//手动输入公积金贷
33 | },
34 | onLoad: function () {
35 | var that = this;
36 | wx.getSystemInfo({
37 | success: function (res) {
38 | that.setData({
39 | sliderLeft: (res.windowWidth / that.data.tabs.length - sliderWidth) / 2,
40 | sliderOffset: res.windowWidth / that.data.tabs.length * that.data.activeIndex
41 | });
42 | }
43 | });
44 | },
45 | loanChange(e) {
46 | this.setData({
47 | loanIndex: e.detail.value
48 | });
49 | },
50 | rateChange0(e) {
51 | this.setData({
52 | MDI_commercial_loan: null,
53 | rateIndex0: e.detail.value
54 | });
55 | },
56 | rateChange1(e) {
57 | this.setData({
58 | MDI_provident_fund_loan: null,
59 | rateIndex1: e.detail.value
60 | });
61 | },
62 | percentChange(e) {
63 | this.setData({
64 | percentIndex: e.detail.value
65 | });
66 | },
67 | yearChange(e) {
68 | this.setData({
69 | yearIndex: e.detail.value
70 | });
71 | },
72 | commercialTotalChange(e) {
73 | this.setData({
74 | commercialTotal: e.detail.value
75 | });
76 | },
77 | gjjTotalChange(e) {
78 | this.setData({
79 | gjjTotal: e.detail.value
80 | });
81 | },
82 | rateChangeCommercial(e) {
83 | this.setData({
84 | MDI_commercial_loan: e.detail.value
85 | });
86 | },
87 | rateChangeProvident(e) {
88 | this.setData({
89 | MDI_provident_fund_loan: e.detail.value
90 | });
91 | },
92 | showDetail() {
93 | var commercialTotal;
94 | var gjjTotal;
95 | var interestRatePerMou0;
96 | var interestRatePerMou1;
97 | var totalMouths;
98 | commercialTotal = this.data.loanIndex == 1 || this.data.activeIndex == 2 ? this.data.commercialTotal : this.data.commercialTotal * this.data.percentArr[this.data.percentIndex] / 10;
99 | gjjTotal = this.data.loanIndex == 1 || this.data.activeIndex == 2 ? this.data.gjjTotal : this.data.gjjTotal * this.data.percentArr[this.data.percentIndex] / 10;
100 | interestRatePerMou0 = this.data.rates[0][this.data.rateIndex0];
101 | interestRatePerMou1 = this.data.rates[1][this.data.rateIndex1];
102 | totalMouths = this.data.years[this.data.yearIndex] * 12;
103 | console.log("interestRatePerMou0", interestRatePerMou0, interestRatePerMou1);
104 | if (this.data.MDI_commercial_loan) {
105 | interestRatePerMou0 = this.data.MDI_commercial_loan
106 | }
107 | if (this.data.MDI_provident_fund_loan) {
108 | interestRatePerMou1 = this.data.MDI_provident_fund_loan
109 | }
110 | wx.navigateTo({
111 | url: './detail/detail?parentActiveIndex=' + this.data.activeIndex + '&commercialTotal=' + commercialTotal + '&gjjTotal=' + gjjTotal + '&interestRatePerMou0=' + interestRatePerMou0 + '&interestRatePerMou1=' + interestRatePerMou1 + '&totalMouths=' + totalMouths
112 | })
113 | },
114 | tabClick: function (e) {
115 | this.setData({
116 | sliderOffset: e.currentTarget.offsetLeft,
117 | activeIndex: e.currentTarget.id
118 | });
119 | },
120 | /**
121 | * 用户点击右上角分享
122 | */
123 | onShareAppMessage: function () {
124 | return {
125 | title: '买房月供一算遍知',
126 | path: '/pages/mortgage/mortgage',
127 |
128 | }
129 | }
130 | });
--------------------------------------------------------------------------------
/pages/weather/components/hourly24/hourly24.js:
--------------------------------------------------------------------------------
1 | import { formatDate, getDayName } from '../../../../utils/util'
2 | import request from '../../../../service/request'
3 | import * as echarts from '../../../components/ec-canvas/echarts' // 或者从本地引入自定义构建的 echarts
4 | function initChart(canvas, width, height, dpr) {
5 | console.log(canvas, width, height, dpr)
6 |
7 | const chart = echarts.init(canvas, null, {
8 | width: width,
9 | height: height,
10 | devicePixelRatio: dpr // 像素
11 | });
12 | canvas.setChart(chart);
13 |
14 | var option = {
15 | xAxis: {
16 | type: 'category',
17 | data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
18 | },
19 | yAxis: {
20 | type: 'value'
21 | },
22 | series: [{
23 | data: [820, 932, 901, 934, 1290, 1330, 1320, 820, 932, 901, 934, 1290, 1330, 1320, 820, 932, 901, 934, 1290, 1330, 1320],
24 | type: 'line'
25 | }]
26 |
27 |
28 | };
29 | chart.setOption(option);
30 | return chart;
31 | }
32 |
33 |
34 | Component({
35 | properties: {
36 | location: {
37 | type: String,
38 | value: '',
39 | observer(val) {
40 | if (val) {
41 | let nowTimeHourly24 = +new Date()
42 | this.getHourly(nowTimeHourly24)
43 | }
44 | }
45 | }
46 | },
47 | lifetimes: {
48 | ready() {
49 | let cacheData = wx.getStorageSync('cache-data') ? JSON.parse(wx.getStorageSync('cache-data')) : null;
50 | let nowTimeHourly24 = +new Date()
51 | if (cacheData && cacheData.hourly24Datas) {
52 | if (nowTimeHourly24 - cacheData.nowTimeHourly24 < 5 * 60 * 1000) {
53 | let startRainTimeFormat = ''
54 | cacheData.hourly24Datas.map((item, index) => {
55 | if (item.text.indexOf('雨') > -1 && !startRainTimeFormat) {
56 | startRainTimeFormat = getDayName(item.fxTime) + formatDate(new Date(item.fxTime), "hh:mm")
57 | }
58 |
59 | cacheData.hourly24Datas[index] = {
60 | fxTimeFormat: formatDate(new Date(item.fxTime), 'hh:mm'),
61 | text: item.text,
62 | temp: item.temp,
63 | windDir: item.windDir,
64 | windScale: item.windScale
65 | }
66 | })
67 | this.setData({
68 | startRainTime: startRainTimeFormat,
69 | hourly24Datas: cacheData.hourly24Datas
70 | })
71 | } else {
72 | console.log('ready1.2')
73 | this.getHourly(nowTimeHourly24)
74 | }
75 | } else {
76 | console.log('ready3')
77 | this.getHourly(nowTimeHourly24)
78 | }
79 | },
80 |
81 | },
82 | data: {
83 | hourly24Datas: [],
84 | startRainTime: '',
85 | ec: {
86 | onInit: initChart
87 | }
88 | },
89 |
90 | methods: {
91 | async getHourly(nowTimeHourly24, hour = 24) {
92 | let hourly24DatasRes = await request({
93 | apiType: 'qweather',
94 | url: `/v7/weather/${hour}h`,
95 | data: {
96 | location: this.data.location,
97 | },
98 | })
99 | let startRainTimeFormat = ''
100 | hourly24DatasRes.hourly.map(item => {
101 | if (item.text.indexOf('雨') > -1 && !startRainTimeFormat) {
102 | startRainTimeFormat = getDayName(item.fxTime) + formatDate(new Date(item.fxTime), "hh:mm")
103 | }
104 | item.fxTimeFormat = formatDate(new Date(item.fxTime), 'hh:mm')
105 | })
106 | this.setData({
107 | startRainTime: startRainTimeFormat,
108 | hourly24Datas: hourly24DatasRes.hourly || []
109 | })
110 | let cacheData = wx.getStorageSync('cache-data') ? JSON.parse(wx.getStorageSync('cache-data')) : null;
111 | cacheData.nowTimeHourly24 = nowTimeHourly24 || +new Date()
112 | cacheData.hourly24Datas = hourly24DatasRes.hourly || []
113 | wx.setStorageSync("cache-data", JSON.stringify(cacheData))
114 |
115 | },
116 | },
117 |
118 |
119 | })
120 |
--------------------------------------------------------------------------------
/pages/weather/city/city.js:
--------------------------------------------------------------------------------
1 | import request from '../../../service/request'
2 | function uniqueFunc(arr, uniId) {
3 | const res = new Map();
4 | let ans = []
5 | for (let i = 0; i < arr.length; i++) {
6 | let item = arr[i]
7 | console.log(item.name, res.has(item[uniId]))
8 | ans.push(item)
9 | if (!res.has(item[uniId])) {
10 | res.set(item[uniId], i)
11 | } else {
12 | ans.splice(res.get(item[uniId]), 1)
13 | }
14 | }
15 | console.log('ans', ans)
16 | if (ans.length > 4) {
17 | ans = [...ans.slice(1, 5)]
18 | }
19 |
20 | return ans
21 | }
22 |
23 |
24 | Page({
25 | data: {
26 | alternative: null,
27 | showItems: null,
28 | inputText: '',
29 | hotCities: [],
30 | hisCities: [],
31 | popularCities: [{
32 | name: '北京',
33 | lat: "39.90499",
34 | lon: "116.40529",
35 | }, {
36 | name: '上海',
37 | lat: "31.23171",
38 | lon: "121.47264",
39 | },
40 | {
41 | name: '广州',
42 | lat: "23.12518",
43 | lon: "113.28064",
44 | },
45 | {
46 | name: '深圳',
47 | lat: "22.54700",
48 | lon: "114.08595",
49 | },
50 | {
51 | name: '杭州',
52 | lat: "30.24603",
53 | lon: "120.21079",
54 | },
55 | {
56 | name: '南京',
57 | lat: "32.04155",
58 | lon: "118.76741",
59 | },
60 |
61 | {
62 | name: '天津',
63 | lat: "39.12560",
64 | lon: "117.19019",
65 | },
66 | {
67 | name: '武汉',
68 | lat: "30.58435",
69 | lon: "114.29857",
70 | },
71 | {
72 | name: '西安',
73 | lat: "34.34321",
74 | lon: "108.93965",
75 | },
76 | {
77 | name: '苏州',
78 | lat: "31.29938",
79 | lon: "120.61958",
80 | },
81 | {
82 | name: '郑州',
83 | lat: "34.75798",
84 | lon: "113.66541",
85 | },
86 | {
87 | name: '重庆',
88 | lat: "29.56376",
89 | lon: "106.55046",
90 | }]
91 | },
92 |
93 |
94 | cancel() {
95 | this.setData({
96 | inputText: '',
97 | showItems: this.data.cities,
98 | })
99 | },
100 | inputFilter(e) {
101 | let cities = this.data.cities
102 | let value = e.detail.value.replace(/\s+/g, '')
103 | console.log("value", value)
104 | if (value.length) {
105 | this.lookup(value)
106 | } else {
107 | this.setData({
108 | showItems: cities,
109 | })
110 | }
111 |
112 | },
113 |
114 | async lookup(value) {
115 | let res = await request({
116 | apiType: 'geo',
117 | url: '/v2/city/lookup',
118 | isHideErrorTip: true,
119 | data: {
120 | location: value,
121 | },
122 | })
123 | console.log("res", res.location)
124 | if (value.length && res.code === '200') {
125 | this.setData({
126 | showItems: res.location,
127 | })
128 | } else {
129 | this.setData({
130 | showItems: cities,
131 | })
132 | }
133 |
134 | },
135 | choose(e) {
136 | console.log('e-choose', e)
137 | const { lon, lat, name } = e.currentTarget.dataset
138 |
139 | let location = `${Number(lon)},${Number(lat)}`
140 | let pages = getCurrentPages()
141 | let len = pages.length
142 | let weatherPage = pages[len - 2]
143 |
144 | if (lon && lat) {
145 | let hisCities = wx.getStorageSync('city-data') ? wx.getStorageSync('city-data') : []
146 |
147 | hisCities.push({
148 | name,
149 | lat,
150 | lon,
151 | })
152 |
153 | hisCities = uniqueFunc(hisCities, 'name')
154 | console.log("hisCities2", hisCities)
155 | if (hisCities.length > 5) {
156 | this.setData({
157 | hisCities: hisCities.reverse()
158 | }, () => {
159 | wx.setStorageSync('city-data', hisCities.reverse())
160 | weatherPage.search(location, () => {
161 | wx.navigateBack({})
162 | })
163 | })
164 | } else {
165 | this.setData({
166 | hisCities: hisCities.reverse()
167 | }, () => {
168 | wx.setStorageSync('city-data', hisCities.reverse())
169 | weatherPage.search(location, () => {
170 | wx.navigateBack({})
171 | })
172 | })
173 | }
174 |
175 |
176 | } else {
177 |
178 | weatherPage.initLocation(() => {
179 | wx.navigateBack({})
180 | })
181 | }
182 | },
183 |
184 | async getHotCities() {
185 | let res = await request({
186 | apiType: 'geo',
187 | url: '/v2/city/top',
188 | })
189 | let hcList = []
190 | res.topCityList.map(item => {
191 | console.log(item.name, JSON.stringify(this.data.popularCities).indexOf(item.name))
192 | if (JSON.stringify(this.data.popularCities).indexOf(item.name) === -1) {
193 | hcList.push(item)
194 | }
195 | })
196 | console.log("hcList", hcList)
197 | if (res.code === '200') {
198 | this.setData({
199 | hotCities: hcList
200 | })
201 |
202 | }
203 | },
204 | onLoad() {
205 | this.getHotCities()
206 | console.log("hisCities1", wx.getStorageSync('city-data') ? wx.getStorageSync('city-data') : [])
207 |
208 | let cities = []
209 | this.setData({
210 | cities,
211 | showItems: cities,
212 | hisCities: wx.getStorageSync('city-data') ? wx.getStorageSync('city-data').reverse() : []
213 | })
214 | },
215 | })
--------------------------------------------------------------------------------
/pages/setting/setting.js:
--------------------------------------------------------------------------------
1 |
2 | import { cmpVersion } from '../../utils/util'
3 | const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
4 | Page({
5 | data: {
6 | setting: {},
7 | show: false,
8 | screenBrightness: '获取中',
9 | keepscreenon: false,
10 | SDKVersion: '',
11 | enableUpdate: true,
12 | weatherPage: {},
13 | avatarUrl: defaultAvatarUrl
14 | },
15 | onChooseAvatar(e) {
16 | const { avatarUrl } = e.detail
17 | this.setData({
18 | avatarUrl,
19 | })
20 | },
21 | switchChange(e) {
22 | let dataset = e.currentTarget.dataset
23 | let switchparam = dataset.switchparam
24 | let setting = this.data.setting
25 | if (switchparam === 'forceUpdate') {
26 | if (this.data.enableUpdate) {
27 | setting[switchparam] = (e.detail || {}).value
28 | } else {
29 | setting[switchparam] = false
30 | wx.showToast({
31 | title: '基础库版本较低,无法使用该功能',
32 | icon: 'none',
33 | duration: 2000,
34 | })
35 | }
36 | } else if (switchparam === 'keepscreenon') {
37 | this.setKeepScreenOn(!this.data.keepscreenon)
38 | getApp().globalData.keepscreenon = !this.data.keepscreenon
39 | } else {
40 | setting[switchparam] = !(e.detail || {}).value
41 | }
42 | this.setData({
43 | setting,
44 | })
45 | console.log("this.data.",this.data)
46 | wx.setStorage({
47 | key: 'setting',
48 | data: setting,
49 | success: () => {
50 | this.data.weatherPage.reloadInitSetting()
51 | },
52 | })
53 | },
54 | hide() {
55 | this.setData({
56 | show: false,
57 | })
58 | },
59 | updateInstruc() {
60 | this.setData({
61 | show: true,
62 | })
63 | },
64 | onShow() {
65 | let pages = getCurrentPages()
66 | let len = pages.length
67 | console.log("pages",pages,pages.length)
68 | let weatherPage = pages[len - 2]
69 | // 不能初始化到 data 里面!!!!
70 | this.setData({
71 | keepscreenon: getApp().globalData.keepscreenon,
72 | weatherPage,
73 | })
74 | this.ifDisableUpdate()
75 | this.getScreenBrightness()
76 | wx.getStorage({
77 | key: 'setting',
78 | success: (res) => {
79 | let setting = res.data
80 | this.setData({
81 | setting,
82 | })
83 | },
84 | fail: (res) => {
85 | this.setData({
86 | setting: {},
87 | })
88 | },
89 | })
90 | },
91 | ifDisableUpdate() {
92 | let systeminfo = getApp().globalData.systeminfo
93 | let SDKVersion = systeminfo.SDKVersion
94 | let version = cmpVersion(SDKVersion, '1.9.90')
95 | if (version >= 0) {
96 | this.setData({
97 | SDKVersion,
98 | enableUpdate: true,
99 | })
100 | } else {
101 | this.setData({
102 | SDKVersion,
103 | enableUpdate: false,
104 | })
105 | }
106 | },
107 |
108 | getScreenBrightness() {
109 | wx.getScreenBrightness({
110 | success: (res) => {
111 | this.setData({
112 | screenBrightness: Number(res.value * 100).toFixed(0),
113 | })
114 | },
115 | fail: (res) => {
116 | this.setData({
117 | screenBrightness: '获取失败',
118 | })
119 | },
120 | })
121 | },
122 | screenBrightnessChanging(e) {
123 | this.setScreenBrightness(e.detail.value)
124 | },
125 | setScreenBrightness(val) {
126 | wx.setScreenBrightness({
127 | value: val / 100,
128 | success: (res) => {
129 | this.setData({
130 | screenBrightness: val,
131 | })
132 | },
133 | })
134 | },
135 | setKeepScreenOn(b) {
136 | wx.setKeepScreenOn({
137 | keepScreenOn: b,
138 | success: () => {
139 | this.setData({
140 | keepscreenon: b,
141 | })
142 | },
143 | })
144 | },
145 |
146 | removeStorage(e) {
147 | let that = this
148 | let datatype = e.currentTarget.dataset.type
149 | if (datatype === 'setting') {
150 | wx.showModal({
151 | title: '提示',
152 | content: '确认要初始化设置',
153 | cancelText: '容朕想想',
154 | confirmColor: '#40a7e7',
155 | success: (res) => {
156 | if (res.confirm) {
157 | wx.removeStorage({
158 | key: 'setting',
159 | success: function (res) {
160 | wx.showToast({
161 | title: '设置已初始化',
162 | })
163 | that.setData({
164 | setting: {},
165 | })
166 | that.data.weatherPage.reloadInitSetting()
167 | },
168 | })
169 | }
170 | },
171 | })
172 | } else if (datatype === 'all') {
173 | wx.showModal({
174 | title: '提示',
175 | content: '确认要删除',
176 | cancelText: '容朕想想',
177 | confirmColor: '#40a7e7',
178 | success(res) {
179 | if (res.confirm) {
180 | wx.clearStorage({
181 | success: (res) => {
182 | wx.showToast({
183 | title: '数据已清除',
184 | })
185 | that.setData({
186 | setting: {},
187 | pos: {},
188 | })
189 | that.data.weatherPage.reloadInitSetting()
190 | },
191 | })
192 | }
193 | },
194 | })
195 | }
196 | },
197 | goToAbout() {
198 | wx.navigateTo({
199 | url: '/pages/setting/about/about'
200 | })
201 | },
202 | goToFinance() {
203 | wx.navigateTo({
204 | url: '/pages/finance/finance'
205 | })
206 | },
207 | goToMortgage() {
208 | wx.navigateTo({
209 | url: '/pages/mortgage/mortgage'
210 | })
211 | },
212 | goToWxyj() {
213 | wx.navigateTo({
214 | url: '/pages/wuxian-yijin/wxyj'
215 | })
216 | }
217 |
218 | })
--------------------------------------------------------------------------------
/pages/setting/setting.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 | 更多功能
13 |
14 |
15 |
16 | 房贷计算
17 |
18 |
19 |
20 |
21 |
22 | 五险一金
23 |
24 |
25 |
26 |
27 |
28 | 金融公式
29 |
30 |
31 |
32 |
33 |
34 | 关于我们
35 |
36 |
37 |
38 |
39 |
50 |
51 |
71 |
72 |
73 |
74 | 小工具
75 |
76 |
77 | 屏幕亮度
78 |
79 |
80 | 当前屏幕亮度
81 | 范围0~100,0 最暗,100 最亮
82 |
83 | {{screenBrightness}}
84 |
85 |
86 |
87 | 设置屏幕亮度
88 |
89 |
90 |
91 |
92 |
93 |
94 | 保持常亮
95 | 仅在当前小程序、当次生效,离开小程序后设置失效
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | 清除数据
105 |
106 |
107 |
108 |
109 | 恢复初始化设置
110 |
111 |
112 | 所有设置信息都将被清除
113 |
114 |
115 |
116 |
117 |
118 |
119 | 清除所有本地数据
120 |
121 |
122 | 所有本地数据都将被清除
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 | 兼容性
136 | 由于小程序基础库从 1.9.90 开始支持 wx.getUpdateManager API,故基础库低于该版本的会忽略该设置。
137 | 启动机制
138 |
139 | 小程序启动会有两种情况,一种是「冷启动」,一种是「热启动」。 假如用户已经打开过某小程序,然后在一定时间内再次打开该小程序,此时无需重新启动,只需将后台的小程序切换到前台,这个过程就是热启动;冷启动指的是用户首次打开或小程序被微信主动销毁后再次打开的情况,此时小程序需要重新加载启动。
140 |
141 | 更新机制
142 |
143 | 小程序冷启动时如果发现有新版本,将会异步下载新版本的代码包,并同时用客户端本地的包进行启动,即新版本的小程序需要等下一次冷启动才会应用上。
144 |
145 | 运行机制
146 |
147 | 1、小程序没有重启的概念;
148 | 2、当小程序进入后台,客户端会维持一段时间的运行状态,超过一定时间后(目前是5分钟)会被微信主动销毁;
149 | 3、当短时间内(5s)连续收到两次以上系统内存告警,会进行小程序的销毁。
150 |
151 |
152 |
153 |
154 |
--------------------------------------------------------------------------------
/utils/calculatorForHouseLoan.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /**
4 | * 等额本金、等额本息还款方式详细对比
5 | * 带有Ai后缀为等额本息还款方式,即average interest
6 | * 带有Ap后缀为等额本金还款方式,即average principal
7 | */
8 |
9 | // 格式化金额,保留两位小数
10 | const formatFloat = function (input, decimals) {
11 | let formatFloatNumb = Math.round(input * Math.pow(10, decimals)) / Math.pow(10, decimals);
12 | return formatFloatNumb.toFixed(decimals);
13 | };
14 |
15 | // 涉及计算公式
16 | const loanFormula = {
17 | // 等额本息每月还款金额
18 | getRepayPerMouPriceAi: function (loanTotal, interestRatePerMou, totalMouths) {
19 | /**
20 | * @param loanTotal 总贷款
21 | * @param interestRatePerMou 月利率
22 | * @param totalMouths 总月数
23 | * 每月还款金额 = [总贷款 × 月利率 × (1 + 月利率)^总月数] ÷ [(1 + 月利率)^总月数 - 1]
24 | */
25 |
26 | // 简化公式,创建变量x
27 | let x = Math.pow((1 + interestRatePerMou), totalMouths);
28 |
29 | return (loanTotal * interestRatePerMou * x / (x - 1));
30 | },
31 |
32 | // 等额本息第i个月还款中利息部分
33 | getRepayInterestPerMouAi: function (i, loanTotal, interestRatePerMou, totalMouths) {
34 | /**
35 | * @param i 第(i + 1)个月
36 | * 第i个月还款中利息部分 = 总贷款 × 月利率 × {(1 + 月利率)^i - (1 + 月利率)^总月数 * [(1 + 月利率)^i - 1] ÷ [(1 + 月利率)^总月数 - 1]}
37 | */
38 |
39 | // 简化公式,创建变量x、y
40 | let [x, y] = [Math.pow((1 + interestRatePerMou), i), Math.pow((1 + interestRatePerMou), totalMouths)];
41 |
42 | return (loanTotal * interestRatePerMou * (x - y * (x - 1) / (y - 1)));
43 | }
44 | };
45 |
46 | const calculate = function (loanTotal, interestRatePerMou, totalMouths) {
47 |
48 | // 每月需还利息、本金、剩余待还本金、已还总金额
49 | let repayPerMouObj = {
50 | // 等额本息
51 | repayPerMouObjAi: {
52 | repayInterestPerMouArrAi: [],
53 | repayPrincipalPerMouArrAi: [],
54 | balanceArrAi: [],
55 | totalRepaidArrAi: [],
56 | totalRepayPerMouArrAi: []
57 | },
58 |
59 | // 等额本金
60 | repayPerMouObjAp: {
61 | repayInterestPerMouArrAp: [],
62 | repayPerMouPriceArrAp: [],
63 | balanceArrAp: [],
64 | totalRepaidArrAp: [],
65 | totalRepayPerMouArrAp: []
66 | }
67 | };
68 |
69 | // 等额本息月均还本带息
70 | let repayPerMouAi = loanFormula.getRepayPerMouPriceAi(loanTotal, interestRatePerMou, totalMouths);
71 |
72 | // 等额本息初始化剩余待还本金
73 | let balancePerMouAi = loanTotal;
74 |
75 | // 等额本息初始化已还总金额
76 | let totalRepaidPerMouAi = 0;
77 |
78 | // 等额本金每月还款本金
79 | let repayPrincipalPerMouAp = loanTotal / totalMouths;
80 |
81 | // 等额本金每月还款递减金额
82 | let decreasePerMouAp = repayPrincipalPerMouAp * interestRatePerMou;
83 |
84 | // 等额本金初始化剩余待还本金
85 | let balancePerMouAp = loanTotal;
86 |
87 | // 等额本金初始化已还总金额
88 | let totalRepaidPerMouAp = 0;
89 |
90 | const getRepayPerMouObj = function () {
91 | for (let i = 0; i < totalMouths; i++) {
92 | // 等额本息第(i+1)个月需还利息
93 | let repayInterestPerMouAi = loanFormula.getRepayInterestPerMouAi(i, loanTotal, interestRatePerMou, totalMouths);
94 |
95 | // 等额本息第(i+1)个月需还本金:月均还本带息 - 利息部分
96 | let repayPrincipalPerMouAi = repayPerMouAi - repayInterestPerMouAi;
97 |
98 | // 等额本息第(i+1)个月待还本金:第i个月剩余待还本金 - 第(i + 1)个月所还本金,即上月剩余待还本金 - 当月已还本金
99 | balancePerMouAi = balancePerMouAi - repayPrincipalPerMouAi;
100 |
101 | // 等额本息第(i+1)个月已还总金额
102 | totalRepaidPerMouAi = totalRepaidPerMouAi + repayPerMouAi;
103 |
104 | // 等额本金第(i+1)个月若提前还款实际支付
105 | let totalRepayPerMouAi = balancePerMouAi + totalRepaidPerMouAi;
106 |
107 | // 拼接等额本息数组,包括各月份需还利息、本金及剩余待还本金
108 | repayPerMouObj.repayPerMouObjAi.repayInterestPerMouArrAi.push(formatFloat(repayInterestPerMouAi, 2));
109 | repayPerMouObj.repayPerMouObjAi.repayPrincipalPerMouArrAi.push(formatFloat(repayPrincipalPerMouAi, 2));
110 | repayPerMouObj.repayPerMouObjAi.balanceArrAi.push(formatFloat(balancePerMouAi, 2));
111 | repayPerMouObj.repayPerMouObjAi.totalRepaidArrAi.push(formatFloat(totalRepaidPerMouAi, 2));
112 | repayPerMouObj.repayPerMouObjAi.totalRepayPerMouArrAi.push(formatFloat(totalRepayPerMouAi, 2));
113 |
114 | // 等额本金第(i+1)个月需还利息
115 | let repayInterestPerMouAp = loanTotal * interestRatePerMou * (1 - (i - 1) / totalMouths);
116 |
117 | // 等额本金第(i+1)个月还本带息
118 | let repayPerMouPriceAp = repayPrincipalPerMouAp + repayInterestPerMouAp;
119 |
120 | // 等额本金第(i+1)个月剩余待还本金
121 | balancePerMouAp = balancePerMouAp - repayPrincipalPerMouAp;
122 |
123 | // 等额本金第(i+1)个月总还本带息
124 | totalRepaidPerMouAp = totalRepaidPerMouAp + repayPerMouPriceAp;
125 |
126 | // 等额本金第(i+1)个月若提前还款实际支付
127 | let totalRepayPerMouAp = balancePerMouAp + totalRepaidPerMouAp;
128 |
129 | // 拼接等额本金数组,包括各月份需还利息、本金及剩余待还本金
130 | repayPerMouObj.repayPerMouObjAp.repayInterestPerMouArrAp.push(formatFloat(repayInterestPerMouAp, 2));
131 | repayPerMouObj.repayPerMouObjAp.repayPerMouPriceArrAp.push(formatFloat(repayPerMouPriceAp, 2));
132 | repayPerMouObj.repayPerMouObjAp.balanceArrAp.push(formatFloat(balancePerMouAp, 2));
133 | repayPerMouObj.repayPerMouObjAp.totalRepaidArrAp.push(formatFloat(totalRepaidPerMouAp, 2));
134 | repayPerMouObj.repayPerMouObjAp.totalRepayPerMouArrAp.push(formatFloat(totalRepayPerMouAp, 2));
135 | }
136 | return repayPerMouObj;
137 | };
138 | getRepayPerMouObj();
139 |
140 | // 等额本息总还本带息: 月均还本带息 × 总月数
141 | let totalRepayAi = repayPerMouAi * totalMouths;
142 |
143 | // 等额本息总还款利息: 总还本带息 - 总贷款额
144 | let totalInterestAi = totalRepayAi - loanTotal;
145 |
146 | // 等额本金总还款金额(直接从等额本金数组中获取)
147 | const totalRepayPriceAp = repayPerMouObj.repayPerMouObjAp.totalRepaidArrAp[repayPerMouObj.repayPerMouObjAp.totalRepaidArrAp.length - 1];
148 |
149 | // 等额本金总还款利息: 总还本带息 - 总贷款额
150 | const totalInterestAp = totalRepayPriceAp - loanTotal;
151 |
152 | return {
153 | loanTotal: formatFloat(loanTotal, 2), //贷款总额
154 | totalInterestAi: formatFloat(totalInterestAi, 2), //等额本息总还款利息
155 | totalRepayAi: formatFloat(totalRepayAi, 2), //总还本带息
156 | repayPerMouAi: formatFloat(repayPerMouAi, 2), //等额本息月均还本带息
157 | totalInterestAp: formatFloat(totalInterestAp, 2), //等额本金总还款利息
158 | totalRepayPriceAp: formatFloat(totalRepayPriceAp, 2), //等额本金总还款金额
159 | //等额本金每月所还本金
160 | repayPrincipalPerMouAp: formatFloat(repayPrincipalPerMouAp, 2),
161 | //等额本金第一个月还款
162 | repayPerMouthAp: formatFloat(repayPerMouObj.repayPerMouObjAp.repayPerMouPriceArrAp[0], 2),
163 | //之后每个月递减额
164 | decreasePerMouAp: formatFloat(decreasePerMouAp, 2),
165 | //等额本息详情
166 | repayPerMouObjAi: repayPerMouObj.repayPerMouObjAi,
167 | //等额本金详情
168 | repayPerMouObjAp: repayPerMouObj.repayPerMouObjAp
169 | }
170 |
171 | };
172 |
173 | module.exports = {
174 | calculate: calculate
175 | };
176 |
--------------------------------------------------------------------------------
/pages/mortgage/mortgage.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{item}}
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | 公积金贷款(元):
19 |
20 |
21 |
22 |
23 | 元
24 |
25 |
26 |
27 | 商业贷款(元):
28 |
29 |
30 |
31 |
32 | 元
33 |
34 |
35 |
36 |
37 | 公积金利率:
38 |
39 |
40 |
41 |
42 | {{MDI_provident_fund_loan?MDI_provident_fund_loan+'%':ratesName[0][rateIndex0]}}
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | %
54 |
55 |
56 |
57 |
58 |
59 | 商贷利率:
60 |
61 |
62 |
63 |
64 | {{MDI_commercial_loan?MDI_commercial_loan+'%':ratesName[1][rateIndex1]}}
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | %
76 |
77 |
78 |
79 |
80 | 贷款年限:
81 |
82 |
83 |
84 | {{years[yearIndex]}}年
85 |
86 |
87 |
88 |
89 |
90 | 计算方式:
91 |
92 |
93 |
94 | {{loansType[loanIndex]}}
95 |
96 |
97 |
98 |
99 |
100 | 贷款比例:
101 |
102 |
103 |
104 | {{percentArr[percentIndex]}}成
105 |
106 |
107 |
108 |
109 |
110 |
113 |
114 |
115 |
116 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/pages/components/ec-canvas/ec-canvas.js:
--------------------------------------------------------------------------------
1 | import WxCanvas from './wx-canvas';
2 | import * as echarts from './echarts';
3 |
4 | let ctx;
5 |
6 | function compareVersion(v1, v2) {
7 | v1 = v1.split('.')
8 | v2 = v2.split('.')
9 | const len = Math.max(v1.length, v2.length)
10 |
11 | while (v1.length < len) {
12 | v1.push('0')
13 | }
14 | while (v2.length < len) {
15 | v2.push('0')
16 | }
17 |
18 | for (let i = 0; i < len; i++) {
19 | const num1 = parseInt(v1[i])
20 | const num2 = parseInt(v2[i])
21 |
22 | if (num1 > num2) {
23 | return 1
24 | } else if (num1 < num2) {
25 | return -1
26 | }
27 | }
28 | return 0
29 | }
30 |
31 | Component({
32 | properties: {
33 | canvasId: {
34 | type: String,
35 | value: 'ec-canvas'
36 | },
37 |
38 | ec: {
39 | type: Object
40 | },
41 |
42 | forceUseOldCanvas: {
43 | type: Boolean,
44 | value: false
45 | }
46 | },
47 |
48 | data: {
49 | isUseNewCanvas: false
50 | },
51 |
52 | ready: function () {
53 | // Disable prograssive because drawImage doesn't support DOM as parameter
54 | // See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
55 | echarts.registerPreprocessor(option => {
56 | if (option && option.series) {
57 | if (option.series.length > 0) {
58 | option.series.forEach(series => {
59 | series.progressive = 0;
60 | });
61 | }
62 | else if (typeof option.series === 'object') {
63 | option.series.progressive = 0;
64 | }
65 | }
66 | });
67 |
68 | if (!this.data.ec) {
69 | console.warn('组件需绑定 ec 变量,例:');
71 | return;
72 | }
73 |
74 | if (!this.data.ec.lazyLoad) {
75 | this.init();
76 | }
77 | },
78 |
79 | methods: {
80 | init: function (callback) {
81 | const version = wx.getSystemInfoSync().SDKVersion
82 |
83 | const canUseNewCanvas = compareVersion(version, '2.9.0') >= 0;
84 | const forceUseOldCanvas = this.data.forceUseOldCanvas;
85 | const isUseNewCanvas = canUseNewCanvas && !forceUseOldCanvas;
86 | this.setData({ isUseNewCanvas });
87 |
88 | if (forceUseOldCanvas && canUseNewCanvas) {
89 | console.warn('开发者强制使用旧canvas,建议关闭');
90 | }
91 |
92 | if (isUseNewCanvas) {
93 | // console.log('微信基础库版本大于2.9.0,开始使用');
94 | // 2.9.0 可以使用
95 | this.initByNewWay(callback);
96 | } else {
97 | const isValid = compareVersion(version, '1.9.91') >= 0
98 | if (!isValid) {
99 | console.error('微信基础库版本过低,需大于等于 1.9.91。'
100 | + '参见:https://github.com/ecomfe/echarts-for-weixin'
101 | + '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82');
102 | return;
103 | } else {
104 | console.warn('建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能');
105 | this.initByOldWay(callback);
106 | }
107 | }
108 | },
109 |
110 | initByOldWay(callback) {
111 | // 1.9.91 <= version < 2.9.0:原来的方式初始化
112 | ctx = wx.createCanvasContext(this.data.canvasId, this);
113 | const canvas = new WxCanvas(ctx, this.data.canvasId, false);
114 |
115 | echarts.setCanvasCreator(() => {
116 | return canvas;
117 | });
118 | // const canvasDpr = wx.getSystemInfoSync().pixelRatio // 微信旧的canvas不能传入dpr
119 | const canvasDpr = 1
120 | var query = wx.createSelectorQuery().in(this);
121 | query.select('.ec-canvas').boundingClientRect(res => {
122 | if (typeof callback === 'function') {
123 | this.chart = callback(canvas, res.width, res.height, canvasDpr);
124 | }
125 | else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
126 | this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr);
127 | }
128 | else {
129 | this.triggerEvent('init', {
130 | canvas: canvas,
131 | width: res.width,
132 | height: res.height,
133 | canvasDpr: canvasDpr // 增加了dpr,可方便外面echarts.init
134 | });
135 | }
136 | }).exec();
137 | },
138 |
139 | initByNewWay(callback) {
140 | // version >= 2.9.0:使用新的方式初始化
141 | const query = wx.createSelectorQuery().in(this)
142 | query
143 | .select('.ec-canvas')
144 | .fields({ node: true, size: true })
145 | .exec(res => {
146 | const canvasNode = res[0].node
147 | this.canvasNode = canvasNode
148 |
149 | const canvasDpr = wx.getSystemInfoSync().pixelRatio
150 | const canvasWidth = res[0].width
151 | const canvasHeight = res[0].height
152 |
153 | const ctx = canvasNode.getContext('2d')
154 |
155 | const canvas = new WxCanvas(ctx, this.data.canvasId, true, canvasNode)
156 | echarts.setCanvasCreator(() => {
157 | return canvas
158 | })
159 |
160 | if (typeof callback === 'function') {
161 | this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr)
162 | } else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
163 | this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr)
164 | } else {
165 | this.triggerEvent('init', {
166 | canvas: canvas,
167 | width: canvasWidth,
168 | height: canvasHeight,
169 | dpr: canvasDpr
170 | })
171 | }
172 | })
173 | },
174 | canvasToTempFilePath(opt) {
175 | if (this.data.isUseNewCanvas) {
176 | // 新版
177 | const query = wx.createSelectorQuery().in(this)
178 | query
179 | .select('.ec-canvas')
180 | .fields({ node: true, size: true })
181 | .exec(res => {
182 | const canvasNode = res[0].node
183 | opt.canvas = canvasNode
184 | wx.canvasToTempFilePath(opt)
185 | })
186 | } else {
187 | // 旧的
188 | if (!opt.canvasId) {
189 | opt.canvasId = this.data.canvasId;
190 | }
191 | ctx.draw(true, () => {
192 | wx.canvasToTempFilePath(opt, this);
193 | });
194 | }
195 | },
196 |
197 | touchStart(e) {
198 | if (this.chart && e.touches.length > 0) {
199 | var touch = e.touches[0];
200 | var handler = this.chart.getZr().handler;
201 | handler.dispatch('mousedown', {
202 | zrX: touch.x,
203 | zrY: touch.y,
204 | preventDefault: () => {},
205 | stopImmediatePropagation: () => {},
206 | stopPropagation: () => {}
207 | });
208 | handler.dispatch('mousemove', {
209 | zrX: touch.x,
210 | zrY: touch.y,
211 | preventDefault: () => {},
212 | stopImmediatePropagation: () => {},
213 | stopPropagation: () => {}
214 | });
215 | handler.processGesture(wrapTouch(e), 'start');
216 | }
217 | },
218 |
219 | touchMove(e) {
220 | if (this.chart && e.touches.length > 0) {
221 | var touch = e.touches[0];
222 | var handler = this.chart.getZr().handler;
223 | handler.dispatch('mousemove', {
224 | zrX: touch.x,
225 | zrY: touch.y,
226 | preventDefault: () => {},
227 | stopImmediatePropagation: () => {},
228 | stopPropagation: () => {}
229 | });
230 | handler.processGesture(wrapTouch(e), 'change');
231 | }
232 | },
233 |
234 | touchEnd(e) {
235 | if (this.chart) {
236 | const touch = e.changedTouches ? e.changedTouches[0] : {};
237 | var handler = this.chart.getZr().handler;
238 | handler.dispatch('mouseup', {
239 | zrX: touch.x,
240 | zrY: touch.y,
241 | preventDefault: () => {},
242 | stopImmediatePropagation: () => {},
243 | stopPropagation: () => {}
244 | });
245 | handler.dispatch('click', {
246 | zrX: touch.x,
247 | zrY: touch.y,
248 | preventDefault: () => {},
249 | stopImmediatePropagation: () => {},
250 | stopPropagation: () => {}
251 | });
252 | handler.processGesture(wrapTouch(e), 'end');
253 | }
254 | }
255 | }
256 | });
257 |
258 | function wrapTouch(event) {
259 | for (let i = 0; i < event.touches.length; ++i) {
260 | const touch = event.touches[i];
261 | touch.offsetX = touch.x;
262 | touch.offsetY = touch.y;
263 | }
264 | return event;
265 | }
266 |
--------------------------------------------------------------------------------
/pages/weather/weather.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | -webkit-font-smoothing: antialiased;
3 | font-family: "PingHei", "Helvetica Neue", "Helvetica", "Arial", "Verdana", "sans-serif";
4 | }
5 |
6 | .num {
7 | font-weight: 300;
8 | }
9 |
10 | .weather-bg {
11 | position: fixed;
12 | width: 100%;
13 | top: 0;
14 | }
15 |
16 | .container {
17 | display: flex;
18 | flex-direction: column;
19 | min-height: 100vh;
20 | font-size: 30rpx;
21 | }
22 |
23 | .weather-page-header {
24 | /* background: #f3f5fa; */
25 | height: 90rpx;
26 | /* color: rgba(0, 0, -1, .5); */
27 | display: flex;
28 | }
29 |
30 | .search {
31 | position: fixed;
32 | z-index: 4;
33 | top: 0;
34 | left: 0;
35 | right: 0;
36 | width: 100%;
37 | height: 90rpx;
38 | }
39 |
40 | .search .wrapper {
41 | display: flex;
42 | flex-direction: row;
43 | justify-content: flex-start;
44 | align-items: center;
45 | font-size: 28rpx;
46 | height: 60rpx;
47 | margin: 15rpx 50rpx;
48 | padding: 0 15rpx;
49 | box-sizing: border-box;
50 | border: none;
51 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.5);
52 | }
53 |
54 | .search image {
55 | width: 28rpx;
56 | height: 28rpx;
57 | margin-right: 16rpx;
58 | opacity: .5;
59 | }
60 |
61 | .search input {
62 | flex: 1;
63 | }
64 |
65 | .placeholderClass {
66 | color: rgba(0, 0, 0, 0.5);
67 | }
68 |
69 | .container .header {
70 | background-image: linear-gradient(225deg, #DBEBFF, #DDE5F4 55%, #BECDDD);
71 | }
72 |
73 | .city .name {
74 | display: flex;
75 | }
76 |
77 | .city .name .val {
78 | color: #000;
79 | font-size: 36rpx;
80 | max-width: 5em;
81 | display: -webkit-box;
82 | -webkit-box-orient: vertical;
83 | -webkit-line-clamp: 1;
84 | overflow: hidden;
85 | }
86 |
87 | .weather-city-sun {
88 | background-image: linear-gradient(225deg, #fee5ca, #e9f0ff 55%, #dce3fb);
89 | }
90 |
91 | .weather-city-cloudy {
92 | background-image: linear-gradient(225deg, #D0DAE8, #CCD4DF 55%, #A5B3C5);
93 | }
94 |
95 | .weather-city-rain {
96 | background-image: linear-gradient(225deg, #DBEBFF, #DDE5F4 55%, #BECDDD);
97 | }
98 |
99 | .weather-city-snow {
100 | background-image: linear-gradient(225deg, #D2F0FD, #E6F8FE 55%, #D6EDED);
101 | }
102 |
103 | .weather-city-haze {
104 | background-image: linear-gradient(225deg, #b29c82, #ded9d7 64.29%, #d9d7dc);
105 | }
106 |
107 | .weather-city-image {
108 | width: 100%;
109 | position: absolute;
110 | top: 0;
111 | z-index: -1;
112 | }
113 |
114 | .current-details {
115 | background-color: rgba(0, 0, 0, 0.03);
116 | display: flex;
117 | align-items: center;
118 | flex-wrap: wrap;
119 | margin-bottom: 20rpx;
120 | font-size: 24rpx;
121 | }
122 |
123 | .temp {
124 | height: 100rpx;
125 | font-size: 72rpx;
126 | }
127 |
128 | .temp .unit {
129 | font-size: 36rpx;
130 | position: relative;
131 | top: -6px;
132 | }
133 |
134 | .today {
135 | padding: 10rpx 0 10rpx;
136 | }
137 |
138 | .today-tip {
139 | display: flex;
140 | justify-content: flex-end;
141 | margin: 10rpx;
142 | }
143 |
144 | .today .subscribe-button {
145 | padding: 0 15px;
146 | height: 44rpx;
147 | line-height: 44rpx;
148 | border-radius: 10rpx;
149 | background: #427BFF;
150 | color: #fff;
151 | font-size: 24rpx;
152 | text-align: center;
153 | display: inline-block;
154 | margin-right: 30rpx;
155 | margin-top: 20rpx;
156 | }
157 |
158 | .rainfall-handle {
159 | background-color: rgba(0, 0, 0, 0.1);
160 | text-align: center;
161 | font-size: 28rpx;
162 | color: rgba(0, 0, 0, 0.5);
163 | height: 50rpx;
164 | margin: 0 50rpx;
165 | }
166 |
167 | .today-header {
168 | display: flex;
169 | justify-content: space-between;
170 |
171 | margin: 10rpx 40rpx;
172 | height: 40rpx;
173 | line-height: 40rpx;
174 | }
175 |
176 |
177 |
178 | .today-header .time {
179 | color: rgba(0, 0, 0, 0.5);
180 | font-size: 24rpx;
181 | display: flex;
182 | align-items: center;
183 | }
184 |
185 | .icon-refresh {
186 | width: 24rpx;
187 | height: 24rpx;
188 | opacity: .5;
189 | margin-left: 8rpx;
190 | }
191 |
192 | .comfort-text {
193 | font-size: 24rpx;
194 | text-align: center;
195 | margin: 0 50rpx;
196 | color: rgba(0, 0, 0, 0.5);
197 | }
198 |
199 |
200 |
201 |
202 |
203 | .daily-30-text {
204 | color: #666;
205 | font-size: 28rpx;
206 | text-align: center;
207 | padding: 20rpx 0;
208 | border-top: 1px solid #999999;
209 | border-bottom: 1px solid #999999;
210 | display: flex;
211 | align-items: center;
212 | justify-content: center;
213 | }
214 |
215 | .daily-30-text .more {
216 | width: 28rpx;
217 | height: 28rpx;
218 | margin-left: 5rpx;
219 | }
220 |
221 | .footer {
222 | color: #888888;
223 | display: flex;
224 | justify-content: space-around;
225 | align-items: center;
226 | font-size: 24rpx;
227 | margin: 0 40rpx;
228 | }
229 |
230 |
231 |
232 |
233 | .toast .mask {
234 | position: fixed;
235 | z-index: 9;
236 | top: 0;
237 | right: 0;
238 | bottom: 0;
239 | left: 0;
240 | margin: auto;
241 | background: rgba(0, 0, 0, .5);
242 | }
243 |
244 | .toast .wrapper {
245 | position: fixed;
246 | z-index: 10;
247 | top: 0;
248 | right: 0;
249 | bottom: 0;
250 | left: 0;
251 | margin: auto;
252 | background: #fff;
253 | font-size: 24rpx;
254 | color: #333;
255 | width: 60%;
256 | height: 400rpx;
257 | overflow: scroll;
258 | border-radius: 14rpx;
259 | padding: 46rpx 28rpx;
260 | }
261 |
262 | .toast .box {
263 | height: 400rpx;
264 | overflow: scroll;
265 | }
266 |
267 | .t {
268 | overflow: hidden;
269 | padding: 0 40rpx;
270 | background: #fff;
271 | margin-bottom: 20rpx;
272 | }
273 |
274 | .toast .t {
275 | font-size: 28rpx;
276 | color: #40a7e7;
277 | margin: 20rpx 0;
278 | padding: 0;
279 | }
280 |
281 | .toast .content {
282 | line-height: 1.8em;
283 | text-align: justify;
284 | }
285 |
286 | .toast .content text {
287 | display: block;
288 | margin-bottom: 10rpx;
289 | }
290 |
291 | .today-weather-air {
292 | display: flex;
293 | margin: auto;
294 | width: 500rpx;
295 | justify-content: center;
296 | }
297 |
298 | .today-weather-air .line {
299 | width: 1rpx;
300 | background: #999999;
301 | margin: 0 15rpx;
302 | }
303 |
304 | .icon-question {
305 | width: 24rpx;
306 | height: 24rpx;
307 | }
308 |
309 | .air-now {
310 | white-space: nowrap;
311 | border-radius: 20rpx;
312 | padding: 0 20rpx;
313 |
314 | }
315 |
316 | .air-tag--1 {
317 | color: white;
318 | background-color: #95B359;
319 | }
320 |
321 | .air-tag--2 {
322 | color: white;
323 | background-color: #A9A538;
324 | }
325 |
326 | .air-tag--3 {
327 | color: white;
328 | background-color: #E0991D;
329 | }
330 |
331 | .air-tag--4 {
332 | color: white;
333 | background-color: #D96161;
334 | }
335 |
336 | .air-tag--5 {
337 | color: white;
338 | background-color: #A257D0;
339 | }
340 |
341 | .air-tag--6 {
342 | color: white;
343 | background-color: #D94371;
344 | }
345 |
346 | .weather-today-image {
347 | width: 80rpx;
348 | height: 80rpx;
349 | }
350 |
351 | .share-button {
352 | width: 200rpx;
353 | height: 40rpx;
354 | font-size: 24rpx;
355 | line-height: 40rpx;
356 | }
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 | .container .content {
365 | flex: 2;
366 | transition: .3s ease;
367 | }
368 |
369 | .content {
370 | position: relative;
371 | z-index: 2;
372 | }
373 |
374 |
375 |
376 | .info .temp,
377 | .info .pm,
378 | .info .pm view,
379 | .info .weather {
380 | position: relative;
381 | width: auto;
382 | display: flex;
383 | flex-direction: row;
384 | justify-content: center;
385 | align-items: center;
386 | }
387 |
388 |
389 | .info .pm text {
390 | font-size: 24rpx;
391 | height: 1em;
392 | line-height: 1em;
393 | padding: 10rpx 20rpx;
394 | border-radius: 20rpx;
395 | background: rgba(240, 240, 240, .2);
396 | }
397 |
398 |
399 |
400 | .city .name .icon,
401 | .city .name .down {
402 | width: 30rpx;
403 | height: 30rpx;
404 | }
405 |
406 | .city .name .icon {
407 | margin-right: 20rpx;
408 | }
409 |
410 | .city .name .down {
411 | margin-left: 20rpx;
412 | }
413 |
414 | .city .time {
415 | display: block;
416 | text-align: right;
417 | font-size: 24rpx;
418 | }
419 |
420 | .message {
421 | font-size: 22rpx;
422 | color: #fff;
423 | padding: 30rpx 50rpx 0;
424 | box-sizing: border-box;
425 | }
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 | .hour .weather {
434 | display: flex;
435 | justify-content: center;
436 | align-items: center;
437 | }
438 |
439 |
440 | .hour .weather image {
441 | width: 40rpx;
442 | margin-left: 4rpx;
443 | }
444 |
445 | .hourly {
446 | margin-bottom: 20rpx;
447 | }
448 |
449 | .hourly .hours {
450 | padding: 20rpx 10rpx 0;
451 | background: rgba(0, 0, 0, .6);
452 | }
453 |
454 | .hourly .hours .time {
455 | font-size: 22rpx;
456 | height: 60rpx;
457 | line-height: 60rpx;
458 | text-align: center;
459 | }
460 |
461 |
462 |
463 | .hour {
464 | display: flex;
465 | align-items: center;
466 | flex-wrap: wrap;
467 | background: rgb(107, 102, 102);
468 | font-size: 24rpx;
469 | box-sizing: border-box;
470 | border-radius: 8rpx;
471 | }
472 |
473 | .hourly swiper-item {
474 | box-sizing: border-box;
475 | padding: 0 10rpx;
476 | background: rgba(0, 0, 0, 0);
477 | }
478 |
479 | .details .detail,
480 | .hour .detail {
481 | display: flex;
482 | flex-direction: column;
483 | justify-content: space-around;
484 | align-items: center;
485 | padding: 10rpx 0;
486 | height: 100rpx;
487 | width: 20%;
488 | border-right: 1rpx solid rgba(250, 250, 250, 0.2);
489 | border-bottom: 1rpx solid rgba(250, 250, 250, 0.2);
490 | box-sizing: border-box;
491 | }
492 |
493 | .details .detail:nth-child(4n),
494 | .hour .detail:nth-child(4n) {
495 | border-right: none;
496 | }
497 |
498 | .details .detail:nth-child(n+9),
499 | .hour .detail:nth-child(n+9) {
500 | border-bottom: none;
501 | }
--------------------------------------------------------------------------------
/pages/mortgage/detail/detail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{item}}
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | 贷款总额
17 | ¥{{loanTotal}}
18 |
19 |
20 |
21 | 还款总额
22 | {{totalRepayAi}}
23 |
24 |
25 | 总利息
26 | {{totalInterestAi}}
27 |
28 |
29 | 月供
30 | {{repayPerMouAi}}
31 |
32 |
33 |
34 | {{hiddenDetail? "明细": "收起"}}
35 |
36 |
37 |
38 |
39 |
40 | 期数
41 |
42 |
43 | 月供
44 |
45 |
46 | 本金
47 |
48 |
49 | 利息
50 |
51 |
52 | 待还本金
53 |
54 |
55 |
56 |
57 |
58 | {{index+1}}
59 |
60 |
61 | {{repayPerMouAi}}
62 |
63 |
64 | {{repayPerMouObjAi.repayPrincipalPerMouArrAi[index]}}
65 |
66 |
67 | {{repayPerMouObjAi.repayInterestPerMouArrAi[index]}}
68 |
69 |
70 | {{repayPerMouObjAi.balanceArrAi[index]}}
71 |
72 |
73 |
74 |
75 |
76 | 结果仅供参考,不保障绝对准确。
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | 贷款总额
85 | ¥{{loanTotal}}
86 |
87 |
88 |
89 | 还款总额
90 | {{totalRepayPriceAp}}
91 |
92 |
93 | 总利息
94 | {{totalInterestAp}}
95 |
96 |
97 | 月供
98 | 首期还 {{repayPerMouthAp}} 元,之后每月递减 {{decreasePerMouAp}} 元
99 |
100 |
101 |
102 | {{hiddenDetail? "明细": "收起"}}
103 |
104 |
105 |
106 |
107 |
108 | 期数
109 |
110 |
111 | 月供
112 |
113 |
114 | 本金
115 |
116 |
117 | 利息
118 |
119 |
120 | 待还本金
121 |
122 |
123 |
124 |
125 |
126 | {{index+1}}
127 |
128 |
129 | {{repayPerMouObjAp.repayPerMouPriceArrAp[index]}}
130 |
131 |
132 | {{repayPrincipalPerMouAp}}
133 |
134 |
135 | {{repayPerMouObjAp.repayInterestPerMouArrAp[index]}}
136 |
137 |
138 | {{repayPerMouObjAp.balanceArrAp[index]}}
139 |
140 |
141 |
142 |
143 |
144 | 结果仅供参考,不保障绝对准确。
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 | 贷款总额
153 | ¥{{loanTotal}}
154 |
155 |
156 |
157 | 还款总额
158 | {{totalRepayAi+" / "+totalRepayPriceAp}}
159 |
160 |
161 | 总利息
162 | {{totalInterestAi+" / "+totalInterestAp}}
163 |
164 |
165 | 月供
166 | {{repayPerMouAi}} / 首期还 {{repayPerMouthAp}} 元,之后每期递减 {{decreasePerMouAp}} 元
167 |
168 |
169 |
170 | {{hiddenDetail? "明细": "收起"}}
171 |
172 |
173 |
174 |
175 |
176 | 期数
177 |
178 |
179 | 已还本息
180 |
181 |
182 | 待还本金
183 |
184 |
185 | 提前还款实付
186 |
187 |
188 |
189 |
190 |
191 | {{index+1}}
192 |
193 |
194 | {{repayPerMouObjAi.totalRepaidArrAi[index] + " / " + repayPerMouObjAp.totalRepaidArrAp[index]}}
195 |
196 |
197 | {{repayPerMouObjAi.balanceArrAi[index] + " / " + repayPerMouObjAp.balanceArrAp[index]}}
198 |
199 |
200 | {{repayPerMouObjAi.totalRepayPerMouArrAi[index] + " / " + repayPerMouObjAp.totalRepayPerMouArrAp[index]}}
201 |
202 |
203 |
204 |
205 |
206 | 结果仅供参考,不保障绝对准确。
207 |
208 |
209 |
210 |
211 | 选项三的内容
212 |
213 |
214 |
215 |
--------------------------------------------------------------------------------
/pages/weather/weather.js:
--------------------------------------------------------------------------------
1 | import { formatDate, cmpVersion } from '../../utils/util'
2 | import request from '../../service/request'
3 | let globalData = getApp().globalData
4 |
5 | Page({
6 | data: {
7 | globalLoading: true,
8 | isIPhoneX: globalData.isIPhoneX,
9 | location: '',
10 | weatherIconUrl: globalData.weatherIconUrl,
11 | comfText: '',
12 | rainfall: '',
13 | isRainfall: true,
14 | warning: null,
15 | warningShow: false,
16 | // 是否切换了城市
17 | located: true,
18 | // 用来清空 input
19 | searchText: '',
20 |
21 | setting: {},
22 |
23 | locationName: '',
24 | nowData: {},
25 | isUseCache: false,
26 | weatherData: null
27 | },
28 |
29 | onLoad() {
30 | this.initPage()
31 | },
32 | initPage(location) {
33 | if (!location) {
34 | this.initLocation()
35 | } else {
36 |
37 | }
38 | },
39 | initLocation(callback) {
40 | this.setData({
41 | located: true,
42 | })
43 | wx.getLocation({
44 | success: (res) => {
45 |
46 | let location = `${res.longitude},${res.latitude}`
47 | let cacheData = wx.getStorageSync('cache-data') ? JSON.parse(wx.getStorageSync('cache-data')) : null;
48 | let nowTime = +new Date()
49 | console.log("cacheData", cacheData)
50 | if (cacheData) {
51 |
52 | console.log("nowTime - cacheData.nowTime", nowTime - cacheData.nowTime)
53 | if (nowTime - cacheData.nowTime < 60 * 1000) {
54 | console.log("调用缓存里的数据", cacheData)
55 | this.setData({
56 | globalLoading: false,
57 | location,
58 | weatherData: cacheData
59 | })
60 | } else {
61 | cacheData.nowTime = nowTime
62 | //超过5分钟重新调用接口数据
63 | wx.setStorageSync("cache-data", JSON.stringify(cacheData))
64 | this.getWeatherRefresh(location)
65 | }
66 | } else {
67 | wx.setStorageSync("cache-data", JSON.stringify({
68 | nowTime
69 | }))
70 | this.getWeatherRefresh(location)
71 | }
72 | },
73 | fail: (res) => {
74 | this.getLocationFail(res)
75 | }
76 | })
77 | callback && callback()
78 | },
79 | reloadWeather() {
80 | if (this.data.located) {
81 | this.initLocation()
82 | } else {
83 | this.search(this.data.searchCity)
84 | this.setData({
85 | searchCity: '',
86 | })
87 | }
88 | },
89 | reloadPage() {
90 | this.reloadWeather()
91 | },
92 |
93 |
94 |
95 | search(val, callback) {
96 | wx.pageScrollTo({
97 | scrollTop: 0,
98 | duration: 300,
99 | })
100 | if (val) {
101 | this.setData({
102 | located: false,
103 | location: val,
104 | })
105 |
106 | this.getWeatherRefresh(val)
107 |
108 | }
109 | callback && callback()
110 | },
111 |
112 | getWeatherRefresh(location) {
113 | console.log("location", location)
114 |
115 | wx.setStorageSync("location", location)
116 | this.setData({ location }, async () => {
117 | Promise.all([
118 | await this.getLocationCity(),
119 | await this.getWeatherNow(),
120 | await this.indiceServer(),
121 | await this.airServer(),
122 | await this.warningServer(),
123 | await this.minutelyServer()
124 | ]).then(data => {
125 | console.log("all-data", data)
126 | let cacheData = wx.getStorageSync('cache-data') ? JSON.parse(wx.getStorageSync('cache-data')) : null;
127 | console.log("cacheData", cacheData)
128 | data.map(item => {
129 | if (item) {
130 | cacheData = {
131 | ...cacheData,
132 | ...item,
133 | }
134 | }
135 |
136 | })
137 |
138 | wx.setStorageSync("cache-data", JSON.stringify(cacheData))
139 | this.setData({
140 | globalLoading: false,
141 | weatherData: cacheData
142 | })
143 | })
144 | // if (this.data.isRainfall) {
145 | // this.minutelyServer()
146 | // }
147 | })
148 | },
149 | // wx.openSetting 要废弃,button open-type openSetting 2.0.7 后支持
150 | // 使用 wx.canIUse('openSetting') 都会返回 true,这里判断版本号区分
151 | canUseOpenSettingApi() {
152 | let systeminfo = getApp().globalData.systeminfo
153 | let SDKVersion = systeminfo.SDKVersion
154 | let version = cmpVersion(SDKVersion, '2.0.7')
155 | if (version < 0) {
156 | return true
157 | } else {
158 | return false
159 | }
160 | },
161 |
162 |
163 | getLocationFail(res) {
164 | wx.stopPullDownRefresh()
165 | let errMsg = res.errMsg || ''
166 | // 拒绝授权地理位置权限
167 | if (errMsg.indexOf('deny') !== -1 || errMsg.indexOf('denied') !== -1) {
168 | wx.showToast({
169 | title: '需要开启地理位置权限',
170 | icon: 'none',
171 | duration: 2500,
172 | success: (res) => {
173 | if (this.canUseOpenSettingApi()) {
174 | let timer = setTimeout(() => {
175 | clearTimeout(timer)
176 | wx.openSetting({})
177 | }, 2500)
178 | }
179 | },
180 | })
181 | } else {
182 | wx.showToast({
183 | title: '网络不给力,请稍后再试',
184 | icon: 'none',
185 | })
186 | }
187 | },
188 | async getLocationCity() {
189 | this.data.locationName = '定位中...'
190 | let locationName
191 | let res = await request({
192 | apiType: 'geo',
193 | url: '/v2/city/lookup',
194 | data: {
195 | location: this.data.location,
196 | },
197 | })
198 | console.log("getLocationCity", res.location[0])
199 | if (res.code === '200') {
200 | locationName = `${res.location[0].adm1 || ''} ${res.location[0].adm2 || ''}${res.location[0].name}`
201 | this.setData({
202 | locationName
203 | })
204 | }
205 | return { locationName }
206 | },
207 |
208 | async getWeatherNow() {
209 | // 实时天气:https://dev.qweather.com/docs/api/weather/weather-now/
210 | let weatherNowDataRes = await request({
211 | apiType: 'qweather',
212 | url: '/v7/weather/now',
213 | data: {
214 | location: this.data.location,
215 | }
216 | })
217 |
218 | if (weatherNowDataRes.code === '200') {
219 | let nowData = weatherNowDataRes.now
220 | nowData.obsTimeFormat = formatDate(new Date(nowData.obsTime), "yy-MM-dd hh:mm")
221 |
222 | const textList = ['晴', '雨', '雪', '云', '雾', '阴']
223 | const textEnList = ['sun', 'rain', 'snow', 'cloudy', 'haze', 'cloudy']
224 | for (let i = 0; i < textList.length; i++) {
225 | if (nowData.text.indexOf(textList[i]) > -1) {
226 | nowData.text_en = textEnList[i]
227 | }
228 | }
229 |
230 | wx.stopPullDownRefresh()
231 |
232 |
233 | return {
234 | temp: nowData.temp,
235 | text: nowData.text,
236 | text_en: nowData.text_en,
237 | windDir: nowData.windDir,
238 | windScale: nowData.windScale,
239 | vis: nowData.vis,
240 | humidity: nowData.humidity,
241 | icon: nowData.icon,
242 | precip: nowData.precip,
243 | obsTimeFormat: formatDate(new Date(nowData.obsTime), "yy-MM-dd hh:mm"),
244 | feelsLike: nowData.feelsLike
245 | }
246 | }
247 | },
248 |
249 | async indiceServer(day = 1) {
250 | let indiceRes = await request({
251 | apiType: 'qweather',
252 | url: `/v7/indices/${day}d`,
253 | data: {
254 | location: this.data.location,
255 | type: '7',
256 | },
257 | })
258 | if (indiceRes.code === '200') {
259 | return {
260 | comfText: indiceRes.daily[0].text
261 | }
262 | } else {
263 | return null
264 | }
265 | },
266 | async minutelyServer() {
267 | let minutelyRes = await request({
268 | apiType: 'qweather',
269 | url: `/v7/minutely/5m`,
270 | data: {
271 | location: this.data.location
272 | },
273 | })
274 | if (minutelyRes.code === '200') {
275 | this.setData({
276 | rainfall: minutelyRes.summary
277 | })
278 | }
279 | return {
280 | rainfall: minutelyRes.summary
281 | }
282 | },
283 | async warningServer(cb) {
284 | let warning
285 | let warningRes = await request({
286 | apiType: 'qweather',
287 | url: `/v7/warning/now`,
288 | data: {
289 | location: this.data.location
290 | },
291 | })
292 | cb && cb()
293 | if (warningRes.code === '200') {
294 | warning = warningRes.warning && warningRes.warning.length ? warningRes.warning : null
295 | }
296 | return {
297 | warning
298 | }
299 |
300 | },
301 | async airServer() {
302 | let airingRes = await request({
303 | apiType: 'qweather',
304 | url: `/v7/air/now`,
305 | data: {
306 | location: this.data.location
307 | },
308 | })
309 |
310 | if (airingRes.code === '200') {
311 | return {
312 | aqi: airingRes.now.aqi,
313 | category: airingRes.now.category
314 | }
315 | }
316 |
317 | },
318 |
319 | onPullDownRefresh(res) {
320 | this.reloadPage()
321 | },
322 |
323 | openSetting() { },
324 |
325 |
326 | checkUpdate(setting) {
327 | // 兼容低版本
328 | if (!setting.forceUpdate || !wx.getUpdateManager) {
329 | return
330 | }
331 | let updateManager = wx.getUpdateManager()
332 | updateManager.onCheckForUpdate((res) => {
333 | console.error(res)
334 | })
335 | updateManager.onUpdateReady(function () {
336 | wx.showModal({
337 | title: '更新提示',
338 | content: '新版本已下载完成,是否重启应用?',
339 | success: function (res) {
340 | if (res.confirm) {
341 | updateManager.applyUpdate()
342 | }
343 | }
344 | })
345 | })
346 | },
347 |
348 |
349 | toCitychoose() {
350 | wx.navigateTo({
351 | url: '/pages/weather/city/city',
352 | })
353 | },
354 | initSetting(successFunc) {
355 | wx.getStorage({
356 | key: 'setting',
357 | success: (res) => {
358 | let setting = res.data || {}
359 | this.setData({
360 | setting,
361 | })
362 | successFunc && successFunc(setting)
363 | },
364 | fail: () => {
365 | this.setData({
366 | setting: {},
367 | })
368 | },
369 | })
370 | },
371 | reloadInitSetting() {
372 | this.initSetting((setting) => {
373 | this.checkUpdate(setting)
374 | })
375 | },
376 | onShareAppMessage(res) {
377 | return {
378 | title: '出行天气早知道',
379 | path: '/pages/weather/weather',
380 | // imageUrl: '/img/share.jpg',
381 | }
382 | },
383 | getRainfall() {
384 | if (this.data.isRainfall) {
385 | return
386 | }
387 | this.setData({
388 | isRainfall: true
389 | }, () => {
390 | this.minutelyServer(this.data.location)
391 | })
392 | },
393 | openWarningToast() {
394 |
395 | this.setData({
396 | warningShow: true
397 | })
398 |
399 | },
400 | hideWarningToast() {
401 | this.setData({
402 | warningShow: false
403 | })
404 | },
405 | refresh() {
406 | this.getWeatherRefresh(this.data.location)
407 | },
408 | goToDay30() {
409 | wx.navigateTo({
410 | url: '/pages/weather/days30/days30?location=' + this.data.location
411 | })
412 | }
413 | })
414 |
--------------------------------------------------------------------------------