├── .gitignore
├── LICENSE
├── README.md
├── app.js
├── app.json
├── app.wxss
├── config.js
├── functions
└── getOpenId
│ ├── index.js
│ └── package.json
├── image
├── addition_fill.png
├── green_tri.png
├── icon64_appwx_logo.png
├── icon_API.png
├── icon_API_HL.png
├── icon_await_disable.png
├── icon_await_enable.png
├── icon_component.png
├── icon_component_HL.png
├── icon_foot.png
├── icon_love_disable.png
├── icon_love_enable.png
├── location.png
├── pause.png
├── play.png
├── plus.png
├── record.png
├── share.png
├── stop.png
├── trash.png
├── wechat.png
└── wechatHL.png
├── package.json
├── page
├── API
│ ├── components
│ │ └── set-tab-bar
│ │ │ ├── set-tab-bar.js
│ │ │ ├── set-tab-bar.json
│ │ │ ├── set-tab-bar.wxml
│ │ │ └── set-tab-bar.wxss
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ ├── index.wxss
│ ├── pages
│ │ ├── action-sheet
│ │ │ ├── action-sheet.js
│ │ │ ├── action-sheet.json
│ │ │ ├── action-sheet.wxml
│ │ │ └── action-sheet.wxss
│ │ ├── add-contact
│ │ │ ├── add-contact.js
│ │ │ ├── add-contact.json
│ │ │ ├── add-contact.wxml
│ │ │ └── add-contact.wxss
│ │ ├── animation
│ │ │ ├── animation.js
│ │ │ ├── animation.json
│ │ │ ├── animation.wxml
│ │ │ └── animation.wxss
│ │ ├── background-audio
│ │ │ ├── background-audio.js
│ │ │ ├── background-audio.json
│ │ │ ├── background-audio.wxml
│ │ │ └── background-audio.wxss
│ │ ├── bluetooth
│ │ │ ├── bluetooth.js
│ │ │ ├── bluetooth.json
│ │ │ ├── bluetooth.wxml
│ │ │ └── bluetooth.wxss
│ │ ├── canvas
│ │ │ ├── canvas.js
│ │ │ ├── canvas.json
│ │ │ ├── canvas.wxml
│ │ │ ├── canvas.wxss
│ │ │ └── example.js
│ │ ├── capture-screen
│ │ │ ├── capture-screen.js
│ │ │ ├── capture-screen.json
│ │ │ ├── capture-screen.wxml
│ │ │ └── capture-screen.wxss
│ │ ├── choose-address
│ │ │ ├── choose-address.js
│ │ │ ├── choose-address.json
│ │ │ ├── choose-address.wxml
│ │ │ └── choose-address.wxss
│ │ ├── choose-invoice-title
│ │ │ ├── choose-invoice-title.js
│ │ │ ├── choose-invoice-title.json
│ │ │ ├── choose-invoice-title.wxml
│ │ │ └── choose-invoice-title.wxss
│ │ ├── choose-location
│ │ │ ├── choose-location.js
│ │ │ ├── choose-location.json
│ │ │ ├── choose-location.wxml
│ │ │ └── choose-location.wxss
│ │ ├── clipboard-data
│ │ │ ├── clipboard-data.js
│ │ │ ├── clipboard-data.json
│ │ │ ├── clipboard-data.wxml
│ │ │ └── clipboard-data.wxss
│ │ ├── custom-message
│ │ │ ├── custom-message.js
│ │ │ ├── custom-message.json
│ │ │ ├── custom-message.wxml
│ │ │ └── custom-message.wxss
│ │ ├── custom-service
│ │ │ ├── custom-service.js
│ │ │ ├── custom-service.json
│ │ │ ├── custom-service.wxml
│ │ │ └── custom-service.wxss
│ │ ├── download-file
│ │ │ ├── download-file.js
│ │ │ ├── download-file.json
│ │ │ ├── download-file.wxml
│ │ │ └── download-file.wxss
│ │ ├── file
│ │ │ ├── file.js
│ │ │ ├── file.json
│ │ │ ├── file.wxml
│ │ │ └── file.wxss
│ │ ├── get-location
│ │ │ ├── get-location.js
│ │ │ ├── get-location.json
│ │ │ ├── get-location.wxml
│ │ │ └── get-location.wxss
│ │ ├── get-network-type
│ │ │ ├── get-network-type.js
│ │ │ ├── get-network-type.json
│ │ │ ├── get-network-type.wxml
│ │ │ └── get-network-type.wxss
│ │ ├── get-system-info
│ │ │ ├── get-system-info.js
│ │ │ ├── get-system-info.json
│ │ │ ├── get-system-info.wxml
│ │ │ └── get-system-info.wxss
│ │ ├── get-user-info
│ │ │ ├── get-user-info.js
│ │ │ ├── get-user-info.json
│ │ │ ├── get-user-info.wxml
│ │ │ └── get-user-info.wxss
│ │ ├── get-wxml-node-info
│ │ │ ├── get-wxml-node-info.js
│ │ │ ├── get-wxml-node-info.json
│ │ │ ├── get-wxml-node-info.wxml
│ │ │ └── get-wxml-node-info.wxss
│ │ ├── ibeacon
│ │ │ ├── ibeacon.js
│ │ │ ├── ibeacon.json
│ │ │ ├── ibeacon.wxml
│ │ │ └── ibeacon.wxss
│ │ ├── image
│ │ │ ├── image.js
│ │ │ ├── image.json
│ │ │ ├── image.wxml
│ │ │ └── image.wxss
│ │ ├── intersection-observer
│ │ │ ├── intersection-observer.js
│ │ │ ├── intersection-observer.json
│ │ │ ├── intersection-observer.wxml
│ │ │ └── intersection-observer.wxss
│ │ ├── load-font-face
│ │ │ ├── load-font-face.js
│ │ │ ├── load-font-face.json
│ │ │ ├── load-font-face.wxml
│ │ │ └── load-font-face.wxss
│ │ ├── login
│ │ │ ├── login.js
│ │ │ ├── login.json
│ │ │ ├── login.wxml
│ │ │ └── login.wxss
│ │ ├── make-phone-call
│ │ │ ├── make-phone-call.js
│ │ │ ├── make-phone-call.json
│ │ │ ├── make-phone-call.wxml
│ │ │ └── make-phone-call.wxss
│ │ ├── modal
│ │ │ ├── modal.js
│ │ │ ├── modal.json
│ │ │ ├── modal.wxml
│ │ │ └── modal.wxss
│ │ ├── navigation-bar-loading
│ │ │ ├── navigation-bar-loading.js
│ │ │ ├── navigation-bar-loading.json
│ │ │ ├── navigation-bar-loading.wxml
│ │ │ └── navigation-bar-loading.wxss
│ │ ├── navigator
│ │ │ ├── navigator.js
│ │ │ ├── navigator.json
│ │ │ ├── navigator.wxml
│ │ │ └── navigator.wxss
│ │ ├── on-accelerometer-change
│ │ │ ├── on-accelerometer-change.js
│ │ │ ├── on-accelerometer-change.json
│ │ │ ├── on-accelerometer-change.wxml
│ │ │ └── on-accelerometer-change.wxss
│ │ ├── on-compass-change
│ │ │ ├── compass.png
│ │ │ ├── on-compass-change.js
│ │ │ ├── on-compass-change.json
│ │ │ ├── on-compass-change.wxml
│ │ │ └── on-compass-change.wxss
│ │ ├── on-network-status-change
│ │ │ ├── on-network-status-change.js
│ │ │ ├── on-network-status-change.json
│ │ │ ├── on-network-status-change.wxml
│ │ │ └── on-network-status-change.wxss
│ │ ├── open-location
│ │ │ ├── open-location.js
│ │ │ ├── open-location.json
│ │ │ ├── open-location.wxml
│ │ │ └── open-location.wxss
│ │ ├── page-scroll
│ │ │ ├── page-scroll.js
│ │ │ ├── page-scroll.json
│ │ │ ├── page-scroll.wxml
│ │ │ └── page-scroll.wxss
│ │ ├── pull-down-refresh
│ │ │ ├── pull-down-refresh.js
│ │ │ ├── pull-down-refresh.json
│ │ │ ├── pull-down-refresh.wxml
│ │ │ └── pull-down-refresh.wxss
│ │ ├── request-payment
│ │ │ ├── request-payment.js
│ │ │ ├── request-payment.json
│ │ │ ├── request-payment.wxml
│ │ │ └── request-payment.wxss
│ │ ├── request
│ │ │ ├── request.js
│ │ │ ├── request.json
│ │ │ ├── request.wxml
│ │ │ └── request.wxss
│ │ ├── scan-code
│ │ │ ├── scan-code.js
│ │ │ ├── scan-code.json
│ │ │ ├── scan-code.wxml
│ │ │ └── scan-code.wxss
│ │ ├── screen-brightness
│ │ │ ├── screen-brightness.js
│ │ │ ├── screen-brightness.json
│ │ │ ├── screen-brightness.wxml
│ │ │ └── screen-brightness.wxss
│ │ ├── sendMessage
│ │ │ ├── sendMessage.js
│ │ │ ├── sendMessage.json
│ │ │ ├── sendMessage.wxml
│ │ │ └── sendMessage.wxss
│ │ ├── set-navigation-bar-title
│ │ │ ├── set-navigation-bar-title.js
│ │ │ ├── set-navigation-bar-title.json
│ │ │ ├── set-navigation-bar-title.wxml
│ │ │ └── set-navigation-bar-title.wxss
│ │ ├── setting
│ │ │ ├── setting.js
│ │ │ ├── setting.json
│ │ │ ├── setting.wxml
│ │ │ └── setting.wxss
│ │ ├── share-button
│ │ │ ├── share-button.js
│ │ │ ├── share-button.json
│ │ │ ├── share-button.wxml
│ │ │ └── share-button.wxss
│ │ ├── share
│ │ │ ├── share.js
│ │ │ ├── share.json
│ │ │ ├── share.wxml
│ │ │ └── share.wxss
│ │ ├── soter-authentication
│ │ │ ├── soter-authentication.js
│ │ │ ├── soter-authentication.json
│ │ │ ├── soter-authentication.wxml
│ │ │ └── soter-authentication.wxss
│ │ ├── storage
│ │ │ ├── storage.js
│ │ │ ├── storage.json
│ │ │ ├── storage.wxml
│ │ │ └── storage.wxss
│ │ ├── subscribe-message
│ │ │ ├── subscribe-message.js
│ │ │ ├── subscribe-message.json
│ │ │ ├── subscribe-message.wxml
│ │ │ └── subscribe-message.wxss
│ │ ├── template-message
│ │ │ ├── template-message.js
│ │ │ ├── template-message.json
│ │ │ ├── template-message.wxml
│ │ │ └── template-message.wxss
│ │ ├── toast
│ │ │ ├── toast.js
│ │ │ ├── toast.json
│ │ │ ├── toast.wxml
│ │ │ └── toast.wxss
│ │ ├── upload-file
│ │ │ ├── upload-file.js
│ │ │ ├── upload-file.json
│ │ │ ├── upload-file.wxml
│ │ │ └── upload-file.wxss
│ │ ├── vibrate
│ │ │ ├── vibrate.js
│ │ │ ├── vibrate.json
│ │ │ ├── vibrate.wxml
│ │ │ └── vibrate.wxss
│ │ ├── video
│ │ │ ├── video.js
│ │ │ ├── video.json
│ │ │ ├── video.wxml
│ │ │ └── video.wxss
│ │ ├── voice
│ │ │ ├── voice.js
│ │ │ ├── voice.json
│ │ │ ├── voice.wxml
│ │ │ └── voice.wxss
│ │ ├── web-socket
│ │ │ ├── web-socket.js
│ │ │ ├── web-socket.json
│ │ │ ├── web-socket.wxml
│ │ │ └── web-socket.wxss
│ │ ├── wifi
│ │ │ ├── wifi.js
│ │ │ ├── wifi.json
│ │ │ ├── wifi.wxml
│ │ │ └── wifi.wxss
│ │ └── worker
│ │ │ ├── worker.js
│ │ │ ├── worker.json
│ │ │ ├── worker.wxml
│ │ │ └── worker.wxss
│ └── resources
│ │ └── kind
│ │ ├── api.png
│ │ ├── device.png
│ │ ├── feedback.png
│ │ ├── location.png
│ │ ├── logo.png
│ │ ├── media.png
│ │ ├── network.png
│ │ ├── page.png
│ │ ├── storage.png
│ │ └── worker.png
├── await
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── common
│ ├── foot.wxml
│ ├── head.wxml
│ ├── index.wxss
│ └── lib
│ │ └── weui.wxss
├── component
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ ├── index.wxss
│ ├── pages
│ │ ├── ad
│ │ │ ├── ad.js
│ │ │ ├── ad.json
│ │ │ ├── ad.wxml
│ │ │ └── ad.wxss
│ │ ├── audio
│ │ │ ├── audio.js
│ │ │ ├── audio.json
│ │ │ ├── audio.wxml
│ │ │ └── audio.wxss
│ │ ├── button
│ │ │ ├── button.js
│ │ │ ├── button.json
│ │ │ ├── button.wxml
│ │ │ └── button.wxss
│ │ ├── camera-scan-code
│ │ │ ├── camera-scan-code.js
│ │ │ ├── camera-scan-code.json
│ │ │ ├── camera-scan-code.wxml
│ │ │ └── camera-scan-code.wxss
│ │ ├── camera
│ │ │ ├── camera.js
│ │ │ ├── camera.json
│ │ │ ├── camera.wxml
│ │ │ └── camera.wxss
│ │ ├── canvas
│ │ │ ├── canvas.js
│ │ │ ├── canvas.json
│ │ │ ├── canvas.wxml
│ │ │ └── canvas.wxss
│ │ ├── checkbox
│ │ │ ├── checkbox.js
│ │ │ ├── checkbox.json
│ │ │ ├── checkbox.wxml
│ │ │ └── checkbox.wxss
│ │ ├── cover-view
│ │ │ ├── cover-view.js
│ │ │ ├── cover-view.json
│ │ │ ├── cover-view.wxml
│ │ │ └── cover-view.wxss
│ │ ├── form
│ │ │ ├── form.js
│ │ │ ├── form.json
│ │ │ ├── form.wxml
│ │ │ └── form.wxss
│ │ ├── icon
│ │ │ ├── icon.js
│ │ │ ├── icon.json
│ │ │ ├── icon.wxml
│ │ │ └── icon.wxss
│ │ ├── image
│ │ │ ├── image.js
│ │ │ ├── image.json
│ │ │ ├── image.wxml
│ │ │ └── image.wxss
│ │ ├── input
│ │ │ ├── input.js
│ │ │ ├── input.json
│ │ │ ├── input.wxml
│ │ │ └── input.wxss
│ │ ├── label
│ │ │ ├── label.js
│ │ │ ├── label.json
│ │ │ ├── label.wxml
│ │ │ └── label.wxss
│ │ ├── map-styles
│ │ │ ├── map-styles.js
│ │ │ ├── map-styles.json
│ │ │ ├── map-styles.wxml
│ │ │ └── map-styles.wxss
│ │ ├── map
│ │ │ ├── map.js
│ │ │ ├── map.json
│ │ │ ├── map.wxml
│ │ │ └── map.wxss
│ │ ├── movable-view
│ │ │ ├── movable-view.js
│ │ │ ├── movable-view.json
│ │ │ ├── movable-view.wxml
│ │ │ └── movable-view.wxss
│ │ ├── navigator
│ │ │ ├── navigate.js
│ │ │ ├── navigate.json
│ │ │ ├── navigate.wxml
│ │ │ ├── navigate.wxss
│ │ │ ├── navigator.js
│ │ │ ├── navigator.json
│ │ │ ├── navigator.wxml
│ │ │ ├── navigator.wxss
│ │ │ ├── redirect.js
│ │ │ ├── redirect.json
│ │ │ ├── redirect.wxml
│ │ │ └── redirect.wxss
│ │ ├── open-data
│ │ │ ├── open-data.js
│ │ │ ├── open-data.json
│ │ │ ├── open-data.wxml
│ │ │ └── open-data.wxss
│ │ ├── picker-view
│ │ │ ├── picker-view.js
│ │ │ ├── picker-view.json
│ │ │ ├── picker-view.wxml
│ │ │ └── picker-view.wxss
│ │ ├── picker
│ │ │ ├── picker.js
│ │ │ ├── picker.json
│ │ │ ├── picker.wxml
│ │ │ └── picker.wxss
│ │ ├── progress
│ │ │ ├── progress.js
│ │ │ ├── progress.json
│ │ │ ├── progress.wxml
│ │ │ └── progress.wxss
│ │ ├── radio
│ │ │ ├── radio.js
│ │ │ ├── radio.json
│ │ │ ├── radio.wxml
│ │ │ └── radio.wxss
│ │ ├── rich-text
│ │ │ ├── rich-text.js
│ │ │ ├── rich-text.json
│ │ │ ├── rich-text.wxml
│ │ │ └── rich-text.wxss
│ │ ├── scroll-view
│ │ │ ├── scroll-view.js
│ │ │ ├── scroll-view.json
│ │ │ ├── scroll-view.wxml
│ │ │ └── scroll-view.wxss
│ │ ├── slider
│ │ │ ├── slider.js
│ │ │ ├── slider.json
│ │ │ ├── slider.wxml
│ │ │ └── slider.wxss
│ │ ├── swiper
│ │ │ ├── swiper.js
│ │ │ ├── swiper.json
│ │ │ ├── swiper.wxml
│ │ │ └── swiper.wxss
│ │ ├── switch
│ │ │ ├── switch.js
│ │ │ ├── switch.json
│ │ │ ├── switch.wxml
│ │ │ └── switch.wxss
│ │ ├── text
│ │ │ ├── text.js
│ │ │ ├── text.json
│ │ │ ├── text.wxml
│ │ │ └── text.wxss
│ │ ├── textarea
│ │ │ ├── textarea.js
│ │ │ ├── textarea.json
│ │ │ ├── textarea.wxml
│ │ │ └── textarea.wxss
│ │ ├── video
│ │ │ ├── video.js
│ │ │ ├── video.json
│ │ │ ├── video.wxml
│ │ │ └── video.wxss
│ │ ├── view
│ │ │ ├── view.js
│ │ │ ├── view.json
│ │ │ ├── view.wxml
│ │ │ └── view.wxss
│ │ └── web-view
│ │ │ ├── web-view.js
│ │ │ ├── web-view.json
│ │ │ ├── web-view.wxml
│ │ │ └── web-view.wxss
│ └── resources
│ │ ├── kind
│ │ ├── canvas.png
│ │ ├── content.png
│ │ ├── daytime.png
│ │ ├── form.png
│ │ ├── logo.png
│ │ ├── map.png
│ │ ├── media.png
│ │ ├── nav.png
│ │ ├── night.png
│ │ ├── open.png
│ │ └── view.png
│ │ └── pic
│ │ ├── 1.jpg
│ │ ├── 2.jpg
│ │ ├── custom_map_template_1.png
│ │ ├── custom_map_template_2.png
│ │ ├── custom_map_template_3.png
│ │ └── custom_map_template_4.png
├── memory
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── postList
│ ├── postlist.js
│ ├── postlist.json
│ ├── postlist.wxml
│ └── postlist.wxss
└── postSend
│ ├── postsend.js
│ ├── postsend.json
│ ├── postsend.wxml
│ └── postsend.wxss
├── project.config.json
├── util
└── util.js
└── workers
└── fib
└── index.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows
2 | [Dd]esktop.ini
3 | Thumbs.db
4 | $RECYCLE.BIN/
5 |
6 | # macOS
7 | .DS_Store
8 | .fseventsd
9 | .Spotlight-V100
10 | .TemporaryItems
11 | .Trashes
12 |
13 | # Node.js
14 | node_modules/
15 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 wechat-miniprogram
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | const openIdUrl = require('./config').openIdUrl
2 |
3 | App({
4 | onLaunch(opts) {
5 | console.log('App Launch', opts)
6 |
7 | wx.cloud.init({
8 | // env: 'dev-wx-xxxx',
9 | env: 'online-xxxx',
10 | traceUser:true
11 | })
12 | },
13 | onShow(opts) {
14 | console.log('App Show', opts)
15 | },
16 | onHide() {
17 | console.log('App Hide')
18 | },
19 | globalData: {
20 | hasLogin: false,
21 | openid: null
22 | },
23 | // lazy loading openid
24 | getUserOpenId(callback) {
25 | const self = this
26 |
27 | if (self.globalData.openid) {
28 | callback(null, self.globalData.openid)
29 | } else {
30 | wx.login({
31 | success(data) {
32 | wx.request({
33 | url: openIdUrl,
34 | data: {
35 | code: data.code
36 | },
37 | success(res) {
38 | console.log('拉取openid成功', res)
39 | self.globalData.openid = res.data.openid
40 | callback(null, self.globalData.openid)
41 | },
42 | fail(res) {
43 | console.log('拉取用户openid失败,将无法正常使用开放接口等服务', res)
44 | callback(res)
45 | }
46 | })
47 | },
48 | fail(err) {
49 | console.log('wx.login 接口调用失败,将无法正常使用开放接口等服务', err)
50 | callback(err)
51 | }
52 | })
53 | }
54 | }
55 | })
56 |
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 小程序配置文件
3 | */
4 |
5 | // 此处主机域名是腾讯云解决方案分配的域名
6 | // 小程序后台服务解决方案:https://www.qcloud.com/solution/la
7 | const host = 'xxxxxxxxxxxxxx'
8 |
9 | const config = {
10 |
11 | // 下面的地址配合云端 Server 工作
12 | host,
13 |
14 | // 登录地址,用于建立会话
15 | loginUrl: `https://${host}/login`,
16 |
17 | // 测试的请求地址,用于测试会话
18 | requestUrl: `https://${host}/testRequest`,
19 |
20 | // 用code换取openId
21 | openIdUrl: `https://${host}/openid`,
22 |
23 | // 测试的信道服务接口
24 | tunnelUrl: `https://${host}/tunnel`,
25 |
26 | // 生成支付订单的接口
27 | paymentUrl: `https://${host}/payment`,
28 |
29 | // 发送模板消息接口
30 | templateMessageUrl: `https://${host}/templateMessage`,
31 |
32 | // 发送订阅消息接口
33 | subscribeMessageUrl: `https://${host}/subscribeMessage`,
34 |
35 | // 上传文件接口
36 | uploadFileUrl: `https://${host}/upload`,
37 |
38 | // 下载示例图片接口
39 | downloadExampleUrl: `https://${host}/static/weapp.jpg`
40 | }
41 |
42 | module.exports = config
43 |
--------------------------------------------------------------------------------
/functions/getOpenId/index.js:
--------------------------------------------------------------------------------
1 | // 云函数入口文件
2 | const cloud = require('wx-server-sdk')
3 |
4 | cloud.init()
5 |
6 | // 云函数入口函数
7 | exports.main = async (event, context) => {
8 | const wxContext = cloud.getWXContext()
9 |
10 | return {
11 | event,
12 | openid: wxContext.OPENID,
13 | appid: wxContext.APPID,
14 | unionid: wxContext.UNIONID,
15 | }
16 | }
--------------------------------------------------------------------------------
/functions/getOpenId/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "getOpenId",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "wx-server-sdk": "latest"
13 | }
14 | }
--------------------------------------------------------------------------------
/image/addition_fill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/addition_fill.png
--------------------------------------------------------------------------------
/image/green_tri.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/green_tri.png
--------------------------------------------------------------------------------
/image/icon64_appwx_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/icon64_appwx_logo.png
--------------------------------------------------------------------------------
/image/icon_API.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/icon_API.png
--------------------------------------------------------------------------------
/image/icon_API_HL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/icon_API_HL.png
--------------------------------------------------------------------------------
/image/icon_await_disable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/icon_await_disable.png
--------------------------------------------------------------------------------
/image/icon_await_enable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/icon_await_enable.png
--------------------------------------------------------------------------------
/image/icon_component.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/icon_component.png
--------------------------------------------------------------------------------
/image/icon_component_HL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/icon_component_HL.png
--------------------------------------------------------------------------------
/image/icon_foot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/icon_foot.png
--------------------------------------------------------------------------------
/image/icon_love_disable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/icon_love_disable.png
--------------------------------------------------------------------------------
/image/icon_love_enable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/icon_love_enable.png
--------------------------------------------------------------------------------
/image/location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/location.png
--------------------------------------------------------------------------------
/image/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/pause.png
--------------------------------------------------------------------------------
/image/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/play.png
--------------------------------------------------------------------------------
/image/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/plus.png
--------------------------------------------------------------------------------
/image/record.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/record.png
--------------------------------------------------------------------------------
/image/share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/share.png
--------------------------------------------------------------------------------
/image/stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/stop.png
--------------------------------------------------------------------------------
/image/trash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/trash.png
--------------------------------------------------------------------------------
/image/wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/wechat.png
--------------------------------------------------------------------------------
/image/wechatHL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/image/wechatHL.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "miniprogram-demo",
3 | "version": "2.3.1",
4 | "description": "WeChat miniprogram demo",
5 | "scripts": {
6 | "lint": "eslint ."
7 | },
8 | "repository": {
9 | "type": "git",
10 | "url": "git+https://github.com/wechat-miniprogram/miniprogram-demo.git"
11 | },
12 | "author": "wechat-miniprogram",
13 | "license": "MIT",
14 | "bugs": {
15 | "url": "https://github.com/wechat-miniprogram/miniprogram-demo/issues"
16 | },
17 | "homepage": "https://github.com/wechat-miniprogram/miniprogram-demo#readme",
18 | "devDependencies": {
19 | "eslint": "^5.5.0",
20 | "eslint-config-airbnb-base": "13.1.0",
21 | "eslint-plugin-import": "^2.14.0",
22 | "eslint-plugin-node": "^7.0.1",
23 | "eslint-plugin-promise": "^4.0.0"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/page/API/components/set-tab-bar/set-tab-bar.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/page/API/components/set-tab-bar/set-tab-bar.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
12 |
15 |
18 |
21 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/page/API/components/set-tab-bar/set-tab-bar.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 | @import "../../../../app.wxss";
3 |
4 | .weui-label {
5 | width: 5em;
6 | }
7 |
--------------------------------------------------------------------------------
/page/API/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "小程序接口能力展示",
3 | "usingComponents": {
4 | "set-tab-bar": "components/set-tab-bar/set-tab-bar"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/page/API/index.wxss:
--------------------------------------------------------------------------------
1 | @import "../common/index.wxss";
--------------------------------------------------------------------------------
/page/API/pages/action-sheet/action-sheet.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '操作菜单',
5 | path: 'page/API/pages/action-sheet/action-sheet'
6 | }
7 | },
8 |
9 | actionSheetTap() {
10 | wx.showActionSheet({
11 | itemList: ['item1', 'item2', 'item3', 'item4'],
12 | success(e) {
13 | console.log(e.tapIndex)
14 | }
15 | })
16 | }
17 | })
18 |
--------------------------------------------------------------------------------
/page/API/pages/action-sheet/action-sheet.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "操作菜单"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/API/pages/add-contact/add-contact.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '新增联系人',
5 | path: 'page/API/pages/add-contact/add-contact'
6 | }
7 | },
8 |
9 | submit(e) {
10 | const formData = e.detail.value
11 | wx.addPhoneContact({
12 | ...formData,
13 | success() {
14 | wx.showToast({
15 | title: '联系人创建成功'
16 | })
17 | },
18 | fail() {
19 | wx.showToast({
20 | title: '联系人创建失败'
21 | })
22 | }
23 | })
24 | }
25 | })
26 |
--------------------------------------------------------------------------------
/page/API/pages/add-contact/add-contact.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "新增联系人"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/add-contact/add-contact.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | input {
4 | width: 100%;
5 | }
6 |
--------------------------------------------------------------------------------
/page/API/pages/animation/animation.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "动画"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/background-audio/background-audio.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "背景音乐"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/page/API/pages/bluetooth/bluetooth.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "蓝牙"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/bluetooth/bluetooth.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | color: #333;
3 | }
4 | .devices_summary {
5 | padding: 10rpx;
6 | font-size: 30rpx;
7 | }
8 | .device_list {
9 | height: 300rpx;
10 | border-radius: 5rpx;
11 | flex: 1;
12 | }
13 | .device_item {
14 | border-bottom: 1rpx solid #EEE;
15 | padding: 10rpx;
16 | color: #666;
17 | }
18 | .device_item_hover {
19 | background-color: rgba(0, 0, 0, .1);
20 | }
21 | .connected_info {
22 | position: fixed;
23 | bottom: 0;
24 | width: 100%;
25 | background-color: #F0F0F0;
26 | padding: 10rpx;
27 | padding-bottom: 20rpx;
28 | margin-bottom: env(safe-area-inset-bottom);
29 | font-size: 28rpx;
30 | min-height: 100rpx;
31 | box-shadow: 0rpx 0rpx 3rpx 0rpx;
32 | }
33 | .connected_info .operation {
34 | position: absolute;
35 | display: inline-block;
36 | right: 30rpx;
37 | }
38 | .page-body-info {
39 | padding: 30rpx;
40 | box-sizing: border-box;
41 | }
42 |
--------------------------------------------------------------------------------
/page/API/pages/canvas/canvas.js:
--------------------------------------------------------------------------------
1 | const example = require('./example.js')
2 |
3 | Page({
4 | onShareAppMessage() {
5 | return {
6 | title: '创建画布',
7 | path: 'page/API/pages/canvas/canvas'
8 | }
9 | },
10 |
11 | onLoad() {
12 | this.context = wx.createContext()
13 |
14 | const methods = Object.keys(example)
15 | this.setData({
16 | methods
17 | })
18 |
19 | const that = this
20 | methods.forEach(function (method) {
21 | that[method] = function () {
22 | example[method](that.context)
23 | const actions = that.context.getActions()
24 |
25 | wx.drawCanvas({
26 | canvasId: 'canvas',
27 | actions
28 | })
29 | }
30 | })
31 | },
32 |
33 | toTempFilePath() {
34 | wx.canvasToTempFilePath({
35 | canvasId: 'canvas',
36 | success(res) {
37 | console.log(res)
38 | },
39 |
40 | fail(res) {
41 | console.log(res)
42 | }
43 | })
44 | }
45 | })
46 |
--------------------------------------------------------------------------------
/page/API/pages/canvas/canvas.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "创建画布"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/capture-screen/capture-screen.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '用户截屏事件',
5 | path: 'page/API/pages/capture-screen/capture-screen'
6 | }
7 | },
8 |
9 | data: {
10 | captured: false,
11 | },
12 | onLoad() {
13 | wx.onUserCaptureScreen(() => {
14 | this.setData({
15 | captured: true
16 | })
17 | })
18 | }
19 | })
20 |
--------------------------------------------------------------------------------
/page/API/pages/capture-screen/capture-screen.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "用户截屏事件"
3 | }
--------------------------------------------------------------------------------
/page/API/pages/capture-screen/capture-screen.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 请进行屏幕截屏
10 | 截屏事件{{ captured ? "已" : "未" }}触发
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/page/API/pages/capture-screen/capture-screen.wxss:
--------------------------------------------------------------------------------
1 | .page-body-text {
2 | font-size: 40rpx;
3 | font-family: -apple-system-font, Helvetica Neue,Helvetica,sans-serif;
4 | }
5 |
--------------------------------------------------------------------------------
/page/API/pages/choose-address/choose-address.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '收货地址',
5 | path: 'page/API/pages/choose-address/choose-address'
6 | }
7 | },
8 |
9 | data: {
10 | addressInfo: null
11 | },
12 | chooseAddress() {
13 | wx.chooseAddress({
14 | success: (res) => {
15 | this.setData({
16 | addressInfo: res
17 | })
18 | },
19 | fail(err) {
20 | console.log(err)
21 | }
22 | })
23 | }
24 | })
25 |
--------------------------------------------------------------------------------
/page/API/pages/choose-address/choose-address.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "收货地址"
3 | }
--------------------------------------------------------------------------------
/page/API/pages/choose-address/choose-address.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | form {
4 | margin-top: 30rpx;
5 | }
6 |
7 | .weui-cell__bd {
8 | display: flex;
9 | justify-content: flex-start;
10 | align-items: center;
11 | padding: 20rpx 0;
12 | min-height: 60rpx;
13 | }
--------------------------------------------------------------------------------
/page/API/pages/choose-invoice-title/choose-invoice-title.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '获取发票抬头',
5 | path: 'page/API/pages/choose-invoice-title/choose-invoice-title'
6 | }
7 | },
8 |
9 | data: {
10 | type: '',
11 | title: '',
12 | taxNumber: '',
13 | companyAddress: '',
14 | telephone: '',
15 | bankName: '',
16 | bankAccount: '',
17 | },
18 | chooseInvoiceTitle() {
19 | wx.chooseInvoiceTitle({
20 | success: (res) => {
21 | this.setData({
22 | type: res.type,
23 | title: res.title,
24 | taxNumber: res.taxNumber,
25 | companyAddress: res.companyAddress,
26 | telephone: res.telephone,
27 | bankName: res.bankName,
28 | bankAccount: res.bankAccount
29 | })
30 | },
31 | fail: (err) => {
32 | console.error(err)
33 | }
34 | })
35 | }
36 | })
37 |
--------------------------------------------------------------------------------
/page/API/pages/choose-invoice-title/choose-invoice-title.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "获取发票抬头"
3 | }
--------------------------------------------------------------------------------
/page/API/pages/choose-invoice-title/choose-invoice-title.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | form {
4 | margin-top: 30rpx;
5 | }
6 |
7 | .weui-cell__bd {
8 | display: flex;
9 | justify-content: flex-start;
10 | padding: 20rpx 0;
11 | min-height: 60rpx;
12 | align-items: center;
13 | }
--------------------------------------------------------------------------------
/page/API/pages/choose-location/choose-location.js:
--------------------------------------------------------------------------------
1 | const util = require('../../../../util/util.js')
2 |
3 | const formatLocation = util.formatLocation
4 |
5 | Page({
6 | onShareAppMessage() {
7 | return {
8 | title: '使用原生地图选择位置',
9 | path: 'page/API/pages/choose-location/choose-location'
10 | }
11 | },
12 |
13 | data: {
14 | hasLocation: false,
15 | },
16 | chooseLocation() {
17 | const that = this
18 | wx.chooseLocation({
19 | success(res) {
20 | console.log(res)
21 | that.setData({
22 | hasLocation: true,
23 | location: formatLocation(res.longitude, res.latitude),
24 | locationAddress: res.address
25 | })
26 | }
27 | })
28 | },
29 | clear() {
30 | this.setData({
31 | hasLocation: false
32 | })
33 | }
34 | })
35 |
--------------------------------------------------------------------------------
/page/API/pages/choose-location/choose-location.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "使用原生地图选择位置"
3 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/page/API/pages/choose-location/choose-location.wxss:
--------------------------------------------------------------------------------
1 | .page-body-info{
2 | padding-bottom: 0;
3 | height: 440rpx;
4 | }
--------------------------------------------------------------------------------
/page/API/pages/clipboard-data/clipboard-data.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '剪切板',
5 | path: 'page/API/pages/clipboard-data/clipboard-data'
6 | }
7 | },
8 |
9 | data: {
10 | value: 'edit and copy me',
11 | pasted: '',
12 | },
13 |
14 | valueChanged(e) {
15 | this.setData({
16 | value: e.detail.value
17 | })
18 | },
19 |
20 | copy() {
21 | wx.setClipboardData({
22 | data: this.data.value,
23 | success() {
24 | wx.showToast({
25 | title: '复制成功',
26 | icon: 'success',
27 | duration: 1000
28 | })
29 | }
30 | })
31 | },
32 |
33 | paste() {
34 | const self = this
35 | wx.getClipboardData({
36 | success(res) {
37 | self.setData({
38 | pasted: res.data
39 | })
40 | wx.showToast({
41 | title: '粘贴成功',
42 | icon: 'success',
43 | duration: 1000
44 | })
45 | }
46 | })
47 | }
48 | })
49 |
--------------------------------------------------------------------------------
/page/API/pages/clipboard-data/clipboard-data.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "剪切板"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/clipboard-data/clipboard-data.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Copy
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Paste
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/page/API/pages/clipboard-data/clipboard-data.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .page-body-info {
4 | padding: 10rpx;
5 | height: 200rpx;
6 | overflow: scroll-y;
7 | text-align: left;
8 | }
9 |
--------------------------------------------------------------------------------
/page/API/pages/custom-message/custom-message.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '客服消息',
5 | path: 'page/API/pages/custom-message/custom-message'
6 | }
7 | },
8 | })
9 |
--------------------------------------------------------------------------------
/page/API/pages/custom-message/custom-message.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "客服消息"
3 | }
4 |
--------------------------------------------------------------------------------
/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/API/pages/custom-message/custom-message.wxss:
--------------------------------------------------------------------------------
1 | /* page/API/pages/custom-message/custom-message.wxss */
--------------------------------------------------------------------------------
/page/API/pages/custom-service/custom-service.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/page/API/pages/custom-service/custom-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "客服消息"
3 | }
4 |
--------------------------------------------------------------------------------
/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/custom-service/custom-service.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/pages/custom-service/custom-service.wxss
--------------------------------------------------------------------------------
/page/API/pages/download-file/download-file.js:
--------------------------------------------------------------------------------
1 | const downloadExampleUrl = require('../../../../config').downloadExampleUrl
2 |
3 | Page({
4 | onShareAppMessage() {
5 | return {
6 | title: '下载文件',
7 | path: 'page/API/pages/download-file/download-file'
8 | }
9 | },
10 |
11 | downloadImage() {
12 | const self = this
13 |
14 | wx.downloadFile({
15 | url: downloadExampleUrl,
16 | success(res) {
17 | console.log('downloadFile success, res is', res)
18 |
19 | self.setData({
20 | imageSrc: res.tempFilePath
21 | })
22 | },
23 | fail({errMsg}) {
24 | console.log('downloadFile fail, err is:', errMsg)
25 | }
26 | })
27 | }
28 | })
29 |
--------------------------------------------------------------------------------
/page/API/pages/download-file/download-file.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "下载文件"
3 | }
4 |
--------------------------------------------------------------------------------
/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/download-file/download-file.wxss:
--------------------------------------------------------------------------------
1 | .page-body image {
2 | width: 600rpx;
3 | height: 600rpx;
4 |
5 | margin: 0 75rpx;
6 | }
--------------------------------------------------------------------------------
/page/API/pages/file/file.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "文件"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/get-location/get-location.js:
--------------------------------------------------------------------------------
1 | const util = require('../../../../util/util.js')
2 |
3 | const formatLocation = util.formatLocation
4 |
5 | Page({
6 | onShareAppMessage() {
7 | return {
8 | title: '获取位置',
9 | path: 'page/API/pages/get-location/get-location'
10 | }
11 | },
12 |
13 | data: {
14 | hasLocation: false,
15 | },
16 | getLocation() {
17 | const that = this
18 | wx.getLocation({
19 | success(res) {
20 | console.log(res)
21 | that.setData({
22 | hasLocation: true,
23 | location: formatLocation(res.longitude, res.latitude)
24 | })
25 | }
26 | })
27 | },
28 | clear() {
29 | this.setData({
30 | hasLocation: false
31 | })
32 | }
33 | })
34 |
--------------------------------------------------------------------------------
/page/API/pages/get-location/get-location.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "获取位置"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/get-network-type/get-network-type.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '获取手机网络状态',
5 | path: 'page/API/pages/get-network-type/get-network-type'
6 | }
7 | },
8 |
9 | data: {
10 | hasNetworkType: false
11 | },
12 | getNetworkType() {
13 | const that = this
14 | wx.getNetworkType({
15 | success(res) {
16 | console.log(res)
17 | that.setData({
18 | hasNetworkType: true,
19 | networkType: res.subtype || res.networkType
20 | })
21 | }
22 | })
23 | },
24 | clear() {
25 | this.setData({
26 | hasNetworkType: false,
27 | networkType: ''
28 | })
29 | }
30 | })
31 |
--------------------------------------------------------------------------------
/page/API/pages/get-network-type/get-network-type.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "获取手机网络状态"
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/API/pages/get-system-info/get-system-info.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '获取手机系统信息',
5 | path: 'page/API/pages/get-system-info/get-system-info'
6 | }
7 | },
8 |
9 | data: {
10 | systemInfo: {}
11 | },
12 | getSystemInfo() {
13 | const that = this
14 | wx.getSystemInfo({
15 | success(res) {
16 | that.setData({
17 | systemInfo: res
18 | })
19 | }
20 | })
21 | }
22 | })
23 |
--------------------------------------------------------------------------------
/page/API/pages/get-system-info/get-system-info.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/get-user-info/get-user-info.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '获取用户信息',
5 | path: 'page/API/pages/get-user-info/get-user-info'
6 | }
7 | },
8 |
9 | data: {
10 | hasUserInfo: false
11 | },
12 | getUserInfo(info) {
13 | const userInfo = info.detail.userInfo
14 | this.setData({
15 | userInfo,
16 | hasUserInfo: true
17 | })
18 | },
19 | clear() {
20 | this.setData({
21 | hasUserInfo: false,
22 | userInfo: {}
23 | })
24 | }
25 | })
26 |
--------------------------------------------------------------------------------
/page/API/pages/get-user-info/get-user-info.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "获取用户信息"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/get-wxml-node-info/get-wxml-node-info.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '获取WXML节点信息',
5 | path: 'page/API/pages/get-wxml-node-info/get-wxml-node-info'
6 | }
7 | },
8 |
9 | data: {
10 | metrics: []
11 | },
12 |
13 | onReady() {
14 | this.getNodeInfo()
15 | },
16 |
17 | getNodeInfo() {
18 | const $ = wx.createSelectorQuery()
19 | const target = $.select('.target')
20 | target.boundingClientRect()
21 |
22 | $.exec((res) => {
23 | const rect = res[0]
24 | if (rect) {
25 | const metrics = []
26 | // eslint-disable-next-line
27 | for (const key in rect) {
28 | if (key !== 'id' && key !== 'dataset') {
29 | const val = rect[key]
30 | metrics.push({key, val})
31 | }
32 | }
33 |
34 | this.setData({metrics})
35 | }
36 | })
37 | }
38 |
39 | })
40 |
--------------------------------------------------------------------------------
/page/API/pages/get-wxml-node-info/get-wxml-node-info.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "获取WXML节点信息"
3 | }
--------------------------------------------------------------------------------
/page/API/pages/get-wxml-node-info/get-wxml-node-info.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Drag
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | {{ item.key }}
20 | {{ item.val }}
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/page/API/pages/get-wxml-node-info/get-wxml-node-info.wxss:
--------------------------------------------------------------------------------
1 | movable-view {
2 | display: flex;
3 | align-items: center;
4 | justify-content: center;
5 | height: 100rpx;
6 | width: 100rpx;
7 | background: #1AAD19;
8 | color: #fff;
9 | }
10 |
11 | movable-area {
12 | height: 400rpx;
13 | width: 400rpx;
14 | background-color: #ccc;
15 | overflow: hidden;
16 | }
17 |
18 | .page-section {
19 | display: flex;
20 | justify-content: center;
21 | }
22 |
23 | .page-body {
24 | display: flex;
25 | flex-direction: column;
26 | align-items: center;
27 | }
28 |
29 | .metric {
30 | width: 400rpx;
31 | display: flex;
32 | justify-content: center;
33 | flex-direction:column;
34 | align-items:center;
35 | }
36 |
37 | .b {
38 | display: inline-block;
39 | width: 150rpx;
40 | font-weight: bold;
41 | }
42 |
43 | .span {
44 | display: inline-block;
45 | width: 100rpx;
46 | }
47 |
--------------------------------------------------------------------------------
/page/API/pages/ibeacon/ibeacon.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'iBeacon',
5 | path: 'page/API/pages/ibeacon/ibeacon'
6 | }
7 | },
8 |
9 | data: {
10 | uuid: '',
11 | beacons: []
12 | },
13 |
14 | onUnload() {
15 | this.stopSearch()
16 | },
17 |
18 | enterUuid(e) {
19 | this.setData({
20 | uuid: e.detail.value
21 | })
22 | },
23 |
24 | startSearch() {
25 | if (this._searching) return
26 | this._searching = true
27 | wx.startBeaconDiscovery({
28 | uuids: [this.data.uuid],
29 | success: (res) => {
30 | console.log(res)
31 | wx.onBeaconUpdate(({beacons}) => {
32 | this.setData({
33 | beacons
34 | })
35 | })
36 | },
37 | fail: (err) => {
38 | console.error(err)
39 | }
40 | })
41 | },
42 |
43 | stopSearch() {
44 | this._searching = false
45 | wx.stopBeaconDiscovery()
46 | }
47 | })
48 |
--------------------------------------------------------------------------------
/page/API/pages/ibeacon/ibeacon.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "iBeacon"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/ibeacon/ibeacon.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .page-body-info {
4 | margin-top: 50rpx;
5 | padding: 30rpx 60rpx;
6 | width: auto;
7 | }
8 |
9 | .devices_summary {
10 | padding: 10rpx;
11 | font-size: 30rpx;
12 | }
13 | .device_list {
14 | height: 300rpx;
15 | border-radius: 5rpx;
16 | flex: 1;
17 | }
18 | .device_item {
19 | border-bottom: 1rpx solid #EEE;
20 | padding: 10rpx;
21 | color: #666;
22 | }
23 | .device_item_hover {
24 | background-color: rgba(0, 0, 0, .1);
25 | }
26 |
--------------------------------------------------------------------------------
/page/API/pages/image/image.js:
--------------------------------------------------------------------------------
1 | const sourceType = [['camera'], ['album'], ['camera', 'album']]
2 | const sizeType = [['compressed'], ['original'], ['compressed', 'original']]
3 |
4 | Page({
5 | onShareAppMessage() {
6 | return {
7 | title: '图片',
8 | path: 'page/API/pages/image/image'
9 | }
10 | },
11 |
12 | data: {
13 | imageList: [],
14 | sourceTypeIndex: 2,
15 | sourceType: ['拍照', '相册', '拍照或相册'],
16 |
17 | sizeTypeIndex: 2,
18 | sizeType: ['压缩', '原图', '压缩或原图'],
19 |
20 | countIndex: 8,
21 | count: [1, 2, 3, 4, 5, 6, 7, 8, 9]
22 | },
23 | sourceTypeChange(e) {
24 | this.setData({
25 | sourceTypeIndex: e.detail.value
26 | })
27 | },
28 | sizeTypeChange(e) {
29 | this.setData({
30 | sizeTypeIndex: e.detail.value
31 | })
32 | },
33 | countChange(e) {
34 | this.setData({
35 | countIndex: e.detail.value
36 | })
37 | },
38 | chooseImage() {
39 | const that = this
40 | wx.chooseImage({
41 | sourceType: sourceType[this.data.sourceTypeIndex],
42 | sizeType: sizeType[this.data.sizeTypeIndex],
43 | count: this.data.count[this.data.countIndex],
44 | success(res) {
45 | console.log(res)
46 | that.setData({
47 | imageList: res.tempFilePaths
48 | })
49 | }
50 | })
51 | },
52 | previewImage(e) {
53 | const current = e.target.dataset.src
54 |
55 | wx.previewImage({
56 | current,
57 | urls: this.data.imageList
58 | })
59 | }
60 | })
61 |
--------------------------------------------------------------------------------
/page/API/pages/image/image.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "图片"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/image/image.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/pages/intersection-observer/intersection-observer.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'WXML节点布局相交状态',
5 | path: 'page/API/pages/intersection-observer/intersection-observer'
6 | }
7 | },
8 |
9 | data: {
10 | appear: false
11 | },
12 | onLoad() {
13 | this._observer = wx.createIntersectionObserver(this)
14 | this._observer
15 | .relativeTo('.scroll-view')
16 | .observe('.ball', (res) => {
17 | console.log(res)
18 | this.setData({
19 | appear: res.intersectionRatio > 0
20 | })
21 | })
22 | },
23 | onUnload() {
24 | if (this._observer) this._observer.disconnect()
25 | }
26 | })
27 |
--------------------------------------------------------------------------------
/page/API/pages/intersection-observer/intersection-observer.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "WXML节点布局相交状态"
3 | }
--------------------------------------------------------------------------------
/page/API/pages/intersection-observer/intersection-observer.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/intersection-observer/intersection-observer.wxss:
--------------------------------------------------------------------------------
1 | .scroll-view {
2 | height: 400rpx;
3 | background: #fff;
4 | }
5 |
6 | .scroll-area {
7 | height: 1300rpx;
8 | display: flex;
9 | flex-direction: column;
10 | align-items: center;
11 | transition: .5s;
12 | }
13 |
14 | .notice {
15 | margin-top: 150rpx;
16 | }
17 |
18 | .ball {
19 | width: 200rpx;
20 | height: 200rpx;
21 | background: #1AAD19;
22 | border-radius: 50%;
23 | }
24 |
25 | .filling {
26 | height: 400rpx;
27 | }
28 |
29 | .message {
30 | width: 100%;
31 | display: flex;
32 | justify-content: center;
33 | }
34 |
35 | .message text {
36 | font-size: 40rpx;
37 | font-family: -apple-system-font, Helvetica Neue,Helvetica,sans-serif;
38 | }
39 |
--------------------------------------------------------------------------------
/page/API/pages/load-font-face/load-font-face.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '动态加载字体',
5 | path: 'page/API/pages/load-font-face/load-font-face'
6 | }
7 | },
8 |
9 | data: {
10 | fontFamily: 'Bitstream Vera Serif Bold',
11 | loaded: false,
12 | },
13 |
14 | onLoad() {
15 | this.setData({
16 | loaded: false
17 | })
18 | },
19 |
20 | loadFontFace() {
21 | const self = this
22 | wx.loadFontFace({
23 | family: this.data.fontFamily,
24 | source: 'url("https://sungd.github.io/Pacifico.ttf")',
25 | success(res) {
26 | console.log(res.status)
27 | self.setData({loaded: true})
28 | },
29 | fail(res) {
30 | console.log(res.status)
31 | },
32 | complete(res) {
33 | console.log(res.status)
34 | }
35 | })
36 | },
37 |
38 | clear() {
39 | this.setData({loaded: false})
40 | }
41 | })
42 |
--------------------------------------------------------------------------------
/page/API/pages/load-font-face/load-font-face.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "动态加载字体"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/load-font-face/load-font-face.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Load {{ fontFamily }}
11 | {{ fontFamily }} is loaded
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/page/API/pages/load-font-face/load-font-face.wxss:
--------------------------------------------------------------------------------
1 | .page-body-info {
2 | align-items: center;
3 | padding: 200rpx 0;
4 | }
5 |
6 | .font-loaded {
7 | font-family: "Bitstream Vera Serif Bold";
8 | }
9 |
10 | .display-area {
11 | font-size: 40rpx;
12 | }
13 |
--------------------------------------------------------------------------------
/page/API/pages/login/login.js:
--------------------------------------------------------------------------------
1 | const app = getApp()
2 | Page({
3 | onShareAppMessage() {
4 | return {
5 | title: '微信登录',
6 | path: 'page/API/pages/login/login'
7 | }
8 | },
9 |
10 | onLoad() {
11 | this.setData({
12 | hasLogin: app.globalData.hasLogin
13 | })
14 | },
15 | data: {},
16 | login() {
17 | const that = this
18 | wx.login({
19 | success() {
20 | app.globalData.hasLogin = true
21 | that.setData({
22 | hasLogin: true
23 | })
24 | }
25 | })
26 | }
27 | })
28 |
--------------------------------------------------------------------------------
/page/API/pages/login/login.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "微信登录"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/make-phone-call/make-phone-call.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '打电话',
5 | path: 'page/API/pages/make-phone-call/make-phone-call'
6 | }
7 | },
8 |
9 | data: {
10 | disabled: true
11 | },
12 | bindInput(e) {
13 | this.inputValue = e.detail.value
14 |
15 | if (this.inputValue.length > 0) {
16 | this.setData({
17 | disabled: false
18 | })
19 | } else {
20 | this.setData({
21 | disabled: true
22 | })
23 | }
24 | },
25 | makePhoneCall() {
26 | wx.makePhoneCall({
27 | phoneNumber: this.inputValue,
28 | success() {
29 | console.log('成功拨打电话')
30 | }
31 | })
32 | }
33 | })
34 |
--------------------------------------------------------------------------------
/page/API/pages/make-phone-call/make-phone-call.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "打电话"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/API/pages/modal/modal.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '模态弹窗',
5 | path: 'page/API/pages/modal/modal'
6 | }
7 | },
8 |
9 | data: {
10 | modalHidden: true,
11 | modalHidden2: true
12 | },
13 | modalTap() {
14 | wx.showModal({
15 | title: '弹窗标题',
16 | content: '弹窗内容,告知当前状态、信息和解决方法,描述文字尽量控制在三行内',
17 | showCancel: false,
18 | confirmText: '确定'
19 | })
20 | },
21 | noTitlemodalTap() {
22 | wx.showModal({
23 | content: '弹窗内容,告知当前状态、信息和解决方法,描述文字尽量控制在三行内',
24 | confirmText: '确定',
25 | cancelText: '取消'
26 | })
27 | }
28 | })
29 |
--------------------------------------------------------------------------------
/page/API/pages/modal/modal.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "模态弹窗"
3 | }
4 |
--------------------------------------------------------------------------------
/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/modal/modal.wxss:
--------------------------------------------------------------------------------
1 | /* page/API/pages/modal/modal.wxss */
--------------------------------------------------------------------------------
/page/API/pages/navigation-bar-loading/navigation-bar-loading.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '标题栏加载动画',
5 | path: 'page/API/pages/navigation-bar-loading/navigation-bar-loading'
6 | }
7 | },
8 |
9 | showNavigationBarLoading() {
10 | wx.showNavigationBarLoading()
11 | },
12 | hideNavigationBarLoading() {
13 | wx.hideNavigationBarLoading()
14 | }
15 | })
16 |
--------------------------------------------------------------------------------
/page/API/pages/navigation-bar-loading/navigation-bar-loading.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "标题栏加载动画"
3 | }
4 |
--------------------------------------------------------------------------------
/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/API/pages/navigation-bar-loading/navigation-bar-loading.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/pages/navigation-bar-loading/navigation-bar-loading.wxss
--------------------------------------------------------------------------------
/page/API/pages/navigator/navigator.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '页面跳转',
5 | path: 'page/API/pages/navigator/navigator'
6 | }
7 | },
8 |
9 | navigateTo() {
10 | wx.navigateTo({url: './navigator'})
11 | },
12 |
13 | navigateBack() {
14 | wx.navigateBack()
15 | },
16 |
17 | redirectTo() {
18 | wx.redirectTo({url: './navigator'})
19 | },
20 |
21 | switchTab() {
22 | wx.switchTab({url: '/page/component/index'})
23 | },
24 |
25 | reLaunch() {
26 | wx.reLaunch({url: '/page/component/index'})
27 | }
28 | })
29 |
--------------------------------------------------------------------------------
/page/API/pages/navigator/navigator.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "页面跳转"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/navigator/navigator.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/page/API/pages/navigator/navigator.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/pages/navigator/navigator.wxss
--------------------------------------------------------------------------------
/page/API/pages/on-accelerometer-change/on-accelerometer-change.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "监听重力感应数据"
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/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-body-controls {
28 | margin-top: 30rpx;
29 | }
30 | .page-body-controls button {
31 | margin-left: 20rpx;
32 | float: left;
33 | }
34 |
--------------------------------------------------------------------------------
/page/API/pages/on-compass-change/compass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/pages/on-compass-change/compass.png
--------------------------------------------------------------------------------
/page/API/pages/on-compass-change/on-compass-change.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '监听罗盘数据',
5 | path: 'page/API/pages/on-compass-change/on-compass-change'
6 | }
7 | },
8 |
9 | data: {
10 | enabled: true,
11 | direction: 0
12 | },
13 | onReady() {
14 | const that = this
15 | wx.onCompassChange(function (res) {
16 | that.setData({
17 | direction: parseInt(res.direction, 10)
18 | })
19 | })
20 | },
21 | startCompass() {
22 | if (this.data.enabled) {
23 | return
24 | }
25 | const that = this
26 | wx.startCompass({
27 | success() {
28 | that.setData({
29 | enabled: true
30 | })
31 | }
32 | })
33 | },
34 | stopCompass() {
35 | if (!this.data.enabled) {
36 | return
37 | }
38 | const that = this
39 | wx.stopCompass({
40 | success() {
41 | that.setData({
42 | enabled: false
43 | })
44 | }
45 | })
46 | }
47 | })
48 |
--------------------------------------------------------------------------------
/page/API/pages/on-compass-change/on-compass-change.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "监听罗盘数据"
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/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 | .controls{
42 | margin-top: 70rpx;
43 | }
44 | .controls button{
45 | margin-left: 20rpx;
46 | float: left;
47 | }
48 |
--------------------------------------------------------------------------------
/page/API/pages/on-network-status-change/on-network-status-change.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '监听手机网络变化',
5 | path: 'page/API/pages/on-network-status-change/on-network-status-change'
6 | }
7 | },
8 |
9 | data: {
10 | isConnected: false,
11 | },
12 | onLoad() {
13 | const that = this
14 | wx.onNetworkStatusChange(function (res) {
15 | that.setData({
16 | isConnected: res.isConnected,
17 | networkType: res.networkType
18 | })
19 | })
20 | },
21 | onShow() {
22 | const that = this
23 | wx.getNetworkType({
24 | success(res) {
25 | that.setData({
26 | isConnected: res.networkType !== 'none',
27 | networkType: res.networkType
28 | })
29 | }
30 | })
31 | }
32 | })
33 |
--------------------------------------------------------------------------------
/page/API/pages/on-network-status-change/on-network-status-change.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "监听手机网络变化"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/on-network-status-change/on-network-status-change.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 网络状态
11 |
12 | 没有网络连接
13 |
14 |
15 | {{networkType}}
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/page/API/pages/on-network-status-change/on-network-status-change.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/API/pages/open-location/open-location.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '查看位置',
5 | path: 'page/API/pages/open-location/open-location'
6 | }
7 | },
8 |
9 | openLocation(e) {
10 | console.log(e)
11 | const value = e.detail.value
12 | console.log(value)
13 | wx.openLocation({
14 | longitude: Number(value.longitude),
15 | latitude: Number(value.latitude),
16 | name: value.name,
17 | address: value.address
18 | })
19 | }
20 | })
21 |
--------------------------------------------------------------------------------
/page/API/pages/open-location/open-location.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "查看位置"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/open-location/open-location.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/pages/page-scroll/page-scroll.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '页面滚动',
5 | path: 'page/API/pages/page-scroll/page-scroll'
6 | }
7 | },
8 |
9 | scrollToTop() {
10 | wx.pageScrollTo({
11 | scrollTop: 0,
12 | duration: 300
13 | })
14 | },
15 |
16 | scrollToBottom() {
17 | wx.pageScrollTo({
18 | scrollTop: 3000,
19 | duration: 300
20 | })
21 | }
22 | })
23 |
--------------------------------------------------------------------------------
/page/API/pages/page-scroll/page-scroll.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "页面滚动"
3 | }
--------------------------------------------------------------------------------
/page/API/pages/page-scroll/page-scroll.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/page/API/pages/page-scroll/page-scroll.wxss:
--------------------------------------------------------------------------------
1 | .rect {
2 | width: 100rpx;
3 | height: 100rpx;
4 | background-color: #ccc;
5 | }
6 |
7 | .filling-area {
8 | height: 1500rpx;
9 | }
10 |
--------------------------------------------------------------------------------
/page/API/pages/pull-down-refresh/pull-down-refresh.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '下拉刷新',
5 | path: 'page/API/pages/pull-down-refresh/pull-down-refresh'
6 | }
7 | },
8 |
9 | onPullDownRefresh() {
10 | wx.showToast({
11 | title: 'loading...',
12 | icon: 'loading'
13 | })
14 | console.log('onPullDownRefresh', new Date())
15 | },
16 |
17 | stopPullDownRefresh() {
18 | wx.stopPullDownRefresh({
19 | complete(res) {
20 | wx.hideToast()
21 | console.log(res, new Date())
22 | }
23 | })
24 | }
25 | })
26 |
--------------------------------------------------------------------------------
/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.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 下滑页面即可刷新
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/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/request-payment/request-payment.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "发起支付"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/API/pages/request/request.js:
--------------------------------------------------------------------------------
1 | const requestUrl = require('../../../../config').requestUrl
2 |
3 | const duration = 2000
4 |
5 | Page({
6 | onShareAppMessage() {
7 | return {
8 | title: '网络请求',
9 | path: 'page/API/pages/request/request'
10 | }
11 | },
12 |
13 | makeRequest() {
14 | const self = this
15 |
16 | self.setData({
17 | loading: true
18 | })
19 |
20 | wx.request({
21 | url: requestUrl,
22 | data: {
23 | noncestr: Date.now()
24 | },
25 | success(result) {
26 | wx.showToast({
27 | title: '请求成功',
28 | icon: 'success',
29 | mask: true,
30 | duration,
31 | })
32 | self.setData({
33 | loading: false
34 | })
35 | console.log('request success', result)
36 | },
37 |
38 | fail({errMsg}) {
39 | console.log('request fail', errMsg)
40 | self.setData({
41 | loading: false
42 | })
43 | }
44 | })
45 | }
46 | })
47 |
--------------------------------------------------------------------------------
/page/API/pages/request/request.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "网络请求"
3 | }
4 |
--------------------------------------------------------------------------------
/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/request/request.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/pages/request/request.wxss
--------------------------------------------------------------------------------
/page/API/pages/scan-code/scan-code.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '扫码',
5 | path: 'page/API/pages/scan-code/scan-code'
6 | }
7 | },
8 |
9 | data: {
10 | result: ''
11 | },
12 |
13 | scanCode() {
14 | const that = this
15 | wx.scanCode({
16 | success(res) {
17 | that.setData({
18 | result: res.result
19 | })
20 | },
21 | fail() {}
22 | })
23 | }
24 | })
25 |
--------------------------------------------------------------------------------
/page/API/pages/scan-code/scan-code.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "扫码"
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/API/pages/screen-brightness/screen-brightness.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '屏幕亮度',
5 | path: 'page/API/pages/screen-brightness/screen-brightness'
6 | }
7 | },
8 |
9 | data: {
10 | screenBrightness: 0
11 | },
12 |
13 | onLoad() {
14 | this._updateScreenBrightness()
15 | },
16 |
17 | changeBrightness(e) {
18 | const value = Number.parseFloat(
19 | (e.detail.value).toFixed(1)
20 | )
21 | wx.setScreenBrightness({
22 | value,
23 | success: () => {
24 | this._updateScreenBrightness()
25 | }
26 | })
27 | },
28 |
29 | _updateScreenBrightness() {
30 | wx.getScreenBrightness({
31 | success: (res) => {
32 | this.setData({
33 | screenBrightness: Number.parseFloat(
34 | res.value.toFixed(1)
35 | )
36 | })
37 | },
38 | fail(err) {
39 | console.error(err)
40 | }
41 | })
42 | }
43 | })
44 |
--------------------------------------------------------------------------------
/page/API/pages/screen-brightness/screen-brightness.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "屏幕亮度"
3 | }
--------------------------------------------------------------------------------
/page/API/pages/screen-brightness/screen-brightness.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 当前屏幕亮度
10 | {{screenBrightness}}
11 |
12 |
13 | 设置屏幕亮度
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/page/API/pages/screen-brightness/screen-brightness.wxss:
--------------------------------------------------------------------------------
1 | .page-body-text-screen-brightness {
2 | font-size: 80rpx;
3 | font-family: -apple-system-font, Helvetica Neue,Helvetica,sans-serif;
4 | }
5 |
6 | .page-section-gap {
7 | padding: 30rpx;
8 | }
9 |
--------------------------------------------------------------------------------
/page/API/pages/sendMessage/sendMessage.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/page/API/pages/sendMessage/sendMessage.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "发送模板消息"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/sendMessage/sendMessage.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/pages/set-navigation-bar-title/set-navigation-bar-title.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '设置页面标题',
5 | path: 'page/API/pages/set-navigation-bar-title/set-navigation-bar-title'
6 | }
7 | },
8 |
9 | setNaivgationBarTitle(e) {
10 | const title = e.detail.value.title
11 | console.log(title)
12 | wx.setNavigationBarTitle({
13 | title,
14 | success() {
15 | console.log('setNavigationBarTitle success')
16 | },
17 | fail(err) {
18 | console.log('setNavigationBarTitle fail, err is', err)
19 | }
20 | })
21 |
22 | return false
23 | }
24 | })
25 |
--------------------------------------------------------------------------------
/page/API/pages/set-navigation-bar-title/set-navigation-bar-title.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "设置页面标题"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/setting/setting.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '设置',
5 | path: 'page/API/pages/setting/setting'
6 | }
7 | },
8 |
9 | data: {
10 | setting: {}
11 | },
12 |
13 | getSetting() {
14 | wx.getSetting({
15 | success: (res) => {
16 | console.log(res)
17 | this.setData({setting: res.authSetting})
18 | }
19 | })
20 | }
21 | })
22 |
--------------------------------------------------------------------------------
/page/API/pages/setting/setting.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "设置"
3 | }
--------------------------------------------------------------------------------
/page/API/pages/setting/setting.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | form {
4 | margin-top: 30rpx;
5 | }
6 |
7 | .weui-cell__bd {
8 | display: flex;
9 | justify-content: center;
10 | padding: 20rpx 0;
11 | min-height: 60rpx;
12 | }
--------------------------------------------------------------------------------
/page/API/pages/share-button/share-button.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '转发按钮',
5 | path: 'page/API/pages/share-button/share-button'
6 | }
7 | },
8 | handleTapShareButton() {
9 | if (!((typeof wx.canIUse === 'function') && wx.canIUse('button.open-type.share'))) {
10 | wx.showModal({
11 | title: '当前版本不支持转发按钮',
12 | content: '请升级至最新版本微信客户端',
13 | showCancel: false
14 | })
15 | }
16 | }
17 | })
18 |
--------------------------------------------------------------------------------
/page/API/pages/share-button/share-button.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "转发按钮"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/share-button/share-button.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 轻触下方图标即可转发
11 |
12 |
13 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/page/API/pages/share-button/share-button.wxss:
--------------------------------------------------------------------------------
1 | .button-share {
2 | display: none;
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
10 | onShareAppMessage() {
11 | return this.data.shareData
12 | }
13 | })
14 |
--------------------------------------------------------------------------------
/page/API/pages/share/share.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "转发"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/share/share.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/pages/soter-authentication/soter-authentication.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "生物认证"
3 | }
--------------------------------------------------------------------------------
/page/API/pages/soter-authentication/soter-authentication.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/page/API/pages/soter-authentication/soter-authentication.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/pages/soter-authentication/soter-authentication.wxss
--------------------------------------------------------------------------------
/page/API/pages/storage/storage.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "数据存储"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/storage/storage.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/pages/subscribe-message/subscribe-message.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "订阅消息"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/subscribe-message/subscribe-message.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 已{{authType === 0 ? '' : '拒绝'}}授权
11 | 未授权
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/page/API/pages/subscribe-message/subscribe-message.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .page-body-wording {
4 | padding: 130rpx 100rpx;
5 | }
6 |
7 | .page-body-title {
8 | font-size: 40rpx;
9 | line-height: 1;
10 | }
11 |
--------------------------------------------------------------------------------
/page/API/pages/template-message/template-message.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "模板消息"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/template-message/template-message.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/API/pages/toast/toast.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '消息提示框',
5 | path: 'page/API/pages/toast/toast'
6 | }
7 | },
8 |
9 | toast1Tap() {
10 | wx.showToast({
11 | title: '默认'
12 | })
13 | },
14 |
15 | toast2Tap() {
16 | wx.showToast({
17 | title: 'duration 3000',
18 | duration: 3000
19 | })
20 | },
21 |
22 | toast3Tap() {
23 | wx.showToast({
24 | title: 'loading',
25 | icon: 'loading',
26 | duration: 5000
27 | })
28 | },
29 |
30 | hideToast() {
31 | wx.hideToast()
32 | }
33 | })
34 |
--------------------------------------------------------------------------------
/page/API/pages/toast/toast.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "消息提示框"
3 | }
4 |
--------------------------------------------------------------------------------
/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/toast/toast.wxss:
--------------------------------------------------------------------------------
1 | /* page/API/pages/toast/toast.wxss */
--------------------------------------------------------------------------------
/page/API/pages/upload-file/upload-file.js:
--------------------------------------------------------------------------------
1 | const uploadFileUrl = require('../../../../config').uploadFileUrl
2 |
3 | Page({
4 | onShareAppMessage() {
5 | return {
6 | title: '上传文件',
7 | path: 'page/API/pages/upload-file/upload-file'
8 | }
9 | },
10 |
11 | chooseImage() {
12 | const self = this
13 |
14 | wx.chooseImage({
15 | count: 1,
16 | sizeType: ['compressed'],
17 | sourceType: ['album'],
18 | success(res) {
19 | console.log('chooseImage success, temp path is', res.tempFilePaths[0])
20 |
21 | const imageSrc = res.tempFilePaths[0]
22 |
23 | wx.uploadFile({
24 | url: uploadFileUrl,
25 | filePath: imageSrc,
26 | name: 'data',
27 | success(res) {
28 | console.log('uploadImage success, res is:', res)
29 |
30 | wx.showToast({
31 | title: '上传成功',
32 | icon: 'success',
33 | duration: 1000
34 | })
35 |
36 | self.setData({
37 | imageSrc
38 | })
39 | },
40 | fail({errMsg}) {
41 | console.log('uploadImage fail, errMsg is', errMsg)
42 | }
43 | })
44 | },
45 |
46 | fail({errMsg}) {
47 | console.log('chooseImage fail, err is', errMsg)
48 | }
49 | })
50 | }
51 | })
52 |
--------------------------------------------------------------------------------
/page/API/pages/upload-file/upload-file.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "上传文件"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/vibrate/vibrate.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: '振动',
5 | path: 'page/API/pages/vibrate/vibrate'
6 | }
7 | },
8 |
9 | vibrateShort() {
10 | wx.vibrateShort({
11 | success(res) {
12 | console.log(res)
13 | },
14 | fail(err) {
15 | console.error(err)
16 | },
17 | complete() {
18 | console.log('completed')
19 | }
20 | })
21 | },
22 |
23 | vibrateLong() {
24 | wx.vibrateLong({
25 | success(res) {
26 | console.log(res)
27 | },
28 | fail(err) {
29 | console.error(err)
30 | },
31 | complete() {
32 | console.log('completed')
33 | }
34 | })
35 | }
36 | })
37 |
--------------------------------------------------------------------------------
/page/API/pages/vibrate/vibrate.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "振动"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/vibrate/vibrate.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/page/API/pages/vibrate/vibrate.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/pages/vibrate/vibrate.wxss
--------------------------------------------------------------------------------
/page/API/pages/video/video.js:
--------------------------------------------------------------------------------
1 | const sourceType = [['camera'], ['album'], ['camera', 'album']]
2 | const camera = [['front'], ['back'], ['front', 'back']]
3 |
4 | // eslint-disable-next-line
5 | const duration = Array.apply(null, {length: 60}).map(function (n, i) {
6 | return i + 1
7 | })
8 |
9 | Page({
10 | onShareAppMessage() {
11 | return {
12 | title: '拍摄/选择视频',
13 | path: 'page/API/pages/video/video'
14 | }
15 | },
16 |
17 | data: {
18 | sourceTypeIndex: 2,
19 | sourceType: ['拍摄', '相册', '拍摄或相册'],
20 |
21 | cameraIndex: 2,
22 | camera: ['前置', '后置', '前置或后置'],
23 |
24 | durationIndex: 59,
25 | duration: duration.map(function (t) { return t + '秒' }),
26 |
27 | src: ''
28 | },
29 | sourceTypeChange(e) {
30 | this.setData({
31 | sourceTypeIndex: e.detail.value
32 | })
33 | },
34 | cameraChange(e) {
35 | this.setData({
36 | cameraIndex: e.detail.value
37 | })
38 | },
39 | durationChange(e) {
40 | this.setData({
41 | durationIndex: e.detail.value
42 | })
43 | },
44 | chooseVideo() {
45 | const that = this
46 | wx.chooseVideo({
47 | sourceType: sourceType[this.data.sourceTypeIndex],
48 | camera: camera[this.data.cameraIndex],
49 | maxDuration: duration[this.data.durationIndex],
50 | success(res) {
51 | that.setData({
52 | src: res.tempFilePath
53 | })
54 | }
55 | })
56 | }
57 | })
58 |
--------------------------------------------------------------------------------
/page/API/pages/video/video.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "拍摄/选择视频"
3 | }
4 |
--------------------------------------------------------------------------------
/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/voice/voice.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "录音"
3 | }
4 |
--------------------------------------------------------------------------------
/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/API/pages/web-socket/web-socket.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "Web Socket"
3 | }
4 |
--------------------------------------------------------------------------------
/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/web-socket/web-socket.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
--------------------------------------------------------------------------------
/page/API/pages/wifi/wifi.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "Wi-Fi"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/wifi/wifi.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{ item.SSID }}
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/page/API/pages/worker/worker.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "多线程Worker"
3 | }
4 |
--------------------------------------------------------------------------------
/page/API/pages/worker/worker.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 计算斐波那契数
15 |
16 |
17 |
18 |
19 |
20 | 结果
21 |
22 |
23 | {{res}}
24 |
25 |
26 | 提示:使用单线程进行计算时,动画会出现明显的卡顿现象。使用 Worker 线程进行计算,则可以保证动画的流畅。
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/page/API/pages/worker/worker.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .canvas {
4 | width: 305px;
5 | height: 305px;
6 | background-color: #fff;
7 | }
8 |
9 | .page-section-title {
10 | margin-top: 30rpx;
11 | }
--------------------------------------------------------------------------------
/page/API/resources/kind/api.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/resources/kind/api.png
--------------------------------------------------------------------------------
/page/API/resources/kind/device.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/resources/kind/device.png
--------------------------------------------------------------------------------
/page/API/resources/kind/feedback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/resources/kind/feedback.png
--------------------------------------------------------------------------------
/page/API/resources/kind/location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/resources/kind/location.png
--------------------------------------------------------------------------------
/page/API/resources/kind/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/resources/kind/logo.png
--------------------------------------------------------------------------------
/page/API/resources/kind/media.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/resources/kind/media.png
--------------------------------------------------------------------------------
/page/API/resources/kind/network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/resources/kind/network.png
--------------------------------------------------------------------------------
/page/API/resources/kind/page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/resources/kind/page.png
--------------------------------------------------------------------------------
/page/API/resources/kind/storage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/resources/kind/storage.png
--------------------------------------------------------------------------------
/page/API/resources/kind/worker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/API/resources/kind/worker.png
--------------------------------------------------------------------------------
/page/await/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShow() {
3 | wx.reportAnalytics('enter_home_programmatically', {})
4 | const endSecond = 1598665600
5 |
6 | const totalDay = Math.floor((endSecond - new Date().getTime() / 1000) / 3600 / 24)
7 | // const totalMarryDay = Math.floor((new Date().getTime() / 1000 - marrrySecond) / 3600 / 24)
8 |
9 | const list = this.data.list
10 | for (let i = 0, len = list.length; i < len; ++i) {
11 | var gap = list[i].id - totalDay
12 | list[i].gap = Math.abs(gap)
13 | if (gap >= 0) {
14 | list[i].pre = "距离恋爱"
15 | list[i].center = "还有"
16 | list[i].end = "天"
17 | list[i].finish = false
18 | } else {
19 | list[i].pre = "恋爱"
20 | list[i].center = ""
21 | list[i].end = " ✓"
22 | list[i].finish = true
23 | }
24 | }
25 |
26 | this.setData({
27 | totalDay: totalDay,
28 | list: list
29 | })
30 | },
31 | onShareAppMessage() {
32 | return {
33 | title: '纪念日',
34 | path: 'page/component/index'
35 | }
36 | },
37 |
38 | data: {
39 | totalDay: 0,
40 | totalMarryDay: 0,
41 | list: [
42 | // { id: 1, desc: "99天" }
43 | ]
44 | },
45 | })
46 |
--------------------------------------------------------------------------------
/page/await/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "XXXX专属小程序"
3 | }
4 |
--------------------------------------------------------------------------------
/page/await/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 愿望还差
5 | {{totalDay}}
6 | 天就达成
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | {{item.pre}}
17 | {{item.desc}}
18 | {{item.center}}
19 | {{item.gap}}
20 | {{item.end}}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/page/await/index.wxss:
--------------------------------------------------------------------------------
1 | @import "../common/index.wxss";
2 |
3 | .flex-wrp-center-row{
4 | display:flex;
5 | align-items: flex-end;
6 | justify-content: center;
7 | flex-direction:row;
8 | padding: 0rpx 0 0 0;
9 | }
10 |
11 | .memory-index-hd {
12 | padding: 260rpx 0 0 0;
13 | text-align: center;
14 | }
15 |
16 | .memory-index-hd-hi {
17 | padding: 0 5rpx 0 5rpx;
18 | font-size: 70rpx;
19 | color: #FF1F71
20 | }
21 |
22 | .memory-index-hd-desc {
23 | padding: 0 0 24rpx 0;
24 | }
25 |
26 | .task_item_text {
27 | height: auto;
28 | width: auto;
29 | }
30 |
31 | .task_item_text_hide {
32 | height: auto;
33 | width: 0;
34 | display: none;
35 | }
36 |
37 | .task_item_text_finish {
38 | height: auto;
39 | width: auto;
40 | color: #00aa00
41 | }
42 |
43 | .flex-wrp{
44 | display:flex;
45 | }
46 |
47 | .flex-wrp-item{
48 | display:flex;
49 | padding: 20rpx 0 20rpx 60rpx;
50 | margin: 20rpx 60rpx 0 60rpx;
51 | background-color: #FFFFFF;
52 | border-radius: 4rpx;
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/page/common/foot.wxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/page/common/head.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{title}}
4 |
5 | {{desc}}
6 |
7 |
8 |
--------------------------------------------------------------------------------
/page/component/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "123小程序官方组件展示"
3 | }
4 |
--------------------------------------------------------------------------------
/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/index.wxss:
--------------------------------------------------------------------------------
1 | @import "../common/index.wxss";
--------------------------------------------------------------------------------
/page/component/pages/ad/ad.js:
--------------------------------------------------------------------------------
1 | const info = wx.getSystemInfoSync()
2 |
3 | Page({
4 | onShareAppMessage() {
5 | return {
6 | title: 'ad',
7 | path: 'page/component/pages/ad/ad'
8 | }
9 | },
10 |
11 | data: {
12 | platform: info.platform
13 | }
14 | })
15 |
--------------------------------------------------------------------------------
/page/component/pages/ad/ad.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "ad"
3 | }
--------------------------------------------------------------------------------
/page/component/pages/ad/ad.wxss:
--------------------------------------------------------------------------------
1 | /* page/component/pages/ad/ad.wxss */
2 |
--------------------------------------------------------------------------------
/page/component/pages/audio/audio.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'audio',
5 | path: 'page/component/pages/audio/audio'
6 | }
7 | },
8 |
9 | data: {
10 | current: {
11 | poster: 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000',
12 | name: '此时此刻',
13 | author: '许巍',
14 | src: 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E06DCBDC9AB7C49FD713D632D313AC4858BACB8DDD29067D3C601481D36E62053BF8DFEAF74C0A5CCFADD6471160CAF3E6A&fromtag=46',
15 | },
16 | audioAction: {
17 | method: 'pause'
18 | }
19 | }
20 | })
21 |
--------------------------------------------------------------------------------
/page/component/pages/audio/audio.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "audio"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/audio/audio.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/page/component/pages/audio/audio.wxss:
--------------------------------------------------------------------------------
1 | /* page/component/pages/audio/audio.wxss */
--------------------------------------------------------------------------------
/page/component/pages/button/button.js:
--------------------------------------------------------------------------------
1 | const types = ['default', 'primary', 'warn']
2 | const pageObject = {
3 | data: {
4 | defaultSize: 'default',
5 | primarySize: 'default',
6 | warnSize: 'default',
7 | disabled: false,
8 | plain: false,
9 | loading: false
10 | },
11 |
12 | onShareAppMessage() {
13 | return {
14 | title: 'button',
15 | path: 'page/component/pages/button/button'
16 | }
17 | },
18 |
19 | setDisabled() {
20 | this.setData({
21 | disabled: !this.data.disabled
22 | })
23 | },
24 |
25 | setPlain() {
26 | this.setData({
27 | plain: !this.data.plain
28 | })
29 | },
30 |
31 | setLoading() {
32 | this.setData({
33 | loading: !this.data.loading
34 | })
35 | }
36 | }
37 |
38 | for (let i = 0; i < types.length; ++i) {
39 | (function (type) {
40 | pageObject[type] = function () {
41 | const key = type + 'Size'
42 | const changedData = {}
43 | changedData[key] =
44 | this.data[key] === 'default' ? 'mini' : 'default'
45 | this.setData(changedData)
46 | }
47 | }(types[i]))
48 | }
49 |
50 | Page(pageObject)
51 |
--------------------------------------------------------------------------------
/page/component/pages/button/button.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "button"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/camera-scan-code/camera-scan-code.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'camera',
5 | path: 'page/component/pages/camera-scan-code/camera-scan-code'
6 | }
7 | },
8 |
9 | data: {
10 | result: {}
11 | },
12 | onReady() {
13 | wx.showModal({
14 | title: '提示',
15 | content: '将摄像头对准一维码即可扫描',
16 | showCancel: false
17 | })
18 | },
19 | scanCode(e) {
20 | console.log('scanCode:', e)
21 | this.setData({
22 | result: e.detail
23 | })
24 | },
25 | navigateBack() {
26 | wx.navigateBack()
27 | },
28 | error(e) {
29 | console.log(e.detail)
30 | }
31 | })
32 |
--------------------------------------------------------------------------------
/page/component/pages/camera-scan-code/camera-scan-code.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "camera"
3 | }
--------------------------------------------------------------------------------
/page/component/pages/camera-scan-code/camera-scan-code.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
15 |
16 |
17 |
20 |
21 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/page/component/pages/camera-scan-code/camera-scan-code.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | camera {
4 | height: 500rpx;
5 | }
6 |
7 | .btn-area {
8 | margin-top: 0;
9 | }
10 |
11 | form {
12 | margin-top: 30rpx;
13 | }
14 |
15 | .weui-cell__bd {
16 | display: flex;
17 | justify-content: flex-start;
18 | align-items: center;
19 | padding: 20rpx 0;
20 | min-height: 60rpx;
21 | }
--------------------------------------------------------------------------------
/page/component/pages/camera/camera.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'camera',
5 | path: 'page/component/pages/camera/camera'
6 | }
7 | },
8 |
9 | data: {
10 | src: '',
11 | videoSrc: '',
12 | position: 'back',
13 | mode: 'scanCode',
14 | result: {}
15 | },
16 | onLoad() {
17 | this.ctx = wx.createCameraContext()
18 | },
19 | takePhoto() {
20 | this.ctx.takePhoto({
21 | quality: 'high',
22 | success: (res) => {
23 | this.setData({
24 | src: res.tempImagePath
25 | })
26 | }
27 | })
28 | },
29 | startRecord() {
30 | this.ctx.startRecord({
31 | success: () => {
32 | console.log('startRecord')
33 | }
34 | })
35 | },
36 | stopRecord() {
37 | this.ctx.stopRecord({
38 | success: (res) => {
39 | this.setData({
40 | src: res.tempThumbPath,
41 | videoSrc: res.tempVideoPath
42 | })
43 | }
44 | })
45 | },
46 | togglePosition() {
47 | this.setData({
48 | position: this.data.position === 'front'
49 | ? 'back' : 'front'
50 | })
51 | },
52 | error(e) {
53 | console.log(e.detail)
54 | }
55 | })
56 |
--------------------------------------------------------------------------------
/page/component/pages/camera/camera.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "camera"
3 | }
--------------------------------------------------------------------------------
/page/component/pages/camera/camera.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
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/camera/camera.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | camera {
4 | height: 500rpx;
5 | }
6 |
7 | .preview-tips {
8 | margin: 20rpx 0;
9 | }
10 |
11 | .photo, .video {
12 | margin-top: 50rpx;
13 | width: 100%;
14 | }
15 |
16 | .btn-area {
17 | margin-top: 0;
18 | }
19 |
20 | .first-btn {
21 | margin-top: 30rpx;
22 | }
23 |
24 | form {
25 | margin-top: 30rpx;
26 | }
27 |
28 | .weui-cell__bd {
29 | display: flex;
30 | justify-content: flex-start;
31 | align-items: center;
32 | padding: 20rpx 0;
33 | min-height: 60rpx;
34 | }
--------------------------------------------------------------------------------
/page/component/pages/canvas/canvas.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'canvas',
5 | path: 'page/component/pages/canvas/canvas'
6 | }
7 | },
8 |
9 | onReady() {
10 | this.position = {
11 | x: 150,
12 | y: 150,
13 | vx: 2,
14 | vy: 2
15 | }
16 |
17 | this.drawBall()
18 | this.interval = setInterval(this.drawBall, 17)
19 | },
20 |
21 | drawBall() {
22 | const p = this.position
23 | p.x += p.vx
24 | p.y += p.vy
25 | if (p.x >= 300) {
26 | p.vx = -2
27 | }
28 | if (p.x <= 7) {
29 | p.vx = 2
30 | }
31 | if (p.y >= 300) {
32 | p.vy = -2
33 | }
34 | if (p.y <= 7) {
35 | p.vy = 2
36 | }
37 |
38 | const context = wx.createCanvasContext('canvas')
39 |
40 | function ball(x, y) {
41 | context.beginPath(0)
42 | context.arc(x, y, 5, 0, Math.PI * 2)
43 | context.setFillStyle('#1aad19')
44 | context.setStrokeStyle('rgba(1,1,1,0)')
45 | context.fill()
46 | context.stroke()
47 | }
48 |
49 | ball(p.x, 150)
50 | ball(150, p.y)
51 | ball(300 - p.x, 150)
52 | ball(150, 300 - p.y)
53 | ball(p.x, p.y)
54 | ball(300 - p.x, 300 - p.y)
55 | ball(p.x, 300 - p.y)
56 | ball(300 - p.x, p.y)
57 |
58 | context.draw()
59 | },
60 |
61 | onUnload() {
62 | clearInterval(this.interval)
63 | }
64 | })
65 |
--------------------------------------------------------------------------------
/page/component/pages/canvas/canvas.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "canvas"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/canvas/canvas.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/page/component/pages/canvas/canvas.wxss:
--------------------------------------------------------------------------------
1 | .canvas {
2 | width: 305px;
3 | height: 305px;
4 | background-color: #fff;
5 | }
6 |
--------------------------------------------------------------------------------
/page/component/pages/checkbox/checkbox.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'checkbox',
5 | path: 'page/component/pages/checkbox/checkbox'
6 | }
7 | },
8 |
9 | data: {
10 | items: [
11 | {value: 'USA', name: '美国'},
12 | {value: 'CHN', name: '中国', checked: 'true'},
13 | {value: 'BRA', name: '巴西'},
14 | {value: 'JPN', name: '日本'},
15 | {value: 'ENG', name: '英国'},
16 | {value: 'FRA', name: '法国'}
17 | ]
18 | },
19 |
20 | checkboxChange(e) {
21 | console.log('checkbox发生change事件,携带value值为:', e.detail.value)
22 |
23 | const items = this.data.items
24 | const values = e.detail.value
25 | for (let i = 0, lenI = items.length; i < lenI; ++i) {
26 | items[i].checked = false
27 |
28 | for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
29 | if (items[i].value === values[j]) {
30 | items[i].checked = true
31 | break
32 | }
33 | }
34 | }
35 |
36 | this.setData({
37 | items
38 | })
39 | }
40 | })
41 |
--------------------------------------------------------------------------------
/page/component/pages/checkbox/checkbox.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "checkbox"
3 | }
4 |
--------------------------------------------------------------------------------
/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/checkbox/checkbox.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .checkbox{
4 | margin-right: 20rpx;
5 | }
6 |
--------------------------------------------------------------------------------
/page/component/pages/cover-view/cover-view.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'cover-view',
5 | path: 'page/component/pages/cover-view/cover-view'
6 | }
7 | },
8 |
9 | data: {
10 | latitude: 23.099994,
11 | longitude: 113.324520,
12 | }
13 | })
14 |
--------------------------------------------------------------------------------
/page/component/pages/cover-view/cover-view.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "cover-view"
3 | }
--------------------------------------------------------------------------------
/page/component/pages/cover-view/cover-view.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/page/component/pages/cover-view/cover-view.wxss:
--------------------------------------------------------------------------------
1 | .cover-view {
2 | position: absolute;
3 | top: calc(50% - 150rpx);
4 | left: calc(50% - 300rpx);
5 | /* opacity: .7; */
6 | }
7 |
8 | .flex-wrp{
9 | display:flex;
10 | }
11 |
12 | .flex-item{
13 | width: 200rpx;
14 | height: 300rpx;
15 | font-size: 26rpx;
16 | }
17 |
18 | .demo-text-1 {
19 | background: rgba(26, 173, 25, 0.7);
20 | }
21 |
22 | .demo-text-2 {
23 | background: rgba(39, 130, 215, 0.7);
24 | }
25 |
26 | .demo-text-3 {
27 | background: rgba(255, 255, 255, 0.7);
28 | }
--------------------------------------------------------------------------------
/page/component/pages/form/form.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'form',
5 | path: 'page/component/pages/form/form'
6 | }
7 | },
8 |
9 | data: {
10 | pickerHidden: true,
11 | chosen: ''
12 | },
13 |
14 | pickerConfirm(e) {
15 | this.setData({
16 | pickerHidden: true
17 | })
18 | this.setData({
19 | chosen: e.detail.value
20 | })
21 | },
22 |
23 | pickerCancel() {
24 | this.setData({
25 | pickerHidden: true
26 | })
27 | },
28 |
29 | pickerShow() {
30 | this.setData({
31 | pickerHidden: false
32 | })
33 | },
34 |
35 | formSubmit(e) {
36 | console.log('form发生了submit事件,携带数据为:', e.detail.value)
37 | },
38 |
39 | formReset(e) {
40 | console.log('form发生了reset事件,携带数据为:', e.detail.value)
41 | this.setData({
42 | chosen: ''
43 | })
44 | }
45 | })
46 |
--------------------------------------------------------------------------------
/page/component/pages/form/form.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "form"
3 | }
4 |
--------------------------------------------------------------------------------
/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/icon/icon.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'icon',
5 | path: 'page/component/pages/icon/icon'
6 | }
7 | },
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/icon/icon.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "icon"
3 | }
4 |
--------------------------------------------------------------------------------
/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/image/image.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'image',
5 | path: 'page/component/pages/image/image'
6 | }
7 | },
8 |
9 | })
10 |
--------------------------------------------------------------------------------
/page/component/pages/image/image.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "image"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/input/input.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'input',
5 | path: 'page/component/pages/input/input'
6 | }
7 | },
8 |
9 | data: {
10 | focus: false,
11 | inputValue: ''
12 | },
13 |
14 | bindKeyInput(e) {
15 | this.setData({
16 | inputValue: e.detail.value
17 | })
18 | },
19 |
20 | bindReplaceInput(e) {
21 | const value = e.detail.value
22 | let pos = e.detail.cursor
23 | let left
24 | if (pos !== -1) {
25 | // 光标在中间
26 | left = e.detail.value.slice(0, pos)
27 | // 计算光标的位置
28 | pos = left.replace(/11/g, '2').length
29 | }
30 |
31 | // 直接返回对象,可以对输入进行过滤处理,同时可以控制光标的位置
32 | return {
33 | value: value.replace(/11/g, '2'),
34 | cursor: pos
35 | }
36 |
37 | // 或者直接返回字符串,光标在最后边
38 | // return value.replace(/11/g,'2'),
39 | },
40 |
41 | bindHideKeyboard(e) {
42 | if (e.detail.value === '123') {
43 | // 收起键盘
44 | wx.hideKeyboard()
45 | }
46 | }
47 | })
48 |
--------------------------------------------------------------------------------
/page/component/pages/input/input.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "input"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/input/input.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .page-section{
4 | margin-bottom: 20rpx;
5 | }
--------------------------------------------------------------------------------
/page/component/pages/label/label.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'label',
5 | path: 'page/component/pages/label/label'
6 | }
7 | },
8 |
9 | data: {
10 | checkboxItems: [
11 | {name: 'USA', value: '美国'},
12 | {name: 'CHN', value: '中国', checked: 'true'}
13 | ],
14 | radioItems: [
15 | {name: 'USA', value: '美国'},
16 | {name: 'CHN', value: '中国', checked: 'true'}
17 | ],
18 | hidden: false
19 | },
20 |
21 | checkboxChange(e) {
22 | const checked = e.detail.value
23 | const changed = {}
24 | for (let i = 0; i < this.data.checkboxItems.length; i++) {
25 | if (checked.indexOf(this.data.checkboxItems[i].name) !== -1) {
26 | changed['checkboxItems[' + i + '].checked'] = true
27 | } else {
28 | changed['checkboxItems[' + i + '].checked'] = false
29 | }
30 | }
31 | this.setData(changed)
32 | },
33 |
34 | radioChange(e) {
35 | const checked = e.detail.value
36 | const changed = {}
37 | for (let i = 0; i < this.data.radioItems.length; i++) {
38 | if (checked.indexOf(this.data.radioItems[i].name) !== -1) {
39 | changed['radioItems[' + i + '].checked'] = true
40 | } else {
41 | changed['radioItems[' + i + '].checked'] = false
42 | }
43 | }
44 | this.setData(changed)
45 | },
46 |
47 | tapEvent() {
48 | console.log('按钮被点击')
49 | }
50 | })
51 |
--------------------------------------------------------------------------------
/page/component/pages/label/label.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "label"
3 | }
4 |
--------------------------------------------------------------------------------
/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/map-styles/map-styles.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'map底图样式',
5 | path: 'page/component/pages/map-styles/map-styles'
6 | }
7 | },
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/map-styles/map-styles.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "map底图样式"
3 | }
--------------------------------------------------------------------------------
/page/component/pages/map-styles/map-styles.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 |
--------------------------------------------------------------------------------
/page/component/pages/map-styles/map-styles.wxss:
--------------------------------------------------------------------------------
1 | .page-section-ctn {
2 | text-align: center;
3 | }
4 |
5 | .image {
6 | margin-top: 30rpx;
7 | width: 490rpx;
8 | height: 568rpx;
9 | }
--------------------------------------------------------------------------------
/page/component/pages/map/map.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "map"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/map/map.wxss:
--------------------------------------------------------------------------------
1 | .page-section-title {
2 | margin-bottom: 30rpx;
3 | }
4 |
5 | .navigator {
6 | color: #1AAD19;
7 | display: inline-block;
8 | }
--------------------------------------------------------------------------------
/page/component/pages/movable-view/movable-view.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'movable-view',
5 | path: 'page/component/pages/movable-view/movable-view'
6 | }
7 | },
8 |
9 | data: {
10 | x: 0,
11 | y: 0,
12 | scale: 2,
13 | },
14 |
15 | tap() {
16 | this.setData({
17 | x: 30,
18 | y: 30
19 | })
20 | },
21 |
22 | tap2() {
23 | this.setData({
24 | scale: 3
25 | })
26 | },
27 |
28 | onChange(e) {
29 | console.log(e.detail)
30 | },
31 |
32 | onScale(e) {
33 | console.log(e.detail)
34 | }
35 | })
36 |
--------------------------------------------------------------------------------
/page/component/pages/movable-view/movable-view.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "movable-view"
3 | }
--------------------------------------------------------------------------------
/page/component/pages/movable-view/movable-view.wxss:
--------------------------------------------------------------------------------
1 | movable-view {
2 | display: flex;
3 | align-items: center;
4 | justify-content: center;
5 | height: 100rpx;
6 | width: 100rpx;
7 | background: #1AAD19;
8 | color: #fff;
9 | }
10 |
11 | movable-area {
12 | height: 400rpx;
13 | width: 400rpx;
14 | margin: 50rpx 0rpx 0 50rpx;
15 | background-color: #ccc;
16 | overflow: hidden;
17 | }
18 |
19 | .max {
20 | width: 600rpx;
21 | height: 600rpx;
22 | }
23 |
24 | .page-section {
25 | width: 100%;
26 | margin-bottom: 20rpx;
27 | }
28 |
29 | .page-section-title {
30 | margin-top: 50rpx;
31 | font-size: 28rpx;
32 | color: #999999;
33 | margin-bottom: 10rpx;
34 | padding-left: 30rpx;
35 | padding-right: 30rpx;
36 | }
37 |
38 | .page-section-title.first {
39 | margin-top: 0;
40 | }
41 |
42 | .btn-area {
43 | margin-top: 20rpx;
44 | }
45 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigate.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'navigatePage',
5 | path: 'page/component/pages/navigator/navigate'
6 | }
7 | },
8 |
9 | onLoad(options) {
10 | console.log(options)
11 | this.setData({
12 | title: options.title
13 | })
14 | }
15 | })
16 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigate.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "navigatePage"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigate.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigate.wxss:
--------------------------------------------------------------------------------
1 | /* page/component/pages/navigator/navigate.wxss */
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigator.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'navigator',
5 | path: 'page/component/pages/navigator/navigator'
6 | }
7 | }
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/navigator.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "navigator"
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/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/navigator/redirect.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'redirectPage',
5 | path: 'page/component/pages/navigator/redirect'
6 | }
7 | },
8 |
9 | onLoad(options) {
10 | console.log(options)
11 | this.setData({
12 | title: options.title
13 | })
14 | }
15 | })
16 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/redirect.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "redirectPage"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/redirect.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/page/component/pages/navigator/redirect.wxss:
--------------------------------------------------------------------------------
1 | /* page/component/pages/navigator/redirect.wxss */
--------------------------------------------------------------------------------
/page/component/pages/open-data/open-data.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'open-data',
5 | path: 'page/component/pages/open-data/open-data'
6 | }
7 | },
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/open-data/open-data.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "open-data"
3 | }
--------------------------------------------------------------------------------
/page/component/pages/open-data/open-data.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .avatar {
4 | display: flex;
5 | justify-content: center;
6 | margin-bottom: 50rpx;
7 | }
8 |
9 | .avatar-img {
10 | width: 50%;
11 | border-radius: 50%;
12 | }
13 |
14 | .country, .province, .city {
15 | padding-right: 10rpx;
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/page/component/pages/picker-view/picker-view.js:
--------------------------------------------------------------------------------
1 | const date = new Date()
2 | const years = []
3 | const months = []
4 | const days = []
5 |
6 | for (let i = 1990; i <= date.getFullYear(); i++) {
7 | years.push(i)
8 | }
9 |
10 | for (let i = 1; i <= 12; i++) {
11 | months.push(i)
12 | }
13 |
14 | for (let i = 1; i <= 31; i++) {
15 | days.push(i)
16 | }
17 |
18 | Page({
19 | onShareAppMessage() {
20 | return {
21 | title: 'picker-view',
22 | path: 'page/component/pages/picker-view/picker-view'
23 | }
24 | },
25 |
26 | data: {
27 | years,
28 | year: date.getFullYear(),
29 | months,
30 | month: 2,
31 | days,
32 | day: 2,
33 | value: [9999, 1, 1],
34 | isDaytime: true,
35 | },
36 |
37 | bindChange(e) {
38 | const val = e.detail.value
39 | this.setData({
40 | year: this.data.years[val[0]],
41 | month: this.data.months[val[1]],
42 | day: this.data.days[val[2]],
43 | isDaytime: !val[3]
44 | })
45 | }
46 | })
47 |
--------------------------------------------------------------------------------
/page/component/pages/picker-view/picker-view.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "picker-view"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/picker-view/picker-view.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{year}}年{{month}}月{{day}}日{{isDaytime ? "白天" : "夜晚"}}
9 |
10 |
11 | {{item}}年
12 |
13 |
14 | {{item}}月
15 |
16 |
17 | {{item}}日
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/page/component/pages/picker-view/picker-view.wxss:
--------------------------------------------------------------------------------
1 | .selected-date {
2 | text-align: center;
3 | margin: 30rpx;
4 | }
5 |
6 | .icon-container {
7 | display: flex;
8 | flex-direction: column;
9 | justify-content: center;
10 | align-items: center;
11 | }
12 |
13 | .picker-icon {
14 | width: 50rpx;
15 | height: 50rpx;
16 | }
--------------------------------------------------------------------------------
/page/component/pages/picker/picker.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'picker',
5 | path: 'page/component/pages/picker/picker'
6 | }
7 | },
8 |
9 | data: {
10 | array: ['中国', '美国', '巴西', '日本'],
11 | index: 0,
12 | date: '2016-09-01',
13 | time: '12:01'
14 | },
15 |
16 | bindPickerChange(e) {
17 | console.log('picker发送选择改变,携带值为', e.detail.value)
18 | this.setData({
19 | index: e.detail.value
20 | })
21 | },
22 |
23 | bindDateChange(e) {
24 | this.setData({
25 | date: e.detail.value
26 | })
27 | },
28 |
29 | bindTimeChange(e) {
30 | this.setData({
31 | time: e.detail.value
32 | })
33 | }
34 | })
35 |
--------------------------------------------------------------------------------
/page/component/pages/picker/picker.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "picker"
3 | }
4 |
--------------------------------------------------------------------------------
/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/progress/progress.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'progress',
5 | path: 'page/component/pages/progress/progress'
6 | }
7 | },
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/progress/progress.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "progress"
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/component/pages/radio/radio.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'radio',
5 | path: 'page/component/pages/radio/radio'
6 | }
7 | },
8 |
9 | data: {
10 | items: [
11 | {value: 'USA', name: '美国'},
12 | {value: 'CHN', name: '中国', checked: 'true'},
13 | {value: 'BRA', name: '巴西'},
14 | {value: 'JPN', name: '日本'},
15 | {value: 'ENG', name: '英国'},
16 | {value: 'FRA', name: '法国'},
17 | ]
18 | },
19 |
20 | radioChange(e) {
21 | console.log('radio发生change事件,携带value值为:', e.detail.value)
22 |
23 | const items = this.data.items
24 | for (let i = 0, len = items.length; i < len; ++i) {
25 | items[i].checked = items[i].value === e.detail.value
26 | }
27 |
28 | this.setData({
29 | items
30 | })
31 | }
32 | })
33 |
--------------------------------------------------------------------------------
/page/component/pages/radio/radio.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "radio"
3 | }
4 |
--------------------------------------------------------------------------------
/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/radio/radio.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
2 |
3 | .radio {
4 | margin-right: 20rpx;
5 | }
6 |
--------------------------------------------------------------------------------
/page/component/pages/rich-text/rich-text.js:
--------------------------------------------------------------------------------
1 | const htmlSnip =
2 | `
3 |
Title
4 |
5 | Life is like a box of
6 | chocolates.
7 |
8 |
9 | `
10 |
11 | const nodeSnip =
12 | `Page({
13 | data: {
14 | nodes: [{
15 | name: 'div',
16 | attrs: {
17 | class: 'div_class',
18 | style: 'line-height: 60px; color: red;'
19 | },
20 | children: [{
21 | type: 'text',
22 | text: 'You never know what you're gonna get.'
23 | }]
24 | }]
25 | }
26 | })
27 | `
28 |
29 | Page({
30 | onShareAppMessage() {
31 | return {
32 | title: 'rich-text',
33 | path: 'page/component/pages/rich-text/rich-text'
34 | }
35 | },
36 |
37 | data: {
38 | htmlSnip,
39 | nodeSnip,
40 | renderedByHtml: false,
41 | renderedByNode: false,
42 | nodes: [{
43 | name: 'div',
44 | attrs: {
45 | class: 'div_class',
46 | style: 'line-height: 60px; color: #1AAD19;'
47 | },
48 | children: [{
49 | type: 'text',
50 | text: 'You never know what you\'re gonna get.'
51 | }]
52 | }]
53 | },
54 | renderHtml() {
55 | this.setData({
56 | renderedByHtml: true
57 | })
58 | },
59 | renderNode() {
60 | this.setData({
61 | renderedByNode: true
62 | })
63 | },
64 | enterCode(e) {
65 | console.log(e.detail.value)
66 | this.setData({
67 | htmlSnip: e.detail.value
68 | })
69 | }
70 | })
71 |
--------------------------------------------------------------------------------
/page/component/pages/rich-text/rich-text.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "rich-text"
3 | }
--------------------------------------------------------------------------------
/page/component/pages/rich-text/rich-text.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 通过HTML String渲染
10 |
11 | {{htmlSnip}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 通过节点渲染
21 |
22 | {{nodeSnip}}
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/page/component/pages/rich-text/rich-text.wxss:
--------------------------------------------------------------------------------
1 | .page-content {
2 | width: auto;
3 | margin: 30rpx 0;
4 | padding: 0 50rpx;
5 | }
6 |
7 | .code-fragment {
8 | height: 350rpx;
9 | }
10 |
11 | .code-textarea {
12 | width: auto;
13 | height: 350rpx;
14 | border: 1rpx solid #1AAD19;
15 | }
16 |
17 | .p {
18 | color: #1AAD19;
19 | margin-top: 30rpx;
20 | }
21 |
22 | .space {
23 | display: inline-block;
24 | background: red;
25 | width: 10rpx;
26 | }
27 |
28 | scroll-view {
29 | height: 350rpx;
30 | border: 1rpx solid #1AAD19;
31 | white-space: pre;
32 | padding: 10rpx;
33 | box-sizing: border-box;
34 | }
35 |
--------------------------------------------------------------------------------
/page/component/pages/scroll-view/scroll-view.js:
--------------------------------------------------------------------------------
1 | const order = ['demo1', 'demo2', 'demo3']
2 |
3 | Page({
4 | onShareAppMessage() {
5 | return {
6 | title: 'scroll-view',
7 | path: 'page/component/pages/scroll-view/scroll-view'
8 | }
9 | },
10 |
11 | data: {
12 | toView: 'green'
13 | },
14 |
15 | upper(e) {
16 | console.log(e)
17 | },
18 |
19 | lower(e) {
20 | console.log(e)
21 | },
22 |
23 | scroll(e) {
24 | console.log(e)
25 | },
26 |
27 | scrollToTop() {
28 | this.setAction({
29 | scrollTop: 0
30 | })
31 | },
32 |
33 | tap() {
34 | for (let i = 0; i < order.length; ++i) {
35 | if (order[i] === this.data.toView) {
36 | this.setData({
37 | toView: order[i + 1],
38 | scrollTop: (i + 1) * 200
39 | })
40 | break
41 | }
42 | }
43 | },
44 |
45 | tapMove() {
46 | this.setData({
47 | scrollTop: this.data.scrollTop + 10
48 | })
49 | }
50 | })
51 |
--------------------------------------------------------------------------------
/page/component/pages/scroll-view/scroll-view.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "scroll-view"
3 | }
4 |
--------------------------------------------------------------------------------
/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/component/pages/slider/slider.js:
--------------------------------------------------------------------------------
1 | const pageData = {
2 | onShareAppMessage() {
3 | return {
4 | title: 'slider',
5 | path: 'page/component/pages/slider/slider'
6 | }
7 | },
8 | }
9 |
10 | for (let i = 1; i < 5; ++i) {
11 | (function (index) {
12 | pageData['slider' + index + 'change'] = function (e) {
13 | console.log('slider' + index + '发生change事件,携带值为', e.detail.value)
14 | }
15 | }(i))
16 | }
17 |
18 | Page(pageData)
19 |
--------------------------------------------------------------------------------
/page/component/pages/slider/slider.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "slider"
3 | }
4 |
--------------------------------------------------------------------------------
/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/component/pages/slider/slider.wxss:
--------------------------------------------------------------------------------
1 | /* page/component/pages/slider/slider.wxss */
--------------------------------------------------------------------------------
/page/component/pages/swiper/swiper.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'swiper',
5 | path: 'page/component/pages/swiper/swiper'
6 | }
7 | },
8 |
9 | data: {
10 | background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
11 | indicatorDots: true,
12 | vertical: false,
13 | autoplay: false,
14 | interval: 2000,
15 | duration: 500
16 | },
17 |
18 | changeIndicatorDots() {
19 | this.setData({
20 | indicatorDots: !this.data.indicatorDots
21 | })
22 | },
23 |
24 | changeAutoplay() {
25 | this.setData({
26 | autoplay: !this.data.autoplay
27 | })
28 | },
29 |
30 | intervalChange(e) {
31 | this.setData({
32 | interval: e.detail.value
33 | })
34 | },
35 |
36 | durationChange(e) {
37 | this.setData({
38 | duration: e.detail.value
39 | })
40 | }
41 | })
42 |
--------------------------------------------------------------------------------
/page/component/pages/swiper/swiper.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "swiper"
3 | }
4 |
--------------------------------------------------------------------------------
/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/component/pages/switch/switch.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'switch',
5 | path: 'page/component/pages/switch/switch'
6 | }
7 | },
8 |
9 | switch1Change(e) {
10 | console.log('switch1 发生 change 事件,携带值为', e.detail.value)
11 | },
12 |
13 | switch2Change(e) {
14 | console.log('switch2 发生 change 事件,携带值为', e.detail.value)
15 | }
16 | })
17 |
--------------------------------------------------------------------------------
/page/component/pages/switch/switch.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "switch"
3 | }
4 |
--------------------------------------------------------------------------------
/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/switch/switch.wxss:
--------------------------------------------------------------------------------
1 | @import "../../../common/lib/weui.wxss";
--------------------------------------------------------------------------------
/page/component/pages/text/text.js:
--------------------------------------------------------------------------------
1 | const 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 | onShareAppMessage() {
19 | return {
20 | title: 'text',
21 | path: 'page/component/pages/text/text'
22 | }
23 | },
24 |
25 | data: {
26 | text: '',
27 | canAdd: true,
28 | canRemove: false
29 | },
30 | extraLine: [],
31 |
32 | add() {
33 | this.extraLine.push(texts[this.extraLine.length % 12])
34 | this.setData({
35 | text: this.extraLine.join('\n'),
36 | canAdd: this.extraLine.length < 12,
37 | canRemove: this.extraLine.length > 0
38 | })
39 | setTimeout(() => {
40 | this.setData({
41 | scrollTop: 99999
42 | })
43 | }, 0)
44 | },
45 | remove() {
46 | if (this.extraLine.length > 0) {
47 | this.extraLine.pop()
48 | this.setData({
49 | text: this.extraLine.join('\n'),
50 | canAdd: this.extraLine.length < 12,
51 | canRemove: this.extraLine.length > 0,
52 | })
53 | }
54 | setTimeout(() => {
55 | this.setData({
56 | scrollTop: 99999
57 | })
58 | }, 0)
59 | }
60 | })
61 |
--------------------------------------------------------------------------------
/page/component/pages/text/text.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "text"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/component/pages/textarea/textarea.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'textarea',
5 | path: 'page/component/pages/textarea/textarea'
6 | }
7 | },
8 |
9 | data: {
10 | focus: false
11 | },
12 |
13 | bindTextAreaBlur(e) {
14 | console.log(e.detail.value)
15 | }
16 | })
17 |
--------------------------------------------------------------------------------
/page/component/pages/textarea/textarea.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "textarea"
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
25 |
--------------------------------------------------------------------------------
/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/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 | onShareAppMessage() {
13 | return {
14 | title: 'video',
15 | path: 'page/component/pages/video/video'
16 | }
17 | },
18 |
19 | onReady() {
20 | this.videoContext = wx.createVideoContext('myVideo')
21 | },
22 |
23 | inputValue: '',
24 | data: {
25 | src: '',
26 | danmuList:
27 | [{
28 | text: '第 1s 出现的弹幕',
29 | color: '#ff0000',
30 | time: 1
31 | }, {
32 | text: '第 3s 出现的弹幕',
33 | color: '#ff00ff',
34 | time: 3
35 | }]
36 | },
37 |
38 | bindInputBlur(e) {
39 | this.inputValue = e.detail.value
40 | },
41 |
42 | bindButtonTap() {
43 | const that = this
44 | wx.chooseVideo({
45 | sourceType: ['album', 'camera'],
46 | maxDuration: 60,
47 | camera: ['front', 'back'],
48 | success(res) {
49 | that.setData({
50 | src: res.tempFilePath
51 | })
52 | }
53 | })
54 | },
55 |
56 | bindSendDanmu() {
57 | this.videoContext.sendDanmu({
58 | text: this.inputValue,
59 | color: getRandomColor()
60 | })
61 | },
62 |
63 | videoErrorCallback(e) {
64 | console.log('视频错误信息:')
65 | console.log(e.detail.errMsg)
66 | }
67 | })
68 |
--------------------------------------------------------------------------------
/page/component/pages/video/video.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "video"
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/page/component/pages/view/view.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'view',
5 | path: 'page/component/pages/view/view'
6 | }
7 | },
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/view/view.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "view"
3 | }
4 |
--------------------------------------------------------------------------------
/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/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/component/pages/web-view/web-view.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onShareAppMessage() {
3 | return {
4 | title: 'webview',
5 | path: 'page/component/pages/web-view/web-view'
6 | }
7 | },
8 | })
9 |
--------------------------------------------------------------------------------
/page/component/pages/web-view/web-view.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "webview"
3 | }
4 |
--------------------------------------------------------------------------------
/page/component/pages/web-view/web-view.wxml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/page/component/pages/web-view/web-view.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/pages/web-view/web-view.wxss
--------------------------------------------------------------------------------
/page/component/resources/kind/canvas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/canvas.png
--------------------------------------------------------------------------------
/page/component/resources/kind/content.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/content.png
--------------------------------------------------------------------------------
/page/component/resources/kind/daytime.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/daytime.png
--------------------------------------------------------------------------------
/page/component/resources/kind/form.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/form.png
--------------------------------------------------------------------------------
/page/component/resources/kind/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/logo.png
--------------------------------------------------------------------------------
/page/component/resources/kind/map.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/map.png
--------------------------------------------------------------------------------
/page/component/resources/kind/media.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/media.png
--------------------------------------------------------------------------------
/page/component/resources/kind/nav.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/nav.png
--------------------------------------------------------------------------------
/page/component/resources/kind/night.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/night.png
--------------------------------------------------------------------------------
/page/component/resources/kind/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/open.png
--------------------------------------------------------------------------------
/page/component/resources/kind/view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/kind/view.png
--------------------------------------------------------------------------------
/page/component/resources/pic/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/pic/1.jpg
--------------------------------------------------------------------------------
/page/component/resources/pic/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/pic/2.jpg
--------------------------------------------------------------------------------
/page/component/resources/pic/custom_map_template_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/pic/custom_map_template_1.png
--------------------------------------------------------------------------------
/page/component/resources/pic/custom_map_template_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/pic/custom_map_template_2.png
--------------------------------------------------------------------------------
/page/component/resources/pic/custom_map_template_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/pic/custom_map_template_3.png
--------------------------------------------------------------------------------
/page/component/resources/pic/custom_map_template_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyxxp/miniprogram-xiaoxiao-open/74564deaf8c4d42d7231878a383b805d7de10069/page/component/resources/pic/custom_map_template_4.png
--------------------------------------------------------------------------------
/page/memory/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "XXXXX专属小程序"
3 | }
4 |
--------------------------------------------------------------------------------
/page/memory/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 我们在一起
5 | {{totalDay}}
6 | 天啦!
7 |
8 |
9 | 我们领证
10 | {{totalMarryDay}}
11 | 天啦!
12 |
13 |
14 |
15 |
17 |
18 |
19 |
20 | {{item.pre}}
21 | {{item.desc}}
22 | {{item.center}}
23 | {{item.gap}}
24 | {{item.end}}
25 |
26 |
27 |
--------------------------------------------------------------------------------
/page/memory/index.wxss:
--------------------------------------------------------------------------------
1 | @import "../common/index.wxss";
2 |
3 | .flex-wrp-center-row{
4 | display:flex;
5 | align-items: flex-end;
6 | justify-content: center;
7 | flex-direction:row;
8 | }
9 |
10 | .memory-index-hd {
11 | padding: 40rpx;
12 | text-align: center;
13 | }
14 |
15 | .memory-index-hd-hi {
16 | padding: 0 5rpx 0 5rpx;
17 | font-size: 70rpx;
18 | color: #FF1F71
19 | }
20 |
21 | .memory-index-hd-desc {
22 | padding: 0 0 24rpx 0;
23 | }
24 |
25 | .video_display {
26 | display: flex;
27 | width: auto;
28 | height: 900rpx;
29 | }
30 |
31 | .video_display_none {
32 | display: none;
33 | }
34 |
35 | .task_item_text {
36 | height: auto;
37 | width: auto;
38 | }
39 |
40 | .task_item_text_hide {
41 | height: auto;
42 | width: 0;
43 | display: none;
44 | }
45 |
46 | .task_item_text_finish {
47 | height: auto;
48 | width: auto;
49 | color: #FF1F71
50 | }
51 |
52 | .flex-wrp{
53 | display:flex;
54 | }
55 |
56 | .flex-wrp-item{
57 | display:flex;
58 | padding: 20rpx 0 20rpx 60rpx;
59 | margin: 20rpx 60rpx 0 60rpx;
60 | background-color: #FFFFFF;
61 | border-radius: 4rpx;
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/page/postList/postlist.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "笔记本",
3 | "enablePullDownRefresh": true
4 | }
5 |
--------------------------------------------------------------------------------
/page/postList/postlist.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{item.userInfo.nickName}}
13 | {{item.message}}
14 |
15 | {{item.dateStr}}
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/page/postList/postlist.wxss:
--------------------------------------------------------------------------------
1 | @import "../common/lib/weui.wxss";
2 |
3 | .postCardContainer {
4 | display: flex;
5 | flex-direction: row;
6 | margin: 0rpx 20rpx 30rpx 20rpx;
7 | }
8 |
9 | .postCardInfoListContainer {
10 | display: flex;
11 | flex-grow: 1;
12 | flex-direction: column;
13 | margin: 0rpx 20rpx 50rpx 20rpx;
14 | }
15 |
16 | .postCardAvatar {
17 | height: 80rpx;
18 | width: 80rpx;
19 | border-radius: 50%;
20 | }
21 |
22 | .postName {
23 | font-size: 30rpx;
24 | color: #307691;
25 | }
26 |
27 | .postImage {
28 | height: 550rpx;
29 | width: 550rpx;
30 | border-radius: 5rpx;
31 | }
32 |
33 | .sendBox {
34 | position:fixed;
35 | bottom:0;
36 | display:flex;
37 | width:100%;
38 | justify-content:center;
39 | }
40 |
41 | .sendBtn {
42 | width: 120rpx;
43 | height: 120rpx;
44 | }
--------------------------------------------------------------------------------
/page/postSend/postsend.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "XXXX专属小程序"
3 | }
4 |
--------------------------------------------------------------------------------
/page/postSend/postsend.wxss:
--------------------------------------------------------------------------------
1 | @import "../common/lib/weui.wxss";
2 |
3 |
4 | .sendBtn {
5 | margin: 50rpx 30rpx;
6 | }
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "cloudfunctionRoot": "functions/",
3 | "description": "Project configuration file",
4 | "packOptions": {
5 | "ignore": []
6 | },
7 | "setting": {
8 | "urlCheck": true,
9 | "es6": true,
10 | "postcss": true,
11 | "minified": true,
12 | "newFeature": true,
13 | "autoAudits": false
14 | },
15 | "compileType": "miniprogram",
16 | "libVersion": "2.4.2",
17 | "appid": "wxc1dc735c8a1ec9a9",
18 | "projectname": "wanxiao",
19 | "debugOptions": {
20 | "hidedInDevtools": []
21 | },
22 | "isGameTourist": false,
23 | "condition": {
24 | "search": {
25 | "current": -1,
26 | "list": []
27 | },
28 | "conversation": {
29 | "current": -1,
30 | "list": []
31 | },
32 | "game": {
33 | "currentL": -1,
34 | "list": []
35 | },
36 | "miniprogram": {
37 | "current": -1,
38 | "list": []
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/util/util.js:
--------------------------------------------------------------------------------
1 | function formatTime(time) {
2 | if (typeof time !== 'number' || time < 0) {
3 | return time
4 | }
5 |
6 | const hour = parseInt(time / 3600, 10)
7 | time %= 3600
8 | const minute = parseInt(time / 60, 10)
9 | time = parseInt(time % 60, 10)
10 | const 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 | function fib(n) {
34 | if (n < 1) return 0
35 | if (n <= 2) return 1
36 | return fib(n - 1) + fib(n - 2)
37 | }
38 |
39 | module.exports = {
40 | formatTime,
41 | formatLocation,
42 | fib
43 | }
44 |
--------------------------------------------------------------------------------
/workers/fib/index.js:
--------------------------------------------------------------------------------
1 | function fib(n) {
2 | if (n < 1) return 0
3 | if (n <= 2) return 1
4 | return fib(n - 1) + fib(n - 2)
5 | }
6 |
7 | worker.onMessage(function (msg) {
8 | if (msg.type === 'execFunc_fib') {
9 | worker.postMessage({
10 | type: 'execFunc_fib',
11 | result: fib(msg.params[0])
12 | })
13 | }
14 | })
15 |
--------------------------------------------------------------------------------