├── src
├── utils
│ └── utils.js
├── assets
│ ├── css
│ │ ├── style.css
│ │ └── m_base.less
│ ├── logo.png
│ └── js
│ │ ├── Lib.js
│ │ └── rem.js
├── store.js
├── route
│ ├── router_list.js
│ └── router.js
├── main.js
├── components
│ ├── model.vue
│ ├── picker.vue
│ └── test_canlen
│ │ ├── swiper-monthorweek.vue
│ │ ├── calendar.vue
│ │ └── format.js
├── App.vue
├── views
│ ├── tmp.vue
│ ├── tmp2
│ │ └── tmp2.vue
│ └── index.vue
└── registerServiceWorker.js
├── public
├── robots.txt
├── favicon.ico
├── img
│ └── icons
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── mstile-150x150.png
│ │ ├── apple-touch-icon.png
│ │ ├── android-chrome-192x192.png
│ │ ├── android-chrome-512x512.png
│ │ ├── apple-touch-icon-120x120.png
│ │ ├── apple-touch-icon-152x152.png
│ │ ├── apple-touch-icon-180x180.png
│ │ ├── apple-touch-icon-60x60.png
│ │ ├── apple-touch-icon-76x76.png
│ │ ├── msapplication-icon-144x144.png
│ │ └── safari-pinned-tab.svg
├── manifest.json
└── index.html
├── babel.config.js
├── vue.config.js
├── README.md
├── package.json
└── postcss.config.js
/src/utils/utils.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/assets/css/style.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/app'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/src/assets/logo.png
--------------------------------------------------------------------------------
/public/img/icons/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/favicon-16x16.png
--------------------------------------------------------------------------------
/public/img/icons/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/favicon-32x32.png
--------------------------------------------------------------------------------
/public/img/icons/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/mstile-150x150.png
--------------------------------------------------------------------------------
/public/img/icons/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/apple-touch-icon.png
--------------------------------------------------------------------------------
/public/img/icons/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/android-chrome-192x192.png
--------------------------------------------------------------------------------
/public/img/icons/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/android-chrome-512x512.png
--------------------------------------------------------------------------------
/public/img/icons/apple-touch-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/apple-touch-icon-120x120.png
--------------------------------------------------------------------------------
/public/img/icons/apple-touch-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/apple-touch-icon-152x152.png
--------------------------------------------------------------------------------
/public/img/icons/apple-touch-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/apple-touch-icon-180x180.png
--------------------------------------------------------------------------------
/public/img/icons/apple-touch-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/apple-touch-icon-60x60.png
--------------------------------------------------------------------------------
/public/img/icons/apple-touch-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/apple-touch-icon-76x76.png
--------------------------------------------------------------------------------
/public/img/icons/msapplication-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssza02/calendar-mobile/HEAD/public/img/icons/msapplication-icon-144x144.png
--------------------------------------------------------------------------------
/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | configureWebpack: config => {
3 | require('vux-loader').merge(config, {
4 | options: {},
5 | plugins: ['vux-ui']
6 | })
7 | }
8 | }
--------------------------------------------------------------------------------
/src/store.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex)
5 |
6 | export default new Vuex.Store({
7 | state: {
8 |
9 | },
10 | mutations: {
11 |
12 | },
13 | actions: {
14 |
15 | }
16 | })
17 |
--------------------------------------------------------------------------------
/src/route/router_list.js:
--------------------------------------------------------------------------------
1 | // import Index from '../views/index.vue'
2 |
3 | const Routes = [
4 | {
5 | path: '/',
6 | name: 'index',
7 | component: () => import('../views/index.vue')
8 | }
9 | ]
10 |
11 | export default Routes;
--------------------------------------------------------------------------------
/src/route/router.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import routerList from './router_list'
4 |
5 |
6 | Vue.use(Router)
7 | const routes = routerList
8 | const router = new Router({
9 | routes
10 | })
11 |
12 | export default router
13 |
--------------------------------------------------------------------------------
/src/assets/js/Lib.js:
--------------------------------------------------------------------------------
1 | //导入全局的css
2 | //require('assets/css/m_base.css');
3 | require('../css/style.css');
4 | //导入全局的站点配置文件
5 | // import C from './conf';
6 | //导入全局的共用事件
7 | import M from '../js/common';
8 | // import BScroll from 'better-scroll';
9 |
10 | export default{
11 | M
12 | }
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import router from './route/router'
4 | import store from './store'
5 | import MintUI from 'mint-ui';
6 | import 'mint-ui/lib/style.css'
7 | import './registerServiceWorker'
8 | import './assets/js/rem'
9 |
10 | Vue.use(MintUI)
11 |
12 | Vue.config.productionTip = false
13 |
14 | new Vue({
15 | router,
16 | store,
17 | render: h => h(App)
18 | }).$mount('#app')
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # visitor-web
2 |
3 | ## Project setup
4 | ```
5 | npm install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | npm run serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | npm run build
16 | ```
17 |
18 | ### Run your tests
19 | ```
20 | npm run test
21 | ```
22 |
23 | ### Lints and fixes files
24 | ```
25 | npm run lint
26 | ```
27 |
28 | ### Customize configuration
29 | See [Configuration Reference](https://cli.vuejs.org/config/).
30 |
--------------------------------------------------------------------------------
/src/assets/js/rem.js:
--------------------------------------------------------------------------------
1 | (function (doc, win) {
2 | var docEl = doc.documentElement,
3 | resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
4 | recalc = function () {
5 | var clientWidth = docEl.clientWidth;
6 | if (!clientWidth) return;
7 | docEl.style.fontSize = 100 * (clientWidth / 375) + 'px';
8 | };
9 | if (!doc.addEventListener) return;
10 | win.addEventListener(resizeEvt, recalc, false);
11 | doc.addEventListener('DOMContentLoaded', recalc, false);
12 | })(document, window);
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "visitor-web",
3 | "short_name": "visitor-web",
4 | "icons": [
5 | {
6 | "src": "./img/icons/android-chrome-192x192.png",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "./img/icons/android-chrome-512x512.png",
12 | "sizes": "512x512",
13 | "type": "image/png"
14 | }
15 | ],
16 | "start_url": "./index.html",
17 | "display": "standalone",
18 | "background_color": "#000000",
19 | "theme_color": "#4DBA87"
20 | }
21 |
--------------------------------------------------------------------------------
/src/components/model.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
13 |
14 |
15 |
31 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
28 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | visitor-web
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "visitor-web",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "vue-cli-service serve",
7 | "build": "vue-cli-service build"
8 | },
9 | "dependencies": {
10 | "axios": "^0.19.0",
11 | "core-js": "^2.6.5",
12 | "mint-ui": "^2.2.13",
13 | "register-service-worker": "^1.6.2",
14 | "vue": "^2.6.10",
15 | "vue-router": "^3.0.3",
16 | "vuex": "^3.0.1",
17 | "vux": "^2.9.4"
18 | },
19 | "devDependencies": {
20 | "@vue/cli-plugin-babel": "^3.9.0",
21 | "@vue/cli-plugin-pwa": "^3.9.0",
22 | "@vue/cli-service": "^3.9.0",
23 | "less": "^3.0.4",
24 | "less-loader": "^4.1.0",
25 | "vue-loader": "^14.2.2",
26 | "vue-template-compiler": "^2.6.10",
27 | "vux-loader": "^1.2.9",
28 | "weixin-js-sdk": "^1.4.0-test"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/views/tmp.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
12312312312
8 |
9 |
10 |
11 |
12 |
13 |
37 |
38 |
45 |
--------------------------------------------------------------------------------
/src/views/tmp2/tmp2.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
12312312312
8 |
9 |
10 |
11 |
12 |
13 |
37 |
38 |
45 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | // module.exports = {
2 | // plugins: {
3 | // "autoprefixer": {},
4 | // "postcss-cssnext": {},
5 | // "postcss-pxtorem": {
6 | // "rootValue": 16,
7 | // "propList": [
8 | // "*"
9 | // ]
10 | // }
11 | // }
12 | // }
13 |
14 |
15 | // const autoprefixer = require('autoprefixer')
16 | // const pxtorem = require('postcss-pxtorem')
17 |
18 | // module.exports = ({ file }) => {
19 | // let rootValue
20 | // // vant 37.5 [link](https://github.com/youzan/vant/issues/1181)
21 | // if (file && file.dirname && file.dirname.indexOf('vant') > -1) {
22 | // rootValue = 37.5
23 | // } else {
24 | // rootValue = 75
25 | // }
26 | // return {
27 | // plugins: [
28 | // autoprefixer(),
29 | // pxtorem({
30 | // rootValue: rootValue,
31 | // propList: ['*'],
32 | // minPixelValue: 2
33 | // })
34 | // ]
35 | // }
36 | // }
--------------------------------------------------------------------------------
/src/registerServiceWorker.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-console */
2 |
3 | import { register } from 'register-service-worker'
4 |
5 | if (process.env.NODE_ENV === 'production') {
6 | register(`${process.env.BASE_URL}service-worker.js`, {
7 | ready () {
8 | console.log(
9 | 'App is being served from cache by a service worker.\n' +
10 | 'For more details, visit https://goo.gl/AFskqB'
11 | )
12 | },
13 | registered () {
14 | console.log('Service worker has been registered.')
15 | },
16 | cached () {
17 | console.log('Content has been cached for offline use.')
18 | },
19 | updatefound () {
20 | console.log('New content is downloading.')
21 | },
22 | updated () {
23 | console.log('New content is available; please refresh.')
24 | },
25 | offline () {
26 | console.log('No internet connection found. App is running in offline mode.')
27 | },
28 | error (error) {
29 | console.error('Error during service worker registration:', error)
30 | }
31 | })
32 | }
33 |
--------------------------------------------------------------------------------
/src/components/picker.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
16 |
17 |
18 |
35 |
36 |
37 |
92 |
--------------------------------------------------------------------------------
/src/views/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
73 |
74 |
122 |
--------------------------------------------------------------------------------
/src/assets/css/m_base.less:
--------------------------------------------------------------------------------
1 | /*顶部标题*/
2 | html, body, div, span, object, iframe,
3 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
4 | abbr, address, cite, code,
5 | del, dfn, em, img, ins, kbd, q, samp,
6 | small, strong, sub, sup, var,
7 | b, i,
8 | dl, dt, dd, ol, ul, li,
9 | fieldset, form, label, legend,
10 | table, caption, tbody, tfoot, thead, tr, th, td,
11 | article, aside, canvas, details, figcaption, figure,
12 | footer, header, hgroup, menu, nav, section, summary,
13 | time, mark, audio, video {
14 | margin:0;
15 | padding:0;
16 | border:0;
17 | outline:0;
18 | font-size:100%;
19 | vertical-align:baseline;
20 | background:transparent;
21 | }
22 |
23 | body {
24 | line-height:1;
25 | }
26 |
27 | :focus {
28 | outline: 1;
29 | }
30 |
31 | article,aside,canvas,details,figcaption,figure,
32 | footer,header,hgroup,menu,nav,section,summary {
33 | display:block;
34 | }
35 |
36 | nav ul,li {
37 | list-style:none;
38 | }
39 |
40 | blockquote, q {
41 | quotes:none;
42 | }
43 |
44 | blockquote:before, blockquote:after,
45 | q:before, q:after {
46 | content:'';
47 | content:none;
48 | }
49 |
50 | a {
51 | margin:0;
52 | padding:0;
53 | border:0;
54 | font-size:100%;
55 | vertical-align:baseline;
56 | background:transparent;
57 | text-decoration:none;
58 | }
59 | a{ -webkit-tap-highlight-color:rgba(255,0,0,0);}
60 |
61 | ins {
62 | background-color:#ff9;
63 | color:#000;
64 | text-decoration:none;
65 | }
66 |
67 | mark {
68 | background-color:#ff9;
69 | color:#000;
70 | font-style:italic;
71 | font-weight:bold;
72 | }
73 | w
74 | del {
75 | text-decoration: line-through;
76 | }
77 |
78 | abbr[title], dfn[title] {
79 | border-bottom:1px dotted #000;
80 | cursor:help;
81 | }
82 |
83 | table {
84 | border-collapse:collapse;
85 | border-spacing:0;
86 | }
87 |
88 | hr {
89 | display:block;
90 | height:1px;
91 | border:0;
92 | border-top:1px solid #cccccc;
93 | margin:1em 0;
94 | padding:0;
95 | }
96 |
97 | input, select {
98 | vertical-align:middle;
99 | -webkit-appearance: none;
100 | border-radius: 0;
101 | -webkit-box-sizing: border-box;
102 | -moz-box-sizing: border-box;
103 | box-sizing: border-box;
104 | }
105 | .top_toast{
106 | width: 100%;
107 | height: 0.2rem;
108 | background: black;
109 | }
110 |
111 | .top_title_box{
112 | padding: 0 0.3rem;
113 | height: 0.44rem;
114 | line-height: 0.44rem;
115 | border: 1px solid #f0f0f0;
116 | font-size: 0;
117 | text-align: center;
118 | margin: 0 -2px;
119 | position: relative;
120 | background-color: #f9f9f9;
121 | .top-back-icon{
122 | font-size: 24px;
123 | position: absolute;
124 | left: 0;
125 | display: inline-block;
126 | height: 0.44rem;
127 | width: 0.44rem;
128 | line-height: 0.44rem;
129 | }
130 | .top_title{
131 | display: inline-block;
132 | font-size: 20px;
133 | font-weight: bold;
134 | white-space: nowrap;
135 | color: #333;
136 | }
137 | .top_register_btn{
138 | font-size: 13px;
139 | color: #333;
140 | float: right;
141 | }
142 | }
143 |
144 | /*顶部标题*/
145 |
146 | /*小标题*/
147 | .title_base{
148 | height: 0.9rem;
149 | line-height: 0.9rem;
150 | padding: 0 0.3rem;
151 | font-size: 15px;
152 | color: #333333;
153 | margin-top: 0.2rem;
154 | background-color: #fff;
155 | }
156 | .title-icon{
157 | background-color:#2399eb;
158 | width: 0.1rem;
159 | height: 13px;
160 | margin-right: 0.2rem;
161 | display: inline-block;
162 | }
163 | .title,.banner,.exper_type_bar{
164 | background-color: #fff;
165 | }
166 | /*小标题*/
167 |
168 |
169 | /*底部导航栏*/
170 | html,body {
171 | margin: 0;
172 | padding:0;
173 | /* height: 100%;*/
174 | -webkit-overflow-scrolling: touch;
175 | }
176 | /*base*/
177 | .html_box{
178 | /*min-height:100%;
179 | height: auto !important;
180 | height: 100%; /*IE6不识别min-height*/
181 | position: relative;
182 | //padding-bottom: 1rem;
183 | background-color: #efeff3;
184 | width: 100%;
185 | overflow: hidden;
186 | .more{
187 | font-size: 14px;
188 | color:#808080;
189 | display: inline-block;
190 | float: right;
191 | font-weight: normal;
192 | i{
193 | font-size: 12px;
194 | }
195 | }
196 | }
197 |
198 | /*base*/
199 |
200 | *{
201 | -webkit-tap-highlight-color: rgba(0,0,0,0);
202 | }
203 | .clearfix:after{
204 | content:".";
205 | display:block;
206 | height:0;
207 | clear:both;
208 | visibility:hidden;
209 | }
210 | .clearfix{
211 | height:1%;
212 | }
213 | a,a:link,a:visited,a:hover,a:active{color:#000;text-decoration:none;out-line:none;} /* 重置链接a标签 */
214 | // {color:#000;text-decoration:none;out-line:none;}
215 | // {color:#000;text-decoration:none;out-line:none;}
216 | // {color:#000;text-decoration:none;out-line:none;}
217 | // {color:#000;text-decoration:none;out-line:none;}
218 |
219 | input[type="submit"],input[type="reset"],input[type="button"],input[type="text"],input[type="number"],
220 | select,
221 | button{ -webkit-appearance:none;}
222 |
223 | .text-overflow{
224 | white-space: nowrap;
225 | text-overflow:ellipsis;
226 | overflow:hidden;
227 | }
228 | .centerbox{
229 | position: absolute;
230 | text-align: center;
231 | left:50%;
232 | top: 50%;
233 | -webkit-transform: translate(-50%,-50%);
234 | -ms-transform: translate(-50%,-50%);
235 | transform: translate(-50%,-50%);
236 | }
237 | .shadow{
238 | width: 100%;
239 | height: 100%;
240 | background: rgba(0,0,0,0.4);
241 | position: fixed;
242 | top: 0;
243 | left: 0;
244 | z-index: 999998;
245 | }
246 |
247 |
248 | .fade-enter-active, .fade-leave-active {
249 | transition: opacity .3s
250 | }
251 | .fade-enter, .fade-leave-active {
252 | opacity: 0
253 | }
254 | // .loading_box{
255 | // width: 100%;
256 | // height: 100%;
257 | // position: absolute;
258 | // top: 0;
259 | // left: 0;
260 | // display: none;
261 | // z-index: 999999;
262 | // }
263 |
264 | .btn{
265 | background: #2399EB;
266 | color:#fff;
267 | text-align: center;
268 | outline: none;
269 | cursor: pointer;
270 | box-sizing: border-box;
271 | border: none;
272 | }
273 | .btn:disabled{
274 | background: #ccc;
275 | }
276 |
277 | input.transparent,button.transparent{
278 | background: transparent;
279 | border: 0;
280 | outline: none;
281 | }
282 |
--------------------------------------------------------------------------------
/src/components/test_canlen/swiper-monthorweek.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
16 |
17 |
273 |
291 |
--------------------------------------------------------------------------------
/public/img/icons/safari-pinned-tab.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
150 |
--------------------------------------------------------------------------------
/src/components/test_canlen/calendar.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
11 | -
12 |
13 |
14 | 今
15 | {{day.day}}
16 |
17 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
{{formateTime}}
28 |
31 |
32 |
33 |
34 |
249 |
405 |
--------------------------------------------------------------------------------
/src/components/test_canlen/format.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Administrator on 2018/1/19.
3 | */
4 | /**
5 | * @1900-2100区间内的公历、农历互转
6 | * @charset UTF-8
7 | * @Author Jea杨(JJonline@JJonline.Cn)
8 | * @Time 2014-7-21
9 | * @Time 2016-8-13 Fixed 2033hex、Attribution Annals
10 | * @Time 2016-9-25 Fixed lunar LeapMonth Param Bug
11 | * @Version 1.0.2
12 | * @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
13 | * @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
14 | */
15 | const calendar = {
16 |
17 | /**
18 | * 农历1900-2100的润大小信息表
19 | * @Array Of Property
20 | * @return Hex
21 | */
22 | lunarInfo:[0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,//1900-1909
23 | 0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,//1910-1919
24 | 0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,//1920-1929
25 | 0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,//1930-1939
26 | 0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,//1940-1949
27 | 0x06ca0,0x0b550,0x15355,0x04da0,0x0a5b0,0x14573,0x052b0,0x0a9a8,0x0e950,0x06aa0,//1950-1959
28 | 0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,//1960-1969
29 | 0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b6a0,0x195a6,//1970-1979
30 | 0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,//1980-1989
31 | 0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,//1990-1999
32 | 0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,//2000-2009
33 | 0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,//2010-2019
34 | 0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,//2020-2029
35 | 0x05aa0,0x076a3,0x096d0,0x04afb,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,//2030-2039
36 | 0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0,//2040-2049
37 | /**Add By JJonline@JJonline.Cn**/
38 | 0x14b63,0x09370,0x049f8,0x04970,0x064b0,0x168a6,0x0ea50, 0x06b20,0x1a6c4,0x0aae0,//2050-2059
39 | 0x0a2e0,0x0d2e3,0x0c960,0x0d557,0x0d4a0,0x0da50,0x05d55,0x056a0,0x0a6d0,0x055d4,//2060-2069
40 | 0x052d0,0x0a9b8,0x0a950,0x0b4a0,0x0b6a6,0x0ad50,0x055a0,0x0aba4,0x0a5b0,0x052b0,//2070-2079
41 | 0x0b273,0x06930,0x07337,0x06aa0,0x0ad50,0x14b55,0x04b60,0x0a570,0x054e4,0x0d160,//2080-2089
42 | 0x0e968,0x0d520,0x0daa0,0x16aa6,0x056d0,0x04ae0,0x0a9d4,0x0a2d0,0x0d150,0x0f252,//2090-2099
43 | 0x0d520],//2100
44 |
45 | /**
46 | * 公历每个月份的天数普通表
47 | * @Array Of Property
48 | * @return Number
49 | */
50 | solarMonth:[31,28,31,30,31,30,31,31,30,31,30,31],
51 |
52 | /**
53 | * 天干地支之天干速查表
54 | * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
55 | * @return Cn string
56 | */
57 | Gan:["\u7532","\u4e59","\u4e19","\u4e01","\u620a","\u5df1","\u5e9a","\u8f9b","\u58ec","\u7678"],
58 |
59 | /**
60 | * 天干地支之地支速查表
61 | * @Array Of Property
62 | * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
63 | * @return Cn string
64 | */
65 | Zhi:["\u5b50","\u4e11","\u5bc5","\u536f","\u8fb0","\u5df3","\u5348","\u672a","\u7533","\u9149","\u620c","\u4ea5"],
66 |
67 | /**
68 | * 天干地支之地支速查表<=>生肖
69 | * @Array Of Property
70 | * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
71 | * @return Cn string
72 | */
73 | Animals:["\u9f20","\u725b","\u864e","\u5154","\u9f99","\u86c7","\u9a6c","\u7f8a","\u7334","\u9e21","\u72d7","\u732a"],
74 |
75 | /**
76 | * 24节气速查表
77 | * @Array Of Property
78 | * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
79 | * @return Cn string
80 | */
81 | solarTerm:["\u5c0f\u5bd2","\u5927\u5bd2","\u7acb\u6625","\u96e8\u6c34","\u60ca\u86f0","\u6625\u5206","\u6e05\u660e","\u8c37\u96e8","\u7acb\u590f","\u5c0f\u6ee1","\u8292\u79cd","\u590f\u81f3","\u5c0f\u6691","\u5927\u6691","\u7acb\u79cb","\u5904\u6691","\u767d\u9732","\u79cb\u5206","\u5bd2\u9732","\u971c\u964d","\u7acb\u51ac","\u5c0f\u96ea","\u5927\u96ea","\u51ac\u81f3"],
82 |
83 | /**
84 | * 1900-2100各年的24节气日期速查表
85 | * @Array Of Property
86 | * @return 0x string For splice
87 | */
88 | sTermInfo:['9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf97c3598082c95f8c965cc920f',
89 | '97bd0b06bdb0722c965ce1cfcc920f','b027097bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
90 | '97bcf97c359801ec95f8c965cc920f','97bd0b06bdb0722c965ce1cfcc920f','b027097bd097c36b0b6fc9274c91aa',
91 | '97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f','97bd0b06bdb0722c965ce1cfcc920f',
92 | 'b027097bd097c36b0b6fc9274c91aa','9778397bd19801ec9210c965cc920e','97b6b97bd19801ec95f8c965cc920f',
93 | '97bd09801d98082c95f8e1cfcc920f','97bd097bd097c36b0b6fc9210c8dc2','9778397bd197c36c9210c9274c91aa',
94 | '97b6b97bd19801ec95f8c965cc920e','97bd09801d98082c95f8e1cfcc920f','97bd097bd097c36b0b6fc9210c8dc2',
95 | '9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec95f8c965cc920e','97bcf97c3598082c95f8e1cfcc920f',
96 | '97bd097bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec9210c965cc920e',
97 | '97bcf97c3598082c95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
98 | '97b6b97bd19801ec9210c965cc920e','97bcf97c3598082c95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722',
99 | '9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f',
100 | '97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
101 | '97bcf97c359801ec95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
102 | '97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f','97bd097bd07f595b0b6fc920fb0722',
103 | '9778397bd097c36b0b6fc9210c8dc2','9778397bd19801ec9210c9274c920e','97b6b97bd19801ec95f8c965cc920f',
104 | '97bd07f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c920e',
105 | '97b6b97bd19801ec95f8c965cc920f','97bd07f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2',
106 | '9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec9210c965cc920e','97bd07f1487f595b0b0bc920fb0722',
107 | '7f0e397bd097c36b0b6fc9210c8dc2','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
108 | '97bcf7f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
109 | '97b6b97bd19801ec9210c965cc920e','97bcf7f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
110 | '9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf7f1487f531b0b0bb0b6fb0722',
111 | '7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
112 | '97bcf7f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
113 | '97b6b97bd19801ec9210c9274c920e','97bcf7f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
114 | '9778397bd097c36b0b6fc9210c91aa','97b6b97bd197c36c9210c9274c920e','97bcf7f0e47f531b0b0bb0b6fb0722',
115 | '7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c920e',
116 | '97b6b7f0e47f531b0723b0b6fb0722','7f0e37f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2',
117 | '9778397bd097c36b0b70c9274c91aa','97b6b7f0e47f531b0723b0b6fb0721','7f0e37f1487f595b0b0bb0b6fb0722',
118 | '7f0e397bd097c35b0b6fc9210c8dc2','9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721',
119 | '7f0e27f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
120 | '97b6b7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
121 | '9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
122 | '7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721',
123 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9274c91aa',
124 | '97b6b7f0e47f531b0723b0787b0721','7f0e27f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
125 | '9778397bd097c36b0b6fc9210c91aa','97b6b7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
126 | '7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9210c8dc2','977837f0e37f149b0723b0787b0721',
127 | '7f07e7f0e47f531b0723b0b6fb0722','7f0e37f5307f595b0b0bc920fb0722','7f0e397bd097c35b0b6fc9210c8dc2',
128 | '977837f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0721','7f0e37f1487f595b0b0bb0b6fb0722',
129 | '7f0e397bd097c35b0b6fc9210c8dc2','977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
130 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','977837f0e37f14998082b0787b06bd',
131 | '7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
132 | '977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
133 | '7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
134 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14998082b0787b06bd',
135 | '7f07e7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
136 | '977837f0e37f14998082b0723b06bd','7f07e7f0e37f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
137 | '7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b0721',
138 | '7f07e7f0e47f531b0723b0b6fb0722','7f0e37f1487f595b0b0bb0b6fb0722','7f0e37f0e37f14898082b0723b02d5',
139 | '7ec967f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0722','7f0e37f1487f531b0b0bb0b6fb0722',
140 | '7f0e37f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
141 | '7f0e37f1487f531b0b0bb0b6fb0722','7f0e37f0e37f14898082b072297c35','7ec967f0e37f14998082b0787b06bd',
142 | '7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e37f0e37f14898082b072297c35',
143 | '7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
144 | '7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f149b0723b0787b0721',
145 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14998082b0723b06bd',
146 | '7f07e7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722','7f0e37f0e366aa89801eb072297c35',
147 | '7ec967f0e37f14998082b0723b06bd','7f07e7f0e37f14998083b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
148 | '7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14898082b0723b02d5','7f07e7f0e37f14998082b0787b0721',
149 | '7f07e7f0e47f531b0723b0b6fb0722','7f0e36665b66aa89801e9808297c35','665f67f0e37f14898082b0723b02d5',
150 | '7ec967f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0722','7f0e36665b66a449801e9808297c35',
151 | '665f67f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
152 | '7f0e36665b66a449801e9808297c35','665f67f0e37f14898082b072297c35','7ec967f0e37f14998082b0787b06bd',
153 | '7f07e7f0e47f531b0723b0b6fb0721','7f0e26665b66a449801e9808297c35','665f67f0e37f1489801eb072297c35',
154 | '7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722'],
155 |
156 | /**
157 | * 数字转中文速查表
158 | * @Array Of Property
159 | * @trans ['日','一','二','三','四','五','六','七','八','九','十']
160 | * @return Cn string
161 | */
162 | nStr1:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341"],
163 |
164 | /**
165 | * 日期转农历称呼速查表
166 | * @Array Of Property
167 | * @trans ['初','十','廿','卅']
168 | * @return Cn string
169 | */
170 | nStr2:["\u521d","\u5341","\u5eff","\u5345"],
171 |
172 | /**
173 | * 月份转农历称呼速查表
174 | * @Array Of Property
175 | * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
176 | * @return Cn string
177 | */
178 | nStr3:["\u6b63","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u51ac","\u814a"],
179 |
180 | /**
181 | * 返回农历y年一整年的总天数
182 | * @param lunar Year
183 | * @return Number
184 | * @eg:var count = calendar.lYearDays(1987) ;//count=387
185 | */
186 | lYearDays:function(y) {
187 | var i, sum = 348;
188 | for(i=0x8000; i>0x8; i>>=1) { sum += (calendar.lunarInfo[y-1900] & i)? 1: 0; }
189 | return(sum+calendar.leapDays(y));
190 | },
191 |
192 | /**
193 | * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
194 | * @param lunar Year
195 | * @return Number (0-12)
196 | * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
197 | */
198 | leapMonth:function(y) { //闰字编码 \u95f0
199 | return(calendar.lunarInfo[y-1900] & 0xf);
200 | },
201 |
202 | /**
203 | * 返回农历y年闰月的天数 若该年没有闰月则返回0
204 | * @param lunar Year
205 | * @return Number (0、29、30)
206 | * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
207 | */
208 | leapDays:function(y) {
209 | if(calendar.leapMonth(y)) {
210 | return((calendar.lunarInfo[y-1900] & 0x10000)? 30: 29);
211 | }
212 | return(0);
213 | },
214 |
215 | /**
216 | * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
217 | * @param lunar Year
218 | * @return Number (-1、29、30)
219 | * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
220 | */
221 | monthDays:function(y,m) {
222 | if(m>12 || m<1) {return -1}//月份参数从1至12,参数错误返回-1
223 | return( (calendar.lunarInfo[y-1900] & (0x10000>>m))? 30: 29 );
224 | },
225 |
226 | /**
227 | * 返回公历(!)y年m月的天数
228 | * @param solar Year
229 | * @return Number (-1、28、29、30、31)
230 | * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
231 | */
232 | solarDays:function(y,m) {
233 | if(m>12 || m<1) {return -1} //若参数错误 返回-1
234 | var ms = m-1;
235 | if(ms==1) { //2月份的闰平规律测算后确认返回28或29
236 | return(((y%4 == 0) && (y%100 != 0) || (y%400 == 0))? 29: 28);
237 | }else {
238 | return(calendar.solarMonth[ms]);
239 | }
240 | },
241 |
242 | /**
243 | * 农历年份转换为干支纪年
244 | * @param lYear 农历年的年份数
245 | * @return Cn string
246 | */
247 | toGanZhiYear:function(lYear) {
248 | var ganKey = (lYear - 3) % 10;
249 | var zhiKey = (lYear - 3) % 12;
250 | if(ganKey == 0) ganKey = 10;//如果余数为0则为最后一个天干
251 | if(zhiKey == 0) zhiKey = 12;//如果余数为0则为最后一个地支
252 | return calendar.Gan[ganKey-1] + calendar.Zhi[zhiKey-1];
253 |
254 | },
255 |
256 | /**
257 | * 公历月、日判断所属星座
258 | * @param cMonth [description]
259 | * @param cDay [description]
260 | * @return Cn string
261 | */
262 | toAstro:function(cMonth,cDay) {
263 | var s = "\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf";
264 | var arr = [20,19,21,21,21,22,23,23,23,23,22,22];
265 | return s.substr(cMonth*2 - (cDay < arr[cMonth-1] ? 2 : 0),2) + "\u5ea7";//座
266 | },
267 |
268 | /**
269 | * 传入offset偏移量返回干支
270 | * @param offset 相对甲子的偏移量
271 | * @return Cn string
272 | */
273 | toGanZhi:function(offset) {
274 | return calendar.Gan[offset%10] + calendar.Zhi[offset%12];
275 | },
276 |
277 | /**
278 | * 传入公历(!)y年获得该年第n个节气的公历日期
279 | * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
280 | * @return day Number
281 | * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
282 | */
283 | getTerm:function(y,n) {
284 | if(y<1900 || y>2100) {return -1;}
285 | if(n<1 || n>24) {return -1;}
286 | var _table = calendar.sTermInfo[y-1900];
287 | var _info = [
288 | parseInt('0x'+_table.substr(0,5)).toString() ,
289 | parseInt('0x'+_table.substr(5,5)).toString(),
290 | parseInt('0x'+_table.substr(10,5)).toString(),
291 | parseInt('0x'+_table.substr(15,5)).toString(),
292 | parseInt('0x'+_table.substr(20,5)).toString(),
293 | parseInt('0x'+_table.substr(25,5)).toString()
294 | ];
295 | var _calday = [
296 | _info[0].substr(0,1),
297 | _info[0].substr(1,2),
298 | _info[0].substr(3,1),
299 | _info[0].substr(4,2),
300 |
301 | _info[1].substr(0,1),
302 | _info[1].substr(1,2),
303 | _info[1].substr(3,1),
304 | _info[1].substr(4,2),
305 |
306 | _info[2].substr(0,1),
307 | _info[2].substr(1,2),
308 | _info[2].substr(3,1),
309 | _info[2].substr(4,2),
310 |
311 | _info[3].substr(0,1),
312 | _info[3].substr(1,2),
313 | _info[3].substr(3,1),
314 | _info[3].substr(4,2),
315 |
316 | _info[4].substr(0,1),
317 | _info[4].substr(1,2),
318 | _info[4].substr(3,1),
319 | _info[4].substr(4,2),
320 |
321 | _info[5].substr(0,1),
322 | _info[5].substr(1,2),
323 | _info[5].substr(3,1),
324 | _info[5].substr(4,2),
325 | ];
326 | return parseInt(_calday[n-1]);
327 | },
328 |
329 | /**
330 | * 传入农历数字月份返回汉语通俗表示法
331 | * @param lunar month
332 | * @return Cn string
333 | * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
334 | */
335 | toChinaMonth:function(m) { // 月 => \u6708
336 | if(m>12 || m<1) {return -1} //若参数错误 返回-1
337 | var s = calendar.nStr3[m-1];
338 | s+= "\u6708";//加上月字
339 | return s;
340 | },
341 |
342 | /**
343 | * 传入农历日期数字返回汉字表示法
344 | * @param lunar day
345 | * @return Cn string
346 | * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
347 | */
348 | toChinaDay:function(d){ //日 => \u65e5
349 | var s;
350 | switch (d) {
351 | case 10:
352 | s = '\u521d\u5341'; break;
353 | case 20:
354 | s = '\u4e8c\u5341'; break;
355 | break;
356 | case 30:
357 | s = '\u4e09\u5341'; break;
358 | break;
359 | default :
360 | s = calendar.nStr2[Math.floor(d/10)];
361 | s += calendar.nStr1[d%10];
362 | }
363 | return(s);
364 | },
365 |
366 | /**
367 | * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
368 | * @param y year
369 | * @return Cn string
370 | * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
371 | */
372 | getAnimal: function(y) {
373 | return calendar.Animals[(y - 4) % 12]
374 | },
375 |
376 | /**
377 | * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
378 | * @param y solar year
379 | * @param m solar month
380 | * @param d solar day
381 | * @return JSON object
382 | * @eg:console.log(calendar.solar2lunar(1987,11,01));
383 | */
384 | solar2lunar:function (y,m,d) { //参数区间1900.1.31~2100.12.31
385 | var old_str=''
386 | if(y<1900 || y>2100) {return -1;}//年份限定、上限
387 | if(y==1900&&m==1&&d<31) {return -1;}//下限
388 | if(!y) { //未传参 获得当天
389 | var objDate = new Date();
390 | }else {
391 | var objDate = new Date(y,parseInt(m)-1,d)
392 | }
393 | var i, leap=0, temp=0;
394 | //修正ymd参数
395 | var y = objDate.getFullYear(),m = objDate.getMonth()+1,d = objDate.getDate();
396 | var offset = (Date.UTC(objDate.getFullYear(),objDate.getMonth(),objDate.getDate()) - Date.UTC(1900,0,31))/86400000;
397 | for(i=1900; i<2101 && offset>0; i++) { temp=calendar.lYearDays(i); offset-=temp; }
398 | if(offset<0) { offset+=temp; i--; }
399 |
400 | //是否今天
401 | var isTodayObj = new Date(),isToday=false;
402 | if(isTodayObj.getFullYear()==y && isTodayObj.getMonth()+1==m && isTodayObj.getDate()==d) {
403 | //console.log(y,m,d)
404 | isToday = true;
405 | }
406 | //星期几
407 | var nWeek = objDate.getDay(),cWeek = calendar.nStr1[nWeek];
408 | if(nWeek==0) {nWeek =7;}//数字表示周几顺应天朝周一开始的惯例
409 | //农历年
410 | var year = i;
411 |
412 | var leap = calendar.leapMonth(i); //闰哪个月
413 | var isLeap = false;
414 |
415 | //效验闰月
416 | for(i=1; i<13 && offset>0; i++) {
417 | //闰月
418 | if(leap>0 && i==(leap+1) && isLeap==false){
419 | --i;
420 | isLeap = true; temp = calendar.leapDays(year); //计算农历闰月天数
421 | }
422 | else{
423 | temp = calendar.monthDays(year, i);//计算农历普通月天数
424 | }
425 | //解除闰月
426 | if(isLeap==true && i==(leap+1)) { isLeap = false; }
427 | offset -= temp;
428 | }
429 |
430 | if(offset==0 && leap>0 && i==leap+1)
431 | if(isLeap){
432 | isLeap = false;
433 | }else{
434 | isLeap = true; --i;
435 | }
436 | if(offset<0){ offset += temp; --i; }
437 | //农历月
438 | var month = i;
439 | //农历日
440 | var day = offset + 1;
441 |
442 | //天干地支处理
443 | var sm = m-1;
444 | var gzY = calendar.toGanZhiYear(year);
445 |
446 | //月柱 1900年1月小寒以前为 丙子月(60进制12)
447 | var firstNode = calendar.getTerm(year,(m*2-1));//返回当月「节」为几日开始
448 | var secondNode = calendar.getTerm(year,(m*2));//返回当月「节」为几日开始
449 |
450 | //依据12节气修正干支月
451 | var gzM = calendar.toGanZhi((y-1900)*12+m+11);
452 | if(d>=firstNode) {
453 | gzM = calendar.toGanZhi((y-1900)*12+m+12);
454 | }
455 |
456 | //传入的日期的节气与否
457 | var isTerm = false;
458 | var Term = null;
459 | if(firstNode==d) {
460 | isTerm = true;
461 | Term = calendar.solarTerm[m*2-2];
462 | }
463 | if(secondNode==d) {
464 | isTerm = true;
465 | Term = calendar.solarTerm[m*2-1];
466 | }
467 | //日柱 当月一日与 1900/1/1 相差天数
468 | var dayCyclical = Date.UTC(y,sm,1,0,0,0,0)/86400000+25567+10;
469 | var gzD = calendar.toGanZhi(dayCyclical+d-1);
470 | //该日期所属的星座
471 | var astro = calendar.toAstro(m,d);
472 |
473 | if(day==1){
474 | if(isTerm){
475 | old_str=Term
476 | }else{
477 | old_str=(isLeap?"\u95f0":'')+calendar.toChinaMonth(month)
478 | }
479 | }else{
480 | if(isTerm){
481 | old_str=Term
482 | }else{
483 | old_str=calendar.toChinaDay(day)
484 | }
485 | }
486 | return {'lYear':year,'lMonth':month,'lDay':day,'Animal':calendar.getAnimal(year),'IMonthCn':(isLeap?"\u95f0":'')+calendar.toChinaMonth(month),'IDayCn':calendar.toChinaDay(day),'cYear':y,'cMonth':m,'cDay':d,'gzYear':gzY,'gzMonth':gzM,'gzDay':gzD,'isToday':isToday,'isLeap':isLeap,'nWeek':nWeek,'ncWeek':"\u661f\u671f"+cWeek,'isTerm':isTerm,'Term':Term,'astro':astro,old_str:old_str};
487 | },
488 |
489 | /**
490 | * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
491 | * @param y lunar year
492 | * @param m lunar month
493 | * @param d lunar day
494 | * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
495 | * @return JSON object
496 | * @eg:console.log(calendar.lunar2solar(1987,9,10));
497 | */
498 | lunar2solar:function(y,m,d,isLeapMonth) { //参数区间1900.1.31~2100.12.1
499 | var isLeapMonth = !!isLeapMonth;
500 | var leapOffset = 0;
501 | var leapMonth = calendar.leapMonth(y);
502 | var leapDay = calendar.leapDays(y);
503 | if(isLeapMonth&&(leapMonth!=m)) {return -1;}//传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
504 | if(y==2100&&m==12&&d>1 || y==1900&&m==1&&d<31) {return -1;}//超出了最大极限值
505 | var day = calendar.monthDays(y,m);
506 | var _day = day;
507 | //bugFix 2016-9-25
508 | //if month is leap, _day use leapDays method
509 | if(isLeapMonth) {
510 | _day = calendar.leapDays(y,m);
511 | }
512 | if(y < 1900 || y > 2100 || d > _day) {return -1;}//参数合法性效验
513 |
514 | //计算农历的时间差
515 | var offset = 0;
516 | for(var i=1900;i0) {
524 | offset+=calendar.leapDays(y);isAdd = true;
525 | }
526 | }
527 | offset+=calendar.monthDays(y,i);
528 | }
529 | //转换闰月农历 需补充该年闰月的前一个月的时差
530 | if(isLeapMonth) {offset+=day;}
531 | //1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
532 | var stmap = Date.UTC(1900,1,30,0,0,0);
533 | var calObj = new Date((offset+d-31)*86400000+stmap);
534 | var cY = calObj.getUTCFullYear();
535 | var cM = calObj.getUTCMonth()+1;
536 | var cD = calObj.getUTCDate();
537 |
538 | return calendar.solar2lunar(cY,cM,cD);
539 | }
540 | };
541 |
542 | export default calendar
543 |
544 |
--------------------------------------------------------------------------------