diff --git a/doc/”航大云“新生报到系统_行业和领域调研分析报告.docx b/doc/01_”航大云“新生报到系统_行业和领域调研分析报告.docx similarity index 100% rename from doc/”航大云“新生报到系统_行业和领域调研分析报告.docx rename to doc/01_”航大云“新生报到系统_行业和领域调研分析报告.docx diff --git a/doc/”航大云“新生报到系统_软件系统的需求构思及描述.docx b/doc/02_”航大云“新生报到系统_软件系统的需求构思及描述.docx similarity index 100% rename from doc/”航大云“新生报到系统_软件系统的需求构思及描述.docx rename to doc/02_”航大云“新生报到系统_软件系统的需求构思及描述.docx diff --git a/doc/03_”航大云“新生报到系统_软件需求规格说明书.docx b/doc/03_”航大云“新生报到系统_软件需求规格说明书.docx new file mode 100644 index 0000000..6c9517f Binary files /dev/null and b/doc/03_”航大云“新生报到系统_软件需求规格说明书.docx differ diff --git a/doc/04_”航大云“新生报到系统_软件设计规格说明书.docx b/doc/04_”航大云“新生报到系统_软件设计规格说明书.docx new file mode 100644 index 0000000..cbdc29c Binary files /dev/null and b/doc/04_”航大云“新生报到系统_软件设计规格说明书.docx differ diff --git a/model/01_“航大云”新生报到系统_需求模型.docx b/model/01_“航大云”新生报到系统_需求模型.docx new file mode 100644 index 0000000..7db375e Binary files /dev/null and b/model/01_“航大云”新生报到系统_需求模型.docx differ diff --git a/model/02_“航大云”新生报到系统_设计模型.docx b/model/02_“航大云”新生报到系统_设计模型.docx new file mode 100644 index 0000000..2acd1d5 Binary files /dev/null and b/model/02_“航大云”新生报到系统_设计模型.docx differ diff --git a/model/需求分析模型/分析类图.png b/model/需求分析模型/分析类图.png deleted file mode 100644 index c2ad489..0000000 Binary files a/model/需求分析模型/分析类图.png and /dev/null differ diff --git a/model/需求分析模型/用例图.png b/model/需求分析模型/用例图.png deleted file mode 100644 index 77d6728..0000000 Binary files a/model/需求分析模型/用例图.png and /dev/null differ diff --git a/model/需求分析模型/用例描述.docx b/model/需求分析模型/用例描述.docx deleted file mode 100644 index 4e99cac..0000000 Binary files a/model/需求分析模型/用例描述.docx and /dev/null differ diff --git a/model/需求设计模型/设计类图.png b/model/需求设计模型/设计类图.png deleted file mode 100644 index b5e369c..0000000 Binary files a/model/需求设计模型/设计类图.png and /dev/null differ diff --git a/model/需求设计模型/跳转顺序图.png b/model/需求设计模型/跳转顺序图.png deleted file mode 100644 index fd427c5..0000000 Binary files a/model/需求设计模型/跳转顺序图.png and /dev/null differ diff --git a/model/需求设计模型/逻辑视图.png b/model/需求设计模型/逻辑视图.png deleted file mode 100644 index a7a2c48..0000000 Binary files a/model/需求设计模型/逻辑视图.png and /dev/null differ diff --git a/other/05_”航大云“新生报到系统_软件工程课程设计汇报.pptx b/other/05_”航大云“新生报到系统_软件工程课程设计汇报.pptx new file mode 100644 index 0000000..8fb3394 Binary files /dev/null and b/other/05_”航大云“新生报到系统_软件工程课程设计汇报.pptx differ diff --git a/other/06_”航大云“新生报到系统_软件开发项目的个人自评报告.xlsx b/other/06_”航大云“新生报到系统_软件开发项目的个人自评报告.xlsx new file mode 100644 index 0000000..e1c8926 Binary files /dev/null and b/other/06_”航大云“新生报到系统_软件开发项目的个人自评报告.xlsx differ diff --git a/other/07_”航大云“新生报到系统_软件开发项目的团队自评报告.xlsx b/other/07_”航大云“新生报到系统_软件开发项目的团队自评报告.xlsx new file mode 100644 index 0000000..ad0bde7 Binary files /dev/null and b/other/07_”航大云“新生报到系统_软件开发项目的团队自评报告.xlsx differ diff --git a/other/08_”航大云“新生报到系统_210340065马嘉序_实践总结报告.docx b/other/08_”航大云“新生报到系统_210340065马嘉序_实践总结报告.docx new file mode 100644 index 0000000..077f550 Binary files /dev/null and b/other/08_”航大云“新生报到系统_210340065马嘉序_实践总结报告.docx differ diff --git a/other/08_”航大云“新生报到系统_210340081杨申申_实践总结报告.docx b/other/08_”航大云“新生报到系统_210340081杨申申_实践总结报告.docx new file mode 100644 index 0000000..3f47ee0 Binary files /dev/null and b/other/08_”航大云“新生报到系统_210340081杨申申_实践总结报告.docx differ diff --git a/other/08_”航大云“新生报到系统_210340086赵军杰_实践总结报告.docx b/other/08_”航大云“新生报到系统_210340086赵军杰_实践总结报告.docx new file mode 100644 index 0000000..ac06860 Binary files /dev/null and b/other/08_”航大云“新生报到系统_210340086赵军杰_实践总结报告.docx differ diff --git a/other/08_”航大云“新生报到系统_210340090邹国涛_实践总结报告.docx b/other/08_”航大云“新生报到系统_210340090邹国涛_实践总结报告.docx new file mode 100644 index 0000000..e149355 Binary files /dev/null and b/other/08_”航大云“新生报到系统_210340090邹国涛_实践总结报告.docx differ diff --git a/other/09_”航大云“新生报到系统_演示录屏.mp4 b/other/09_”航大云“新生报到系统_演示录屏.mp4 new file mode 100644 index 0000000..d66fd2f Binary files /dev/null and b/other/09_”航大云“新生报到系统_演示录屏.mp4 differ diff --git a/other/10_”航大云“新生报到系统_宣传海报.jpg b/other/10_”航大云“新生报到系统_宣传海报.jpg new file mode 100644 index 0000000..e854b8f Binary files /dev/null and b/other/10_”航大云“新生报到系统_宣传海报.jpg differ diff --git a/src/.eslintrc.js b/src/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/src/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/src/LICENSE b/src/LICENSE new file mode 100644 index 0000000..f7a2cae --- /dev/null +++ b/src/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 jwhuang + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/app.js b/src/app.js new file mode 100644 index 0000000..df2507a --- /dev/null +++ b/src/app.js @@ -0,0 +1,38 @@ +// app.js +const amapFile = require('utils/amap-wx.js'); +App({ + onLaunch() { + // 展示本地存储能力 + const logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + + // 登录 + wx.login({ + success: res => { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + } + }) + + wx.cloud.init({ + env:'cloud-travel-7gc7n4zqa50965ff', //xxx填写云开发环境id + traceUser: true + }) + + }, + globalData: { + mapInfo:"", + mapApi:"https://restapi.amap.com/v3/", + history:[], + historyRoute:[], + homePart: { + homeText: '设置一个地址', + homePoint: '' + + }, + companyPart: { + companyText: '设置一个地址', + companyPoint: '', + }, + } +}) diff --git a/src/app.json b/src/app.json new file mode 100644 index 0000000..7927d9c --- /dev/null +++ b/src/app.json @@ -0,0 +1,74 @@ +{ + "pages":[ + "pages/home/home", + "pages/my/my", + "pages/information/information", + "pages/calendar/calendar", + "pages/newslist/newslist", + "pages/details/details", + "pages/course/course", + "pages/login/login", + "pages/index/index", + "pages/logs/logs", + "pages/search/search", + "pages/nearby/nearby", + "pages/site/site", + "pages/route/route", + "pages/detail/detail", + "pages/admin/admin", + "pages/navigation/navigation", + "pages/collect/collect" + ], + "requiredPrivateInfos":[ + "getLocation", + "chooseAddress", + "onLocationChange", + "startLocationUpdate", + "startLocationUpdateBackground", + "choosePoi", + "chooseLocation" + ], + "window":{ + "backgroundTextStyle":"light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "HDY", + "navigationBarTextStyle":"black" + }, + "navigateToMiniProgramAppIdList": [ + "wxbbec65de8931cc38" + ], + "tabBar": { + "borderStyle":"black", + "selectedColor": "#00BCD4", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/home/home", + "text": "首页", + "iconPath": "/images/home.png", + "selectedIconPath": "/images/home.png" + }, + { + "pagePath": "pages/index/index", + "text": "导航", + "iconPath": "/images/navigate.png", + "selectedIconPath": "/images/navigate.png" + }, + { + "pagePath": "pages/my/my", + "text": "个人中心", + "iconPath": "/images/my.png", + "selectedIconPath": "images/my.png" + } + ] + }, + "style": "v2", + "sitemapLocation": "sitemap.json", + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + } +} + + diff --git a/src/app.wxss b/src/app.wxss new file mode 100644 index 0000000..06c6fc9 --- /dev/null +++ b/src/app.wxss @@ -0,0 +1,10 @@ +/**app.wxss**/ +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 200rpx 0; + box-sizing: border-box; +} diff --git a/src/image/admin.png b/src/image/admin.png new file mode 100644 index 0000000..8582bcf Binary files /dev/null and b/src/image/admin.png differ diff --git a/src/image/arrow.png b/src/image/arrow.png new file mode 100644 index 0000000..8928b16 Binary files /dev/null and b/src/image/arrow.png differ diff --git a/src/image/arrow0.png b/src/image/arrow0.png new file mode 100644 index 0000000..ba71d7f Binary files /dev/null and b/src/image/arrow0.png differ diff --git a/src/image/arrow1.png b/src/image/arrow1.png new file mode 100644 index 0000000..6955cd2 Binary files /dev/null and b/src/image/arrow1.png differ diff --git a/src/image/bank.jpg b/src/image/bank.jpg new file mode 100644 index 0000000..9603e7f Binary files /dev/null and b/src/image/bank.jpg differ diff --git a/src/image/bathing.jpg b/src/image/bathing.jpg new file mode 100644 index 0000000..f9ff9d3 Binary files /dev/null and b/src/image/bathing.jpg differ diff --git a/src/image/company.png b/src/image/company.png new file mode 100644 index 0000000..49ff233 Binary files /dev/null and b/src/image/company.png differ diff --git a/src/image/drive.png b/src/image/drive.png new file mode 100644 index 0000000..8f7c30b Binary files /dev/null and b/src/image/drive.png differ diff --git a/src/image/endpoint.png b/src/image/endpoint.png new file mode 100644 index 0000000..4b9ed6c Binary files /dev/null and b/src/image/endpoint.png differ diff --git a/src/image/endpoint0.png b/src/image/endpoint0.png new file mode 100644 index 0000000..54dc1ad Binary files /dev/null and b/src/image/endpoint0.png differ diff --git a/src/image/exchange.png b/src/image/exchange.png new file mode 100644 index 0000000..fc4b80b Binary files /dev/null and b/src/image/exchange.png differ diff --git a/src/image/fangda.png b/src/image/fangda.png new file mode 100644 index 0000000..e668586 Binary files /dev/null and b/src/image/fangda.png differ diff --git a/src/image/flower.png b/src/image/flower.png new file mode 100644 index 0000000..f7c5186 Binary files /dev/null and b/src/image/flower.png differ diff --git a/src/image/food.jpg b/src/image/food.jpg new file mode 100644 index 0000000..01903cd Binary files /dev/null and b/src/image/food.jpg differ diff --git a/src/image/gantan.png b/src/image/gantan.png new file mode 100644 index 0000000..6a9f907 Binary files /dev/null and b/src/image/gantan.png differ diff --git a/src/image/goto.png b/src/image/goto.png new file mode 100644 index 0000000..09347d9 Binary files /dev/null and b/src/image/goto.png differ diff --git a/src/image/home.png b/src/image/home.png new file mode 100644 index 0000000..142b7c6 Binary files /dev/null and b/src/image/home.png differ diff --git a/src/image/hotel.jpg b/src/image/hotel.jpg new file mode 100644 index 0000000..4eb304c Binary files /dev/null and b/src/image/hotel.jpg differ diff --git a/src/image/lishi.png b/src/image/lishi.png new file mode 100644 index 0000000..8488af9 Binary files /dev/null and b/src/image/lishi.png differ diff --git a/src/image/loadline.png b/src/image/loadline.png new file mode 100644 index 0000000..b8fae26 Binary files /dev/null and b/src/image/loadline.png differ diff --git a/src/image/location.png b/src/image/location.png new file mode 100644 index 0000000..b9e731e Binary files /dev/null and b/src/image/location.png differ diff --git a/src/image/logo.png b/src/image/logo.png new file mode 100644 index 0000000..d5a9def Binary files /dev/null and b/src/image/logo.png differ diff --git a/src/image/menu.png b/src/image/menu.png new file mode 100644 index 0000000..6b0095f Binary files /dev/null and b/src/image/menu.png differ diff --git a/src/image/metro.jpg b/src/image/metro.jpg new file mode 100644 index 0000000..a03edfc Binary files /dev/null and b/src/image/metro.jpg differ diff --git a/src/image/more.jpg b/src/image/more.jpg new file mode 100644 index 0000000..29d57f9 Binary files /dev/null and b/src/image/more.jpg differ diff --git a/src/image/movie.jpg b/src/image/movie.jpg new file mode 100644 index 0000000..246d126 Binary files /dev/null and b/src/image/movie.jpg differ diff --git a/src/image/nophoto.jpg b/src/image/nophoto.jpg new file mode 100644 index 0000000..a967010 Binary files /dev/null and b/src/image/nophoto.jpg differ diff --git a/src/image/rest.png b/src/image/rest.png new file mode 100644 index 0000000..5f6afdd Binary files /dev/null and b/src/image/rest.png differ diff --git a/src/image/route0.png b/src/image/route0.png new file mode 100644 index 0000000..8f7c30b Binary files /dev/null and b/src/image/route0.png differ diff --git a/src/image/route1.png b/src/image/route1.png new file mode 100644 index 0000000..94b51a0 Binary files /dev/null and b/src/image/route1.png differ diff --git a/src/image/route2.png b/src/image/route2.png new file mode 100644 index 0000000..8fe95e1 Binary files /dev/null and b/src/image/route2.png differ diff --git a/src/image/route3.png b/src/image/route3.png new file mode 100644 index 0000000..a8c97f6 Binary files /dev/null and b/src/image/route3.png differ diff --git a/src/image/share.png b/src/image/share.png new file mode 100644 index 0000000..c1197bb Binary files /dev/null and b/src/image/share.png differ diff --git a/src/image/spot.jpg b/src/image/spot.jpg new file mode 100644 index 0000000..cebc232 Binary files /dev/null and b/src/image/spot.jpg differ diff --git a/src/image/start-end.png b/src/image/start-end.png new file mode 100644 index 0000000..e06d905 Binary files /dev/null and b/src/image/start-end.png differ diff --git a/src/image/startpoint.png b/src/image/startpoint.png new file mode 100644 index 0000000..27ed2d0 Binary files /dev/null and b/src/image/startpoint.png differ diff --git a/src/image/startpoint0.png b/src/image/startpoint0.png new file mode 100644 index 0000000..3ae930b Binary files /dev/null and b/src/image/startpoint0.png differ diff --git a/src/image/step1.jpg b/src/image/step1.jpg new file mode 100644 index 0000000..6f68731 Binary files /dev/null and b/src/image/step1.jpg differ diff --git a/src/image/step2.jpg b/src/image/step2.jpg new file mode 100644 index 0000000..bfcc67f Binary files /dev/null and b/src/image/step2.jpg differ diff --git a/src/image/submit.png b/src/image/submit.png new file mode 100644 index 0000000..3631a4d Binary files /dev/null and b/src/image/submit.png differ diff --git a/src/image/supermarket.jpg b/src/image/supermarket.jpg new file mode 100644 index 0000000..506e67d Binary files /dev/null and b/src/image/supermarket.jpg differ diff --git a/src/image/transit.jpg b/src/image/transit.jpg new file mode 100644 index 0000000..c0c822b Binary files /dev/null and b/src/image/transit.jpg differ diff --git a/src/image/wx_logo.png b/src/image/wx_logo.png new file mode 100644 index 0000000..37d80d1 Binary files /dev/null and b/src/image/wx_logo.png differ diff --git a/src/images/1.jpeg b/src/images/1.jpeg new file mode 100644 index 0000000..7a97f56 Binary files /dev/null and b/src/images/1.jpeg differ diff --git a/src/images/2.jpeg b/src/images/2.jpeg new file mode 100644 index 0000000..c6360d9 Binary files /dev/null and b/src/images/2.jpeg differ diff --git a/src/images/3.jpeg b/src/images/3.jpeg new file mode 100644 index 0000000..0011877 Binary files /dev/null and b/src/images/3.jpeg differ diff --git a/src/images/4.jpeg b/src/images/4.jpeg new file mode 100644 index 0000000..08edbc3 Binary files /dev/null and b/src/images/4.jpeg differ diff --git a/src/images/Monday.png b/src/images/Monday.png new file mode 100644 index 0000000..086c1b7 Binary files /dev/null and b/src/images/Monday.png differ diff --git a/src/images/chat.png b/src/images/chat.png new file mode 100644 index 0000000..590b4d7 Binary files /dev/null and b/src/images/chat.png differ diff --git a/src/images/course.png b/src/images/course.png new file mode 100644 index 0000000..84dc3a0 Binary files /dev/null and b/src/images/course.png differ diff --git a/src/images/home.png b/src/images/home.png new file mode 100644 index 0000000..a2132e4 Binary files /dev/null and b/src/images/home.png differ diff --git a/src/images/my.png b/src/images/my.png new file mode 100644 index 0000000..4ce305e Binary files /dev/null and b/src/images/my.png differ diff --git a/src/images/navigate.png b/src/images/navigate.png new file mode 100644 index 0000000..90fe816 Binary files /dev/null and b/src/images/navigate.png differ diff --git a/src/images/notice.png b/src/images/notice.png new file mode 100644 index 0000000..ad2b796 Binary files /dev/null and b/src/images/notice.png differ diff --git a/src/images/schedule.png b/src/images/schedule.png new file mode 100644 index 0000000..83281c3 Binary files /dev/null and b/src/images/schedule.png differ diff --git a/src/images/star.png b/src/images/star.png new file mode 100644 index 0000000..ae8e208 Binary files /dev/null and b/src/images/star.png differ diff --git a/src/miniprogram_npm/@vant/weapp/action-sheet/index.js b/src/miniprogram_npm/@vant/weapp/action-sheet/index.js new file mode 100644 index 0000000..a9e4b07 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/action-sheet/index.js @@ -0,0 +1,64 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var button_1 = require('../mixins/button'); +var open_type_1 = require('../mixins/open-type'); +component_1.VantComponent({ + mixins: [button_1.button, open_type_1.openType], + props: { + show: Boolean, + title: String, + cancelText: String, + description: String, + round: { + type: Boolean, + value: true, + }, + zIndex: { + type: Number, + value: 100, + }, + actions: { + type: Array, + value: [], + }, + overlay: { + type: Boolean, + value: true, + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + }, + closeOnClickAction: { + type: Boolean, + value: true, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + }, + methods: { + onSelect: function (event) { + var index = event.currentTarget.dataset.index; + var item = this.data.actions[index]; + if (item && !item.disabled && !item.loading) { + this.$emit('select', item); + if (this.data.closeOnClickAction) { + this.onClose(); + } + } + }, + onCancel: function () { + this.$emit('cancel'); + }, + onClose: function () { + this.$emit('close'); + }, + onClickOverlay: function () { + this.$emit('click-overlay'); + this.onClose(); + }, + }, +}); diff --git a/src/miniprogram_npm/@vant/weapp/action-sheet/index.json b/src/miniprogram_npm/@vant/weapp/action-sheet/index.json new file mode 100644 index 0000000..19bf989 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/action-sheet/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-popup": "../popup/index", + "van-loading": "../loading/index" + } +} diff --git a/src/miniprogram_npm/@vant/weapp/action-sheet/index.wxml b/src/miniprogram_npm/@vant/weapp/action-sheet/index.wxml new file mode 100644 index 0000000..7ed2819 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/action-sheet/index.wxml @@ -0,0 +1,67 @@ + + + + + {{ title }} + + + + {{ description }} + + + + + + + + {{ cancelText }} + + diff --git a/src/miniprogram_npm/@vant/weapp/action-sheet/index.wxss b/src/miniprogram_npm/@vant/weapp/action-sheet/index.wxss new file mode 100644 index 0000000..dc54840 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/action-sheet/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;max-height:var(--action-sheet-max-height,90%)!important;color:#323233;color:var(--action-sheet-item-text-color,#323233)}.van-action-sheet__cancel,.van-action-sheet__item{text-align:center;font-size:16px;font-size:var(--action-sheet-item-font-size,16px);line-height:50px;line-height:var(--action-sheet-item-height,50px);background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel:before{display:block;content:" ";height:8px;height:var(--action-sheet-cancel-padding-top,8px);background-color:#f7f8fa;background-color:var(--action-sheet-cancel-padding-color,#f7f8fa)}.van-action-sheet__item--disabled{color:#c8c9cc;color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{margin-left:4px;margin-left:var(--padding-base,4px);font-size:12px;font-size:var(--action-sheet-subname-font-size,12px);color:#646566;color:var(--action-sheet-subname-color,#646566)}.van-action-sheet__header{text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--action-sheet-header-font-size,16px);line-height:44px;line-height:var(--action-sheet-header-height,44px)}.van-action-sheet__description{text-align:center;padding:16px;padding:var(--padding-md,16px);color:#646566;color:var(--action-sheet-description-color,#646566);font-size:14px;font-size:var(--action-sheet-description-font-size,14px);line-height:20px;line-height:var(--action-sheet-description-line-height,20px)}.van-action-sheet__close{position:absolute!important;top:0;right:0;line-height:inherit!important;padding:0 12px;padding:var(--action-sheet-close-icon-padding,0 12px);font-size:18px!important;font-size:var(--action-sheet-close-icon-size,18px)!important;color:#969799;color:var(--action-sheet-close-icon-color,#969799)}.van-action-sheet__loading{display:-webkit-flex!important;display:flex!important;height:50px;height:var(--action-sheet-item-height,50px)} \ No newline at end of file diff --git a/src/miniprogram_npm/@vant/weapp/area/index.js b/src/miniprogram_npm/@vant/weapp/area/index.js new file mode 100644 index 0000000..ed80e4c --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/area/index.js @@ -0,0 +1,257 @@ +'use strict'; +var __assign = + (this && this.__assign) || + function () { + __assign = + Object.assign || + function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var shared_1 = require('../picker/shared'); +var COLUMNSPLACEHOLDERCODE = '000000'; +component_1.VantComponent({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: __assign(__assign({}, shared_1.pickerProps), { + value: { + type: String, + observer: function (value) { + this.code = value; + this.setValues(); + }, + }, + areaList: { + type: Object, + value: {}, + observer: 'setValues', + }, + columnsNum: { + type: null, + value: 3, + observer: function (value) { + this.setData({ + displayColumns: this.data.columns.slice(0, +value), + }); + }, + }, + columnsPlaceholder: { + type: Array, + observer: function (val) { + this.setData({ + typeToColumnsPlaceholder: { + province: val[0] || '', + city: val[1] || '', + county: val[2] || '', + }, + }); + }, + }, + }), + data: { + columns: [{ values: [] }, { values: [] }, { values: [] }], + displayColumns: [{ values: [] }, { values: [] }, { values: [] }], + typeToColumnsPlaceholder: {}, + }, + mounted: function () { + var _this = this; + setTimeout(function () { + _this.setValues(); + }, 0); + }, + methods: { + getPicker: function () { + if (this.picker == null) { + this.picker = this.selectComponent('.van-area__picker'); + } + return this.picker; + }, + onCancel: function (event) { + this.emit('cancel', event.detail); + }, + onConfirm: function (event) { + var index = event.detail.index; + var value = event.detail.value; + value = this.parseOutputValues(value); + this.emit('confirm', { value: value, index: index }); + }, + emit: function (type, detail) { + detail.values = detail.value; + delete detail.value; + this.$emit(type, detail); + }, + // parse output columns data + parseOutputValues: function (values) { + var columnsPlaceholder = this.data.columnsPlaceholder; + return values.map(function (value, index) { + // save undefined value + if (!value) return value; + value = JSON.parse(JSON.stringify(value)); + if (!value.code || value.name === columnsPlaceholder[index]) { + value.code = ''; + value.name = ''; + } + return value; + }); + }, + onChange: function (event) { + var _this = this; + var _a = event.detail, + index = _a.index, + picker = _a.picker, + value = _a.value; + this.code = value[index].code; + this.setValues().then(function () { + _this.$emit('change', { + picker: picker, + values: _this.parseOutputValues(picker.getValues()), + index: index, + }); + }); + }, + getConfig: function (type) { + var areaList = this.data.areaList; + return (areaList && areaList[type + '_list']) || {}; + }, + getList: function (type, code) { + var typeToColumnsPlaceholder = this.data.typeToColumnsPlaceholder; + var result = []; + if (type !== 'province' && !code) { + return result; + } + var list = this.getConfig(type); + result = Object.keys(list).map(function (code) { + return { + code: code, + name: list[code], + }; + }); + if (code) { + // oversea code + if (code[0] === '9' && type === 'city') { + code = '9'; + } + result = result.filter(function (item) { + return item.code.indexOf(code) === 0; + }); + } + if (typeToColumnsPlaceholder[type] && result.length) { + // set columns placeholder + var codeFill = + type === 'province' + ? '' + : type === 'city' + ? COLUMNSPLACEHOLDERCODE.slice(2, 4) + : COLUMNSPLACEHOLDERCODE.slice(4, 6); + result.unshift({ + code: '' + code + codeFill, + name: typeToColumnsPlaceholder[type], + }); + } + return result; + }, + getIndex: function (type, code) { + var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6; + var list = this.getList(type, code.slice(0, compareNum - 2)); + // oversea code + if (code[0] === '9' && type === 'province') { + compareNum = 1; + } + code = code.slice(0, compareNum); + for (var i = 0; i < list.length; i++) { + if (list[i].code.slice(0, compareNum) === code) { + return i; + } + } + return 0; + }, + setValues: function () { + var _this = this; + var county = this.getConfig('county'); + var code = this.code; + if (!code) { + if (this.data.columnsPlaceholder.length) { + code = COLUMNSPLACEHOLDERCODE; + } else if (Object.keys(county)[0]) { + code = Object.keys(county)[0]; + } else { + code = ''; + } + } + var province = this.getList('province'); + var city = this.getList('city', code.slice(0, 2)); + var picker = this.getPicker(); + if (!picker) { + return; + } + var stack = []; + stack.push(picker.setColumnValues(0, province, false)); + stack.push(picker.setColumnValues(1, city, false)); + if (city.length && code.slice(2, 4) === '00') { + code = city[0].code; + } + stack.push( + picker.setColumnValues( + 2, + this.getList('county', code.slice(0, 4)), + false + ) + ); + return Promise.all(stack) + .catch(function () {}) + .then(function () { + return picker.setIndexes([ + _this.getIndex('province', code), + _this.getIndex('city', code), + _this.getIndex('county', code), + ]); + }) + .catch(function () {}); + }, + getValues: function () { + var picker = this.getPicker(); + return picker + ? picker.getValues().filter(function (value) { + return !!value; + }) + : []; + }, + getDetail: function () { + var values = this.getValues(); + var area = { + code: '', + country: '', + province: '', + city: '', + county: '', + }; + if (!values.length) { + return area; + } + var names = values.map(function (item) { + return item.name; + }); + area.code = values[values.length - 1].code; + if (area.code[0] === '9') { + area.country = names[1] || ''; + area.province = names[2] || ''; + } else { + area.province = names[0] || ''; + area.city = names[1] || ''; + area.county = names[2] || ''; + } + return area; + }, + reset: function (code) { + this.code = code || ''; + return this.setValues(); + }, + }, +}); diff --git a/src/miniprogram_npm/@vant/weapp/area/index.json b/src/miniprogram_npm/@vant/weapp/area/index.json new file mode 100644 index 0000000..a778e91 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/area/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-picker": "../picker/index" + } +} diff --git a/src/miniprogram_npm/@vant/weapp/area/index.wxml b/src/miniprogram_npm/@vant/weapp/area/index.wxml new file mode 100644 index 0000000..6075794 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/area/index.wxml @@ -0,0 +1,18 @@ + diff --git a/src/miniprogram_npm/@vant/weapp/area/index.wxss b/src/miniprogram_npm/@vant/weapp/area/index.wxss new file mode 100644 index 0000000..99694d6 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/area/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/src/miniprogram_npm/@vant/weapp/button/index.js b/src/miniprogram_npm/@vant/weapp/button/index.js new file mode 100644 index 0000000..d38d35d --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/button/index.js @@ -0,0 +1,81 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var button_1 = require('../mixins/button'); +var open_type_1 = require('../mixins/open-type'); +var version_1 = require('../common/version'); +var mixins = [button_1.button, open_type_1.openType]; +if (version_1.canIUseFormFieldButton()) { + mixins.push('wx://form-field-button'); +} +component_1.VantComponent({ + mixins: mixins, + classes: ['hover-class', 'loading-class'], + data: { + baseStyle: '', + }, + props: { + formType: String, + icon: String, + classPrefix: { + type: String, + value: 'van-icon', + }, + plain: Boolean, + block: Boolean, + round: Boolean, + square: Boolean, + loading: Boolean, + hairline: Boolean, + disabled: Boolean, + loadingText: String, + customStyle: String, + loadingType: { + type: String, + value: 'circular', + }, + type: { + type: String, + value: 'default', + }, + dataset: null, + size: { + type: String, + value: 'normal', + }, + loadingSize: { + type: String, + value: '20px', + }, + color: { + type: String, + observer: function (color) { + var style = ''; + if (color) { + style += 'color: ' + (this.data.plain ? color : 'white') + ';'; + if (!this.data.plain) { + // Use background instead of backgroundColor to make linear-gradient work + style += 'background: ' + color + ';'; + } + // hide border when color is linear-gradient + if (color.indexOf('gradient') !== -1) { + style += 'border: 0;'; + } else { + style += 'border-color: ' + color + ';'; + } + } + if (style !== this.data.baseStyle) { + this.setData({ baseStyle: style }); + } + }, + }, + }, + methods: { + onClick: function () { + if (!this.data.loading) { + this.$emit('click'); + } + }, + noop: function () {}, + }, +}); diff --git a/src/miniprogram_npm/@vant/weapp/button/index.json b/src/miniprogram_npm/@vant/weapp/button/index.json new file mode 100644 index 0000000..e00a588 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/button/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index" + } +} diff --git a/src/miniprogram_npm/@vant/weapp/button/index.wxml b/src/miniprogram_npm/@vant/weapp/button/index.wxml new file mode 100644 index 0000000..ab393e8 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/button/index.wxml @@ -0,0 +1,68 @@ + + + + + + +function get(type, color,plain) { + if(plain) { + return color ? color: '#c9c9c9'; + } + + if(type === 'default') { + return '#c9c9c9'; + } + return 'white'; +} + +module.exports = get; + diff --git a/src/miniprogram_npm/@vant/weapp/button/index.wxss b/src/miniprogram_npm/@vant/weapp/button/index.wxss new file mode 100644 index 0000000..5a591fb --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/button/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-button{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:0;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%;height:44px;height:var(--button-default-height,44px);line-height:20px;line-height:var(--button-line-height,20px);font-size:16px;font-size:var(--button-default-font-size,16px);transition:opacity .2s;transition:opacity var(--animation-duration-fast,.2s);border-radius:2px;border-radius:var(--button-border-radius,2px)}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);opacity:0;content:" ";background-color:#000;background-color:var(--black,#000);border-color:#000;border-color:var(--black,#000)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#323233;color:var(--button-default-color,#323233);background:#fff;background:var(--button-default-background-color,#fff);border:1px solid #ebedf0;border:var(--button-border-width,1px) solid var(--button-default-border-color,#ebedf0)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background:#07c160;background:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:var(--button-border-width,1px) solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background:#1989fa;background:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:var(--button-border-width,1px) solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background:#ee0a24;background:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:var(--button-border-width,1px) solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background:#ff976a;background:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:var(--button-border-width,1px) solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background:#fff;background:var(--button-plain-background-color,#fff)}.van-button--plain.van-button--primary{color:#07c160;color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:#1989fa;color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:#ee0a24;color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:#ff976a;color:var(--button-warning-background-color,#ff976a)}.van-button--large{width:100%;height:50px;height:var(--button-large-height,50px)}.van-button--normal{padding:0 15px;font-size:14px;font-size:var(--button-normal-font-size,14px)}.van-button--small{min-width:60px;min-width:var(--button-small-min-width,60px);height:30px;height:var(--button-small-height,30px);padding:0 8px;padding:0 var(--padding-xs,8px);font-size:12px;font-size:var(--button-small-font-size,12px)}.van-button--mini{display:inline-block;min-width:50px;min-width:var(--button-mini-min-width,50px);height:22px;height:var(--button-mini-height,22px);font-size:10px;font-size:var(--button-mini-font-size,10px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:-webkit-flex;display:flex;width:100%}.van-button--round{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5;opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{min-width:1em;line-height:inherit!important;vertical-align:top}.van-button--hairline{padding-top:1px;border-width:0}.van-button--hairline:after{border-color:inherit;border-width:1px;border-radius:4px;border-radius:calc(var(--button-border-radius, 2px)*2)}.van-button--hairline.van-button--round:after{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0} \ No newline at end of file diff --git a/src/miniprogram_npm/@vant/weapp/calendar/calendar.wxml b/src/miniprogram_npm/@vant/weapp/calendar/calendar.wxml new file mode 100644 index 0000000..09a60b3 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/calendar.wxml @@ -0,0 +1,57 @@ + + + diff --git a/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.js b/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.js new file mode 100644 index 0000000..cf725ae --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.js @@ -0,0 +1,18 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../../../common/component'); +component_1.VantComponent({ + props: { + title: { + type: String, + value: '日期选择', + }, + subtitle: String, + showTitle: Boolean, + showSubtitle: Boolean, + }, + data: { + weekdays: ['日', '一', '二', '三', '四', '五', '六'], + }, + methods: {}, +}); diff --git a/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.json b/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml b/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml new file mode 100644 index 0000000..eb8e4b4 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxml @@ -0,0 +1,16 @@ + + + + {{ title }} + + + + {{ subtitle }} + + + + + {{ item }} + + + diff --git a/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss b/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss new file mode 100644 index 0000000..4075e48 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/components/header/index.wxss @@ -0,0 +1 @@ +@import '../../../common/index.wxss';.van-calendar__header{-webkit-flex-shrink:0;flex-shrink:0;box-shadow:0 2px 10px rgba(125,126,128,.16);box-shadow:var(--calendar-header-box-shadow,0 2px 10px rgba(125,126,128,.16))}.van-calendar__header-subtitle,.van-calendar__header-title{text-align:center;height:44px;height:var(--calendar-header-title-height,44px);font-weight:500;font-weight:var(--font-weight-bold,500);line-height:44px;line-height:var(--calendar-header-title-height,44px)}.van-calendar__header-title+.van-calendar__header-title,.van-calendar__header-title:empty{display:none}.van-calendar__header-title:empty+.van-calendar__header-title{display:block!important}.van-calendar__weekdays{display:-webkit-flex;display:flex}.van-calendar__weekday{-webkit-flex:1;flex:1;text-align:center;font-size:12px;font-size:var(--calendar-weekdays-font-size,12px);line-height:30px;line-height:var(--calendar-weekdays-height,30px)} \ No newline at end of file diff --git a/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.js b/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.js new file mode 100644 index 0000000..1950c6c --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.js @@ -0,0 +1,167 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../../../common/component'); +var utils_1 = require('../../utils'); +component_1.VantComponent({ + props: { + date: { + type: null, + observer: 'setDays', + }, + type: { + type: String, + observer: 'setDays', + }, + color: String, + minDate: { + type: null, + observer: 'setDays', + }, + maxDate: { + type: null, + observer: 'setDays', + }, + showMark: Boolean, + rowHeight: [Number, String], + formatter: { + type: null, + observer: 'setDays', + }, + currentDate: { + type: [null, Array], + observer: 'setDays', + }, + allowSameDay: Boolean, + showSubtitle: Boolean, + showMonthTitle: Boolean, + }, + data: { + visible: true, + days: [], + }, + methods: { + onClick: function (event) { + var index = event.currentTarget.dataset.index; + var item = this.data.days[index]; + if (item.type !== 'disabled') { + this.$emit('click', item); + } + }, + setDays: function () { + var days = []; + var startDate = new Date(this.data.date); + var year = startDate.getFullYear(); + var month = startDate.getMonth(); + var totalDay = utils_1.getMonthEndDay( + startDate.getFullYear(), + startDate.getMonth() + 1 + ); + for (var day = 1; day <= totalDay; day++) { + var date = new Date(year, month, day); + var type = this.getDayType(date); + var config = { + date: date, + type: type, + text: day, + bottomInfo: this.getBottomInfo(type), + }; + if (this.data.formatter) { + config = this.data.formatter(config); + } + days.push(config); + } + this.setData({ days: days }); + }, + getMultipleDayType: function (day) { + var currentDate = this.data.currentDate; + if (!Array.isArray(currentDate)) { + return ''; + } + var isSelected = function (date) { + return currentDate.some(function (item) { + return utils_1.compareDay(item, date) === 0; + }); + }; + if (isSelected(day)) { + var prevDay = utils_1.getPrevDay(day); + var nextDay = utils_1.getNextDay(day); + var prevSelected = isSelected(prevDay); + var nextSelected = isSelected(nextDay); + if (prevSelected && nextSelected) { + return 'multiple-middle'; + } + if (prevSelected) { + return 'end'; + } + return nextSelected ? 'start' : 'multiple-selected'; + } + return ''; + }, + getRangeDayType: function (day) { + var _a = this.data, + currentDate = _a.currentDate, + allowSameDay = _a.allowSameDay; + if (!Array.isArray(currentDate)) { + return; + } + var startDay = currentDate[0], + endDay = currentDate[1]; + if (!startDay) { + return; + } + var compareToStart = utils_1.compareDay(day, startDay); + if (!endDay) { + return compareToStart === 0 ? 'start' : ''; + } + var compareToEnd = utils_1.compareDay(day, endDay); + if (compareToStart === 0 && compareToEnd === 0 && allowSameDay) { + return 'start-end'; + } + if (compareToStart === 0) { + return 'start'; + } + if (compareToEnd === 0) { + return 'end'; + } + if (compareToStart > 0 && compareToEnd < 0) { + return 'middle'; + } + }, + getDayType: function (day) { + var _a = this.data, + type = _a.type, + minDate = _a.minDate, + maxDate = _a.maxDate, + currentDate = _a.currentDate; + if ( + utils_1.compareDay(day, minDate) < 0 || + utils_1.compareDay(day, maxDate) > 0 + ) { + return 'disabled'; + } + if (type === 'single') { + return utils_1.compareDay(day, currentDate) === 0 ? 'selected' : ''; + } + if (type === 'multiple') { + return this.getMultipleDayType(day); + } + /* istanbul ignore else */ + if (type === 'range') { + return this.getRangeDayType(day); + } + }, + getBottomInfo: function (type) { + if (this.data.type === 'range') { + if (type === 'start') { + return '开始'; + } + if (type === 'end') { + return '结束'; + } + if (type === 'start-end') { + return '开始/结束'; + } + } + }, + }, +}); diff --git a/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.json b/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml b/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml new file mode 100644 index 0000000..55bab83 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxml @@ -0,0 +1,39 @@ + + + + + + {{ computed.formatMonthTitle(date) }} + + + + + {{ computed.getMark(date) }} + + + + + {{ item.topInfo }} + {{ item.text }} + + {{ item.bottomInfo }} + + + + + {{ item.topInfo }} + {{ item.text }} + + {{ item.bottomInfo }} + + + + + diff --git a/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs b/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs new file mode 100644 index 0000000..a057079 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxs @@ -0,0 +1,67 @@ +/* eslint-disable */ +var utils = require('../../utils.wxs'); + +function getMark(date) { + return getDate(date).getMonth() + 1; +} + +var ROW_HEIGHT = 64; + +function getDayStyle(type, index, date, rowHeight, color) { + var style = []; + var offset = getDate(date).getDay(); + + if (index === 0) { + style.push(['margin-left', (100 * offset) / 7 + '%']); + } + + if (rowHeight !== ROW_HEIGHT) { + style.push(['height', rowHeight + 'px']); + } + + if (color) { + if ( + type === 'start' || + type === 'end' || + type === 'multiple-selected' || + type === 'multiple-middle' + ) { + style.push(['background', color]); + } else if (type === 'middle') { + style.push(['color', color]); + } + } + + return style + .map(function(item) { + return item.join(':'); + }) + .join(';'); +} + +function formatMonthTitle(date) { + date = getDate(date); + return date.getFullYear() + '年' + (date.getMonth() + 1) + '月'; +} + +function getMonthStyle(visible, date, rowHeight) { + if (!visible) { + date = getDate(date); + + var totalDay = utils.getMonthEndDay( + date.getFullYear(), + date.getMonth() + 1 + ); + var offset = getDate(date).getDay(); + var padding = Math.ceil((totalDay + offset) / 7) * rowHeight; + + return 'padding-bottom:' + padding + 'px'; + } +} + +module.exports = { + getMark: getMark, + getDayStyle: getDayStyle, + formatMonthTitle: formatMonthTitle, + getMonthStyle: getMonthStyle +}; diff --git a/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss b/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss new file mode 100644 index 0000000..17c12f4 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/components/month/index.wxss @@ -0,0 +1 @@ +@import '../../../common/index.wxss';.van-calendar{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;height:100%;background-color:#fff;background-color:var(--calendar-background-color,#fff)}.van-calendar__month-title{text-align:center;height:44px;height:var(--calendar-header-title-height,44px);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:14px;font-size:var(--calendar-month-title-font-size,14px);line-height:44px;line-height:var(--calendar-header-title-height,44px)}.van-calendar__days{position:relative;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-webkit-user-select:none;user-select:none}.van-calendar__month-mark{position:absolute;top:50%;left:50%;z-index:0;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);pointer-events:none;color:rgba(242,243,245,.8);color:var(--calendar-month-mark-color,rgba(242,243,245,.8));font-size:160px;font-size:var(--calendar-month-mark-font-size,160px)}.van-calendar__day,.van-calendar__selected-day{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;text-align:center}.van-calendar__day{position:relative;width:14.285%;height:64px;height:var(--calendar-day-height,64px);font-size:16px;font-size:var(--calendar-day-font-size,16px)}.van-calendar__day--end,.van-calendar__day--multiple-middle,.van-calendar__day--multiple-selected,.van-calendar__day--start,.van-calendar__day--start-end{color:#fff;color:var(--calendar-range-edge-color,#fff);background-color:#ee0a24;background-color:var(--calendar-range-edge-background-color,#ee0a24)}.van-calendar__day--start{border-radius:4px 0 0 4px;border-radius:var(--border-radius-md,4px) 0 0 var(--border-radius-md,4px)}.van-calendar__day--end{border-radius:0 4px 4px 0;border-radius:0 var(--border-radius-md,4px) var(--border-radius-md,4px) 0}.van-calendar__day--multiple-selected,.van-calendar__day--start-end{border-radius:4px;border-radius:var(--border-radius-md,4px)}.van-calendar__day--middle{color:#ee0a24;color:var(--calendar-range-middle-color,#ee0a24)}.van-calendar__day--middle:after{position:absolute;top:0;right:0;bottom:0;left:0;background-color:currentColor;content:"";opacity:.1;opacity:var(--calendar-range-middle-background-opacity,.1)}.van-calendar__day--disabled{cursor:default;color:#c8c9cc;color:var(--calendar-day-disabled-color,#c8c9cc)}.van-calendar__bottom-info,.van-calendar__top-info{position:absolute;right:0;left:0;font-size:10px;font-size:var(--calendar-info-font-size,10px);line-height:14px;line-height:var(--calendar-info-line-height,14px)}@media (max-width:350px){.van-calendar__bottom-info,.van-calendar__top-info{font-size:9px}}.van-calendar__top-info{top:6px}.van-calendar__bottom-info{bottom:6px}.van-calendar__selected-day{width:54px;width:var(--calendar-selected-day-size,54px);height:54px;height:var(--calendar-selected-day-size,54px);color:#fff;color:var(--calendar-selected-day-color,#fff);background-color:#ee0a24;background-color:var(--calendar-selected-day-background-color,#ee0a24);border-radius:4px;border-radius:var(--border-radius-md,4px)} \ No newline at end of file diff --git a/src/miniprogram_npm/@vant/weapp/calendar/index.js b/src/miniprogram_npm/@vant/weapp/calendar/index.js new file mode 100644 index 0000000..e2b2ce1 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/index.js @@ -0,0 +1,318 @@ +'use strict'; +var __spreadArrays = + (this && this.__spreadArrays) || + function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) + s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; +var __importDefault = + (this && this.__importDefault) || + function (mod) { + return mod && mod.__esModule ? mod : { default: mod }; + }; +Object.defineProperty(exports, '__esModule', { value: true }); +var component_1 = require('../common/component'); +var utils_1 = require('./utils'); +var toast_1 = __importDefault(require('../toast/toast')); +component_1.VantComponent({ + props: { + title: { + type: String, + value: '日期选择', + }, + color: String, + show: { + type: Boolean, + observer: function (val) { + if (val) { + this.initRect(); + this.scrollIntoView(); + } + }, + }, + formatter: null, + confirmText: { + type: String, + value: '确定', + }, + rangePrompt: String, + defaultDate: { + type: [Number, Array], + observer: function (val) { + this.setData({ currentDate: val }); + this.scrollIntoView(); + }, + }, + allowSameDay: Boolean, + confirmDisabledText: String, + type: { + type: String, + value: 'single', + observer: 'reset', + }, + minDate: { + type: null, + value: Date.now(), + }, + maxDate: { + type: null, + value: new Date( + new Date().getFullYear(), + new Date().getMonth() + 6, + new Date().getDate() + ).getTime(), + }, + position: { + type: String, + value: 'bottom', + }, + rowHeight: { + type: [Number, String], + value: utils_1.ROW_HEIGHT, + }, + round: { + type: Boolean, + value: true, + }, + poppable: { + type: Boolean, + value: true, + }, + showMark: { + type: Boolean, + value: true, + }, + showTitle: { + type: Boolean, + value: true, + }, + showConfirm: { + type: Boolean, + value: true, + }, + showSubtitle: { + type: Boolean, + value: true, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + }, + maxRange: { + type: [Number, String], + value: null, + }, + }, + data: { + subtitle: '', + currentDate: null, + scrollIntoView: '', + }, + created: function () { + this.setData({ + currentDate: this.getInitialDate(), + }); + }, + mounted: function () { + if (this.data.show || !this.data.poppable) { + this.initRect(); + this.scrollIntoView(); + } + }, + methods: { + reset: function () { + this.setData({ currentDate: this.getInitialDate() }); + this.scrollIntoView(); + }, + initRect: function () { + var _this = this; + if (this.contentObserver != null) { + this.contentObserver.disconnect(); + } + var contentObserver = this.createIntersectionObserver({ + thresholds: [0, 0.1, 0.9, 1], + observeAll: true, + }); + this.contentObserver = contentObserver; + contentObserver.relativeTo('.van-calendar__body'); + contentObserver.observe('.month', function (res) { + if (res.boundingClientRect.top <= res.relativeRect.top) { + // @ts-ignore + _this.setData({ + subtitle: utils_1.formatMonthTitle(res.dataset.date), + }); + } + }); + }, + getInitialDate: function () { + var _a = this.data, + type = _a.type, + defaultDate = _a.defaultDate, + minDate = _a.minDate; + if (type === 'range') { + var _b = defaultDate || [], + startDay = _b[0], + endDay = _b[1]; + return [ + startDay || minDate, + endDay || utils_1.getNextDay(new Date(minDate)).getTime(), + ]; + } + if (type === 'multiple') { + return defaultDate || [minDate]; + } + return defaultDate || minDate; + }, + scrollIntoView: function () { + var _this = this; + setTimeout(function () { + var _a = _this.data, + currentDate = _a.currentDate, + type = _a.type, + show = _a.show, + poppable = _a.poppable, + minDate = _a.minDate, + maxDate = _a.maxDate; + var targetDate = type === 'single' ? currentDate : currentDate[0]; + var displayed = show || !poppable; + if (!targetDate || !displayed) { + return; + } + var months = utils_1.getMonths(minDate, maxDate); + months.some(function (month, index) { + if (utils_1.compareMonth(month, targetDate) === 0) { + _this.setData({ scrollIntoView: 'month' + index }); + return true; + } + return false; + }); + }, 100); + }, + onOpen: function () { + this.$emit('open'); + }, + onOpened: function () { + this.$emit('opened'); + }, + onClose: function () { + this.$emit('close'); + }, + onClosed: function () { + this.$emit('closed'); + }, + onClickDay: function (event) { + var date = event.detail.date; + var _a = this.data, + type = _a.type, + currentDate = _a.currentDate, + allowSameDay = _a.allowSameDay; + if (type === 'range') { + var startDay = currentDate[0], + endDay = currentDate[1]; + if (startDay && !endDay) { + var compareToStart = utils_1.compareDay(date, startDay); + if (compareToStart === 1) { + this.select([startDay, date], true); + } else if (compareToStart === -1) { + this.select([date, null]); + } else if (allowSameDay) { + this.select([date, date]); + } + } else { + this.select([date, null]); + } + } else if (type === 'multiple') { + var selectedIndex_1; + var selected = currentDate.some(function (dateItem, index) { + var equal = utils_1.compareDay(dateItem, date) === 0; + if (equal) { + selectedIndex_1 = index; + } + return equal; + }); + if (selected) { + var cancelDate = currentDate.splice(selectedIndex_1, 1); + this.setData({ currentDate: currentDate }); + this.unselect(cancelDate); + } else { + this.select(__spreadArrays(currentDate, [date])); + } + } else { + this.select(date, true); + } + }, + unselect: function (dateArray) { + var date = dateArray[0]; + if (date) { + this.$emit('unselect', utils_1.copyDates(date)); + } + }, + select: function (date, complete) { + if (complete && this.data.type === 'range') { + var valid = this.checkRange(date); + if (!valid) { + // auto selected to max range if showConfirm + if (this.data.showConfirm) { + this.emit([ + date[0], + utils_1.getDayByOffset(date[0], this.data.maxRange - 1), + ]); + } else { + this.emit(date); + } + return; + } + } + this.emit(date); + if (complete && !this.data.showConfirm) { + this.onConfirm(); + } + }, + emit: function (date) { + var getTime = function (date) { + return date instanceof Date ? date.getTime() : date; + }; + this.setData({ + currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date), + }); + this.$emit('select', utils_1.copyDates(date)); + }, + checkRange: function (date) { + var _a = this.data, + maxRange = _a.maxRange, + rangePrompt = _a.rangePrompt; + if (maxRange && utils_1.calcDateNum(date) > maxRange) { + toast_1.default({ + context: this, + message: + rangePrompt || + '\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 ' + + maxRange + + ' \u5929', + }); + return false; + } + return true; + }, + onConfirm: function () { + var _this = this; + if ( + this.data.type === 'range' && + !this.checkRange(this.data.currentDate) + ) { + return; + } + wx.nextTick(function () { + _this.$emit('confirm', utils_1.copyDates(_this.data.currentDate)); + }); + }, + }, +}); diff --git a/src/miniprogram_npm/@vant/weapp/calendar/index.json b/src/miniprogram_npm/@vant/weapp/calendar/index.json new file mode 100644 index 0000000..61dec08 --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/index.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "header": "./components/header/index", + "month": "./components/month/index", + "van-button": "../button/index", + "van-popup": "../popup/index" + } +} diff --git a/src/miniprogram_npm/@vant/weapp/calendar/index.wxml b/src/miniprogram_npm/@vant/weapp/calendar/index.wxml new file mode 100644 index 0000000..d4849cc --- /dev/null +++ b/src/miniprogram_npm/@vant/weapp/calendar/index.wxml @@ -0,0 +1,31 @@ + + + + + +