├── .gitignore
├── .vscode
└── settings.json
├── LICENSE
├── README.md
├── apis
├── book.js
├── booklist.js
├── classification.js
├── collection.js
├── library.js
├── order.js
├── request.js
├── review.js
└── user.js
├── app.js
├── app.json
├── app.wxss
├── assets
├── 04-26-19-51-00.png
├── 04-26-19-53-08.png
├── 04-26-20-59-19.png
├── component.png
└── ui.png
├── component-demos
├── async-button
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── async-switch
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── collapse
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── index
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── load-more
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── no-data
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── panel
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── popup
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── rate
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── search-bar
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ ├── index.wxss
│ ├── mask.js
│ ├── mask.json
│ ├── mask.wxml
│ └── mask.wxss
├── send-code
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── spinner
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── sticky
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── tab-bar
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── toast
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
└── toptip
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── components
├── async-button
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── async-switch
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── collapse
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── load-more
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── no-data
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── panel
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── popup
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── rate
│ ├── images
│ │ ├── icon_star_full.png
│ │ ├── icon_star_half.png
│ │ └── icon_star_normal.png
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── search-bar
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── send-code
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── spinner
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── sticky-2
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── sticky
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── tab-bar
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── toast
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
└── toptip
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── docs
├── .vuepress
│ ├── config.js
│ └── public
│ │ ├── favicon.ico
│ │ └── ui.sketch
├── README.md
├── guide
│ ├── README.md
│ ├── api.md
│ ├── feature.md
│ ├── front.md
│ └── install.md
├── media
│ ├── admin_1.png
│ ├── admin_2.png
│ ├── android.png
│ ├── component.png
│ ├── functional_architecture.jpg
│ ├── fundebug-1.png
│ ├── fundebug-2.png
│ ├── library_2.png
│ ├── order_status.jpg
│ ├── page_status_indicator.png
│ ├── postman.png
│ ├── sequence_book.jpg
│ ├── sequence_borrow_in_library.jpg
│ ├── softwares.png
│ ├── swagger_ui_1.png
│ ├── swagger_ui_2.png
│ ├── swagger_ui_3.png
│ ├── swagger_ui_4.png
│ ├── ui.png
│ ├── user_identity.jpg
│ ├── weapp_code.png
│ ├── weapp_ui_1.png
│ ├── weapp_ui_2.png
│ ├── weapp_ui_3.png
│ ├── wiki_1.png
│ ├── wiki_2.png
│ ├── wiki_3.png
│ └── wiki_4.png
└── media_待整理
│ ├── sequence_register.jpg
│ ├── sequence_take_book.jpg
│ ├── sys_architecture.jpg
│ ├── user_case_basic.jpg
│ ├── user_case_booklist.jpg
│ ├── user_case_collection.jpg
│ ├── user_case_notice.jpg
│ ├── user_case_order.jpg
│ ├── user_case_recommend.jpg
│ ├── user_case_review.jpg
│ ├── user_case_search.jpg
│ ├── user_case_user.jpg
│ ├── vue_architecture.jpg
│ └── weapp_architecture.jpg
├── images
├── default_avatar.jpg
├── icon_add_to_booklist.png
├── icon_bell.png
├── icon_booklist_fill.png
├── icon_booklist_line.png
├── icon_cart_fill.png
├── icon_cart_line.png
├── icon_certificated.png
├── icon_deposit.png
├── icon_drawer.png
├── icon_empty_booklist.png
├── icon_headlines.png
├── icon_help.png
├── icon_home_fill.png
├── icon_home_line.png
├── icon_in_process.png
├── icon_info.png
├── icon_logout.png
├── icon_me_fill.png
├── icon_me_line.png
├── icon_more.png
├── icon_paper_plane.png
├── icon_review.png
├── icon_review_2.png
├── icon_scan.png
├── icon_setting.png
├── icon_time.png
├── icon_trending_1.png
├── icon_trending_2.png
├── icon_trending_3.png
├── icon_trending_up.png
├── icon_uncertificated.png
├── load_fail.png
├── logo.jpeg
├── miniapp_code.jpg
└── no_data.png
├── pages
├── book-detail
│ ├── book-detail.js
│ ├── book-detail.json
│ ├── book-detail.wxml
│ ├── book-detail.wxss
│ └── children
│ │ ├── add.js
│ │ ├── add.json
│ │ ├── add.wxml
│ │ ├── add.wxss
│ │ ├── children
│ │ ├── library-detail.js
│ │ ├── library-detail.json
│ │ ├── library-detail.wxml
│ │ ├── library-detail.wxss
│ │ ├── result.js
│ │ ├── result.json
│ │ ├── result.wxml
│ │ └── result.wxss
│ │ ├── library-list.js
│ │ ├── library-list.json
│ │ ├── library-list.wxml
│ │ ├── library-list.wxss
│ │ ├── order.js
│ │ ├── order.json
│ │ ├── order.wxml
│ │ ├── order.wxss
│ │ ├── review.js
│ │ ├── review.json
│ │ ├── review.wxml
│ │ └── review.wxss
├── booklist
│ ├── booklist.js
│ ├── booklist.json
│ ├── booklist.wxml
│ ├── booklist.wxss
│ └── children
│ │ ├── booklist-detail.js
│ │ ├── booklist-detail.json
│ │ ├── booklist-detail.wxml
│ │ ├── booklist-detail.wxss
│ │ ├── children
│ │ ├── modify.js
│ │ ├── modify.json
│ │ ├── modify.wxml
│ │ └── modify.wxss
│ │ ├── modify.js
│ │ ├── modify.json
│ │ ├── modify.wxml
│ │ └── modify.wxss
├── cart
│ ├── cart.js
│ ├── cart.json
│ ├── cart.wxml
│ ├── cart.wxss
│ └── children
│ │ ├── help.js
│ │ ├── help.json
│ │ ├── help.wxml
│ │ ├── help.wxss
│ │ ├── qrcode.js
│ │ ├── qrcode.json
│ │ ├── qrcode.wxml
│ │ └── qrcode.wxss
├── components
│ ├── booklist-item
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ └── home-search-bar
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
├── home
│ ├── children
│ │ ├── advanced-search.js
│ │ ├── advanced-search.json
│ │ ├── advanced-search.wxml
│ │ ├── advanced-search.wxss
│ │ ├── classification.js
│ │ ├── classification.json
│ │ ├── classification.wxml
│ │ └── classification.wxss
│ ├── home.js
│ ├── home.json
│ ├── home.wxml
│ └── home.wxss
├── index
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── list
│ ├── book.js
│ ├── book.json
│ ├── book.wxml
│ ├── book.wxss
│ ├── booklist.js
│ ├── booklist.json
│ ├── booklist.wxml
│ └── booklist.wxss
├── profile
│ ├── children
│ │ ├── about.js
│ │ ├── about.json
│ │ ├── about.wxml
│ │ ├── about.wxss
│ │ ├── children
│ │ │ ├── order-detail.js
│ │ │ ├── order-detail.json
│ │ │ ├── order-detail.wxml
│ │ │ ├── order-detail.wxss
│ │ │ ├── personal-information-modify.js
│ │ │ ├── personal-information-modify.json
│ │ │ ├── personal-information-modify.wxml
│ │ │ └── personal-information-modify.wxss
│ │ ├── order-history.js
│ │ ├── order-history.json
│ │ ├── order-history.wxml
│ │ ├── order-history.wxss
│ │ ├── order-ongoing.js
│ │ ├── order-ongoing.json
│ │ ├── order-ongoing.wxml
│ │ ├── order-ongoing.wxss
│ │ ├── personal-information.js
│ │ ├── personal-information.json
│ │ ├── personal-information.wxml
│ │ ├── personal-information.wxss
│ │ ├── qrcode.js
│ │ ├── qrcode.json
│ │ ├── qrcode.wxml
│ │ ├── qrcode.wxss
│ │ ├── review.js
│ │ ├── review.json
│ │ ├── review.wxml
│ │ └── review.wxss
│ ├── navigate.js
│ ├── navigate.json
│ ├── navigate.wxml
│ ├── navigate.wxss
│ ├── profile.js
│ ├── profile.json
│ ├── profile.wxml
│ └── profile.wxss
└── register
│ ├── children
│ ├── result.js
│ ├── result.json
│ ├── result.wxml
│ └── result.wxss
│ ├── register.js
│ ├── register.json
│ ├── register.wxml
│ └── register.wxss
├── project.config.json
├── simplest-mock-server
├── .gitignore
├── Dockerfile
├── README.md
├── README_en.md
├── assets
│ └── 04-16-13-22-37.png
├── example
│ ├── DELETE
│ │ └── api
│ │ │ └── v1
│ │ │ ├── booklists
│ │ │ └── {id}.json
│ │ │ ├── orders
│ │ │ └── {id}.json
│ │ │ └── reviews
│ │ │ └── {id}.json
│ ├── GET
│ │ └── api
│ │ │ └── v1
│ │ │ ├── booklists
│ │ │ ├── recommend
│ │ │ │ └── {phone}.json
│ │ │ ├── search.json
│ │ │ ├── users
│ │ │ │ └── {id}.json
│ │ │ ├── {id}.json
│ │ │ └── {id}
│ │ │ │ └── books.json
│ │ │ ├── books
│ │ │ ├── authors
│ │ │ │ └── {author}.json
│ │ │ ├── classifications
│ │ │ │ └── {class}.json
│ │ │ ├── isbn
│ │ │ │ ├── {isbn}.json
│ │ │ │ └── {isbn}
│ │ │ │ │ └── collections.json
│ │ │ ├── ranking.json
│ │ │ ├── recommend
│ │ │ │ └── {phone}.json
│ │ │ ├── search.json
│ │ │ ├── search
│ │ │ │ └── advanced.json
│ │ │ ├── tags
│ │ │ │ └── {tag}.json
│ │ │ ├── {id}.json
│ │ │ └── {id}
│ │ │ │ ├── collections.json
│ │ │ │ └── reviews.json
│ │ │ ├── classifications
│ │ │ └── {id}
│ │ │ │ └── sons.json
│ │ │ ├── codes
│ │ │ └── check.json
│ │ │ ├── images.json
│ │ │ ├── libraries
│ │ │ └── {id}.json
│ │ │ ├── orders
│ │ │ ├── return.json
│ │ │ ├── users
│ │ │ │ └── {phone}.json
│ │ │ ├── {id}.json
│ │ │ └── {id}
│ │ │ │ └── take.json
│ │ │ ├── reviews
│ │ │ └── {id}.json
│ │ │ ├── users.json
│ │ │ └── users
│ │ │ ├── {phone}.json
│ │ │ └── {phone}
│ │ │ └── reviews.json
│ └── POST
│ │ └── api
│ │ └── v1
│ │ ├── booklists.json
│ │ ├── booklists
│ │ ├── {id}.json
│ │ └── {id}
│ │ │ └── favorite.json
│ │ ├── books
│ │ └── {id}
│ │ │ └── reviews.json
│ │ ├── codes.json
│ │ ├── orders.json
│ │ ├── orders
│ │ ├── {id}.json
│ │ └── {id}
│ │ │ ├── cancel.json
│ │ │ └── renew.json
│ │ └── users
│ │ └── {phone}.json
├── gulpfile.js
├── package-lock.json
├── package.json
├── router.js
└── server.js
├── styles
├── color.wxss
├── font.wxss
├── helper.wxss
├── icon.wxss
├── ui.wxss
└── weui.wxss
├── templates
├── library-list
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── page-status-indicator
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
└── showcase
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
└── utils
├── biz-helper.wxs
├── constant.js
├── constant.wxs
├── es6-promise.js
├── event.js
├── fundebug.0.5.0.min.js
├── permission.js
├── promise-polyfill.js
├── promisify.js
├── qrcode.js
├── tip.js
├── utils.js
└── validator.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | sitemap.json
3 | .DS_Store
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "git.ignoreLimitWarning": true
3 | }
--------------------------------------------------------------------------------
/apis/book.js:
--------------------------------------------------------------------------------
1 | import { get } from './request.js'
2 |
3 | module.exports = {
4 | getBookById: function (id) {
5 | return get(`/books/${id}`)
6 | },
7 | getBookByISBN: function (isbn) {
8 | return get(`/books/isbn/${isbn}`)
9 | },
10 | getRankingBooks: function (start = 0) {
11 | return get(`/books/ranking?start=${start}`)
12 | },
13 | getRecommendedBooksByUserId: function (uid) {
14 | return get(`/books/recommend/${uid}`)
15 | },
16 | getBooksByKeyword: function (keyword, start = 0) {
17 | return get('/books/search', { keyword, start })
18 | },
19 | getBooksByAuthor: function (author, start = 0) {
20 | return get(`/books/authors/${author}?start=${start}`)
21 | },
22 | getBooksByTag: function (tag, start = 0) {
23 | return get(`/books/tags/${tag}?start=${start}`)
24 | },
25 | getBooksByAdvancedSearch: function (params) {
26 | return get('/books/search/advanced', params)
27 | },
28 | getBooksByClassificationNumber: function (classNum, start = 0) {
29 | return get(`/books/classifications/${classNum}?start=${start}`)
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/apis/booklist.js:
--------------------------------------------------------------------------------
1 | import { get, post, del } from './request.js'
2 |
3 | module.exports = {
4 | createBooklist: function (params) {
5 | return post('/booklists', params)
6 | },
7 | getRecommendedBooklistsByUserId: function (uid) {
8 | return get(`/booklists/recommend/${uid}`)
9 | },
10 | getBooklistById: function (id, start = 0) {
11 | return get(`/booklists/${id}?start=${start}`)
12 | },
13 | getBooksByBooklistId: function (id, start = 0) {
14 | return get(`/booklists/${id}/books?start=${start}`)
15 | },
16 | updateBooklistById: function (id, params) {
17 | return post(`/booklists/${id}`, params)
18 | },
19 | deleteBooklistById: function (id) {
20 | return del(`/booklists/${id}`)
21 | },
22 | favoriteBooklistById: function (id) {
23 | return post(`/booklists/${id}/favorite`)
24 | },
25 | getBooklistsByKeyword: function (keyword, start = 0) {
26 | return get('/booklists/search', { keyword, start })
27 | },
28 | getBooklistsByUserId: function (uid, type = 'all') {
29 | return get(`/booklists/users/${uid}?type=${type}`)
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/apis/classification.js:
--------------------------------------------------------------------------------
1 | import { get } from './request.js'
2 |
3 | module.exports = {
4 | getSonNumbersByNumber: function (number, start = 0) {
5 | return get(`/classifications/${number}/sons`, { start })
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/apis/collection.js:
--------------------------------------------------------------------------------
1 | import { get } from './request.js'
2 |
3 | module.exports = {
4 | getCollectionsByBookId: function (id, params = {}) {
5 | return get(`/books/${id}/collections`, params)
6 | },
7 | getCollectionsByBookISBN: function (isbn, params = {}) {
8 | return get(`/books/isbn/${isbn}/collections`, params)
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/apis/library.js:
--------------------------------------------------------------------------------
1 | import { get, post, del } from './request.js'
2 |
3 | module.exports = {
4 | getLibraryById: function (id) {
5 | return get(`/libraries/${id}`)
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/apis/order.js:
--------------------------------------------------------------------------------
1 | import { get, post, del } from './request.js'
2 |
3 | module.exports = {
4 | createOrders: function (params) {
5 | return post('/orders', params)
6 | },
7 | getOrderById: function (id) {
8 | return get(`/orders/${id}`)
9 | },
10 | getOrdersByUserId: function (uid, type, start = 0) {
11 | return get(`/orders/users/${uid}`, { type, start })
12 | },
13 | cancelOrderByOrderId: function (id) {
14 | return post(`/orders/${id}/cancel`)
15 | },
16 | renewBookByOrderId: function (id) {
17 | return post(`/orders/${id}/renew`)
18 | },
19 | deleteOrderByOrderId: function (id) {
20 | return del(`/orders/${id}`)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/apis/review.js:
--------------------------------------------------------------------------------
1 | import { get, post, del } from './request.js'
2 |
3 | module.exports = {
4 | addReviewByBookId: function (id, params) {
5 | return post(`/books/${id}/reviews`, params)
6 | },
7 | getReviewsByBookId: function (id, start = 0) {
8 | return get(`/books/${id}/reviews?start=${start}`)
9 | },
10 | getReviewsByUserId: function (uid, start = 0) {
11 | return get(`/users/${uid}/reviews?start=${start}`)
12 | },
13 | deleteReviewById: function (id) {
14 | return del(`/reviews/${id}`)
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/apis/user.js:
--------------------------------------------------------------------------------
1 | import { BASE_URL, get, post } from './request'
2 | import Promisify from '../utils/promisify'
3 |
4 | module.exports = {
5 | sendCode: function (phone) {
6 | return post(`/codes?phone=${phone}&type=wechat`)
7 | },
8 | checkCode: function (phone, code) {
9 | return get('/codes/check', { phone, code, type: 'wechat' })
10 | },
11 | uploadIdCardImg: function (filepath) {
12 | return Promisify(wx.uploadFile)({
13 | url: `${BASE_URL}/upload`,
14 | filePath: filepath,
15 | name: 'picture'
16 | }).then(res => {
17 | if (res.statusCode != 200) {
18 | try {
19 | res.data = JSON.parse(res.data)
20 | } catch (e) {
21 |
22 | }
23 | wx.showModal({
24 | title: '上传图片失败',
25 | content: (res.data && res.data.message) ? res.data.message : '发生未知错误',
26 | showCancel: false
27 | })
28 | return Promise.reject(new Error('上传图片失败'))
29 | } else {
30 | return res.data
31 | }
32 | })
33 | },
34 | updateUserInfoById: function (id, params) {
35 | return post(`/users/${id}`, params)
36 | },
37 | getUserInfoById: function (id) {
38 | return get(`/users/${id}`)
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | @import 'styles/weui.wxss';
2 | @import 'styles/font.wxss';
3 | @import 'styles/color.wxss';
4 | @import 'styles/icon.wxss';
5 | @import 'styles/ui.wxss';
6 | @import 'styles/helper.wxss';
7 |
8 | /* 组件wxss */
9 | @import "/templates/page-status-indicator/index.wxss";
10 |
11 | page {
12 | background-color: #F0EFF5;
13 | padding-bottom: 1rpx; /* 试图解决 load-more 底部 margin 不显示的问题 */
14 | }
15 |
16 | /**
17 | * 组件展示页相关
18 | */
19 | .page {
20 | min-height: 100vh;
21 | background-color: #F8F8F8;
22 | }
23 |
24 | .page__hd {
25 | padding: 40px;
26 | }
27 |
28 | .page__bd {
29 | padding-bottom: 40px;
30 | }
31 |
32 | .page__bd--spacing {
33 | padding-left: 15px;
34 | padding-right: 15px;
35 | }
36 |
37 | .page__ft {
38 | padding-bottom: 10px;
39 | text-align: center;
40 | }
41 |
42 | .page__title {
43 | text-align: left;
44 | font-size: 20px;
45 | font-weight: 400;
46 | }
47 |
48 | .page__desc {
49 | margin-top: 5px;
50 | color: #888888;
51 | text-align: left;
52 | font-size: 14px;
53 | }
54 | .page__bd > .page__desc {
55 | margin-left: 15px;
56 | }
57 | .page__bd.page__bd--spacing > .page__desc {
58 | margin-left: 0;
59 | }
60 |
61 | .page__section-title {
62 | margin-top: 1.2em;
63 | margin-left: 15px;
64 | margin-bottom: .6em;
65 | /*color: #353535;*/
66 | text-align: left;
67 | font-size: 14px;
68 | /*font-weight: bold;*/
69 | }
70 |
71 | .page__section-title--first {
72 | margin-top: 0;
73 | }
74 |
75 | .page__bd--spacing > .page__section-title {
76 | margin-left: 0;
77 | }
78 |
79 | .page__placeholder {
80 | padding: 50px 0;
81 | text-align: center;
82 | }
--------------------------------------------------------------------------------
/assets/04-26-19-51-00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/assets/04-26-19-51-00.png
--------------------------------------------------------------------------------
/assets/04-26-19-53-08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/assets/04-26-19-53-08.png
--------------------------------------------------------------------------------
/assets/04-26-20-59-19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/assets/04-26-20-59-19.png
--------------------------------------------------------------------------------
/assets/component.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/assets/component.png
--------------------------------------------------------------------------------
/assets/ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/assets/ui.png
--------------------------------------------------------------------------------
/component-demos/async-button/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 | loading: true
5 | },
6 |
7 | onLoading: function () {
8 | this.setData({loading: true})
9 | },
10 |
11 | onCancelLoading: function () {
12 | this.setData({loading: false})
13 | }
14 | })
15 |
--------------------------------------------------------------------------------
/component-demos/async-button/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "AsyncButton",
3 | "usingComponents": {
4 | "async-button": "/components/async-button/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/async-button/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | AsyncButton
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 | tap
30 |
31 |
--------------------------------------------------------------------------------
/component-demos/async-button/index.wxss:
--------------------------------------------------------------------------------
1 | .big-button-area > async-button {
2 | display: block;
3 | margin-bottom: 15px;
4 | }
5 |
6 | .big-button-area > async-button:last-child {
7 | margin-bottom: 0;
8 | }
9 |
10 | .mini-button-area > async-button {
11 | margin-right: 6px;
12 | }
--------------------------------------------------------------------------------
/component-demos/async-switch/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 | loading: false,
5 | checked: false
6 | },
7 |
8 | onToggleSwitch: function () {
9 | this.setData({loading: true})
10 | setTimeout(() => this.setData({
11 | loading: false,
12 | checked: !this.data.checked
13 | }), 800)
14 | }
15 | })
16 |
--------------------------------------------------------------------------------
/component-demos/async-switch/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "AsyncSwitch",
3 | "usingComponents": {
4 | "async-switch": "/components/async-switch/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/async-switch/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | AsyncSwitch
4 | 异步开关
5 |
6 |
7 | 点击切换状态
8 |
9 |
10 | 加载状态
11 |
12 |
13 | 选中状态
14 |
15 |
16 | 禁用状态
17 |
18 |
19 |
20 | 事件
21 | switch
22 |
23 |
--------------------------------------------------------------------------------
/component-demos/async-switch/index.wxss:
--------------------------------------------------------------------------------
1 | async-switch {
2 | display: inline-block;
3 | margin-right: 20px;
4 | }
--------------------------------------------------------------------------------
/component-demos/collapse/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 | },
5 |
6 | onShowCollapse: function () {
7 | wx.showModal({
8 | content: '显示 collapse 内容',
9 | showCancel: false
10 | })
11 | },
12 |
13 | onHideCollapse: function () {
14 | wx.showModal({
15 | content: '隐藏 collapse 内容',
16 | showCancel: false
17 | })
18 | },
19 |
20 | onTapAction: function () {
21 | wx.showModal({
22 | content: '点击了操作按钮',
23 | showCancel: false
24 | })
25 | }
26 | })
27 |
--------------------------------------------------------------------------------
/component-demos/collapse/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "Collapse",
3 | "usingComponents": {
4 | "collapse": "/components/collapse/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/collapse/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Collapse
4 | 折叠面板
5 |
6 |
7 | 基本用法
8 |
9 |
10 | 这是 collapse 的内容
11 |
12 |
13 |
14 | 带有操作按钮
15 |
16 |
17 | 这是 collapse 的内容
18 |
19 |
20 |
21 | 自定义标题样式
22 |
23 |
24 | 这是 collapse 的内容
25 |
26 |
27 | 注意:自定义样式类的优先级是未知的
28 |
29 | 事件
30 |
31 |
32 | 这是 collapse 的内容
33 |
34 |
35 | show / hide / tapaction
36 |
37 |
--------------------------------------------------------------------------------
/component-demos/collapse/index.wxss:
--------------------------------------------------------------------------------
1 | .container {
2 | border: 1px solid #eee;
3 | }
4 |
5 | .custom-header {
6 | color: red !important;
7 | }
--------------------------------------------------------------------------------
/component-demos/index/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 | components: [
5 | {
6 | title: 'AsyncButton 异步圆角线性按钮',
7 | url: '../async-button/index'
8 | },
9 | {
10 | title: 'AsyncSwitch 异步开关',
11 | url: '../async-switch/index'
12 | },
13 | {
14 | title: 'Collapse 折叠面板',
15 | url: '../collapse/index'
16 | },
17 | {
18 | title: 'LoadMore 加载更多',
19 | url: '../load-more/index'
20 | },
21 | {
22 | title: 'NoData 暂无数据',
23 | url: '../no-data/index'
24 | },
25 | {
26 | title: 'Panel 带有一个导航标题栏的面板',
27 | url: '../panel/index'
28 | },
29 | {
30 | title: 'Popup 底部弹出菜单',
31 | url: '../popup/index'
32 | },
33 | {
34 | title: 'Rate 评分',
35 | url: '../rate/index'
36 | },
37 | {
38 | title: 'SearchBar 搜索框',
39 | url: '../search-bar/index'
40 | },
41 | {
42 | title: 'SendCode 发送短信按钮',
43 | url: '../send-code/index'
44 | },
45 | {
46 | title: 'Spinner 加载样式',
47 | url: '../spinner/index'
48 | },
49 | {
50 | title: 'Sticky 吸顶元素',
51 | url: '../sticky/index'
52 | },
53 | {
54 | title: 'TabBar 选项卡',
55 | url: '../tab-bar/index'
56 | },
57 | {
58 | title: 'Toast 浮动提示',
59 | url: '../toast/index'
60 | },
61 | {
62 | title: 'TopTip 顶部提示',
63 | url: '../toptip/index'
64 | }
65 | ]
66 | }
67 | })
68 |
--------------------------------------------------------------------------------
/component-demos/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "组件展示"
3 | }
--------------------------------------------------------------------------------
/component-demos/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 组件展示
4 | 微信小程序组件封装
5 |
6 |
7 |
8 |
9 | {{item.title}}
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/component-demos/index/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/component-demos/index/index.wxss
--------------------------------------------------------------------------------
/component-demos/load-more/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({})
3 |
--------------------------------------------------------------------------------
/component-demos/load-more/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "LoadMore",
3 | "usingComponents": {
4 | "load-more": "/components/load-more/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/load-more/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | LoadMore
4 | 加载更多
5 |
6 |
7 | 基本用法
8 |
9 |
10 |
11 | 自定义文字
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/component-demos/load-more/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/component-demos/load-more/index.wxss
--------------------------------------------------------------------------------
/component-demos/no-data/index.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/component-demos/no-data/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "NoData",
3 | "usingComponents": {
4 | "no-data": "/components/no-data/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/no-data/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | NoData
4 | 暂无数据
5 |
6 |
7 | 基本用法
8 |
9 |
10 | 自定义文字
11 |
12 |
13 |
--------------------------------------------------------------------------------
/component-demos/no-data/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/component-demos/no-data/index.wxss
--------------------------------------------------------------------------------
/component-demos/panel/index.js:
--------------------------------------------------------------------------------
1 | // component-demos/panel/index.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/component-demos/panel/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "Panel",
3 | "usingComponents": {
4 | "panel": "/components/panel/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/panel/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Panel
4 | 带有一个导航标题栏的面板
5 |
6 |
7 |
8 |
9 | 这是 panel 的内容
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/component-demos/panel/index.wxss:
--------------------------------------------------------------------------------
1 | /* component-demos/panel/index.wxss */
--------------------------------------------------------------------------------
/component-demos/popup/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 | show: [false, false, false, false]
5 | },
6 |
7 | onShowPopup: function (e) {
8 | this.data.show[e.currentTarget.id] = true
9 | this.setData({show: this.data.show})
10 | },
11 |
12 | onHidePopup: function (e) {
13 | this.data.show[e.currentTarget.id] = false
14 | this.setData({show: this.data.show})
15 | if (e.currentTarget.id == 3) {
16 | wx.showModal({content: '关闭了 popup', showCancel: false})
17 | }
18 | }
19 | })
20 |
--------------------------------------------------------------------------------
/component-demos/popup/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "Popup",
3 | "usingComponents": {
4 | "popup": "/components/popup/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/popup/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Popup
4 | 底部弹出菜单
5 |
6 |
7 | 基本用法
8 |
9 |
10 |
11 | 这是 popup 的内容
12 |
13 |
14 |
15 | 自定义文字
16 |
17 |
18 |
19 | 这是 popup 的内容
20 |
21 |
22 |
23 | 点击背景无法关闭
24 |
25 |
26 |
27 | 这是 popup 的内容
28 |
29 |
30 |
31 | 事件
32 |
33 |
34 |
35 | 这是 popup 的内容
36 |
37 |
38 | hide
39 |
40 |
--------------------------------------------------------------------------------
/component-demos/popup/index.wxss:
--------------------------------------------------------------------------------
1 | .weui-btn {
2 | margin-top: 0;
3 | }
--------------------------------------------------------------------------------
/component-demos/rate/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | onChange: function (e) {
4 | console.log(e)
5 | wx.showModal({
6 | content: `当前评分: ${e.detail.value}`,
7 | showCancel: false
8 | })
9 | }
10 | })
11 |
--------------------------------------------------------------------------------
/component-demos/rate/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "Rate",
3 | "usingComponents": {
4 | "rate": "/components/rate/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/rate/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Rate
4 | 可打半星的评分组件,默认满分 10 分
5 |
6 |
7 | 基本用法
8 |
9 |
10 |
11 |
12 | 每颗星 2 分,半颗星 1 分
13 |
14 | 自定义大小与间距
15 |
16 |
17 |
18 |
19 |
20 | 大小与间距的单位默认为 px,可选 rpx
21 |
22 | 禁用状态
23 |
24 |
25 | 事件
26 |
27 | change: { value: 当前评分 }
28 |
29 |
--------------------------------------------------------------------------------
/component-demos/rate/index.wxss:
--------------------------------------------------------------------------------
1 | .rate-area > rate {
2 | display: block;
3 | margin-bottom: 15px;
4 | }
5 |
6 | .rate-area > rate:last-child {
7 | margin-bottom: 0;
8 | }
--------------------------------------------------------------------------------
/component-demos/search-bar/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 | eventInfo: '点击输入框进行操作'
5 | },
6 |
7 | onEvent: function (e) {
8 | console.log(e)
9 |
10 | switch (e.type) {
11 | case 'focus':
12 | this.setData({eventInfo: '触发 focus 事件'})
13 | break
14 | case 'input':
15 | this.setData({eventInfo: `触发 input 事件,输入框内容:${e.detail.value}`})
16 | break
17 | case 'clear':
18 | this.setData({eventInfo: '触发 clear 事件'})
19 | break
20 | case 'hide':
21 | this.setData({eventInfo: '触发 hide 事件'})
22 | break
23 | case 'search':
24 | this.setData({eventInfo: `触发 search 事件,输入框内容:${e.detail.value}`})
25 | break
26 | }
27 | }
28 | })
29 |
--------------------------------------------------------------------------------
/component-demos/search-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "SearchBar",
3 | "usingComponents": {
4 | "search-bar": "/components/search-bar/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/search-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SearchBar
4 | 搜索框
5 |
6 |
7 | 基本用法
8 |
9 |
10 | 自定义文字
11 |
12 |
13 | 显示遮罩背景
14 |
15 |
16 | 点击遮罩背景可关闭
17 |
18 |
19 |
20 | 点击遮罩背景不可关闭
21 |
22 |
23 |
24 |
25 | 事件
26 | {{eventInfo}}
27 |
28 | focus / input / clear / hide / search
29 | input / search: { value: 输入框内容 }
30 | 输入框内容为空时不触发 search 事件
31 |
32 |
--------------------------------------------------------------------------------
/component-demos/search-bar/index.wxss:
--------------------------------------------------------------------------------
1 | .event-info {
2 | margin-top: -10px;
3 | margin-bottom: 5px;
4 | line-height: 1.8em;
5 | text-align: center;
6 | font-size: 14px;
7 | color: #888;
8 | }
--------------------------------------------------------------------------------
/component-demos/search-bar/mask.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | tappable: false
4 | },
5 |
6 | onLoad: function (options) {
7 | if (options.tappable) {
8 | this.setData({tappable: true})
9 | }
10 | }
11 | })
12 |
--------------------------------------------------------------------------------
/component-demos/search-bar/mask.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "SearchBar",
3 | "usingComponents": {
4 | "search-bar": "/components/search-bar/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/search-bar/mask.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/component-demos/search-bar/mask.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/component-demos/search-bar/mask.wxss
--------------------------------------------------------------------------------
/component-demos/send-code/index.js:
--------------------------------------------------------------------------------
1 |
2 | var sendBtns // 保存send-code组件的引用
3 |
4 | Page({
5 | onReady: function () {
6 | sendBtns = [
7 | this.selectComponent('#send-btn-1'),
8 | this.selectComponent('#send-btn-2'),
9 | this.selectComponent('#send-btn-3'),
10 | this.selectComponent('#send-btn-4')
11 | ]
12 | },
13 |
14 | onSend: function (e) {
15 | let btn
16 |
17 | switch (e.target.id) {
18 | case 'send-btn-1':
19 | btn = sendBtns[0]
20 | break
21 | case 'send-btn-2':
22 | btn = sendBtns[1]
23 | break
24 | case 'send-btn-3':
25 | btn = sendBtns[2]
26 | break
27 | case 'send-btn-4':
28 | wx.showModal({content: '点击发送按钮', showCancel: false})
29 | btn = sendBtns[3]
30 | break
31 | }
32 |
33 | btn.prepare()
34 | setTimeout(() => btn.start(), 1000)
35 | },
36 |
37 | onEnd: function () {
38 | wx.showModal({content: '倒计时结束', showCancel: false})
39 | }
40 | })
41 |
--------------------------------------------------------------------------------
/component-demos/send-code/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "SendCode",
3 | "usingComponents": {
4 | "send-code": "/components/send-code/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/send-code/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/component-demos/send-code/index.wxss
--------------------------------------------------------------------------------
/component-demos/spinner/index.js:
--------------------------------------------------------------------------------
1 | // component-demos/spinner/index.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/component-demos/spinner/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "Spinner",
3 | "usingComponents": {
4 | "spinner": "/components/spinner/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/spinner/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Spinner
4 | 加载样式
5 |
6 |
7 | 基本用法
8 |
9 |
10 |
11 |
12 | 自定义颜色
13 |
14 |
15 |
16 | 样式
17 | line-scale / line-scale-pulse-out / ball-pulse-sync
18 |
19 |
--------------------------------------------------------------------------------
/component-demos/spinner/index.wxss:
--------------------------------------------------------------------------------
1 | spinner {
2 | display: block;
3 | margin: 10px 0;
4 | }
--------------------------------------------------------------------------------
/component-demos/sticky/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 | scrollTop: 0,
5 | eventInfo: {}
6 | },
7 |
8 | onPageScroll: function (e) {
9 | this.setData({scrollTop: e.scrollTop})
10 | },
11 |
12 | onSticky: function (e) {
13 | this.setData({eventInfo: e.detail})
14 | }
15 | })
16 |
--------------------------------------------------------------------------------
/component-demos/sticky/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "Sticky",
3 | "usingComponents": {
4 | "sticky": "/components/sticky/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/sticky/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sticky
4 | 吸顶元素
5 |
6 |
7 | 基本用法
8 |
9 |
10 |
11 |
12 |
13 | 自定义与顶部的距离
14 |
15 |
16 |
17 |
18 |
19 | 事件
20 |
21 |
25 |
29 |
30 | stickystart / stickyend:开始固定 / 结束固定
31 | 事件对象为元素的布局信息 { left, top, right, bottom }
32 |
33 |
34 |
35 |
36 | 占位元素
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/component-demos/sticky/index.wxss:
--------------------------------------------------------------------------------
1 | .sticky-header1 {
2 | padding: 10px 20px;
3 | line-height: 30px;
4 | background-color: #fff;
5 | border-color: 1px solid #eee;
6 | }
7 |
8 | .sticky-header2 {
9 | padding: 10px 20px;
10 | line-height: 30px;
11 | background-color: #ddd;
12 | border-color: 1px solid #eee;
13 | }
14 |
15 | .sticky-header3 {
16 | padding: 10px 20px;
17 | background-color: #fff;
18 | border-color: 1px solid #eee;
19 | }
--------------------------------------------------------------------------------
/component-demos/tab-bar/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | onActiveTab: function (e) {
4 | let tabs = this.selectComponent('#tab-bar')
5 | tabs.setActiveIndex((e.currentTarget.dataset.index - 0 + 1) % 4)
6 | }
7 | })
8 |
--------------------------------------------------------------------------------
/component-demos/tab-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "TabBar",
3 | "usingComponents": {
4 | "tab-bar": "/components/tab-bar/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/tab-bar/index.wxss:
--------------------------------------------------------------------------------
1 | .container {
2 | border: 1px solid #eee;
3 | background-color: #fff;
4 | }
--------------------------------------------------------------------------------
/component-demos/toast/index.js:
--------------------------------------------------------------------------------
1 |
2 | var toast
3 |
4 | Page({
5 | onReady: function () {
6 | toast = this.selectComponent('#toast')
7 | },
8 |
9 | onShowDefault: function () {
10 | toast.show('我是一个浮动提示')
11 | },
12 |
13 | onShowPostion: function (e) {
14 | let position = e.currentTarget.dataset.pos
15 | toast.show('我是一个浮动提示', { position })
16 | },
17 |
18 | onShowDuration: function () {
19 | toast.show('我在五秒钟后会消失', {duration: 5000})
20 | }
21 | })
22 |
--------------------------------------------------------------------------------
/component-demos/toast/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "Toast",
3 | "usingComponents": {
4 | "toast": "/components/toast/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/toast/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Toast
6 | 浮动提示,默认显示在底部 3 秒
7 |
8 |
9 | 基本用法
10 |
11 |
12 |
13 |
14 | 提示位置
15 |
16 |
17 |
18 |
19 |
20 | 自定义显示时长
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/component-demos/toast/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/component-demos/toast/index.wxss
--------------------------------------------------------------------------------
/component-demos/toptip/index.js:
--------------------------------------------------------------------------------
1 |
2 | var toptip
3 |
4 | Page({
5 | onReady: function () {
6 | toptip = this.selectComponent('#toptip')
7 | },
8 |
9 | onShowDefault: function () {
10 | toptip.show('我是一个顶部提示')
11 | },
12 |
13 | onShowType: function (e) {
14 | let type = e.currentTarget.dataset.type
15 | toptip.show('我是一个顶部提示', { type })
16 | },
17 |
18 | onShowDuration: function () {
19 | toptip.show('我在五秒钟后会消失', {duration: 5000})
20 | }
21 | })
22 |
--------------------------------------------------------------------------------
/component-demos/toptip/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "TopTip",
3 | "usingComponents": {
4 | "toptip": "/components/toptip/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/component-demos/toptip/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | TopTip
6 | 顶部提示,默认为 error 类型,显示 3 秒
7 |
8 |
9 | 基本用法
10 |
11 |
12 |
13 |
14 | 提示类型
15 |
16 |
17 |
18 |
19 |
20 | 自定义显示时长
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/component-demos/toptip/index.wxss:
--------------------------------------------------------------------------------
1 | /* component-demos/toptip/index.wxss */
--------------------------------------------------------------------------------
/components/async-button/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 异步圆角线性按钮:加载中、禁用
3 | * @event
4 | */
5 | Component({
6 | properties: {
7 | // 按钮文字
8 | text: String,
9 | // 是否正在加载
10 | loading: {
11 | type: Boolean,
12 | value: false
13 | },
14 | // 按钮类型: primary, default, warn
15 | type: {
16 | type: String,
17 | value: 'primary'
18 | },
19 | // 按钮大小:default,mini
20 | size: {
21 | type: String,
22 | value: 'default'
23 | },
24 | // 是否禁用
25 | disabled: {
26 | type: Boolean,
27 | value: false
28 | }
29 | },
30 |
31 | methods: {
32 | _onTap: function () {
33 | let loading = this.data.loading
34 | let disabled = this.data.disabled
35 | if (loading || disabled) return
36 | else this.triggerEvent('tap')
37 | }
38 | }
39 | })
40 |
--------------------------------------------------------------------------------
/components/async-button/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/async-button/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/async-switch/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 异步开关:同步、异步、禁用
3 | * @event
4 | */
5 | Component({
6 | properties: {
7 | // 是否禁用
8 | disabled: {
9 | type: Boolean,
10 | value: false
11 | },
12 | // 是否选中
13 | checked: {
14 | type: Boolean,
15 | value: false
16 | },
17 | // 是否正在加载
18 | loading: {
19 | type: Boolean,
20 | value: false
21 | }
22 | },
23 |
24 | methods: {
25 | _onTap: function () {
26 | {
27 | let loading = this.data.loading
28 | let disabled = this.data.disabled
29 |
30 | if (loading || disabled) return
31 |
32 | this.triggerEvent('switch')
33 | }
34 | }
35 | }
36 | })
37 |
--------------------------------------------------------------------------------
/components/async-switch/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/async-switch/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/components/collapse/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 折叠面板
4 | * TODO --- 动画展开
5 | * slot:折叠区域
6 | * @event
7 | */
8 | Component({
9 | options: {
10 | multipleSlots: true
11 | },
12 | properties: {
13 | // 标题
14 | title: String,
15 | // 标题栏右侧操作按钮的文字
16 | actionText: {
17 | type: String,
18 | value: ''
19 | },
20 | show: {
21 | type: Boolean,
22 | value: true
23 | }
24 | },
25 | externalClasses: ['header-class'], // 自定义标题类
26 | methods: {
27 | _toggle: function () {
28 | this.setData({show: !this.data.show})
29 | if (this.data.show) {
30 | this.triggerEvent('show')
31 | } else {
32 | this.triggerEvent('hide')
33 | }
34 | },
35 | _onTapAction: function () {
36 | this.triggerEvent('tapaction')
37 | }
38 | }
39 | })
40 |
--------------------------------------------------------------------------------
/components/collapse/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/collapse/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/components/collapse/index.wxss:
--------------------------------------------------------------------------------
1 |
2 | .collapse__header {
3 | position: relative;
4 | padding: 20rpx 30rpx 10rpx 30rpx;
5 | background-color: #f5f5f5;
6 | border-top: 1rpx solid #e5e5e5;
7 | border-bottom: 1rpx solid #e5e5e5;
8 | }
9 |
10 | .collapse__header-action {
11 | position: absolute;
12 | right: 30rpx;
13 | top: 20rpx;
14 | min-width: 15%;
15 | text-align: right;
16 | color: #09BB07;
17 | }
18 |
19 | .collapse__body {
20 | display: none;
21 | }
22 |
23 | .collapse__body--show {
24 | display: block;
25 | }
26 |
27 |
28 | /* 通用样式类 */
29 |
30 | .font-gray-28 {
31 | color: #888;
32 | font-size: 28rpx
33 | }
34 |
35 | .icon-right,
36 | .icon-down {
37 | display: inline-block;
38 | padding-right: 13rpx;
39 | position: relative;
40 | }
41 |
42 | .icon-right::after,
43 | .icon-down::after {
44 | content: "";
45 | display: inline-block;
46 | position: relative;
47 | bottom: 2rpx;
48 | height: 6px;
49 | width: 6px;
50 | border-width: 2px 2px 0 0;
51 | border-style: solid;
52 | }
53 |
54 | .icon-right::after {
55 | -webkit-transform: rotate(45deg);
56 | transform: rotate(45deg);
57 | }
58 |
59 | .icon-down::after {
60 | bottom: 4rpx;
61 | -webkit-transform: rotate(135deg);
62 | transform: rotate(135deg);
63 | }
64 |
--------------------------------------------------------------------------------
/components/load-more/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 加载更多
4 | */
5 | Component({
6 | properties: {
7 | status: {
8 | type: String,
9 | value: 'loading' // nomore, hidding
10 | },
11 | loadingText: {
12 | type: String,
13 | value: '正在加载'
14 | },
15 | nomoreText: {
16 | type: String,
17 | value: '没有更多数据了'
18 | }
19 | }
20 | })
21 |
--------------------------------------------------------------------------------
/components/load-more/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/load-more/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{loadingText}}
4 |
5 |
6 | {{nomoreText}}
7 |
8 |
--------------------------------------------------------------------------------
/components/no-data/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 暂无数据
4 | */
5 | Component({
6 | properties: {
7 | text: {
8 | type: String,
9 | value: '暂无数据'
10 | }
11 | }
12 | })
13 |
--------------------------------------------------------------------------------
/components/no-data/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/no-data/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ text || "暂无数据" }}
4 |
--------------------------------------------------------------------------------
/components/no-data/index.wxss:
--------------------------------------------------------------------------------
1 | icon {
2 | color: #ccc;
3 | }
4 |
5 | .no-data {
6 | text-align: center;
7 | margin: 30px 0;
8 | }
9 |
10 | .no-data__text {
11 | text-align: center;
12 | display: block;
13 | color: #aaa;
14 | margin: 6px 0 0 0;
15 | }
--------------------------------------------------------------------------------
/components/panel/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 带有一个导航标题栏的面板
4 | * slot: 面板内容
5 | */
6 | Component({
7 | properties: {
8 | url: String,
9 | title: String
10 | }
11 | })
12 |
--------------------------------------------------------------------------------
/components/panel/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/panel/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{title}}
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/components/panel/index.wxss:
--------------------------------------------------------------------------------
1 | .panel {
2 | position: relative;
3 | overflow: hidden;
4 | background-color: #FFFFFF;
5 | }
6 |
7 | .panel:before {
8 | content: " ";
9 | position: absolute;
10 | left: 0;
11 | top: 0;
12 | right: 0;
13 | height: 1px;
14 | border-top: 1rpx solid #E5E5E5;
15 | color: #E5E5E5;
16 | }
17 | .panel:after {
18 | content: " ";
19 | position: absolute;
20 | left: 0;
21 | bottom: 0;
22 | right: 0;
23 | height: 1px;
24 | border-bottom: 1rpx solid #E5E5E5;
25 | color: #E5E5E5;
26 | }
27 | .panel-hd {
28 | padding: 14px 15px 10px;
29 | color: #999999;
30 | font-size: 13px;
31 | position: relative;
32 | }
33 | .panel-hd:after {
34 | content: " ";
35 | position: absolute;
36 | left: 0;
37 | bottom: 0;
38 | right: 0;
39 | height: 1px;
40 | border-bottom: 1rpx solid #E5E5E5;
41 | color: #E5E5E5;
42 | left: 15px;
43 | }
44 | .panel-hd--active {
45 | background-color: #ECECEC !important;
46 | }
47 | .panel-hd__arrow {
48 | position: absolute;
49 | right: 15px;
50 | top: 50%;
51 | display: inline-block;
52 | height: 6px;
53 | width: 6px;
54 | border-width: 2px 2px 0 0;
55 | border-color: #c8c8c8;
56 | border-style: solid;
57 | transform: translateY(-50%) matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
58 | }
59 |
--------------------------------------------------------------------------------
/components/popup/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 底部弹出菜单
4 | * slot:菜单内容
5 | * @event
6 | */
7 | Component({
8 | properties: {
9 | // 点击背景是否自动关闭,默认是
10 | tappableMask: {
11 | type: Boolean,
12 | value: true
13 | },
14 | // 菜单标题
15 | title: String,
16 | // 关闭按钮文字
17 | hideText: {
18 | type: String,
19 | value: '关闭'
20 | },
21 | // 由父组件控制菜单显示
22 | show: {
23 | type: Boolean,
24 | value: false
25 | }
26 | },
27 |
28 | methods: {
29 | _onTapMask: function () {
30 | // 原来这里会直接设置 show 为 false
31 | // 现在只触发事件,由父组件设置 show 属性
32 | if (this.data.tappableMask) {
33 | this.triggerEvent('hide')
34 | }
35 | },
36 | _onHide: function () {
37 | this.triggerEvent('hide')
38 | }
39 | }
40 | })
41 |
--------------------------------------------------------------------------------
/components/popup/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/popup/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/popup/index.wxss:
--------------------------------------------------------------------------------
1 | .popup__mask {
2 | z-index: 450;
3 | position: fixed;
4 | top: 0;
5 | left: 0;
6 | right: 0;
7 | bottom: 0;
8 | background: rgba(0, 0, 0, 0.7);
9 | display: none;
10 | }
11 | .popup__container {
12 | z-index: 480;
13 | position: fixed;
14 | left: 0;
15 | bottom: 0;
16 | width: 100%;
17 | max-height: 100vh;
18 | overflow: scroll;
19 | /* width: 100vw; */
20 | background: white;
21 | transform: translateY(150%);
22 | transition: all 0.4s ease;
23 | }
24 | .popup--show .popup__container {
25 | transform: translateY(0);
26 | }
27 | .popup--show .popup__mask {
28 | display: block;
29 | }
30 |
31 | .popup__hd {
32 | padding: 15px 15px 9px;
33 | line-height: 1em;
34 | border-bottom: 1rpx solid #D9D9D9;
35 | }
36 |
37 | .popup__hd-title {
38 | display: inline-block;
39 | width: 50%;
40 | font-size: 14px;
41 | color: #888;
42 | }
43 |
44 | .popup__hd-close {
45 | display: inline-block;
46 | width: 50%;
47 | font-size: 14px;
48 | color: #09BB07;
49 | }
50 |
51 | .popup__hd-title {
52 | text-align: left;
53 | }
54 |
55 | .popup__hd-close {
56 | text-align: right;
57 | }
--------------------------------------------------------------------------------
/components/rate/images/icon_star_full.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/components/rate/images/icon_star_full.png
--------------------------------------------------------------------------------
/components/rate/images/icon_star_half.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/components/rate/images/icon_star_half.png
--------------------------------------------------------------------------------
/components/rate/images/icon_star_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/components/rate/images/icon_star_normal.png
--------------------------------------------------------------------------------
/components/rate/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 可打半星的评分组件,默认满分10分
4 | * @event
5 | */
6 | Component({
7 | properties: {
8 | // 当前评分
9 | value: Number,
10 | // 是否禁用
11 | disabled: {
12 | type: Boolean,
13 | value: false
14 | },
15 | // 五角星个数
16 | number: {
17 | type: Number,
18 | value: 5
19 | },
20 | // 五角星大小
21 | starSize: {
22 | type: String,
23 | value: 30
24 | },
25 | // 五角星间距大小
26 | gutterSize: {
27 | type: Number,
28 | value: 0
29 | },
30 | // 大小单位:px,rpx
31 | unit: {
32 | type: String,
33 | value: 'px'
34 | }
35 | },
36 |
37 | data: {
38 | // 满星、半星、空星图片url
39 | fullSrc: './images/icon_star_full.png',
40 | halfSrc: './images/icon_star_half.png',
41 | normalSrc: './images/icon_star_normal.png',
42 |
43 | // wx-for 中的辅助数组,为每颗星星设置 value
44 | starArray: []
45 | },
46 |
47 | attached: function () {
48 | let t = 0
49 | let ta = []
50 | for (let i = 0; i < this.properties.number; i++, t += 2) {
51 | ta.push(t)
52 | }
53 | this.setData({starArray: ta})
54 | },
55 |
56 | methods: {
57 | // 点击左边选择半颗星
58 | _onTapLeft: function (e) {
59 | if (this.data.disabled) return
60 | let value = e.currentTarget.dataset.value
61 | if (this.data.value === value) {
62 | value--
63 | }
64 | this.setData({ value: value })
65 | this.triggerEvent('change', { value: value })
66 | },
67 |
68 | // 点击右边选择整颗星
69 | _onTapRight: function (e) {
70 | if (this.data.disabled) return
71 | let value = e.currentTarget.dataset.value
72 | if (this.data.value === value) {
73 | value--
74 | }
75 | this.setData({ value: value })
76 | this.triggerEvent('change', { value: value })
77 | }
78 | }
79 | })
80 |
--------------------------------------------------------------------------------
/components/rate/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/rate/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
13 |
14 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/components/rate/index.wxss:
--------------------------------------------------------------------------------
1 | .star {
2 | }
3 |
4 | .star__image{
5 | position: relative;
6 | }
7 | .star__image:last-child {
8 | margin-right: 0;
9 | }
10 |
11 | .star__mask{
12 | position: absolute;
13 | top: 0;
14 | }
--------------------------------------------------------------------------------
/components/search-bar/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 搜索框
4 | * @event
5 | */
6 | Component({
7 | properties: {
8 | defaultText: {
9 | type: String,
10 | value: '搜索'
11 | },
12 | focusText: {
13 | type: String,
14 | value: '搜索'
15 | },
16 | // 是否显示背景遮罩,默认否
17 | showMask: {
18 | type: Boolean,
19 | value: false
20 | },
21 | // 点击背景是否自动关闭,默认是
22 | tappableMask: {
23 | type: Boolean,
24 | value: true
25 | }
26 | },
27 | data: {
28 | isFocus: false,
29 | value: ''
30 | },
31 | methods: {
32 | _onFocus: function () {
33 | this.setData({ isFocus: true })
34 | this.triggerEvent('focus')
35 | },
36 |
37 | _onHide: function () {
38 | this.setData({
39 | value: '',
40 | isFocus: false
41 | })
42 | this.triggerEvent('hide')
43 | },
44 |
45 | _onClear: function () {
46 | this.setData({ value: '' })
47 | this.triggerEvent('clear')
48 | },
49 |
50 | _onInput: function (e) {
51 | this.setData({ value: e.detail.value })
52 | this.triggerEvent('input', {value: e.detail.value})
53 | },
54 |
55 | _onTapMask: function () {
56 | if (this.data.tappableMask) this._onHide()
57 | },
58 |
59 | // 在输入框不为空时搜索
60 | _onSearch: function (e) {
61 | if (this.data.value) {
62 | this.triggerEvent('search', { value: this.data.value })
63 | }
64 | }
65 | }
66 | })
67 |
--------------------------------------------------------------------------------
/components/search-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/search-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
14 |
15 | 取消
16 |
17 |
--------------------------------------------------------------------------------
/components/search-bar/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | @import '/styles/weui.wxss';
3 |
4 | .search-bar {
5 | z-index: 6;
6 | }
7 |
8 | .search-bar__mask {
9 | position: fixed;
10 | top: 0;
11 | left: 0;
12 | right: 0;
13 | bottom: 0;
14 | z-index: 5;
15 | background: rgba(0, 0, 0, 0.7);
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/components/send-code/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 发送短信的倒计时按钮
4 | * @event
5 | */
6 | Component({
7 | properties: {
8 | // 默认文字
9 | defaultText: {
10 | type: String,
11 | value: '获取验证码'
12 | },
13 | // 点击后的文字
14 | pendingText: {
15 | type: String,
16 | value: '发送中'
17 | },
18 | // 倒计时文字
19 | countingText: {
20 | type: String,
21 | value: '已发送'
22 | },
23 | // 倒计时时长
24 | duration: {
25 | type: Number,
26 | value: 60
27 | }
28 | },
29 |
30 | data: {
31 | str: '', // 当前显示的文字
32 | disabled: false, // 倒计时过程中禁用
33 | timer: null, // 计时器
34 | leftTime: 0 // 倒计时剩余时间
35 | },
36 |
37 | attached: function () {
38 | let { defaultText, duration } = this.data
39 | this.setData({str: defaultText})
40 | this.data.leftTime = duration
41 | },
42 |
43 | methods: {
44 | // 准备倒计时
45 | prepare: function () {
46 | this.setData({
47 | disabled: true,
48 | str: this.data.pendingText
49 | })
50 | },
51 |
52 | // 开始倒计时
53 | start: function () {
54 | this._countDown()
55 | },
56 |
57 | // 结束倒计时
58 | stop: function () {
59 | clearTimeout(this.data.timer)
60 | this.data.leftTime = this.data.duration
61 | this.setData({
62 | disabled: false,
63 | str: this.data.defaultText
64 | })
65 | },
66 |
67 | /**
68 | * 点击的时候不直接开始倒计时,父组件可以做一些参数判断
69 | */
70 | _onTap: function () {
71 | this.triggerEvent('tap')
72 | },
73 |
74 | _countDown: function () {
75 | let countingText = this.data.countingText
76 | if (this.data.leftTime > 0) {
77 | this.data.leftTime--
78 | this.setData({
79 | disabled: true,
80 | str: `${countingText}(${this.data.leftTime})`
81 | })
82 | this.data.timer = setTimeout(() => {
83 | this._countDown()
84 | }, 1000)
85 | } else {
86 | this.stop()
87 | this.triggerEvent('end')
88 | }
89 | }
90 | }
91 | })
92 |
--------------------------------------------------------------------------------
/components/send-code/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/send-code/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{str}}
3 | {{str}}
4 |
--------------------------------------------------------------------------------
/components/send-code/index.wxss:
--------------------------------------------------------------------------------
1 | @import "/styles/weui.wxss";
--------------------------------------------------------------------------------
/components/spinner/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 加载组件
4 | * 修改了下面的库的css,目前只整合了三个样式
5 | * https://github.com/ConnorAtherton/loaders.css/blob/master/loaders.css
6 | */
7 | Component({
8 | properties: {
9 | /**
10 | * 动画类型
11 | * 可选:line-scale,line-scale-pulse-out,ball-pulse-sync
12 | */
13 | type: {
14 | type: String,
15 | value: 'line-scale-pulse-out'
16 | },
17 | /**
18 | * 背景颜色
19 | */
20 | bgColor: {
21 | type: String,
22 | value: '#999'
23 | }
24 | }
25 | })
26 |
--------------------------------------------------------------------------------
/components/spinner/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/spinner/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/components/sticky-2/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/sticky-2/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/components/sticky-2/index.wxss:
--------------------------------------------------------------------------------
1 | .is-sticky {
2 | z-index: 200;
3 | position: fixed;
4 | top: 0;
5 | left: 0;
6 | width: 100%;
7 | }
--------------------------------------------------------------------------------
/components/sticky/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Sticky 吸顶元素,当元素滚动到页面顶部时固定,不再跟随滚动。
4 | * @event 事件对象为被包裹元素的布局信息
5 | *
6 | * 使用示例
7 | * ① wxml:
8 |
9 | 我是固定的!
10 | 我是固定的!
11 |
12 | * ② 为页面添加属性 scrollTop: 0
13 | * ③ 在页面的onPageScroll或scroll-view的bindscroll事件中添加:
14 | onPageScroll: function (e) {
15 | this.setData({scrollTop: e.scrollTop})
16 | }
17 | */
18 | Component({
19 | properties: {
20 | // 页面scrollTop值,该值发生变化时说明页面发生了滚动
21 | scrollTop: {
22 | type: Number,
23 | observer: function (val) {
24 | this._update()
25 | }
26 | },
27 | // 固定位置与顶部的距离
28 | topSpacing: {
29 | type: Number,
30 | value: 0
31 | }
32 | },
33 | options: {
34 | multipleSlots: true
35 | },
36 | data: {
37 | fixed: false
38 | },
39 |
40 | methods: {
41 | _update: function () {
42 | var query = wx.createSelectorQuery().in(this)
43 | query.select('.sticky').boundingClientRect(res => {
44 | let fixed = res.top - this.properties.topSpacing < 0
45 | if (fixed == this.data.fixed) return
46 | this.setData({fixed: fixed})
47 | if (fixed) {
48 | this.triggerEvent('stickystart', res)
49 | console.log('trigger stickystart')
50 | } else {
51 | this.triggerEvent('stickyend', res)
52 | console.log('trigger stickyend')
53 | }
54 | }).exec()
55 | }
56 | }
57 | })
58 |
--------------------------------------------------------------------------------
/components/sticky/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/sticky/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/components/sticky/index.wxss:
--------------------------------------------------------------------------------
1 | .sticky {
2 | z-index: 200;
3 | }
4 |
5 | .sticky-faker {
6 | position: fixed;
7 | top: 0;
8 | left: 0;
9 | width: 100%;
10 | z-index: 200;
11 | }
--------------------------------------------------------------------------------
/components/tab-bar/index.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 选项卡 TabBar
4 | * slot:不同tab的内容,“name”为对应tab的值
5 | * @event
6 | */
7 | Component({
8 | options: {
9 | multipleSlots: true
10 | },
11 | properties: {
12 | tabs: {
13 | type: Array,
14 | value: ['tab1', 'tab2', 'tab3']
15 | },
16 | // 默认激活的选项
17 | activeIndex: {
18 | type: Number,
19 | value: 0
20 | }
21 | },
22 |
23 | data: {
24 | sliderOffset: 0,
25 | sliderWidth: 0 // slider的宽度
26 | },
27 |
28 | attached: function () {
29 | wx.getSystemInfo({
30 | success: res => {
31 | let sliderWidth = res.windowWidth / this.data.tabs.length
32 | this.setData({
33 | sliderOffset: sliderWidth * this.data.activeIndex,
34 | sliderWidth: sliderWidth
35 | })
36 | }
37 | })
38 | },
39 |
40 | methods: {
41 | // 设置当前激活页
42 | setActiveIndex: function (index) {
43 | this.setData({
44 | sliderOffset: this.data.sliderWidth * index,
45 | activeIndex: index
46 | })
47 | },
48 | // 切换当前激活页
49 | _onClick: function (e) {
50 | let { offsetLeft, id } = e.currentTarget
51 | this.setData({
52 | sliderOffset: offsetLeft, // 或者 this.data.sliderWidth * index
53 | activeIndex: id
54 | })
55 | this.triggerEvent('click', {index: id})
56 | }
57 | }
58 | })
59 |
--------------------------------------------------------------------------------
/components/tab-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/tab-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{item}}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/components/tab-bar/index.wxss:
--------------------------------------------------------------------------------
1 | @import '/styles/weui.wxss'
2 |
3 | .weui-navbar {
4 | position: relative;
5 | }
6 |
7 | .weui-tab__panel {
8 | padding-top: 0;
9 | }
--------------------------------------------------------------------------------
/components/toast/index.js:
--------------------------------------------------------------------------------
1 |
2 | var timer
3 |
4 | var DEFAULT_CONFIG = {
5 | duration: 3000,
6 | position: 'bottom'
7 | }
8 |
9 | /**
10 | * Toast 能够自定义位置的浮动提示
11 | * 如果只需要居中显示,最好使用 wx.showToast()
12 | * TODO --- 实现淡入淡出
13 | */
14 | Component({
15 | properties: {
16 | // 自定义显示位置:top,center,bottom
17 | position: String
18 | },
19 | data: {
20 | title: '',
21 | show: false
22 | },
23 | methods: {
24 | /**
25 | * 显示 Toast,父组件通过 Toast 组件的引用调用
26 | * @param title {String}
27 | * @param option {Object}
28 | * -- duration:持续时长
29 | * -- position:元素位置
30 | */
31 | show (title = '', options = {}) {
32 | // 如果已经有一个计时器在了,就先清理掉
33 | if (timer) {
34 | clearTimeout(timer)
35 | timer = undefined
36 | }
37 |
38 | // 扩展默认配置项
39 | options = Object.assign({}, DEFAULT_CONFIG, options)
40 |
41 | // 设置定时器,定时关闭topTips
42 | timer = setTimeout(() => {
43 | this.setData({
44 | show: false
45 | })
46 | }, options.duration)
47 |
48 | // 展示出topTips
49 | this.setData({
50 | title: title,
51 | position: options.position,
52 | show: true
53 | })
54 | }
55 | }
56 | })
57 |
--------------------------------------------------------------------------------
/components/toast/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/toast/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{ title }}
3 |
--------------------------------------------------------------------------------
/components/toast/index.wxss:
--------------------------------------------------------------------------------
1 | .toast {
2 | z-index: 500;
3 | display: inline-block;
4 | box-sizing:border-box;
5 | position: fixed;
6 | left: 50%;
7 | width:60%;
8 | transform: translateX(-50%);
9 | padding:10px;
10 | font-size: 14px;
11 | line-height:1.5em;
12 | text-align:center;
13 | color: #fff;
14 | background: rgba(0, 0, 0, 0.7);
15 | border-radius: 4px;
16 | }
17 |
18 | .toast--top {
19 | top: 20px;
20 | }
21 |
22 | .toast--center {
23 | top: 50%;
24 | transform: translateX(-50%) translateY(-50%);
25 | }
26 |
27 | .toast--bottom {
28 | bottom: 20px;
29 | }
--------------------------------------------------------------------------------
/components/toptip/index.js:
--------------------------------------------------------------------------------
1 |
2 | var timer
3 |
4 | var DEFAULT_CONFIG = {
5 | duration: 3000,
6 | type: 'error' // warn、success、error
7 | }
8 |
9 | /**
10 | * 顶部提示
11 | */
12 | Component({
13 | properties: {
14 | content: String
15 | },
16 | data: {
17 | type: '',
18 | show: false
19 | },
20 |
21 | methods: {
22 | /**
23 | * 显示 TopTip,父组件通过 TopTip 组件的引用调用
24 | * @param content {String}
25 | * @param option {Object}
26 | * -- duration:持续时长
27 | * -- type:提示类型
28 | */
29 | show (content = '', options = {}) {
30 | // 如果已经有一个计时器在了,就先清理掉
31 | if (timer) {
32 | clearTimeout(timer)
33 | timer = undefined
34 | }
35 |
36 | // 扩展默认参数
37 | options = Object.assign({}, DEFAULT_CONFIG, options)
38 |
39 | // 设置定时器,定时关闭
40 | timer = setTimeout(() => {
41 | this.setData({
42 | show: false
43 | })
44 | }, options.duration)
45 |
46 | // 展示出topTips
47 | this.setData({
48 | content: content,
49 | type: options.type,
50 | show: true
51 | })
52 | }
53 | }
54 | })
55 |
--------------------------------------------------------------------------------
/components/toptip/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/toptip/index.wxml:
--------------------------------------------------------------------------------
1 | {{ content }}
--------------------------------------------------------------------------------
/components/toptip/index.wxss:
--------------------------------------------------------------------------------
1 | .toptip {
2 | z-index: 500;
3 | display: block;
4 | position: fixed;
5 | -webkit-transform: translateZ(0) translateY(-100%);
6 | transform: translateZ(0) translateY(-100%);
7 | width: 100%;
8 | /* 至少有一行的高度,保证第一次动画显示正常 */
9 | min-height: 32px;
10 | top: 0;
11 | line-height: 2.3;
12 | font-size: 14px;
13 | text-align: center;
14 | color: #FFF;
15 | background-color: #E64340;
16 |
17 | /* 动画部分 */
18 | transition: all 0.4s ease;
19 | }
20 |
21 | .toptip--warn {
22 | background-color: #FFBF00;
23 | }
24 | .toptip--success {
25 | background-color: #09BB07;
26 | }
27 | .toptip--error {
28 | background-color: #E64340;
29 | }
30 |
31 | .toptip--show {
32 | -webkit-transform: translateZ(0) translateY(0);
33 | transform: translateZ(0) translateY(0);
34 | }
35 |
--------------------------------------------------------------------------------
/docs/.vuepress/config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | title: '在线借书平台',
3 | description: '一个连接读者与读书馆的图书资源共享平台',
4 | head: [
5 | ['link', { rel: 'icon', href: `/favicon.ico` }]
6 | ],
7 | base: '/weapp-library/',
8 | themeConfig: {
9 | sidebar: {
10 | '/guide/': [{
11 | title: '文档',
12 | collapsable: false,
13 | children: [
14 | '',
15 | 'install',
16 | 'feature',
17 | 'front',
18 | 'api',
19 | ]
20 | }]
21 | },
22 | repo: 'imageslr/weapp-library',
23 | docsDir: 'docs',
24 | editLinks: true,
25 | editLinkText: '在 Github 上编辑此页',
26 | lastUpdated: '上次更新'
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/docs/.vuepress/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/.vuepress/public/favicon.ico
--------------------------------------------------------------------------------
/docs/.vuepress/public/ui.sketch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/.vuepress/public/ui.sketch
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | home: true
3 | actionText: 快速了解 →
4 | actionLink: /guide/
5 | features:
6 | - title: 图书借阅线上化
7 | details: 查找图书、查看馆藏、预约图书、押金支付等均可在小程序内完成;管理员APP实现借书还书的自动化登记,并提供数据统计、订单搜索与查看等功能。
8 | - title: 图书资源利用率最大化
9 | details: 连接所有图书馆的馆藏信息,用户可在多个图书馆中进行选择,使得每个图书馆的图书资源都能得到充分利用。
10 | - title: 培养用户读书兴趣
11 | details: 为用户提供轻松获取图书信息、管理阅读计划的途径。这不仅需要优化推荐与搜索功能,还需要在其他方面做出更多的探索。
12 | footer: Copyright © 2018-present Imageslr
13 | ---
14 |
15 | ### 开始使用
16 | 打开微信——小程序——搜索“在线借书平台”。
17 |
18 | **测试账号**:随便输入一个合法手机号与6位验证码。
19 |
20 | 也可扫描以下小程序码体验:
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/guide/README.md:
--------------------------------------------------------------------------------
1 | # 快速了解
2 |
3 | ## 开始使用
4 | ### 微信小程序
5 | 打开微信——小程序——搜索“在线借书平台”。
6 |
7 | **测试账号**:随便输入一个合法手机号与6位验证码。
8 |
9 | 也可扫描以下小程序码体验:
10 |
11 |
12 |
13 |
14 | ## 简介
15 |
16 | 我们的目标:提供**一个连接读者与图书馆的图书资源共享平台**。
17 |
18 | 如今人们阅读纸质书的频率越来越低,主要原因是购买纸质书需要成本,而从图书馆借书步骤繁琐:每个图书馆都需要办卡、缴纳押金;图书无法在线预约;不同的图书馆馆藏资源不共享,用户往往需要去多个图书馆才能找到自己想要的图书。我们希望通过为所有图书馆和读者提供服务,实现图书借阅线上化,最大化的提高资源利用率。
19 |
20 | #### 简化借阅流程
21 | 用户可通过小程序在线查找图书及馆藏、预约/借阅图书;当用户在图书馆的时候,也可通过小程序扫描图书的ISBN,将图书加入借书栏;管理员只需要通过安卓管理app扫描用户借书二维码即可自动完成订单的创建或修改,无须手动录入信息。
22 | #### 图书借阅线上化
23 | 图书馆可在系统中注册,通过安卓管理App实现借书/还书的自动化登记,通过桌面应用实现图书馆信息设置/馆藏管理/订单管理等功能。
24 | #### 图书资源利用率最大化
25 | 所有图书馆都能方便在我们的平台注册、发布馆藏。当用户需要借阅某本图书时,可在小程序内直接获取所有图书馆的馆藏信息,无需对每个图书馆分别查找,因此一些图书馆的闲置资源也能得到充分利用。
26 | #### 解决信任问题
27 | 读者需要缴纳押金、上传身份证照片,审核通过后方可借书;图书馆需要提交资质证明文件,审核通过后可获得认证标志,这使读者能够知道哪些图书馆是可靠的,图书馆也能够知道哪些读者是可信任的。再加上完善地平台管理机制(用户可能被拉黑,无法再登录),彻底解决读者与图书馆之间的信任问题。
28 | #### 培养用户读书兴趣
29 | 推荐系统会根据用户阅读习惯为其推荐书籍;书单功能使用户可以管理与分享自己的书单;书评功能使用户能交流自己的读书体会。这些功能都能激发用户的读书欲望,进而培养用户的读书习惯。平台为用户提供轻松获取图书信息、管理阅读计划的途径。这不仅需要优化推荐与搜索功能,还需要在其他方面做出更多的探索。
30 |
31 |
32 | ## 特色
33 | * 研究多种设计规范,精心打磨产品界面与交互,确保良好的用户体验
34 | * 利用 Sketch 绘制[高保真原型图](./front.md#ui)
35 | * 利用 [Swagger](https://app.swaggerhub.com/apis/imageslr/weapp/1.0.1#/) 编写详细的[RESTful API 文档](./api.md)
36 | * 前后端分离开发,[前端](./front.md)尽可能实现[组件化](./front.md#组件化)
37 | * 提供一个轻量级、可复用的[本地 Mock Server 解决方案](https://github.com/imageslr/weapp-library#mock-server)
38 |
39 |
40 | ## 功能
41 |
42 | * **搜索图书**
43 | * **查看馆藏**
44 | * **在线预约/续借图书,线下扫码借书**
45 | * **书单功能**:与网易云音乐的歌单系统十分类似,用户可搜索、收藏、推荐和分享书单。用户不仅可为书单添加描述,还可以与书单内的每一本图书添加个性化描述。
46 | * **书评功能**
47 | * **订单管理**
48 | * **用户管理**
49 | * **数据可视化**
50 | * **图书维基系统**:结合维基百科与豆瓣图书的设计理念而开发,是一个开放、可供多人协同创作、且具有版本控制功能的图书信息管理系统,主要提供平台所使用的图书信息的协作管理功能。任何人均可浏览、创建和更改图书信息。
51 | * 推荐系统(TODO)
52 |
53 | 
54 |
55 | 更多请见[运行截图](./feature.html#运行截图)
56 |
57 |
58 |
--------------------------------------------------------------------------------
/docs/guide/feature.md:
--------------------------------------------------------------------------------
1 |
2 | # 功能
3 | ## 介绍
4 | 本项目[小程序](#微信小程序)有 30 多个页面,实现了以下功能:
5 |
6 | * 搜索图书
7 | * 查看馆藏
8 | * 在线预约/续借图书,线下扫码借书
9 | * 创建/收藏/分享书单
10 | * 书评功能
11 | * 订单管理
12 | * ...
13 |
14 | 其中**书单功能**与网易云音乐的歌单系统十分类似,用户可搜索、收藏、推荐和分享书单。用户不仅可为书单添加描述,还可以与书单内的每一本图书添加个性化描述。
15 |
16 | [图书馆桌面应用](#图书馆桌面应用)、[超级管理员应用](#超级管理员应用)均为 vue 单页应用,具有订单管理、用户管理、数据可视化等功能。
17 |
18 | [图书维基系统](#图书维基系统)也是 vue 单页应用。该系统结合维基百科与豆瓣图书的设计理念而开发,是一个开放、可供多人协同创作、且具有版本控制功能的图书信息管理系统。主要提供平台所使用的图书信息的协作管理功能,任何人均可浏览、创建和更改图书信息。
19 |
20 | ### 功能架构图
21 | 
22 |
23 | ### 软件概览
24 |
25 | 各个软件功能请见下图:
26 |
27 |
28 |
29 | ## 运行截图
30 | ### 微信小程序
31 | 
32 |
33 | 
34 |
35 | 
36 |
37 | ### 图书馆安卓App
38 |
39 |
40 | ### 图书馆桌面应用
41 | #### 数据统计
42 | 
43 |
44 | ### 图书维基系统
45 | #### 登录注册
46 | 
47 | #### 搜索图书
48 | 
49 | #### 查看不同版本
50 | 
51 | #### 版本差异对比
52 | 
53 |
54 | ### 超级管理员应用
55 | #### 平台数据统计
56 | 
57 | 
58 |
59 |
60 | ## 用户身份
61 |
62 | 图书馆与读者是借阅关系,wiki系统贡献者能和其他用户共同维护图书信息。超级管理员管理所有的用户,同时接收他们意见反馈。
63 |
64 |
65 |
66 | ## 流程图
67 |
68 | 借书流程图:
69 |
70 | 
71 |
72 | 
73 |
74 | 订单状态转移图:
75 |
76 | 
77 |
78 |
--------------------------------------------------------------------------------
/docs/guide/install.md:
--------------------------------------------------------------------------------
1 | # 安装
2 | ## 小程序
3 | 1. 安装最新版微信小程序开发工具
4 | 2. 下载[源代码](https://github.com/imageslr/weapp-library),在微信开发者工具中导入
5 | 3. 按照[README](https://github.com/imageslr/weapp-library) 中的说明,启动本地 mock server
6 | 4. 运行成功
7 |
8 | ## 桌面应用
9 |
10 | 目前暂无。
11 |
12 | ## 后端
13 | 目前暂无。
--------------------------------------------------------------------------------
/docs/media/admin_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/admin_1.png
--------------------------------------------------------------------------------
/docs/media/admin_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/admin_2.png
--------------------------------------------------------------------------------
/docs/media/android.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/android.png
--------------------------------------------------------------------------------
/docs/media/component.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/component.png
--------------------------------------------------------------------------------
/docs/media/functional_architecture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/functional_architecture.jpg
--------------------------------------------------------------------------------
/docs/media/fundebug-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/fundebug-1.png
--------------------------------------------------------------------------------
/docs/media/fundebug-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/fundebug-2.png
--------------------------------------------------------------------------------
/docs/media/library_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/library_2.png
--------------------------------------------------------------------------------
/docs/media/order_status.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/order_status.jpg
--------------------------------------------------------------------------------
/docs/media/page_status_indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/page_status_indicator.png
--------------------------------------------------------------------------------
/docs/media/postman.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/postman.png
--------------------------------------------------------------------------------
/docs/media/sequence_book.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/sequence_book.jpg
--------------------------------------------------------------------------------
/docs/media/sequence_borrow_in_library.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/sequence_borrow_in_library.jpg
--------------------------------------------------------------------------------
/docs/media/softwares.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/softwares.png
--------------------------------------------------------------------------------
/docs/media/swagger_ui_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/swagger_ui_1.png
--------------------------------------------------------------------------------
/docs/media/swagger_ui_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/swagger_ui_2.png
--------------------------------------------------------------------------------
/docs/media/swagger_ui_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/swagger_ui_3.png
--------------------------------------------------------------------------------
/docs/media/swagger_ui_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/swagger_ui_4.png
--------------------------------------------------------------------------------
/docs/media/ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/ui.png
--------------------------------------------------------------------------------
/docs/media/user_identity.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/user_identity.jpg
--------------------------------------------------------------------------------
/docs/media/weapp_code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/weapp_code.png
--------------------------------------------------------------------------------
/docs/media/weapp_ui_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/weapp_ui_1.png
--------------------------------------------------------------------------------
/docs/media/weapp_ui_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/weapp_ui_2.png
--------------------------------------------------------------------------------
/docs/media/weapp_ui_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/weapp_ui_3.png
--------------------------------------------------------------------------------
/docs/media/wiki_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/wiki_1.png
--------------------------------------------------------------------------------
/docs/media/wiki_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/wiki_2.png
--------------------------------------------------------------------------------
/docs/media/wiki_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/wiki_3.png
--------------------------------------------------------------------------------
/docs/media/wiki_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media/wiki_4.png
--------------------------------------------------------------------------------
/docs/media_待整理/sequence_register.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/sequence_register.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/sequence_take_book.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/sequence_take_book.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/sys_architecture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/sys_architecture.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/user_case_basic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/user_case_basic.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/user_case_booklist.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/user_case_booklist.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/user_case_collection.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/user_case_collection.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/user_case_notice.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/user_case_notice.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/user_case_order.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/user_case_order.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/user_case_recommend.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/user_case_recommend.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/user_case_review.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/user_case_review.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/user_case_search.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/user_case_search.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/user_case_user.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/user_case_user.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/vue_architecture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/vue_architecture.jpg
--------------------------------------------------------------------------------
/docs/media_待整理/weapp_architecture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/docs/media_待整理/weapp_architecture.jpg
--------------------------------------------------------------------------------
/images/default_avatar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/default_avatar.jpg
--------------------------------------------------------------------------------
/images/icon_add_to_booklist.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_add_to_booklist.png
--------------------------------------------------------------------------------
/images/icon_bell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_bell.png
--------------------------------------------------------------------------------
/images/icon_booklist_fill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_booklist_fill.png
--------------------------------------------------------------------------------
/images/icon_booklist_line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_booklist_line.png
--------------------------------------------------------------------------------
/images/icon_cart_fill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_cart_fill.png
--------------------------------------------------------------------------------
/images/icon_cart_line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_cart_line.png
--------------------------------------------------------------------------------
/images/icon_certificated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_certificated.png
--------------------------------------------------------------------------------
/images/icon_deposit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_deposit.png
--------------------------------------------------------------------------------
/images/icon_drawer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_drawer.png
--------------------------------------------------------------------------------
/images/icon_empty_booklist.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_empty_booklist.png
--------------------------------------------------------------------------------
/images/icon_headlines.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_headlines.png
--------------------------------------------------------------------------------
/images/icon_help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_help.png
--------------------------------------------------------------------------------
/images/icon_home_fill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_home_fill.png
--------------------------------------------------------------------------------
/images/icon_home_line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_home_line.png
--------------------------------------------------------------------------------
/images/icon_in_process.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_in_process.png
--------------------------------------------------------------------------------
/images/icon_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_info.png
--------------------------------------------------------------------------------
/images/icon_logout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_logout.png
--------------------------------------------------------------------------------
/images/icon_me_fill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_me_fill.png
--------------------------------------------------------------------------------
/images/icon_me_line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_me_line.png
--------------------------------------------------------------------------------
/images/icon_more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_more.png
--------------------------------------------------------------------------------
/images/icon_paper_plane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_paper_plane.png
--------------------------------------------------------------------------------
/images/icon_review.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_review.png
--------------------------------------------------------------------------------
/images/icon_review_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_review_2.png
--------------------------------------------------------------------------------
/images/icon_scan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_scan.png
--------------------------------------------------------------------------------
/images/icon_setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_setting.png
--------------------------------------------------------------------------------
/images/icon_time.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_time.png
--------------------------------------------------------------------------------
/images/icon_trending_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_trending_1.png
--------------------------------------------------------------------------------
/images/icon_trending_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_trending_2.png
--------------------------------------------------------------------------------
/images/icon_trending_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_trending_3.png
--------------------------------------------------------------------------------
/images/icon_trending_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_trending_up.png
--------------------------------------------------------------------------------
/images/icon_uncertificated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/icon_uncertificated.png
--------------------------------------------------------------------------------
/images/load_fail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/load_fail.png
--------------------------------------------------------------------------------
/images/logo.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/logo.jpeg
--------------------------------------------------------------------------------
/images/miniapp_code.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/miniapp_code.jpg
--------------------------------------------------------------------------------
/images/no_data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/images/no_data.png
--------------------------------------------------------------------------------
/pages/book-detail/book-detail.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "图书详情",
3 | "usingComponents":
4 | {
5 | "popup": "/components/popup/index",
6 | "load-more": "/components/load-more/index",
7 | "no-data": "/components/no-data/index"
8 | }
9 | }
--------------------------------------------------------------------------------
/pages/book-detail/children/add.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "加入书单"
3 | }
--------------------------------------------------------------------------------
/pages/book-detail/children/add.wxml:
--------------------------------------------------------------------------------
1 | 书单
2 |
3 |
4 |
5 |
6 | {{booklistTitles[selectedIndex]}}
7 |
8 |
9 |
10 |
11 | 图书描述
12 |
13 |
14 |
15 |
16 | {{comment.length}}/200
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/pages/book-detail/children/add.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/pages/book-detail/children/add.wxss
--------------------------------------------------------------------------------
/pages/book-detail/children/children/library-detail.js:
--------------------------------------------------------------------------------
1 | import { getLibraryById } from '../../../../apis/library'
2 |
3 | var options // 保存页面参数
4 |
5 | Page({
6 | data: {
7 | pageStatus: 'loading', // error, done
8 | library: {
9 | id: undefined,
10 | status: 1, // 0:未认证,1:已认证
11 | name: '',
12 | phone: '',
13 | address: '',
14 | introduction: '',
15 | book_type_num: 0,
16 | book_total_num: 0,
17 | photos: []
18 | }
19 | },
20 |
21 | onLoad: function (opts) {
22 | options = opts
23 | this._loadPage()
24 | },
25 |
26 | onReloadPage: function () {
27 | this._loadPage()
28 | },
29 |
30 | onPreview: function (e) {
31 | let library = this.data.library
32 | let id = e.currentTarget.dataset.index
33 | wx.previewImage({
34 | current: library.photos[id],
35 | urls: library.photos
36 | })
37 | },
38 |
39 | _loadPage: function () {
40 | this.setData({pageStatus: 'loading'})
41 | getLibraryById(options.id).then(res => {
42 | this.setData({
43 | library: res.data,
44 | pageStatus: 'done'
45 | })
46 | }).catch(() => this.setData({pageStatus: 'error'}))
47 | }
48 | })
49 |
--------------------------------------------------------------------------------
/pages/book-detail/children/children/library-detail.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "图书馆详情"
3 | }
--------------------------------------------------------------------------------
/pages/book-detail/children/children/library-detail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 基本信息
6 |
7 | {{library.name}}
8 | 认证状态:
9 | 已认证
10 | 未认证
11 |
12 | 电话:{{library.phone}}
13 | 地址:{{library.address}}
14 |
15 | 简介
16 | {{library.introduction || '暂无'}}
17 | 馆藏信息
18 |
19 | 图书种类:{{library.book_type_num}}种
20 | 馆藏数量:{{library.book_total_num}}本
21 |
22 |
23 | 照片
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | 暂无
34 |
35 |
--------------------------------------------------------------------------------
/pages/book-detail/children/children/library-detail.wxss:
--------------------------------------------------------------------------------
1 |
2 | page {
3 | padding-bottom: 20px;
4 | }
--------------------------------------------------------------------------------
/pages/book-detail/children/children/result.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 | title: undefined,
5 | first: undefined,
6 | second: undefined
7 | },
8 |
9 | onLoad: function (options) {
10 | wx.setNavigationBarTitle({title: options.title})
11 | this.setData({
12 | title: options.title,
13 | first: options.first,
14 | second: options.second
15 | })
16 | },
17 |
18 | onBack: function () {
19 | wx.navigateBack()
20 | },
21 |
22 | onSwitch: function () {
23 | wx.switchTab({
24 | url: '/pages/home/home'
25 | })
26 | }
27 | })
28 |
--------------------------------------------------------------------------------
/pages/book-detail/children/children/result.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": ""
3 | }
--------------------------------------------------------------------------------
/pages/book-detail/children/children/result.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{title}}
7 |
8 | {{first}}
9 | {{second}}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/pages/book-detail/children/children/result.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #fff;
3 | }
--------------------------------------------------------------------------------
/pages/book-detail/children/library-list.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "查找图书馆",
3 | "usingComponents":
4 | {
5 | "search-bar": "/components/search-bar/index",
6 | "load-more": "/components/load-more/index",
7 | "no-data": "/components/no-data/index"
8 | }
9 | }
--------------------------------------------------------------------------------
/pages/book-detail/children/library-list.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/pages/book-detail/children/library-list.wxss:
--------------------------------------------------------------------------------
1 | @import "/templates/library-list/index.wxss"
--------------------------------------------------------------------------------
/pages/book-detail/children/order.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "确认借书"
3 | }
--------------------------------------------------------------------------------
/pages/book-detail/children/order.wxss:
--------------------------------------------------------------------------------
1 | .library__name {
2 | display: -webkit-box;
3 | display: -webkit-flex;
4 | display: flex;
5 | align-items: center;
6 | line-height: 1.8em;
7 | }
8 |
9 | .library__name image {
10 | flex: 0 0 40rpx;
11 | width: 30rpx;
12 | height: 30rpx;
13 | vertical-align: middle;
14 | }
15 |
16 | .container {
17 | min-height: 100vh;
18 | background-color: #fff;
19 | }
--------------------------------------------------------------------------------
/pages/book-detail/children/review.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "评论列表",
3 | "usingComponents":
4 | {
5 | "toptip": "/components/toptip/index",
6 | "rate": "/components/rate/index",
7 | "popup": "/components/popup/index",
8 | "load-more": "/components/load-more/index",
9 | "async-button": "/components/async-button/index",
10 | "sticky": "/components/sticky/index"
11 | }
12 | }
--------------------------------------------------------------------------------
/pages/book-detail/children/review.wxss:
--------------------------------------------------------------------------------
1 | .fixed-header-container {
2 | padding-top: 64px;
3 | }
4 | .fixed-header-container > .review-header {
5 | z-index: 5;
6 | position: fixed;
7 | top: 0;
8 | width: 100%;
9 | height: 64px;
10 | }
11 | .review-book {
12 | margin-bottom: 13px;
13 | }
14 | .review-header {
15 | /*position: sticky;
16 | top: 0;*/
17 | padding-top: 20px;
18 | box-sizing: border-box;
19 | background-color: #FFF;
20 | border-bottom: 1px solid #D9D9D9;
21 | }
22 | .review-header:before {
23 | display: none;
24 | }
25 |
26 | .popup-bd {
27 | padding: 30px 50px;
28 | }
29 | .popup-bd__label {
30 | margin-bottom: 16px;
31 | font-size: 15px;
32 | color: #888;
33 | text-align: center;
34 | }
35 | .popup-bd__score {
36 | margin-bottom: 20px;
37 | text-align: center;
38 | }
39 | .popup-bd__textarea {
40 | margin-bottom: 20px;
41 | padding:10px 15px;
42 | border-radius: 4rpx;
43 | border: 1rpx solid #D9D9D9;
44 | }
45 | .popup-bd__btn-area {
46 | width: 150px;
47 | margin: 0 auto;
48 | }
--------------------------------------------------------------------------------
/pages/booklist/booklist.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "书单",
3 | "enablePullDownRefresh": true,
4 | "usingComponents":
5 | {
6 | "search-bar": "/components/search-bar/index",
7 | "collapse": "/components/collapse/index"
8 | }
9 | }
--------------------------------------------------------------------------------
/pages/booklist/booklist.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{item.title}}
8 |
9 | {{item.total}}本 by {{item.creator.nickname}},{{item.favorited_num}}人收藏
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | {{item.title}}
23 |
24 | {{item.total}}本 by {{item.creator.nickname}},{{item.favorited_num}}人收藏
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/pages/booklist/booklist.wxss:
--------------------------------------------------------------------------------
1 | /* pages/booklist/booklist.wxss */
--------------------------------------------------------------------------------
/pages/booklist/children/booklist-detail.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "书单详情",
3 | "usingComponents": {
4 | "async-switch": "/components/async-switch/index",
5 | "load-more": "/components/load-more/index",
6 | "no-data": "/components/no-data/index",
7 | "booklist-item": "/pages/components/booklist-item/index"
8 | }
9 | }
--------------------------------------------------------------------------------
/pages/booklist/children/booklist-detail.wxss:
--------------------------------------------------------------------------------
1 | .booklist-header {
2 | padding: 20px 15px 10px;
3 | background-color: #FFF;
4 | }
5 |
6 | .booklist-header__title {
7 | display: -webkit-box;
8 | display: -webkit-flex;
9 | display: flex;
10 | align-items: center;
11 | justify-content: center;
12 | }
13 |
14 | .booklist-header__title-name {
15 | margin-right: 10px;
16 | }
17 |
18 | .booklist-header__title-avatar {
19 | flex: 0 0 20px;
20 | width: 20px;
21 | height: 20px;
22 | margin-right: 10px;
23 | vertical-align: middle;
24 | border-radius: 10px;
25 | }
26 |
27 | .booklist-header__description {
28 | padding-top: 10px;
29 | white-space: pre-wrap;
30 | }
31 | .booklist-header__description {
32 | line-height: 1.8em;
33 | }
34 |
35 | .booklist-switch {
36 | background-color: #FFF;
37 | border-bottom: 1rpx solid #D9D9D9;
38 | }
39 | .booklist-switch:before {
40 | display: none;
41 | }
42 | .booklist-switch__delete:active {
43 | opacity: 0.8;
44 | }
45 | .booklist-switch__delete--disabled {
46 | opacity: 0.6 !important;
47 | }
48 |
49 | .booklist-item-container {
50 | position: relative;
51 | }
52 | .booklist-item-container:after {
53 | content: " ";
54 | position: absolute;
55 | left: 0;
56 | bottom: 0;
57 | right: 0;
58 | height: 1px;
59 | border-bottom: 1rpx solid #D9D9D9;
60 | color: #D9D9D9;
61 | }
62 | .booklist-item {
63 | position: relative;
64 | }
65 | .booklist-item:before {
66 | z-index: 3;
67 | content: " ";
68 | position: absolute;
69 | top: 0;
70 | right: 0;
71 | height: 1px;
72 | border-top: 1rpx solid #D9D9D9;
73 | color: #D9D9D9;
74 | left: 15px;
75 | }
76 | .booklist-item:first-child:before {
77 | display: none;
78 | }
--------------------------------------------------------------------------------
/pages/booklist/children/children/modify.js:
--------------------------------------------------------------------------------
1 | import { updateBooklistById } from '../../../../apis/booklist'
2 |
3 | var NB_TIMER
4 |
5 | // 保存页面参数options
6 | var options = {
7 | index: undefined,
8 | book_id: undefined,
9 | booklist_id: undefined
10 | }
11 |
12 | Page({
13 | data: {
14 | comment: ''
15 | },
16 |
17 | onLoad: function (opts) {
18 | options = opts
19 | this.setData({comment: decodeURIComponent(opts.comment)})
20 | },
21 |
22 | onUnload: function () {
23 | clearTimeout(NB_TIMER)
24 | },
25 |
26 | onInput: function (e) {
27 | this.setData({ comment: e.detail.value })
28 | },
29 |
30 | /**
31 | * @event
32 | * 书单详情页(../booklist-detail)监听该事件
33 | */
34 | onSubmit: function () {
35 | wx.showLoading({ title: '加载中', mask: true })
36 | updateBooklistById(options.booklist_id, {
37 | add_items: [
38 | {
39 | book_id: options.book_id,
40 | comment: this.data.comment
41 | }
42 | ]
43 | }).then(() => {
44 | wx.hideLoading()
45 | wx.showToast({ title: '操作成功', mask: true })
46 | NB_TIMER = setTimeout(_ => wx.navigateBack(), 1000)
47 |
48 | // 触发事件
49 | getApp().event.emit('bookCommentModified', {
50 | index: options.index,
51 | comment: this.data.comment
52 | })
53 | }).catch(_ => {
54 | wx.hideLoading()
55 | })
56 | }
57 | })
58 |
--------------------------------------------------------------------------------
/pages/booklist/children/children/modify.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "编辑图书描述"
3 | }
--------------------------------------------------------------------------------
/pages/booklist/children/children/modify.wxml:
--------------------------------------------------------------------------------
1 | 图书描述
2 |
3 |
4 |
5 |
6 | {{comment.length}}/200
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/pages/booklist/children/children/modify.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/pages/booklist/children/children/modify.wxss
--------------------------------------------------------------------------------
/pages/booklist/children/modify.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "设置书单信息",
3 | "usingComponents":
4 | {
5 | "toptip": "/components/toptip/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/pages/booklist/children/modify.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 标题
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | 书单描述
17 |
18 |
19 |
20 |
21 | {{description.length}}/300
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/pages/booklist/children/modify.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/pages/booklist/children/modify.wxss
--------------------------------------------------------------------------------
/pages/cart/cart.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "借书栏"
3 | }
--------------------------------------------------------------------------------
/pages/cart/cart.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding-bottom: 25px;
3 | }
4 |
5 | .step>view {
6 | line-height: 1.5;
7 | margin-top: 10rpx;
8 | }
9 |
10 | .step>view:first-child {
11 | margin-top: 0;
12 | }
13 |
14 | .weui-cells:after {
15 | display: none;
16 | }
--------------------------------------------------------------------------------
/pages/cart/children/help.js:
--------------------------------------------------------------------------------
1 | Page({
2 | })
3 |
--------------------------------------------------------------------------------
/pages/cart/children/help.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "帮助"
3 | }
--------------------------------------------------------------------------------
/pages/cart/children/help.wxml:
--------------------------------------------------------------------------------
1 |
2 | 如何在线预订图书?
3 |
4 | 1. 搜索图书
5 |
6 |
7 | 通过主页搜索框可搜索图书;点击“分类”可按照学科门类搜索图书; 点击搜索框后,左侧可选择搜索条件,或进入高级搜索。
8 |
9 |
10 |
11 |
12 | 2. 图书详情
13 |
14 |
15 | 点击首页图书,或点击搜索结果中的列表项,可进入图书详情。
16 | 点击“馆藏信息”或右下角借阅按钮,可展开馆藏列表。
17 |
18 |
19 |
20 |
21 | 3. 在线预订
22 |
23 |
24 | 选择图书馆,进入订单页。
25 |
26 | 当该图书馆有此图书时,你可以选择一个取书日期预订此书,需在一个月之内取书;当该图书馆暂无此书时,你可以预约图书,当他人归还时,你将收到系统提醒。
27 |
28 |
29 |
30 |
31 | 4. 取书
32 |
33 |
34 | 在约定的取书日期前往图书馆,向图书管理员出示订单号(订单可在“我的-借阅进度”中查看),管理员确认后,完成取书。
35 |
36 |
37 |
38 |
39 | 5. 还书
40 |
41 |
42 | 图书借阅时长为一个月,每本图书可续借一次。需在还书日期前归还图书。
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/pages/cart/children/help.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | min-height: 100%;
3 | background-color: #fff;
4 | }
--------------------------------------------------------------------------------
/pages/cart/children/qrcode.js:
--------------------------------------------------------------------------------
1 | import QR from '../../../utils/qrcode'
2 | import { getToken } from '../../../utils/permission'
3 |
4 | Page({
5 | onReady: function () {
6 | var size = this.setCanvasSize() // 动态设置画布大小
7 | wx.getStorage({
8 | key: 'selectedBooks',
9 | success: (res) => {
10 | var params = {
11 | token: getToken(),
12 | book_id: []
13 | }
14 | res.data.forEach(i => params.book_id.push(i.id))
15 | QR.qrApi.draw(JSON.stringify(params), 'qrcode', size.w, size.h)
16 | }
17 | })
18 | },
19 |
20 | // 适配不同屏幕大小的canvas
21 | setCanvasSize: function () {
22 | var size = {}
23 | try {
24 | var res = wx.getSystemInfoSync()
25 | var scale = 750 / 686 // 不同屏幕下canvas的适配比例;设计稿是750宽
26 | var width = res.windowWidth / scale
27 | var height = width // canvas画布为正方形
28 | size.w = width
29 | size.h = height
30 | } catch (e) {
31 | console.log('获取设备信息失败' + e)
32 | }
33 | return size
34 | }
35 | })
36 |
--------------------------------------------------------------------------------
/pages/cart/children/qrcode.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "借书二维码"
3 | }
--------------------------------------------------------------------------------
/pages/cart/children/qrcode.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 请将二维码出示给管理员
--------------------------------------------------------------------------------
/pages/cart/children/qrcode.wxss:
--------------------------------------------------------------------------------
1 |
2 | .container {
3 | margin-top: 100rpx;
4 | }
5 |
6 | .container>canvas {
7 | margin: 0 auto;
8 | }
9 |
10 | .tip {
11 | margin: 0 30rpx;
12 | text-align: center;
13 | }
14 |
--------------------------------------------------------------------------------
/pages/components/booklist-item/index.js:
--------------------------------------------------------------------------------
1 | import Promisify from '../../../utils/promisify'
2 |
3 | /**
4 | * 书单页的图书条目
5 | * @event
6 | */
7 | Component({
8 | properties: {
9 | // 图书数据
10 | book: Object,
11 | // 个性化描述
12 | comment: String,
13 | // 是否正在多选书目
14 | // 关闭多选模式时,重置所有图书条目为未选择状态
15 | isSelecting: {
16 | type: Boolean,
17 | value: false,
18 | observer: function (newVal, oldVal) {
19 | if (!newVal) this.setData({checked: false})
20 | }
21 | }
22 | },
23 |
24 | data: {
25 | checked: false // 是否被选中
26 | },
27 |
28 | methods: {
29 | _onTapCard: function () {
30 | const { isSelecting, checked, book: { id } } = this.data
31 | if (isSelecting) {
32 | this.setData({checked: !checked})
33 | this.triggerEvent('change', {
34 | checked: !checked
35 | })
36 | } else {
37 | wx.navigateTo({url: `/pages/book-detail/book-detail?id=${id}`})
38 | }
39 | },
40 |
41 | _onShowActionSheet: function () {
42 | Promisify(wx.showActionSheet)({
43 | itemList: ['编辑图书描述'],
44 | itemColor: '#000'
45 | }).then(res => {
46 | this.triggerEvent('modify')
47 | })
48 | }
49 | }
50 | })
51 |
--------------------------------------------------------------------------------
/pages/components/booklist-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/pages/components/booklist-item/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{book.title}}
5 |
6 | 评分:
7 | {{book.total_score}}({{book.review_num}}条评论)
8 | 作者: {{item}}
9 | 出版社: {{book.publisher}}
10 | 出版日期: {{book.pubdate}}
11 | ISBN: {{book.isbn}}
12 | {{comment}}
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/pages/components/booklist-item/index.wxss:
--------------------------------------------------------------------------------
1 | @import '/styles/font.wxss'
2 | @import '/styles/color.wxss'
3 | @import '/styles/weui.wxss'
4 | @import '/styles/ui.wxss'
5 |
6 |
7 | .booklist-item__action {
8 | width: 50px;
9 | height: 50px;
10 | align-self: center;
11 | text-align: right;
12 | }
13 | .booklist-item__icon-more {
14 | width: 30px;
15 | }
--------------------------------------------------------------------------------
/pages/components/home-search-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/pages/components/home-search-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{options.selected}}
7 |
8 |
9 |
10 | {{item}}
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | 分类
33 |
34 | 取消
35 |
--------------------------------------------------------------------------------
/pages/components/home-search-bar/index.wxss:
--------------------------------------------------------------------------------
1 | @import "/styles/weui.wxss";
2 | @import "/styles/icon.wxss";
3 | @import "/styles/ui.wxss";
4 |
5 | .home-search-bar {
6 | z-index: 2;
7 | flex-direction: row;
8 | align-items: stretch;
9 | }
10 |
11 | .home-search-bar__option-btn {
12 | display: flex;
13 | display: -webkit-flex;
14 | justify-content: center;
15 | align-items: center;
16 | position: absolute;
17 | left: 0;
18 | top: 0;
19 | width: 20%;
20 | height: 100%;
21 | font-size: 28rpx;
22 | color: #353535;
23 | border-right: 1rpx solid #ddd;
24 | }
25 |
26 | .home-search-bar__option-btn .icon-down {
27 | margin-left: 15rpx;
28 | padding-right: 0;
29 | color: #00C302;
30 | }
31 |
32 | .home-search-bar__option-list {
33 | position: absolute;
34 | left: 0;
35 | top: 100%;
36 | width: auto;
37 | border: 1rpx solid #ddd;
38 | border-radius: 8rpx;
39 | background-color: #fff;
40 | }
41 |
42 | .home-search-bar__option-item {
43 | padding: 20rpx 30rpx;
44 | margin-bottom: -1rpx;
45 | border-bottom: 1rpx solid #ddd;
46 | white-space: nowrap;
47 | font-size: 28rpx;
48 | color: #353535;
49 | }
50 |
51 | .home-search-bar__input-box {
52 | position: relative;
53 | left: 20%;
54 | width: 80%;
55 | }
56 |
57 | .home-search-bar__icon-scan {
58 | z-index: 2;
59 | position: absolute;
60 | top: 0;
61 | right: 0;
62 | width: 40rpx;
63 | height: 37rpx;
64 | padding: 10rpx 18rpx;
65 | }
66 |
67 | .home-search-bar__category {
68 | display: flex;
69 | display: -webkit-flex;
70 | flex-direction: column;
71 | justify-content: space-around;
72 | align-items: center;
73 | margin-left: 30rpx;
74 | margin-right: 10rpx;
75 | }
76 |
77 | .home-search-bar__category > image {
78 | width: 40rpx;
79 | }
80 |
81 | .home-search-bar__category > span {
82 | color: #888;
83 | line-height: 1.2;
84 | font-size: 20rpx;
85 | }
--------------------------------------------------------------------------------
/pages/home/children/advanced-search.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 | title: '',
5 | author: '',
6 | translator: '',
7 | publisher: '',
8 | pubdate_start: '',
9 | pubdate_end: '',
10 | selectedLanguageIndex: 0,
11 | languages: ['汉语', '英语']
12 | },
13 |
14 | onInput: function (e) {
15 | var params = {}
16 | params[e.currentTarget.dataset.label] = e.detail.value
17 | this.setData(params)
18 | },
19 |
20 | onDateChange: function (e) {
21 | switch (e.currentTarget.dataset.type) {
22 | case 'start':
23 | this.setData({pubdate_start: e.detail.value})
24 | break
25 | case 'end':
26 | this.setData({pubdate_end: e.detail.value})
27 | break
28 | }
29 | },
30 |
31 | onLanguageChange: function (e) {
32 | this.setData({selectedLanguageIndex: e.detail.value})
33 | },
34 |
35 | onReset: function () {
36 | this.setData({
37 | title: '',
38 | author: '',
39 | translator: '',
40 | publisher: '',
41 | pubdate_start: '',
42 | pubdate_end: '',
43 | selectedLanguageIndex: 0
44 | })
45 | },
46 |
47 | onSearch: function () {
48 | let { languages, selectedLanguageIndex } = this.data
49 | var url = '/pages/list/book?type=advanced_search'
50 | var params = ['title', 'author', 'translator', 'publisher',
51 | 'pubdate_start', 'pubdate_end']
52 |
53 | // 默认至少有一个language参数,其余参数如果只包含空格的话就忽略
54 | url += `&language=${languages[selectedLanguageIndex]}`
55 | params.forEach(e => {
56 | let str = this.data[e].trim()
57 | if (str) {
58 | url += `&${e}=${encodeURIComponent(str)}`
59 | }
60 | })
61 |
62 | wx.navigateTo({ url: url })
63 | }
64 | })
65 |
--------------------------------------------------------------------------------
/pages/home/children/advanced-search.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "高级搜索"
3 | }
--------------------------------------------------------------------------------
/pages/home/children/advanced-search.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/pages/home/children/advanced-search.wxss
--------------------------------------------------------------------------------
/pages/home/children/classification.js:
--------------------------------------------------------------------------------
1 | import { getSonNumbersByNumber } from '../../../apis/classification'
2 |
3 | Page({
4 | data: {
5 | number: 0, // 当前分类号,默认为根分类号‘0’
6 | sonNumbers: [], // 子分类号
7 | loadMoreStatus: 'hidding' // loading, nomore
8 | },
9 |
10 | onLoad: function (options) {
11 | this.setData({number: options.number || 0})
12 | wx.setNavigationBarTitle({title: options.name || '分类检索'})
13 | wx.showLoading({ title: '加载中', mask: true })
14 | this._fetchData().then(sonNumbers => {
15 | this.setData({sonNumbers: this.data.sonNumbers.concat(sonNumbers)})
16 | }).finally(() => wx.hideLoading())
17 | },
18 |
19 | onReachBottom: function () {
20 | let { loadMoreStatus, isNoData, sonNumbers } = this.data
21 | if (loadMoreStatus !== 'hidding' || isNoData) return
22 |
23 | this.setData({ loadMoreStatus: 'loading' })
24 | this._fetchData(sonNumbers.length).then(sonNumbers => {
25 | this.setData({
26 | sonNumbers: this.data.sonNumbers.concat(sonNumbers),
27 | loadMoreStatus: sonNumbers.length === 0 ? 'nomore' : 'hidding'
28 | })
29 | }).catch(() => this.setData({ loadMoreStatus: 'hidding' }))
30 | },
31 |
32 | _fetchData: function (start = 0) {
33 | return getSonNumbersByNumber(this.data.number, start).then(res => res.data.son_numbers)
34 | }
35 | })
36 |
--------------------------------------------------------------------------------
/pages/home/children/classification.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "",
3 | "usingComponents":
4 | {
5 | "load-more": "/components/load-more/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/pages/home/children/classification.wxml:
--------------------------------------------------------------------------------
1 | 请选择分类
2 |
3 |
4 | 查询下列所有分类的图书
5 |
6 |
7 |
8 |
9 |
10 | {{item.name}}
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/pages/home/children/classification.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/pages/home/children/classification.wxss
--------------------------------------------------------------------------------
/pages/home/home.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "主页",
3 | "enablePullDownRefresh": true,
4 | "usingComponents":
5 | {
6 | "home-search-bar": "/pages/components/home-search-bar/index",
7 | "panel": "/components/panel/index"
8 | }
9 | }
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | import { isLogin } from '../../utils/permission'
2 |
3 | /**
4 | * 判断登录状态并跳转
5 | */
6 | Page({
7 | onLoad: function () {
8 | if (isLogin()) {
9 | wx.switchTab({ url: '/pages/home/home' })
10 | } else {
11 | wx.redirectTo({url: '/pages/register/register'})
12 | }
13 | }
14 | })
15 |
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": ""
3 | }
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/pages/index/index.wxml
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #fff;
3 | }
--------------------------------------------------------------------------------
/pages/list/book.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "",
3 | "usingComponents":
4 | {
5 | "load-more": "/components/load-more/index",
6 | "no-data": "/components/no-data/index"
7 | }
8 | }
--------------------------------------------------------------------------------
/pages/list/book.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 根据你的借阅、收藏和评分等历史行为为你推荐
4 | 最近七天的热门图书
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{item.title}}
12 |
13 | 评分:
14 | {{item.total_score}}({{item.review_num}}条评论)
15 | 作者: {{item}}
16 | 出版社: {{item.publisher}}
17 | 出版日期: {{item.pubdate}}
18 | ISBN: {{item.isbn}}
19 | 藏书量: {{item.total_num}}({{item.available_num}}本可借)
20 | {{comments[index]}}
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/pages/list/book.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/pages/list/book.wxss
--------------------------------------------------------------------------------
/pages/list/booklist.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "",
3 | "usingComponents":
4 | {
5 | "load-more": "/components/load-more/index",
6 | "no-data": "/components/no-data/index"
7 | }
8 | }
--------------------------------------------------------------------------------
/pages/list/booklist.wxml:
--------------------------------------------------------------------------------
1 |
2 | 根据你的借阅、搜索和收藏等历史行为为你推荐
3 |
4 |
5 |
6 |
7 |
8 | {{item.title}}
9 |
10 | {{item.total}}本 by {{item.creator.nickname}},{{item.favorited_num}}人收藏
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/list/booklist.wxss:
--------------------------------------------------------------------------------
1 | /* pages/list/booklist.wxss */
--------------------------------------------------------------------------------
/pages/profile/children/about.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/pages/profile/children/about.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "关于"
3 | }
--------------------------------------------------------------------------------
/pages/profile/children/about.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 在线借书平台
4 |
5 |
6 |
7 | GitHub
8 | imageslr/weapp-library
9 |
10 |
11 | 开发者
12 | Images。
13 |
14 |
15 | 联系方式
16 | https://imageslr.com
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/profile/children/about.wxss:
--------------------------------------------------------------------------------
1 | .logo-container {
2 | margin-top: 36px;
3 | text-align: center;
4 | }
5 |
6 | image {
7 | display: inline-block;
8 | width: 80px;
9 | height: 80px;
10 | border-radius: 50%;
11 | margin-bottom: 5px;
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/pages/profile/children/children/order-detail.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "订单详情"
3 | }
--------------------------------------------------------------------------------
/pages/profile/children/children/order-detail.wxss:
--------------------------------------------------------------------------------
1 | @import '/templates/page-status-indicator/index.wxss'
2 |
3 | .library__name {
4 | display: -webkit-box;
5 | display: -webkit-flex;
6 | display: flex;
7 | align-items: center;
8 | line-height: 1.8em;
9 | }
10 |
11 | .library__name image {
12 | flex: 0 0 40rpx;
13 | width: 30rpx;
14 | height: 30rpx;
15 | vertical-align: middle;
16 | }
--------------------------------------------------------------------------------
/pages/profile/children/children/personal-information-modify.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "设置个人信息",
3 | "usingComponents":
4 | {
5 | "toptip": "/components/toptip/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/pages/profile/children/children/personal-information-modify.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding-bottom: 25px;
3 | }
4 |
5 | .weui-uploader__file {
6 | position: relative;
7 | }
8 |
9 | icon {
10 | position: absolute;
11 | right: 0rpx;
12 | top: 0rpx;
13 | }
--------------------------------------------------------------------------------
/pages/profile/children/order-history.js:
--------------------------------------------------------------------------------
1 | import { getOrdersByUserId } from '../../../apis/order'
2 | import { getUID } from '../../../utils/permission'
3 |
4 | Page({
5 | data: {
6 | pageStatus: 'loading', // error, done
7 | orders: [],
8 | loadMoreStatus: 'hidding' // loading, nomore
9 | },
10 |
11 | /**
12 | * @listens
13 | * 事件在订单详情页(./children/order-detail)中被触发
14 | */
15 | onLoad: function () {
16 | // 监听事件
17 | getApp().event.on('orderDeleted', this.onOrderDeleted)
18 | this._loadPage()
19 | },
20 |
21 | onReloadPage: function () {
22 | this._loadPage()
23 | },
24 |
25 | onReachBottom: function () {
26 | const { loadMoreStatus, orders } = this.data
27 | if (loadMoreStatus !== 'hidding') return
28 |
29 | this.setData({loadMoreStatus: 'loading'})
30 | getOrdersByUserId(getUID(), 'history', orders.length).then(res => {
31 | this.setData({
32 | orders: orders.concat(res.data.orders),
33 | loadMoreStatus: res.data.orders.length ? 'hidding' : 'nomore'
34 | })
35 | }).catch(() => this.setData({loadMoreStatus: 'hidding'}))
36 | },
37 |
38 | onOrderDeleted: function (e) {
39 | const { orders } = this.data
40 | const orderId = e.order.id
41 | this.setData({orders: orders.filter(e => e.id != orderId)})
42 | },
43 |
44 | _loadPage: function () {
45 | this.setData({pageStatus: 'loading'})
46 | getOrdersByUserId(getUID(), 'history').then(res => {
47 | this.setData({
48 | pageStatus: 'done',
49 | orders: res.data.orders
50 | })
51 | }).catch(() => this.setData({pageStatus: 'error'}))
52 | }
53 | })
54 |
--------------------------------------------------------------------------------
/pages/profile/children/order-history.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "借阅历史",
3 | "usingComponents":
4 | {
5 | "load-more": "/components/load-more/index",
6 | "no-data": "/components/no-data/index"
7 | }
8 | }
--------------------------------------------------------------------------------
/pages/profile/children/order-history.wxml:
--------------------------------------------------------------------------------
1 |
2 | module.exports = require('../../../utils/constant.wxs').ORDER_STATUS
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{item.book.title}}
12 | 作者:
13 | {{item}}
14 |
15 | 出版社: {{item.book.publisher}}
16 | 图书馆: {{item.library.name}}
17 |
18 | 创建日期:{{item.created_at}}
19 | 订单状态:已取消
20 |
21 |
22 | 借阅日期:{{item.actual_take_time}}
23 | 还书日期:{{item.actual_return_time}}
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/pages/profile/children/order-history.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/pages/profile/children/order-history.wxss
--------------------------------------------------------------------------------
/pages/profile/children/order-ongoing.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "借阅进度",
3 | "usingComponents":
4 | {
5 | "tab-bar": "/components/tab-bar/index",
6 | "load-more": "/components/load-more/index",
7 | "no-data": "/components/no-data/index"
8 | }
9 | }
--------------------------------------------------------------------------------
/pages/profile/children/order-ongoing.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | height: 100%;
3 | }
4 |
5 | .order-list {
6 | height: 100%;
7 | /* padding-bottom:1rpx; TODO --- 在iphone中load-more底部的margin不显示 */
8 | }
--------------------------------------------------------------------------------
/pages/profile/children/personal-information.js:
--------------------------------------------------------------------------------
1 | import { USER_STATUS_REVIEWING, USER_STATUS_APPROVED, USER_STATUS_REJECTED } from '../../../utils/constant'
2 |
3 | var app = getApp()
4 |
5 | Page({
6 | data: {
7 | userInfo: {
8 | status: undefined, // 0: 未审核 1: 已通过 2: 未通过 3: 已拉黑
9 | name: '',
10 | birthday: '',
11 | id_number: '',
12 | postcode: '',
13 | address: '',
14 | id_card_img: {
15 | front: '',
16 | back: ''
17 | }
18 | },
19 | tips: ''
20 | },
21 |
22 | /**
23 | * @listens app.setUserInfo 调用时触发
24 | */
25 | onLoad: function () {
26 | wx.showLoading({title: '加载中', mask: true})
27 | this._setUserInfo().finally(() => wx.hideLoading())
28 |
29 | // 监听事件
30 | app.event.on('userInfoChanged', this._setUserInfo)
31 | },
32 |
33 | onPreview: function (e) {
34 | let { front, back } = this.data.userInfo.id_card_img
35 | let type = e.currentTarget.dataset.type
36 | wx.previewImage({
37 | // 当前显示图片的http链接
38 | current: this.data.userInfo.id_card_img[type],
39 | // 需要预览的图片http链接列表,filter过滤空url
40 | urls: [front, back].filter(e => e)
41 | })
42 | },
43 |
44 | _setUserInfo: function () {
45 | return app.getUserInfo().then(userInfo => {
46 | this.setData({userInfo})
47 | if (userInfo.status === USER_STATUS_REVIEWING) {
48 | this.setData({
49 | tips: '您的信息正在审核中,在此期间您可以重新设置您的个人信息,审核通过后您将可以在线预约图书。'
50 | })
51 | } else if (userInfo.status === USER_STATUS_APPROVED) {
52 | this.setData({
53 | tips: '您的信息已通过审核,您现在可以在线预约图书。如果您需要修改个人信息,请通过“意见反馈”联系管理员。'
54 | })
55 | } else if (userInfo.status === USER_STATUS_REJECTED) {
56 | this.setData({
57 | tips: `您的信息没有通过审核,原因是:${userInfo.review_msg}。您可修改后重新提交审核,审核通过后您将可以在线预约图书。`
58 | })
59 | }
60 | })
61 | }
62 | })
63 |
--------------------------------------------------------------------------------
/pages/profile/children/personal-information.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "个人信息"
3 | }
--------------------------------------------------------------------------------
/pages/profile/children/personal-information.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding-bottom: 25px;
3 | }
--------------------------------------------------------------------------------
/pages/profile/children/qrcode.js:
--------------------------------------------------------------------------------
1 |
2 | import QR from '../../../utils/qrcode.js'
3 | import { getToken } from '../../../utils/permission'
4 |
5 | Page({
6 | onReady: function () {
7 | var size = this.setCanvasSize() // 动态设置画布大小
8 | var params = JSON.stringify({ token: getToken(), time: Date.now()})
9 | QR.qrApi.draw(params, 'qrcode', size.w, size.h)
10 | },
11 |
12 | // 适配不同屏幕大小的canvas
13 | setCanvasSize: function () {
14 | var size = {}
15 | try {
16 | var res = wx.getSystemInfoSync()
17 | var scale = 750 / 686// 不同屏幕下canvas的适配比例;设计稿是750宽
18 | var width = res.windowWidth / scale
19 | var height = width// canvas画布为正方形
20 | size.w = width
21 | size.h = height
22 | } catch (e) {
23 | console.log('获取设备信息失败' + e)
24 | }
25 | return size
26 | }
27 | })
28 |
--------------------------------------------------------------------------------
/pages/profile/children/qrcode.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "我的二维码"
3 | }
--------------------------------------------------------------------------------
/pages/profile/children/qrcode.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 请将您的个人二维码出示给管理员
--------------------------------------------------------------------------------
/pages/profile/children/qrcode.wxss:
--------------------------------------------------------------------------------
1 |
2 | .container {
3 | margin-top: 50px;
4 | }
5 |
6 | .container>canvas {
7 | margin: 0 auto;
8 | }
9 |
10 | .tip {
11 | margin: 10px 15px;
12 | text-align: center;
13 | }
14 |
--------------------------------------------------------------------------------
/pages/profile/children/review.js:
--------------------------------------------------------------------------------
1 | import { getReviewsByUserId, deleteReviewById } from '../../../apis/review'
2 | import { getUID } from '../../../utils/permission'
3 | import { showTip } from '../../../utils/tip'
4 |
5 | Page({
6 | data: {
7 | pageStatus: 'loading', // error, done
8 | reviews: [],
9 | loadMoreStatus: 'hidding' // loading, nomore
10 | },
11 |
12 | onLoad: function (options) {
13 | showTip('MY_REVIEWS')
14 | this._loadPage()
15 | },
16 |
17 | onReloadPage: function () {
18 | this._loadPage()
19 | },
20 |
21 | onReachBottom: function () {
22 | let status = this.data.loadMoreStatus
23 | if (status !== 'hidding') return
24 |
25 | this.setData({ loadMoreStatus: 'loading' })
26 | let reviews = this.data.reviews
27 | getReviewsByUserId(getUID(), reviews.length).then(res => {
28 | this.setData({
29 | 'reviews': reviews.concat(res.data.reviews),
30 | 'loadMoreStatus': res.data.reviews.length ? 'hidding' : 'nomore'
31 | })
32 | }).catch(() => this.setData({ loadMoreStatus: 'hidding' }))
33 | },
34 |
35 | onDelete: function (e) {
36 | let { id, index } = e.currentTarget.dataset
37 | wx.showModal({
38 | title: '删除评论',
39 | content: '确定删除这条评论?这项操作将无法撤销',
40 | success: res => {
41 | if (res.confirm) {
42 | wx.showLoading({title: '删除中', mask: true})
43 | deleteReviewById(id).then(() => {
44 | wx.hideLoading()
45 | this.data.reviews.splice(index, 1)
46 | this.setData({ reviews: this.data.reviews })
47 | wx.showToast({title: '删除成功'})
48 | }).catch(() => wx.hideLoading())
49 | }
50 | }
51 | })
52 | },
53 |
54 | _loadPage: function () {
55 | this.setData({pageStatus: 'loading'})
56 | getReviewsByUserId(getUID()).then(res => {
57 | this.setData({
58 | pageStatus: 'done',
59 | reviews: res.data.reviews
60 | })
61 | }).catch(() => this.setData({pageStatus: 'error'}))
62 | }
63 | })
64 |
--------------------------------------------------------------------------------
/pages/profile/children/review.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "我的书评",
3 | "usingComponents":
4 | {
5 | "rate": "/components/rate/index",
6 | "load-more": "/components/load-more/index",
7 | "no-data": "/components/no-data/index"
8 | }
9 | }
--------------------------------------------------------------------------------
/pages/profile/children/review.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 发表于《{{item.book.title}}》
9 |
10 |
11 |
12 |
13 | {{item.created_at}}
14 | {{item.content}}
15 |
16 | 删除
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/pages/profile/children/review.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/pages/profile/children/review.wxss
--------------------------------------------------------------------------------
/pages/profile/navigate.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/pages/profile/navigate.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "暂未开发"
3 | }
--------------------------------------------------------------------------------
/pages/profile/navigate.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 该功能暂未开发
5 |
6 |
--------------------------------------------------------------------------------
/pages/profile/navigate.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #fff;
3 | }
4 |
5 | .code {
6 | width: 180px;
7 | height:180px;
8 | margin: 100px auto 30px;
9 | border-radius: 50%;
10 | border: 1px solid #ddd;
11 | overflow: hidden;
12 | }
13 |
14 | .code > image {
15 | width: 180px;
16 | height:180px;
17 | }
18 |
19 | .weui-cells__tips {
20 | text-align: center;
21 | }
--------------------------------------------------------------------------------
/pages/profile/profile.js:
--------------------------------------------------------------------------------
1 | import Promisify from '../../utils/promisify'
2 | import { updateUserInfoById } from '../../apis/user'
3 | import { logout, getUID } from '../../utils/permission'
4 |
5 | var app = getApp()
6 |
7 | Page({
8 | data: {
9 | showLoginBtn: false
10 | },
11 |
12 | onLoad: function () {
13 | // 获取用户授权,更新用户昵称与头像
14 | Promisify(wx.getUserInfo)()
15 | .then(this._updateUserInfo)
16 | .catch(() => this.setData({showLoginBtn: true}))
17 | },
18 |
19 | onLogout: function () {
20 | wx.showModal({
21 | content: '确定退出登录?',
22 | success: res => {
23 | if (res.confirm && logout()) {
24 | wx.reLaunch({ url: '/pages/register/register' })
25 | }
26 | }
27 | })
28 | },
29 |
30 | onClickLoginBtn: function (e) {
31 | let { errMsg } = e.detail
32 | if (errMsg.indexOf('fail') === -1) {
33 | this._updateUserInfo(e.detail).then(() => {
34 | this.setData({showLoginBtn: false})
35 | })
36 | wx.showToast({title: '授权成功'})
37 | }
38 | },
39 |
40 | _updateUserInfo: function (userInfo) {
41 | return updateUserInfoById(getUID(), {
42 | nickname: userInfo.userInfo.nickName,
43 | avatar: userInfo.userInfo.avatarUrl
44 | }).then(res => app.setUserInfo(res))
45 | }
46 | })
47 |
--------------------------------------------------------------------------------
/pages/profile/profile.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "我的",
3 | "usingComponents":
4 | {
5 | "collapse": "/components/collapse/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/pages/profile/profile.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding-bottom: 20px;
3 | }
4 |
5 | .collapse__header {
6 | background-color: #FFBF00 !important;
7 | color: #FFF !important;
8 | border-top: none !important;
9 | }
10 |
11 | collapse .ui-card {
12 | padding: 15px;
13 | }
14 | collapse .ui-card:before {
15 | display: none;
16 | }
17 |
18 | .icon {
19 | margin-right: 5px;
20 | vertical-align: middle;
21 | width:20px;
22 | height: 20px;
23 | }
24 |
25 | .user-info__avatar {
26 | width: 64px;
27 | height: 64px;
28 | margin-right: 15px;
29 | vertical-align: middle;
30 | border-radius: 32px;
31 | overflow: hidden;
32 | }
33 |
34 | .user-info__name {
35 | margin-bottom: 12rpx;
36 | }
--------------------------------------------------------------------------------
/pages/register/children/result.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/pages/register/children/result.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "注册成功"
3 | }
--------------------------------------------------------------------------------
/pages/register/children/result.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 注册成功
7 | 完善个人信息后即可在线借阅图书
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/register/children/result.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #FFF;
3 | }
--------------------------------------------------------------------------------
/pages/register/register.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "注册/登录",
3 | "usingComponents":
4 | {
5 | "send-code": "/components/send-code/index",
6 | "toptip": "/components/toptip/index",
7 | "toast": "/components/toast/index"
8 | }
9 | }
--------------------------------------------------------------------------------
/pages/register/register.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 国家/地区
8 |
9 |
10 |
11 | {{countries[countryIndex]}}
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 |
--------------------------------------------------------------------------------
/pages/register/register.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | padding-top: 30rpx;
3 | }
4 |
5 |
--------------------------------------------------------------------------------
/simplest-mock-server/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
--------------------------------------------------------------------------------
/simplest-mock-server/Dockerfile:
--------------------------------------------------------------------------------
1 | # https://hub.docker.com/_/node
2 | FROM node:10.10.0-slim
3 |
4 | # Create and change to the app directory.
5 | WORKDIR /usr/src/app
6 |
7 | # Copy application dependency manifests to the container image.
8 | # A wildcard is used to ensure both package.json AND package-lock.json are copied.
9 | # Copying this separately prevents re-running npm install on every code change.
10 | COPY package*.json ./
11 |
12 | # Install production dependencies.
13 | RUN npm install --only=production
14 |
15 | RUN npm install -g gulp
16 |
17 | # Copy local code to the container image.
18 | COPY . ./
19 |
20 | # Run the web service on container startup.
21 | CMD [ "gulp", "mock" ]
--------------------------------------------------------------------------------
/simplest-mock-server/README_en.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/simplest-mock-server/README_en.md
--------------------------------------------------------------------------------
/simplest-mock-server/assets/04-16-13-22-37.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/simplest-mock-server/assets/04-16-13-22-37.png
--------------------------------------------------------------------------------
/simplest-mock-server/example/DELETE/api/v1/booklists/{id}.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/simplest-mock-server/example/DELETE/api/v1/orders/{id}.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/simplest-mock-server/example/DELETE/api/v1/reviews/{id}.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/booklists/recommend/{phone}.json:
--------------------------------------------------------------------------------
1 | [{
2 | "status": 0,
3 | "id": "@integer(60, 100)",
4 | "creator": {
5 | "phone": "@string",
6 | "nickname": "@string"
7 | },
8 | "title": "我的收藏集",
9 | "image": "https://img1.doubanio.com/spic/s1237549.jpg",
10 | "total": "@integer(60, 100)",
11 | "favorited_num": "@integer(60, 100)"
12 | }, {
13 | "status": 0,
14 | "id": "@integer(60, 100)",
15 | "creator": {
16 | "phone": "@string",
17 | "nickname": "@string"
18 | },
19 | "title": "给你人生哲理的书",
20 | "image": "https://img1.doubanio.com/spic/s27264181.jpg",
21 | "total": "@integer(60, 100)",
22 | "favorited_num": "@integer(60, 100)"
23 | }, {
24 | "status": 0,
25 | "id": "@integer(60, 100)",
26 | "creator": {
27 | "phone": "@string",
28 | "nickname": "@string"
29 | },
30 | "title": "经典好书",
31 | "image": "https://img1.doubanio.com/spic/s1513425.jpg",
32 | "total": "@integer(60, 100)",
33 | "favorited_num": "@integer(60, 100)"
34 | }, {
35 | "status": 0,
36 | "id": "@integer(60, 100)",
37 | "creator": {
38 | "phone": "@string",
39 | "nickname": "@string"
40 | },
41 | "title": "励志书籍",
42 | "image": "https://img1.doubanio.com/spic/s29451990.jpg",
43 | "total": "@integer(60, 100)",
44 | "favorited_num": "@integer(60, 100)"
45 | }]
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/booklists/users/{id}.json:
--------------------------------------------------------------------------------
1 | {
2 | "create": [{
3 | "status": 1,
4 | "id": "@integer(60, 100)",
5 | "creator": {
6 | "phone": "@string",
7 | "nickname": "@name"
8 | },
9 | "title": "我的收藏集",
10 | "image": "https://img1.doubanio.com/spic/s1237549.jpg",
11 | "total": "@integer(60, 100)",
12 | "favorited_num": "@integer(60, 100)"
13 | }, {
14 | "status": 1,
15 | "id": "@integer(60, 100)",
16 | "creator": {
17 | "phone": "@string",
18 | "nickname": "@name"
19 | },
20 | "title": "经典好书",
21 | "image": "https://img1.doubanio.com/spic/s1513425.jpg",
22 | "total": "@integer(60, 100)",
23 | "favorited_num": "@integer(60, 100)"
24 | }],
25 | "favorite": [{
26 | "status": 1,
27 | "id": "@integer(60, 100)",
28 | "creator": {
29 | "phone": "@string",
30 | "nickname": "@name"
31 | },
32 | "title": "给你人生哲理的书",
33 | "image": "https://img1.doubanio.com/spic/s29451990.jpg",
34 | "total": "@integer(60, 100)",
35 | "favorited_num": "@integer(60, 100)"
36 | }, {
37 | "status": 1,
38 | "id": "@integer(60, 100)",
39 | "creator": {
40 | "phone": "@string",
41 | "nickname": "@name"
42 | },
43 | "title": "励志书籍",
44 | "image": "https://img1.doubanio.com/spic/s27264181.jpg",
45 | "total": "@integer(60, 100)",
46 | "favorited_num": "@integer(60, 100)"
47 | }]
48 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/classifications/{id}/sons.json:
--------------------------------------------------------------------------------
1 | {
2 | "son_numbers|10-20": [{
3 | "number": "string",
4 | "parent_number": "string",
5 | "name": "@name()",
6 | "has_son|1": [true, false]
7 | }],
8 | "start": 0,
9 | "count": 0,
10 | "total": 0
11 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/codes/check.json:
--------------------------------------------------------------------------------
1 | {
2 | "token": "12312312",
3 | "user": {
4 | "id": 1,
5 | "phone": "13000000000",
6 | "openid": "@id",
7 | "status": 0,
8 | "review_msg": "@paragraph(1, 3)",
9 | "nickname": "@nickname",
10 | "avatar": "",
11 | "name": "@cname",
12 | "birthday": "@now",
13 | "id_number": "@natural",
14 | "id_card_img": {
15 | "front": "",
16 | "back": ""
17 | },
18 | "address": "@city(true)",
19 | "postcode": "@natural(100000, 100099)",
20 | "deposit_status": 0,
21 | "reading_statistics": {
22 | "book_num": "@natural(60, 100)",
23 | "page_num": "@natural(60, 100)"
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/images.json:
--------------------------------------------------------------------------------
1 | {
2 | "url": "@image('200x100', '@hex', '@hex', 'png', '@name')"
3 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/libraries/{id}.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "@integer(60, 100)",
3 | "status": 0,
4 | "review_msg": "@string",
5 | "name": "北京大学图书馆",
6 | "phone": "010-68123492",
7 | "address": "一个很长很长很长很长很长很长很长很长的地址",
8 | "introduction": "@cparagraph(1, 3)",
9 | "book_type_num": "@integer(60, 100)",
10 | "book_total_num": "@integer(60, 100)",
11 | "order_total_num": "@integer(60, 100)",
12 | "recent_order_num": [
13 | "@integer(60, 100)"
14 | ],
15 | "recent_borrowed_books_ranking": [{
16 | "book_id": "@integer(60, 100)",
17 | "title": "@string",
18 | "number": "@integer(60, 100)"
19 | }],
20 | "total_borrowed_books_ranking": [{
21 | "book_id": "@integer(60, 100)",
22 | "name": "@string",
23 | "value": "@integer(60, 100)"
24 | }],
25 | "order_accounting": "@float(60, 100, 3, 5)",
26 | "photos": [
27 | "http://n1-q.mafengwo.net/s7/M00/8B/BE/wKgB6lRs4X-AJ4pOACX-OTdBrLk34.jpeg?imageMogr2%2Fthumbnail%2F%21690x370r%2Fgravity%2FCenter%2Fcrop%2F%21690x370%2Fquality%2F100"
28 | ],
29 | "qualifications": [
30 | "@string"
31 | ],
32 | "admin_name": "@string",
33 | "admin_phone": "@string"
34 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/orders/return.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "@integer(60, 100)",
3 | "status": 1001,
4 | "user": {
5 | "id": "@integer(60, 100)",
6 | "phone": "@string",
7 | "nickname": "@string",
8 | "avatar": "@string"
9 | },
10 | "book": {
11 | "id": "@integer(60, 100)",
12 | "title": "@string",
13 | "isbn": "@string",
14 | "publisher": "@string",
15 | "pubdate": "@string",
16 | "class_num": "@string",
17 | "call_number": "@string",
18 | "author": [
19 | "@string"
20 | ],
21 | "translator": [
22 | "@string"
23 | ],
24 | "binding": "精装",
25 | "price": "@float(60, 100, 3, 5)",
26 | "pages": "@integer(60, 100)",
27 | "words": "@integer(60, 100)",
28 | "tags": [
29 | "@string"
30 | ],
31 | "total_score": "@float(60, 100, 3, 5)",
32 | "review_num": "@integer(60, 100)",
33 | "imgs": {
34 | "small": "@string",
35 | "medium": "@string",
36 | "large": "@string"
37 | },
38 | "total_num": "@integer(60, 100)",
39 | "available_num": "@integer(60, 100)"
40 | },
41 | "library": {
42 | "id": "@integer(60, 100)",
43 | "status": 0,
44 | "name": "@string",
45 | "phone": "@string",
46 | "address": "@string",
47 | "introduction": "@string",
48 | "book_type_num": "@integer(60, 100)",
49 | "book_total_num": "@integer(60, 100)",
50 | "photos": [
51 | "@string"
52 | ]
53 | },
54 | "create_time": "@string",
55 | "shoule_take_time": "@string",
56 | "actual_take_time": "@string",
57 | "renew_count": "@string",
58 | "shoule_return_time": "@string",
59 | "actual_return_time": "@string",
60 | "fine": "@float(60, 100, 3, 5)"
61 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/orders/{id}/take.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "@integer(60, 100)",
3 | "status": 1001,
4 | "user": {
5 | "id": "@integer(60, 100)",
6 | "phone": "@string",
7 | "nickname": "@string",
8 | "avatar": "@string"
9 | },
10 | "book": {
11 | "id": "@integer(60, 100)",
12 | "title": "@string",
13 | "isbn": "@string",
14 | "publisher": "@string",
15 | "pubdate": "@string",
16 | "class_num": "@string",
17 | "call_number": "@string",
18 | "author": [
19 | "@string"
20 | ],
21 | "translator": [
22 | "@string"
23 | ],
24 | "binding": "精装",
25 | "price": "@float(60, 100, 3, 5)",
26 | "pages": "@integer(60, 100)",
27 | "words": "@integer(60, 100)",
28 | "tags": [
29 | "@string"
30 | ],
31 | "total_score": "@float(60, 100, 3, 5)",
32 | "review_num": "@integer(60, 100)",
33 | "imgs": {
34 | "small": "@string",
35 | "medium": "@string",
36 | "large": "@string"
37 | },
38 | "total_num": "@integer(60, 100)",
39 | "available_num": "@integer(60, 100)"
40 | },
41 | "library": {
42 | "id": "@integer(60, 100)",
43 | "status": 0,
44 | "name": "@string",
45 | "phone": "@string",
46 | "address": "@string",
47 | "introduction": "@string",
48 | "book_type_num": "@integer(60, 100)",
49 | "book_total_num": "@integer(60, 100)",
50 | "photos": [
51 | "@string"
52 | ]
53 | },
54 | "create_time": "@string",
55 | "shoule_take_time": "@string",
56 | "actual_take_time": "@string",
57 | "renew_count": "@string",
58 | "shoule_return_time": "@string",
59 | "actual_return_time": "@string",
60 | "fine": "@float(60, 100, 3, 5)"
61 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/reviews/{id}.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/users.json:
--------------------------------------------------------------------------------
1 | {
2 | "_res": {
3 | "status": 201,
4 | "data": {
5 |
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/GET/api/v1/users/{phone}.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "@integer(60, 100)",
3 | "phone": "@string",
4 | "openid": "otvxTs4dckWG7imySrJd6jSi0CWE",
5 | "status|1": [0, 2],
6 | "review_msg": "@cparagraph(1, 3)",
7 | "nickname": "@first",
8 | "avatar|1": [
9 | "https://img3.doubanio.com/icon/u1373026-121.jpg",
10 | "https://img1.doubanio.com/icon/u3815216-37.jpg",
11 | "https://img3.doubanio.com/icon/u55753308-31.jpg",
12 | "https://img1.doubanio.com/icon/u3719134-8.jpg",
13 | "https://img3.doubanio.com/icon/u136742199-2.jpg",
14 | "https://img3.doubanio.com/icon/u171642416-1.jpg",
15 | "https://img3.doubanio.com/icon/u176837971-1.jpg"
16 | ],
17 | "name": "@cname",
18 | "birthday": "@date",
19 | "id_number": "@id",
20 | "id_card_img": {
21 | "front": "http://ww2.sinaimg.cn/mw690/7cc829d3gw1f54ibvilhxj20g40c30tg.jpg",
22 | "back": "http://imgsrc.baidu.com/image/c0%3Dpixel_huitu%2C0%2C0%2C294%2C40/sign=b05d0b3c38fa828bc52e95a394672458/d788d43f8794a4c2717d681205f41bd5ad6e39a8.jpg"
23 | },
24 | "address": "@city()",
25 | "postcode": "@zip",
26 | "deposit_status": 0,
27 | "reading_statistics": {
28 | "book_num": "@integer(60, 200)",
29 | "page_num": "@integer(1001, 10000)"
30 | }
31 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/POST/api/v1/booklists.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/simplest-mock-server/example/POST/api/v1/booklists/{id}/favorite.json:
--------------------------------------------------------------------------------
1 | {
2 | "status|1": [0, 2],
3 | "id": "@integer(60, 100)",
4 | "creator": {
5 | "phone": "@string",
6 | "nickname": "@string"
7 | },
8 | "title": "@string",
9 | "description": "@string",
10 | "image": "@string",
11 | "start": "@integer(60, 100)",
12 | "count": "@integer(60, 100)",
13 | "total": "@integer(60, 100)",
14 | "items": [{
15 | "book": {
16 | "id": "@integer(60, 100)",
17 | "title": "@string",
18 | "isbn": "@string",
19 | "publisher": "@string",
20 | "pubdate": "@string",
21 | "class_num": "@string",
22 | "call_number": "@string",
23 | "author": [
24 | "@string"
25 | ],
26 | "translator": [
27 | "@string"
28 | ],
29 | "binding": "精装",
30 | "price": "@float(60, 100, 3, 5)",
31 | "pages": "@integer(60, 100)",
32 | "words": "@integer(60, 100)",
33 | "tags": [
34 | "@string"
35 | ],
36 | "total_score": "@float(60, 100, 3, 5)",
37 | "review_num": "@integer(60, 100)",
38 | "imgs": {
39 | "small": "@string",
40 | "medium": "@string",
41 | "large": "@string"
42 | },
43 | "total_num": "@integer(60, 100)",
44 | "available_num": "@integer(60, 100)"
45 | },
46 | "comment": "@string"
47 | }],
48 | "favorited_num": "@integer(60, 100)",
49 | "create_time": "@string",
50 | "update_time": "@string"
51 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/POST/api/v1/books/{id}/reviews.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "@integer(60, 100)",
3 | "is_creator": true,
4 | "user": {
5 | "id": "@integer(60, 100)",
6 | "phone": "@string",
7 | "nickname": "@name",
8 | "avatar|1": [
9 | "https://img3.doubanio.com/icon/u1373026-121.jpg",
10 | "https://img1.doubanio.com/icon/u3815216-37.jpg",
11 | "https://img3.doubanio.com/icon/u55753308-31.jpg",
12 | "https://img1.doubanio.com/icon/u3719134-8.jpg",
13 | "https://img3.doubanio.com/icon/u136742199-2.jpg",
14 | "https://img3.doubanio.com/icon/u171642416-1.jpg",
15 | "https://img3.doubanio.com/icon/u176837971-1.jpg"
16 | ]
17 | },
18 | "book": {
19 | "id": "@integer(60, 100)",
20 | "title": "@string",
21 | "isbn": "@string",
22 | "publisher": "@string",
23 | "pubdate": "@string",
24 | "class_num": "@string",
25 | "call_number": "@string",
26 | "author": [
27 | "@string"
28 | ],
29 | "translator": [
30 | "@string"
31 | ],
32 | "binding": "精装",
33 | "price": "@float(60, 100, 3, 5)",
34 | "pages": "@integer(60, 100)",
35 | "words": "@integer(60, 100)",
36 | "tags": [
37 | "@string"
38 | ],
39 | "total_score": "@float(60, 100, 3, 5)",
40 | "review_num": "@integer(60, 100)",
41 | "imgs": {
42 | "small": "@string",
43 | "medium": "@string",
44 | "large": "@string"
45 | },
46 | "total_num": "@integer(60, 100)",
47 | "available_num": "@integer(60, 100)"
48 | },
49 | "score": "@integer(1, 10)",
50 | "content": "@cparagraph(1, 3)",
51 | "create_time": "@datetime"
52 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/POST/api/v1/codes.json:
--------------------------------------------------------------------------------
1 | {
2 | "_res": {
3 | "status": 400,
4 | "data": function({
5 | _req
6 | }) {
7 | return {
8 | "message": "随便输入一个手机号与验证码"
9 | }
10 | }
11 | },
12 | "message": "发送成功"
13 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/POST/api/v1/orders/{id}/cancel.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "@integer(60, 100)",
3 | "status": 1001,
4 | "user": {
5 | "id": "@integer(60, 100)",
6 | "phone": "@string",
7 | "nickname": "@string",
8 | "avatar": "@string"
9 | },
10 | "book": {
11 | "id": "@integer(60, 100)",
12 | "title": "@string",
13 | "isbn": "@string",
14 | "publisher": "@string",
15 | "pubdate": "@string",
16 | "class_num": "@string",
17 | "call_number": "@string",
18 | "author": [
19 | "@string"
20 | ],
21 | "translator": [
22 | "@string"
23 | ],
24 | "binding": "精装",
25 | "price": "@float(60, 100, 3, 5)",
26 | "pages": "@integer(60, 100)",
27 | "words": "@integer(60, 100)",
28 | "tags": [
29 | "@string"
30 | ],
31 | "total_score": "@float(60, 100, 3, 5)",
32 | "review_num": "@integer(60, 100)",
33 | "imgs": {
34 | "small": "@string",
35 | "medium": "@string",
36 | "large": "@string"
37 | },
38 | "total_num": "@integer(60, 100)",
39 | "available_num": "@integer(60, 100)"
40 | },
41 | "library": {
42 | "id": "@integer(60, 100)",
43 | "status": 0,
44 | "name": "@string",
45 | "phone": "@string",
46 | "address": "@string",
47 | "introduction": "@string",
48 | "book_type_num": "@integer(60, 100)",
49 | "book_total_num": "@integer(60, 100)",
50 | "photos": [
51 | "@string"
52 | ]
53 | },
54 | "create_time": "@string",
55 | "shoule_take_time": "@string",
56 | "actual_take_time": "@string",
57 | "renew_count": "@string",
58 | "shoule_return_time": "@string",
59 | "actual_return_time": "@string",
60 | "fine": "@float(60, 100, 3, 5)"
61 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/POST/api/v1/orders/{id}/renew.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "@integer(60, 100)",
3 | "status": 1001,
4 | "user": {
5 | "id": "@integer(60, 100)",
6 | "phone": "@string",
7 | "nickname": "@string",
8 | "avatar": "@string"
9 | },
10 | "book": {
11 | "id": "@integer(60, 100)",
12 | "title": "@string",
13 | "isbn": "@string",
14 | "publisher": "@string",
15 | "pubdate": "@string",
16 | "class_num": "@string",
17 | "call_number": "@string",
18 | "author": [
19 | "@string"
20 | ],
21 | "translator": [
22 | "@string"
23 | ],
24 | "binding": "精装",
25 | "price": "@float(60, 100, 3, 5)",
26 | "pages": "@integer(60, 100)",
27 | "words": "@integer(60, 100)",
28 | "tags": [
29 | "@string"
30 | ],
31 | "total_score": "@float(60, 100, 3, 5)",
32 | "review_num": "@integer(60, 100)",
33 | "imgs": {
34 | "small": "@string",
35 | "medium": "@string",
36 | "large": "@string"
37 | },
38 | "total_num": "@integer(60, 100)",
39 | "available_num": "@integer(60, 100)"
40 | },
41 | "library": {
42 | "id": "@integer(60, 100)",
43 | "status": 0,
44 | "name": "@string",
45 | "phone": "@string",
46 | "address": "@string",
47 | "introduction": "@string",
48 | "book_type_num": "@integer(60, 100)",
49 | "book_total_num": "@integer(60, 100)",
50 | "photos": [
51 | "@string"
52 | ]
53 | },
54 | "create_time": "@string",
55 | "shoule_take_time": "@string",
56 | "actual_take_time": "@string",
57 | "renew_count": "@string",
58 | "shoule_return_time": "@string",
59 | "actual_return_time": "@string",
60 | "fine": "@float(60, 100, 3, 5)"
61 | }
--------------------------------------------------------------------------------
/simplest-mock-server/example/POST/api/v1/users/{phone}.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "@integer(60, 100)",
3 | "phone": "@string",
4 | "openid": "otvxTs4dckWG7imySrJd6jSi0CWE",
5 | "status|1": [0, 2],
6 | "review_msg": "@cparagraph(1, 3)",
7 | "nickname": "@first",
8 | "avatar|1": [
9 | "https://img3.doubanio.com/icon/u1373026-121.jpg",
10 | "https://img1.doubanio.com/icon/u3815216-37.jpg",
11 | "https://img3.doubanio.com/icon/u55753308-31.jpg",
12 | "https://img1.doubanio.com/icon/u3719134-8.jpg",
13 | "https://img3.doubanio.com/icon/u136742199-2.jpg",
14 | "https://img3.doubanio.com/icon/u171642416-1.jpg",
15 | "https://img3.doubanio.com/icon/u176837971-1.jpg"
16 | ],
17 | "name": "@cname",
18 | "birthday": "@date",
19 | "id_number": "@id",
20 | "id_card_img": {
21 | "front": "http://ww2.sinaimg.cn/mw690/7cc829d3gw1f54ibvilhxj20g40c30tg.jpg",
22 | "back": "http://imgsrc.baidu.com/image/c0%3Dpixel_huitu%2C0%2C0%2C294%2C40/sign=b05d0b3c38fa828bc52e95a394672458/d788d43f8794a4c2717d681205f41bd5ad6e39a8.jpg"
23 | },
24 | "address": "@city()",
25 | "postcode": "@zip",
26 | "deposit_status": 0,
27 | "reading_statistics": {
28 | "book_num": "@integer(60, 200)",
29 | "page_num": "@integer(1001, 10000)"
30 | }
31 | }
--------------------------------------------------------------------------------
/simplest-mock-server/gulpfile.js:
--------------------------------------------------------------------------------
1 | const path = require("path");
2 | const gulp = require("gulp");
3 | const nodemon = require("gulp-nodemon");
4 | const minimist = require("minimist");
5 |
6 | const args = minimist(process.argv.slice(2), {
7 | string: ["dir"],
8 | number: ["port"],
9 | default: { dir: "example", port: 3000 },
10 | });
11 |
12 | const api = path.resolve(__dirname, args.dir);
13 |
14 | gulp.task("mock", function () {
15 | var stream = nodemon({
16 | script: "./server.js",
17 | // 监听文件的后缀
18 | ext: "js json",
19 | args: ["--dir", args.dir, "--port", args.port],
20 | env: {
21 | NODE_ENV: "development",
22 | },
23 | // 监听的路径
24 | watch: [api, "./server.js", "./router.js"],
25 | });
26 | stream.on("crash", function () {
27 | console.error("application has crashed!\n");
28 | stream.emit("restart", 10);
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/simplest-mock-server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "devDependencies": {
3 | "express": "^4.17.1",
4 | "gulp": "^3.9.1",
5 | "gulp-nodemon": "^2.5.0",
6 | "minimist": "^1.2.5",
7 | "mockjs": "^1.1.0",
8 | "morgan": "^1.10.0",
9 | "rd": "^2.0.1"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/simplest-mock-server/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const logger = require('morgan')
3 | const minimist = require('minimist')
4 |
5 | const args = minimist(process.argv.slice(2), {
6 | number: ["port"],
7 | default: {port: 3000}
8 | })
9 |
10 | const port = args.port;
11 | const server = express()
12 | const router = require("./router.js")
13 |
14 | // 添加延迟,模拟真实场景
15 | server.use((request, res, next) => {
16 | setTimeout(next, 500);
17 | });
18 |
19 | server.use(logger('dev', {
20 | skip: (req) =>
21 | process.env.NODE_ENV === 'test' || req.path === '/favicon.ico',
22 | }))
23 |
24 | server.use(router);
25 |
26 | server.listen(port, () => {
27 | console.log("open mock server at localhost:" + port);
28 | });
29 |
30 |
--------------------------------------------------------------------------------
/styles/color.wxss:
--------------------------------------------------------------------------------
1 |
2 | .success,
3 | .color-green {
4 | color: #09BB07;
5 | }
6 |
7 | .color-blue {
8 | color: #576B95;
9 | }
10 |
11 | .error,
12 | .color-red {
13 | color: #E64340;
14 | }
15 |
16 | .warning,
17 | .color-orange {
18 | color: #F56A00;
19 | }
20 |
21 | .color-yellow {
22 | color: #FFBF00
23 | }
24 |
25 | .color-gray {
26 | color: #888888;
27 | }
28 |
29 | .color-black {
30 | color: #353535;
31 | }
--------------------------------------------------------------------------------
/styles/font.wxss:
--------------------------------------------------------------------------------
1 | .font-34 {
2 | font-size: 34rpx;
3 | }
4 | .font-black-34 {
5 | font-weight:400;
6 | font-size:34rpx;
7 | color: #353535
8 | }
9 |
10 | .font-32 {
11 | font-size: 32rpx;
12 | }
13 | .font-black-32 {
14 | font-weight:400;
15 | font-size:32rpx;
16 | color: #353535
17 | }
18 |
19 | .font-30 {
20 | font-size: 30rpx;
21 | }
22 | .font-black-30 {
23 | font-size: 30rpx;
24 | color: #353535
25 | }
26 | .font-gray-30 {
27 | color: #888;
28 | font-size: 30rpx
29 | }
30 |
31 | .font-28 {
32 | font-size: 28rpx;
33 | }
34 | .font-gray-28 {
35 | color: #888;
36 | font-size: 28rpx;
37 | }
38 | .font-black-28 {
39 | color: #353535;
40 | font-size: 28rpx;
41 | }
42 |
43 | .font-26 {
44 | font-size: 26rpx;
45 | }
46 | .font-gray-26 {
47 | color: #888;
48 | font-size: 26rpx;
49 | }
50 | .font-black-26 {
51 | color: #353535;
52 | font-size: 26rpx;
53 | }
--------------------------------------------------------------------------------
/styles/helper.wxss:
--------------------------------------------------------------------------------
1 | /* 一行省略号 */
2 | .ellipsis {
3 | overflow: hidden;
4 | text-overflow: ellipsis;
5 | white-space: nowrap;
6 | word-wrap: normal;
7 | }
8 |
9 | /* 两行省略号 */
10 | .ellipsis-l2 {
11 | max-height: 40px;
12 | line-height: 20px;
13 | overflow: hidden;
14 | text-overflow: ellipsis;
15 | display: -webkit-box;
16 | -webkit-line-clamp: 2;
17 | -webkit-box-orient: vertical;
18 | }
19 |
20 | /* 三行省略号 */
21 | .ellipsis-l3 {
22 | max-height: 60px;
23 | line-height: 20px;
24 | overflow: hidden;
25 | text-overflow: ellipsis;
26 | display: -webkit-box;
27 | -webkit-line-clamp: 3;
28 | -webkit-box-orient: vertical;
29 | }
30 |
31 | /* 保留空白符 */
32 | .pre-wrap {
33 | white-space: pre-wrap;
34 | }
35 |
36 | /* 水平垂直居中. 要求父元素为relative定位 */
37 | .center {
38 | position: absolute;
39 | left: 50%;
40 | top: 50%;
41 | transform: translate(-50%, -50%);
42 | }
--------------------------------------------------------------------------------
/styles/icon.wxss:
--------------------------------------------------------------------------------
1 |
2 | /* ---------- 上、下、左、右箭头 ---------- */
3 |
4 | .icon-up,
5 | .icon-right,
6 | .icon-down {
7 | display: inline-block;
8 | padding-right: 13rpx;
9 | position: relative;
10 | }
11 |
12 | .icon-up::after,
13 | .icon-right::after,
14 | .icon-down::after {
15 | content: "";
16 | display: inline-block;
17 | position: relative;
18 | bottom: 2rpx;
19 | height: 6px;
20 | width: 6px;
21 | border-width: 2px 2px 0 0;
22 | border-style: solid;
23 | }
24 |
25 | .icon-up::after {
26 | top: 3rpx;
27 | -webkit-transform: rotate(-45deg);
28 | transform: rotate(-45deg);
29 | }
30 |
31 | .icon-right::after {
32 | -webkit-transform: rotate(45deg);
33 | transform: rotate(45deg);
34 | }
35 |
36 | .icon-down::after {
37 | bottom: 4rpx;
38 | -webkit-transform: rotate(135deg);
39 | transform: rotate(135deg);
40 | }
41 |
--------------------------------------------------------------------------------
/templates/library-list/index.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imageslr/weapp-library/42a1fe8131c7a62041b008fddcacac2cb204ad5b/templates/library-list/index.js
--------------------------------------------------------------------------------
/templates/library-list/index.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/templates/library-list/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{item.library.name}}
10 |
11 |
12 |
13 |
14 | {{item.library.address}}
15 |
16 |
17 |
18 | 馆藏:{{item.total_num}} | 可借:{{item.available_num}}
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/templates/library-list/index.wxss:
--------------------------------------------------------------------------------
1 | .library-list:before {
2 | display: none;
3 | }
4 |
5 | .library-item__info {
6 | flex: auto;
7 | overflow: hidden; /* 必须有这一行,否则不会有省略号 */
8 | }
9 |
10 | .library-item__info-name {
11 | display: -webkit-box;
12 | display: -webkit-flex;
13 | display: flex;
14 | align-items: center;
15 | }
16 |
17 | .library-item__info-name image {
18 | flex: 0 0 40rpx;
19 | width: 30rpx;
20 | height: 30rpx;
21 | vertical-align: middle;
22 | }
23 |
24 | .library-item__collection {
25 | flex: none;
26 | display: flex;
27 | display: -webkit-flex;
28 | flex-direction: row;
29 | align-items: baseline;
30 | }
--------------------------------------------------------------------------------
/templates/page-status-indicator/index.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/templates/page-status-indicator/index.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/templates/showcase/index.js:
--------------------------------------------------------------------------------
1 | Page({})
2 |
--------------------------------------------------------------------------------
/templates/showcase/index.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/templates/showcase/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{item.title}}
7 | {{item}}
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | {{item.title}}
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/templates/showcase/index.wxss:
--------------------------------------------------------------------------------
1 | .showcase-container {
2 | box-sizing: border-box;
3 | padding: 30rpx;
4 | width: 100%;
5 | background: #fff;
6 | }
7 |
8 | .showcase {
9 | display: flex;
10 | display: -webkit-flex;
11 | flex-direction: row;
12 | }
13 |
14 | .showcase__item {
15 | position: relative;
16 | width: 200rpx;
17 | margin-right: 47rpx;
18 | }
19 |
20 | /*
21 | * TODO --- 这里想让作者名字紧贴底部,但是没实现
22 |
23 | .showcase__item-author {
24 | position: relative;
25 | bottom: 0;
26 | }
27 | */
28 |
29 | .showcase__item-image--book {
30 | width: 200rpx;
31 | height: 285rpx;
32 | }
33 |
34 |
35 | .showcase__item-image--booklist {
36 | width: 200rpx;
37 | height: 200rpx;
38 | }
--------------------------------------------------------------------------------
/utils/biz-helper.wxs:
--------------------------------------------------------------------------------
1 | /**
2 | * 业务相关的辅助函数
3 | */
4 |
5 | /**
6 | * 订单状态
7 | * switch的case语句不支持获取对象属性,需要解构对象
8 | */
9 | var ORDER_STATUS = require('./constant.wxs').ORDER_STATUS
10 | var WAITING_TO_TAKE_RETURNED_BOOK = ORDER_STATUS.WAITING_TO_TAKE_RETURNED_BOOK
11 | var WAITING_TO_TAKE_AT_PLANED_TIME = ORDER_STATUS.WAITING_TO_TAKE_AT_PLANED_TIME
12 | var BORROWING = ORDER_STATUS.BORROWING
13 |
14 | /**
15 | * 获取订单状态的颜色
16 | * 可取书-绿色;已逾期-红色;其他-默认。
17 | */
18 | function getStatusColor (order) {
19 | switch (order.status) {
20 | case WAITING_TO_TAKE_RETURNED_BOOK:
21 | case WAITING_TO_TAKE_AT_PLANED_TIME:
22 | return 'green'
23 | case BORROWING:
24 | if (order.is_overdue) {
25 | return 'red'
26 | }
27 | break
28 | default:
29 | return ''
30 | }
31 | }
32 |
33 | /**
34 | * 订单可否续借:正在借阅、未超时、且续借次数少于1
35 | */
36 | function isRenewable (order) {
37 | return order.renew_count == 0 && order.status == ORDER_STATUS.BORROWING && !order.is_overdue
38 | }
39 |
40 | /**
41 | * 订单可否取消:未取书时可取消
42 | */
43 | function isCancelable (order) {
44 | return order.status <= ORDER_STATUS.WAITING_TO_TAKE_AT_PLANED_TIME
45 | }
46 |
47 | /**
48 | * 订单可否删除:已归还或已取消订单可以删除
49 | */
50 | function isDeletable (order) {
51 | return order.status >= ORDER_STATUS.NORMAL_CLOSE
52 | }
53 |
54 | module.exports = {
55 | getStatusColor: getStatusColor,
56 | isRenewable: isRenewable,
57 | isCancelable: isCancelable,
58 | isDeletable: isDeletable
59 | }
60 |
--------------------------------------------------------------------------------
/utils/constant.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 和业务相关的一些常量
3 | */
4 |
5 | /**
6 | * 用户账号状态
7 | */
8 | export const USER_STATUS_REVIEWING = 0 // 审核中
9 | export const USER_STATUS_APPROVED = 1 // 审核通过
10 | export const USER_STATUS_REJECTED = 2 // 审核未通过
11 |
12 | /**
13 | * 用户与书单关系
14 | */
15 | export const BL_NO_RELATION = 0 // 没有任何关系
16 | export const BL_IS_CREATOR = 1 // 创建者
17 | export const BL_IS_FAVORITE = 2 // 收藏者
18 |
19 | /**
20 | * 订单状态
21 | */
22 |
23 | /* —————————— 1001 - 1010: order is in process 订单进行中 —————————— */
24 |
25 | /**
26 | * 1001: User is waiting for others to return the book and the
27 | * user will get a notification when someone returns the book.
28 | * 预约中: 图书无库存,用户预约此图书,正在等待其他用户归还.
29 | */
30 | export const ORDER_STATUS_WAITING_FOR_OTHERS_TO_RETURN = 1001
31 |
32 | /**
33 | * 1002: others have returned. Wait for user to take the book.
34 | * 其他用户已经归还图书,正在等待用户取书.
35 | */
36 | export const ORDER_STATUS_WAITING_TO_TAKE_RETURNED_BOOK = 1002
37 |
38 | /**
39 | * 1003: Wait for user to take the book at the planed time.
40 | * 预订中: 图书充足,用户预订此图书,将在约定的时间前往图书馆取书.
41 | */
42 | export const ORDER_STATUS_WAITING_TO_TAKE_AT_PLANED_TIME = 1003
43 |
44 | /**
45 | * 1004: User have taken the book, not returned yet.
46 | * 借书借阅中.
47 | */
48 | export const ORDER_STATUS_BORROWING = 1004
49 |
50 | /* —————————— 1011-1020: order has been closed 订单结束 —————————— */
51 |
52 | /**
53 | * 1011: Return book and close order normally.
54 | * 正常关闭.
55 | */
56 | export const ORDER_STATUS_NORMAL_CLOSE = 1011
57 |
58 | /**
59 | * 1012: Return book and close order abnormally.
60 | * 非正常关闭, 需要支付罚金. 如图书损坏.
61 | */
62 | export const ORDER_STATUS_ABNORMAL_CLOSE = 1012
63 |
64 | /* —————————— 1021-1030: order has been canceled 订单取消 —————————— */
65 |
66 | /**
67 | * 1021: User cancel the order. Or. Not take book at the point time.
68 | * 用户自己取消预约/预订订单. 或, 未在规定时间取书,系统自动取消订单.
69 | */
70 | export const ORDER_STATUS_CANCELED_BY_USER = 1021
71 |
--------------------------------------------------------------------------------
/utils/constant.wxs:
--------------------------------------------------------------------------------
1 | /**
2 | * 和业务相关的一些常量,具体定义见constant.js
3 | */
4 |
5 | var ORDER_STATUS = {
6 | WAITING_FOR_OTHERS_TO_RETURN: 1001,
7 | WAITING_TO_TAKE_RETURNED_BOOK: 1002,
8 | WAITING_TO_TAKE_AT_PLANED_TIME: 1003,
9 | BORROWING: 1004,
10 | NORMAL_CLOSE: 1011,
11 | ABNORMAL_CLOSE: 1012,
12 | CANCELED_BY_USER: 1021
13 | }
14 |
15 | module.exports = {
16 | ORDER_STATUS: ORDER_STATUS
17 | }
18 |
--------------------------------------------------------------------------------
/utils/promise-polyfill.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 添加Promise.finally
3 | * 小程序不支持DOM,所以不能用bluebird,只能用es-promise
4 | */
5 | var Promise = require('./es6-promise.js')
6 |
7 | if (typeof Promise !== 'function') {
8 | throw new TypeError('A global Promise is required')
9 | }
10 | if (typeof Promise.prototype.finally !== 'function') {
11 | var speciesConstructor = function (O, defaultConstructor) {
12 | if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
13 | throw new TypeError('Assertion failed: Type(O) is not Object')
14 | }
15 | var C = O.constructor
16 | if (typeof C === 'undefined') {
17 | return defaultConstructor
18 | }
19 | if (!C || (typeof C !== 'object' && typeof C !== 'function')) {
20 | throw new TypeError('O.constructor is not an Object')
21 | }
22 | var S = typeof Symbol === 'function' && typeof Symbol.species === 'symbol' ? C[Symbol.species] : undefined
23 | if (S == null) {
24 | return defaultConstructor
25 | }
26 | if (typeof S === 'function' && S.prototype) {
27 | return S
28 | }
29 | throw new TypeError('no constructor found')
30 | }
31 |
32 | var shim = {
33 | finally (onFinally) {
34 | var handler = typeof onFinally === 'function' ? onFinally : () => { }
35 | var C
36 | var newPromise = Promise.prototype.then.call(
37 | this, // throw if IsPromise(this) is not true
38 | x => new C(resolve => resolve(handler())).then(() => x),
39 | e => new C(resolve => resolve(handler())).then(() => { throw e })
40 | )
41 | C = speciesConstructor(this, Promise) // throws if SpeciesConstructor throws
42 | return newPromise
43 | }
44 | }
45 | Object.defineProperty(Promise.prototype, 'finally', { configurable: true, writable: true, value: shim.finally })
46 | }
47 |
--------------------------------------------------------------------------------
/utils/promisify.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 将小程序的API封装成支持Promise的API
3 | */
4 |
5 | var Promise = require('./es6-promise.js')
6 |
7 | /**
8 | * @param fn {Function} 小程序原始API,如wx.login
9 | */
10 | module.exports = function wxPromisify (fn) {
11 | return function (obj = {}) {
12 | return new Promise((resolve, reject) => {
13 | obj.success = function (res) {
14 | resolve(res)
15 | }
16 |
17 | obj.fail = function (res) {
18 | reject(res)
19 | }
20 |
21 | fn(obj)
22 | })
23 | }
24 | }
25 |
26 | /**
27 | 用法:
28 |
29 | import promisify from '...'
30 | var getLocationPromisified = promisify(wx.getLocation)
31 |
32 | getLocationPromisified({
33 | type: 'wgs84'
34 | }).then(function (res) {
35 | var latitude = res.latitude
36 | var longitude = res.longitude
37 | var speed = res.speed
38 | var accuracy = res.accuracy
39 | }).catch(function () {
40 | console.error("get location failed")
41 | })
42 |
43 | */
44 |
--------------------------------------------------------------------------------
/utils/validator.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | isPhone: str => /^1[3|4|5|7|8][0-9]{9}$/.test(str),
3 | isVrcode: str => /^[0-9]{6}$/.test(str), // 6位数字验证码
4 | isEmpty: str => /^\s+$/.test(str), // 全是空白符
5 | isISBN: str => /^[0-9]{13}$/.test(str) // ISBN
6 | }
7 |
--------------------------------------------------------------------------------