├── .gitignore
├── page
├── API
│ ├── pages
│ │ ├── request
│ │ │ ├── request.wxss
│ │ │ ├── request.json
│ │ │ ├── request.wxml
│ │ │ └── request.js
│ │ ├── navigator
│ │ │ ├── navigator.wxss
│ │ │ ├── navigator.json
│ │ │ ├── navigator.js
│ │ │ └── navigator.wxml
│ │ ├── custom-service
│ │ │ ├── custom-service.wxss
│ │ │ ├── custom-service.js
│ │ │ ├── custom-service.json
│ │ │ └── custom-service.wxml
│ │ ├── custom-message
│ │ │ ├── custom-message.js
│ │ │ ├── custom-message.json
│ │ │ └── custom-message.wxml
│ │ ├── sendMessage
│ │ │ ├── sendMessage.js
│ │ │ ├── sendMessage.wxss
│ │ │ ├── sendMessage.json
│ │ │ └── sendMessage.wxml
│ │ ├── navigation-bar-loading
│ │ │ ├── navigation-bar-loading.wxss
│ │ │ ├── navigation-bar-loading.json
│ │ │ ├── navigation-bar-loading.js
│ │ │ └── navigation-bar-loading.wxml
│ │ ├── image
│ │ │ ├── image.wxss
│ │ │ ├── image.json
│ │ │ ├── image.js
│ │ │ └── image.wxml
│ │ ├── share
│ │ │ ├── share.wxss
│ │ │ ├── share.json
│ │ │ ├── share.js
│ │ │ └── share.wxml
│ │ ├── storage
│ │ │ ├── storage.wxss
│ │ │ ├── storage.json
│ │ │ ├── storage.wxml
│ │ │ └── storage.js
│ │ ├── file
│ │ │ ├── file.json
│ │ │ ├── file.wxss
│ │ │ ├── file.wxml
│ │ │ └── file.js
│ │ ├── voice
│ │ │ ├── voice.json
│ │ │ ├── voice.wxss
│ │ │ ├── voice.wxml
│ │ │ └── voice.js
│ │ ├── canvas
│ │ │ ├── canvas.json
│ │ │ ├── canvas.wxss
│ │ │ ├── canvas.wxml
│ │ │ └── canvas.js
│ │ ├── login
│ │ │ ├── login.json
│ │ │ ├── login.js
│ │ │ ├── login.wxss
│ │ │ └── login.wxml
│ │ ├── modal
│ │ │ ├── modal.json
│ │ │ ├── modal.wxml
│ │ │ └── modal.js
│ │ ├── open-location
│ │ │ ├── open-location.wxss
│ │ │ ├── open-location.json
│ │ │ ├── open-location.js
│ │ │ └── open-location.wxml
│ │ ├── toast
│ │ │ ├── toast.json
│ │ │ ├── toast.js
│ │ │ └── toast.wxml
│ │ ├── video
│ │ │ ├── video.json
│ │ │ ├── video.wxss
│ │ │ ├── video.js
│ │ │ └── video.wxml
│ │ ├── web-socket
│ │ │ ├── web-socket.wxss
│ │ │ ├── web-socket.json
│ │ │ ├── web-socket.wxml
│ │ │ └── web-socket.js
│ │ ├── animation
│ │ │ ├── animation.json
│ │ │ ├── animation.wxss
│ │ │ ├── animation.wxml
│ │ │ └── animation.js
│ │ ├── get-system-info
│ │ │ ├── get-system-info.wxss
│ │ │ ├── get-system-info.json
│ │ │ ├── get-system-info.js
│ │ │ └── get-system-info.wxml
│ │ ├── scan-code
│ │ │ ├── scan-code.json
│ │ │ ├── scan-code.wxss
│ │ │ ├── scan-code.js
│ │ │ └── scan-code.wxml
│ │ ├── template-message
│ │ │ ├── template-message.wxss
│ │ │ ├── template-message.json
│ │ │ ├── template-message.js
│ │ │ └── template-message.wxml
│ │ ├── action-sheet
│ │ │ ├── action-sheet.json
│ │ │ ├── action-sheet.wxss
│ │ │ ├── action-sheet.js
│ │ │ └── action-sheet.wxml
│ │ ├── get-location
│ │ │ ├── get-location.json
│ │ │ ├── get-location.wxss
│ │ │ ├── get-location.js
│ │ │ └── get-location.wxml
│ │ ├── upload-file
│ │ │ ├── upload-file.json
│ │ │ ├── upload-file.wxss
│ │ │ ├── upload-file.wxml
│ │ │ └── upload-file.js
│ │ ├── choose-location
│ │ │ ├── choose-location.json
│ │ │ ├── choose-location.wxss
│ │ │ ├── choose-location.js
│ │ │ └── choose-location.wxml
│ │ ├── download-file
│ │ │ ├── download-file.json
│ │ │ ├── download-file.wxss
│ │ │ ├── download-file.js
│ │ │ └── download-file.wxml
│ │ ├── get-user-info
│ │ │ ├── get-user-info.json
│ │ │ ├── get-user-info.wxss
│ │ │ ├── get-user-info.js
│ │ │ └── get-user-info.wxml
│ │ ├── make-phone-call
│ │ │ ├── make-phone-call.json
│ │ │ ├── make-phone-call.wxss
│ │ │ ├── make-phone-call.js
│ │ │ └── make-phone-call.wxml
│ │ ├── background-audio
│ │ │ ├── background-audio.json
│ │ │ ├── background-audio.wxss
│ │ │ ├── background-audio.wxml
│ │ │ └── background-audio.js
│ │ ├── request-payment
│ │ │ ├── request-payment.json
│ │ │ ├── request-payment.wxss
│ │ │ ├── request-payment.wxml
│ │ │ └── request-payment.js
│ │ ├── get-network-type
│ │ │ ├── get-network-type.json
│ │ │ ├── get-network-type.wxss
│ │ │ ├── get-network-type.js
│ │ │ └── get-network-type.wxml
│ │ ├── on-compass-change
│ │ │ ├── on-compass-change.json
│ │ │ ├── compass.png
│ │ │ ├── on-compass-change.js
│ │ │ ├── on-compass-change.wxml
│ │ │ └── on-compass-change.wxss
│ │ ├── on-accelerometer-change
│ │ │ ├── on-accelerometer-change.json
│ │ │ ├── on-accelerometer-change.wxss
│ │ │ ├── on-accelerometer-change.wxml
│ │ │ └── on-accelerometer-change.js
│ │ ├── set-navigation-bar-title
│ │ │ ├── set-navigation-bar-title.json
│ │ │ ├── set-navigation-bar-title.wxss
│ │ │ ├── set-navigation-bar-title.js
│ │ │ └── set-navigation-bar-title.wxml
│ │ └── pull-down-refresh
│ │ │ ├── pull-down-refresh.json
│ │ │ ├── pull-down-refresh.wxss
│ │ │ ├── pull-down-refresh.js
│ │ │ └── pull-down-refresh.wxml
│ ├── index.wxss
│ ├── index.json
│ ├── resources
│ │ └── kind
│ │ │ ├── api.png
│ │ │ ├── logo.png
│ │ │ ├── page.png
│ │ │ ├── device.png
│ │ │ ├── media.png
│ │ │ ├── network.png
│ │ │ ├── storage.png
│ │ │ ├── feedback.png
│ │ │ └── location.png
│ ├── index.wxml
│ └── index.js
├── component
│ ├── pages
│ │ ├── icon
│ │ │ ├── icon.js
│ │ │ ├── icon.json
│ │ │ ├── icon.wxss
│ │ │ └── icon.wxml
│ │ ├── view
│ │ │ ├── view.js
│ │ │ ├── view.json
│ │ │ ├── view.wxss
│ │ │ └── view.wxml
│ │ ├── image
│ │ │ ├── image.js
│ │ │ ├── image.json
│ │ │ ├── image.wxss
│ │ │ └── image.wxml
│ │ ├── navigator
│ │ │ ├── navigator.js
│ │ │ ├── navigator.json
│ │ │ ├── navigate.json
│ │ │ ├── redirect.json
│ │ │ ├── navigator.wxss
│ │ │ ├── navigate.js
│ │ │ ├── redirect.js
│ │ │ ├── navigate.wxml
│ │ │ ├── redirect.wxml
│ │ │ └── navigator.wxml
│ │ ├── progress
│ │ │ ├── progress.js
│ │ │ ├── progress.json
│ │ │ ├── progress.wxss
│ │ │ └── progress.wxml
│ │ ├── switch
│ │ │ ├── switch.wxss
│ │ │ ├── switch.json
│ │ │ ├── switch.js
│ │ │ └── switch.wxml
│ │ ├── form
│ │ │ ├── form.json
│ │ │ ├── form.wxss
│ │ │ ├── form.js
│ │ │ └── form.wxml
│ │ ├── map
│ │ │ ├── map.json
│ │ │ ├── map.js
│ │ │ └── map.wxml
│ │ ├── text
│ │ │ ├── text.json
│ │ │ ├── text.wxss
│ │ │ ├── text.wxml
│ │ │ └── text.js
│ │ ├── audio
│ │ │ ├── audio.json
│ │ │ ├── audio.js
│ │ │ └── audio.wxml
│ │ ├── input
│ │ │ ├── input.json
│ │ │ ├── input.wxss
│ │ │ ├── input.js
│ │ │ └── input.wxml
│ │ ├── label
│ │ │ ├── label.json
│ │ │ ├── label.wxss
│ │ │ ├── label.js
│ │ │ └── label.wxml
│ │ ├── radio
│ │ │ ├── radio.json
│ │ │ ├── radio.wxss
│ │ │ ├── radio.js
│ │ │ └── radio.wxml
│ │ ├── video
│ │ │ ├── video.json
│ │ │ ├── video.wxss
│ │ │ ├── video.wxml
│ │ │ └── video.js
│ │ ├── button
│ │ │ ├── button.json
│ │ │ ├── button.wxss
│ │ │ ├── button.js
│ │ │ └── button.wxml
│ │ ├── canvas
│ │ │ ├── canvas.json
│ │ │ ├── canvas.wxss
│ │ │ ├── canvas.wxml
│ │ │ └── canvas.js
│ │ ├── picker
│ │ │ ├── picker.json
│ │ │ ├── picker.wxss
│ │ │ ├── picker.js
│ │ │ └── picker.wxml
│ │ ├── slider
│ │ │ ├── slider.json
│ │ │ ├── slider.js
│ │ │ └── slider.wxml
│ │ ├── swiper
│ │ │ ├── swiper.json
│ │ │ ├── swiper.wxss
│ │ │ ├── swiper.js
│ │ │ └── swiper.wxml
│ │ ├── checkbox
│ │ │ ├── checkbox.json
│ │ │ ├── checkbox.wxss
│ │ │ ├── checkbox.js
│ │ │ └── checkbox.wxml
│ │ ├── textarea
│ │ │ ├── textarea.json
│ │ │ ├── textarea.js
│ │ │ ├── textarea.wxss
│ │ │ └── textarea.wxml
│ │ └── scroll-view
│ │ │ ├── scroll-view.json
│ │ │ ├── scroll-view.wxss
│ │ │ ├── scroll-view.js
│ │ │ └── scroll-view.wxml
│ ├── index.wxss
│ ├── index.json
│ ├── resources
│ │ ├── pic
│ │ │ ├── 1.jpg
│ │ │ └── 2.jpg
│ │ └── kind
│ │ │ ├── map.png
│ │ │ ├── nav.png
│ │ │ ├── canvas.png
│ │ │ ├── form.png
│ │ │ ├── logo.png
│ │ │ ├── media.png
│ │ │ ├── view.png
│ │ │ └── content.png
│ ├── index.wxml
│ └── index.js
└── common
│ ├── foot.wxml
│ ├── head.wxml
│ └── index.wxss
├── image
├── pause.png
├── play.png
├── plus.png
├── stop.png
├── trash.png
├── record.png
├── wechat.png
├── green_tri.png
├── icon_API.png
├── icon_foot.png
├── location.png
├── wechatHL.png
├── icon_API_HL.png
├── icon_component.png
├── icon64_appwx_logo.png
└── icon_component_HL.png
├── README.md
├── vendor
└── qcloud-weapp-client-sdk
│ ├── lib
│ ├── utils.js
│ ├── session.js
│ ├── constants.js
│ ├── wxTunnel.js
│ ├── request.js
│ └── login.js
│ ├── bower.json
│ ├── index.js
│ ├── .bower.json
│ └── LICENSE
├── config.js
├── util
└── util.js
├── app.js
├── app.json
└── app.wxss
/.gitignore:
--------------------------------------------------------------------------------
1 | *swp
2 | *~
3 |
--------------------------------------------------------------------------------
/page/API/pages/request/request.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/page/API/pages/navigator/navigator.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/page/component/pages/icon/icon.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/page/component/pages/view/view.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/page/API/index.wxss:
--------------------------------------------------------------------------------
1 | @import "../common/index.wxss";
--------------------------------------------------------------------------------
/page/API/pages/custom-service/custom-service.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/page/component/pages/image/image.js:
--------------------------------------------------------------------------------
1 | Page({
2 | })
3 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigator.js:
--------------------------------------------------------------------------------
1 | Page({})
--------------------------------------------------------------------------------
/page/API/pages/custom-message/custom-message.js:
--------------------------------------------------------------------------------
1 | Page({})
--------------------------------------------------------------------------------
/page/API/pages/sendMessage/sendMessage.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/page/component/index.wxss:
--------------------------------------------------------------------------------
1 | @import "../common/index.wxss";
--------------------------------------------------------------------------------
/page/component/pages/progress/progress.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/page/API/pages/custom-service/custom-service.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/page/API/pages/navigation-bar-loading/navigation-bar-loading.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/page/API/pages/image/image.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/pages/share/share.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "小程序接口能力展示"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/storage/storage.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/image/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/pause.png
--------------------------------------------------------------------------------
/image/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/play.png
--------------------------------------------------------------------------------
/image/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/plus.png
--------------------------------------------------------------------------------
/image/stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/stop.png
--------------------------------------------------------------------------------
/image/trash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/trash.png
--------------------------------------------------------------------------------
/page/API/pages/file/file.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "文件"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/image/image.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "图片"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/sendMessage/sendMessage.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/pages/share/share.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "分享"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/voice/voice.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "录音"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "小程序官方组件展示"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/switch/switch.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/image/record.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/record.png
--------------------------------------------------------------------------------
/image/wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/wechat.png
--------------------------------------------------------------------------------
/page/API/pages/canvas/canvas.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "创建画布"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/login/login.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "微信登录"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/modal/modal.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "模态弹窗"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/open-location/open-location.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/pages/request/request.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "网络请求"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/storage/storage.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "数据存储"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/toast/toast.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "消息提示框"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/video/video.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "拍摄/选择视频"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/web-socket/web-socket.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
--------------------------------------------------------------------------------
/page/component/pages/form/form.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "form"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/icon/icon.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "icon"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/map/map.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "map"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/text/text.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "text"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/view/view.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "view"
3 | }
4 |
--------------------------------------------------------------------------------
/image/green_tri.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/green_tri.png
--------------------------------------------------------------------------------
/image/icon_API.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/icon_API.png
--------------------------------------------------------------------------------
/image/icon_foot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/icon_foot.png
--------------------------------------------------------------------------------
/image/location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/location.png
--------------------------------------------------------------------------------
/image/wechatHL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/wechatHL.png
--------------------------------------------------------------------------------
/page/API/pages/animation/animation.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "动画"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/get-system-info/get-system-info.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/pages/navigator/navigator.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "页面跳转"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/scan-code/scan-code.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "扫码"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/template-message/template-message.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/component/pages/audio/audio.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "audio"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/image/image.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "image"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/input/input.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "input"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/label/label.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "label"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/radio/radio.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "radio"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/video/video.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "video"
3 | }
4 |
--------------------------------------------------------------------------------
/image/icon_API_HL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/icon_API_HL.png
--------------------------------------------------------------------------------
/page/API/pages/action-sheet/action-sheet.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "操作菜单"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/get-location/get-location.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "获取位置"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/sendMessage/sendMessage.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "发送模板消息"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/upload-file/upload-file.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "上传文件"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/button/button.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "button"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/canvas/canvas.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "canvas"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/picker/picker.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "picker"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/slider/slider.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "slider"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/swiper/swiper.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "swiper"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/switch/switch.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "switch"
3 | }
4 |
--------------------------------------------------------------------------------
/image/icon_component.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/icon_component.png
--------------------------------------------------------------------------------
/page/API/pages/choose-location/choose-location.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "使用原生地图选择位置"
3 | }
--------------------------------------------------------------------------------
/page/API/pages/custom-message/custom-message.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "客服消息"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/custom-service/custom-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "客服消息"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/download-file/download-file.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "下载文件"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/get-user-info/get-user-info.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "获取用户信息"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/make-phone-call/make-phone-call.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "打电话"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/open-location/open-location.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "查看位置"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/web-socket/web-socket.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "Web Socket"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/checkbox/checkbox.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "checkbox"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigator.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "navigator"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/progress/progress.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "progress"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/textarea/textarea.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "textarea"
3 | }
4 |
--------------------------------------------------------------------------------
/image/icon64_appwx_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/icon64_appwx_logo.png
--------------------------------------------------------------------------------
/image/icon_component_HL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/image/icon_component_HL.png
--------------------------------------------------------------------------------
/page/API/pages/background-audio/background-audio.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "背景音乐"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/get-system-info/get-system-info.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "获取手机系统信息"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/request-payment/request-payment.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "发起支付"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/template-message/template-message.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "模板消息"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigate.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "navigatePage"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/redirect.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "redirectPage"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/get-network-type/get-network-type.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "获取手机网络状态"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/on-compass-change/on-compass-change.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "监听罗盘数据"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/scroll-view/scroll-view.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "scroll-view"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/resources/kind/api.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/API/resources/kind/api.png
--------------------------------------------------------------------------------
/page/API/resources/kind/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/API/resources/kind/logo.png
--------------------------------------------------------------------------------
/page/API/resources/kind/page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/API/resources/kind/page.png
--------------------------------------------------------------------------------
/page/API/pages/choose-location/choose-location.wxss:
--------------------------------------------------------------------------------
1 | .page-body-info{
2 | padding-bottom: 0;
3 | height: 440rpx;
4 | }
--------------------------------------------------------------------------------
/page/API/pages/navigation-bar-loading/navigation-bar-loading.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "标题栏加载动画"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/resources/kind/device.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/API/resources/kind/device.png
--------------------------------------------------------------------------------
/page/API/resources/kind/media.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/API/resources/kind/media.png
--------------------------------------------------------------------------------
/page/API/resources/kind/network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/API/resources/kind/network.png
--------------------------------------------------------------------------------
/page/API/resources/kind/storage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/API/resources/kind/storage.png
--------------------------------------------------------------------------------
/page/component/resources/pic/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/component/resources/pic/1.jpg
--------------------------------------------------------------------------------
/page/component/resources/pic/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/component/resources/pic/2.jpg
--------------------------------------------------------------------------------
/page/API/pages/on-accelerometer-change/on-accelerometer-change.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "监听重力感应数据"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/set-navigation-bar-title/set-navigation-bar-title.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "设置页面标题"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/resources/kind/feedback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/API/resources/kind/feedback.png
--------------------------------------------------------------------------------
/page/API/resources/kind/location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/API/resources/kind/location.png
--------------------------------------------------------------------------------
/page/component/resources/kind/map.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/component/resources/kind/map.png
--------------------------------------------------------------------------------
/page/component/resources/kind/nav.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/component/resources/kind/nav.png
--------------------------------------------------------------------------------
/page/component/pages/canvas/canvas.wxss:
--------------------------------------------------------------------------------
1 | .canvas {
2 | width: 305px;
3 | height: 305px;
4 | background-color: #fff;
5 | }
6 |
--------------------------------------------------------------------------------
/page/component/pages/radio/radio.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .radio {
4 | margin-right: 20rpx;
5 | }
6 |
--------------------------------------------------------------------------------
/page/component/resources/kind/canvas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/component/resources/kind/canvas.png
--------------------------------------------------------------------------------
/page/component/resources/kind/form.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/component/resources/kind/form.png
--------------------------------------------------------------------------------
/page/component/resources/kind/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/component/resources/kind/logo.png
--------------------------------------------------------------------------------
/page/component/resources/kind/media.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/component/resources/kind/media.png
--------------------------------------------------------------------------------
/page/component/resources/kind/view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/component/resources/kind/view.png
--------------------------------------------------------------------------------
/page/component/pages/input/input.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .page-section{
4 | margin-bottom: 20rpx;
5 | }
--------------------------------------------------------------------------------
/page/component/resources/kind/content.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/component/resources/kind/content.png
--------------------------------------------------------------------------------
/page/API/pages/download-file/download-file.wxss:
--------------------------------------------------------------------------------
1 | .page-body image {
2 | width: 600rpx;
3 | height: 600rpx;
4 |
5 | margin: 0 75rpx;
6 | }
--------------------------------------------------------------------------------
/page/API/pages/on-compass-change/compass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Hao-Wu/WeApp-Demo/HEAD/page/API/pages/on-compass-change/compass.png
--------------------------------------------------------------------------------
/page/component/pages/checkbox/checkbox.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .checkbox{
4 | margin-right: 20rpx;
5 | }
6 |
--------------------------------------------------------------------------------
/page/API/pages/pull-down-refresh/pull-down-refresh.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "下拉刷新",
3 | "enablePullDownRefresh": true
4 | }
5 |
--------------------------------------------------------------------------------
/page/API/pages/pull-down-refresh/pull-down-refresh.wxss:
--------------------------------------------------------------------------------
1 | .page-body-info {
2 | background-color: transparent;
3 | }
4 | .btn-area{
5 | margin-top: 300rpx;
6 | }
--------------------------------------------------------------------------------
/page/API/pages/set-navigation-bar-title/set-navigation-bar-title.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .weui-label{
4 | width: 5em;
5 | }
6 |
--------------------------------------------------------------------------------
/page/API/pages/scan-code/scan-code.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .weui-cell__bd{
4 | min-height: 48rpx;
5 | word-break: break-all;
6 | }
--------------------------------------------------------------------------------
/page/component/pages/picker/picker.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .picker{
4 | padding: 19rpx 26rpx;
5 | background-color: #FFFFFF;
6 | }
7 |
--------------------------------------------------------------------------------
/page/component/pages/image/image.wxss:
--------------------------------------------------------------------------------
1 | .page-section-ctn {
2 | text-align: center;
3 | }
4 |
5 | .image {
6 | margin-top: 30rpx;
7 | width: 580rpx;
8 | height: 208rpx;
9 | }
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigator.wxss:
--------------------------------------------------------------------------------
1 | .navigator-hover button{
2 | background-color: #DEDEDE;
3 | }
4 | .other-navigator-hover button{
5 | background-color: #DEDEDE;
6 | }
7 |
--------------------------------------------------------------------------------
/page/component/pages/textarea/textarea.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | focus: false
4 | },
5 | bindTextAreaBlur: function(e) {
6 | console.log(e.detail.value)
7 | }
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/textarea/textarea.wxss:
--------------------------------------------------------------------------------
1 | textarea {
2 | width: 700rpx;
3 | padding: 25rpx 0;
4 | }
5 | .textarea-wrp {
6 | padding: 0 25rpx;
7 | background-color: #fff;
8 | }
--------------------------------------------------------------------------------
/page/API/pages/action-sheet/action-sheet.wxss:
--------------------------------------------------------------------------------
1 | /*
2 | .cancel {
3 | color: white;
4 | background: #303F9F;
5 | }
6 | .item {
7 | color: black;
8 | background: #C5CAE9;
9 | }*/
10 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigate.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onLoad: function(options) {
3 | console.log(options)
4 | this.setData({
5 | title: options.title
6 | })
7 | }
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/redirect.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onLoad: function(options) {
3 | console.log(options)
4 | this.setData({
5 | title: options.title
6 | })
7 | }
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/video/video.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .weui-cells{
4 | margin-top: 80rpx;
5 | text-align: left;
6 | }
7 | .weui-label{
8 | width: 5em;
9 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### 微信小程序官方Demo,代码同步更新
2 |
3 | * [开发文档](https://mp.weixin.qq.com/debug/wxadoc/introduction/index.html)
4 |
5 |
6 | * 截图
7 |
8 | 
9 |
--------------------------------------------------------------------------------
/page/component/pages/button/button.wxss:
--------------------------------------------------------------------------------
1 | button{
2 | margin-top: 30rpx;
3 | margin-bottom: 30rpx;
4 | }
5 | .button-sp-area{
6 | margin: 0 auto;
7 | width: 60%;
8 | }
9 | .mini-btn{
10 | margin-right: 10rpx;
11 | }
--------------------------------------------------------------------------------
/page/component/pages/label/label.wxss:
--------------------------------------------------------------------------------
1 | .label-1, .label-2{
2 | margin: 30rpx 0;
3 | }
4 | .label-3-text{
5 | color: #576B95;
6 | font-size: 28rpx;
7 | }
8 | .checkbox-3{
9 | display: block;
10 | margin: 30rpx 0;
11 | }
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigate.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/redirect.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/page/component/pages/progress/progress.wxss:
--------------------------------------------------------------------------------
1 | progress{
2 | width: 100%;
3 | }
4 | .progress-box{
5 | display: flex;
6 | height: 50rpx;
7 | margin-bottom: 60rpx;
8 | }
9 | .progress-cancel{
10 | margin-left: 40rpx;
11 | }
--------------------------------------------------------------------------------
/page/API/pages/get-network-type/get-network-type.wxss:
--------------------------------------------------------------------------------
1 | .page-body-info {
2 | height: 200rpx;
3 | }
4 | .page-body-text-network-type {
5 | font-size: 80rpx;
6 | font-family: -apple-system-font,Helvetica Neue,Helvetica,sans-serif;
7 | }
8 |
--------------------------------------------------------------------------------
/page/common/foot.wxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/page/API/pages/navigation-bar-loading/navigation-bar-loading.js:
--------------------------------------------------------------------------------
1 | Page({
2 | showNavigationBarLoading: function () {
3 | wx.showNavigationBarLoading()
4 | },
5 | hideNavigationBarLoading: function () {
6 | wx.hideNavigationBarLoading()
7 | }
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/switch/switch.js:
--------------------------------------------------------------------------------
1 | Page({
2 | switch1Change: function (e){
3 | console.log('switch1 发生 change 事件,携带值为', e.detail.value)
4 | },
5 | switch2Change: function (e){
6 | console.log('switch2 发生 change 事件,携带值为', e.detail.value)
7 | }
8 | })
9 |
--------------------------------------------------------------------------------
/page/common/head.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{title}}
4 |
5 | {{desc}}
6 |
7 |
8 |
--------------------------------------------------------------------------------
/page/component/pages/view/view.wxss:
--------------------------------------------------------------------------------
1 | .flex-wrp{
2 | margin-top: 60rpx;
3 | display:flex;
4 | }
5 | .flex-item{
6 | width: 200rpx;
7 | height: 300rpx;
8 | font-size: 26rpx;
9 | }
10 | .flex-item-V{
11 | margin: 0 auto;
12 | width: 300rpx;
13 | height: 200rpx;
14 | }
--------------------------------------------------------------------------------
/page/API/pages/action-sheet/action-sheet.js:
--------------------------------------------------------------------------------
1 | Page({
2 | actionSheetTap: function () {
3 | wx.showActionSheet({
4 | itemList: ['item1', 'item2', 'item3', 'item4'],
5 | success: function (e) {
6 | console.log(e.tapIndex)
7 | }
8 | })
9 | }
10 | })
11 |
--------------------------------------------------------------------------------
/page/API/pages/share/share.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | shareData: {
4 | title: '自定义分享标题',
5 | desc: '自定义分享描述',
6 | path: '/page/API/pages/share/share'
7 | }
8 | },
9 | onShareAppMessage: function () {
10 | return this.data.shareData
11 | }
12 | })
13 |
--------------------------------------------------------------------------------
/page/API/pages/get-user-info/get-user-info.wxss:
--------------------------------------------------------------------------------
1 | .page-body-info {
2 | padding-bottom: 0;
3 | height: 230px;
4 | }
5 | .userinfo-avatar {
6 | border-radius: 128rpx;
7 | width: 128rpx;
8 | height: 128rpx;
9 | }
10 | .userinfo-nickname {
11 | margin-top: 20rpx;
12 | font-size: 38rpx;
13 | }
--------------------------------------------------------------------------------
/page/API/pages/navigator/navigator.js:
--------------------------------------------------------------------------------
1 | Page({
2 | navigateTo: function () {
3 | wx.navigateTo({ url: './navigator' })
4 | },
5 | navigateBack: function () {
6 | wx.navigateBack()
7 | },
8 | redirectTo: function () {
9 | wx.redirectTo({ url: './navigator' })
10 | }
11 | })
12 |
--------------------------------------------------------------------------------
/page/component/pages/form/form.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | label {
4 | display: inline-block;
5 | min-width: 270rpx;
6 | margin-right: 20rpx;
7 | }
8 | form{
9 | width: 100%;
10 | }
11 | .picker-text {
12 | margin-left: 20rpx;
13 | position: relative;
14 | }
15 |
--------------------------------------------------------------------------------
/page/component/pages/slider/slider.js:
--------------------------------------------------------------------------------
1 | var pageData = {}
2 | for (var i = 1; i < 5; ++i) {
3 | (function (index) {
4 | pageData['slider' + index + 'change'] = function(e) {
5 | console.log('slider' + index + '发生change事件,携带值为', e.detail.value)
6 | }
7 | })(i)
8 | }
9 | Page(pageData)
10 |
--------------------------------------------------------------------------------
/page/component/pages/scroll-view/scroll-view.wxss:
--------------------------------------------------------------------------------
1 | .page-section-spacing{
2 | margin-top: 60rpx;
3 | }
4 | .scroll-view_H{
5 | white-space: nowrap;
6 | }
7 | .scroll-view-item{
8 | height: 300rpx;
9 | }
10 | .scroll-view-item_H{
11 | display: inline-block;
12 | width: 100%;
13 | height: 300rpx;
14 | }
15 |
--------------------------------------------------------------------------------
/page/API/pages/on-compass-change/on-compass-change.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | direction: 0
4 | },
5 | onReady: function () {
6 | var that = this
7 | wx.onCompassChange(function (res) {
8 | that.setData({
9 | direction: parseInt(res.direction)
10 | })
11 | })
12 | }
13 | })
14 |
--------------------------------------------------------------------------------
/page/API/pages/video/video.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .page-body-info {
4 | display: flex;
5 | margin-top: 40rpx;
6 | padding: 0;
7 | height: 360rpx;
8 | border-top: 1rpx solid #D9D9D9;
9 | border-bottom: 1rpx solid #D9D9D9;
10 | align-items: center;
11 | justify-content: center;
12 | }
--------------------------------------------------------------------------------
/page/API/pages/get-location/get-location.wxss:
--------------------------------------------------------------------------------
1 | .page-body-info {
2 | height: 250rpx;
3 | }
4 | .page-body-text-small {
5 | font-size: 24rpx;
6 | color: #000;
7 | margin-bottom: 100rpx;
8 | }
9 | .page-body-text-location {
10 | display: flex;
11 | font-size: 50rpx;
12 | }
13 | .page-body-text-location text {
14 | margin: 10rpx;
15 | }
16 |
--------------------------------------------------------------------------------
/page/API/pages/file/file.wxss:
--------------------------------------------------------------------------------
1 | .image {
2 | width: 100%;
3 | height: 360rpx;
4 | }
5 | .page-body-info {
6 | display: flex;
7 | box-sizing: border-box;
8 | padding: 30rpx;
9 | height: 420rpx;
10 | border-top: 1rpx solid #D9D9D9;
11 | border-bottom: 1rpx solid #D9D9D9;
12 | align-items: center;
13 | justify-content: center;
14 | }
15 |
--------------------------------------------------------------------------------
/page/API/pages/upload-file/upload-file.wxss:
--------------------------------------------------------------------------------
1 | .image {
2 | width: 100%;
3 | height: 360rpx;
4 | }
5 | .page-body-info {
6 | display: flex;
7 | box-sizing: border-box;
8 | padding: 30rpx;
9 | height: 420rpx;
10 | border-top: 1rpx solid #D9D9D9;
11 | border-bottom: 1rpx solid #D9D9D9;
12 | align-items: center;
13 | justify-content: center;
14 | }
15 |
--------------------------------------------------------------------------------
/page/API/pages/get-system-info/get-system-info.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | systemInfo: {}
4 | },
5 | getSystemInfo: function () {
6 | var that = this
7 | wx.getSystemInfo({
8 | success: function (res) {
9 | that.setData({
10 | systemInfo: res
11 | })
12 | that.update()
13 | }
14 | })
15 | }
16 | })
17 |
--------------------------------------------------------------------------------
/page/API/pages/scan-code/scan-code.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | result: ''
4 | },
5 | scanCode: function () {
6 | var that = this
7 | wx.scanCode({
8 | success: function (res) {
9 | that.setData({
10 | result: res.result
11 | })
12 | },
13 | fail: function (res) {
14 | }
15 | })
16 | }
17 | })
18 |
--------------------------------------------------------------------------------
/page/API/pages/open-location/open-location.js:
--------------------------------------------------------------------------------
1 | Page({
2 | openLocation: function (e) {
3 | console.log(e)
4 | var value = e.detail.value
5 | console.log(value)
6 | wx.openLocation({
7 | longitude: Number(value.longitude),
8 | latitude: Number(value.latitude),
9 | name: value.name,
10 | address: value.address
11 | })
12 | }
13 | })
14 |
--------------------------------------------------------------------------------
/page/component/pages/text/text.wxss:
--------------------------------------------------------------------------------
1 | button{
2 | margin: 40rpx 0;
3 | }
4 | .text-box{
5 | margin-bottom: 70rpx;
6 | padding: 40rpx 0;
7 | display: flex;
8 | min-height: 300rpx;
9 | background-color: #FFFFFF;
10 | justify-content: center;
11 | align-items: center;
12 | text-align: center;
13 | font-size: 30rpx;
14 | color: #353535;
15 | line-height: 2em;
16 | }
--------------------------------------------------------------------------------
/page/API/pages/custom-service/custom-service.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/page/API/pages/make-phone-call/make-phone-call.wxss:
--------------------------------------------------------------------------------
1 | .page-section{
2 | width: auto;
3 | margin: 30rpx;
4 | padding: 44rpx 60rpx 60rpx;
5 | background-color: #fff;
6 | font-size: 28rpx;
7 | }
8 | .desc{
9 | margin-bottom: 20rpx;
10 | }
11 | .input{
12 | height: 119rpx;
13 | line-height: 119rpx;
14 | font-size: 78rpx;
15 | border-bottom: 1rpx solid #E2E2E2;
16 | }
17 | .btn-area{
18 | padding: 0;
19 | }
20 |
--------------------------------------------------------------------------------
/page/component/pages/canvas/canvas.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/page/API/pages/action-sheet/action-sheet.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/page/API/pages/canvas/canvas.wxss:
--------------------------------------------------------------------------------
1 | .canvas-element-wrapper {
2 | display: block;
3 | margin-bottom: 100rpx;
4 | }
5 | .canvas-element {
6 | width: 100%;
7 | height: 500rpx;
8 | background-color: #ffffff;
9 | }
10 | .canvas-buttons {
11 | padding: 30rpx 50rpx 10rpx;
12 | width: 100%;
13 | height: 360rpx;
14 | box-sizing: border-box;
15 | }
16 | .canvas-button {
17 | float: left;
18 | line-height: 2;
19 | width: 300rpx;
20 | margin: 15rpx 12rpx;
21 | }
22 |
--------------------------------------------------------------------------------
/page/API/pages/pull-down-refresh/pull-down-refresh.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onPullDownRefresh: function () {
3 | wx.showToast({
4 | title: 'loading...',
5 | icon: 'loading'
6 | })
7 | console.log('onPullDownRefresh', new Date())
8 | },
9 | stopPullDownRefresh: function () {
10 | wx.stopPullDownRefresh({
11 | complete: function (res) {
12 | wx.hideToast()
13 | console.log(res, new Date())
14 | }
15 | })
16 | }
17 | })
18 |
--------------------------------------------------------------------------------
/page/API/pages/login/login.js:
--------------------------------------------------------------------------------
1 | var app = getApp()
2 | Page({
3 | onLoad: function () {
4 | this.setData({
5 | hasLogin: app.globalData.hasLogin
6 | })
7 | },
8 | data: {},
9 | login: function () {
10 | var that = this
11 | wx.login({
12 | success: function (res) {
13 | app.globalData.hasLogin = true
14 | that.setData({
15 | hasLogin: true
16 | })
17 | that.update()
18 | }
19 | })
20 | }
21 | })
22 |
--------------------------------------------------------------------------------
/vendor/qcloud-weapp-client-sdk/lib/utils.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 拓展对象
4 | */
5 | exports.extend = function extend(target) {
6 | var sources = Array.prototype.slice.call(arguments, 1);
7 |
8 | for (var i = 0; i < sources.length; i += 1) {
9 | var source = sources[i];
10 | for (var key in source) {
11 | if (source.hasOwnProperty(key)) {
12 | target[key] = source[key];
13 | }
14 | }
15 | }
16 |
17 | return target;
18 | };
--------------------------------------------------------------------------------
/page/API/pages/toast/toast.js:
--------------------------------------------------------------------------------
1 | Page({
2 | toast1Tap: function () {
3 | wx.showToast({
4 | title: "默认"
5 | })
6 | },
7 | toast2Tap: function () {
8 | wx.showToast({
9 | title: "duration 3000",
10 | duration: 3000
11 | })
12 | },
13 | toast3Tap: function () {
14 | wx.showToast({
15 | title: "loading",
16 | icon: "loading",
17 | duration: 5000
18 | })
19 | },
20 | hideToast: function () {
21 | wx.hideToast()
22 | }
23 | })
24 |
--------------------------------------------------------------------------------
/page/API/pages/modal/modal.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/page/API/pages/set-navigation-bar-title/set-navigation-bar-title.js:
--------------------------------------------------------------------------------
1 | Page({
2 | setNaivgationBarTitle: function (e) {
3 | var title = e.detail.value.title
4 | console.log(title)
5 | wx.setNavigationBarTitle({
6 | title: title,
7 | success: function() {
8 | console.log('setNavigationBarTitle success')
9 | },
10 | fail: function(err) {
11 | console.log('setNavigationBarTitle fail, err is', err)
12 | }
13 | })
14 |
15 | return false
16 | }
17 | })
18 |
--------------------------------------------------------------------------------
/page/component/pages/map/map.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | latitude: 23.099994,
4 | longitude: 113.324520,
5 | markers: [{
6 | latitude: 23.099994,
7 | longitude: 113.324520,
8 | name: 'T.I.T 创意园'
9 | }],
10 | covers: [{
11 | latitude: 23.099994,
12 | longitude: 113.344520,
13 | iconPath: '/image/location.png'
14 | }, {
15 | latitude: 23.099994,
16 | longitude: 113.304520,
17 | iconPath: '/image/location.png'
18 | }]
19 | }
20 | })
21 |
--------------------------------------------------------------------------------
/vendor/qcloud-weapp-client-sdk/lib/session.js:
--------------------------------------------------------------------------------
1 | var constants = require('./constants');
2 | var SESSION_KEY = 'weapp_session_' + constants.WX_SESSION_MAGIC_ID;
3 |
4 | var Session = {
5 | get: function () {
6 | return wx.getStorageSync(SESSION_KEY) || null;
7 | },
8 |
9 | set: function (session) {
10 | wx.setStorageSync(SESSION_KEY, session);
11 | },
12 |
13 | clear: function () {
14 | wx.removeStorageSync(SESSION_KEY);
15 | },
16 | };
17 |
18 | module.exports = Session;
--------------------------------------------------------------------------------
/page/API/pages/modal/modal.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | modalHidden: true,
4 | modalHidden2: true
5 | },
6 | modalTap: function(e) {
7 | wx.showModal({
8 | title: "弹窗标题",
9 | content: "弹窗内容,告知当前状态、信息和解决方法,描述文字尽量控制在三行内",
10 | showCancel: false,
11 | confirmText: "确定"
12 | })
13 | },
14 | noTitlemodalTap: function(e) {
15 | wx.showModal({
16 | content: "弹窗内容,告知当前状态、信息和解决方法,描述文字尽量控制在三行内",
17 | confirmText: "确定",
18 | cancelText: "取消"
19 | })
20 | }
21 | })
22 |
--------------------------------------------------------------------------------
/page/component/pages/swiper/swiper.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | button{
4 | margin-bottom: 30rpx;
5 | }
6 | button:last-child{
7 | margin-bottom: 0;
8 | }
9 | .page-section-title{
10 | padding: 0;
11 | }
12 | .swiper-item{
13 | display: block;
14 | height: 150px;
15 | }
16 | .page-section-title{
17 | margin-top: 60rpx;
18 | position: relative;
19 | }
20 | .info{
21 | position: absolute;
22 | right: 0;
23 | color: #353535;
24 | font-size: 30rpx;
25 | }
26 | .page-foot{
27 | margin-top: 50rpx;
28 | }
--------------------------------------------------------------------------------
/page/API/pages/login/login.wxss:
--------------------------------------------------------------------------------
1 | .page-section {
2 | margin-top: 200rpx;
3 | display: flex;
4 | flex-direction: column;
5 | align-items: center;
6 | justify-content: center;
7 | width: 100%;
8 | padding: 0 50rpx;
9 | box-sizing: border-box;
10 | }
11 | .page-body-title {
12 | font-size: 60rpx;
13 | line-height: 200rpx;
14 | }
15 | .page-body-text {
16 | color: #bbb;
17 | font-size: 28rpx;
18 | line-height: 40rpx;
19 | margin: 0 0 100rpx 0;
20 | text-align: center;
21 | }
22 | .page-body-button {
23 | width: 100%;
24 | }
25 |
--------------------------------------------------------------------------------
/page/API/pages/navigator/navigator.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/page/API/pages/navigation-bar-loading/navigation-bar-loading.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/page/component/pages/audio/audio.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | current: {
4 | poster: 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000',
5 | name: '此时此刻',
6 | author: '许巍',
7 | src: 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E06DCBDC9AB7C49FD713D632D313AC4858BACB8DDD29067D3C601481D36E62053BF8DFEAF74C0A5CCFADD6471160CAF3E6A&fromtag=46',
8 | },
9 | audioAction: {
10 | method: 'pause'
11 | }
12 | }
13 | })
14 |
--------------------------------------------------------------------------------
/page/API/pages/request-payment/request-payment.wxss:
--------------------------------------------------------------------------------
1 | .page-section{
2 | width: auto;
3 | margin: 30rpx;
4 | padding: 64rpx 30rpx;
5 | background-color: #fff;
6 | text-align: center;
7 | font-size: 28rpx;
8 | }
9 | .desc{
10 | color: #B2B2B2;
11 | }
12 | .price{
13 | margin-top: 30rpx;
14 | margin-bottom: 25rpx;
15 | position: relative;
16 | display: inline-block;
17 | font-size: 78rpx;
18 | line-height: 1;
19 | }
20 | .price:before{
21 | content: "¥";
22 | position: absolute;
23 | font-size: 40rpx;
24 | top: 8rpx;
25 | left: -40rpx;
26 | }
27 |
--------------------------------------------------------------------------------
/page/component/pages/icon/icon.wxss:
--------------------------------------------------------------------------------
1 | .icon-box{
2 | margin-bottom: 40rpx;
3 | padding: 0 75rpx;
4 | display: flex;
5 | align-items: center;
6 | }
7 | .icon-box-img{
8 | margin-right: 46rpx;
9 | }
10 | .icon-box-ctn{
11 | flex-shrink: 100;
12 | }
13 | .icon-box-title{
14 | font-size: 34rpx;
15 | }
16 | .icon-box-desc{
17 | margin-top: 12rpx;
18 | font-size: 26rpx;
19 | color: #888;
20 | }
21 |
22 | .icon-small-wrp{
23 | margin-right: 46rpx;
24 | width: 93px;
25 | height: 93px;
26 | display: flex;
27 | align-items: center;
28 | justify-content: center;
29 | }
--------------------------------------------------------------------------------
/page/component/pages/picker/picker.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | array: ['中国', '美国', '巴西', '日本'],
4 | index: 0,
5 | date: '2016-09-01',
6 | time: '12:01'
7 | },
8 | bindPickerChange: function(e) {
9 | console.log('picker发送选择改变,携带值为', e.detail.value)
10 | this.setData({
11 | index: e.detail.value
12 | })
13 | },
14 | bindDateChange: function(e) {
15 | this.setData({
16 | date: e.detail.value
17 | })
18 | },
19 | bindTimeChange: function(e) {
20 | this.setData({
21 | time: e.detail.value
22 | })
23 | }
24 | })
25 |
--------------------------------------------------------------------------------
/page/component/pages/audio/audio.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/page/API/pages/download-file/download-file.js:
--------------------------------------------------------------------------------
1 | const downloadExampleUrl = require('../../../../config').downloadExampleUrl
2 |
3 | Page({
4 | downloadImage: function() {
5 | var self = this
6 |
7 | wx.downloadFile({
8 | url: downloadExampleUrl,
9 | success: function(res) {
10 | console.log('downloadFile success, res is', res)
11 |
12 | self.setData({
13 | imageSrc: res.tempFilePath
14 | })
15 | },
16 | fail: function({errMsg}) {
17 | console.log('downloadFile fail, err is:', errMsg)
18 | }
19 | })
20 | }
21 | })
22 |
--------------------------------------------------------------------------------
/page/API/pages/get-network-type/get-network-type.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | hasNetworkType: false
4 | },
5 | getNetworkType: function () {
6 | var that = this
7 | wx.getNetworkType({
8 | success: function (res) {
9 | console.log(res)
10 | that.setData({
11 | hasNetworkType: true,
12 | networkType: res.subtype || res.networkType
13 | })
14 | that.update()
15 | }
16 | })
17 | },
18 | clear: function () {
19 | this.setData({
20 | hasNetworkType: false,
21 | networkType: ''
22 | })
23 | }
24 | })
25 |
--------------------------------------------------------------------------------
/page/API/pages/on-accelerometer-change/on-accelerometer-change.wxss:
--------------------------------------------------------------------------------
1 | .page-body-xyz {
2 | display: flex;
3 | justify-content: space-between;
4 | width: 700rpx;
5 | margin-top: 90rpx;
6 | box-sizing: border-box;
7 | text-align: center;
8 | }
9 | .page-body-canvas {
10 | margin-top: 30rpx;
11 | width: 302px;
12 | height: 302px;
13 | position: relative;
14 | }
15 | .page-body-ball {
16 | position: absolute;
17 | top: 0;
18 | left: 0;
19 | width: 302px;
20 | height: 302px;
21 | }
22 | .page-body-title {
23 | margin-bottom: 0;
24 | font-size: 32rpx;
25 | width: 250rpx;
26 | }
27 |
--------------------------------------------------------------------------------
/page/API/pages/custom-message/custom-message.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 点击气泡icon打开客服消息界面
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/page/component/pages/map/map.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/page/API/pages/request/request.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 点击向服务器发起请求
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/page/API/pages/make-phone-call/make-phone-call.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | disabled: true
4 | },
5 | bindInput: function(e) {
6 | this.inputValue = e.detail.value
7 |
8 | if (this.inputValue.length > 0) {
9 | this.setData({
10 | disabled: false
11 | })
12 | } else {
13 | this.setData({
14 | disabled: true
15 | })
16 | }
17 | },
18 | makePhoneCall: function () {
19 | var that = this
20 | wx.makePhoneCall({
21 | phoneNumber: this.inputValue,
22 | success: function () {
23 | console.log("成功拨打电话")
24 | }
25 | })
26 | }
27 | })
28 |
--------------------------------------------------------------------------------
/page/API/pages/pull-down-refresh/pull-down-refresh.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 下滑页面即可刷新
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/page/API/pages/get-location/get-location.js:
--------------------------------------------------------------------------------
1 | var util = require('../../../../util/util.js')
2 | var formatLocation = util.formatLocation
3 |
4 | Page({
5 | data: {
6 | hasLocation: false,
7 | },
8 | getLocation: function () {
9 | var that = this
10 | wx.getLocation({
11 | success: function (res) {
12 | console.log(res)
13 | that.setData({
14 | hasLocation: true,
15 | location: formatLocation(res.longitude, res.latitude)
16 | })
17 | }
18 | })
19 | },
20 | clear: function () {
21 | this.setData({
22 | hasLocation: false
23 | })
24 | }
25 | })
26 |
--------------------------------------------------------------------------------
/page/API/pages/request-payment/request-payment.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 支付金额
10 | 0.01
11 | 实际接口应用中可自定义金额
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/page/API/pages/make-phone-call/make-phone-call.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 请在下方输入电话号码
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/page/component/pages/text/text.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | {{text}}
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/page/API/pages/scan-code/scan-code.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 扫码结果
9 |
10 |
11 | {{result}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/vendor/qcloud-weapp-client-sdk/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "qcloud-weapp-client-sdk",
3 | "description": "QCloud 微信小程序客户端 SDK",
4 | "main": "index.js",
5 | "authors": [
6 | "Tencent Cloud"
7 | ],
8 | "license": "MIT",
9 | "keywords": [
10 | "qcloud",
11 | "weapp",
12 | "wechat",
13 | "sdk",
14 | "client",
15 | "auth",
16 | "websocket"
17 | ],
18 | "homepage": "",
19 | "ignore": [
20 | "**/.*",
21 | "node_modules",
22 | "bower_components",
23 | "test",
24 | "tests",
25 | "typings.json",
26 | "jsconfig.json",
27 | "package.json",
28 | ".npmignore",
29 | ".travis.yml",
30 | ".gitignore"
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/page/API/pages/animation/animation.wxss:
--------------------------------------------------------------------------------
1 | .animation-element-wrapper {
2 | display: flex;
3 | width: 100%;
4 | padding-top: 150rpx;
5 | padding-bottom: 150rpx;
6 | justify-content: center;
7 | overflow: hidden;
8 | background-color: #ffffff;
9 | }
10 | .animation-element {
11 | width: 200rpx;
12 | height: 200rpx;
13 | background-color: #1AAD19;
14 | }
15 | .animation-buttons {
16 | padding: 30rpx 50rpx 10rpx;
17 | width: 100%;
18 | height: 360rpx;
19 | box-sizing: border-box;
20 | }
21 | .animation-button {
22 | float: left;
23 | line-height: 2;
24 | width: 300rpx;
25 | margin: 15rpx 12rpx;
26 | }
27 |
28 | .animation-button-reset {
29 | width: 620rpx;
30 | }
31 |
--------------------------------------------------------------------------------
/page/API/pages/choose-location/choose-location.js:
--------------------------------------------------------------------------------
1 | var util = require('../../../../util/util.js')
2 | var formatLocation = util.formatLocation
3 |
4 | Page({
5 | data: {
6 | hasLocation: false,
7 | },
8 | chooseLocation: function () {
9 | var that = this
10 | wx.chooseLocation({
11 | success: function (res) {
12 | console.log(res)
13 | that.setData({
14 | hasLocation: true,
15 | location: formatLocation(res.longitude, res.latitude),
16 | locationAddress: res.address
17 | })
18 | }
19 | })
20 | },
21 | clear: function () {
22 | this.setData({
23 | hasLocation: false
24 | })
25 | }
26 | })
27 |
--------------------------------------------------------------------------------
/page/component/pages/radio/radio.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | items: [
4 | {value: 'USA', name: '美国'},
5 | {value: 'CHN', name: '中国', checked: 'true'},
6 | {value: 'BRA', name: '巴西'},
7 | {value: 'JPN', name: '日本'},
8 | {value: 'ENG', name: '英国'},
9 | {value: 'FRA', name: '法国'},
10 | ]
11 | },
12 | radioChange: function(e) {
13 | console.log('radio发生change事件,携带value值为:', e.detail.value)
14 |
15 | var items = this.data.items;
16 | for (var i = 0, len = items.length; i < len; ++i) {
17 | items[i].checked = items[i].value == e.detail.value
18 | }
19 |
20 | this.setData({
21 | items: items
22 | });
23 | }
24 | })
25 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigator.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/page/API/pages/download-file/download-file.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | 点击按钮下载服务端示例图片
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/page/API/pages/background-audio/background-audio.wxss:
--------------------------------------------------------------------------------
1 | image {
2 | width: 150rpx;
3 | height: 150rpx;
4 | }
5 |
6 | .page-body-wrapper {
7 | margin-top: 0;
8 | }
9 | .page-body-info {
10 | padding-bottom: 50rpx;
11 | }
12 | .time-big {
13 | font-size: 60rpx;
14 | margin: 20rpx;
15 | }
16 | .slider {
17 | width: 650rpx;
18 | }
19 | .play-time {
20 | font-size: 28rpx;
21 | width: 700rpx;
22 | padding: 20rpx 0;
23 | display: flex;
24 | justify-content: space-between;
25 | box-sizing: border-box;
26 | }
27 | .page-body-buttons {
28 | display: flex;
29 | justify-content: space-around;
30 | margin-top: 100rpx;
31 | }
32 | .page-body-button {
33 | width: 250rpx;
34 | text-align: center;
35 | }
36 |
--------------------------------------------------------------------------------
/vendor/qcloud-weapp-client-sdk/index.js:
--------------------------------------------------------------------------------
1 | var constants = require('./lib/constants');
2 | var login = require('./lib/login');
3 | var Session = require('./lib/session');
4 | var request = require('./lib/request');
5 | var Tunnel = require('./lib/tunnel');
6 |
7 | var exports = module.exports = {
8 | login: login.login,
9 | setLoginUrl: login.setLoginUrl,
10 | LoginError: login.LoginError,
11 |
12 | clearSession: Session.clear,
13 |
14 | request: request.request,
15 | RequestError: request.RequestError,
16 |
17 | Tunnel: Tunnel,
18 | };
19 |
20 | // 导出错误类型码
21 | Object.keys(constants).forEach(function (key) {
22 | if (key.indexOf('ERR_') === 0) {
23 | exports[key] = constants[key];
24 | }
25 | });
--------------------------------------------------------------------------------
/page/component/pages/swiper/swiper.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
4 | indicatorDots: true,
5 | vertical: false,
6 | autoplay: false,
7 | interval: 2000,
8 | duration: 500
9 | },
10 | changeIndicatorDots: function (e) {
11 | this.setData({
12 | indicatorDots: !this.data.indicatorDots
13 | })
14 | },
15 | changeAutoplay: function (e) {
16 | this.setData({
17 | autoplay: !this.data.autoplay
18 | })
19 | },
20 | intervalChange: function (e) {
21 | this.setData({
22 | interval: e.detail.value
23 | })
24 | },
25 | durationChange: function (e) {
26 | this.setData({
27 | duration: e.detail.value
28 | })
29 | }
30 | })
31 |
--------------------------------------------------------------------------------
/page/component/pages/form/form.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | pickerHidden: true,
4 | chosen: ''
5 | },
6 | pickerConfirm: function (e) {
7 | this.setData({
8 | pickerHidden: true
9 | })
10 | this.setData({
11 | chosen: e.detail.value
12 | })
13 | },
14 | pickerCancel: function (e) {
15 | this.setData({
16 | pickerHidden: true
17 | })
18 | },
19 | pickerShow: function (e) {
20 | this.setData({
21 | pickerHidden: false
22 | })
23 | },
24 | formSubmit: function (e) {
25 | console.log('form发生了submit事件,携带数据为:', e.detail.value)
26 | },
27 | formReset: function (e) {
28 | console.log('form发生了reset事件,携带数据为:', e.detail.value)
29 | this.setData({
30 | chosen: ''
31 | })
32 | }
33 | })
34 |
--------------------------------------------------------------------------------
/vendor/qcloud-weapp-client-sdk/lib/constants.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | WX_HEADER_CODE: 'X-WX-Code',
3 | WX_HEADER_ENCRYPTED_DATA: 'X-WX-Encrypted-Data',
4 | WX_HEADER_IV: 'X-WX-IV',
5 | WX_HEADER_ID: 'X-WX-Id',
6 | WX_HEADER_SKEY: 'X-WX-Skey',
7 |
8 | WX_SESSION_MAGIC_ID: 'F2C224D4-2BCE-4C64-AF9F-A6D872000D1A',
9 |
10 | ERR_INVALID_PARAMS: 'ERR_INVALID_PARAMS',
11 |
12 | ERR_WX_LOGIN_FAILED: 'ERR_WX_LOGIN_FAILED',
13 | ERR_WX_GET_USER_INFO: 'ERR_WX_GET_USER_INFO',
14 | ERR_LOGIN_TIMEOUT: 'ERR_LOGIN_TIMEOUT',
15 | ERR_LOGIN_FAILED: 'ERR_LOGIN_FAILED',
16 | ERR_LOGIN_SESSION_NOT_RECEIVED: 'ERR_LOGIN_MISSING_SESSION',
17 |
18 | ERR_INVALID_SESSION: 'ERR_INVALID_SESSION',
19 | ERR_CHECK_LOGIN_FAILED: 'ERR_CHECK_LOGIN_FAILED',
20 | };
--------------------------------------------------------------------------------
/page/API/pages/login/login.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 已登录
11 | 每个微信号中仅需登录 1 次,后续每次进入页面即可根据微信 id 自动拉取用户信息
12 |
13 |
14 | 每个微信号中仅需登录一次
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/page/API/pages/get-user-info/get-user-info.js:
--------------------------------------------------------------------------------
1 | var app = getApp()
2 | Page({
3 | data: {
4 | hasUserInfo: false
5 | },
6 | getUserInfo: function () {
7 | var that = this
8 |
9 | if (app.globalData.hasLogin === false) {
10 | wx.login({
11 | success: _getUserInfo
12 | })
13 | } else {
14 | _getUserInfo()
15 | }
16 |
17 | function _getUserInfo() {
18 | wx.getUserInfo({
19 | success: function (res) {
20 | that.setData({
21 | hasUserInfo: true,
22 | userInfo: res.userInfo
23 | })
24 | that.update()
25 | }
26 | })
27 | }
28 | },
29 | clear: function () {
30 | this.setData({
31 | hasUserInfo: false,
32 | userInfo: {}
33 | })
34 | }
35 | })
36 |
--------------------------------------------------------------------------------
/page/API/pages/canvas/canvas.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/page/component/pages/textarea/textarea.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 输入区域高度自适应,不会出现滚动条
10 |
11 |
12 |
13 |
14 |
15 |
16 | 这是一个可以自动聚焦的textarea
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/page/component/pages/image/image.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Local Image
10 |
11 |
12 |
13 |
14 |
15 | Internet Image
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/page/API/pages/on-compass-change/on-compass-change.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 旋转手机即可获取方位信息
10 |
11 |
12 |
13 |
14 | {{direction}}
15 | o
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/page/API/pages/voice/voice.wxss:
--------------------------------------------------------------------------------
1 | image {
2 | width: 150rpx;
3 | height: 150rpx;
4 | }
5 |
6 | .page-body-wrapper {
7 | justify-content: space-between;
8 | flex-grow: 1;
9 | margin-bottom: 300rpx;
10 | }
11 | .page-body-time {
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | }
16 | .time-big {
17 | font-size: 60rpx;
18 | margin: 20rpx;
19 | }
20 | .time-small {
21 | font-size: 30rpx;
22 | }
23 |
24 | .page-body-buttons {
25 | margin-top: 60rpx;
26 | display: flex;
27 | justify-content: space-around;
28 | }
29 | .page-body-button {
30 | width: 250rpx;
31 | text-align: center;
32 | }
33 | .button-stop-record {
34 | width: 110rpx;
35 | height: 110rpx;
36 | border: 20rpx solid #fff;
37 | background-color: #f55c23;
38 | border-radius: 130rpx;
39 | margin: 0 auto;
40 | }
41 |
--------------------------------------------------------------------------------
/page/component/pages/scroll-view/scroll-view.js:
--------------------------------------------------------------------------------
1 | var order = ['demo1', 'demo2', 'demo3']
2 | Page({
3 | data: {
4 | toView: 'green'
5 | },
6 | upper: function(e) {
7 | console.log(e)
8 | },
9 | lower: function(e) {
10 | console.log(e)
11 | },
12 | scroll: function(e) {
13 | console.log(e)
14 | },
15 | scrollToTop: function(e) {
16 | this.setAction({
17 | scrollTop: 0
18 | })
19 | },
20 | tap: function(e) {
21 | for (var i = 0; i < order.length; ++i) {
22 | if (order[i] === this.data.toView) {
23 | this.setData({
24 | toView: order[i + 1],
25 | scrollTop: (i + 1) * 200
26 | })
27 | break
28 | }
29 | }
30 | },
31 | tapMove: function(e) {
32 | this.setData({
33 | scrollTop: this.data.scrollTop + 10
34 | })
35 | }
36 | })
37 |
--------------------------------------------------------------------------------
/page/API/pages/on-compass-change/on-compass-change.wxss:
--------------------------------------------------------------------------------
1 | .direction {
2 | position: relative;
3 | margin-top: 70rpx;
4 | display: flex;
5 | width: 540rpx;
6 | height: 540rpx;
7 | align-items: center;
8 | justify-content: center;
9 | }
10 | .direction-value {
11 | position: relative;
12 | font-size: 200rpx;
13 | color: #353535;
14 | line-height: 1;
15 | z-index: 1;
16 | }
17 | .direction-degree {
18 | position: absolute;
19 | top: 0;
20 | right: -40rpx;
21 | font-size: 60rpx;
22 | }
23 | .bg-compass{
24 | position: absolute;
25 | top: 0;
26 | left: 0;
27 | width: 540rpx;
28 | height: 540rpx;
29 | transition: .1s;
30 | }
31 | .bg-compass-line{
32 | position: absolute;
33 | left: 267rpx;
34 | top: -10rpx;
35 | width: 6rpx;
36 | height: 56rpx;
37 | background-color: #1AAD19;
38 | border-radius: 999rpx;
39 | z-index: 1;
40 | }
41 |
--------------------------------------------------------------------------------
/page/API/pages/toast/toast.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/page/API/pages/canvas/canvas.js:
--------------------------------------------------------------------------------
1 | var example = require('./example.js')
2 |
3 | Page({
4 | onLoad: function () {
5 | this.context = wx.createContext()
6 |
7 | var methods = Object.keys(example)
8 | this.setData({
9 | methods: methods
10 | })
11 |
12 | var that = this
13 | methods.forEach(function (method) {
14 | that[method] = function () {
15 | example[method](that.context)
16 | var actions = that.context.getActions()
17 |
18 | wx.drawCanvas({
19 | canvasId: 'canvas',
20 | actions: actions
21 | })
22 | }
23 | })
24 | },
25 | toTempFilePath: function () {
26 | wx.canvasToTempFilePath({
27 | canvasId: 'canvas',
28 | success: function (res) {
29 | console.log(res)
30 | },
31 | fail: function (res) {
32 | console.log(res)
33 | }
34 | })
35 | }
36 | })
37 |
--------------------------------------------------------------------------------
/page/component/pages/checkbox/checkbox.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | items: [
4 | {value: 'USA', name: '美国'},
5 | {value: 'CHN', name: '中国', checked: 'true'},
6 | {value: 'BRA', name: '巴西'},
7 | {value: 'JPN', name: '日本'},
8 | {value: 'ENG', name: '英国'},
9 | {value: 'FRA', name: '法国'}
10 | ]
11 | },
12 | checkboxChange: function(e) {
13 | console.log('checkbox发生change事件,携带value值为:', e.detail.value)
14 |
15 | var items = this.data.items, values = e.detail.value;
16 | for (var i = 0, lenI = items.length; i < lenI; ++i) {
17 | items[i].checked = false;
18 |
19 | for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
20 | if(items[i].value == values[j]){
21 | items[i].checked = true;
22 | break
23 | }
24 | }
25 | }
26 |
27 | this.setData({
28 | items: items
29 | })
30 | }
31 | })
32 |
--------------------------------------------------------------------------------
/page/component/pages/input/input.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | focus: false,
4 | inputValue: ''
5 | },
6 | bindKeyInput: function (e) {
7 | this.setData({
8 | inputValue: e.detail.value
9 | })
10 | },
11 | bindReplaceInput: function (e) {
12 | var value = e.detail.value
13 | var pos = e.detail.cursor
14 | var left
15 | if (pos !== -1) {
16 | // 光标在中间
17 | left = e.detail.value.slice(0, pos)
18 | // 计算光标的位置
19 | pos = left.replace(/11/g, '2').length
20 | }
21 |
22 | // 直接返回对象,可以对输入进行过滤处理,同时可以控制光标的位置
23 | return {
24 | value: value.replace(/11/g, '2'),
25 | cursor: pos
26 | }
27 |
28 | // 或者直接返回字符串,光标在最后边
29 | // return value.replace(/11/g,'2'),
30 | },
31 | bindHideKeyboard: function (e) {
32 | if (e.detail.value === '123') {
33 | // 收起键盘
34 | wx.hideKeyboard()
35 | }
36 | }
37 | })
38 |
--------------------------------------------------------------------------------
/vendor/qcloud-weapp-client-sdk/lib/wxTunnel.js:
--------------------------------------------------------------------------------
1 | /* istanbul ignore next */
2 | const noop = () => void(0);
3 |
4 | let onOpen, onClose, onMessage, onError;
5 |
6 | /* istanbul ignore next */
7 | function listen(listener) {
8 | if (listener) {
9 | onOpen = listener.onOpen;
10 | onClose = listener.onClose;
11 | onMessage = listener.onMessage;
12 | onError = listener.onError;
13 | } else {
14 | onOpen = noop;
15 | onClose = noop;
16 | onMessage = noop;
17 | onError = noop;
18 | }
19 | }
20 |
21 | /* istanbul ignore next */
22 | function bind() {
23 | wx.onSocketOpen(result => onOpen(result));
24 | wx.onSocketClose(result => onClose(result));
25 | wx.onSocketMessage(result => onMessage(result));
26 | wx.onSocketError(error => onError(error));
27 | }
28 |
29 | listen(null);
30 | bind();
31 |
32 | module.exports = { listen };
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 小程序配置文件
3 | */
4 |
5 | // 此处主机域名是腾讯云解决方案分配的域名
6 | // 小程序后台服务解决方案:https://www.qcloud.com/solution/la
7 |
8 | var host = "14592619.qcloud.la"
9 |
10 | var config = {
11 |
12 | // 下面的地址配合云端 Server 工作
13 | host,
14 |
15 | // 登录地址,用于建立会话
16 | loginUrl: `https://${host}/login`,
17 |
18 | // 测试的请求地址,用于测试会话
19 | requestUrl: `https://${host}/testRequest`,
20 |
21 | // 用code换取openId
22 | openIdUrl: `https://${host}/openid`,
23 |
24 | // 测试的信道服务接口
25 | tunnelUrl: `https://${host}/tunnel`,
26 |
27 | // 生成支付订单的接口
28 | paymentUrl: `https://${host}/payment`,
29 |
30 | // 发送模板消息接口
31 | templateMessageUrl: `https://${host}/templateMessage`,
32 |
33 | // 上传文件接口
34 | uploadFileUrl: `https://${host}/upload`,
35 |
36 | // 下载示例图片接口
37 | downloadExampleUrl: `https://${host}/static/weapp.jpg`
38 | };
39 |
40 | module.exports = config
41 |
--------------------------------------------------------------------------------
/page/API/pages/upload-file/upload-file.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 选择图片
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/page/API/pages/request/request.js:
--------------------------------------------------------------------------------
1 | const requestUrl = require('../../../../config').requestUrl
2 | const duration = 2000
3 |
4 | Page({
5 | makeRequest: function() {
6 | var self = this
7 |
8 | self.setData({
9 | loading: true
10 | })
11 |
12 | wx.request({
13 | url: requestUrl,
14 | data: {
15 | noncestr: Date.now()
16 | },
17 | success: function(result) {
18 | wx.showToast({
19 | title: '请求成功',
20 | icon: 'success',
21 | mask: true,
22 | duration: duration
23 | })
24 | self.setData({
25 | loading: false
26 | })
27 | console.log('request success', result)
28 | },
29 |
30 | fail: function({errMsg}) {
31 | console.log('request fail', errMsg)
32 | self.setData({
33 | loading: false
34 | })
35 | }
36 | })
37 | }
38 | })
39 |
--------------------------------------------------------------------------------
/page/API/pages/set-navigation-bar-title/set-navigation-bar-title.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/page/API/pages/on-accelerometer-change/on-accelerometer-change.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 倾斜手机即可移动下方小球
10 |
11 |
12 |
13 |
14 |
15 | X: {{x}}
16 | Y: {{y}}
17 | Z: {{z}}
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/page/component/pages/progress/progress.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/util/util.js:
--------------------------------------------------------------------------------
1 | function formatTime(time) {
2 | if (typeof time !== 'number' || time < 0) {
3 | return time
4 | }
5 |
6 | var hour = parseInt(time / 3600)
7 | time = time % 3600
8 | var minute = parseInt(time / 60)
9 | time = time % 60
10 | var second = time
11 |
12 | return ([hour, minute, second]).map(function (n) {
13 | n = n.toString()
14 | return n[1] ? n : '0' + n
15 | }).join(':')
16 | }
17 |
18 | function formatLocation(longitude, latitude) {
19 | if (typeof longitude === 'string' && typeof latitude === 'string') {
20 | longitude = parseFloat(longitude)
21 | latitude = parseFloat(latitude)
22 | }
23 |
24 | longitude = longitude.toFixed(2)
25 | latitude = latitude.toFixed(2)
26 |
27 | return {
28 | longitude: longitude.toString().split('.'),
29 | latitude: latitude.toString().split('.')
30 | }
31 | }
32 |
33 | module.exports = {
34 | formatTime: formatTime,
35 | formatLocation: formatLocation
36 | }
37 |
--------------------------------------------------------------------------------
/page/component/pages/button/button.js:
--------------------------------------------------------------------------------
1 | var types = ['default', 'primary', 'warn']
2 | var pageObject = {
3 | data: {
4 | defaultSize: 'default',
5 | primarySize: 'default',
6 | warnSize: 'default',
7 | disabled: false,
8 | plain: false,
9 | loading: false
10 | },
11 | setDisabled: function(e) {
12 | this.setData({
13 | disabled: !this.data.disabled
14 | })
15 | },
16 | setPlain: function(e) {
17 | this.setData({
18 | plain: !this.data.plain
19 | })
20 | },
21 | setLoading: function(e) {
22 | this.setData({
23 | loading: !this.data.loading
24 | })
25 | }
26 | }
27 |
28 | for (var i = 0; i < types.length; ++i) {
29 | (function(type) {
30 | pageObject[type] = function(e) {
31 | var key = type + 'Size'
32 | var changedData = {}
33 | changedData[key] =
34 | this.data[key] === 'default' ? 'mini' : 'default'
35 | this.setData(changedData)
36 | }
37 | })(types[i])
38 | }
39 |
40 | Page(pageObject)
41 |
--------------------------------------------------------------------------------
/page/API/pages/get-network-type/get-network-type.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 网络状态
11 |
12 | 未获取
13 | 点击绿色按钮可获取网络状态
14 |
15 |
16 | {{networkType}}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/vendor/qcloud-weapp-client-sdk/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "qcloud-weapp-client-sdk",
3 | "description": "QCloud 微信小程序客户端 SDK",
4 | "main": "index.js",
5 | "authors": [
6 | "Tencent Cloud"
7 | ],
8 | "license": "MIT",
9 | "keywords": [
10 | "qcloud",
11 | "weapp",
12 | "wechat",
13 | "sdk",
14 | "client",
15 | "auth",
16 | "websocket"
17 | ],
18 | "homepage": "https://github.com/tencentyun/weapp-client-sdk",
19 | "ignore": [
20 | "**/.*",
21 | "node_modules",
22 | "bower_components",
23 | "test",
24 | "tests",
25 | "typings.json",
26 | "jsconfig.json",
27 | "package.json",
28 | ".npmignore",
29 | ".travis.yml",
30 | ".gitignore"
31 | ],
32 | "version": "0.8.2",
33 | "_release": "0.8.2",
34 | "_resolution": {
35 | "type": "version",
36 | "tag": "v0.8.2",
37 | "commit": "0944545afe0b6bc4aec8c39e8437dbe95a07a8d9"
38 | },
39 | "_source": "https://github.com/tencentyun/weapp-client-sdk.git",
40 | "_target": "*",
41 | "_originalSource": "qcloud-weapp-client-sdk"
42 | }
--------------------------------------------------------------------------------
/page/API/pages/get-user-info/get-user-info.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 用户信息
11 |
12 | 未获取
13 | 点击绿色按钮可获取用户头像及昵称
14 |
15 |
16 |
17 | {{userInfo.nickName}}
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/page/component/pages/slider/slider.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 设置step
10 |
11 |
12 |
13 |
14 |
15 |
16 | 显示当前value
17 |
18 |
19 |
20 |
21 |
22 |
23 | 设置最小/最大值
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/page/API/pages/get-location/get-location.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 当前位置经纬度
11 |
12 | 未获取
13 |
14 |
15 |
16 | E: {{location.longitude[0]}}°{{location.longitude[1]}}′
17 | N: {{location.latitude[0]}}°{{location.latitude[1]}}′
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/page/API/pages/web-socket/web-socket.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Socket状态
12 |
13 |
14 |
15 |
16 |
17 | 消息
18 |
19 | Hello, 小程序!
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/page/API/pages/choose-location/choose-location.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 当前位置信息
11 |
12 | 未选择位置
13 |
14 |
15 | {{locationAddress}}
16 |
17 | E: {{location.longitude[0]}}°{{location.longitude[1]}}′
18 | N: {{location.latitude[0]}}°{{location.latitude[1]}}′
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/vendor/qcloud-weapp-client-sdk/LICENSE:
--------------------------------------------------------------------------------
1 | LICENSE - "MIT License"
2 |
3 | Copyright (c) 2016 by Tencent Cloud
4 |
5 | Permission is hereby granted, free of charge, to any person
6 | obtaining a copy of this software and associated documentation
7 | files (the "Software"), to deal in the Software without
8 | restriction, including without limitation the rights to use,
9 | copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the
11 | Software is furnished to do so, subject to the following
12 | conditions:
13 |
14 | The above copyright notice and this permission notice shall be
15 | included in all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 | OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/page/component/pages/radio/radio.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 默认样式
10 |
13 |
16 |
17 |
18 |
19 |
20 | 推荐展示样式
21 |
22 |
23 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/page/component/pages/switch/switch.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 默认样式
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | 推荐展示样式
18 |
19 |
20 | 开启中
21 |
22 |
23 |
24 |
25 |
26 | 关闭
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/page/component/pages/view/view.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | flex-direction: row\n横向布局
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | flex-direction: column\n纵向布局
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/page/API/pages/upload-file/upload-file.js:
--------------------------------------------------------------------------------
1 | const uploadFileUrl = require('../../../../config').uploadFileUrl
2 |
3 | Page({
4 | chooseImage: function() {
5 | var self = this
6 |
7 | wx.chooseImage({
8 | count: 1,
9 | sizeType: ['compressed'],
10 | sourceType: ['album'],
11 | success: function(res) {
12 | console.log('chooseImage success, temp path is', res.tempFilePaths[0])
13 |
14 | var imageSrc = res.tempFilePaths[0]
15 |
16 | wx.uploadFile({
17 | url: uploadFileUrl,
18 | filePath: imageSrc,
19 | name: 'data',
20 | success: function(res) {
21 | console.log('uploadImage success, res is:', res)
22 |
23 | wx.showToast({
24 | title: '上传成功',
25 | icon: 'success',
26 | duration: 1000
27 | })
28 |
29 | self.setData({
30 | imageSrc
31 | })
32 | },
33 | fail: function({errMsg}) {
34 | console.log('uploadImage fail, errMsg is', errMsg)
35 | }
36 | })
37 |
38 | },
39 | fail: function({errMsg}) {
40 | console.log('chooseImage fail, err is', errMsg)
41 | }
42 | })
43 | }
44 | })
45 |
--------------------------------------------------------------------------------
/page/component/pages/checkbox/checkbox.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 默认样式
10 |
13 |
16 |
17 |
18 |
19 | 推荐展示样式
20 |
21 |
22 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/page/component/pages/label/label.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | checkboxItems: [
4 | {name: 'USA', value: '美国'},
5 | {name: 'CHN', value: '中国', checked: 'true'}
6 | ],
7 | radioItems: [
8 | {name: 'USA', value: '美国'},
9 | {name: 'CHN', value: '中国', checked: 'true'}
10 | ],
11 | hidden: false
12 | },
13 | checkboxChange: function (e) {
14 | var checked = e.detail.value
15 | var changed = {}
16 | for (var i = 0; i < this.data.checkboxItems.length; i++) {
17 | if (checked.indexOf(this.data.checkboxItems[i].name) !== -1) {
18 | changed['checkboxItems[' + i + '].checked'] = true
19 | } else {
20 | changed['checkboxItems[' + i + '].checked'] = false
21 | }
22 | }
23 | this.setData(changed)
24 | },
25 | radioChange: function (e) {
26 | var checked = e.detail.value
27 | var changed = {}
28 | for (var i = 0; i < this.data.radioItems.length; i ++) {
29 | if (checked.indexOf(this.data.radioItems[i].name) !== -1) {
30 | changed['radioItems[' + i + '].checked'] = true
31 | } else {
32 | changed['radioItems[' + i + '].checked'] = false
33 | }
34 | }
35 | this.setData(changed)
36 | },
37 | tapEvent: function (e) {
38 | console.log('按钮被点击')
39 | }
40 | })
41 |
--------------------------------------------------------------------------------
/page/API/pages/video/video.js:
--------------------------------------------------------------------------------
1 | var sourceType = [ ['camera'], ['album'], ['camera', 'album'] ]
2 | var camera = [ ['front'], ['back'], ['front', 'back'] ]
3 | var duration = Array.apply(null, {length: 60}).map(function (n, i) {
4 | return i + 1
5 | })
6 |
7 | Page({
8 | data: {
9 | sourceTypeIndex: 2,
10 | sourceType: ['拍摄', '相册', '拍摄或相册'],
11 |
12 | cameraIndex: 2,
13 | camera: ['前置', '后置', '前置或后置'],
14 |
15 | durationIndex: 59,
16 | duration: duration.map(function (t) { return t + '秒'}),
17 |
18 | src: ''
19 | },
20 | sourceTypeChange: function (e) {
21 | this.setData({
22 | sourceTypeIndex: e.detail.value
23 | })
24 | },
25 | cameraChange: function (e) {
26 | this.setData({
27 | cameraIndex: e.detail.value
28 | })
29 | },
30 | durationChange: function (e) {
31 | this.setData({
32 | durationIndex: e.detail.value
33 | })
34 | },
35 | chooseVideo: function () {
36 | var that = this
37 | wx.chooseVideo({
38 | sourceType: sourceType[this.data.sourceTypeIndex],
39 | camera: camera[this.data.cameraIndex],
40 | maxDuration: duration[this.data.durationIndex],
41 | success: function (res) {
42 | that.setData({
43 | src: res.tempFilePath
44 | })
45 | }
46 | })
47 | }
48 | })
49 |
--------------------------------------------------------------------------------
/page/API/pages/animation/animation.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/page/component/pages/canvas/canvas.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onReady: function () {
3 | this.position = {
4 | x: 150,
5 | y: 150,
6 | vx: 2,
7 | vy: 2
8 | }
9 |
10 | this.drawBall()
11 | this.interval = setInterval(this.drawBall, 17)
12 | },
13 | drawBall: function () {
14 | var p = this.position
15 | p.x += p.vx
16 | p.y += p.vy
17 | if (p.x >= 300) {
18 | p.vx = -2
19 | }
20 | if (p.x <= 7) {
21 | p.vx = 2
22 | }
23 | if (p.y >= 300) {
24 | p.vy = -2
25 | }
26 | if (p.y <= 7) {
27 | p.vy = 2
28 | }
29 |
30 | var context = wx.createContext()
31 |
32 | function ball(x, y) {
33 | context.beginPath(0)
34 | context.arc(x, y, 5, 0, Math.PI * 2)
35 | context.setFillStyle('#1aad19')
36 | context.setStrokeStyle('rgba(1,1,1,0)')
37 | context.fill()
38 | context.stroke()
39 | }
40 |
41 | ball(p.x, 150)
42 | ball(150, p.y)
43 | ball(300 - p.x, 150)
44 | ball(150, 300 - p.y)
45 | ball(p.x, p.y)
46 | ball(300 - p.x, 300 - p.y)
47 | ball(p.x, 300 - p.y)
48 | ball(300 - p.x, p.y)
49 |
50 | wx.drawCanvas({
51 | canvasId: 'canvas',
52 | actions: context.getActions()
53 | })
54 | },
55 | onUnload: function () {
56 | clearInterval(this.interval)
57 | }
58 | })
59 |
--------------------------------------------------------------------------------
/page/component/pages/video/video.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 弹幕内容
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | const openIdUrl = require('./config').openIdUrl
2 |
3 | App({
4 | onLaunch: function () {
5 | console.log('App Launch')
6 | },
7 | onShow: function () {
8 | console.log('App Show')
9 | },
10 | onHide: function () {
11 | console.log('App Hide')
12 | },
13 | globalData: {
14 | hasLogin: false,
15 | openid: null
16 | },
17 | // lazy loading openid
18 | getUserOpenId: function(callback) {
19 | var self = this
20 |
21 | if (self.globalData.openid) {
22 | callback(null, self.globalData.openid)
23 | } else {
24 | wx.login({
25 | success: function(data) {
26 | wx.request({
27 | url: openIdUrl,
28 | data: {
29 | code: data.code
30 | },
31 | success: function(res) {
32 | console.log('拉取openid成功', res)
33 | self.globalData.openid = res.data.openid
34 | callback(null, self.globalData.openid)
35 | },
36 | fail: function(res) {
37 | console.log('拉取用户openid失败,将无法正常使用开放接口等服务', res)
38 | callback(res)
39 | }
40 | })
41 | },
42 | fail: function(err) {
43 | console.log('wx.login 接口调用失败,将无法正常使用开放接口等服务', err)
44 | callback(err)
45 | }
46 | })
47 | }
48 | }
49 | })
50 |
--------------------------------------------------------------------------------
/page/API/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 以下将演示小程序接口能力,具体属性参数详见小程序开发文档。
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{item.name}}
12 |
13 |
14 |
15 |
16 |
17 |
18 | {{page.zh}}
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/page/component/pages/text/text.js:
--------------------------------------------------------------------------------
1 | var texts = [
2 | '2011年1月,微信1.0发布',
3 | '同年5月,微信2.0语音对讲发布',
4 | '10月,微信3.0新增摇一摇功能',
5 | '2012年3月,微信用户突破1亿',
6 | '4月份,微信4.0朋友圈发布',
7 | '同年7月,微信4.2发布公众平台',
8 | '2013年8月,微信5.0发布微信支付',
9 | '2014年9月,企业号发布',
10 | '同月,发布微信卡包',
11 | '2015年1月,微信第一条朋友圈广告',
12 | '2016年1月,企业微信发布',
13 | '2017年1月,小程序发布',
14 | '......'
15 | ];
16 |
17 | Page({
18 | data: {
19 | text: '',
20 | canAdd: true,
21 | canRemove: false
22 | },
23 | extraLine: [],
24 | add: function(e) {
25 | var that = this;
26 | this.extraLine.push(texts[this.extraLine.length % 12])
27 | this.setData({
28 | text: this.extraLine.join('\n'),
29 | canAdd: this.extraLine.length < 12,
30 | canRemove: this.extraLine.length > 0
31 | })
32 | setTimeout(function(){
33 | that.setData({
34 | scrollTop: 99999
35 | });
36 | }, 0)
37 | },
38 | remove: function(e) {
39 | var that = this;
40 | if (this.extraLine.length > 0) {
41 | this.extraLine.pop()
42 | this.setData({
43 | text: this.extraLine.join('\n'),
44 | canAdd: this.extraLine.length < 12,
45 | canRemove: this.extraLine.length > 0,
46 | })
47 | }
48 | setTimeout(function(){
49 | that.setData({
50 | scrollTop: 99999
51 | });
52 | }, 0)
53 | }
54 | })
55 |
--------------------------------------------------------------------------------
/page/component/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 以下将展示小程序官方组件能力,组件样式仅供参考,开发者可根据自身需求自定义组件样式,具体属性参数详见小程序开发文档。
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{item.name}}
12 |
13 |
14 |
15 |
16 |
17 |
18 | {{page}}
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/page/component/pages/button/button.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/page/API/pages/file/file.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 请选择文件
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | {{dialog.content}}
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/page/component/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | list: [
4 | {
5 | id: 'view',
6 | name: '视图容器',
7 | open: false,
8 | pages: ['view', 'scroll-view', 'swiper']
9 | }, {
10 | id: 'content',
11 | name: '基础内容',
12 | open: false,
13 | pages: ['text', 'icon', 'progress']
14 | }, {
15 | id: 'form',
16 | name: '表单组件',
17 | open: false,
18 | pages: ['button', 'checkbox', 'form', 'input', 'label', 'picker', 'radio', 'slider', 'switch', 'textarea']
19 | }, {
20 | id: 'nav',
21 | name: '导航',
22 | open: false,
23 | pages: ['navigator']
24 | }, {
25 | id: 'media',
26 | name: '媒体组件',
27 | open: false,
28 | pages: ['image', 'audio', 'video']
29 | }, {
30 | id: 'map',
31 | name: '地图',
32 | pages: ['map']
33 | }, {
34 | id: 'canvas',
35 | name: '画布',
36 | pages: ['canvas']
37 | }
38 | ]
39 | },
40 | kindToggle: function (e) {
41 | var id = e.currentTarget.id, list = this.data.list;
42 | for (var i = 0, len = list.length; i < len; ++i) {
43 | if (list[i].id == id) {
44 | list[i].open = !list[i].open
45 | } else {
46 | list[i].open = false
47 | }
48 | }
49 | this.setData({
50 | list: list
51 | });
52 | }
53 | })
54 |
55 |
--------------------------------------------------------------------------------
/page/API/pages/request-payment/request-payment.js:
--------------------------------------------------------------------------------
1 | const paymentUrl = require('../../../../config').paymentUrl
2 |
3 | var app = getApp()
4 |
5 | Page({
6 | onLoad: function() {
7 | },
8 | requestPayment: function() {
9 | var self = this
10 |
11 | self.setData({
12 | loading: true
13 | })
14 | // 此处需要先调用wx.login方法获取code,然后在服务端调用微信接口使用code换取下单用户的openId
15 | // 具体文档参考https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-login.html?t=20161230#wxloginobject
16 | app.getUserOpenId(function(err, openid) {
17 | if (!err) {
18 | wx.request({
19 | url: paymentUrl,
20 | data: {
21 | openid
22 | },
23 | method: 'POST',
24 | success: function(res) {
25 | console.log('unified order success, response is:', res)
26 | var payargs = res.data.payargs
27 | wx.requestPayment({
28 | timeStamp: payargs.timeStamp,
29 | nonceStr: payargs.nonceStr,
30 | package: payargs.package,
31 | signType: payargs.signType,
32 | paySign: payargs.paySign
33 | })
34 |
35 | self.setData({
36 | loading: false
37 | })
38 | }
39 | })
40 | } else {
41 | console.log('err:', err)
42 | self.setData({
43 | loading: false
44 | })
45 | }
46 | })
47 | }
48 | })
49 |
--------------------------------------------------------------------------------
/page/API/pages/background-audio/background-audio.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{formatedPlayTime}}
10 |
11 |
12 | 00:00
13 | 04:29
14 |
15 |
16 | 注意:离开当前页面后背景音乐将保持播放,但退出小程序将停止
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/page/API/pages/image/image.js:
--------------------------------------------------------------------------------
1 | var sourceType = [ ['camera'], ['album'], ['camera', 'album'] ]
2 | var sizeType = [ ['compressed'], ['original'], ['compressed', 'original'] ]
3 |
4 | Page({
5 | data: {
6 | imageList: [],
7 | sourceTypeIndex: 2,
8 | sourceType: ['拍照', '相册', '拍照或相册'],
9 |
10 | sizeTypeIndex: 2,
11 | sizeType: ['压缩', '原图', '压缩或原图'],
12 |
13 | countIndex: 8,
14 | count: [1, 2, 3, 4, 5, 6, 7, 8, 9]
15 | },
16 | sourceTypeChange: function (e) {
17 | this.setData({
18 | sourceTypeIndex: e.detail.value
19 | })
20 | },
21 | sizeTypeChange: function (e) {
22 | this.setData({
23 | sizeTypeIndex: e.detail.value
24 | })
25 | },
26 | countChange: function (e) {
27 | this.setData({
28 | countIndex: e.detail.value
29 | })
30 | },
31 | chooseImage: function () {
32 | var that = this
33 | wx.chooseImage({
34 | sourceType: sourceType[this.data.sourceTypeIndex],
35 | sizeType: sizeType[this.data.sizeTypeIndex],
36 | count: this.data.count[this.data.countIndex],
37 | success: function (res) {
38 | console.log(res)
39 | that.setData({
40 | imageList: res.tempFilePaths
41 | })
42 | }
43 | })
44 | },
45 | previewImage: function (e) {
46 | var current = e.target.dataset.src
47 |
48 | wx.previewImage({
49 | current: current,
50 | urls: this.data.imageList
51 | })
52 | }
53 | })
54 |
--------------------------------------------------------------------------------
/page/component/pages/video/video.js:
--------------------------------------------------------------------------------
1 | function getRandomColor () {
2 | const rgb = []
3 | for (let i = 0 ; i < 3; ++i){
4 | let color = Math.floor(Math.random() * 256).toString(16)
5 | color = color.length == 1 ? '0' + color : color
6 | rgb.push(color)
7 | }
8 | return '#' + rgb.join('')
9 | }
10 |
11 | Page({
12 | onReady: function (res) {
13 | this.videoContext = wx.createVideoContext('myVideo')
14 | },
15 | inputValue: '',
16 | data: {
17 | src: '',
18 | danmuList:
19 | [{
20 | text: '第 1s 出现的弹幕',
21 | color: '#ff0000',
22 | time: 1
23 | },
24 | {
25 | text: '第 3s 出现的弹幕',
26 | color: '#ff00ff',
27 | time: 3
28 | }]
29 | },
30 | bindInputBlur: function(e) {
31 | this.inputValue = e.detail.value
32 | },
33 | bindButtonTap: function() {
34 | var that = this
35 | wx.chooseVideo({
36 | sourceType: ['album', 'camera'],
37 | maxDuration: 60,
38 | camera: ['front','back'],
39 | success: function(res) {
40 | that.setData({
41 | src: res.tempFilePath
42 | })
43 | }
44 | })
45 | },
46 | bindSendDanmu: function () {
47 | this.videoContext.sendDanmu({
48 | text: this.inputValue,
49 | color: getRandomColor()
50 | })
51 | },
52 | videoErrorCallback: function(e) {
53 | console.log('视频错误信息:')
54 | console.log(e.detail.errMsg)
55 | }
56 | })
--------------------------------------------------------------------------------
/page/API/pages/template-message/template-message.js:
--------------------------------------------------------------------------------
1 | const templateMessageUrl = require('../../../../config').templateMessageUrl
2 |
3 | var app = getApp()
4 |
5 | const formData = {
6 | address: 'T.I.T 造舰厂',
7 | time: '2017.01.09',
8 | name: '帝国歼星舰',
9 | serial: '123456789'
10 | }
11 |
12 | Page({
13 | onLoad: function() {
14 | this.setData({
15 | formData
16 | })
17 | },
18 |
19 | submitForm: function(e) {
20 | var self = this
21 | var form_id = e.detail.formId
22 | var formData = e.detail.value
23 |
24 | console.log('form_id is:', form_id)
25 |
26 | self.setData({
27 | loading: true
28 | })
29 |
30 | app.getUserOpenId(function(err, openid) {
31 | if (!err) {
32 | wx.request({
33 | url: templateMessageUrl,
34 | method: 'POST',
35 | data: {
36 | form_id,
37 | openid,
38 | formData
39 | },
40 | success: function(res) {
41 | console.log('submit form success', res)
42 | wx.showToast({
43 | title: '发送成功',
44 | icon: 'success'
45 | })
46 | self.setData({
47 | loading: false
48 | })
49 | },
50 | fail: function({errMsg}) {
51 | console.log('submit form fail, errMsg is:', errMsg)
52 | }
53 | })
54 | } else {
55 | console.log('err:', err)
56 | }
57 | })
58 | }
59 | })
60 |
61 |
62 |
--------------------------------------------------------------------------------
/page/API/pages/share/share.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 发送内容(以下字段可自由适配)
9 |
10 |
11 |
12 | 标题
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 描述
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | 跳转页面
29 |
30 |
31 |
32 |
33 |
34 |
35 | 点击右上角菜单分享给好友
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/page/component/pages/scroll-view/scroll-view.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Vertical Scroll\n纵向滚动
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | Horizontal Scroll\n横向滚动
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/page/API/pages/storage/storage.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | key
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | value
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | {{dialog.content}}
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/page/API/pages/sendMessage/sendMessage.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 发送内容(以下字段可自由适配)
9 |
10 |
11 |
12 | 实例字段
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 实例字段
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | 跳转链接
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/page/component/pages/label/label.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 表单组件在label内
10 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
21 | label用for标识表单组件
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | label内有多个时选中第一个
32 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/page/API/pages/file/file.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onLoad: function () {
3 | this.setData({
4 | savedFilePath: wx.getStorageSync('savedFilePath')
5 | })
6 | },
7 | data: {
8 | tempFilePath: '',
9 | savedFilePath: '',
10 | dialog: {
11 | hidden: true
12 | }
13 | },
14 | chooseImage: function () {
15 | var that = this
16 | wx.chooseImage({
17 | count: 1,
18 | success: function (res) {
19 | that.setData({
20 | tempFilePath: res.tempFilePaths[0]
21 | })
22 | }
23 | })
24 | },
25 | saveFile: function () {
26 | if (this.data.tempFilePath.length > 0) {
27 | var that = this
28 | wx.saveFile({
29 | tempFilePath: this.data.tempFilePath,
30 | success: function (res) {
31 | that.setData({
32 | savedFilePath: res.savedFilePath
33 | })
34 | wx.setStorageSync('savedFilePath', res.savedFilePath)
35 | that.setData({
36 | dialog: {
37 | title: '保存成功',
38 | content: '下次进入应用时,此文件仍可用',
39 | hidden: false
40 | }
41 | })
42 | },
43 | fail: function (res) {
44 | that.setData({
45 | dialog: {
46 | title: '保存失败',
47 | content: '应该是有 bug 吧',
48 | hidden: false
49 | }
50 | })
51 | }
52 | })
53 | }
54 | },
55 | clear: function () {
56 | wx.setStorageSync('savedFilePath', '')
57 | this.setData({
58 | tempFilePath: '',
59 | savedFilePath: ''
60 | })
61 | },
62 | confirm: function () {
63 | this.setData({
64 | 'dialog.hidden': true
65 | })
66 | }
67 | })
68 |
--------------------------------------------------------------------------------
/page/component/pages/form/form.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/page/component/pages/swiper/swiper.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 指示点
22 |
23 |
24 |
25 |
26 |
27 | 自动播放
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | 幻灯片切换时长(ms)
38 | {{duration}}
39 |
40 |
41 |
42 | 自动播放间隔时长(ms)
43 | {{interval}}
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/page/API/pages/template-message/template-message.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/page/component/pages/picker/picker.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 地区选择器
10 |
11 |
12 |
13 | 当前选择
14 |
15 |
16 |
17 | {{array[index]}}
18 |
19 |
20 |
21 |
22 |
23 | 时间选择器
24 |
25 |
26 |
27 | 当前选择
28 |
29 |
30 |
31 | {{time}}
32 |
33 |
34 |
35 |
36 |
37 | 日期选择器
38 |
39 |
40 |
41 | 当前选择
42 |
43 |
44 |
45 | {{date}}
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/page/API/pages/open-location/open-location.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/page/API/pages/animation/animation.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onReady: function () {
3 | this.animation = wx.createAnimation()
4 | },
5 | rotate: function () {
6 | this.animation.rotate(Math.random() * 720 - 360).step()
7 | this.setData({animation: this.animation.export()})
8 | },
9 | scale: function () {
10 | this.animation.scale(Math.random() * 2).step()
11 | this.setData({animation: this.animation.export()})
12 | },
13 | translate: function () {
14 | this.animation.translate(Math.random() * 100 - 50, Math.random() * 100 - 50).step()
15 | this.setData({animation: this.animation.export()})
16 | },
17 | skew: function () {
18 | this.animation.skew(Math.random() * 90, Math.random() * 90).step()
19 | this.setData({animation: this.animation.export()})
20 | },
21 | rotateAndScale: function () {
22 | this.animation.rotate(Math.random() * 720 - 360)
23 | .scale(Math.random() * 2)
24 | .step()
25 | this.setData({animation: this.animation.export()})
26 | },
27 | rotateThenScale: function () {
28 | this.animation.rotate(Math.random() * 720 - 360).step()
29 | .scale(Math.random() * 2).step()
30 | this.setData({animation: this.animation.export()})
31 | },
32 | all: function () {
33 | this.animation.rotate(Math.random() * 720 - 360)
34 | .scale(Math.random() * 2)
35 | .translate(Math.random() * 100 - 50, Math.random() * 100 - 50)
36 | .skew(Math.random() * 90, Math.random() * 90)
37 | .step()
38 | this.setData({animation: this.animation.export()})
39 | },
40 | allInQueue: function () {
41 | this.animation.rotate(Math.random() * 720 - 360).step()
42 | .scale(Math.random() * 2).step()
43 | .translate(Math.random() * 100 - 50, Math.random() * 100 - 50).step()
44 | .skew(Math.random() * 90, Math.random() * 90).step()
45 | this.setData({animation: this.animation.export()})
46 | },
47 | reset: function () {
48 | this.animation.rotate(0, 0)
49 | .scale(1)
50 | .translate(0, 0)
51 | .skew(0, 0)
52 | .step({duration: 0})
53 | this.setData({animation: this.animation.export()})
54 | }
55 | })
56 |
--------------------------------------------------------------------------------
/page/API/pages/video/video.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | 视频来源
13 |
14 |
15 |
16 | {{sourceType[sourceTypeIndex]}}
17 |
18 |
19 |
20 |
21 |
22 | 摄像头
23 |
24 |
25 |
26 | {{camera[cameraIndex]}}
27 |
28 |
29 |
30 |
31 |
32 | 拍摄长度
33 |
34 |
35 |
36 | {{duration[durationIndex]}}
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | 添加视频
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/page/API/pages/storage/storage.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | key: '',
4 | data: '',
5 | dialog: {
6 | title: '',
7 | content: '',
8 | hidden: true
9 | }
10 | },
11 | keyChange: function (e) {
12 | this.data.key = e.detail.value
13 | },
14 | dataChange: function (e) {
15 | this.data.data = e.detail.value
16 | },
17 | getStorage: function () {
18 | var key = this.data.key,
19 | data = this.data.data
20 | var storageData
21 |
22 | if (key.length === 0) {
23 | this.setData({
24 | key: key,
25 | data: data,
26 | 'dialog.hidden': false,
27 | 'dialog.title': '读取数据失败',
28 | 'dialog.content': 'key 不能为空'
29 | })
30 | } else {
31 | storageData = wx.getStorageSync(key)
32 | if (storageData === "") {
33 | this.setData({
34 | key: key,
35 | data: data,
36 | 'dialog.hidden': false,
37 | 'dialog.title': '读取数据失败',
38 | 'dialog.content': '找不到 key 对应的数据'
39 | })
40 | } else {
41 | this.setData({
42 | key: key,
43 | data: data,
44 | 'dialog.hidden': false,
45 | 'dialog.title': '读取数据成功',
46 | 'dialog.content': "data: '"+ storageData + "'"
47 | })
48 | }
49 | }
50 | },
51 | setStorage: function () {
52 | var key = this.data.key
53 | var data = this.data.data
54 | if (key.length === 0) {
55 | this.setData({
56 | key: key,
57 | data: data,
58 | 'dialog.hidden': false,
59 | 'dialog.title': '保存数据失败',
60 | 'dialog.content': 'key 不能为空'
61 | })
62 | } else {
63 | wx.setStorageSync(key, data)
64 | this.setData({
65 | key: key,
66 | data: data,
67 | 'dialog.hidden': false,
68 | 'dialog.title': '存储数据成功'
69 | })
70 | }
71 | },
72 | clearStorage: function () {
73 | wx.clearStorageSync()
74 | this.setData({
75 | key: '',
76 | data: '',
77 | 'dialog.hidden': false,
78 | 'dialog.title': '清除数据成功',
79 | 'dialog.content': ''
80 | })
81 | },
82 | confirm: function () {
83 | this.setData({
84 | 'dialog.hidden': true,
85 | 'dialog.title': '',
86 | 'dialog.content': ''
87 | })
88 | }
89 | })
90 |
--------------------------------------------------------------------------------
/page/common/index.wxss:
--------------------------------------------------------------------------------
1 | .index-hd {
2 | padding: 80rpx;
3 | text-align: center;
4 | }
5 | .index-bd {
6 | padding: 0 30rpx 40rpx;
7 | }
8 | .index-ft {
9 | padding-bottom: 20rpx;
10 | text-align: center;
11 | }
12 | .index-logo {
13 | width: 86rpx;
14 | height: 86rpx;
15 | }
16 | .index-desc {
17 | margin-top: 20rpx;
18 | color: #888888;
19 | font-size: 28rpx;
20 | }
21 |
22 |
23 | .navigator-box {
24 | opacity: 0;
25 | position: relative;
26 | background-color: #FFFFFF;
27 | line-height: 1.41176471;
28 | font-size: 34rpx;
29 |
30 | transform: translateY(-50%);
31 | transition: .3s;
32 | }
33 | .navigator-box-show {
34 | opacity: 1;
35 | transform: translateY(0);
36 | }
37 | .navigator {
38 | padding: 20rpx 30rpx;
39 | position: relative;
40 | display: flex;
41 | align-items: center;
42 | }
43 | .navigator:before {
44 | content: " ";
45 | position: absolute;
46 | left: 30rpx;
47 | top: 0;
48 | right: 30rpx;
49 | height: 1px;
50 | border-top: 1rpx solid #D8D8D8;
51 | color: #D8D8D8;
52 | }
53 | .navigator:first-child:before {
54 | display: none;
55 | }
56 | .navigator-text {
57 | flex: 1;
58 | }
59 | .navigator-arrow {
60 | padding-right: 26rpx;
61 | position: relative;
62 | }
63 | .navigator-arrow:after {
64 | content: " ";
65 | display: inline-block;
66 | height: 18rpx;
67 | width: 18rpx;
68 | border-width: 2rpx 2rpx 0 0;
69 | border-color: #888888;
70 | border-style: solid;
71 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
72 | position: absolute;
73 | top: 50%;
74 | margin-top: -8rpx;
75 | right: 28rpx;
76 | }
77 |
78 |
79 | .kind-list-item {
80 | margin: 20rpx 0;
81 | background-color: #FFFFFF;
82 | border-radius: 4rpx;
83 | overflow: hidden;
84 | }
85 | .kind-list-item:first-child {
86 | margin-top: 0;
87 | }
88 | .kind-list-text{
89 | flex: 1;
90 | }
91 | .kind-list-img {
92 | width: 60rpx;
93 | height: 60rpx;
94 | }
95 | .kind-list-item-hd {
96 | padding: 30rpx;
97 | display: flex;
98 | align-items: center;
99 |
100 | transition: opacity .3s;
101 | }
102 | .kind-list-item-hd-show {
103 | opacity: .2;
104 | }
105 | .kind-list-item-bd {
106 | height: 0;
107 | overflow: hidden;
108 | }
109 | .kind-list-item-bd-show {
110 | height: auto;
111 | }
--------------------------------------------------------------------------------
/page/API/pages/on-accelerometer-change/on-accelerometer-change.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onReady: function () {
3 | this.drawBigBall()
4 | var that = this
5 |
6 | this.position = {
7 | x: 151,
8 | y: 151,
9 | vx: 0,
10 | vy: 0,
11 | ax: 0,
12 | ay: 0
13 | }
14 | wx.onAccelerometerChange(function (res) {
15 | that.setData({
16 | x: res.x.toFixed(2),
17 | y: res.y.toFixed(2),
18 | z: res.z.toFixed(2)
19 | })
20 | that.position.ax = Math.sin(res.x * Math.PI / 2)
21 | that.position.ay = -Math.sin(res.y * Math.PI / 2)
22 | //that.drawSmallBall()
23 | })
24 |
25 | this.interval = setInterval(function () {
26 | that.drawSmallBall()
27 | }, 17)
28 |
29 | },
30 | drawBigBall: function () {
31 | var context = wx.createContext()
32 | context.beginPath(0)
33 | context.arc(151, 151, 140, 0, Math.PI * 2)
34 | context.setFillStyle('#ffffff')
35 | context.setStrokeStyle('#aaaaaa')
36 | context.fill()
37 | // context.stroke()
38 | wx.drawCanvas({
39 | canvasId: 'big-ball',
40 | actions: context.getActions()
41 | })
42 | },
43 | drawSmallBall: function () {
44 | var p = this.position
45 | var strokeStyle = 'rgba(1,1,1,0)'
46 |
47 | p.x = p.x + p.vx
48 | p.y = p.y + p.vy
49 | p.vx = p.vx + p.ax
50 | p.vy = p.vy + p.ay
51 |
52 | if (Math.sqrt(Math.pow(Math.abs(p.x) - 151, 2) + Math.pow(Math.abs(p.y) - 151, 2)) >= 115) {
53 | if (p.x > 151 && p.vx > 0) {
54 | p.vx = 0
55 | }
56 | if (p.x < 151 && p.vx < 0) {
57 | p.vx = 0
58 | }
59 | if (p.y > 151 && p.vy > 0) {
60 | p.vy = 0
61 | }
62 | if (p.y < 151 && p.vy < 0) {
63 | p.vy = 0
64 | }
65 | strokeStyle = '#ff0000'
66 | }
67 |
68 | var context = wx.createContext()
69 | context.beginPath(0)
70 | context.arc(p.x, p.y, 15, 0, Math.PI * 2)
71 | context.setFillStyle('#1aad19')
72 | context.setStrokeStyle(strokeStyle)
73 | context.fill()
74 | // context.stroke()
75 | wx.drawCanvas({
76 | canvasId: 'small-ball',
77 | actions: context.getActions()
78 | })
79 | },
80 | data: {
81 | x: 0,
82 | y: 0,
83 | z: 0
84 | },
85 | onUnload: function () {
86 | clearInterval(this.interval)
87 | }
88 | })
89 |
--------------------------------------------------------------------------------
/page/API/pages/background-audio/background-audio.js:
--------------------------------------------------------------------------------
1 | var app = getApp()
2 | var util = require('../../../../util/util.js')
3 | var dataUrl = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
4 | Page({
5 | onLoad: function () {
6 | this._enableInterval()
7 |
8 | if (app.globalData.backgroundAudioPlaying) {
9 | this.setData({
10 | playing: true
11 | })
12 | }
13 | },
14 | data: {
15 | playing: false,
16 | playTime: 0,
17 | formatedPlayTime: '00:00:00'
18 | },
19 | play: function (res) {
20 | var that = this
21 | wx.playBackgroundAudio({
22 | dataUrl: dataUrl,
23 | title: '此时此刻',
24 | coverImgUrl: 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000',
25 | complete: function (res) {
26 | that.setData({
27 | playing: true
28 | })
29 | }
30 | })
31 | this._enableInterval()
32 | app.globalData.backgroundAudioPlaying = true
33 | },
34 | seek: function (e) {
35 | clearInterval(this.updateInterval)
36 | var that = this
37 | wx.seekBackgroundAudio({
38 | position: e.detail.value,
39 | complete: function () {
40 | // 实际会延迟两秒左右才跳过去
41 | setTimeout(function () {
42 | that._enableInterval()
43 | }, 2000)
44 | }
45 | })
46 | },
47 | pause: function () {
48 | var that = this
49 | wx.pauseBackgroundAudio({
50 | dataUrl: dataUrl,
51 | success: function () {
52 | that.setData({
53 | playing: false
54 | })
55 | }
56 | })
57 | app.globalData.backgroundAudioPlaying = false
58 | },
59 | stop: function () {
60 | var that = this
61 | wx.stopBackgroundAudio({
62 | dataUrl: dataUrl,
63 | success: function (res) {
64 | that.setData({
65 | playing: false,
66 | playTime: 0,
67 | formatedPlayTime: util.formatTime(0)
68 | })
69 | }
70 | })
71 | app.globalData.backgroundAudioPlaying = false
72 | },
73 | _enableInterval: function () {
74 | var that = this
75 | update()
76 | this.updateInterval = setInterval(update, 500)
77 | function update() {
78 | wx.getBackgroundAudioPlayerState({
79 | success: function (res) {
80 | that.setData({
81 | playTime: res.currentPosition,
82 | formatedPlayTime: util.formatTime(res.currentPosition + 1)
83 | })
84 | }
85 | })
86 | }
87 | },
88 | onUnload: function () {
89 | clearInterval(this.updateInterval)
90 | }
91 | })
92 |
--------------------------------------------------------------------------------
/page/API/pages/get-system-info/get-system-info.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | 手机型号
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 微信语言
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | 微信版本
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | 屏幕宽度
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | 屏幕高度
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | DPI
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/page/API/pages/voice/voice.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{formatedRecordTime}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | {{formatedRecordTime}}
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | {{formatedPlayTime}}
38 | {{formatedRecordTime}}
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | {{formatedPlayTime}}
54 | {{formatedRecordTime}}
55 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/page/API/pages/web-socket/web-socket.js:
--------------------------------------------------------------------------------
1 | const qcloud = require('../../../../vendor/qcloud-weapp-client-sdk/index')
2 | const loginUrl = require('../../../../config').loginUrl
3 | const tunnelUrl = require('../../../../config').tunnelUrl
4 |
5 | function showModal(title, content) {
6 | wx.showModal({
7 | title,
8 | content,
9 | showCancel: false
10 | })
11 | }
12 |
13 | function showSuccess(title) {
14 | wx.showToast({
15 | title,
16 | icon: 'success',
17 | duration: 1000
18 | })
19 | }
20 |
21 |
22 | Page({
23 | data: {
24 | socketStatus: 'closed'
25 | },
26 |
27 | onLoad: function() {
28 | var self = this
29 |
30 | qcloud.setLoginUrl(loginUrl)
31 |
32 | qcloud.login({
33 | success: function(result) {
34 | console.log('登录成功', result)
35 | self.setData({
36 | hasLogin: true
37 | })
38 | },
39 |
40 | fail: function(error) {
41 | console.log('登录失败', error)
42 | }
43 | })
44 | },
45 |
46 | onUnload: function() {
47 | this.closeSocket()
48 | },
49 |
50 | toggleSocket: function(e) {
51 | const turnedOn = e.detail.value
52 |
53 | if (turnedOn && this.data.socketStatus == 'closed') {
54 | this.openSocket()
55 |
56 | } else if (!turnedOn && this.data.socketStatus == 'connected') {
57 | var showSuccess = true
58 | this.closeSocket(showSuccess)
59 | }
60 | },
61 |
62 | openSocket: function() {
63 | var socket = this.socket = new qcloud.Tunnel(tunnelUrl)
64 |
65 | socket.on('connect', () => {
66 | console.log('WebSocket 已连接')
67 | showSuccess('Socket已连接')
68 | this.setData({
69 | socketStatus: 'connected',
70 | waitingResponse: false
71 | })
72 | })
73 |
74 | socket.on('close', () => {
75 | console.log('WebSocket 已断开')
76 | this.setData({ socketStatus: 'closed' })
77 | })
78 |
79 | socket.on('error', error => {
80 | showModal('发生错误', JSON.stringify(error))
81 | console.error('socket error:', error)
82 | this.setData({
83 | loading: false
84 | })
85 | })
86 |
87 | // 监听服务器推送消息
88 | socket.on('message', message => {
89 | showSuccess('收到信道消息')
90 | console.log('socket message:', message)
91 | this.setData({
92 | loading: false
93 | })
94 | })
95 |
96 | // 打开信道
97 | socket.open()
98 | },
99 |
100 | closeSocket: function(showSuccessToast) {
101 | if (this.socket) {
102 | this.socket.close()
103 | }
104 | if (showSuccessToast) showSuccess('Socket已断开')
105 | this.setData({ socketStatus: 'closed' })
106 | },
107 |
108 | sendMessage: function() {
109 | if (this.socket && this.socket.isActive()) {
110 | this.socket.emit('message', {
111 | 'content': 'Hello, 小程序!'
112 | })
113 | this.setData({
114 | loading: true
115 | })
116 | }
117 | },
118 | })
119 |
--------------------------------------------------------------------------------
/page/API/pages/image/image.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/page/API/pages/voice/voice.js:
--------------------------------------------------------------------------------
1 | var util = require('../../../../util/util.js')
2 | var playTimeInterval
3 | var recordTimeInterval
4 |
5 | Page({
6 | data: {
7 | recording: false,
8 | playing: false,
9 | hasRecord: false,
10 | recordTime: 0,
11 | playTime: 0,
12 | formatedRecordTime: '00:00:00',
13 | formatedPlayTime: '00:00:00'
14 | },
15 | onHide: function() {
16 | if (this.data.playing) {
17 | this.stopVoice()
18 | } else if (this.data.recording) {
19 | this.stopRecordUnexpectedly()
20 | }
21 | },
22 | startRecord: function () {
23 | this.setData({ recording: true })
24 |
25 | var that = this
26 | recordTimeInterval = setInterval(function () {
27 | var recordTime = that.data.recordTime += 1
28 | that.setData({
29 | formatedRecordTime: util.formatTime(that.data.recordTime),
30 | recordTime: recordTime
31 | })
32 | }, 1000)
33 | wx.startRecord({
34 | success: function (res) {
35 | that.setData({
36 | hasRecord: true,
37 | tempFilePath: res.tempFilePath,
38 | formatedPlayTime: util.formatTime(that.data.playTime)
39 | })
40 | },
41 | complete: function () {
42 | that.setData({ recording: false })
43 | clearInterval(recordTimeInterval)
44 | }
45 | })
46 | },
47 | stopRecord: function() {
48 | wx.stopRecord()
49 | },
50 | stopRecordUnexpectedly: function () {
51 | var that = this
52 | wx.stopRecord({
53 | success: function() {
54 | console.log('stop record success')
55 | clearInterval(recordTimeInterval)
56 | that.setData({
57 | recording: false,
58 | hasRecord: false,
59 | recordTime: 0,
60 | formatedRecordTime: util.formatTime(0)
61 | })
62 | }
63 | })
64 | },
65 | playVoice: function () {
66 | var that = this
67 | playTimeInterval = setInterval(function () {
68 | var playTime = that.data.playTime + 1
69 | console.log('update playTime', playTime)
70 | that.setData({
71 | playing: true,
72 | formatedPlayTime: util.formatTime(playTime),
73 | playTime: playTime
74 | })
75 | }, 1000)
76 | wx.playVoice({
77 | filePath: this.data.tempFilePath,
78 | success: function () {
79 | clearInterval(playTimeInterval)
80 | var playTime = 0
81 | console.log('play voice finished')
82 | that.setData({
83 | playing: false,
84 | formatedPlayTime: util.formatTime(playTime),
85 | playTime: playTime
86 | })
87 | }
88 | })
89 | },
90 | pauseVoice: function () {
91 | clearInterval(playTimeInterval)
92 | wx.pauseVoice()
93 | this.setData({
94 | playing: false
95 | })
96 | },
97 | stopVoice: function () {
98 | clearInterval(playTimeInterval)
99 | this.setData({
100 | playing: false,
101 | formatedPlayTime: util.formatTime(0),
102 | playTime: 0
103 | })
104 | wx.stopVoice()
105 | },
106 | clear: function () {
107 | clearInterval(playTimeInterval)
108 | wx.stopVoice()
109 | this.setData({
110 | playing: false,
111 | hasRecord: false,
112 | tempFilePath: '',
113 | formatedRecordTime: util.formatTime(0),
114 | recordTime: 0,
115 | playTime: 0
116 | })
117 | }
118 | })
119 |
--------------------------------------------------------------------------------
/page/component/pages/input/input.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 可以自动聚焦的input
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | 控制最大输入长度的input
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | 实时获取输入值:{{inputValue}}
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | 控制输入的input
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 控制键盘的input
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | 数字输入的input
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | 密码输入的input
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | 带小数点的input
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | 身份证输入的input
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | 控制占位符颜色的input
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/vendor/qcloud-weapp-client-sdk/lib/request.js:
--------------------------------------------------------------------------------
1 | var constants = require('./constants');
2 | var utils = require('./utils');
3 | var Session = require('./session');
4 | var loginLib = require('./login');
5 |
6 | var noop = function noop() {};
7 |
8 | var buildAuthHeader = function buildAuthHeader(session) {
9 | var header = {};
10 |
11 | if (session && session.id && session.skey) {
12 | header[constants.WX_HEADER_ID] = session.id;
13 | header[constants.WX_HEADER_SKEY] = session.skey;
14 | }
15 |
16 | return header;
17 | };
18 |
19 | /***
20 | * @class
21 | * 表示请求过程中发生的异常
22 | */
23 | var RequestError = (function () {
24 | function RequestError(type, message) {
25 | Error.call(this, message);
26 | this.type = type;
27 | this.message = message;
28 | }
29 |
30 | RequestError.prototype = new Error();
31 | RequestError.prototype.constructor = RequestError;
32 |
33 | return RequestError;
34 | })();
35 |
36 | function request(options) {
37 | if (typeof options !== 'object') {
38 | var message = '请求传参应为 object 类型,但实际传了 ' + (typeof options) + ' 类型';
39 | throw new RequestError(constants.ERR_INVALID_PARAMS, message);
40 | }
41 |
42 | var requireLogin = options.login;
43 | var success = options.success || noop;
44 | var fail = options.fail || noop;
45 | var complete = options.complete || noop;
46 | var originHeader = options.header || {};
47 |
48 | // 成功回调
49 | var callSuccess = function () {
50 | success.apply(null, arguments);
51 | complete.apply(null, arguments);
52 | };
53 |
54 | // 失败回调
55 | var callFail = function (error) {
56 | fail.call(null, error);
57 | complete.call(null, error);
58 | };
59 |
60 | // 是否已经进行过重试
61 | var hasRetried = false;
62 |
63 | if (requireLogin) {
64 | doRequestWithLogin();
65 | } else {
66 | doRequest();
67 | }
68 |
69 | // 登录后再请求
70 | function doRequestWithLogin() {
71 | loginLib.login({ success: doRequest, fail: callFail });
72 | }
73 |
74 | // 实际进行请求的方法
75 | function doRequest() {
76 | var authHeader = buildAuthHeader(Session.get());
77 |
78 | wx.request(utils.extend({}, options, {
79 | header: utils.extend({}, originHeader, authHeader),
80 |
81 | success: function (response) {
82 | var data = response.data;
83 |
84 | // 如果响应的数据里面包含 SDK Magic ID,表示被服务端 SDK 处理过,此时一定包含登录态失败的信息
85 | if (data && data[constants.WX_SESSION_MAGIC_ID]) {
86 | // 清除登录态
87 | Session.clear();
88 |
89 | var error, message;
90 | if (data.error === constants.ERR_INVALID_SESSION) {
91 | // 如果是登录态无效,并且还没重试过,会尝试登录后刷新凭据重新请求
92 | if (!hasRetried) {
93 | hasRetried = true;
94 | doRequestWithLogin();
95 | return;
96 | }
97 |
98 | message = '登录态已过期';
99 | error = new RequestError(data.error, message);
100 |
101 | } else {
102 | message = '鉴权服务器检查登录态发生错误(' + (data.error || 'OTHER') + '):' + (data.message || '未知错误');
103 | error = new RequestError(constants.ERR_CHECK_LOGIN_FAILED, message);
104 | }
105 |
106 | callFail(error);
107 | return;
108 | }
109 |
110 | callSuccess.apply(null, arguments);
111 | },
112 |
113 | fail: callFail,
114 | complete: noop,
115 | }));
116 | };
117 |
118 | };
119 |
120 | module.exports = {
121 | RequestError: RequestError,
122 | request: request,
123 | };
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "page/component/index",
4 |
5 | "page/component/pages/view/view",
6 | "page/component/pages/scroll-view/scroll-view",
7 | "page/component/pages/swiper/swiper",
8 |
9 | "page/component/pages/text/text",
10 | "page/component/pages/icon/icon",
11 | "page/component/pages/progress/progress",
12 |
13 | "page/component/pages/button/button",
14 | "page/component/pages/checkbox/checkbox",
15 | "page/component/pages/form/form",
16 | "page/component/pages/input/input",
17 | "page/component/pages/label/label",
18 | "page/component/pages/picker/picker",
19 | "page/component/pages/radio/radio",
20 | "page/component/pages/slider/slider",
21 | "page/component/pages/switch/switch",
22 | "page/component/pages/textarea/textarea",
23 |
24 | "page/component/pages/navigator/navigator",
25 | "page/component/pages/navigator/navigate",
26 | "page/component/pages/navigator/redirect",
27 |
28 | "page/component/pages/image/image",
29 | "page/component/pages/audio/audio",
30 | "page/component/pages/video/video",
31 |
32 | "page/component/pages/map/map",
33 |
34 | "page/component/pages/canvas/canvas",
35 |
36 |
37 |
38 | "page/API/index",
39 |
40 | "page/API/pages/login/login",
41 | "page/API/pages/get-user-info/get-user-info",
42 | "page/API/pages/request-payment/request-payment",
43 | "page/API/pages/share/share",
44 | "page/API/pages/custom-message/custom-message",
45 | "page/API/pages/template-message/template-message",
46 |
47 | "page/API/pages/set-navigation-bar-title/set-navigation-bar-title",
48 | "page/API/pages/navigation-bar-loading/navigation-bar-loading",
49 | "page/API/pages/navigator/navigator",
50 | "page/API/pages/pull-down-refresh/pull-down-refresh",
51 | "page/API/pages/animation/animation",
52 |
53 | "page/API/pages/action-sheet/action-sheet",
54 | "page/API/pages/modal/modal",
55 | "page/API/pages/toast/toast",
56 |
57 | "page/API/pages/get-network-type/get-network-type",
58 | "page/API/pages/get-system-info/get-system-info",
59 | "page/API/pages/on-compass-change/on-compass-change",
60 | "page/API/pages/make-phone-call/make-phone-call",
61 | "page/API/pages/scan-code/scan-code",
62 |
63 |
64 | "page/API/pages/request/request",
65 | "page/API/pages/web-socket/web-socket",
66 | "page/API/pages/upload-file/upload-file",
67 | "page/API/pages/download-file/download-file",
68 |
69 |
70 | "page/API/pages/image/image",
71 | "page/API/pages/voice/voice",
72 | "page/API/pages/file/file",
73 | "page/API/pages/on-accelerometer-change/on-accelerometer-change",
74 | "page/API/pages/canvas/canvas",
75 | "page/API/pages/background-audio/background-audio",
76 | "page/API/pages/video/video",
77 |
78 | "page/API/pages/get-location/get-location",
79 | "page/API/pages/open-location/open-location",
80 | "page/API/pages/choose-location/choose-location",
81 |
82 | "page/API/pages/storage/storage"
83 | ],
84 | "window": {
85 | "navigationBarTextStyle": "black",
86 | "navigationBarTitleText": "演示",
87 | "navigationBarBackgroundColor": "#F8F8F8",
88 | "backgroundColor": "#F8F8F8"
89 | },
90 | "tabBar": {
91 | "color": "#7A7E83",
92 | "selectedColor": "#3cc51f",
93 | "borderStyle": "black",
94 | "backgroundColor": "#ffffff",
95 | "list": [{
96 | "pagePath": "page/component/index",
97 | "iconPath": "image/icon_component.png",
98 | "selectedIconPath": "image/icon_component_HL.png",
99 | "text": "组件"
100 | }, {
101 | "pagePath": "page/API/index",
102 | "iconPath": "image/icon_API.png",
103 | "selectedIconPath": "image/icon_API_HL.png",
104 | "text": "接口"
105 | }]
106 | },
107 | "networkTimeout": {
108 | "request": 10000,
109 | "connectSocket": 10000,
110 | "uploadFile": 10000,
111 | "downloadFile": 10000
112 | },
113 | "debug": false
114 | }
115 |
--------------------------------------------------------------------------------
/page/component/pages/icon/icon.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 成功
11 | 用于表示操作顺利完成
12 |
13 |
14 |
15 |
16 |
17 | 提示
18 | 用于表示信息提示;也常用于缺乏条件的操作拦截,提示用户所需信息
19 |
20 |
21 |
22 |
23 |
24 | 普通警告
25 | 用于表示操作后将引起一定后果的情况;也用于表示由于系统原因而造成的负向结果
26 |
27 |
28 |
29 |
30 |
31 | 强烈警告
32 | 用于表示由于用户原因造成的负向结果;也用于表示操作后将引起不可严重的挽回的后果的情况
33 |
34 |
35 |
36 |
37 |
38 | 等待
39 | 用于表示等待,告知用户结果需等待
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 多选控件图标_已选择
48 | 用于多选控件中,表示已选择该项目
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | 多选控件图标_未选择
57 | 用于多选控件中,表示该项目可被选择,但还未选择
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | 错误提示
66 | 用于在表单中表示出现错误
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | 单选控件图标_已选择
75 | 用于单选控件中,表示已选择该项目
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | 下载
84 | 用于表示可下载
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | 提示
93 | 用于在表单中表示有信息提示
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | 停止或关闭
102 | 用于在表单中,表示关闭或停止
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | 搜索
111 | 用于搜索控件中,表示可搜索
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /* reset */
2 | page {
3 | background-color: #F8F8F8;
4 | height: 100%;
5 | font-size: 32rpx;
6 | line-height: 1.6;
7 | }
8 | checkbox, radio{
9 | margin-right: 10rpx;
10 | }
11 | button{
12 | margin-top: 20rpx;
13 | margin-bottom: 20rpx;
14 | }
15 | form{
16 | width: 100%;
17 | }
18 |
19 | /* lib */
20 | .strong{
21 | font-weight: bold;
22 | }
23 | .tc{
24 | text-align: center;
25 | }
26 |
27 | /* page */
28 | .container {
29 | display: flex;
30 | flex-direction: column;
31 | min-height: 100%;
32 | justify-content: space-between;
33 | font-size: 32rpx;
34 | font-family: -apple-system-font,Helvetica Neue,Helvetica,sans-serif;
35 | }
36 | .page-head{
37 | padding: 60rpx 50rpx 80rpx;
38 | text-align: center;
39 | }
40 | .page-head-title{
41 | display: inline-block;
42 | padding: 0 40rpx 20rpx 40rpx;
43 | font-size: 32rpx;
44 | color: #BEBEBE;
45 | }
46 | .page-head-line{
47 | margin: 0 auto;
48 | width: 150rpx;
49 | height: 2rpx;
50 | background-color: #D8D8D8;
51 | }
52 | .page-head-desc{
53 | padding-top: 20rpx;
54 | color: #9B9B9B;
55 | font-size: 32rpx;
56 | }
57 |
58 | .page-body {
59 | width: 100%;
60 | flex-grow: 1;
61 | overflow-x: hidden;
62 | }
63 | .page-body-wrapper {
64 | display: flex;
65 | flex-direction: column;
66 | align-items: center;
67 | width: 100%;
68 | }
69 | .page-body-wording {
70 | text-align: center;
71 | padding: 200rpx 100rpx;
72 | }
73 | .page-body-info {
74 | display: flex;
75 | flex-direction: column;
76 | align-items: center;
77 | background-color: #fff;
78 | width: 100%;
79 | padding: 50rpx 0 150rpx 0;
80 | }
81 | .page-body-title {
82 | margin-bottom: 100rpx;
83 | font-size: 32rpx;
84 | }
85 | .page-body-text {
86 | font-size: 30rpx;
87 | line-height: 26px;
88 | color: #ccc;
89 | }
90 | .page-body-text-small {
91 | font-size: 24rpx;
92 | color: #000;
93 | margin-bottom: 100rpx;
94 | }
95 |
96 | .page-foot{
97 | margin: 100rpx 0 30rpx 0;
98 | text-align: center;
99 | color: #1aad19;
100 | font-size: 0;
101 | }
102 | .icon-foot{
103 | width: 152rpx;
104 | height: 23rpx;
105 | }
106 |
107 | .page-section{
108 | width: 100%;
109 | margin-bottom: 60rpx;
110 | }
111 | .page-section_center{
112 | display: flex;
113 | flex-direction: column;
114 | align-items: center;
115 | }
116 | .page-section:last-child{
117 | margin-bottom: 0;
118 | }
119 | .page-section-gap{
120 | box-sizing: border-box;
121 | padding: 0 30rpx;
122 | }
123 | .page-section-spacing{
124 | box-sizing: border-box;
125 | padding: 0 80rpx;
126 | }
127 | .page-section-title{
128 | font-size: 28rpx;
129 | color: #999999;
130 | margin-bottom: 10rpx;
131 | padding-left: 30rpx;
132 | padding-right: 30rpx;
133 | }
134 | .page-section-gap .page-section-title{
135 | padding-left: 0;
136 | padding-right: 0;
137 | }
138 | .page-section-ctn{
139 |
140 | }
141 |
142 | /* widget */
143 | .btn-area{
144 | margin-top: 60rpx;
145 | box-sizing: border-box;
146 | width: 100%;
147 | padding: 0 30rpx;
148 | }
149 |
150 | .image-plus {
151 | width: 150rpx;
152 | height: 150rpx;
153 | border: 2rpx solid #D9D9D9;
154 | position: relative;
155 | }
156 | .image-plus-nb{
157 | border: 0;
158 | }
159 | .image-plus-text{
160 | color: #888888;
161 | font-size: 28rpx;
162 | }
163 | .image-plus-horizontal {
164 | position: absolute;
165 | top: 50%;
166 | left: 50%;
167 | background-color: #d9d9d9;
168 | width: 4rpx;
169 | height: 80rpx;
170 | transform: translate(-50%, -50%);
171 | }
172 | .image-plus-vertical {
173 | position: absolute;
174 | top: 50%;
175 | left: 50%;
176 | background-color: #d9d9d9;
177 | width: 80rpx;
178 | height: 4rpx;
179 | transform: translate(-50%, -50%);
180 | }
181 |
182 | .demo-text-1{
183 | position: relative;
184 | align-items: center;
185 | justify-content: center;
186 | background-color: #1AAD19;
187 | color: #FFFFFF;
188 | font-size: 36rpx;
189 | }
190 | .demo-text-1:before{
191 | content: 'A';
192 | position: absolute;
193 | top: 50%;
194 | left: 50%;
195 | transform: translate(-50%, -50%);
196 | }
197 | .demo-text-2{
198 | position: relative;
199 | align-items: center;
200 | justify-content: center;
201 | background-color: #2782D7;
202 | color: #FFFFFF;
203 | font-size: 36rpx;
204 | }
205 | .demo-text-2:before{
206 | content: 'B';
207 | position: absolute;
208 | top: 50%;
209 | left: 50%;
210 | transform: translate(-50%, -50%);
211 | }
212 | .demo-text-3{
213 | position: relative;
214 | align-items: center;
215 | justify-content: center;
216 | background-color: #F1F1F1;
217 | color: #353535;
218 | font-size: 36rpx;
219 | }
220 | .demo-text-3:before{
221 | content: 'C';
222 | position: absolute;
223 | top: 50%;
224 | left: 50%;
225 | transform: translate(-50%, -50%);
226 | }
--------------------------------------------------------------------------------
/page/API/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | list: [
4 | {
5 | id: 'api',
6 | name: '开放接口',
7 | open: false,
8 | pages: [
9 | {
10 | zh: '微信登录',
11 | url: 'login/login'
12 | }, {
13 | zh: '获取用户信息',
14 | url: 'get-user-info/get-user-info'
15 | }, {
16 | zh: '发起支付',
17 | url: 'request-payment/request-payment'
18 | }, {
19 | zh: '分享',
20 | url: 'share/share'
21 | }, {
22 | zh: '客服消息',
23 | url: 'custom-message/custom-message'
24 | }, {
25 | zh: '模板消息',
26 | url: 'template-message/template-message'
27 | }
28 | ]
29 | }, {
30 | id: 'page',
31 | name: '界面',
32 | open: false,
33 | pages: [
34 | {
35 | zh: '设置界面标题',
36 | url: 'set-navigation-bar-title/set-navigation-bar-title'
37 | }, {
38 | zh: '标题栏加载动画',
39 | url: 'navigation-bar-loading/navigation-bar-loading'
40 | }, {
41 | zh: '页面跳转',
42 | url: 'navigator/navigator'
43 | }, {
44 | zh: '下拉刷新',
45 | url: 'pull-down-refresh/pull-down-refresh'
46 | }, {
47 | zh: '创建动画',
48 | url: 'animation/animation'
49 | }, {
50 | zh: '创建绘画',
51 | url: 'canvas/canvas'
52 | }, {
53 | zh: '显示操作菜单',
54 | url: 'action-sheet/action-sheet'
55 | }, {
56 | zh: '显示模态弹窗',
57 | url: 'modal/modal'
58 | }, {
59 | zh: '显示消息提示框',
60 | url: 'toast/toast'
61 | }
62 | ]
63 | }, {
64 | id: 'device',
65 | name: '设备',
66 | open: false,
67 | pages: [
68 | {
69 | zh: '获取手机网络状态',
70 | url: 'get-network-type/get-network-type'
71 | }, {
72 | zh: '获取手机系统信息',
73 | url: 'get-system-info/get-system-info'
74 | }, {
75 | zh: '监听重力感应数据',
76 | url: 'on-accelerometer-change/on-accelerometer-change'
77 | }, {
78 | zh: '监听罗盘数据',
79 | url: 'on-compass-change/on-compass-change'
80 | }, {
81 | zh: '打电话',
82 | url: 'make-phone-call/make-phone-call'
83 | }, {
84 | zh: '扫码',
85 | url: 'scan-code/scan-code'
86 | }
87 | ]
88 | }, {
89 | id: 'network',
90 | name: '网络',
91 | open: false,
92 | pages: [
93 | {
94 | zh: '发起一个请求',
95 | url: 'request/request'
96 | }, {
97 | zh: 'WebSocket',
98 | url: 'web-socket/web-socket'
99 | }, {
100 | zh: '上传文件',
101 | url: 'upload-file/upload-file'
102 | }, {
103 | zh: '下载文件',
104 | url: 'download-file/download-file'
105 | }
106 | ]
107 | }, {
108 | id: 'media',
109 | name: '媒体',
110 | open: false,
111 | pages: [
112 | {
113 | zh: '图片',
114 | url: 'image/image'
115 | }, {
116 | zh: '录音',
117 | url: 'voice/voice'
118 | }, {
119 | zh: '背景音频',
120 | url: 'background-audio/background-audio'
121 | }, {
122 | zh: '文件',
123 | url: 'file/file'
124 | }, {
125 | zh: '视频',
126 | url: 'video/video'
127 | }
128 | ]
129 | }, {
130 | id: 'location',
131 | name: '位置',
132 | open: false,
133 | pages: [
134 | {
135 | zh: '获取当前位置',
136 | url: 'get-location/get-location'
137 | }, {
138 | zh: '使用原生地图查看位置',
139 | url: 'open-location/open-location'
140 | }, {
141 | zh: '使用原生地图选择位置',
142 | url: 'choose-location/choose-location'
143 | }
144 | ]
145 | }, {
146 | id: 'storage',
147 | name: '数据',
148 | url: 'storage/storage'
149 | }
150 | ]
151 | },
152 | kindToggle: function (e) {
153 | var id = e.currentTarget.id, list = this.data.list;
154 | for (var i = 0, len = list.length; i < len; ++i) {
155 | if (list[i].id == id) {
156 | if(list[i].url){
157 | wx.navigateTo({
158 | url: 'pages/' + list[i].url
159 | })
160 | return
161 | }
162 | list[i].open = !list[i].open
163 | } else {
164 | list[i].open = false
165 | }
166 | }
167 | this.setData({
168 | list: list
169 | });
170 | }
171 | })
172 |
--------------------------------------------------------------------------------
/vendor/qcloud-weapp-client-sdk/lib/login.js:
--------------------------------------------------------------------------------
1 | var utils = require('./utils');
2 | var constants = require('./constants');
3 | var Session = require('./session');
4 |
5 | /***
6 | * @class
7 | * 表示登录过程中发生的异常
8 | */
9 | var LoginError = (function () {
10 | function LoginError(type, message) {
11 | Error.call(this, message);
12 | this.type = type;
13 | this.message = message;
14 | }
15 |
16 | LoginError.prototype = new Error();
17 | LoginError.prototype.constructor = LoginError;
18 |
19 | return LoginError;
20 | })();
21 |
22 | /**
23 | * 微信登录,获取 code 和 encryptData
24 | */
25 | var getWxLoginResult = function getLoginCode(callback) {
26 | wx.login({
27 | success: function (loginResult) {
28 | wx.getUserInfo({
29 | success: function (userResult) {
30 | callback(null, {
31 | code: loginResult.code,
32 | encryptedData: userResult.encryptedData,
33 | iv: userResult.iv,
34 | userInfo: userResult.userInfo,
35 | });
36 | },
37 |
38 | fail: function (userError) {
39 | var error = new LoginError(constants.ERR_WX_GET_USER_INFO, '获取微信用户信息失败,请检查网络状态');
40 | error.detail = userError;
41 | callback(error, null);
42 | },
43 | });
44 | },
45 |
46 | fail: function (loginError) {
47 | var error = new LoginError(constants.ERR_WX_LOGIN_FAILED, '微信登录失败,请检查网络状态');
48 | error.detail = loginError;
49 | callback(error, null);
50 | },
51 | });
52 | };
53 |
54 | var noop = function noop() {};
55 | var defaultOptions = {
56 | method: 'GET',
57 | success: noop,
58 | fail: noop,
59 | loginUrl: null,
60 | };
61 |
62 | /**
63 | * @method
64 | * 进行服务器登录,以获得登录会话
65 | *
66 | * @param {Object} options 登录配置
67 | * @param {string} options.loginUrl 登录使用的 URL,服务器应该在这个 URL 上处理登录请求
68 | * @param {string} [options.method] 请求使用的 HTTP 方法,默认为 "GET"
69 | * @param {Function} options.success(userInfo) 登录成功后的回调函数,参数 userInfo 微信用户信息
70 | * @param {Function} options.fail(error) 登录失败后的回调函数,参数 error 错误信息
71 | */
72 | var login = function login(options) {
73 | options = utils.extend({}, defaultOptions, options);
74 |
75 | if (!defaultOptions.loginUrl) {
76 | options.fail(new LoginError(constants.ERR_INVALID_PARAMS, '登录错误:缺少登录地址,请通过 setLoginUrl() 方法设置登录地址'));
77 | return;
78 | }
79 |
80 | var doLogin = () => getWxLoginResult(function (wxLoginError, wxLoginResult) {
81 | if (wxLoginError) {
82 | options.fail(wxLoginError);
83 | return;
84 | }
85 |
86 | var userInfo = wxLoginResult.userInfo;
87 |
88 | // 构造请求头,包含 code、encryptedData 和 iv
89 | var code = wxLoginResult.code;
90 | var encryptedData = wxLoginResult.encryptedData;
91 | var iv = wxLoginResult.iv;
92 | var header = {};
93 |
94 | header[constants.WX_HEADER_CODE] = code;
95 | header[constants.WX_HEADER_ENCRYPTED_DATA] = encryptedData;
96 | header[constants.WX_HEADER_IV] = iv;
97 |
98 | // 请求服务器登录地址,获得会话信息
99 | wx.request({
100 | url: options.loginUrl,
101 | header: header,
102 | method: options.method,
103 | data: options.data,
104 |
105 | success: function (result) {
106 | var data = result.data;
107 |
108 | // 成功地响应会话信息
109 | if (data && data[constants.WX_SESSION_MAGIC_ID]) {
110 | if (data.session) {
111 | data.session.userInfo = userInfo;
112 | Session.set(data.session);
113 | options.success(userInfo);
114 | } else {
115 | var errorMessage = '登录失败(' + data.error + '):' + (data.message || '未知错误');
116 | var noSessionError = new LoginError(constants.ERR_LOGIN_SESSION_NOT_RECEIVED, errorMessage);
117 | options.fail(noSessionError);
118 | }
119 |
120 | // 没有正确响应会话信息
121 | } else {
122 | var errorMessage = '登录请求没有包含会话响应,请确保服务器处理 `' + options.loginUrl + '` 的时候正确使用了 SDK 输出登录结果';
123 | var noSessionError = new LoginError(constants.ERR_LOGIN_SESSION_NOT_RECEIVED, errorMessage);
124 | options.fail(noSessionError);
125 | }
126 | },
127 |
128 | // 响应错误
129 | fail: function (loginResponseError) {
130 | var error = new LoginError(constants.ERR_LOGIN_FAILED, '登录失败,可能是网络错误或者服务器发生异常');
131 | options.fail(error);
132 | },
133 | });
134 | });
135 |
136 | var session = Session.get();
137 | if (session) {
138 | wx.checkSession({
139 | success: function () {
140 | options.success(session.userInfo);
141 | },
142 |
143 | fail: function () {
144 | Session.clear();
145 | doLogin();
146 | },
147 | });
148 | } else {
149 | doLogin();
150 | }
151 | };
152 |
153 | var setLoginUrl = function (loginUrl) {
154 | defaultOptions.loginUrl = loginUrl;
155 | };
156 |
157 | module.exports = {
158 | LoginError: LoginError,
159 | login: login,
160 | setLoginUrl: setLoginUrl,
161 | };
--------------------------------------------------------------------------------