├── miniprogram ├── app.wxss ├── pages │ ├── index │ │ ├── index.wxss │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.js │ ├── scanCode │ │ ├── scanCode.wxss │ │ ├── scanCode.wxml │ │ ├── scanCode.json │ │ └── scanCode.js │ └── bookDetail │ │ ├── bookDetail.wxss │ │ ├── bookDetail.json │ │ ├── bookDetail.wxml │ │ └── bookDetail.js ├── vant │ ├── common │ │ ├── style │ │ │ ├── var.wxss │ │ │ ├── mixins │ │ │ │ ├── clearfix.wxss │ │ │ │ ├── ellipsis.wxss │ │ │ │ └── border-retina.wxss │ │ │ ├── clearfix.wxss │ │ │ ├── ellipsis.wxss │ │ │ └── hairline.wxss │ │ ├── classnames.js │ │ └── index.wxss │ ├── tag │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.js │ │ └── index.wxss │ ├── card │ │ ├── index.json │ │ ├── index.js │ │ ├── index.wxml │ │ └── index.wxss │ ├── col │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.js │ │ └── index.wxss │ ├── loading │ │ ├── index.json │ │ ├── index.js │ │ ├── index.wxml │ │ └── index.wxss │ ├── row │ │ ├── index.json │ │ ├── index.wxss │ │ ├── index.wxml │ │ └── index.js │ ├── stepper │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxss │ │ └── index.js │ ├── badge │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.js │ │ └── index.wxss │ ├── cell-group │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.js │ │ └── index.wxss │ ├── popup │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.js │ │ └── index.wxss │ ├── slider │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxss │ │ └── index.js │ ├── tabbar │ │ ├── index.json │ │ ├── index.wxss │ │ ├── index.wxml │ │ └── index.js │ ├── transition │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.js │ │ └── index.wxss │ ├── badge-group │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxss │ │ └── index.js │ ├── overlay │ │ ├── index.wxss │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.js │ ├── cell │ │ ├── index.json │ │ ├── index.js │ │ ├── index.wxml │ │ └── index.wxss │ ├── switch-cell │ │ ├── index.wxss │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.js │ ├── button │ │ ├── index.json │ │ ├── index.wxml │ │ ├── behaviors.js │ │ ├── index.wxss │ │ └── index.js │ ├── nav-bar │ │ ├── index.json │ │ ├── index.js │ │ ├── index.wxss │ │ └── index.wxml │ ├── notice-bar │ │ ├── index.json │ │ ├── index.wxss │ │ ├── index.wxml │ │ └── index.js │ ├── panel │ │ ├── index.json │ │ ├── index.js │ │ ├── index.wxml │ │ └── index.wxss │ ├── steps │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.js │ │ └── index.wxss │ ├── switch │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.js │ │ └── index.wxss │ ├── tabbar-item │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.js │ │ └── index.wxss │ ├── tree-select │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxss │ │ └── index.js │ ├── notify │ │ ├── index.json │ │ ├── index.wxss │ │ ├── index.wxml │ │ ├── notify.js │ │ └── index.js │ ├── field │ │ ├── index.json │ │ ├── index.wxss │ │ ├── index.wxml │ │ └── index.js │ ├── search │ │ ├── index.json │ │ ├── index.wxss │ │ ├── index.wxml │ │ └── index.js │ ├── actionsheet │ │ ├── index.json │ │ ├── index.js │ │ ├── index.wxml │ │ └── index.wxss │ ├── toast │ │ ├── index.json │ │ ├── index.js │ │ ├── index.wxml │ │ ├── index.wxss │ │ └── toast.js │ ├── utils │ │ └── index.js │ └── behaviors │ │ ├── touch.js │ │ └── button.js ├── app.js └── app.json ├── cloudfunctions ├── bookinfo │ ├── index.js │ ├── package.json │ ├── .gitignore │ └── package-lock.json ├── batchupdate │ ├── package.json │ ├── index.js │ ├── .gitignore │ └── yarn.lock └── login │ └── index.js ├── project.config.json ├── README.md └── .gitignore /miniprogram/app.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /miniprogram/pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /miniprogram/vant/common/style/var.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /miniprogram/vant/common/style/mixins/clearfix.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /miniprogram/vant/common/style/mixins/ellipsis.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /miniprogram/vant/common/style/mixins/border-retina.wxss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /miniprogram/vant/tag/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } -------------------------------------------------------------------------------- /miniprogram/vant/card/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /miniprogram/vant/col/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /miniprogram/vant/loading/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } -------------------------------------------------------------------------------- /miniprogram/vant/row/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /miniprogram/vant/stepper/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } -------------------------------------------------------------------------------- /miniprogram/vant/badge/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /miniprogram/vant/cell-group/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } -------------------------------------------------------------------------------- /miniprogram/vant/popup/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /miniprogram/vant/slider/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /miniprogram/vant/tabbar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /miniprogram/vant/transition/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/scanCode/scanCode.wxss: -------------------------------------------------------------------------------- 1 | /* pages/scanCode/scanCode.wxss */ -------------------------------------------------------------------------------- /miniprogram/vant/badge-group/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /miniprogram/pages/bookDetail/bookDetail.wxss: -------------------------------------------------------------------------------- 1 | /* pages/bookDetail/bookDetail.wxss */ -------------------------------------------------------------------------------- /miniprogram/vant/row/index.wxss: -------------------------------------------------------------------------------- 1 | .van-row::after{content:"";display:table;clear:both} -------------------------------------------------------------------------------- /miniprogram/vant/overlay/index.wxss: -------------------------------------------------------------------------------- 1 | .van-overlay{position:fixed;top:0;left:0;right:0;bottom:0} -------------------------------------------------------------------------------- /miniprogram/vant/common/style/clearfix.wxss: -------------------------------------------------------------------------------- 1 | .van-clearfix::after{content:'';display:table;clear:both} -------------------------------------------------------------------------------- /miniprogram/vant/row/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /miniprogram/pages/bookDetail/bookDetail.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": { 3 | "van-button": "../../vant/button/index" 4 | } 5 | } -------------------------------------------------------------------------------- /miniprogram/vant/cell/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-icon": "../icon/index" 5 | } 6 | } -------------------------------------------------------------------------------- /miniprogram/vant/switch-cell/index.wxss: -------------------------------------------------------------------------------- 1 | .van-switch-cell{padding-top:8px;padding-bottom:8px}.van-switch-cell__switch{vertical-align:middle} -------------------------------------------------------------------------------- /miniprogram/vant/badge-group/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /miniprogram/vant/button/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-loading": "../loading/index" 5 | } 6 | } -------------------------------------------------------------------------------- /miniprogram/vant/nav-bar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /miniprogram/vant/notice-bar/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-icon": "../icon/index" 5 | } 6 | } -------------------------------------------------------------------------------- /miniprogram/vant/panel/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-cell": "../cell/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /miniprogram/vant/steps/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /miniprogram/vant/tabbar/index.wxss: -------------------------------------------------------------------------------- 1 | .van-tabbar{width:100%;height:50px;background-color:#fff}.van-tabbar--fixed{left:0;bottom:0;position:fixed} -------------------------------------------------------------------------------- /miniprogram/vant/switch/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-loading": "../loading/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /miniprogram/vant/tabbar-item/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /miniprogram/vant/tree-select/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-icon": "../icon/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /miniprogram/vant/notify/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-transition": "../transition/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /miniprogram/vant/overlay/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-transition": "../transition/index" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /miniprogram/vant/cell-group/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /miniprogram/vant/field/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-cell": "../cell/index", 5 | "van-icon": "../icon/index" 6 | } 7 | } -------------------------------------------------------------------------------- /miniprogram/vant/search/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-icon": "../icon/index", 5 | "van-field": "../field/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /miniprogram/vant/switch-cell/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-cell": "../cell/index", 5 | "van-switch": "../switch/index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /miniprogram/vant/notify/index.wxss: -------------------------------------------------------------------------------- 1 | .van-notify{top:0;width:100%;z-index:110;color:#fff;position:fixed;min-height:32px;line-height:2.3;font-size:14px;text-align:center;background-color:#e64340} -------------------------------------------------------------------------------- /miniprogram/pages/scanCode/scanCode.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 扫码加书 4 | 5 | -------------------------------------------------------------------------------- /miniprogram/pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": { 3 | "van-card": "../../vant/card/index", 4 | "van-tag": "../../vant/tag/index", 5 | "van-button": "../../vant/button/index" 6 | } 7 | } -------------------------------------------------------------------------------- /miniprogram/pages/scanCode/scanCode.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": { 3 | "van-button": "../../vant/button/index", 4 | "van-row": "../../vant/row/index", 5 | "van-col": "../../vant/col/index" 6 | } 7 | } -------------------------------------------------------------------------------- /miniprogram/vant/col/index.wxml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /miniprogram/vant/actionsheet/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-icon": "../icon/index", 5 | "van-popup": "../popup/index", 6 | "van-loading": "../loading/index" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /miniprogram/vant/tabbar/index.wxml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /miniprogram/pages/bookDetail/bookDetail.wxml: -------------------------------------------------------------------------------- 1 | {{book.title}} 2 | 更新数据 3 | 删除数据 -------------------------------------------------------------------------------- /miniprogram/vant/notify/index.wxml: -------------------------------------------------------------------------------- 1 | 7 | {{ text }} 8 | 9 | -------------------------------------------------------------------------------- /miniprogram/vant/tag/index.wxml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /miniprogram/vant/badge/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | {{ info }} 3 | {{ title }} 4 | 5 | -------------------------------------------------------------------------------- /miniprogram/vant/overlay/index.wxml: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /miniprogram/vant/tag/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | addGlobalClass: true 4 | }, 5 | 6 | externalClasses: ['custom-class'], 7 | 8 | properties: { 9 | type: String, 10 | mark: Boolean, 11 | plain: Boolean 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /miniprogram/vant/cell-group/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | addGlobalClass: true 4 | }, 5 | 6 | externalClasses: ['custom-class'], 7 | 8 | properties: { 9 | border: { 10 | type: Boolean, 11 | value: true 12 | } 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /miniprogram/vant/toast/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "van-icon": "../icon/index", 5 | "van-loading": "../loading/index", 6 | "van-overlay": "../overlay/index", 7 | "van-transition": "../transition/index" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /cloudfunctions/bookinfo/index.js: -------------------------------------------------------------------------------- 1 | var rp = require('request-promise') 2 | 3 | exports.main = (event, context) => { 4 | var res = rp('https://api.douban.com/v2/book/isbn/'+ event.isbn).then( html => { 5 | return html; 6 | }).catch( err => { 7 | console.log(err); 8 | }) 9 | return res 10 | } -------------------------------------------------------------------------------- /miniprogram/app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | onLaunch: function () { 4 | 5 | if (!wx.cloud) { 6 | console.error('请使用 2.2.3 或以上的基础库以使用云能力') 7 | } else { 8 | wx.cloud.init({ 9 | traceUser:true 10 | }) 11 | } 12 | 13 | this.globalData = {} 14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /miniprogram/vant/utils/index.js: -------------------------------------------------------------------------------- 1 | function isDef(value) { 2 | return value !== undefined && value !== null; 3 | } 4 | 5 | function isObj(x) { 6 | const type = typeof x; 7 | return x !== null && (type === 'object' || type === 'function'); 8 | } 9 | 10 | module.exports = { 11 | isObj, 12 | isDef 13 | }; 14 | -------------------------------------------------------------------------------- /miniprogram/vant/transition/index.wxml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cloudfunctions/batchupdate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "batchupdate", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "0.x.x" 13 | } 14 | } -------------------------------------------------------------------------------- /miniprogram/vant/common/style/ellipsis.wxss: -------------------------------------------------------------------------------- 1 | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical} -------------------------------------------------------------------------------- /miniprogram/vant/popup/index.wxml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /miniprogram/vant/panel/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | externalClasses: [ 3 | 'custom-class', 4 | 'footer-class' 5 | ], 6 | 7 | options: { 8 | multipleSlots: true, 9 | addGlobalClass: true 10 | }, 11 | 12 | properties: { 13 | desc: String, 14 | title: String, 15 | status: String, 16 | headerClass: String, 17 | useFooterSlot: Boolean 18 | } 19 | }); 20 | -------------------------------------------------------------------------------- /miniprogram/vant/overlay/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | addGlobalClass: true 4 | }, 5 | 6 | properties: { 7 | show: Boolean, 8 | mask: Boolean, 9 | customStyle: String, 10 | zIndex: { 11 | type: Number, 12 | value: 1 13 | } 14 | }, 15 | 16 | methods: { 17 | onClick() { 18 | this.triggerEvent('click'); 19 | } 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /miniprogram/vant/switch/index.wxml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /miniprogram/vant/switch-cell/index.wxml: -------------------------------------------------------------------------------- 1 | 7 | 15 | 16 | -------------------------------------------------------------------------------- /cloudfunctions/bookinfo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bookinfo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "request": "^2.88.0", 13 | "request-promise": "^4.2.2", 14 | "wx-server-sdk": "0.x.x" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /miniprogram/vant/loading/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | addGlobalClass: true 4 | }, 5 | 6 | externalClasses: ['custom-class'], 7 | 8 | properties: { 9 | size: { 10 | type: String, 11 | value: '30px' 12 | }, 13 | type: { 14 | type: String, 15 | value: 'circular' 16 | }, 17 | color: { 18 | type: String, 19 | value: '#c9c9c9' 20 | } 21 | } 22 | }); 23 | -------------------------------------------------------------------------------- /miniprogram/vant/slider/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /miniprogram/vant/loading/index.wxml: -------------------------------------------------------------------------------- 1 | 5 | 9 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /miniprogram/vant/switch-cell/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | addGlobalClass: true 4 | }, 5 | 6 | properties: { 7 | title: String, 8 | checked: Boolean, 9 | border: Boolean, 10 | loading: Boolean, 11 | disabled: Boolean, 12 | size: { 13 | type: String, 14 | value: '26px' 15 | } 16 | }, 17 | 18 | methods: { 19 | onChange(event) { 20 | this.triggerEvent('change', event.detail); 21 | } 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /cloudfunctions/batchupdate/index.js: -------------------------------------------------------------------------------- 1 | const cloud = require('wx-server-sdk') 2 | cloud.init({}) 3 | const db = cloud.database() 4 | const _ = db.command 5 | 6 | exports.main = async (event, context) => { 7 | try { 8 | return await db.collection('mybook').where({ 9 | _openid: "ocdyO4u6-0Gf92PZUWAsEK4LxkuI" 10 | }) 11 | .update({ 12 | data: { 13 | price: "100元" 14 | }, 15 | }) 16 | } catch (e) { 17 | console.error(e) 18 | } 19 | } -------------------------------------------------------------------------------- /cloudfunctions/login/index.js: -------------------------------------------------------------------------------- 1 | // 云函数模板 2 | // 部署:在 cloud-functions/login 文件夹右击选择 “上传并部署” 3 | 4 | /** 5 | * 这个示例将经自动鉴权过的小程序用户 openid 返回给小程序端 6 | * 7 | * event 参数包含 8 | * - 小程序端调用传入的 data 9 | * - 经过微信鉴权直接可信的用户唯一标识 openid 10 | * 11 | */ 12 | exports.main = (event, context) => { 13 | console.log(event) 14 | console.log(context) 15 | 16 | // 可执行其他自定义逻辑 17 | // console.log 的内容可以在云开发云函数调用日志查看 18 | 19 | return { 20 | openid: event.userInfo.openId, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /miniprogram/vant/slider/index.wxss: -------------------------------------------------------------------------------- 1 | .van-slider{position:relative;border-radius:999px;background-color:#e5e5e5}.van-slider__bar{position:relative;border-radius:inherit;background-color:#38f}.van-slider__button{position:absolute;top:50%;right:0;width:20px;height:20px;border-radius:50%;background-color:#fff;-webkit-transform:translate3d(50%,-50%,0);transform:translate3d(50%,-50%,0);box-shadow:0 1px 2px rgba(0,0,0,.5)}.van-slider__button::after{content:'';position:absolute;width:200%;height:200%;top:-50%;left:-50%}.van-slider--disabled{opacity:.3} -------------------------------------------------------------------------------- /miniprogram/vant/card/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | multipleSlots: true, 4 | addGlobalClass: true 5 | }, 6 | 7 | externalClasses: [ 8 | 'custom-class', 9 | 'thumb-class', 10 | 'title-class', 11 | 'price-class', 12 | 'desc-class', 13 | 'num-class' 14 | ], 15 | 16 | properties: { 17 | num: String, 18 | desc: String, 19 | thumb: String, 20 | title: String, 21 | price: String, 22 | centered: Boolean, 23 | currency: { 24 | type: String, 25 | default: '¥' 26 | } 27 | } 28 | }); 29 | -------------------------------------------------------------------------------- /miniprogram/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/index", 4 | "pages/scanCode/scanCode", 5 | "pages/bookDetail/bookDetail" 6 | ], 7 | "window": { 8 | "backgroundColor": "#F6F6F6", 9 | "backgroundTextStyle": "light", 10 | "navigationBarBackgroundColor": "#F6F6F6", 11 | "navigationBarTitleText": "私家书柜", 12 | "navigationBarTextStyle": "black" 13 | }, 14 | "tabBar": { 15 | "list": [{ 16 | "pagePath": "pages/index/index", 17 | "text": "我的藏书" 18 | },{ 19 | "pagePath": "pages/scanCode/scanCode", 20 | "text": "扫码加书" 21 | }] 22 | } 23 | } -------------------------------------------------------------------------------- /miniprogram/vant/col/index.js: -------------------------------------------------------------------------------- 1 | const ROW_PATH = '../row/index'; 2 | 3 | Component({ 4 | options: { 5 | addGlobalClass: true 6 | }, 7 | 8 | externalClasses: ['custom-class'], 9 | 10 | relations: { 11 | [ROW_PATH]: { 12 | type: 'ancestor' 13 | } 14 | }, 15 | 16 | properties: { 17 | span: Number, 18 | offset: Number 19 | }, 20 | 21 | methods: { 22 | setGutter(gutter) { 23 | const padding = `${gutter / 2}px`; 24 | const style = gutter ? `padding-left: ${padding}; padding-right: ${padding};` : ''; 25 | this.setData({ style }); 26 | } 27 | } 28 | }); 29 | -------------------------------------------------------------------------------- /miniprogram/vant/panel/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /miniprogram/vant/notice-bar/index.wxss: -------------------------------------------------------------------------------- 1 | .van-notice-bar{display:-webkit-box;display:-webkit-flex;display:flex;padding:9px 10px;font-size:12px;line-height:1.5}.van-notice-bar--within-icon{position:relative;padding-right:30px}.van-notice-bar__left-icon{height:18px;min-width:20px;padding-top:1px;box-sizing:border-box}.van-notice-bar__left-icon>image{width:16px;height:16px}.van-notice-bar__right-icon{position:absolute;top:10px;right:10px;font-size:15px;line-height:1}.van-notice-bar__content-wrap{position:relative;-webkit-box-flex:1;-webkit-flex:1;flex:1;height:18px;overflow:hidden}.van-notice-bar__content{position:absolute;white-space:nowrap} -------------------------------------------------------------------------------- /miniprogram/vant/switch/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | addGlobalClass: true 4 | }, 5 | 6 | externalClasses: ['custom-class', 'node-class'], 7 | 8 | properties: { 9 | checked: Boolean, 10 | loading: Boolean, 11 | disabled: Boolean, 12 | size: { 13 | type: String, 14 | value: '30px' 15 | } 16 | }, 17 | 18 | methods: { 19 | onClick() { 20 | if (!this.data.disabled && !this.data.loading) { 21 | const checked = !this.data.checked; 22 | this.triggerEvent('input', checked); 23 | this.triggerEvent('change', checked); 24 | } 25 | } 26 | } 27 | }); 28 | -------------------------------------------------------------------------------- /miniprogram/vant/tabbar-item/index.wxml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /miniprogram/pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{tag.name}} 7 | 8 | 9 | 10 | 11 | 12 | 查看详情 13 | 14 | 15 | -------------------------------------------------------------------------------- /miniprogram/vant/notify/notify.js: -------------------------------------------------------------------------------- 1 | const defaultOptions = { 2 | selector: '#van-notify', 3 | duration: 3000 4 | }; 5 | 6 | export default function Notify(options = {}) { 7 | const pages = getCurrentPages(); 8 | const ctx = pages[pages.length - 1]; 9 | 10 | options = Object.assign({}, defaultOptions, parseParam(options)); 11 | 12 | const el = ctx.selectComponent(options.selector); 13 | delete options.selector; 14 | 15 | if (el) { 16 | el.setData({ 17 | ...options 18 | }); 19 | el.show(); 20 | } 21 | } 22 | 23 | function parseParam(params = '') { 24 | return typeof params === 'object' ? params : { text: params }; 25 | } 26 | -------------------------------------------------------------------------------- /miniprogram/vant/nav-bar/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | externalClasses: [ 3 | 'custom-class', 4 | 'title-class' 5 | ], 6 | 7 | options: { 8 | multipleSlots: true, 9 | addGlobalClass: true 10 | }, 11 | 12 | properties: { 13 | title: String, 14 | leftText: String, 15 | rightText: String, 16 | leftArrow: Boolean, 17 | fixed: Boolean, 18 | zIndex: { 19 | type: Number, 20 | value: 1 21 | } 22 | }, 23 | 24 | methods: { 25 | onClickLeft() { 26 | this.triggerEvent('click-left'); 27 | }, 28 | 29 | onClickRight() { 30 | this.triggerEvent('click-right'); 31 | } 32 | } 33 | }); 34 | -------------------------------------------------------------------------------- /miniprogram/vant/switch/index.wxss: -------------------------------------------------------------------------------- 1 | .van-switch{height:1em;width:1.6em;display:inline-block;position:relative;background:#fff;box-sizing:content-box;border:1px solid rgba(0,0,0,.1);border-radius:1em}.van-switch__node{top:0;left:0;z-index:1;width:1em;height:1em;-webkit-transition:.3s;transition:.3s;position:absolute;border-radius:100%;background-color:#fff;box-shadow:0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05)}.van-switch__loading{top:25%;left:25%;width:50%;height:50%;position:absolute}.van-switch--on{background-color:#44db5e}.van-switch--on .van-switch__node{-webkit-transform:translateX(.6em);transform:translateX(.6em)}.van-switch--disabled{opacity:.4} -------------------------------------------------------------------------------- /miniprogram/vant/badge/index.js: -------------------------------------------------------------------------------- 1 | const BADGE_GROUP_PATH = '../badge-group/index'; 2 | 3 | Component({ 4 | options: { 5 | addGlobalClass: true 6 | }, 7 | 8 | externalClasses: ['custom-class'], 9 | 10 | relations: { 11 | [BADGE_GROUP_PATH]: { 12 | type: 'ancestor' 13 | } 14 | }, 15 | 16 | properties: { 17 | info: Number, 18 | title: String 19 | }, 20 | 21 | methods: { 22 | onClick() { 23 | const group = this.getRelationNodes(BADGE_GROUP_PATH)[0]; 24 | if (group) { 25 | group.setActive(this); 26 | } 27 | }, 28 | 29 | setActive(active) { 30 | this.setData({ active }); 31 | } 32 | } 33 | }); 34 | -------------------------------------------------------------------------------- /miniprogram/vant/search/index.wxss: -------------------------------------------------------------------------------- 1 | .van-search{display:-webkit-box;display:-webkit-flex;display:flex;padding:7px 15px;-webkit-box-align:center;-webkit-align-items:center;align-items:center;box-sizing:border-box}.van-search__field{-webkit-box-flex:1;-webkit-flex:1;flex:1;border-radius:4px}.van-search__field__left-icon{color:#999}.van-search--show-action{padding-right:0}.van-search input::-webkit-search-cancel-button,.van-search input::-webkit-search-decoration,.van-search input::-webkit-search-results-button,.van-search input::-webkit-search-results-decoration{display:none}.van-search__action{padding:0 10px;font-size:14px;line-height:30px;color:#666}.van-search__action:active{background-color:#e8e8e8} -------------------------------------------------------------------------------- /miniprogram/vant/toast/index.js: -------------------------------------------------------------------------------- 1 | import Toast from './toast'; 2 | 3 | Component({ 4 | options: { 5 | addGlobalClass: true 6 | }, 7 | 8 | properties: { 9 | show: Boolean, 10 | mask: Boolean, 11 | message: String, 12 | forbidClick: Boolean, 13 | type: { 14 | type: String, 15 | value: 'text' 16 | }, 17 | loadingType: { 18 | type: String, 19 | value: 'circular' 20 | }, 21 | position: { 22 | type: String, 23 | value: 'middle' 24 | } 25 | }, 26 | 27 | methods: { 28 | clear() { 29 | this.setData({ 30 | show: false 31 | }); 32 | } 33 | } 34 | }); 35 | 36 | export default Toast; 37 | -------------------------------------------------------------------------------- /miniprogram/vant/tabbar-item/index.js: -------------------------------------------------------------------------------- 1 | const TABBAR_PATH = '../tabbar/index'; 2 | 3 | Component({ 4 | properties: { 5 | info: null, 6 | icon: String, 7 | dot: Boolean 8 | }, 9 | 10 | options: { 11 | multipleSlots: true, 12 | addGlobalClass: true 13 | }, 14 | 15 | relations: { 16 | [TABBAR_PATH]: { 17 | type: 'ancestor' 18 | } 19 | }, 20 | 21 | data: { 22 | active: false, 23 | count: 0 24 | }, 25 | 26 | methods: { 27 | onClick() { 28 | const parent = this.getRelationNodes(TABBAR_PATH)[0]; 29 | if (parent) { 30 | parent.onChange(this); 31 | } 32 | this.triggerEvent('click'); 33 | } 34 | } 35 | }); 36 | -------------------------------------------------------------------------------- /miniprogram/vant/stepper/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /miniprogram/vant/nav-bar/index.wxss: -------------------------------------------------------------------------------- 1 | .van-nav-bar{height:46px;position:relative;-webkit-user-select:none;user-select:none;text-align:center;line-height:46px;background-color:#fff}.van-nav-bar__arrow{color:#38f;vertical-align:middle;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{top:0;left:0;width:100%;position:fixed}.van-nav-bar__title{margin:0 auto;max-width:60%;font-size:16px}.van-nav-bar__left,.van-nav-bar__right{bottom:0;font-size:14px;position:absolute}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}.van-nav-bar__text{color:#38f;margin:0 -15px;padding:0 15px;display:inline-block;vertical-align:middle}.van-nav-bar__text:active{background-color:#e8e8e8} -------------------------------------------------------------------------------- /miniprogram/vant/popup/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | addGlobalClass: true 4 | }, 5 | 6 | externalClasses: [ 7 | 'custom-class', 8 | 'overlay-class' 9 | ], 10 | 11 | properties: { 12 | show: Boolean, 13 | overlayStyle: String, 14 | overlay: { 15 | type: Boolean, 16 | value: true 17 | }, 18 | closeOnClickOverlay: { 19 | type: Boolean, 20 | value: true 21 | }, 22 | position: { 23 | type: String, 24 | value: 'center' 25 | } 26 | }, 27 | 28 | methods: { 29 | onClickOverlay() { 30 | this.triggerEvent('click-overlay'); 31 | 32 | if (this.data.closeOnClickOverlay) { 33 | this.triggerEvent('close'); 34 | } 35 | } 36 | } 37 | }); 38 | -------------------------------------------------------------------------------- /miniprogram/vant/tabbar-item/index.wxss: -------------------------------------------------------------------------------- 1 | .van-tabbar-item{float:left;color:#666;height:100%;display:-webkit-box;display:-webkit-flex;display:flex;line-height:1;font-size:12px;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.van-tabbar-item__icon{font-size:18px;margin-bottom:5px;position:relative}.van-tabbar-item__icon .van-icon{display:block}.van-tabbar-item__icon--dot::after{top:0;right:-8px;width:8px;height:8px;content:' ';position:absolute;border-radius:100%;background-color:#f44}.van-tabbar-item__icon image{width:50px;height:18px}.van-tabbar-item--active{color:#38f} -------------------------------------------------------------------------------- /miniprogram/vant/behaviors/touch.js: -------------------------------------------------------------------------------- 1 | module.exports = Behavior({ 2 | methods: { 3 | touchStart(event) { 4 | this.direction = ''; 5 | this.deltaX = 0; 6 | this.deltaY = 0; 7 | this.offsetX = 0; 8 | this.offsetY = 0; 9 | this.startX = event.touches[0].clientX; 10 | this.startY = event.touches[0].clientY; 11 | }, 12 | 13 | touchMove(event) { 14 | const touch = event.touches[0]; 15 | this.deltaX = touch.clientX - this.startX; 16 | this.deltaY = touch.clientY - this.startY; 17 | this.offsetX = Math.abs(this.deltaX); 18 | this.offsetY = Math.abs(this.deltaY); 19 | this.direction = this.offsetX > this.offsetY ? 'horizontal' : this.offsetX < this.offsetY ? 'vertical' : ''; 20 | } 21 | } 22 | }); 23 | -------------------------------------------------------------------------------- /miniprogram/vant/common/classnames.js: -------------------------------------------------------------------------------- 1 | const hasOwn = {}.hasOwnProperty; 2 | 3 | module.exports = function classNames() { 4 | const classes = []; 5 | 6 | for (let i = 0; i < arguments.length; i++) { 7 | const arg = arguments[i]; 8 | if (!arg) continue; 9 | 10 | const argType = typeof arg; 11 | 12 | if (argType === 'string' || argType === 'number') { 13 | classes.push(arg); 14 | } else if (Array.isArray(arg) && arg.length) { 15 | const inner = classNames.apply(null, arg); 16 | if (inner) { 17 | classes.push(inner); 18 | } 19 | } else if (argType === 'object') { 20 | for (const key in arg) { 21 | if (hasOwn.call(arg, key) && arg[key]) { 22 | classes.push(key); 23 | } 24 | } 25 | } 26 | } 27 | 28 | return classes.join(' '); 29 | }; 30 | -------------------------------------------------------------------------------- /miniprogram/vant/cell-group/index.wxss: -------------------------------------------------------------------------------- 1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px} -------------------------------------------------------------------------------- /miniprogram/vant/toast/index.wxml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 11 | 12 | {{ message }} 13 | 14 | 15 | 16 | 22 | 23 | {{ message }} 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /miniprogram/vant/common/style/hairline.wxss: -------------------------------------------------------------------------------- 1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px} -------------------------------------------------------------------------------- /miniprogram/vant/actionsheet/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | addGlobalClass: true 4 | }, 5 | 6 | properties: { 7 | show: Boolean, 8 | title: String, 9 | cancelText: String, 10 | actions: { 11 | type: Array, 12 | value: [] 13 | }, 14 | overlay: { 15 | type: Boolean, 16 | value: true 17 | }, 18 | closeOnClickOverlay: { 19 | type: Boolean, 20 | value: true 21 | } 22 | }, 23 | 24 | methods: { 25 | onSelect(event) { 26 | const { index } = event.currentTarget.dataset; 27 | const item = this.data.actions[index]; 28 | if (item && !item.disabled && !item.loading) { 29 | this.triggerEvent('select', item); 30 | } 31 | }, 32 | 33 | onCancel() { 34 | this.triggerEvent('cancel'); 35 | }, 36 | 37 | onClose() { 38 | this.triggerEvent('close'); 39 | } 40 | } 41 | }); 42 | -------------------------------------------------------------------------------- /miniprogram/vant/row/index.js: -------------------------------------------------------------------------------- 1 | const COL_PATH = '../col/index'; 2 | 3 | Component({ 4 | options: { 5 | addGlobalClass: true 6 | }, 7 | 8 | externalClasses: ['custom-class'], 9 | 10 | relations: { 11 | [COL_PATH]: { 12 | type: 'descendant' 13 | } 14 | }, 15 | 16 | properties: { 17 | gutter: { 18 | type: Number, 19 | observer() { 20 | this.setGutter(); 21 | } 22 | } 23 | }, 24 | 25 | ready() { 26 | this.setGutter(); 27 | }, 28 | 29 | methods: { 30 | setGutter() { 31 | const { gutter } = this.data; 32 | const margin = `-${Number(gutter) / 2}px`; 33 | const style = gutter ? `margin-right: ${margin}; margin-left: ${margin};` : ''; 34 | 35 | this.setData({ style }); 36 | this.getRelationNodes(COL_PATH).forEach((col) => { 37 | col.setGutter(this.data.gutter); 38 | }); 39 | } 40 | } 41 | }); 42 | -------------------------------------------------------------------------------- /miniprogram/vant/badge-group/index.wxss: -------------------------------------------------------------------------------- 1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-badge-group{width:85px} -------------------------------------------------------------------------------- /miniprogram/vant/nav-bar/index.wxml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 12 | {{ leftText }} 13 | 14 | 15 | 16 | 17 | {{ title }} 18 | 19 | 20 | 21 | {{ rightText }} 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /miniprogram/vant/panel/index.wxss: -------------------------------------------------------------------------------- 1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-panel{background:#fff}.van-panel__header-value{color:#f44}.van-panel__footer{padding:10px 15px} -------------------------------------------------------------------------------- /miniprogram/vant/notify/index.js: -------------------------------------------------------------------------------- 1 | import Notify from './notify'; 2 | 3 | Component({ 4 | options: { 5 | addGlobalClass: true 6 | }, 7 | 8 | properties: { 9 | text: String, 10 | color: { 11 | type: String, 12 | value: '#fff' 13 | }, 14 | backgroundColor: { 15 | type: String, 16 | value: '#e64340' 17 | }, 18 | duration: { 19 | type: Number, 20 | value: 3000 21 | } 22 | }, 23 | 24 | methods: { 25 | show() { 26 | const { duration } = this.data; 27 | 28 | clearTimeout(this.timer); 29 | this.setData({ 30 | show: true 31 | }); 32 | 33 | if (duration > 0 && duration !== Infinity) { 34 | this.timer = setTimeout(() => { 35 | this.hide(); 36 | }, duration); 37 | } 38 | }, 39 | 40 | hide() { 41 | clearTimeout(this.timer); 42 | this.setData({ 43 | show: false 44 | }); 45 | } 46 | } 47 | }); 48 | 49 | export default Notify; 50 | -------------------------------------------------------------------------------- /miniprogram/vant/search/index.wxml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 23 | 24 | 25 | 26 | 取消 27 | 28 | 29 | -------------------------------------------------------------------------------- /miniprogram/vant/steps/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | {{ item.text }} 10 | {{ item.desc }} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /miniprogram/vant/toast/index.wxss: -------------------------------------------------------------------------------- 1 | .van-toast{display:-webkit-box;display:-webkit-flex;display:flex;color:#fff;font-size:12px;line-height:1.2;border-radius:5px;word-break:break-all;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;box-sizing:border-box;background-color:rgba(0,0,0,.7)}.van-toast__container{top:50%;left:50%;z-index:3001;position:fixed;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-toast--text{padding:12px;min-width:220px}.van-toast--icon{width:120px;min-height:120px;padding:15px}.van-toast--icon .van-toast__icon{height:1em;font-size:50px}.van-toast--icon .van-toast__text{font-size:14px;padding-top:10px}.van-toast__loading{margin:10px 0 5px}.van-toast--top{-webkit-transform:translate(0,-30vh);transform:translate(0,-30vh)}.van-toast--bottom{-webkit-transform:translate(0,30vh);transform:translate(0,30vh)} -------------------------------------------------------------------------------- /miniprogram/vant/cell/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | externalClasses: [ 3 | 'custom-class', 4 | 'title-class', 5 | 'label-class', 6 | 'value-class', 7 | 'left-icon-class', 8 | 'right-icon-class' 9 | ], 10 | 11 | options: { 12 | multipleSlots: true, 13 | addGlobalClass: true 14 | }, 15 | 16 | properties: { 17 | title: null, 18 | value: null, 19 | url: String, 20 | icon: String, 21 | label: String, 22 | center: Boolean, 23 | isLink: Boolean, 24 | required: Boolean, 25 | clickable: Boolean, 26 | titleWidth: String, 27 | customStyle: String, 28 | arrowDirection: String, 29 | linkType: { 30 | type: String, 31 | value: 'navigateTo' 32 | }, 33 | border: { 34 | type: Boolean, 35 | value: true 36 | } 37 | }, 38 | 39 | methods: { 40 | onClick() { 41 | const { url } = this.data; 42 | if (url) { 43 | wx[this.data.linkType]({ url }); 44 | } 45 | this.triggerEvent('click'); 46 | } 47 | } 48 | }); 49 | -------------------------------------------------------------------------------- /miniprogram/vant/notice-bar/index.wxml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | {{ text }} 13 | 14 | 15 | 16 | 17 | 23 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /miniprogram/vant/card/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ title }} 9 | {{ currency }} {{ price }} 10 | 11 | 12 | 13 | {{ desc }} 14 | x {{ num }} 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /miniprogram/vant/button/index.wxml: -------------------------------------------------------------------------------- 1 | 31 | -------------------------------------------------------------------------------- /miniprogram/vant/tree-select/index.wxml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 13 | {{ item.text }} 14 | 15 | 16 | 20 | 27 | {{ item.text }} 28 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /miniprogram/vant/field/index.wxss: -------------------------------------------------------------------------------- 1 | .van-field__body{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.van-field__body--textarea{min-height:24px}.van-field__control{border:0;margin:0;padding:0;width:100%;resize:none;display:block;text-align:left;box-sizing:border-box;line-height:inherit;background-color:transparent}.van-field__control--disabled{opacity:1;color:#666;background-color:transparent}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__button,.van-field__clear,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear,.van-field__icon-container{padding:0 10px;color:#999;line-height:inherit;margin-right:-10px;vertical-align:middle}.van-field__icon{display:block;font-size:16px;line-height:inherit}.van-field__button{padding-left:10px}.van-field__error-message{color:#f44;font-size:12px;text-align:left}.van-field--error{color:#f44}.van-field--label-center .van-cell__title{text-align:center}.van-field--label-right .van-cell__title{text-align:right} -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "miniprogramRoot": "./miniprogram", 3 | "cloudfunctionRoot": "./cloudfunctions", 4 | "setting": { 5 | "urlCheck": true, 6 | "es6": true, 7 | "postcss": true, 8 | "minified": true, 9 | "newFeature": true 10 | }, 11 | "appid": "wxd1ca70db507085dd", 12 | "projectname": "clouddev", 13 | "condition": { 14 | "search": { 15 | "current": -1, 16 | "list": [] 17 | }, 18 | "conversation": { 19 | "current": -1, 20 | "list": [] 21 | }, 22 | "plugin": { 23 | "current": -1, 24 | "list": [] 25 | }, 26 | "game": { 27 | "list": [] 28 | }, 29 | "miniprogram": { 30 | "current": 2, 31 | "list": [ 32 | { 33 | "id": -1, 34 | "name": "db guide", 35 | "pathName": "pages/databaseGuide/databaseGuide", 36 | "query": "" 37 | }, 38 | { 39 | "id": -1, 40 | "name": "scanCode", 41 | "pathName": "pages/scanCode/scanCode", 42 | "query": "" 43 | }, 44 | { 45 | "id": -1, 46 | "name": "bookDetail", 47 | "pathName": "pages/bookDetail/bookDetail", 48 | "query": "id=W35bTSGodpkt_1Un" 49 | } 50 | ] 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /miniprogram/vant/cell/index.wxml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | {{ title }} 11 | {{ label }} 12 | 13 | 14 | 15 | 16 | {{ value }} 17 | 18 | 19 | 20 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /miniprogram/vant/transition/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | addGlobalClass: true 4 | }, 5 | 6 | externalClasses: ['custom-class'], 7 | 8 | properties: { 9 | customStyle: String, 10 | show: { 11 | value: true, 12 | type: Boolean, 13 | observer(value) { 14 | if (value) { 15 | this.show(); 16 | } else { 17 | this.setData({ 18 | type: 'leave' 19 | }); 20 | } 21 | } 22 | }, 23 | name: { 24 | type: String, 25 | value: 'fade' 26 | }, 27 | duration: { 28 | type: Number, 29 | value: 300 30 | } 31 | }, 32 | 33 | data: { 34 | type: '', 35 | inited: false, 36 | display: false 37 | }, 38 | 39 | attached() { 40 | if (this.data.show) { 41 | this.show(); 42 | } 43 | }, 44 | 45 | methods: { 46 | show() { 47 | this.setData({ 48 | inited: true, 49 | display: true, 50 | type: 'enter' 51 | }); 52 | }, 53 | 54 | onAnimationEnd() { 55 | if (!this.data.show) { 56 | this.setData({ 57 | display: false 58 | }); 59 | } 60 | } 61 | } 62 | }); 63 | -------------------------------------------------------------------------------- /miniprogram/vant/common/index.wxss: -------------------------------------------------------------------------------- 1 | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.van-clearfix::after{content:'';display:table;clear:both}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px} -------------------------------------------------------------------------------- /miniprogram/vant/card/index.wxss: -------------------------------------------------------------------------------- 1 | .van-card{color:#333;height:100px;font-size:16px;background:#fafafa;position:relative;box-sizing:border-box;padding:5px 15px 5px 115px}.van-card--center,.van-card__thumb{-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{top:5px;left:15px;width:90px;height:90px;position:absolute}.van-card__img{border:none;max-width:100%;max-height:100%}.van-card,.van-card__row,.van-card__thumb{display:-webkit-box;display:-webkit-flex;display:flex}.van-card__content{width:100%}.van-card__content--center{height:90px;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.van-card__desc,.van-card__title{line-height:20px;word-break:break-all}.van-card__title{max-height:40px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-card__desc{color:#666;font-size:12px;max-height:20px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-card__num,.van-card__price{-webkit-box-flex:1;-webkit-flex:1;flex:1;min-width:80px;line-height:20px;text-align:right}.van-card__price{font-size:14px}.van-card__num{color:#666;font-size:12px}.van-card__footer{right:15px;bottom:5px;position:absolute}.van-card__footer .van-button{margin-left:5px} -------------------------------------------------------------------------------- /miniprogram/vant/search/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | externalClasses: ['custom-class', 'cancel-class'], 3 | 4 | options: { 5 | multipleSlots: true, 6 | addGlobalClass: true 7 | }, 8 | 9 | properties: { 10 | disabled: Boolean, 11 | readonly: Boolean, 12 | showAction: Boolean, 13 | useActionSlot: Boolean, 14 | placeholder: String, 15 | value: { 16 | type: String, 17 | observer(currentValue) { 18 | this.setData({ currentValue }); 19 | } 20 | }, 21 | background: { 22 | type: String, 23 | value: '#f2f2f2' 24 | }, 25 | maxlength: { 26 | type: Number, 27 | value: -1 28 | } 29 | }, 30 | 31 | attached() { 32 | this.setData({ currentValue: this.data.value }); 33 | }, 34 | 35 | methods: { 36 | onChange(event) { 37 | this.triggerEvent('change', event.detail); 38 | }, 39 | 40 | onCancel() { 41 | this.setData({ currentValue: '' }); 42 | this.triggerEvent('cancel'); 43 | this.triggerEvent('change', ''); 44 | }, 45 | 46 | onSearch() { 47 | this.triggerEvent('search', this.data.currentValue); 48 | }, 49 | 50 | onFocus() { 51 | this.triggerEvent('focus'); 52 | }, 53 | 54 | onBlur() { 55 | this.triggerEvent('blur'); 56 | } 57 | } 58 | }); 59 | -------------------------------------------------------------------------------- /miniprogram/vant/steps/index.js: -------------------------------------------------------------------------------- 1 | Component({ 2 | options: { 3 | addGlobalClass: true 4 | }, 5 | 6 | externalClasses: [ 7 | 'custom-class' 8 | ], 9 | 10 | properties: { 11 | icon: String, 12 | steps: { 13 | type: Array, 14 | observer() { 15 | this.formatSteps(); 16 | } 17 | }, 18 | active: { 19 | type: Number, 20 | observer() { 21 | this.formatSteps(); 22 | } 23 | }, 24 | direction: { 25 | type: String, 26 | value: 'horizontal' 27 | }, 28 | activeColor: { 29 | type: String, 30 | value: '#06bf04' 31 | } 32 | }, 33 | 34 | attached() { 35 | this.formatSteps(); 36 | }, 37 | 38 | methods: { 39 | formatSteps() { 40 | const { steps } = this.data; 41 | const formattedSteps = steps.map((step, index) => { 42 | return { 43 | ...step, 44 | status: this.getStatus(index) 45 | }; 46 | }); 47 | 48 | this.setData({ 49 | formattedSteps 50 | }); 51 | }, 52 | 53 | getStatus(index) { 54 | const { active } = this.data; 55 | 56 | if (index < active) { 57 | return 'finish'; 58 | } else if (index === active) { 59 | return 'process'; 60 | } 61 | 62 | return ''; 63 | } 64 | } 65 | }); 66 | -------------------------------------------------------------------------------- /miniprogram/vant/badge-group/index.js: -------------------------------------------------------------------------------- 1 | const BADGE_PATH = '../badge/index'; 2 | 3 | Component({ 4 | options: { 5 | addGlobalClass: true 6 | }, 7 | 8 | externalClasses: ['custom-class'], 9 | 10 | relations: { 11 | [BADGE_PATH]: { 12 | type: 'descendant', 13 | 14 | linked(target) { 15 | this.data.badges.push(target); 16 | this.setActive(); 17 | }, 18 | 19 | unlinked(target) { 20 | this.data.badges = this.data.badges.filter(item => item !== target); 21 | this.setActive(); 22 | } 23 | } 24 | }, 25 | 26 | properties: { 27 | active: { 28 | type: Number, 29 | value: 0, 30 | observer() { 31 | this.setActive(); 32 | } 33 | } 34 | }, 35 | 36 | data: { 37 | badges: [] 38 | }, 39 | 40 | attached() { 41 | this.currentActive = -1; 42 | }, 43 | 44 | methods: { 45 | setActive(badge) { 46 | let { active } = this.data; 47 | if (badge) { 48 | active = this.data.badges.indexOf(badge); 49 | } 50 | 51 | if (active === this.currentActive) { 52 | return; 53 | } 54 | 55 | if (this.currentActive !== -1) { 56 | this.triggerEvent('change', active); 57 | } 58 | 59 | this.currentActive = active; 60 | this.data.badges.forEach((badge, index) => { 61 | badge.setActive(index === active); 62 | }); 63 | } 64 | } 65 | }); 66 | -------------------------------------------------------------------------------- /miniprogram/pages/index/index.js: -------------------------------------------------------------------------------- 1 | const db = wx.cloud.database() 2 | const book = db.collection('mybook') 3 | const _ = db.command 4 | 5 | Page({ 6 | 7 | /** 8 | * 页面的初始数据 9 | */ 10 | data: { 11 | book_list:[] 12 | }, 13 | 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad: function (options) { 18 | var _this = this; 19 | 20 | db.collection('mybook').get({ 21 | success: res => { 22 | this.setData({ 23 | book_list:res.data 24 | }) 25 | } 26 | }) 27 | }, 28 | 29 | /** 30 | * 生命周期函数--监听页面初次渲染完成 31 | */ 32 | onReady: function () { 33 | 34 | }, 35 | 36 | /** 37 | * 生命周期函数--监听页面显示 38 | */ 39 | onShow: function () { 40 | 41 | }, 42 | 43 | /** 44 | * 生命周期函数--监听页面隐藏 45 | */ 46 | onHide: function () { 47 | 48 | }, 49 | 50 | /** 51 | * 生命周期函数--监听页面卸载 52 | */ 53 | onUnload: function () { 54 | 55 | }, 56 | 57 | /** 58 | * 页面相关事件处理函数--监听用户下拉动作 59 | */ 60 | onPullDownRefresh: function () { 61 | 62 | }, 63 | 64 | /** 65 | * 页面上拉触底事件的处理函数 66 | */ 67 | onReachBottom: function () { 68 | 69 | }, 70 | 71 | /** 72 | * 用户点击右上角分享 73 | */ 74 | onShareAppMessage: function () { 75 | 76 | }, 77 | viewItem:function(event){ 78 | var id = event.currentTarget.dataset.id; 79 | wx.navigateTo({ 80 | url: '../bookDetail/bookDetail?id='+id 81 | }); 82 | } 83 | }) -------------------------------------------------------------------------------- /miniprogram/vant/tag/index.wxss: -------------------------------------------------------------------------------- 1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-tag{display:inline-block;padding:2px 5px;line-height:normal;border-radius:3px;font-size:10px;background:#c9c9c9;color:#fff}.van-tag::after{border-color:currentColor;border-radius:4px}.van-tag--mark{padding-right:7px;border-radius:0 8px 8px 0}.van-tag--mark::after{border-radius:0 16px 16px 0}.van-tag--success{background:#06bf04}.van-tag--success.van-tag--plain{color:#06bf04}.van-tag--danger{background:#f44}.van-tag--danger.van-tag--plain{color:#f44}.van-tag--primary{background:#38f}.van-tag--primary.van-tag--plain{color:#38f}.van-tag--plain{background:#fff;color:#c9c9c9} -------------------------------------------------------------------------------- /miniprogram/vant/stepper/index.wxss: -------------------------------------------------------------------------------- 1 | .van-stepper{font-size:0}.van-stepper__input,.van-stepper__minus,.van-stepper__plus{display:inline-block;vertical-align:middle;background-color:#fff}.van-stepper__minus,.van-stepper__plus{width:40px;height:30px;box-sizing:border-box;border:1px solid #e5e5e5;position:relative;padding:5px}.van-stepper__minus::before,.van-stepper__plus::before{width:9px;height:1px}.van-stepper__minus::after,.van-stepper__plus::after{width:1px;height:9px}.van-stepper__minus::after,.van-stepper__minus::before,.van-stepper__plus::after,.van-stepper__plus::before{content:'';position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;background-color:#6c6c6c}.van-stepper__minus:active,.van-stepper__plus:active{background-color:#e8e8e8}.van-stepper__minus--disabled,.van-stepper__plus--disabled{background-color:#f8f8f8}.van-stepper__minus--disabled::after,.van-stepper__minus--disabled::before,.van-stepper__plus--disabled::after,.van-stepper__plus--disabled::before{background-color:#c9c9c9}.van-stepper__minus--disabled:active,.van-stepper__plus--disabled:active{background-color:#f8f8f8}.van-stepper__minus{border-radius:2px 0 0 2px}.van-stepper__minus::after{display:none}.van-stepper__plus{border-radius:0 2px 2px 0}.van-stepper__input{width:33px;height:26px;padding:1px;border:1px solid #e5e5e5;border-width:1px 0;border-radius:0;box-sizing:content-box;color:#666;font-size:14px;text-align:center;-webkit-appearance:none}.van-stepper__input--disabled{color:#c9c9c9;background-color:#f8f8f8} -------------------------------------------------------------------------------- /miniprogram/vant/behaviors/button.js: -------------------------------------------------------------------------------- 1 | module.exports = Behavior({ 2 | properties: { 3 | loading: Boolean, 4 | // 在自定义组件中,无法与外界的 form 组件联动,暂时不开放 5 | // formType: String, 6 | openType: String, 7 | appParameter: String, 8 | // 暂时不开放,直接传入无法设置样式 9 | // hoverClass: { 10 | // type: String, 11 | // value: 'button-hover' 12 | // }, 13 | hoverStopPropagation: Boolean, 14 | hoverStartTime: { 15 | type: Number, 16 | value: 20 17 | }, 18 | hoverStayTime: { 19 | type: Number, 20 | value: 70 21 | }, 22 | lang: { 23 | type: String, 24 | value: 'en' 25 | }, 26 | sessionFrom: { 27 | type: String, 28 | value: '' 29 | }, 30 | sendMessageTitle: String, 31 | sendMessagePath: String, 32 | sendMessageImg: String, 33 | showMessageCard: String 34 | }, 35 | 36 | methods: { 37 | bindgetuserinfo(event = {}) { 38 | this.triggerEvent('getuserinfo', event.detail || {}); 39 | }, 40 | 41 | bindcontact(event = {}) { 42 | this.triggerEvent('contact', event.detail || {}); 43 | }, 44 | 45 | bindgetphonenumber(event = {}) { 46 | this.triggerEvent('getphonenumber', event.detail || {}); 47 | }, 48 | 49 | bindopensetting(event = {}) { 50 | this.triggerEvent('opensetting', event.detail || {}); 51 | }, 52 | 53 | binderror(event = {}) { 54 | this.triggerEvent('error', event.detail || {}); 55 | } 56 | } 57 | }); 58 | -------------------------------------------------------------------------------- /miniprogram/vant/button/behaviors.js: -------------------------------------------------------------------------------- 1 | module.exports = Behavior({ 2 | properties: { 3 | loading: Boolean, 4 | // 在自定义组件中,无法与外界的 form 组件联动,暂时不开放 5 | // formType: String, 6 | openType: String, 7 | appParameter: String, 8 | // 暂时不开放,直接传入无法设置样式 9 | // hoverClass: { 10 | // type: String, 11 | // value: 'button-hover' 12 | // }, 13 | hoverStopPropagation: Boolean, 14 | hoverStartTime: { 15 | type: Number, 16 | value: 20 17 | }, 18 | hoverStayTime: { 19 | type: Number, 20 | value: 70 21 | }, 22 | lang: { 23 | type: String, 24 | value: 'en' 25 | }, 26 | sessionFrom: { 27 | type: String, 28 | value: '' 29 | }, 30 | sendMessageTitle: String, 31 | sendMessagePath: String, 32 | sendMessageImg: String, 33 | showMessageCard: String 34 | }, 35 | 36 | methods: { 37 | bindgetuserinfo(event = {}) { 38 | this.triggerEvent('getuserinfo', event.detail || {}); 39 | }, 40 | 41 | bindcontact(event = {}) { 42 | this.triggerEvent('contact', event.detail || {}); 43 | }, 44 | 45 | bindgetphonenumber(event = {}) { 46 | this.triggerEvent('getphonenumber', event.detail || {}); 47 | }, 48 | 49 | bindopensetting(event = {}) { 50 | this.triggerEvent('opensetting', event.detail || {}); 51 | }, 52 | 53 | binderror(event = {}) { 54 | this.triggerEvent('error', event.detail || {}); 55 | } 56 | } 57 | }); 58 | -------------------------------------------------------------------------------- /miniprogram/vant/actionsheet/index.wxml: -------------------------------------------------------------------------------- 1 | 9 | 10 | {{ title }} 11 | 12 | 13 | 14 | 21 | 22 | {{ item.name }} 23 | {{ item.subname }} 24 | 25 | 26 | 27 | 28 | 33 | {{ cancelText }} 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 小程序云开发项目实战 · 私房书柜 · 课程 Demo 2 | 3 | By [腾讯云学院](https://cloud.tencent.com/developer/edu) 4 | 5 | ![](https://postimg.aliavv.com/newmbp/6fcr0.png) 6 | 7 | ## 课程需要 8 | 9 | 进行小程序云开发的实践时,需要你自行申请小程序云开发的公测资格,申请地址:https://wj.qq.com/s/2368934/4eb2 10 | 11 | ## 课程简介 12 | 13 | 本课程是基于微信小程序发布的[小程序云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)服务来开发一个微信小程序的项目 Demo。 14 | 15 | ## 课程目录 16 | 17 | 1. [课程概述](https://cloud.tencent.com/developer/edu/learn-100005-1244/3154) 18 | 2. [产品描述](https://cloud.tencent.com/developer/edu/learn-100005-1244/3142) 19 | 3. [云开发简介](https://cloud.tencent.com/developer/edu/learn-100005-1244/3143) 20 | 4. [微信登录实现](https://cloud.tencent.com/developer/edu/learn-100005-1244/3145) 21 | 5. [添加图书的实现](https://cloud.tencent.com/developer/edu/learn-100005-1244/3146) 22 | 6. [图书列表的实现](https://cloud.tencent.com/developer/edu/learn-100005-1244/3147) 23 | 7. [图书信息查看、更新和删除的实现](https://cloud.tencent.com/developer/edu/learn-100005-1244/3148) 24 | 25 | ## 课程基础信息 26 | 27 | 课程类型:**免费课程** 28 | 29 | 课程分类:**微信小程序开发基础课程** 30 | 31 | 适合人群:**微信小程序开发人员** 32 | 33 | 编程语言:**JavaScript** 34 | 35 | 课程地址:[**https://cloud.tencent.com/developer/edu/course-100005-1244**](https://cloud.tencent.com/developer/edu/course-100005-1244) 36 | 37 | ## 课程学习方法 38 | 访问 https://cloud.tencent.com/developer/edu/course-100005-1244 ,使用腾讯云账号登录后即可免费学习。 39 | 40 | ## 联系我们 41 | 42 | 添加微信号 **Tcloudedu** 并回复 1 可以进入到我们的云计算交流群。 43 | 44 | 或扫描下方二维码添加学院君 45 | 46 | ![二维码](https://ws2.sinaimg.cn/large/006tNc79ly1ftdrknbus3j30iq0owq3y.jpg) -------------------------------------------------------------------------------- /miniprogram/vant/col/index.wxss: -------------------------------------------------------------------------------- 1 | .van-col{float:left;box-sizing:border-box}.van-col--1{width:4.16667%}.van-col--offset-1{margin-left:4.16667%}.van-col--2{width:8.33333%}.van-col--offset-2{margin-left:8.33333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66667%}.van-col--offset-4{margin-left:16.66667%}.van-col--5{width:20.83333%}.van-col--offset-5{margin-left:20.83333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16667%}.van-col--offset-7{margin-left:29.16667%}.van-col--8{width:33.33333%}.van-col--offset-8{margin-left:33.33333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66667%}.van-col--offset-10{margin-left:41.66667%}.van-col--11{width:45.83333%}.van-col--offset-11{margin-left:45.83333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16667%}.van-col--offset-13{margin-left:54.16667%}.van-col--14{width:58.33333%}.van-col--offset-14{margin-left:58.33333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66667%}.van-col--offset-16{margin-left:66.66667%}.van-col--17{width:70.83333%}.van-col--offset-17{margin-left:70.83333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16667%}.van-col--offset-19{margin-left:79.16667%}.van-col--20{width:83.33333%}.van-col--offset-20{margin-left:83.33333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66667%}.van-col--offset-22{margin-left:91.66667%}.van-col--23{width:95.83333%}.van-col--offset-23{margin-left:95.83333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%} -------------------------------------------------------------------------------- /miniprogram/vant/badge/index.wxss: -------------------------------------------------------------------------------- 1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-badge{display:block;overflow:hidden;font-size:14px;line-height:1.4;-webkit-user-select:none;user-select:none;color:#666;word-break:break-all;box-sizing:border-box;padding:20px 12px 20px 9px;background-color:#f8f8f8;border-left:3px solid transparent}.van-badge:active{background-color:#e8e8e8}.van-badge::after{border-bottom-width:1px}.van-badge--active{font-weight:700;color:#333;border-color:#f44}.van-badge--active::after{border-right-width:1px}.van-badge--active,.van-badge--active:active{background-color:#fff}.van-badge__info{position:absolute;top:2px;right:2px;color:#fff;font-size:10px;font-weight:400;-webkit-transform:scale(.8);transform:scale(.8);text-align:center;box-sizing:border-box;padding:0 6px;min-width:18px;line-height:18px;border-radius:9px;background-color:#f44} -------------------------------------------------------------------------------- /miniprogram/vant/button/index.wxss: -------------------------------------------------------------------------------- 1 | .van-button{position:relative;padding:0;display:inline-block;height:44px;line-height:42px;border-radius:3px;box-sizing:border-box;font-size:16px;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button::after{content:" ";position:absolute;top:50%;left:50%;opacity:0;width:100%;height:100%;border:inherit;border-color:#000;background-color:#000;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-button:active::after{opacity:.3}.van-button--unclickable::after{display:none}.van-button--default{color:#333;background-color:#fff;border:1px solid #e5e5e5}.van-button--primary{color:#fff;background-color:#4b0;border:1px solid #4b0}.van-button--danger{color:#fff;background-color:#f44;border:1px solid #f44}.van-button--warning{color:#fff;background-color:#f85;border:1px solid #f85}.van-button--plain{background-color:#fff}.van-button--plain.van-button--primary{color:#4b0}.van-button--plain.van-button--danger{color:#f44}.van-button--plain.van-button--warning{color:#f85}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{height:30px;padding:0 8px;min-width:60px;font-size:12px;line-height:28px}.van-button--loading .van-loading{display:inline-block}.van-button--loading .van-button__text{display:none}.van-button--mini{display:inline-block;width:50px;height:22px;line-height:20px;font-size:10px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{width:100%;display:block}.van-button--square{border-radius:0}.van-button--disabled{color:#999;background-color:#e8e8e8;border:1px solid #e5e5e5} -------------------------------------------------------------------------------- /miniprogram/vant/toast/toast.js: -------------------------------------------------------------------------------- 1 | import { isObj } from '../utils/index'; 2 | 3 | const defaultOptions = { 4 | type: 'text', 5 | mask: false, 6 | message: '', 7 | show: true, 8 | duration: 3000, 9 | position: 'middle', 10 | forbidClick: false, 11 | loadingType: 'circular', 12 | selector: '#van-toast' 13 | }; 14 | const parseOptions = message => isObj(message) ? message : { message }; 15 | 16 | let queue = []; 17 | let currentOptions = { ...defaultOptions }; 18 | 19 | function Toast(options = {}) { 20 | options = { 21 | ...currentOptions, 22 | ...parseOptions(options) 23 | }; 24 | 25 | const pages = getCurrentPages(); 26 | const ctx = pages[pages.length - 1]; 27 | 28 | const toast = ctx.selectComponent(options.selector); 29 | delete options.selector; 30 | 31 | queue.push(toast); 32 | toast.setData(options); 33 | clearTimeout(toast.timer); 34 | 35 | if (options.duration > 0) { 36 | toast.timer = setTimeout(() => { 37 | toast.clear(); 38 | queue = queue.filter(item => item !== toast); 39 | }, options.duration); 40 | } 41 | 42 | return toast; 43 | }; 44 | 45 | const createMethod = type => options => Toast({ 46 | type, ...parseOptions(options) 47 | }); 48 | 49 | ['loading', 'success', 'fail'].forEach(method => { 50 | Toast[method] = createMethod(method); 51 | }); 52 | 53 | Toast.clear = all => { 54 | queue.forEach(toast => { 55 | toast.clear(); 56 | }); 57 | queue = []; 58 | }; 59 | 60 | Toast.setDefaultOptions = options => { 61 | Object.assign(currentOptions, options); 62 | }; 63 | 64 | Toast.resetDefaultOptions = () => { 65 | currentOptions = { ...defaultOptions }; 66 | }; 67 | 68 | export default Toast; 69 | -------------------------------------------------------------------------------- /miniprogram/vant/actionsheet/index.wxss: -------------------------------------------------------------------------------- 1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-actionsheet{color:#333;max-height:90%;overflow-y:auto;-webkit-overflow-scrolling:touch;background-color:#f8f8f8}.van-actionsheet--withtitle{background-color:#fff}.van-actionsheet__cancel,.van-actionsheet__item{height:50px;line-height:50px;font-size:16px;text-align:center;background-color:#fff}.van-actionsheet__cancel:active,.van-actionsheet__item:active{background-color:#e8e8e8}.van-actionsheet__item--disabled{color:#c9c9c9}.van-actionsheet__item--disabled:active{background-color:#fff}.van-actionsheet__subname{font-size:12px;color:#666;margin-left:5px}.van-actionsheet__loading{display:inline-block}.van-actionsheet__cancel{margin-top:10px}.van-actionsheet__header{font-size:16px;line-height:44px;text-align:center}.van-actionsheet__close{top:0;right:0;padding:0 15px;font-size:18px;color:#999;position:absolute;line-height:inherit} -------------------------------------------------------------------------------- /miniprogram/vant/tabbar/index.js: -------------------------------------------------------------------------------- 1 | const ITEM_PATH = '../tabbar-item/index'; 2 | 3 | Component({ 4 | options: { 5 | addGlobalClass: true 6 | }, 7 | 8 | externalClasses: ['custom-class'], 9 | 10 | properties: { 11 | active: { 12 | type: Number, 13 | observer(active) { 14 | this.setData({ currentActive: active }); 15 | this.setActiveItem(); 16 | } 17 | }, 18 | fixed: { 19 | type: Boolean, 20 | value: true 21 | }, 22 | zIndex: { 23 | type: Number, 24 | value: 1 25 | } 26 | }, 27 | 28 | data: { 29 | items: [], 30 | currentActive: -1 31 | }, 32 | 33 | attached() { 34 | this.setData({ currentActive: this.data.active }); 35 | }, 36 | 37 | relations: { 38 | [ITEM_PATH]: { 39 | type: 'descendant', 40 | 41 | linked(target) { 42 | this.data.items.push(target); 43 | this.setActiveItem(); 44 | }, 45 | 46 | unlinked(target) { 47 | this.data.items = this.data.items.filter(item => item !== target); 48 | this.setActiveItem(); 49 | } 50 | } 51 | }, 52 | 53 | methods: { 54 | setActiveItem() { 55 | this.data.items.forEach((item, index) => { 56 | item.setData({ 57 | active: index === this.data.currentActive, 58 | count: this.data.items.length 59 | }); 60 | }); 61 | }, 62 | 63 | onChange(child) { 64 | const active = this.data.items.indexOf(child); 65 | if (active !== this.data.currentActive && active !== -1) { 66 | this.triggerEvent('change', active); 67 | this.setData({ currentActive: active }); 68 | this.setActiveItem(); 69 | } 70 | } 71 | } 72 | }); 73 | -------------------------------------------------------------------------------- /miniprogram/pages/bookDetail/bookDetail.js: -------------------------------------------------------------------------------- 1 | const db = wx.cloud.database(); 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | 9 | }, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | db.collection('mybook').doc(options.id).get({ 16 | success: res => { 17 | console.log(res.data); 18 | this.setData({ 19 | book: res.data, 20 | id:options.id 21 | }); 22 | }, 23 | fail:err => { 24 | console.error(err); 25 | } 26 | }) 27 | //console.log(options) 28 | }, 29 | 30 | /** 31 | * 生命周期函数--监听页面初次渲染完成 32 | */ 33 | onReady: function () { 34 | 35 | }, 36 | 37 | /** 38 | * 生命周期函数--监听页面显示 39 | */ 40 | onShow: function () { 41 | 42 | }, 43 | 44 | /** 45 | * 生命周期函数--监听页面隐藏 46 | */ 47 | onHide: function () { 48 | 49 | }, 50 | 51 | /** 52 | * 生命周期函数--监听页面卸载 53 | */ 54 | onUnload: function () { 55 | 56 | }, 57 | 58 | /** 59 | * 页面相关事件处理函数--监听用户下拉动作 60 | */ 61 | onPullDownRefresh: function () { 62 | 63 | }, 64 | 65 | /** 66 | * 页面上拉触底事件的处理函数 67 | */ 68 | onReachBottom: function () { 69 | 70 | }, 71 | 72 | /** 73 | * 用户点击右上角分享 74 | */ 75 | onShareAppMessage: function () { 76 | 77 | }, 78 | update:function(event){ 79 | console.log(event) 80 | db.collection('mybook').doc(this.data.id).update({ 81 | data: { 82 | title: "局部更新测试2" 83 | }, 84 | success: function (res) { 85 | console.log(res) 86 | } 87 | }) 88 | }, 89 | delete: function (event) { 90 | db.collection('mybook').doc(this.data.id).remove({ 91 | success: function (res) { 92 | console.log(res) 93 | } 94 | }) 95 | } 96 | }) -------------------------------------------------------------------------------- /miniprogram/vant/button/index.js: -------------------------------------------------------------------------------- 1 | const buttonBehaviors = require('../behaviors/button'); 2 | const classnames = require('../common/classnames'); 3 | 4 | const observer = function() { 5 | this.setClasses(); 6 | }; 7 | 8 | Component({ 9 | options: { 10 | addGlobalClass: true 11 | }, 12 | 13 | externalClasses: ['custom-class', 'loading-class'], 14 | 15 | behaviors: [buttonBehaviors], 16 | 17 | properties: { 18 | type: { 19 | type: String, 20 | value: 'default', 21 | observer 22 | }, 23 | size: { 24 | type: String, 25 | value: 'normal', 26 | observer 27 | }, 28 | plain: { 29 | type: Boolean, 30 | observer 31 | }, 32 | disabled: { 33 | type: Boolean, 34 | observer 35 | }, 36 | loading: { 37 | type: Boolean, 38 | observer 39 | }, 40 | block: { 41 | type: Boolean, 42 | observer 43 | }, 44 | square: { 45 | type: Boolean, 46 | observer 47 | } 48 | }, 49 | 50 | attached() { 51 | this.setClasses(); 52 | }, 53 | 54 | methods: { 55 | onClick() { 56 | if (!this.data.disabled && !this.data.loading) { 57 | this.triggerEvent('click'); 58 | } 59 | }, 60 | 61 | setClasses() { 62 | const { type, size, plain, disabled, loading, square, block } = this.data; 63 | this.setData({ 64 | classes: classnames(`van-button--${type}`, `van-button--${size}`, { 65 | 'van-button--block': block, 66 | 'van-button--plain': plain, 67 | 'van-button--square': square, 68 | 'van-button--loading': loading, 69 | 'van-button--disabled': disabled, 70 | 'van-button--unclickable': disabled || loading 71 | }) 72 | }); 73 | } 74 | } 75 | }); 76 | -------------------------------------------------------------------------------- /miniprogram/vant/tree-select/index.wxss: -------------------------------------------------------------------------------- 1 | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.van-clearfix::after{content:'';display:table;clear:both}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.tree-select{-webkit-user-select:none;user-select:none;position:relative;font-size:16px}.tree-select__nav{width:143px;position:absolute;left:0;top:0;bottom:0;overflow:scroll;background-color:#fff;-webkit-overflow-scrolling:touch}.tree-select__nitem{line-height:44px;padding:0 15px;background-color:#fff}.tree-select__nitem--active{background-color:#f8f8f8}.tree-select__content{padding:0 15px;margin-left:143px;overflow:scroll;-webkit-overflow-scrolling:touch}.tree-select__item{position:relative;line-height:44px;padding-left:5px;padding-right:18px}.tree-select__item--active{color:#f44}.tree-select__selected{float:right;position:absolute;right:0;top:0;bottom:0;line-height:inherit} -------------------------------------------------------------------------------- /miniprogram/vant/tree-select/index.js: -------------------------------------------------------------------------------- 1 | const ITEM_HEIGHT = 44; 2 | 3 | Component({ 4 | options: { 5 | addGlobalClass: true 6 | }, 7 | 8 | properties: { 9 | items: { 10 | type: Array, 11 | observer() { 12 | this.updateSubItems(); 13 | this.updateMainHeight(); 14 | } 15 | }, 16 | mainActiveIndex: { 17 | type: Number, 18 | value: 0, 19 | observer() { 20 | this.updateSubItems(); 21 | } 22 | }, 23 | activeId: { 24 | type: Number, 25 | value: 0 26 | }, 27 | maxHeight: { 28 | type: Number, 29 | value: 300, 30 | observer() { 31 | this.updateItemHeight(); 32 | this.updateMainHeight(); 33 | } 34 | } 35 | }, 36 | 37 | data: { 38 | subItems: [], 39 | mainHeight: 0, 40 | itemHeight: 0 41 | }, 42 | 43 | methods: { 44 | // 当一个子项被选择时 45 | onSelectItem(event) { 46 | const { 47 | dataset = {} 48 | } = event.currentTarget || {}; 49 | this.triggerEvent('click-item', { ...(dataset.item || {}) }); 50 | }, 51 | 52 | // 当一个导航被点击时 53 | onClickNav(event) { 54 | const { 55 | dataset = {} 56 | } = event.currentTarget || {}; 57 | this.triggerEvent('click-nav', { index: dataset.index }); 58 | }, 59 | 60 | // 更新子项列表 61 | updateSubItems() { 62 | const selectedItem = this.data.items[this.data.mainActiveIndex] || {}; 63 | 64 | this.setData({ subItems: selectedItem.children || [] }); 65 | 66 | this.updateItemHeight(); 67 | }, 68 | 69 | // 更新组件整体高度,根据最大高度和当前组件需要展示的高度来决定 70 | updateMainHeight() { 71 | const maxHeight = Math.max(this.data.items.length * ITEM_HEIGHT, this.data.subItems.length * ITEM_HEIGHT); 72 | 73 | this.setData({ mainHeight: Math.min(maxHeight, this.data.maxHeight) }); 74 | }, 75 | 76 | // 更新子项列表高度,根据可展示的最大高度和当前子项列表的高度决定 77 | updateItemHeight() { 78 | this.setData({ itemHeight: Math.min(this.data.subItems.length * ITEM_HEIGHT, this.data.maxHeight) }); 79 | } 80 | } 81 | }); 82 | -------------------------------------------------------------------------------- /miniprogram/pages/scanCode/scanCode.js: -------------------------------------------------------------------------------- 1 | // pages/scanCode/scanCode.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | 9 | }, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | 16 | }, 17 | 18 | /** 19 | * 生命周期函数--监听页面初次渲染完成 20 | */ 21 | onReady: function () { 22 | 23 | }, 24 | 25 | /** 26 | * 生命周期函数--监听页面显示 27 | */ 28 | onShow: function () { 29 | 30 | }, 31 | 32 | /** 33 | * 生命周期函数--监听页面隐藏 34 | */ 35 | onHide: function () { 36 | 37 | }, 38 | 39 | /** 40 | * 生命周期函数--监听页面卸载 41 | */ 42 | onUnload: function () { 43 | 44 | }, 45 | 46 | /** 47 | * 页面相关事件处理函数--监听用户下拉动作 48 | */ 49 | onPullDownRefresh: function () { 50 | 51 | }, 52 | 53 | /** 54 | * 页面上拉触底事件的处理函数 55 | */ 56 | onReachBottom: function () { 57 | 58 | }, 59 | 60 | /** 61 | * 用户点击右上角分享 62 | */ 63 | onShareAppMessage: function () { 64 | 65 | }, 66 | scanCode: function (event) { 67 | wx.scanCode({ 68 | onlyFromCamera: true, 69 | scanType: ['barCode'], 70 | success: res => { 71 | wx.cloud.callFunction({ 72 | name: 'bookinfo', 73 | // 传递给云函数的参数 74 | data: { 75 | isbn: res.result 76 | }, 77 | success: res => { 78 | var bookString = res.result; 79 | // console.log(JSON.parse(bookString)) 80 | const db = wx.cloud.database() 81 | const book = db.collection('mybook') 82 | // set price , shop 83 | db.collection('mybook').add({ 84 | data: JSON.parse(bookString) 85 | }).then(res => { 86 | console.log(res) 87 | }).catch(err => { 88 | console.log(err) 89 | }) 90 | }, 91 | fail: err => { 92 | console.error(err) 93 | } 94 | }) 95 | }, 96 | fail: err => { 97 | console.log(err); 98 | } 99 | }) 100 | } 101 | }) -------------------------------------------------------------------------------- /miniprogram/vant/cell/index.wxss: -------------------------------------------------------------------------------- 1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-cell{width:100%;display:-webkit-box;display:-webkit-flex;display:flex;padding:10px 15px;box-sizing:border-box;line-height:24px;position:relative;background-color:#fff;color:#333;font-size:14px}.van-cell::after{left:15px;right:0;width:auto;-webkit-transform:scale(1,.5);transform:scale(1,.5);border-bottom-width:1px}.van-cell-group{background-color:#fff}.van-cell__label{font-size:12px;line-height:1.2;color:#666}.van-cell__title,.van-cell__value{-webkit-box-flex:1;-webkit-flex:1;flex:1}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle}.van-cell__left-icon{font-size:16px;line-height:24px;margin-right:5px;vertical-align:middle}.van-cell__right-icon{color:#999;font-size:12px;line-height:24px;margin-left:5px}.van-cell__right-icon--left::before{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.van-cell__right-icon--up::before{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-cell__right-icon--down::before{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.van-cell--clickable:active{background-color:#e8e8e8}.van-cell--required{overflow:visible}.van-cell--required::before{content:'*';position:absolute;left:7px;font-size:14px;color:#f44}.van-cell--center{-webkit-box-align:center;-webkit-align-items:center;align-items:center} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node,osx 3 | 4 | ### Node ### 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | 24 | # nyc test coverage 25 | .nyc_output 26 | 27 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 28 | .grunt 29 | 30 | # Bower dependency directory (https://bower.io/) 31 | bower_components 32 | 33 | # node-waf configuration 34 | .lock-wscript 35 | 36 | # Compiled binary addons (https://nodejs.org/api/addons.html) 37 | build/Release 38 | 39 | # Dependency directories 40 | node_modules/ 41 | jspm_packages/ 42 | 43 | # TypeScript v1 declaration files 44 | typings/ 45 | 46 | # Optional npm cache directory 47 | .npm 48 | 49 | # Optional eslint cache 50 | .eslintcache 51 | 52 | # Optional REPL history 53 | .node_repl_history 54 | 55 | # Output of 'npm pack' 56 | *.tgz 57 | 58 | # Yarn Integrity file 59 | .yarn-integrity 60 | 61 | # dotenv environment variables file 62 | .env 63 | 64 | # parcel-bundler cache (https://parceljs.org/) 65 | .cache 66 | 67 | # next.js build output 68 | .next 69 | 70 | # nuxt.js build output 71 | .nuxt 72 | 73 | # vuepress build output 74 | .vuepress/dist 75 | 76 | # Serverless directories 77 | .serverless 78 | 79 | ### OSX ### 80 | # General 81 | .DS_Store 82 | .AppleDouble 83 | .LSOverride 84 | 85 | # Icon must end with two \r 86 | Icon 87 | 88 | # Thumbnails 89 | ._* 90 | 91 | # Files that might appear in the root of a volume 92 | .DocumentRevisions-V100 93 | .fseventsd 94 | .Spotlight-V100 95 | .TemporaryItems 96 | .Trashes 97 | .VolumeIcon.icns 98 | .com.apple.timemachine.donotpresent 99 | 100 | # Directories potentially created on remote AFP share 101 | .AppleDB 102 | .AppleDesktop 103 | Network Trash Folder 104 | Temporary Items 105 | .apdisk 106 | 107 | 108 | # End of https://www.gitignore.io/api/node,osx 109 | -------------------------------------------------------------------------------- /cloudfunctions/batchupdate/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node,osx 3 | 4 | ### Node ### 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | 24 | # nyc test coverage 25 | .nyc_output 26 | 27 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 28 | .grunt 29 | 30 | # Bower dependency directory (https://bower.io/) 31 | bower_components 32 | 33 | # node-waf configuration 34 | .lock-wscript 35 | 36 | # Compiled binary addons (https://nodejs.org/api/addons.html) 37 | build/Release 38 | 39 | # Dependency directories 40 | node_modules/ 41 | jspm_packages/ 42 | 43 | # TypeScript v1 declaration files 44 | typings/ 45 | 46 | # Optional npm cache directory 47 | .npm 48 | 49 | # Optional eslint cache 50 | .eslintcache 51 | 52 | # Optional REPL history 53 | .node_repl_history 54 | 55 | # Output of 'npm pack' 56 | *.tgz 57 | 58 | # Yarn Integrity file 59 | .yarn-integrity 60 | 61 | # dotenv environment variables file 62 | .env 63 | 64 | # parcel-bundler cache (https://parceljs.org/) 65 | .cache 66 | 67 | # next.js build output 68 | .next 69 | 70 | # nuxt.js build output 71 | .nuxt 72 | 73 | # vuepress build output 74 | .vuepress/dist 75 | 76 | # Serverless directories 77 | .serverless 78 | 79 | ### OSX ### 80 | # General 81 | .DS_Store 82 | .AppleDouble 83 | .LSOverride 84 | 85 | # Icon must end with two \r 86 | Icon 87 | 88 | # Thumbnails 89 | ._* 90 | 91 | # Files that might appear in the root of a volume 92 | .DocumentRevisions-V100 93 | .fseventsd 94 | .Spotlight-V100 95 | .TemporaryItems 96 | .Trashes 97 | .VolumeIcon.icns 98 | .com.apple.timemachine.donotpresent 99 | 100 | # Directories potentially created on remote AFP share 101 | .AppleDB 102 | .AppleDesktop 103 | Network Trash Folder 104 | Temporary Items 105 | .apdisk 106 | 107 | 108 | # End of https://www.gitignore.io/api/node,osx 109 | -------------------------------------------------------------------------------- /cloudfunctions/bookinfo/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node,osx 3 | 4 | ### Node ### 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | 24 | # nyc test coverage 25 | .nyc_output 26 | 27 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 28 | .grunt 29 | 30 | # Bower dependency directory (https://bower.io/) 31 | bower_components 32 | 33 | # node-waf configuration 34 | .lock-wscript 35 | 36 | # Compiled binary addons (https://nodejs.org/api/addons.html) 37 | build/Release 38 | 39 | # Dependency directories 40 | node_modules/ 41 | jspm_packages/ 42 | 43 | # TypeScript v1 declaration files 44 | typings/ 45 | 46 | # Optional npm cache directory 47 | .npm 48 | 49 | # Optional eslint cache 50 | .eslintcache 51 | 52 | # Optional REPL history 53 | .node_repl_history 54 | 55 | # Output of 'npm pack' 56 | *.tgz 57 | 58 | # Yarn Integrity file 59 | .yarn-integrity 60 | 61 | # dotenv environment variables file 62 | .env 63 | 64 | # parcel-bundler cache (https://parceljs.org/) 65 | .cache 66 | 67 | # next.js build output 68 | .next 69 | 70 | # nuxt.js build output 71 | .nuxt 72 | 73 | # vuepress build output 74 | .vuepress/dist 75 | 76 | # Serverless directories 77 | .serverless 78 | 79 | ### OSX ### 80 | # General 81 | .DS_Store 82 | .AppleDouble 83 | .LSOverride 84 | 85 | # Icon must end with two \r 86 | Icon 87 | 88 | # Thumbnails 89 | ._* 90 | 91 | # Files that might appear in the root of a volume 92 | .DocumentRevisions-V100 93 | .fseventsd 94 | .Spotlight-V100 95 | .TemporaryItems 96 | .Trashes 97 | .VolumeIcon.icns 98 | .com.apple.timemachine.donotpresent 99 | 100 | # Directories potentially created on remote AFP share 101 | .AppleDB 102 | .AppleDesktop 103 | Network Trash Folder 104 | Temporary Items 105 | .apdisk 106 | 107 | 108 | # End of https://www.gitignore.io/api/node,osx 109 | -------------------------------------------------------------------------------- /miniprogram/vant/loading/index.wxss: -------------------------------------------------------------------------------- 1 | .van-loading{z-index:0;font-size:0;line-height:0;position:relative;display:inline-block;vertical-align:middle}.van-loading__spinner{z-index:-1;width:100%;height:100%;position:relative;display:inline-block;box-sizing:border-box;-webkit-animation:van-rotate .8s linear infinite;animation:van-rotate .8s linear infinite}.van-loading__spinner--spinner{-webkit-animation-timing-function:steps(12);animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid;border-radius:100%;border-color:currentColor;border-top-color:transparent}.van-loading__dot{top:0;left:0;width:100%;height:100%;position:absolute}.van-loading__dot::before{width:2px;height:25%;content:' ';display:block;margin:0 auto;border-radius:40%;background-color:currentColor}.van-loading__dot:nth-of-type(1){opacity:1;-webkit-transform:rotate(30deg);transform:rotate(30deg)}.van-loading__dot:nth-of-type(2){opacity:.9375;-webkit-transform:rotate(60deg);transform:rotate(60deg)}.van-loading__dot:nth-of-type(3){opacity:.875;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.van-loading__dot:nth-of-type(4){opacity:.8125;-webkit-transform:rotate(120deg);transform:rotate(120deg)}.van-loading__dot:nth-of-type(5){opacity:.75;-webkit-transform:rotate(150deg);transform:rotate(150deg)}.van-loading__dot:nth-of-type(6){opacity:.6875;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.van-loading__dot:nth-of-type(7){opacity:.625;-webkit-transform:rotate(210deg);transform:rotate(210deg)}.van-loading__dot:nth-of-type(8){opacity:.5625;-webkit-transform:rotate(240deg);transform:rotate(240deg)}.van-loading__dot:nth-of-type(9){opacity:.5;-webkit-transform:rotate(270deg);transform:rotate(270deg)}.van-loading__dot:nth-of-type(10){opacity:.4375;-webkit-transform:rotate(300deg);transform:rotate(300deg)}.van-loading__dot:nth-of-type(11){opacity:.375;-webkit-transform:rotate(330deg);transform:rotate(330deg)}.van-loading__dot:nth-of-type(12){opacity:.3125;-webkit-transform:rotate(360deg);transform:rotate(360deg)}@-webkit-keyframes van-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes van-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}} -------------------------------------------------------------------------------- /miniprogram/vant/popup/index.wxss: -------------------------------------------------------------------------------- 1 | .van-popup{top:50%;left:50%;z-index:11;max-height:100%;overflow-y:auto;box-sizing:border-box;background-color:#fff;-webkit-overflow-scrolling:touch;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup,.van-popup__overlay{display:none;position:fixed;-webkit-animation:van-fade-in .3s ease;animation:van-fade-in .3s ease}.van-popup__overlay{width:100%;height:100%;top:0;left:0;z-index:10;background-color:rgba(0,0,0,.7)}.van-popup--top{width:100%;top:0;right:auto;bottom:auto;left:50%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0);-webkit-animation-name:van-popup-top;animation-name:van-popup-top}.van-popup--right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0);-webkit-animation-name:van-popup-right;animation-name:van-popup-right}.van-popup--bottom{width:100%;top:auto;bottom:0;right:auto;left:50%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0);-webkit-animation-name:van-popup-bottom;animation-name:van-popup-bottom}.van-popup--left{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0);-webkit-animation-name:van-popup-left;animation-name:van-popup-left}.van-popup--show{display:block}@-webkit-keyframes van-popup-top{from{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}}@keyframes van-popup-top{from{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}}@-webkit-keyframes van-popup-bottom{from{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}}@keyframes van-popup-bottom{from{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}}@-webkit-keyframes van-popup-left{from{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}}@keyframes van-popup-left{from{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}}@-webkit-keyframes van-popup-right{from{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}}@keyframes van-popup-right{from{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}}@-webkit-keyframes van-fade-in{from{opacity:0}to{opacity:1}}@keyframes van-fade-in{from{opacity:0}to{opacity:1}} -------------------------------------------------------------------------------- /miniprogram/vant/slider/index.js: -------------------------------------------------------------------------------- 1 | const touchBehaviors = require('../behaviors/touch'); 2 | 3 | Component({ 4 | options: { 5 | addGlobalClass: true 6 | }, 7 | 8 | externalClasses: ['custom-class'], 9 | 10 | behaviors: [touchBehaviors], 11 | 12 | properties: { 13 | disabled: Boolean, 14 | max: { 15 | type: Number, 16 | value: 100 17 | }, 18 | min: { 19 | type: Number, 20 | value: 0 21 | }, 22 | step: { 23 | type: Number, 24 | value: 1 25 | }, 26 | value: { 27 | type: Number, 28 | value: 0 29 | }, 30 | barHeight: { 31 | type: String, 32 | value: '2px' 33 | } 34 | }, 35 | 36 | attached() { 37 | this.updateValue(this.data.value); 38 | }, 39 | 40 | methods: { 41 | getRect(callback) { 42 | wx.createSelectorQuery() 43 | .in(this) 44 | .select('.van-slider') 45 | .boundingClientRect(callback) 46 | .exec(); 47 | }, 48 | 49 | onTouchStart(event) { 50 | if (this.data.disabled) return; 51 | 52 | this.touchStart(event); 53 | this.startValue = this.format(this.data.value); 54 | }, 55 | 56 | onTouchMove(event) { 57 | if (this.data.disabled) return; 58 | 59 | this.touchMove(event); 60 | this.getRect(rect => { 61 | const diff = this.deltaX / rect.width * 100; 62 | this.updateValue(this.startValue + diff); 63 | }); 64 | }, 65 | 66 | onTouchEnd() { 67 | if (this.data.disabled) return; 68 | this.updateValue(this.data.value, true); 69 | }, 70 | 71 | onClick(event) { 72 | if (this.data.disabled) return; 73 | 74 | this.getRect(rect => { 75 | const value = (event.detail.x - rect.left) / rect.width * 100; 76 | this.updateValue(value, true); 77 | }); 78 | }, 79 | 80 | updateValue(value, end) { 81 | value = this.format(value); 82 | 83 | this.setData({ 84 | value, 85 | barStyle: `width: ${value}%; height: ${this.data.barHeight};` 86 | }); 87 | 88 | if (end) { 89 | this.triggerEvent('change', value); 90 | } 91 | }, 92 | 93 | format(value) { 94 | const { max, min, step } = this.data; 95 | return Math.round(Math.max(min, Math.min(value, max)) / step) * step; 96 | } 97 | } 98 | }); 99 | -------------------------------------------------------------------------------- /miniprogram/vant/stepper/index.js: -------------------------------------------------------------------------------- 1 | // Note that the bitwise operators and shift operators operate on 32-bit ints 2 | // so in that case, the max safe integer is 2^31-1, or 2147483647 3 | const MAX = 2147483647; 4 | 5 | Component({ 6 | options: { 7 | addGlobalClass: true 8 | }, 9 | 10 | externalClasses: [ 11 | 'custom-class', 12 | 'input-class', 13 | 'plus-class', 14 | 'minus-class' 15 | ], 16 | 17 | properties: { 18 | value: { 19 | type: null, 20 | observer(val) { 21 | if (val !== this.currentValue) { 22 | this.setData({ currentValue: this.range(val) }); 23 | } 24 | } 25 | }, 26 | integer: Boolean, 27 | disabled: Boolean, 28 | disableInput: Boolean, 29 | min: { 30 | type: null, 31 | value: 1 32 | }, 33 | max: { 34 | type: null, 35 | value: MAX 36 | }, 37 | step: { 38 | type: null, 39 | value: 1 40 | } 41 | }, 42 | 43 | attached() { 44 | this.setData({ 45 | currentValue: this.range(this.data.value) 46 | }); 47 | }, 48 | 49 | methods: { 50 | // limit value range 51 | range(value) { 52 | return Math.max(Math.min(this.data.max, value), this.data.min); 53 | }, 54 | 55 | onInput(event) { 56 | const { value = '' } = event.detail || {}; 57 | this.triggerInput(value); 58 | }, 59 | 60 | onChange(type) { 61 | if (this[`${type}Disabled`]) { 62 | this.triggerEvent('overlimit', type); 63 | return; 64 | } 65 | 66 | const diff = type === 'minus' ? -this.data.step : +this.data.step; 67 | const value = Math.round((this.data.currentValue + diff) * 100) / 100; 68 | this.triggerInput(this.range(value)); 69 | this.triggerEvent(type); 70 | }, 71 | 72 | onBlur(event) { 73 | const currentValue = this.range(this.data.currentValue); 74 | this.triggerInput(currentValue); 75 | this.triggerEvent('blur', event); 76 | }, 77 | 78 | onMinus() { 79 | this.onChange('minus'); 80 | }, 81 | 82 | onPlus() { 83 | this.onChange('plus'); 84 | }, 85 | 86 | triggerInput(currentValue) { 87 | this.setData({ currentValue }); 88 | this.triggerEvent('input', currentValue); 89 | this.triggerEvent('change', currentValue); 90 | } 91 | } 92 | }); 93 | -------------------------------------------------------------------------------- /miniprogram/vant/field/index.wxml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 |