├── .vscode
└── settings.json
├── LICENSE
├── README.md
├── app.js
├── app.json
├── app.wxss
├── assets
├── book_default.png
├── find-light.png
├── find.png
├── home-light.png
├── home.png
├── hot.png
├── market-light.png
├── market.png
├── mine
│ ├── icon_user.png
│ ├── is_vip.png
│ ├── logo.png
│ ├── not_vip.png
│ ├── selected.png
│ └── tequan.png
├── more-light.png
├── more.png
├── nav
│ ├── 1.png
│ ├── 2.png
│ ├── 3.png
│ └── 4.png
├── search.png
└── to-more.png
├── config.js
├── images
├── 1.jpg
├── 2.jpg
└── a.jpg
├── jsconfig.json
├── pages
├── bookCity
│ ├── bookCity.js
│ ├── bookCity.wxml
│ └── bookCity.wxss
├── bookDetail
│ ├── bookDetail.js
│ ├── bookDetail.wxml
│ └── bookDetail.wxss
├── bookList
│ ├── bookList.js
│ ├── bookList.wxml
│ └── bookList.wxss
├── bookListDetail
│ ├── bookListDetail.js
│ ├── bookListDetail.wxml
│ └── bookListDetail.wxss
├── bookTag
│ ├── bookTag.js
│ ├── bookTag.wxml
│ └── bookTag.wxss
├── bookType
│ ├── bookType.js
│ ├── bookType.wxml
│ └── bookType.wxss
├── index
│ ├── index.js
│ ├── index.wxml
│ └── index.wxss
├── moreBook
│ ├── moreBook.js
│ ├── moreBook.wxml
│ └── moreBook.wxss
├── rankList
│ ├── rankList.js
│ ├── rankList.wxml
│ └── rankList.wxss
├── searchPage
│ ├── searchPage.js
│ ├── searchPage.wxml
│ └── searchPage.wxss
├── userCenter
│ ├── userCenter.js
│ ├── userCenter.wxml
│ └── userCenter.wxss
└── userInfo
│ ├── userInfo.js
│ ├── userInfo.wxml
│ └── userInfo.wxss
├── project.config.json
├── template
└── searchMask.wxml
├── typings
└── wx.d.ts
└── utils
├── api.config.js
└── util.js
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.associations": {
3 | "*.wpy": "vue",
4 | "*.wxml": "html",
5 | "*.wxss": "css"
6 | }
7 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 集思会Lite 小程序
2 |
3 | ## 访问
4 |
5 | * 微信搜索集思会Lite
6 | * 扫码访问
7 |
8 | 
9 |
10 | ## 预览
11 |
12 | 
13 |
14 | ## 该小程序的相关数据统计
15 |
16 | 
17 |
18 | ### 累计用户数
19 |
20 | 历史累计访问小程序的用户数,同一用户多次访问不重复计;
21 |
22 | ### 访问人数
23 |
24 | 昨日访问小程序内所有页面的总用户数,同一用户多次访问不重复计。
25 |
26 | ### 新用户数
27 |
28 | 首次访问小程序页面的用户数,同一用户多次访问不重复计。
29 |
30 | 最近接触小程序,记录一下从零开发到提交审核正式发布的完整过程,和其中踩过的坑,与大家一起学习。
31 |
32 | ## 一.选型
33 |
34 | 项目的前期调研:
35 |
36 | 从小程序随着微信对小程序的推广越来越大,小程序的相关生态也日渐完善,于是,在进行小程序的相关开发工作之前,进行了开发的调研工作。
37 |
38 | 首先从项目框架的选型上,主要有3种选择,微信小程序的原生开发,wepy 框架开发,labrador框架开发,原生开发是使用小程序的自己的一套开发标准,参考web 的原生开发,wepy 是 vue 风格的小程序开发框架,labrador 则比较亲和 React,对于详细的区别和考量,我们来看看一些别人的讨论:
39 |
40 | 《微信小程序开发最佳实践》——skylor:
41 |
42 | 
43 |
44 | 主要意思就是说使用原生开发少去了第三方框架的学习成本。
45 |
46 | 腾讯官方的wepy框架下相关人员提出的关于选型问题的讨论:
47 |
48 | 
49 | 总结一下就是,wepy 项目是官方维护的,它的可靠性是有保障的,它的下面这句话很重要:
50 |
51 | 从Web转向WePY时,开发者会拿Vue, React之类的来对比,因此会更多的看到的是WePY的不足,而原生切WePY的开发者更多的看到的是WePY的优势。
52 |
53 | 之前使用过 vue ,于是优先考虑了 wepy 的选择,但实际上你会发现比较尴尬的一点,这个 因为小程序本身的一些限制,在使用wepy的时候有时候像 vue,有时候又不像,你还得在其中去区分在 vue 里可以使用的方式在 wepy 里可不可以使用,反而会弄混淆,这样的学习成本倒不如一开始就使用原生来的简单清晰。
54 |
55 | labrador直接放弃,原因见第一个截图。
56 |
57 | 至此,确定了目前选择原生开发。
58 |
59 | ## 二.注册
60 |
61 | 如下图开始,填写相应的注册信息:
62 |
63 | 
64 |
65 | 注册成功以后,会在这里得到一个APPID:
66 |
67 | 
68 |
69 | 详细的请看这里[官方注册流程地址](https://mp.weixin.qq.com/debug/wxadoc/introduction/index.html?t=201828),
70 |
71 |
72 | ## 三.微信web开发者工具
73 |
74 | 确定选型后下载官方微信web开发者工具进行开发
75 |
76 | [官方下载地址](https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/uplog.html)
77 |
78 | 扫码登录,填入项目地址,APPID和项目名称:
79 |
80 | 
81 |
82 | ## 3.开发
83 |
84 | * 目录结构:
85 |
86 | ```
87 | | |___assets // 存储图片
88 | | |___pages // 页面
89 | | | |___index // 首页
90 | | | |___index.wxml // 页面结构文件
91 | | | |___index.wxss // 样式表文件
92 | | | |___index.js // js文件
93 | | |___utils // 全局公共函数
94 | | |___app.js // 系统的方法处理文件
95 | | |___app.json // 系统全局配置文件
96 | | |___app.wxss // 全局的样式表
97 | | |___config.json // 配置文件
98 |
99 | ```
100 |
101 | * 小程序配置文件app.json内容
102 |
103 | 具体的这个文件的配置起什么作用,可以看这里[app.json配置官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/quickstart/basic/file.html#JSON-%E9%85%8D%E7%BD%AE)
104 |
105 | 
106 |
107 | 而写在 pages 字段的第一个页面就是这个小程序的首页(打开小程序看到的第一个页面)。
108 |
109 | * 接口地址记得要登录小程序后台添加,如:
110 |
111 | 在[小程序管理后台-开发设置-服务器域名](https://link.juejin.im/?target=https%3A%2F%2Fmp.weixin.qq.com%2Fwxopen%2Fdevprofile%3Faction%3Dget_profile%26token%3D1316597147%26lang%3Dzh_CN)中将`request合法域名`配置为`https://xxx.com`
112 |
113 | ## 一些踩过的,少走弯路的坑:
114 |
115 | 1. wxss里面的css样式引用图片地址,不能引用本地的,比如:
116 |
117 | 解决方案,引用在线地址和使用image标签,或者图片可以使用base64。
118 |
119 | 2. 下拉刷新。使用onPullDownRefresh下拉处理下后,要在后面使用wx.stopPullDownRefresh()停止下来刷新,否则界面会停留在下拉以后的界面,也就是上方会留下下拉空白。(原来以为下拉后会自动收回上去的)
120 | 
121 |
122 | 3.wx.switchTab: url 不支持 queryString,也就是说,跳转到tab页面不支持带参数,同时也要注意跳转到底部tab页面和非tab页面调用不同方法。
123 |
124 | 4.有地方需要用到嵌入网页的功能,使用了发现不起效果,原来是有限制,如下:
125 |
126 | 
127 |
128 | 我是个人版,所以无法使用该组件。支付方面个人版也会有限制,有条件的推荐申请企业版。
129 |
130 | 5.绑定事件获取的target与currentTarget是有区别的
131 |
132 | 通常我们点击某个元素的时候需要获取到当前元素的属性,点击以后拿到的参数里有这两个属性需要区分一下,target 和 currentTarget。两者的区别在于:
133 |
134 | target:触发事件的源组件;
135 | currentTarget: 事件绑定的当前组件;
136 |
137 | 6.请求的接口地址需要是HTTPS的,所以需要升级下HTTPS,不用全站HTTPS,只要接口是HTTPS就可以了。此外,第一项里提到的在线图片地址可以不用是HTTPS。
138 |
139 | 7.任何情况下的视图更新只能通过setData()。
140 |
141 | 如果你以为数据变了,对应的视图也会相应改变,那就错了,这个时候你还是需要通过setData()方法改变相应变量,视图才会更新。
142 |
143 | ## 四.提交体验版进行多用户实机测试
144 |
145 | 当我们本地开发好以后,点击预览,会得到一个二维码,扫描二维码即可在自己的手机上预览实机效果(不过每次修改后都得点击重新编译预览才行,并不方便),但是我想要别人也来测试实机效果的时候,把这个二维码发过去却不行,界面会提示:
146 |
147 | ```
148 | Unauthorized access
149 | ```
150 | 看来这个预览还的是开发者的自己的微信才行,那么如何让别的用户测试呢?点击这里:
151 |
152 | 
153 |
154 | 上传成功以后,登录小程序后台,选择开发管理:
155 |
156 | 
157 |
158 | 点击箭头,选择将刚才提交的版本作为体验版,然后点击版本号下面的文字就能得到开发版的分享二维码了。
159 |
160 | 但是这个二维码别人还不能用,原来还要进入左边的用户身份栏,然后点击箭头:
161 |
162 | 
163 |
164 | 添加用户并勾选体验者权限,该用户才能体验。否则得到的二维码也会提示没有权限。每添加一个用户都要扫一下二维码,而且只能是管理员添加,而且提示体验名额有限制。。。
165 |
166 | ## 五.提交审核
167 |
168 | 好了,大家终于都测试没问题了,准备提交审核,这个时候提示完善小程序信息,填写相应信息提交即可。
169 |
170 | 
171 |
172 | 提交上去,一个晚上就通过了审核,管理员手机会收到已经通过审核的微信消息。以为就这样结束了吗?在小程序搜索通过审核的小程序,没有结果,原来,通过审核后还得登录后台,将刚才通过审核的版本发布出去,然后过几分钟,就可以搜索到了。
173 |
174 | 
175 |
176 | 关于什么是线上版本,什么是审核版本,官方文档里有解释。
177 |
178 | ## 六.建议
179 |
180 | 推荐多看看微信小程序官方文档,很多情况已经在文档里说明了。(吐槽下文档的搜索功能不怎么好用)
181 |
182 | ## 七.对小程序的感受和看法
183 |
184 | > 它无法取代 APP。
185 |
186 | 小程序的优缺点很明显,这些也是为什么选择小程序和为什么不放弃 APP 的原因。
187 |
188 | 优点:
189 |
190 | * 微信入口,无需下载,更容易带来流量。要知道,很多时候,用户可能对你的服务有兴趣但是一看到要下载 APP 就走开了,一是麻烦,二是担心手机存储,而小程序即扫即用的优势显而易见。用户可以使用通过扫码使用你的服务,对于更高级的功能再引导用户下载 APP 体验,这种推广方式更加友好,比直接一上来就要求用户下载 APP 有效的多。
191 |
192 | * 用户无需更新客户端。APP 的模式使得不仅商家需要上架新的 APP进行审核,用户也需要下载新的 APP 才能体验最新功能。而微信小程序免去了用户更新的痛苦。特别是还有一些用户有基本不升级 APP 的习惯。
193 |
194 | * 不用区分系统。我们知道一个 APP 要有安卓版和 iOS 版本,不同的语言编写,开发成本高。但是小程序是基于微信的,不论是安卓还是 iOS 手机,只要这个手机上有微信,那么你的这一套程序就能在两个系统上运行,不存在区分安卓版本和 iOS 版本的情况。最多会有一些显示界面的微小差别的兼容问题而已,问题不大。
195 |
196 | * 开发成本比 APP 小。这里的成本包括且不限于,人力成本,时间周期成本等。
197 |
198 | * 作为一个在微信基础上建立的产品,天生自带微信的社交属性,便于传播和分享。
199 |
200 | 以上几点,可以感觉到,小程序对于初创型的公司比较有利,开发速度快,成本低,还有流量入口,便于快速迭代产品,抢占市场,占得先机。这其中的一个典型案例,就是“头脑王者”,有了微信这个平台,加上本身的营运,上千万用户成就迅速达成。
201 |
202 | 缺点:
203 |
204 | * 比较重的功能还是得放到 APP 上进行。小程序上只适合轻量级操作,功能没有 APP 强大。
205 |
206 | * 被微信说封就封了,不过 App Store 也有下架的例子。
207 |
208 | * 程序入口不如 APP直接,还得先打开微信。
209 |
210 | 所以小程序的定位一直是轻量的,也如微信自己所说,它无法取代 APP。
211 |
212 | 微信小程序的发展。刚开始推出的时候是轰轰烈烈的,包括各种媒体也好啊,大家都在说,你看多好啊,即用即走,用户也不用下载那么多APP了,以后大家手机只需要装一个APP,那就是微信,再加上当时微信因为打赏功能和Apple闹得不愉快,人们纷纷议论微信这种有点自建生态系统的行为,会不会导致被APP store下架。毕竟终于有人站出来和Apple扳手腕了,大家自然很嗨,搬着板凳嗑着瓜子叫嚣着。不过确实,找遍国内,也只有微信有这个能量去做自己的生态。
213 |
214 | 但渐渐地,人们发现,此时的小程序还很鸡肋,所支持的功能还很少(比如还不支持嵌入网页),限制还很多(比如打包后的大小),在这些功能和限制下,打造出来的小程序,再加上入口比较深,并没有取得之前预料的效果。热度开始慢慢减退了。
215 |
216 | 但是,在后来的一段时间里,我感觉几乎每周,都能收到小程序功能升级的推送,在冷清的市场中,微信依然有周期的迭代新的功能,而且更新的频率也刚好,让人感觉,哎,现在功能月来越多,是不是可以尝试一下了。
217 |
218 | 而小程序再一次高调吸引眼球的,是2017年底更新的小游戏功能,微信客户端更新后再次进去首屏,就是当时刷屏的“跳一跳”小程序了。可以嵌入网页,可以打开APP等等越来越多的功能升级,小程序的热度逐渐从高到低再到回归正常,它在不断摸索中寻找自己在市场中的定位,又,何尝不像我们。
219 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | var aldstat = require("./utils/ald-stat.js");
2 | App({
3 | onLaunch: function () {
4 | }
5 | })
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/userInfo/userInfo",
5 | "pages/userCenter/userCenter",
6 | "pages/bookCity/bookCity",
7 | "pages/bookList/bookList",
8 | "pages/rankList/rankList",
9 | "pages/bookType/bookType",
10 | "pages/bookTag/bookTag",
11 | "pages/bookDetail/bookDetail",
12 | "pages/bookListDetail/bookListDetail",
13 | "pages/searchPage/searchPage",
14 | "pages/moreBook/moreBook"
15 | ],
16 | "window": {
17 | "backgroundColor": "#f6f6f6",
18 | "backgroundTextStyle": "dark",
19 | "navigationBarBackgroundColor": "#ff8862",
20 | "navigationBarTitleText": "",
21 | "navigationBarTextStyle": "white",
22 | "enablePullDownRefresh": true
23 | },
24 | "tabBar": {
25 | "backgroundColor": "#f6f6f6",
26 | "color": "#999",
27 | "selectedColor": "#ff8862",
28 | "borderStyle": "white",
29 | "list": [{
30 | "selectedIconPath": "assets/home-light.png",
31 | "iconPath": "assets/home.png",
32 | "pagePath": "pages/index/index",
33 | "text": "首页"
34 | },{
35 | "selectedIconPath": "assets/find-light.png",
36 | "iconPath": "assets/find.png",
37 | "pagePath": "pages/bookCity/bookCity",
38 | "text": "书城"
39 | },{
40 | "selectedIconPath": "assets/market-light.png",
41 | "iconPath": "assets/market.png",
42 | "pagePath": "pages/bookList/bookList",
43 | "text": "书单"
44 | },{
45 | "selectedIconPath": "assets/more-light.png",
46 | "iconPath": "assets/more.png",
47 | "pagePath": "pages/userCenter/userCenter",
48 | "text": "我的"
49 | }]
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | display: flex;
4 | flex-direction: column;
5 | align-items: center;
6 | box-sizing: border-box;
7 | }
8 |
--------------------------------------------------------------------------------
/assets/book_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/book_default.png
--------------------------------------------------------------------------------
/assets/find-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/find-light.png
--------------------------------------------------------------------------------
/assets/find.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/find.png
--------------------------------------------------------------------------------
/assets/home-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/home-light.png
--------------------------------------------------------------------------------
/assets/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/home.png
--------------------------------------------------------------------------------
/assets/hot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/hot.png
--------------------------------------------------------------------------------
/assets/market-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/market-light.png
--------------------------------------------------------------------------------
/assets/market.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/market.png
--------------------------------------------------------------------------------
/assets/mine/icon_user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/mine/icon_user.png
--------------------------------------------------------------------------------
/assets/mine/is_vip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/mine/is_vip.png
--------------------------------------------------------------------------------
/assets/mine/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/mine/logo.png
--------------------------------------------------------------------------------
/assets/mine/not_vip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/mine/not_vip.png
--------------------------------------------------------------------------------
/assets/mine/selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/mine/selected.png
--------------------------------------------------------------------------------
/assets/mine/tequan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/mine/tequan.png
--------------------------------------------------------------------------------
/assets/more-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/more-light.png
--------------------------------------------------------------------------------
/assets/more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/more.png
--------------------------------------------------------------------------------
/assets/nav/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/nav/1.png
--------------------------------------------------------------------------------
/assets/nav/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/nav/2.png
--------------------------------------------------------------------------------
/assets/nav/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/nav/3.png
--------------------------------------------------------------------------------
/assets/nav/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/nav/4.png
--------------------------------------------------------------------------------
/assets/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/search.png
--------------------------------------------------------------------------------
/assets/to-more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/assets/to-more.png
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 小程序配置文件
3 | */
4 |
5 | // 此处主机域名修改成腾讯云解决方案分配的域名
6 | var host = 'https://yiubwcwi.qcloud.la';
7 |
8 | var config = {
9 |
10 | // 下面的地址配合云端 Demo 工作
11 | service: {
12 | host,
13 |
14 | // 登录地址,用于建立会话
15 | loginUrl: `${host}/weapp/login`,
16 |
17 | // 测试的请求地址,用于测试会话
18 | requestUrl: `${host}/weapp/user`,
19 |
20 | // 测试的信道服务地址
21 | tunnelUrl: `${host}/weapp/tunnel`,
22 |
23 | // 上传图片接口
24 | uploadUrl: `${host}/weapp/upload`
25 | }
26 | };
27 |
28 | module.exports = config;
29 |
--------------------------------------------------------------------------------
/images/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/images/1.jpg
--------------------------------------------------------------------------------
/images/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/images/2.jpg
--------------------------------------------------------------------------------
/images/a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PuRonglong/jisihuiLite/4f8a28a00017e3198c2a7a0638674721cd025e29/images/a.jpg
--------------------------------------------------------------------------------
/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2015",
4 | "module": "commonjs"
5 | }
6 | }
--------------------------------------------------------------------------------
/pages/bookCity/bookCity.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | userInfo: {}
4 | },
5 | setNavigationBarTitleText:function(){
6 | wx.setNavigationBarTitle({
7 | title: "分类"
8 | })
9 | },
10 | onPullDownRefresh: function() {
11 | wx.stopPullDownRefresh();
12 | },
13 | goBookType(e) {
14 | wx.navigateTo({
15 | url: '../../pages/bookType/bookType?category=' + e.currentTarget.dataset.category + '&type=' + e.currentTarget.dataset.type
16 | })
17 | },
18 | onReady: function() {
19 | this.setNavigationBarTitleText();
20 | }
21 | })
--------------------------------------------------------------------------------
/pages/bookCity/bookCity.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 | 网络技术
12 |
13 |
14 |
15 |
16 | 古典文学
17 |
18 |
19 |
20 |
21 | 外国文学
22 |
23 |
24 |
25 |
26 |
27 |
28 | 财经管理
29 |
30 |
31 |
32 |
33 | 哲学宗教
34 |
35 |
36 |
37 |
38 | 家庭养生
39 |
40 |
41 |
42 |
43 |
44 |
45 | 现代文学
46 |
47 |
48 |
49 |
50 | 科幻玄幻
51 |
52 |
53 |
54 |
55 | 网络小说
56 |
57 |
58 |
59 |
60 |
61 |
62 | 教育学习
63 |
64 |
65 |
66 |
67 | 武侠小说
68 |
69 |
70 |
71 |
72 | 人物传记
73 |
74 |
75 |
76 |
77 |
78 |
79 | 历史地理
80 |
81 |
82 |
83 |
84 | 外国小说
85 |
86 |
87 |
88 |
89 | 儿童读物
90 |
91 |
92 |
93 |
94 |
95 |
96 | 侦探推理
97 |
98 |
99 |
100 |
101 | 词典专业
102 |
103 |
104 |
105 |
106 | 恐怖文学
107 |
108 |
109 |
110 |
111 |
112 |
113 | 人文社科
114 |
115 |
116 |
117 |
118 | 诗歌散文
119 |
120 |
121 |
122 |
123 | 战争军事
124 |
125 |
126 |
127 |
128 |
129 |
130 | 励志职场
131 |
132 |
133 |
134 |
135 | 自然科学
136 |
137 |
138 |
139 |
140 | 旅游地图
141 |
142 |
143 |
144 |
145 |
146 |
147 | 心理科学
148 |
149 |
150 |
151 |
152 | 政治官场
153 |
154 |
155 |
156 |
157 | 外文原版
158 |
159 |
160 |
161 |
162 |
163 |
164 | 言情耽美
165 |
166 |
167 |
168 |
169 | 艺术与美
170 |
171 |
172 |
173 |
174 | 分类不明
175 |
176 |
177 |
178 |
--------------------------------------------------------------------------------
/pages/bookCity/bookCity.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background: #F6F6F6;
3 | display: flex;
4 | flex-direction: column;
5 | justify-content: flex-start;
6 | position: relative;
7 | height: 100%;
8 | }
9 | .bookCity-container{
10 | padding: 20rpx;
11 | }
12 | .main{
13 | background-color: #f6f6f6
14 | }
15 | .bookCity-header-image{
16 | height: 200rpx;
17 | width: 710rpx;
18 | color: #fff;
19 | border-radius: 8rpx;
20 | }
21 | .bookCity-header-wrapper{
22 | position: relative;
23 | height: 200rpx;
24 | }
25 | .bookCity-header-text{
26 | color: #fff;
27 | position: absolute;
28 | top: 50%;
29 | margin-top: -25rpx;
30 | font-size: 50rpx;
31 | /* bottom: 0; */
32 | /* background-color: rgba(0, 0, 0, 0.5); */
33 | width: 710rpx;
34 | text-align: center;
35 | height: 50rpx;
36 | font-weight: 500;
37 | letter-spacing:8rpx;
38 | }
39 | .bookCity-body-item{
40 | display: inline-block;
41 | width: 222rpx;
42 | height: 222rpx;
43 | border-radius: 8rpx;
44 | position: relative;
45 | }
46 | .bookCity-body-item-one{
47 | margin-right: 20rpx;
48 | }
49 | .bookCity-body-item-two{
50 | margin-right: 20rpx;
51 | }
52 | .bookCity-body-item-three{
53 | float: right;
54 | }
55 | .bookCity-item-image{
56 | width: 222rpx;
57 | height: 222rpx;
58 | border-radius: 8rpx;
59 | }
60 | .bookCity-item-text{
61 | position: absolute;
62 | background-color: rgba(0, 0, 0, 0.5);
63 | width: 222rpx;
64 | text-align: center;
65 | bottom: 0;
66 | font-size: 30rpx;
67 | border-bottom-right-radius: 8rpx;
68 | border-bottom-left-radius: 8rpx;
69 | color: #fff;
70 | }
71 | .bookCity-bod-container{
72 | margin-top: 20rpx;
73 | display: flex;
74 | }
75 | .bookCity-userinfo-avatar{
76 | width: 50rpx;
77 | height: 50rpx;
78 | border-radius: 50%;
79 | vertical-align: middle;
80 | float: left;
81 | }
82 | .bookCity-header-rec{
83 | float: right;
84 | color: #1E8AE8;
85 | }
86 | .bookCity-swiper-wrapper{
87 | height: 210rpx;
88 | }
89 | .bookCity-swiper-item{
90 | width: 670rpx;
91 | margin: 20rpx;
92 | padding: 20rpx;
93 | border: 2rpx solid rgba(0, 0, 0, 0.1);
94 | background: #fff;
95 | overflow: hidden;
96 | position: relative;
97 | border-radius: 10rpx;
98 | box-shadow: -2rpx 2rpx 10rpx rgba(0, 0, 0, 0.1);
99 | }
100 | .bookCity-swiper-dis{
101 | color: #1E8AE8;
102 | font-style: italic;
103 | font-size: 28rpx;
104 | }
105 | .bookCity-swiper-number{
106 | display: inline-block;
107 | font-style: normal;
108 | font-size: 24rpx;
109 | color: #1E8AE8;
110 | margin-left: 20rpx;
111 | }
112 | .bookCity-swiper-img{
113 | width: 120rpx;
114 | height: 80rpx;
115 | position: absolute;
116 | bottom: 20rpx;
117 | right: 20rpx;
118 | }
119 | .bookCity-swiper-title{
120 | color: #323233;
121 | font-size: 26rpx;
122 | margin: 10rpx 0 6rpx;
123 | }
124 | .bookCity-swiper-tip{
125 | color: #999;
126 | font-size: 24rpx;
127 | }
128 | .bookCity-swiper-title,
129 | .bookCity-swiper-tip{
130 | width: 100%;
131 | float: left;
132 | }
133 | .bookCity-focus-list{
134 | width: 710rpx;
135 | padding: 10rpx 20rpx;
136 | background: #fff;
137 | }
138 | .bookCity-focus-item{
139 | position: relative;
140 | }
141 | .bookCity-focus-title{
142 | color: #323233;
143 | font-size: 28rpx;
144 | font-weight: 500;
145 | margin: 15rpx;
146 | }
147 | .bookCity-focus-avatar,
148 | .bookCity-hot-avatar{
149 | width: 70rpx;
150 | height: 70rpx;
151 | border-radius: 50%;
152 | display: inline-block;
153 | vertical-align: middle;
154 | }
155 | .bookCity-focus-info,
156 | .bookCity-hot-info{
157 | width: 620rpx;
158 | display: inline-block;
159 | font-size: 28rpx;
160 | margin-left: 20rpx;
161 | vertical-align: middle;
162 | padding: 20rpx 0;
163 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
164 | }
165 | .last{
166 | border: none;
167 | }
168 | .bookCity-focus-introduce{
169 | color: #999;
170 | font-size: 26rpx;
171 | }
172 | .bookCity-focus-btn,
173 | .bookCity-hot-btn{
174 | position: absolute;
175 | right: 20rpx;
176 | top: 40rpx;
177 | color: #1E8AE8;
178 | }
179 | .has-focus{
180 | color: #999;
181 | }
182 | .bookCity-focus-control{
183 | text-align: center;
184 | }
185 | .bookCity-focus-button{
186 | display: inline-block;
187 | width: 270rpx;
188 | font-size: 24rpx;
189 | padding: 10rpx;
190 | text-align: center;
191 | margin: 10rpx;
192 | }
193 | .bookCity-focus-refresh{
194 | color: #1E8AE8;
195 | border: 1rpx solid #1E8AE8;
196 | border-radius: 5rpx;
197 | }
198 | .bookCity-focus-all{
199 | color: #fff;
200 | background: #1E8AE8;
201 | border: 1rpx solid #1E8AE8;
202 | border-radius: 5rpx;
203 | }
204 | .bookCity-icon-wrapper{
205 | width: 50rpx;
206 | height: 30rpx;
207 | margin-top: 5rpx;
208 | position: relative;
209 | display: inline-block;
210 | }
211 | .bookCity-focus-icon{
212 | width: 30rpx;
213 | height: 30rpx;
214 | position: absolute;
215 | top: 0;
216 | }
217 | .bookCity-icon-best{
218 | left: 0;
219 | z-index: 1;
220 | }
221 | .bookCity-icon-auth{
222 | left: 5rpx;
223 | }
224 | .bookCity-hot-list{
225 | font-size: 28rpx;
226 | }
227 | .bookCity-hot-header{
228 | padding: 20rpx;
229 | height: 40rpx;
230 | width: 710rpx;
231 | background: #f6f6f6;
232 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
233 | }
234 | .bookCity-hot-item{
235 | position: relative;
236 | padding: 20rpx;
237 | background: #fff;
238 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
239 | }
240 | .bookCity-hot-info{
241 | border: none;
242 | }
243 | .bookCity-hot-btn{
244 | right: 80rpx;
245 | }
246 | .bookCity-control-more{
247 | position: absolute;
248 | right: 20rpx;
249 | top: 40rpx;
250 | color: #1E8AE8;
251 | width: 50rpx;
252 | height: 40rpx;
253 | text-align: center;
254 | }
255 | .bookCity-control-image{
256 | width: 20rpx;
257 | height: 20rpx;
258 | }
259 | .bookCity-hot-nickname{
260 | font-weight: 500;
261 | }
262 | .bookCity-hot-content{
263 | width: 620rpx;
264 | margin-left: 80rpx;
265 | color: #333;
266 | line-height: 1.6;
267 | }
268 | .bookCity-hot-footer{
269 | color: #999;
270 | font-size: 24rpx;
271 | text-align: left;
272 | margin-left: 80rpx;
273 | padding: 20rpx 0;
274 | }
275 | .bookCity-hot-img{
276 | width: 24rpx;
277 | height: 24rpx;
278 | display: inline-block;
279 | vertical-align: middle;
280 | margin-right: 10rpx;
281 | }
282 | .bookCity-hot-text{
283 | display: inline-block;
284 | vertical-align: middle;
285 | margin-right: 40rpx;
286 | }
287 | .bookCity-show-all{
288 | color: #1E8AE8;
289 | margin-left: 80rpx;
290 | }
291 | .text-overflow{
292 | height: 85rpx;
293 | display: -webkit-box;
294 | word-break: break-all;
295 | text-overflow: ellipsis;
296 | overflow: hidden;
297 | -webkit-box-orient: vertical;
298 | -webkit-line-clamp:2;
299 | }
300 | .bookCity-footer{
301 | font-size: 28rpx;
302 | color: #999;
303 | text-align: center;
304 | background: #fff;
305 | padding: 100rpx;
306 | }
307 | .bookCity-footer-btn{
308 | color: #1E8AE8;
309 | }
310 | .bookCity-drawer{
311 | text-align: left;
312 | background: #fff;
313 | color: #999;
314 | padding: 0 30rpx;
315 | position: fixed;
316 | left: 0;
317 | right: 0;
318 | bottom: -100%;
319 | z-index: 999;
320 | }
321 | .bookCity-drawer-swiper{
322 | height: 320rpx;
323 | }
324 | .bookCity-drawer-title{
325 | font-size: 28rpx;
326 | padding: 40rpx 0;
327 | text-align: center;
328 | }
329 | .bookCity-drawer-item {
330 | width: 170rpx;
331 | display: inline-block;
332 | text-align: center;
333 | font-size: 24rpx;
334 | padding-bottom: 20rpx;
335 | }
336 | .bookCity-drawer-img{
337 | width: 80rpx;
338 | height: 80rpx;
339 | }
340 | .elephant{
341 | background: #0e932e;
342 | border-radius: 50%;
343 | }
344 | .bookCity-drawer-control{
345 | border-top: 1rpx solid rgba(0, 0, 0, 0.2);
346 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
347 | padding: 20rpx 0 0;
348 | }
349 | .bookCity-img-wrapper{
350 | width: 80rpx;
351 | height: 80rpx;
352 | border: 1rpx solid rgba(0, 0, 0, 0.2);
353 | border-radius: 50%;
354 | display: inline-block;
355 | }
356 | .bookCity-control-img{
357 | width: 60rpx;
358 | height: 60rpx;
359 | margin: 10rpx auto;
360 | }
361 | .bookCity-drawer-cancel{
362 | padding: 30rpx;
363 | font-size: 28rpx;
364 | text-align: center;
365 | }
366 | .scroll-view{
367 | height: 100%;
368 | }
369 | .fixed{
370 | padding: 20rpx;
371 | height: 40rpx;
372 | width: 710rpx;
373 | background: #f6f6f6;
374 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
375 | position: fixed;
376 | top: 70rpx;
377 | left: 0;
378 | right: 0;
379 | z-index: 99;
380 | }
--------------------------------------------------------------------------------
/pages/bookDetail/bookDetail.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | var util = require('../../utils/util.js')
3 |
4 | Page({
5 | data: {
6 | userInfo: {},
7 | bookDetail: {},
8 | loadMore: '加载更多',
9 | isLoading: false,
10 | bookTags: [],
11 | searchVal: '',
12 | bookContent:'',
13 | bookId:'',
14 | bookStatus: 'DEFAULT',
15 | showIndex: [],
16 | isShowPartContent: true
17 | },
18 | getBookDetail: function(id){
19 | var that = this;
20 | var url = '/m/book/' + id;
21 | util.http('GET',url, {}, (response) => {
22 | if (response.errMsg) {
23 | util.showModel(response.errMsg);
24 | } else {
25 | var array = response.book.tags ? (response.book.tags + '').replace(/[\[\]]/g, '').split(', ') : '';
26 | that.setData({
27 | bookDetail: response,
28 | bookTags: array,
29 | bookAllContent: response.book.content,
30 | bookContent: response.book.content,
31 | bookPartContent: response.book.content ? response.book.content.substring(0, 100) + '...': '',
32 | bookStatus: response.bookStatus
33 | })
34 | }
35 | })
36 | },
37 | getAuthBookDetail: function(id){
38 | var that = this;
39 | var url = '/m/auth/book/' + id;
40 | util.http('POST',url, {}, (response) => {
41 | if (response.errMsg) {
42 | util.showModel(response.errMsg);
43 | } else {
44 | var array = response.book.tags ? (response.book.tags + '').replace(/[\[\]]/g, '').split(', ') : '';
45 | that.setData({
46 | bookDetail: response,
47 | bookTags: array,
48 | bookContent: response.book.content,
49 | bookStatus: response.bookStatus
50 | })
51 | }
52 | },'',that.data.auth)
53 | },
54 | doCollect: function(){
55 | var that = this;
56 | var url = '/m/auth/collect/create';
57 | var data = {
58 | bookIds: that.data.bookId,
59 | bookshelfType: 'TOREAD'
60 | };
61 | util.http('POST',url, data, (response) => {
62 | if (response.code == 'success') {
63 | wx.showToast({
64 | title: '收藏成功',
65 | icon: 'none',
66 | duration: 1000
67 | })
68 | that.setData({
69 | bookStatus: 'TOREAD'
70 | })
71 | } else {
72 | wx.showToast({
73 | title: response.code || response.data.msg,
74 | icon: 'none',
75 | duration: 1000
76 | })
77 | if(response.data){
78 | wx.showToast({
79 | title: response.data.msg,
80 | icon: 'none',
81 | duration: 1000
82 | })
83 | }
84 | if(response.code){
85 | if(response.code == 'error_repeat'){
86 | wx.showToast({
87 | title: '重复收藏',
88 | icon: 'none',
89 | duration: 1000
90 | })
91 | }else if(response.code == 'success'){
92 | wx.showToast({
93 | title: '操作成功',
94 | icon: 'none',
95 | duration: 1000
96 | })
97 | }else if(response.code == 'no_login'){
98 | wx.showToast({
99 | title: '用户未登录',
100 | icon: 'none',
101 | duration: 1000
102 | })
103 | }else if(response.code == 'error_book_id'){
104 | wx.showToast({
105 | title: '图书不存在',
106 | icon: 'none',
107 | duration: 1000
108 | })
109 | }
110 | }
111 | if(response.data.msg == '未登录'){
112 | setTimeout(function (params) {
113 | that.goUserInfo();
114 | },1000)
115 | }
116 | }
117 | },'',that.data.auth)
118 | },
119 | doCancelCollect: function(){
120 | var that = this;
121 | var url = '/m/auth/collect/';
122 | var data = {
123 | bookIds: that.data.bookId
124 | };
125 | util.http('DELETE',url, data, (response) => {
126 | if (response.code == 'success') {
127 | wx.showToast({
128 | title: '取消收藏成功',
129 | icon: 'none',
130 | duration: 1000
131 | })
132 | that.setData({
133 | bookStatus: 'DEFAULT'
134 | })
135 | } else {
136 | wx.showToast({
137 | title: response.code,
138 | icon: 'none',
139 | duration: 1000
140 | })
141 | }
142 | },'',that.data.auth)
143 | },
144 | doPush: function(){
145 | var that = this;
146 | var url = '/m/auth/push/' + that.data.bookId;
147 | util.http('POST',url, {}, (response) => {
148 | if(response.data){
149 | wx.showToast({
150 | title: response.data.msg,
151 | icon: 'none',
152 | duration: 1000
153 | })
154 | if(response.data.msg == '未登录'){
155 | setTimeout(function (params) {
156 | that.goUserInfo();
157 | },1000)
158 | }
159 | }else{
160 | wx.showToast({
161 | title: response.msg,
162 | icon: 'none',
163 | duration: 1000
164 | })
165 | }
166 | },'',that.data.auth)
167 | },
168 | doShowAllContent: function() {
169 | var isShowPartContent = !this.data.isShowPartContent;
170 | this.setData({
171 | isShowPartContent: isShowPartContent
172 | })
173 | },
174 | getUserInfo: function() {
175 |
176 | this.setData({
177 | userInfo: wx.getStorageSync('userInfo')
178 | });
179 |
180 | this.setData({
181 | auth: wx.getStorageSync('auth')
182 | });
183 |
184 | if(this.data.auth && this.data.userInfo){
185 | this.getAuthBookDetail(this.data.bookId);
186 | }else{
187 | this.getBookDetail(this.data.bookId);
188 | }
189 | },
190 | goUserInfo(){
191 | wx.navigateTo({
192 | url: '../../pages/userInfo/userInfo?type=' + '登录' + '&isInVipTime=' + 'false'
193 | })
194 | },
195 | goBookTag(e) {
196 | wx.navigateTo({
197 | url: '../../pages/bookTag/bookTag?tag=' + e.currentTarget.dataset.tag
198 | })
199 | },
200 | onPullDownRefresh: function() {
201 | wx.stopPullDownRefresh();
202 | },
203 | onLoad: function(option){
204 | this.setData({
205 | bookId: option.id
206 | })
207 | this.getUserInfo();
208 | },
209 | onReady: function() {
210 | }
211 | })
--------------------------------------------------------------------------------
/pages/bookDetail/bookDetail.wxml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 | 分类标签
20 | {{item}}
21 |
22 |
23 |
24 | 内容简介
25 |
26 | {{bookContent}}
27 |
28 | 展开全文
29 | 收起全文
30 |
31 |
32 |
33 | 收藏
34 | 取消收藏
35 | 推送
36 |
37 |
--------------------------------------------------------------------------------
/pages/bookDetail/bookDetail.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background: #F6F6F6;
3 | display: flex;
4 | flex-direction: column;
5 | justify-content: flex-start;
6 | position: relative;
7 | }
8 | .bookDetail-header{
9 | padding: 20rpx;
10 | background: #ffffff;
11 | margin-bottom: 30rpx;
12 | }
13 | .bookDetail-header-left{
14 | height: 290rpx;
15 | float: left;
16 | }
17 | .bookDetail-header-right{
18 | height: 290rpx;
19 | margin-left: 20rpx;
20 | float: left;
21 | width: 300rpx;
22 | position: relative;
23 | }
24 | .bookDetail-header-image{
25 | width: 210rpx;
26 | height: 290rpx;
27 | }
28 | .bookDetail-header-name{
29 | margin-bottom: 66rpx;
30 | }
31 | .bookDetail-header-author{
32 | color: rgb(48, 145, 161);
33 | margin-bottom: 30rpx;
34 | font-size: 30rpx;
35 | }
36 | .bookDetail-header-grade{
37 | color: rgb(184, 182, 182);
38 | position: absolute;
39 | bottom: 0rpx;
40 | }
41 | .bookDetail-tag{
42 | background-color: #ffffff;
43 | padding: 20rpx;
44 | margin-bottom: 20rpx;
45 | }
46 | .bookDetail-tag-title{
47 | color: #918f8f;
48 | font-size: 35rpx;
49 | margin-bottom: 15rpx;
50 | }
51 | .bookDetail-tag-type{
52 | color: #ff8862;
53 | font-size: 26rpx;
54 | border: 2rpx solid #ff8862;
55 | display: inline-block;
56 | padding: 6rpx 18rpx;
57 | border-radius: 30rpx;
58 | margin-right: 30rpx;
59 | margin-bottom: 10rpx;
60 | }
61 | .bookDetail-content{
62 | background-color: #ffffff;
63 | padding: 20rpx;
64 | margin-bottom: 100rpx;
65 | }
66 | .ookDetail-content-title{
67 | margin-bottom: 20rpx;
68 | }
69 | .bookDetail-content-info{
70 | font-size: 28rpx;
71 | color: #a7a4a4;
72 | }
73 | .bookDetail-show-all{
74 | color: #1E8AE8;
75 | font-size: 25rpx;
76 | }
77 | .bookDetail-operate{
78 | position: fixed;
79 | bottom: 0rpx;
80 | width: 100%;
81 | border-top: 2rpx solid #918f8f;
82 | }
83 | .bookDetail-operate-button-collect{
84 | width: 50%;
85 | float: left;
86 | border-radius: 0rpx;
87 | height: 100rpx;
88 | line-height: 100rpx;
89 | text-align: center;
90 | background-color: #ffffff;
91 | }
92 | .bookDetail-operate-button-push{
93 | width: 50%;
94 | float: right;
95 | border-radius: 0rpx;
96 | background-color: #ff8862;
97 | color: #ffffff;
98 | height: 100rpx;
99 | line-height: 100rpx;
100 | text-align: center;
101 | }
102 | .text-overflow{
103 | display: -webkit-box;
104 | word-break: break-all;
105 | text-overflow: ellipsis;
106 | overflow: hidden;
107 | -webkit-box-orient: vertical;
108 | -webkit-line-clamp:8;
109 | }
110 |
--------------------------------------------------------------------------------
/pages/bookList/bookList.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 |
3 | Page({
4 | data: {
5 | userInfo: {},
6 | logged: false,
7 | takeSession: false,
8 | requestResult: '',
9 | isShow: false,
10 | isShowQues: false,
11 | bookCategoryList: [],
12 | loadMore: '加载更多',
13 | isLoading: false,
14 | historyList: [],
15 | searchVal: '',
16 | num: 1,
17 | oldListArray: []
18 | },
19 |
20 | // 获取用户权限
21 | getSetting: function() {
22 | console.log('获取用户权限')
23 | var that = this;
24 | wx.getSetting({
25 | success(res) {
26 | if (!res.authSetting['scope.userInfo']) {
27 | wx.authorize({
28 | scope: 'scope.userInfo',
29 | success(res) {
30 | that.login()
31 | },
32 | error() {}
33 | })
34 | } else {
35 | that.data.logged ? that.getUserInfo() : that.login();
36 | }
37 | }
38 | })
39 | },
40 | // 获取图书分类列表
41 | getBookList(rankType, page, flag) {
42 | var that = this;
43 | var url = '/m/booklist/page/' + rankType + '/' + page;
44 | util.http('GET', url, {}, (response) => {
45 | if(response.errMsg) {
46 | util.showModel(response.errMsg);
47 | } else {
48 |
49 | if(flag){
50 | this.setData({
51 | bookList: that.data.bookList.concat(response)
52 | })
53 | }else{
54 | that.setData({
55 | bookList: response
56 | })
57 | }
58 | }
59 | })
60 | },
61 | setNavigationBarTitleText:function(){
62 | wx.setNavigationBarTitle({
63 | title: "精品书单"
64 | })
65 | },
66 | goBookListDetail(e) {
67 | wx.navigateTo({
68 | url: '../../pages/bookListDetail/bookListDetail?title=' + e.currentTarget.dataset.title + '&id=' + e.currentTarget.dataset.id
69 | })
70 | },
71 | getMoreBookList() {
72 | this.setData({
73 | num: (this.data.num) + 1
74 | })
75 | this.oldListArray = this.data.bookList;
76 | var page = (this.data.num);
77 | this.getBookList('1', page, true);
78 | },
79 | // 刷新数据
80 | onPullDownRefresh: function(){
81 | this.getBookList('1', '1', false);
82 | wx.stopPullDownRefresh();
83 | },
84 | // 加载更多
85 | onReachBottom: function() {
86 | this.getMoreBookList();
87 | },
88 | onReady: function() {
89 | this.getBookList('1', '1', false);
90 | this.setNavigationBarTitleText();
91 | }
92 | })
93 |
--------------------------------------------------------------------------------
/pages/bookList/bookList.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{item.title}}
7 | {{item.content}}
8 | {{item.authorName}} {{item.dateText}}
9 |
10 |
11 |
12 |
13 |
14 |
15 | {{loadMore}}
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/pages/bookList/bookList.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background: #F6F6F6;
3 | display: flex;
4 | flex-direction: column;
5 | justify-content: flex-start;
6 | position: relative;
7 | }
8 | .main{
9 | padding: 20rpx;
10 | }
11 | .tab-content{
12 | max-width: 750rpx;
13 | background: #F6F6F6;
14 | font-size: 28rpx;
15 | }
16 | .tab-content-bookList{
17 | max-width: 750rpx;
18 | height: 290rpx;
19 | padding: 20rpx;
20 | background: #fff;
21 | margin-bottom: 20rpx;
22 | box-shadow: 0rpx 0rpx 12rpx 6rpx #cccccc;
23 | }
24 | .category-avatar{
25 | width:50rpx;
26 | height: 50rpx;
27 | border-radius: 50%;
28 | display: inline-block;
29 | vertical-align: middle;
30 | }
31 | .category-title{
32 | font-size: 28rpx;
33 | color: #999;
34 | display: inline-block;
35 | vertical-align: middle;
36 | margin-left: 20rpx;
37 | }
38 | .bookList-author{
39 | margin-bottom: 20rpx;
40 | display: -webkit-box;
41 | -webkit-box-orient: vertical;
42 | -webkit-line-clamp: 3;
43 | overflow: hidden;
44 | }
45 | .bookList-right{
46 | width: 460rpx;
47 | height: 290rpx;
48 | float: left;
49 | padding-left: 20rpx;
50 | padding-right: 20rpx;
51 | box-sizing: border-box;
52 | position: relative;
53 | }
54 | .bookList-date{
55 | position: absolute;
56 | bottom: 0;
57 | color: #b8b6b6;
58 | font-size: 30rpx;
59 | }
60 | .bookList-left{
61 | float: left;
62 | height: 290rpx;
63 | }
64 | .bookList-left-image{
65 | width: 210rpx;
66 | height: 290rpx;
67 | }
68 | .bookList-title{
69 | font-size: 32rpx;
70 | color: #ff8862;
71 | overflow:hidden;
72 | white-space:nowrap;
73 | text-overflow:ellipsis;
74 | margin-bottom: 60rpx;
75 | }
76 | .bookList-content{
77 | max-width: 700rpx;
78 | display: -webkit-box;
79 | word-break: break-all;
80 | text-overflow: ellipsis;
81 | font-size: 28rpx;
82 | overflow: hidden;
83 | -webkit-box-orient: vertical;
84 | -webkit-line-clamp:2;
85 | color: #666;
86 | line-height: 1.6;
87 | }
88 | .bookList-footer{
89 | margin: 15rpx 0;
90 | color: #999;
91 | font-size: 26rpx;
92 | }
93 | .to-bookList-img{
94 | width: 200rpx;
95 | height: 200rpx;
96 | display: block;
97 | margin: 50rpx auto;
98 | }
99 | .to-bookList-title{
100 | font-size: 44rpx;
101 | color: #cdcdcd;
102 | font-weight: 500;
103 | text-align: center;
104 | }
105 | .to-bookList-tip{
106 | color: #1E8AE8;
107 | font-size: 32rpx;
108 | text-align: center;
109 | margin: 20rpx;
110 | }
111 | .load-more{
112 | color: #cdcdcd;
113 | text-align: center;
114 | margin: 15rpx 0;
115 | }
116 | .is-loading{
117 | width: 25rpx;
118 | height: 25rpx;
119 | margin-right: 10rpx;
120 | }
--------------------------------------------------------------------------------
/pages/bookListDetail/bookListDetail.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 |
3 | Page({
4 | data: {
5 | userInfo: {},
6 | logged: false,
7 | takeSession: false,
8 | requestResult: '',
9 | bookCategoryList: [],
10 | loadMore: '加载更多',
11 | isLoading: false,
12 | historyList: [],
13 | searchVal: '',
14 | getOption: {},
15 | oldListArray: [],
16 | num: 1
17 | },
18 |
19 | // 获取用户权限
20 | getSetting: function() {
21 | console.log('获取用户权限')
22 | var that = this;
23 | wx.getSetting({
24 | success(res) {
25 | if (!res.authSetting['scope.userInfo']) {
26 | wx.authorize({
27 | scope: 'scope.userInfo',
28 | success(res) {
29 | that.login()
30 | },
31 | error() {}
32 | })
33 | } else {
34 | that.data.logged ? that.getUserInfo() : that.login();
35 | }
36 | }
37 | })
38 | },
39 | // 获取图书分类列表
40 | getBookCategoryList(booklistId) {
41 | var that = this;
42 | var url = '/m/booklist/' + booklistId;
43 | util.http('GET', url, {}, (response) => {
44 | if(response.errMsg) {
45 | util.showModel(response.errMsg);
46 | } else {
47 | that.setData({
48 | bookCategoryList: response.bookList
49 | })
50 | }
51 | })
52 | },
53 | setNavigationBarTitleText:function(option){
54 | wx.setNavigationBarTitle({
55 | title: option.title
56 | })
57 | },
58 | goBookDetail(e) {
59 | wx.navigateTo({
60 | url: '../../pages/bookDetail/bookDetail?id=' + e.currentTarget.dataset.id
61 | })
62 | },
63 | getMoreBookList() {
64 | this.setData({
65 | num: (this.data.num) + 1
66 | })
67 | this.oldListArray = this.data.bookCategoryList;
68 | var page = (this.data.num);
69 | this.getBookCategoryList(this.getOption.type, page, true);
70 | },
71 | // 刷新数据
72 | onPullDownRefresh: function(){
73 | wx.stopPullDownRefresh();
74 | },
75 | // 加载更多
76 | onReachBottom: function() {
77 | // this.getMoreBookList();
78 | },
79 | onLoad: function(option){
80 | console.log(option);
81 | // this.getOption = option;
82 | this.setNavigationBarTitleText(option);
83 | this.getBookCategoryList(option.id);
84 | },
85 | onReady: function() {
86 | // this.getUserInfo();
87 | // this.getBookCategoryList();
88 | }
89 | })
--------------------------------------------------------------------------------
/pages/bookListDetail/bookListDetail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{item.name}}
10 | {{item.content}}
11 |
12 | {{item.author || ''}}
13 | 豆瓣评分:{{item.doubanScore || '暂无评分'}}
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/bookListDetail/bookListDetail.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | page {
3 | background: #F6F6F6;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: flex-start;
7 | position: relative;
8 | }
9 | .main{
10 | padding: 20rpx;
11 | }
12 | .tab-content{
13 | max-width: 750rpx;
14 | background: #F6F6F6;
15 | font-size: 28rpx;
16 | }
17 | .tab-content-bookListDetail{
18 | max-width: 750rpx;
19 | height: 290rpx;
20 | padding: 20rpx;
21 | background: #fff;
22 | margin-bottom: 20rpx;
23 | box-shadow: 0rpx 0rpx 12rpx 6rpx #cccccc;
24 | }
25 | .category-avatar{
26 | width:50rpx;
27 | height: 50rpx;
28 | border-radius: 50%;
29 | display: inline-block;
30 | vertical-align: middle;
31 | }
32 | .category-title{
33 | font-size: 28rpx;
34 | color: #999;
35 | display: inline-block;
36 | vertical-align: middle;
37 | margin-left: 20rpx;
38 | }
39 | .bookListDetail-author{
40 | float: left;
41 | }
42 | .bookListDetail-right{
43 | width: 460rpx;
44 | height: 290rpx;
45 | float: left;
46 | padding-left: 20rpx;
47 | box-sizing: border-box;
48 | position: relative;
49 | }
50 | .bookListDetail-info{
51 | position: absolute;
52 | bottom: 0;
53 | color: #969595;
54 | width: 440rpx;
55 | }
56 | .bookListDetail-doubanScore{
57 | float: right;
58 | }
59 | .bookListDetail-left{
60 | float: left;
61 | height: 290rpx;
62 | }
63 | .bookListDetail-left-image{
64 | width: 210rpx;
65 | height: 290rpx;
66 | }
67 | .bookListDetail-title{
68 | font-size: 32rpx;
69 | color: #ff8862;
70 | overflow:hidden;
71 | white-space:nowrap;
72 | text-overflow:ellipsis;
73 | margin-bottom: 20rpx;
74 | }
75 | .bookListDetail-content{
76 | display: -webkit-box;
77 | -webkit-box-orient: vertical;
78 | -webkit-line-clamp: 3;
79 | overflow: hidden;
80 | }
81 | .bookListDetail-footer{
82 | margin: 15rpx 0;
83 | color: #999;
84 | font-size: 26rpx;
85 | }
86 | .to-bookListDetail-img{
87 | width: 200rpx;
88 | height: 200rpx;
89 | display: block;
90 | margin: 50rpx auto;
91 | }
92 | .to-bookListDetail-title{
93 | font-size: 44rpx;
94 | color: #cdcdcd;
95 | font-weight: 500;
96 | text-align: center;
97 | }
98 | .to-bookListDetail-tip{
99 | color: #1E8AE8;
100 | font-size: 32rpx;
101 | text-align: center;
102 | margin: 20rpx;
103 | }
--------------------------------------------------------------------------------
/pages/bookTag/bookTag.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 |
3 | Page({
4 | data: {
5 | userInfo: {},
6 | logged: false,
7 | takeSession: false,
8 | requestResult: '',
9 | bookCategoryList: [],
10 | loadMore: '加载更多',
11 | isLoading: false,
12 | historyList: [],
13 | searchVal: '',
14 | getOption: {},
15 | oldListArray: [],
16 | num: 1
17 | },
18 | // 获取图书分类列表
19 | getBookTagList(sKey, page, flag) {
20 | var that = this;
21 | var url = '/app/tags/' + sKey + '/' + page;
22 | util.http('GET', url, {}, (response) => {
23 | if(response.errMsg) {
24 | util.showModel(response.errMsg);
25 | } else {
26 | if(flag){
27 | this.setData({
28 | bookCategoryList: that.data.bookCategoryList.concat(response.resData)
29 | })
30 | }else{
31 | that.setData({
32 | bookCategoryList: response.resData
33 | })
34 | }
35 | }
36 | })
37 | },
38 | setNavigationBarTitleText:function(option){
39 | wx.setNavigationBarTitle({
40 | title: option.tag
41 | })
42 | },
43 | goBookDetail(e) {
44 | wx.navigateTo({
45 | url: '../../pages/bookDetail/bookDetail?id=' + e.currentTarget.dataset.id
46 | })
47 | },
48 | getMoreBookTypeList() {
49 | this.setData({
50 | num: (this.data.num) + 1
51 | })
52 | this.oldListArray = this.data.bookCategoryList;
53 | var page = (this.data.num);
54 | this.getBookTagList(this.getOption.type, page, true);
55 | },
56 | // 刷新数据
57 | onPullDownRefresh: function(){
58 | this.getBookTagList(this.getOption.type, '1', false);
59 | wx.stopPullDownRefresh();
60 | },
61 | // 加载更多
62 | onReachBottom: function() {
63 | this.getMoreBookTypeList();
64 | },
65 | onLoad: function(option){
66 | this.getOption = option;
67 | this.setNavigationBarTitleText(option);
68 | this.getBookTagList(option.tag, '1');
69 | },
70 | onReady: function() {
71 | // this.getUserInfo();
72 | // this.getBookTagList();
73 | }
74 | })
--------------------------------------------------------------------------------
/pages/bookTag/bookTag.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{item.name}}
10 | {{item.author || ''}}
11 | 豆瓣评分:{{item.doubanScore}}
12 |
13 |
14 |
15 | {{loadMore}}
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/bookTag/bookTag.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | page {
3 | background: #F6F6F6;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: flex-start;
7 | position: relative;
8 | }
9 | .main{
10 | padding: 20rpx;
11 | }
12 | .tab-content{
13 | max-width: 750rpx;
14 | background: #F6F6F6;
15 | font-size: 28rpx;
16 | /* margin-top: 190rpx; */
17 | }
18 | .tab-content-focus,
19 | .tab-content-bookType,
20 | .tab-content-hot{
21 | max-width: 750rpx;
22 | height: 290rpx;
23 | padding: 20rpx;
24 | background: #fff;
25 | margin-bottom: 20rpx;
26 | box-shadow: 0rpx 0rpx 6rpx 6rpx #cccccc;
27 | }
28 | .category-avatar{
29 | width:50rpx;
30 | height: 50rpx;
31 | border-radius: 50%;
32 | display: inline-block;
33 | vertical-align: middle;
34 | }
35 | .category-title{
36 | font-size: 28rpx;
37 | color: #999;
38 | display: inline-block;
39 | vertical-align: middle;
40 | margin-left: 20rpx;
41 | }
42 | .bookType-author{
43 | margin-bottom: 40rpx;
44 | }
45 | .bookType-right{
46 | width: 460rpx;
47 | height: 290rpx;
48 | float: left;
49 | padding-left: 20rpx;
50 | box-sizing: border-box;
51 | position: relative;
52 | }
53 | .bookType-doubanScore{
54 | position: absolute;
55 | bottom: 0;
56 | color: #b8b6b6;
57 | }
58 | .bookType-left{
59 | float: left;
60 | height: 290rpx;
61 | }
62 | .bookType-left-image{
63 | width: 210rpx;
64 | height: 290rpx;
65 | }
66 | .bookType-title{
67 | font-size: 32rpx;
68 | color: #ff8862;
69 | overflow:hidden;
70 | white-space:nowrap;
71 | text-overflow:ellipsis;
72 | margin-bottom: 60rpx;
73 | }
74 | .focus-content,
75 | .bookType-content{
76 | max-width: 700rpx;
77 | display: -webkit-box;
78 | word-break: break-all;
79 | text-overflow: ellipsis;
80 | font-size: 28rpx;
81 | overflow: hidden;
82 | -webkit-box-orient: vertical;
83 | -webkit-line-clamp:2;
84 | color: #666;
85 | line-height: 1.6;
86 | }
87 | .focus-footer,
88 | .bookType-footer,
89 | .hot-footer-text{
90 | margin: 15rpx 0;
91 | color: #999;
92 | font-size: 26rpx;
93 | }
94 | .to-bookType-img{
95 | width: 200rpx;
96 | height: 200rpx;
97 | display: block;
98 | margin: 50rpx auto;
99 | }
100 | .to-bookType-title{
101 | font-size: 44rpx;
102 | color: #cdcdcd;
103 | font-weight: 500;
104 | text-align: center;
105 | }
106 | .to-bookType-tip{
107 | color: #1E8AE8;
108 | font-size: 32rpx;
109 | text-align: center;
110 | margin: 20rpx;
111 | }
112 | .load-more{
113 | color: #cdcdcd;
114 | text-align: center;
115 | margin: 15rpx 0;
116 | }
117 | .is-loading{
118 | width: 25rpx;
119 | height: 25rpx;
120 | margin-right: 10rpx;
121 | }
122 | .tab-content-hot{
123 | height: 150rpx;
124 | margin-bottom: 2rpx;
125 | }
126 | .hot-index,
127 | .hot-title{
128 | display: inline-block;
129 | vertical-align: top;
130 | }
131 | .hot-index,
132 | .hot-title{
133 | font-size: 34rpx;
134 | }
135 | .hot-index{
136 | width: 50rpx;
137 | color: #E6DA7A;
138 | }
139 | .hot-index-hot{
140 | color: orangered;
141 | }
142 | .hot-title{
143 | max-width: 470rpx;
144 | display: -webkit-inline-box;
145 | word-break: break-all;
146 | text-overflow: ellipsis;
147 | overflow: hidden;
148 | -webkit-box-orient: vertical;
149 | -webkit-line-clamp:2;
150 | line-height: 1.6;
151 | margin-right: 20rpx;
152 | margin-left: 10rpx;
153 | }
154 | .hot-image{
155 | width: 150rpx;
156 | height: 100rpx;
157 | border-radius: 10rpx;
158 | }
159 | .hot-footer-text{
160 | margin-left: 60rpx;
161 | }
--------------------------------------------------------------------------------
/pages/bookType/bookType.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 |
3 | Page({
4 | data: {
5 | userInfo: {},
6 | logged: false,
7 | takeSession: false,
8 | requestResult: '',
9 | bookCategoryList: [],
10 | loadMore: '加载更多',
11 | isLoading: false,
12 | historyList: [],
13 | searchVal: '',
14 | getOption: {},
15 | oldListArray: [],
16 | num: 1
17 | },
18 |
19 | // 获取用户权限
20 | getSetting: function() {
21 | console.log('获取用户权限')
22 | var that = this;
23 | wx.getSetting({
24 | success(res) {
25 | if (!res.authSetting['scope.userInfo']) {
26 | wx.authorize({
27 | scope: 'scope.userInfo',
28 | success(res) {
29 | that.login()
30 | },
31 | error() {}
32 | })
33 | } else {
34 | that.data.logged ? that.getUserInfo() : that.login();
35 | }
36 | }
37 | })
38 | },
39 | // 获取图书分类列表
40 | getBookCategoryList(type, page, flag) {
41 | var that = this;
42 | var url = '/m/good/c/' + type + '/' + page;
43 | util.http('GET', url, {}, (response) => {
44 | if(response.errMsg) {
45 | util.showModel(response.errMsg);
46 | } else {
47 | if(flag){
48 | this.setData({
49 | bookCategoryList: that.data.bookCategoryList.concat(response)
50 | })
51 | }else{
52 | that.setData({
53 | bookCategoryList: response
54 | })
55 | }
56 | }
57 | })
58 | },
59 | setNavigationBarTitleText:function(option){
60 | wx.setNavigationBarTitle({
61 | title: option.category
62 | })
63 | },
64 | goBookDetail(e) {
65 | wx.navigateTo({
66 | url: '../../pages/bookDetail/bookDetail?id=' + e.currentTarget.dataset.id
67 | })
68 | },
69 | getMoreBookTypeList() {
70 | this.setData({
71 | num: (this.data.num) + 1
72 | })
73 | this.oldListArray = this.data.bookCategoryList;
74 | var page = (this.data.num);
75 | this.getBookCategoryList(this.getOption.type, page, true);
76 | },
77 | // 刷新数据
78 | onPullDownRefresh: function(){
79 | this.getBookCategoryList(this.getOption.type, '1', false);
80 | wx.stopPullDownRefresh();
81 | },
82 | // 加载更多
83 | onReachBottom: function() {
84 | this.getMoreBookTypeList();
85 | },
86 | onLoad: function(option){
87 | this.getOption = option;
88 | this.setNavigationBarTitleText(option);
89 | this.getBookCategoryList(option.type, '1');
90 | },
91 | onReady: function() {
92 | // this.getUserInfo();
93 | // this.getBookCategoryList();
94 | }
95 | })
--------------------------------------------------------------------------------
/pages/bookType/bookType.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{item.name}}
10 | {{item.author || ''}}
11 | 豆瓣评分:{{item.doubanScore}}
12 |
13 |
14 |
15 | {{loadMore}}
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/bookType/bookType.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | page {
3 | background: #F6F6F6;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: flex-start;
7 | position: relative;
8 | }
9 | .main{
10 | padding: 20rpx;
11 | }
12 | .tab-content{
13 | max-width: 750rpx;
14 | background: #F6F6F6;
15 | font-size: 28rpx;
16 | /* margin-top: 190rpx; */
17 | }
18 | .tab-content-focus,
19 | .tab-content-bookType,
20 | .tab-content-hot{
21 | max-width: 750rpx;
22 | height: 290rpx;
23 | padding: 20rpx;
24 | background: #fff;
25 | margin-bottom: 20rpx;
26 | box-shadow: 0rpx 0rpx 6rpx 6rpx #cccccc;
27 | }
28 | .category-avatar{
29 | width:50rpx;
30 | height: 50rpx;
31 | border-radius: 50%;
32 | display: inline-block;
33 | vertical-align: middle;
34 | }
35 | .category-title{
36 | font-size: 28rpx;
37 | color: #999;
38 | display: inline-block;
39 | vertical-align: middle;
40 | margin-left: 20rpx;
41 | }
42 | .bookType-author{
43 | margin-bottom: 40rpx;
44 | }
45 | .bookType-right{
46 | width: 460rpx;
47 | height: 290rpx;
48 | float: left;
49 | padding-left: 20rpx;
50 | box-sizing: border-box;
51 | position: relative;
52 | }
53 | .bookType-doubanScore{
54 | position: absolute;
55 | bottom: 0;
56 | color: #b8b6b6;
57 | }
58 | .bookType-left{
59 | float: left;
60 | height: 290rpx;
61 | }
62 | .bookType-left-image{
63 | width: 210rpx;
64 | height: 290rpx;
65 | }
66 | .bookType-title{
67 | font-size: 32rpx;
68 | color: #ff8862;
69 | overflow:hidden;
70 | white-space:nowrap;
71 | text-overflow:ellipsis;
72 | margin-bottom: 60rpx;
73 | }
74 | .focus-content,
75 | .bookType-content{
76 | max-width: 700rpx;
77 | display: -webkit-box;
78 | word-break: break-all;
79 | text-overflow: ellipsis;
80 | font-size: 28rpx;
81 | overflow: hidden;
82 | -webkit-box-orient: vertical;
83 | -webkit-line-clamp:2;
84 | color: #666;
85 | line-height: 1.6;
86 | }
87 | .focus-footer,
88 | .bookType-footer,
89 | .hot-footer-text{
90 | margin: 15rpx 0;
91 | color: #999;
92 | font-size: 26rpx;
93 | }
94 | .to-bookType-img{
95 | width: 200rpx;
96 | height: 200rpx;
97 | display: block;
98 | margin: 50rpx auto;
99 | }
100 | .to-bookType-title{
101 | font-size: 44rpx;
102 | color: #cdcdcd;
103 | font-weight: 500;
104 | text-align: center;
105 | }
106 | .to-bookType-tip{
107 | color: #1E8AE8;
108 | font-size: 32rpx;
109 | text-align: center;
110 | margin: 20rpx;
111 | }
112 | .load-more{
113 | color: #cdcdcd;
114 | text-align: center;
115 | margin: 15rpx 0;
116 | }
117 | .is-loading{
118 | width: 25rpx;
119 | height: 25rpx;
120 | margin-right: 10rpx;
121 | }
122 | .tab-content-hot{
123 | height: 150rpx;
124 | margin-bottom: 2rpx;
125 | }
126 | .hot-index,
127 | .hot-title{
128 | display: inline-block;
129 | vertical-align: top;
130 | }
131 | .hot-index,
132 | .hot-title{
133 | font-size: 34rpx;
134 | }
135 | .hot-index{
136 | width: 50rpx;
137 | color: #E6DA7A;
138 | }
139 | .hot-index-hot{
140 | color: orangered;
141 | }
142 | .hot-title{
143 | max-width: 470rpx;
144 | display: -webkit-inline-box;
145 | word-break: break-all;
146 | text-overflow: ellipsis;
147 | overflow: hidden;
148 | -webkit-box-orient: vertical;
149 | -webkit-line-clamp:2;
150 | line-height: 1.6;
151 | margin-right: 20rpx;
152 | margin-left: 10rpx;
153 | }
154 | .hot-image{
155 | width: 150rpx;
156 | height: 100rpx;
157 | border-radius: 10rpx;
158 | }
159 | .hot-footer-text{
160 | margin-left: 60rpx;
161 | }
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 |
3 | Page({
4 | data: {
5 | interval: 5000,
6 | duration: 500,
7 | pictureList: [],
8 | adInfo: {},
9 | newsList: [],
10 | partList: [],
11 | specialList: [],
12 | goodBookList: [],
13 | hotBookList: [],
14 | isInputDisabled: true
15 | },
16 | getIndexList: function() {
17 | var that = this;
18 | var url = '/app/getIndexInfo';
19 | util.http('GET', url , {}, (response) => {
20 | if (response.errMsg) {
21 | util.showModel(response.errMsg);
22 | } else {
23 | console.log('请求首页列表接口成功!');
24 | that.setData({
25 | pictureList: response.pictureList || [],
26 | newsList: response.newsList || [],
27 | partList: response.partList || [],
28 | newBookList: response.newBookList || [],
29 | goodBookList: response.goodBookList || [],
30 | hotBookList: response.hotBookList || []
31 | })
32 | }
33 | })
34 | },
35 | getMoreBook: function(){
36 | var that = this;
37 | var url = '/app/getMore';
38 | var data = {
39 | type: "GOOD",
40 | page: 1,
41 | pageSize: 10
42 | };
43 | util.http('GET', url , data, (response) => {
44 | if (response.errMsg) {
45 | util.showModel(response.errMsg);
46 | } else {
47 | console.log(response);
48 | }
49 | })
50 | },
51 | goBookCity(e){
52 | wx.switchTab({
53 | url: '../../pages/bookCity/bookCity'
54 | })
55 | },
56 | goBookList(e){
57 | wx.switchTab({
58 | url: '../../pages/bookList/bookList'
59 | })
60 | },
61 | goRankList(e){
62 | wx.navigateTo({
63 | url: '../../pages/rankList/rankList'
64 | })
65 | },
66 | goMoreBook(e){
67 | wx.navigateTo({
68 | url: '../../pages/moreBook/moreBook?type=' + e.currentTarget.dataset.type + '&category=' + e.currentTarget.dataset.category
69 | })
70 | },
71 | goSearchPage(){
72 | wx.navigateTo({
73 | url: '../../pages/searchPage/searchPage'
74 | })
75 | },
76 | goBookDetail(e){
77 | wx.navigateTo({
78 | url: '../../pages/bookDetail/bookDetail?id=' + e.currentTarget.dataset.id
79 | })
80 | },
81 | setNavigationBarTitleText:function(){
82 | wx.setNavigationBarTitle({
83 | title: '集思会Lite'
84 | })
85 | },
86 | onPullDownRefresh: function() {
87 | this.getIndexList();
88 | wx.stopPullDownRefresh();
89 | },
90 | onReachBottom: function() {
91 | },
92 | onLoad: function(){
93 | this.setNavigationBarTitleText();
94 | },
95 | onReady: function() {
96 | this.getIndexList();
97 | }
98 | })
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
9 |
10 |
13 |
14 |
15 |
16 |
17 |
27 |
28 |
29 |
30 |
31 |
32 | 榜单
33 |
34 |
35 |
36 | 分类
37 |
38 |
39 |
40 | 书单
41 |
42 |
46 |
47 |
48 |
49 |
53 |
54 |
55 |
56 | {{item.name}}
57 |
58 |
59 |
60 |
61 |
62 |
66 |
67 |
68 |
69 | {{item.name}}
70 |
71 |
72 |
73 |
74 |
75 |
79 |
80 |
81 |
82 | {{item.name}}
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background: #F6F6F6;
3 | display: flex;
4 | flex-direction: column;
5 | justify-content: flex-start;
6 | position: relative;
7 | padding-top: 60rpx;
8 | color: #323233;
9 | }
10 | .market-search-wrapper{
11 | width: 750rpx;
12 | height: 73rpx;
13 | line-height: 73rpx;
14 | padding: 5rpx;
15 | background: #ff8862;
16 | position: fixed;
17 | top: 0;
18 | left: 0;
19 | z-index: 99;
20 | text-align: center;
21 | }
22 | .market-search-text{
23 | color: #fff;
24 | width: 700rpx;
25 | font-size: 35rpx;
26 | display: inline-block;
27 | }
28 |
29 | .market-search-text-text{
30 | color: #fff;
31 | }
32 | .market-search-text-input{
33 | background-color: #fff;
34 | border-radius: 15rpx;
35 | height: 60rpx;
36 | line-height: 60rpx;
37 | }
38 | .market-search-input,
39 | .market-search-mask-input{
40 | width: 690rpx;
41 | height: 70rpx;
42 | margin: 15rpx 20rpx;
43 | display: inline-block;
44 | vertical-align: middle;
45 | background: #F6F6F6;
46 | border-radius: 10rpx;
47 | text-align: center;
48 | font-size: 28rpx;
49 | line-height: 70rpx;
50 | color: #cdcdcd;
51 | }
52 | .market-search-button{
53 | width: 40rpx;
54 | height: 60rpx;
55 | font-size: 28rpx;
56 | display: inline-block;
57 | vertical-align: middle;
58 | line-height: 60rpx;
59 | position: absolute;
60 | right: 30rpx;
61 | }
62 | .market-search-input-icon,
63 | .market-search-button-icon{
64 | width: 40rpx;
65 | height: 40rpx;
66 | display: inline-block;
67 | vertical-align: middle;
68 | }
69 | .market-search-input-icon{
70 | width: 30rpx;
71 | height: 30rpx;
72 | margin-bottom: 5rpx;
73 | line-height: 70rpx;
74 | display: inline-block;
75 | vertical-align: middle;
76 | }
77 | .market-search-button-text{
78 | color: #1E8AE8;
79 | display: inline-block;
80 | vertical-align: middle;
81 | }
82 | .market-swiper-wrapper{
83 | width: 750rpx;
84 | height: 400rpx;
85 | }
86 | .market-swiper-img{
87 | width: 750rpx;
88 | height: 410rpx;
89 | }
90 | .market-icon{
91 | margin-top: 25rpx;
92 | }
93 | .market-icon-list{
94 | background: #fff;
95 | padding: 20rpx 0;
96 | margin-bottom: 20px;
97 | text-align: center;
98 | }
99 | .market-icon-item{
100 | width: 250rpx;
101 | display: inline-block;
102 | text-align: center;
103 | color: #323233;
104 | font-size: 24rpx;
105 | }
106 | .market-icon-text{
107 | color: #ff8862;
108 | font-size: 30rpx;
109 | }
110 | .market-icon-img{
111 | width: 60rpx;
112 | height: 60rpx;
113 | }
114 | .market-ad{
115 | width: 690rpx;
116 | padding: 20rpx 30rpx;
117 | text-align: center;
118 | background: #fff;
119 | }
120 | .market-ad-img{
121 | width: 690rpx;
122 | height: 230rpx;
123 | border-radius: 10rpx;
124 | }
125 | .market-live{
126 | margin-top: 20rpx;
127 | background: #fff;
128 | color: #323233;
129 | font-size: 28rpx;
130 | }
131 | .market-scroll-view{
132 | white-space: nowrap;
133 | }
134 | .market-live-item{
135 | width: 700rpx;
136 | display: inline-block;
137 | white-space: normal !important;
138 | border: 2rpx solid #1E8AE8;
139 | }
140 | .market-news-list{
141 | background: #fff;
142 | margin-top: 20rpx;
143 | width: 700rpx;
144 | padding: 20rpx 25rpx;
145 | }
146 | .market-news-header{
147 | font-size: 30rpx;
148 | font-weight: 500;
149 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
150 | padding-bottom: 20rpx;
151 | color: #323233;
152 | }
153 | .market-news-item{
154 | width: 700rpx;
155 | padding: 20rpx 0;
156 | font-size: 28rpx;
157 | position: relative;
158 | }
159 | .maeket-news-icon,
160 | .market-news-time{
161 | position: absolute;
162 | top: 25rpx;
163 | }
164 | .maeket-news-icon{
165 | width: 30rpx;
166 | height: 30rpx;
167 | margin-right: 10rpx;
168 | left: 0;
169 | }
170 | .market-news-title{
171 | width: 540rpx;
172 | display: -webkit-box;
173 | word-break: break-all;
174 | text-overflow: ellipsis;
175 | font-size: 28rpx;
176 | overflow: hidden;
177 | -webkit-box-orient: vertical;
178 | -webkit-line-clamp: 1;
179 | margin-left: 40rpx;
180 | }
181 | .market-news-time{
182 | color: #999;
183 | font-size: 24rpx;
184 | width: 70rpx;
185 | right: 0;
186 | }
187 | .market-news-footer{
188 | margin-top: 20rpx;
189 | }
190 | .market-news-btn,
191 | .market-news-more{
192 | display: inline-block;
193 | vertical-align: middle;
194 | }
195 | .market-news-btn{
196 | width: 250rpx;
197 | height: 70rpx;
198 | border-radius: 80rpx;
199 | color: #e98f36;
200 | background: #f4ea29;
201 | text-align: center;
202 | }
203 | .market-news-img{
204 | width: 20rpx;
205 | height: 20rpx;
206 | margin-right: 10rpx;
207 | }
208 | .market-news-text{
209 | font-size: 24rpx;
210 | }
211 | .market-news-img,
212 | .market-news-text{
213 | display: inline-block;
214 | vertical-align: middle;
215 | margin-top: 10rpx;
216 | }
217 | .market-news-more{
218 | color: #1E8AE8;
219 | font-size: 28rpx;
220 | float: right;
221 | margin-top: 15rpx;
222 | margin-right: 20rpx;
223 | }
224 | .market-video-header{
225 | padding-bottom: 20rpx;
226 | }
227 | .market-video-icon,
228 | .market-lesson-icon,
229 | .market-book-icon,
230 | .market-guess-icon{
231 | width: 40rpx;
232 | height: 40rpx;
233 | display: inline-block;
234 | vertical-align: middle;
235 | margin-right: 10rpx;
236 | }
237 | .market-book-icon{
238 | width: 30rpx;
239 | height: 30rpx;
240 | }
241 | .market-video-text,
242 | .market-lesson-text,
243 | .market-book-text,
244 | .market-guess-text{
245 | font-size: 30rpx;
246 | color: #323233;
247 | display: inline-block;
248 | vertical-align: middle;
249 | font-weight: 700;
250 | }
251 | .market-video-item{
252 | border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
253 | font-size: 28rpx;
254 | padding: 20rpx 0;
255 | }
256 | .market-video-img,
257 | .market-video-area,
258 | .market-video-play{
259 | display: inline-block;
260 | vertical-align: middle;
261 | }
262 | .market-video-img{
263 | width: 150rpx;
264 | height: 150rpx;
265 | border-radius: 10rpx;
266 | margin-right: 20rpx;
267 | }
268 | .market-video-area{
269 | width: 400rpx;
270 | }
271 | .market-video-play{
272 | width: 120rpx;
273 | color: #dfbe79;
274 | font-size: 24rpx;
275 | text-align: center;
276 | margin-top: 40rpx;
277 | }
278 | .market-play-btn{
279 | width: 60rpx;
280 | height: 60rpx;
281 | }
282 | .market-video-info{
283 | color: #999;
284 | }
285 | .market-video-price{
286 | color: #dfbe79;
287 | margin-top: 10rpx;
288 | }
289 | .market-vidoe-title,
290 | .market-video-info,
291 | .market-video-price{
292 | display: -webkit-box;
293 | word-break: break-all;
294 | text-overflow: ellipsis;
295 | overflow: hidden;
296 | -webkit-box-orient: vertical;
297 | -webkit-line-clamp: 1;
298 | line-height: 1.6;
299 | }
300 | .market-vidoe-title{
301 | font-weight: 500;
302 | }
303 | .market-vidoe-footer{
304 | text-align: center;
305 | color: #1E8AE8;
306 | font-size: 28rpx;
307 | padding: 20rpx 0;
308 | }
309 | .market-part,
310 | .market-lesson,
311 | .market-video,
312 | .market-book,
313 | .market-banner,
314 | .market-guess{
315 | margin-top: 20rpx;
316 | background: #fff;
317 | padding: 20rpx 25rpx;
318 | width: 700rpx;
319 | position: relative;
320 | }
321 | .market-part-left,
322 | .market-part-top,
323 | .market-part-bottom{
324 | background: #eee;
325 | border-radius: 10rpx;
326 | position: relative;
327 | }
328 | .market-part-left,
329 | .market-part-right{
330 | display: inline-block;
331 | vertical-align: middle;
332 | width: 340rpx;
333 | height: 340rpx;
334 | font-size: 30rpx;
335 | text-align: center;
336 | }
337 | .market-part-left .market-part-title{
338 | display: inline-block;
339 | color: #e98f36;
340 | }
341 | .market-part-left .market-part-img{
342 | width: 200rpx;
343 | height: 100rpx;
344 | }
345 | .market-part-right{
346 | margin-left: 20rpx;
347 | }
348 | .market-part-right .market-part-text{
349 | display: inline-block;
350 | vertical-align: middle;
351 | width: 160rpx;
352 | margin-top: 30rpx;
353 | }
354 | .market-part-right .market-part-img{
355 | display: inline-block;
356 | vertical-align: middle;
357 | width: 100rpx;
358 | height: 100rpx;
359 | margin-top: 30rpx;
360 | margin-left: 20rpx;
361 | }
362 | .market-part-top,
363 | .market-part-bottom{
364 | height: 160rpx;
365 | }
366 | .market-part-bottom{
367 | margin-top: 20rpx;
368 | }
369 | .market-part-left .market-part-title{
370 | position: absolute;
371 | top: 25%;
372 | left: 50%;
373 | transform: translate(-50%, -25%);
374 | }
375 | .market-part-right .market-part-title{
376 | text-align: left;
377 | }
378 | .market-part-left .market-part-img{
379 | position: absolute;
380 | top: 65%;
381 | left: 50%;
382 | transform: translate(-50%, -65%);
383 | }
384 | .market-part-tip{
385 | font-size: 24rpx;
386 | text-align: left;
387 | }
388 | .market-part-top .market-part-tip{
389 | color: #ff6666;
390 | }
391 | .market-part-bottom .market-part-tip{
392 | color: #999;
393 | }
394 | .market-book-more{
395 | color: #ff8862;
396 | font-size:30rpx;
397 | /* display: inline-block; */
398 | float: right;
399 | }
400 | .market-book-list{
401 | text-align: center;
402 | font-size: 28rpx;
403 | padding: 20rpx 0;
404 | }
405 | .market-book-item{
406 | display: inline-block;
407 | width: 230rpx;
408 | margin: 13rpx 0;
409 | }
410 | .market-book-img{
411 | width: 210rpx;
412 | height: 290rpx;
413 | }
414 | .market-book-name{
415 | width: 195rpx;
416 | padding: 0 10rpx;
417 | display: -webkit-box;
418 | word-break: break-all;
419 | text-overflow: ellipsis;
420 | overflow: hidden;
421 | white-space:nowrap;
422 | font-size: 28rpx;
423 | -webkit-box-orient: vertical;
424 | -webkit-line-clamp: 1;
425 | text-align: center;
426 | }
427 | .market-book-actprice,
428 | .market-book-price{
429 | text-align: left;
430 | color: #ff6666;
431 | font-size: 26rpx;
432 | display: inline-block;
433 | }
434 | .market-book-price{
435 | color: #999;
436 | margin-left: 10rpx;
437 | text-decoration: line-through;
438 | }
439 | .market-banner{
440 | width: 750rpx;
441 | padding: 20rpx 0;
442 | }
443 | .market-banner-item{
444 | display: inline-block;
445 | margin-left: 20rpx;
446 | }
447 | .market-banner-img{
448 | width: 400rpx;
449 | height: 150rpx;
450 | border-radius: 10rpx;
451 | }
452 | .last-item{
453 | margin-right: 20rpx;
454 | }
455 |
456 | .market-icon-wrapper{
457 | width: 30rpx;
458 | height: 30rpx;
459 | position: relative;
460 | display: inline-block;
461 | }
462 | .market-info-icon{
463 | width: 30rpx;
464 | height: 30rpx;
465 | position: absolute;
466 | top: 5rpx;
467 | }
468 | .market-icon-best{
469 | left: 0;
470 | z-index: 1;
471 | }
472 | .market-icon-auth{
473 | left: 5rpx;
474 | }
475 | .market-score-item{
476 | display: inline-block;
477 | width: 30rpx;
478 | height: 30rpx;
479 | }
480 | .market-guess-price{
481 | display: inline-block;
482 | vertical-align: middle;
483 | color: #ff6666;
484 | font-size: 26rpx;
485 | margin-left: 30rpx;
486 | }
487 | .market-guess-title{
488 | width: 540rpx;
489 | display: -webkit-box;
490 | word-break: break-all;
491 | text-overflow: ellipsis;
492 | font-size: 28rpx;
493 | overflow: hidden;
494 | -webkit-box-orient: vertical;
495 | -webkit-line-clamp: 1;
496 | }
497 | .market-guess-info,
498 | .market-guess-img{
499 | display: inline-block;
500 | vertical-align: top;
501 | }
502 | .market-guess-img{
503 | width: 120rpx;
504 | height: 120rpx;
505 | border-radius: 10rpx;
506 | margin-left: 30rpx;
507 | }
508 | .market-guess{
509 | margin-bottom: 20rpx;
510 | }
511 | .show{
512 | display: block;
513 | }
514 | .hide{
515 | display: none;
516 | }
--------------------------------------------------------------------------------
/pages/moreBook/moreBook.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 |
3 | Page({
4 | data: {
5 | userInfo: {},
6 | logged: false,
7 | takeSession: false,
8 | requestResult: '',
9 | moreBookList: [],
10 | loadMore: '加载更多',
11 | isLoading: false,
12 | historyList: [],
13 | searchVal: '',
14 | getOption: {},
15 | oldListArray: [],
16 | num: 1
17 | },
18 |
19 | // 获取用户权限
20 | getSetting: function() {
21 | console.log('获取用户权限')
22 | var that = this;
23 | wx.getSetting({
24 | success(res) {
25 | if (!res.authSetting['scope.userInfo']) {
26 | wx.authorize({
27 | scope: 'scope.userInfo',
28 | success(res) {
29 | that.login()
30 | },
31 | error() {}
32 | })
33 | } else {
34 | that.data.logged ? that.getUserInfo() : that.login();
35 | }
36 | }
37 | })
38 | },
39 | getMoreBookList(type, page, flag) {
40 | var that = this;
41 | var url = '/app/getMore';
42 | var data = {
43 | type: type,
44 | page: page,
45 | pageSize: 10
46 | };
47 | util.http('GET', url, data, (response) => {
48 | if(response.errMsg) {
49 | util.showModel(response.errMsg);
50 | } else {
51 | if(flag){
52 | this.setData({
53 | moreBookList: that.data.moreBookList.concat(response.bookList)
54 | })
55 | }else{
56 | that.setData({
57 | moreBookList: response.bookList
58 | })
59 | }
60 | }
61 | })
62 | },
63 | setNavigationBarTitleText:function(option){
64 | wx.setNavigationBarTitle({
65 | title: option.category
66 | })
67 | },
68 | goBookDetail(e) {
69 | wx.navigateTo({
70 | url: '../../pages/bookDetail/bookDetail?id=' + e.currentTarget.dataset.id
71 | })
72 | },
73 | getMoreBookTypeList() {
74 | this.setData({
75 | num: (this.data.num) + 1
76 | })
77 | this.oldListArray = this.data.moreBookList;
78 | var page = (this.data.num);
79 | this.getMoreBookList(this.getOption.type, page, true);
80 | },
81 | // 刷新数据
82 | onPullDownRefresh: function(){
83 | this.getMoreBookList(this.getOption.type, '1', false);
84 | wx.stopPullDownRefresh();
85 | },
86 | // 加载更多
87 | onReachBottom: function() {
88 | this.getMoreBookTypeList();
89 | },
90 | onLoad: function(option){
91 | this.getOption = option;
92 | this.setNavigationBarTitleText(option);
93 | this.getMoreBookList(option.type, '1');
94 | },
95 | onReady: function() {
96 | }
97 | })
--------------------------------------------------------------------------------
/pages/moreBook/moreBook.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{item.name}}
10 | {{item.author || ''}}
11 | 豆瓣评分:{{item.doubanScore}}
12 |
13 |
14 |
15 | {{loadMore}}
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/moreBook/moreBook.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | page {
3 | background: #F6F6F6;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: flex-start;
7 | position: relative;
8 | }
9 | .main{
10 | padding: 20rpx;
11 | }
12 | .tab-content{
13 | max-width: 750rpx;
14 | background: #F6F6F6;
15 | font-size: 28rpx;
16 | /* margin-top: 190rpx; */
17 | }
18 | .tab-content-focus,
19 | .tab-content-bookType,
20 | .tab-content-hot{
21 | max-width: 750rpx;
22 | height: 290rpx;
23 | padding: 20rpx;
24 | background: #fff;
25 | margin-bottom: 20rpx;
26 | box-shadow: 0rpx 0rpx 6rpx 6rpx #cccccc;
27 | }
28 | .category-avatar{
29 | width:50rpx;
30 | height: 50rpx;
31 | border-radius: 50%;
32 | display: inline-block;
33 | vertical-align: middle;
34 | }
35 | .category-title{
36 | font-size: 28rpx;
37 | color: #999;
38 | display: inline-block;
39 | vertical-align: middle;
40 | margin-left: 20rpx;
41 | }
42 | .bookType-author{
43 | margin-bottom: 40rpx;
44 | }
45 | .bookType-right{
46 | width: 460rpx;
47 | height: 290rpx;
48 | float: left;
49 | padding-left: 20rpx;
50 | box-sizing: border-box;
51 | position: relative;
52 | }
53 | .bookType-doubanScore{
54 | position: absolute;
55 | bottom: 0;
56 | color: #b8b6b6;
57 | }
58 | .bookType-left{
59 | float: left;
60 | height: 290rpx;
61 | }
62 | .bookType-left-image{
63 | width: 210rpx;
64 | height: 290rpx;
65 | }
66 | .bookType-title{
67 | font-size: 32rpx;
68 | color: #ff8862;
69 | overflow:hidden;
70 | white-space:nowrap;
71 | text-overflow:ellipsis;
72 | margin-bottom: 60rpx;
73 | }
74 | .focus-content,
75 | .bookType-content{
76 | max-width: 700rpx;
77 | display: -webkit-box;
78 | word-break: break-all;
79 | text-overflow: ellipsis;
80 | font-size: 28rpx;
81 | overflow: hidden;
82 | -webkit-box-orient: vertical;
83 | -webkit-line-clamp:2;
84 | color: #666;
85 | line-height: 1.6;
86 | }
87 | .focus-footer,
88 | .bookType-footer,
89 | .hot-footer-text{
90 | margin: 15rpx 0;
91 | color: #999;
92 | font-size: 26rpx;
93 | }
94 | .to-bookType-img{
95 | width: 200rpx;
96 | height: 200rpx;
97 | display: block;
98 | margin: 50rpx auto;
99 | }
100 | .to-bookType-title{
101 | font-size: 44rpx;
102 | color: #cdcdcd;
103 | font-weight: 500;
104 | text-align: center;
105 | }
106 | .to-bookType-tip{
107 | color: #1E8AE8;
108 | font-size: 32rpx;
109 | text-align: center;
110 | margin: 20rpx;
111 | }
112 | .load-more{
113 | color: #cdcdcd;
114 | text-align: center;
115 | margin: 15rpx 0;
116 | }
117 | .is-loading{
118 | width: 25rpx;
119 | height: 25rpx;
120 | margin-right: 10rpx;
121 | }
122 | .tab-content-hot{
123 | height: 150rpx;
124 | margin-bottom: 2rpx;
125 | }
126 | .hot-index,
127 | .hot-title{
128 | display: inline-block;
129 | vertical-align: top;
130 | }
131 | .hot-index,
132 | .hot-title{
133 | font-size: 34rpx;
134 | }
135 | .hot-index{
136 | width: 50rpx;
137 | color: #E6DA7A;
138 | }
139 | .hot-index-hot{
140 | color: orangered;
141 | }
142 | .hot-title{
143 | max-width: 470rpx;
144 | display: -webkit-inline-box;
145 | word-break: break-all;
146 | text-overflow: ellipsis;
147 | overflow: hidden;
148 | -webkit-box-orient: vertical;
149 | -webkit-line-clamp:2;
150 | line-height: 1.6;
151 | margin-right: 20rpx;
152 | margin-left: 10rpx;
153 | }
154 | .hot-image{
155 | width: 150rpx;
156 | height: 100rpx;
157 | border-radius: 10rpx;
158 | }
159 | .hot-footer-text{
160 | margin-left: 60rpx;
161 | }
--------------------------------------------------------------------------------
/pages/rankList/rankList.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 |
3 | Page({
4 | data: {
5 | userInfo: {},
6 | logged: false,
7 | takeSession: false,
8 | requestResult: '',
9 | isShow: false,
10 | isShowQues: false,
11 | isActive: 1,
12 | animationData: {},
13 | loadMore: '加载更多',
14 | isLoading: false,
15 | historyList: [],
16 | searchVal: ''
17 | },
18 | // 获取周榜月榜
19 | getRankList(flag) {
20 | var that = this;
21 | var url = '/m /weekAndMonth';
22 | util.http('GET',url, {}, (res) => {
23 | if(res.errMsg) {
24 | util.showModel(res.errMsg);
25 | } else {
26 | if(!flag) {
27 | that.setData({
28 | weekList: res.week,
29 | monthList: res.month
30 | })
31 | }
32 | }
33 | })
34 | },
35 | goBookDetail(e){
36 | wx.navigateTo({
37 | url: '../../pages/bookDetail/bookDetail?id=' + e.currentTarget.dataset.id
38 | })
39 | },
40 | goTitleDetail(e) {
41 | wx.navigateTo({
42 | url: '../../pages/titleDetail/titleDetail?id=' + e.target.dataset.id + '&title=' + e.target.dataset.title
43 | })
44 | },
45 | goContentDetail(e) {
46 | wx.navigateTo({
47 | url: '../../pages/contentDetail/contentDetail?id=' + e.target.dataset.id + '&title=' + e.target.dataset.title + '&avatar=' + e.target.dataset.avatar + '&content=' + e.target.dataset.content + '&like=' + e.target.dataset.like + '&comment=' + e.target.dataset.comment
48 | })
49 | },
50 | setNavigationBarTitleText:function(){
51 | wx.setNavigationBarTitle({
52 | title: "排行榜"
53 | })
54 | },
55 | // 刷新数据
56 | onPullDownRefresh: function(){
57 | // if(!this.data.isShow && !this.data.isShowQues) {
58 | // wx.showNavigationBarLoading();
59 | // switch(+this.data.isActive) {
60 | // case 0: this.getFocusList(true); break;
61 | // case 1: this.getRecommendList(true); break;
62 | // case 2: this.getHotList(true); break;
63 | // default: break;
64 | // }
65 | // }
66 | },
67 | onReady: function() {
68 | // this.getUserInfo();
69 | this.setNavigationBarTitleText();
70 | // this.getFocusList();
71 | // this.getRecommendList();
72 | this.getRankList();
73 | // this.getHotList();
74 | }
75 | })
--------------------------------------------------------------------------------
/pages/rankList/rankList.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 周推榜
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | {{index + 1}}
14 |
15 |
16 | .{{item.name}}
17 |
18 |
19 |
20 | {{item.author == null?'':item.author}}
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | 月推榜
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | {{index + 1}}
39 |
40 |
41 | .{{item.name}}
42 |
43 |
44 |
45 | {{item.author == null?'':item.author}}
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/pages/rankList/rankList.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | page {
3 | background: #F6F6F6;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: flex-start;
7 | position: relative;
8 | }
9 | .main{
10 | padding: 0rpx;
11 | }
12 | .show{
13 | display: block;
14 | }
15 | .hide{
16 | display: none;
17 | }
18 | .tab-content-recommend,
19 | .tab-content-hot{
20 | max-width: 750rpx;
21 | height: 50rpx;
22 | padding: 20rpx;
23 | background: #fff;
24 | border-bottom: 2rpx solid rgb(223, 220, 220);
25 | }
26 | .rankList-title-week{
27 | background-color: #F6F6F6;
28 | font-size: 34rpx;
29 | position: fixed;
30 | height: 65rpx;
31 | line-height: 65rpx;
32 | padding: 10rpx;
33 | width: 100%;
34 | box-sizing: border-box;
35 | vertical-align: middle;
36 | }
37 | .rankList-content-week{
38 | padding-top: 85rpx;
39 | }
40 | .rankList-content-month{
41 | padding-top: 15rpx;
42 | }
43 | .rankList-title-month{
44 | background-color: #F6F6F6;
45 | font-size: 34rpx;
46 | height: 65rpx;
47 | line-height: 65rpx;
48 | width: 100%;
49 | padding: 10rpx;
50 | box-sizing: border-box;
51 | }
52 | .rankList-title-image{
53 | width: 35rpx;
54 | height: 35rpx;
55 | }
56 | .recommend-book-left{
57 | display: inline-block;
58 | }
59 | .recommend-book-number{
60 | display: inline-block;
61 | }
62 | .recommend-book-name{
63 | display: inline-block;
64 | }
65 | .recommend-book-name-hot{
66 | color: #ff8862;
67 | }
68 | .recommend-book-author{
69 | float: right;
70 | font-size: 25rpx;
71 | color: rgb(201, 196, 196);
72 | }
73 | .focus-title,
74 | .recommend-title{
75 | font-size: 30rpx;
76 | margin: 10rpx 0;
77 | overflow:hidden;
78 | white-space:nowrap;
79 | text-overflow:ellipsis;
80 | }
81 | .focus-content,
82 | .recommend-content{
83 | max-width: 700rpx;
84 | display: -webkit-box;
85 | word-break: break-all;
86 | text-overflow: ellipsis;
87 | font-size: 28rpx;
88 | overflow: hidden;
89 | -webkit-box-orient: vertical;
90 | -webkit-line-clamp:2;
91 | color: #666;
92 | line-height: 1.6;
93 | }
94 | .focus-footer,
95 | .recommend-footer,
96 | .hot-footer-text{
97 | margin: 15rpx 0;
98 | color: #999;
99 | font-size: 26rpx;
100 | }
101 | .to-recommend-img{
102 | width: 200rpx;
103 | height: 200rpx;
104 | display: block;
105 | margin: 50rpx auto;
106 | }
107 | .to-recommend-title{
108 | font-size: 44rpx;
109 | color: #cdcdcd;
110 | font-weight: 500;
111 | text-align: center;
112 | }
113 | .to-recommend-tip{
114 | color: #1E8AE8;
115 | font-size: 32rpx;
116 | text-align: center;
117 | margin: 20rpx;
118 | }
119 | .load-more{
120 | color: #cdcdcd;
121 | text-align: center;
122 | margin: 15rpx 0;
123 | }
124 | .is-loading{
125 | width: 25rpx;
126 | height: 25rpx;
127 | margin-right: 10rpx;
128 | }
129 | .tab-content-hot{
130 | height: 150rpx;
131 | margin-bottom: 2rpx;
132 | }
133 | .hot-index,
134 | .hot-title{
135 | display: inline-block;
136 | vertical-align: top;
137 | }
138 | .hot-index,
139 | .hot-title{
140 | font-size: 34rpx;
141 | }
142 | .hot-index{
143 | width: 50rpx;
144 | color: #E6DA7A;
145 | }
146 | .hot-index-hot{
147 | color: orangered;
148 | }
149 | .hot-title{
150 | max-width: 470rpx;
151 | display: -webkit-inline-box;
152 | word-break: break-all;
153 | text-overflow: ellipsis;
154 | overflow: hidden;
155 | -webkit-box-orient: vertical;
156 | -webkit-line-clamp:2;
157 | line-height: 1.6;
158 | margin-right: 20rpx;
159 | margin-left: 10rpx;
160 | }
161 | .hot-image{
162 | width: 150rpx;
163 | height: 100rpx;
164 | border-radius: 10rpx;
165 | }
166 | .hot-footer-text{
167 | margin-left: 60rpx;
168 | }
--------------------------------------------------------------------------------
/pages/searchPage/searchPage.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js')
2 |
3 | Page({
4 | data: {
5 | searchValue: '',
6 | isFocus: true,
7 | resultList: []
8 | },
9 | doSearch:function(){
10 | var that = this;
11 | if(that.data.searchValue){
12 | var url = '/m/search/' + that.data.searchValue;
13 | util.http('GET', url , {}, (response) => {
14 | if (response.errMsg) {
15 | util.showModel(response.errMsg);
16 | } else {
17 | that.setData({
18 | resultList: response || []
19 | })
20 | }
21 | })
22 | }else{
23 | that.setData({
24 | resultList: []
25 | })
26 | }
27 | },
28 | bindKeyInput: function(e) {
29 | this.setData({
30 | searchValue: e.detail.value
31 | })
32 | this.doSearch();
33 | },
34 | setNavigationBarTitleText:function(){
35 | wx.setNavigationBarTitle({
36 | title: '搜索'
37 | })
38 | },
39 | goBookDetail(e){
40 | wx.navigateTo({
41 | url: '../../pages/bookDetail/bookDetail?id=' + e.currentTarget.dataset.id
42 | })
43 | },
44 | onPullDownRefresh: function(){
45 | wx.stopPullDownRefresh();
46 | },
47 | onReady: function() {
48 | this.setNavigationBarTitleText();
49 | }
50 | })
--------------------------------------------------------------------------------
/pages/searchPage/searchPage.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | {{item.name}}
15 | {{item.author}}
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/searchPage/searchPage.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background: #F6F6F6;
3 | display: flex;
4 | flex-direction: column;
5 | justify-content: flex-start;
6 | position: relative;
7 | padding-bottom: 40rpx;
8 | }
9 | .search-page-wrapper{
10 | width: 750rpx;
11 | height: 60rpx;
12 | line-height: 60rpx;
13 | padding: 15rpx;
14 | background: #ff8862;
15 | position: fixed;
16 | top: 0;
17 | left: 0;
18 | z-index: 99;
19 | text-align: center;
20 | }
21 | .search-page-text{
22 | width: 650rpx;
23 | font-size: 35rpx;
24 | display: inline-block;
25 | height: 60rpx;
26 | line-height: 60rpx;
27 | background-color: #fff;
28 | border-radius: 10rpx;
29 | text-align: left;
30 | padding-left: 10rpx;
31 | }
32 | .search-page-button{
33 | height: 60rpx;
34 | line-height: 60rpx;
35 | font-size: 35rpx;
36 | display: inline-block;
37 | color: #fff;
38 | padding-left: 15rpx;
39 | }
40 | .search-page-button-icon{
41 | width: 40rpx;
42 | height: 40rpx;
43 | display: inline-block;
44 | vertical-align: middle;
45 | }
46 | .search-page-item{
47 | border-bottom: 2rpx solid rgb(163, 160, 160);
48 | background-color: #fff;
49 | padding: 30rpx;
50 | box-sizing: border-box;
51 | }
52 | .search-page-item-name{
53 | float: left;
54 | font-size: 35rpx;
55 | }
56 | .search-page-item-author{
57 | float: right;
58 | font-size: 30rpx;
59 | color: rgb(158, 157, 157);
60 | }
61 | .search-page-item-clear{
62 | clear: both;
63 | }
64 | .search-page-result{
65 | padding-top: 90rpx;
66 | }
--------------------------------------------------------------------------------
/pages/userCenter/userCenter.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | userInfo: {},
4 | isLogin: false,
5 | isInVipTime: false,
6 | userCenterList: [],
7 | auth: '',
8 | theme: 'light',
9 | vipTime: ''
10 | },
11 | getUserInfo: function() {
12 | var that = this;
13 | wx.getStorage({
14 | key: 'userInfo',
15 | success (res) {
16 | var nowTime = new Date().getTime();
17 | if(res.data.expiration){
18 | that.setData({
19 | vipTime: that.formatDate(res.data.expiration)
20 | });
21 | }else{
22 | that.setData({
23 | vipTime: ''
24 | });
25 | }
26 | if(res.data.expiration && res.data.expiration > nowTime){
27 | that.setData({
28 | isInVipTime: true
29 | });
30 | }else{
31 | that.setData({
32 | isInVipTime: false
33 | });
34 | }
35 | console.log(res.data);
36 | that.setData({
37 | userInfo: res.data,
38 | isLogin: true
39 | });
40 | },
41 | fail (error) {
42 | that.setData({
43 | userInfo: {},
44 | isLogin: false
45 | });
46 | }
47 | });
48 | wx.getStorage({
49 | key: 'auth',
50 | success (res) {
51 | that.setData({
52 | auth: res.data || ''
53 | });
54 | },
55 | fail (error) {
56 | that.setData({
57 | userInfo: {},
58 | isLogin: false
59 | });
60 | }
61 | });
62 | },
63 | formatDate: function(time){
64 | var date = new Date(time);
65 | var y = 1900+date.getYear();
66 | var m = "0"+(date.getMonth()+1);
67 | var d = "0"+date.getDate();
68 | return y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length);
69 | },
70 | goUserInfo(e){
71 | wx.navigateTo({
72 | url: '../../pages/userInfo/userInfo?type=' + e.currentTarget.dataset.type + '&isInVipTime=' + this.data.isInVipTime
73 | })
74 | },
75 | setNavigationBarTitleText:function(){
76 | wx.setNavigationBarTitle({
77 | title: '我'
78 | })
79 | },
80 | onPullDownRefresh: function(){
81 | wx.stopPullDownRefresh();
82 | },
83 | onShow: function(){
84 | // wx.clearStorage();
85 | this.getUserInfo();
86 | },
87 | onLoad: function(){
88 | // this.getUserInfo();
89 | },
90 | onReady: function() {
91 | this.setNavigationBarTitleText();
92 | }
93 | })
--------------------------------------------------------------------------------
/pages/userCenter/userCenter.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{isLogin ? userInfo.nickName : ''}}
8 |
9 |
10 |
11 |
12 |
13 | {{userInfo.username}}
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 点击登录
22 |
23 |
24 |
25 |
26 |
27 |
28 | 我的会员
29 | {{vipTime?vipTime + '到期' : '开通会员'}}
30 |
31 |
32 |
33 |
34 | 我的收藏
35 |
36 |
37 |
38 |
39 | 推送记录
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
54 |
55 |
56 | 关于我们
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/pages/userCenter/userCenter.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background: #F6F6F6;
3 | display: flex;
4 | flex-direction: column;
5 | justify-content: flex-start;
6 | position: relative;
7 | padding-bottom: 40rpx;
8 | }
9 | .userinfo {
10 | margin-top: 40rpx;
11 | height: 140rpx;
12 | width: 100%;
13 | background: #FFF;
14 | border: 2rpx solid rgba(0, 0, 0, .1);
15 | border-left: none;
16 | border-right: none;
17 | display: flex;
18 | flex-direction: row;
19 | align-items: center;
20 | transition: all 300ms ease;
21 | }
22 | .userinfo-avatar {
23 | width: 100rpx;
24 | height: 100rpx;
25 | margin: 20rpx;
26 | margin-right: 40rpx;
27 | border-radius: 50%;
28 | margin-left: 30rpx;
29 | }
30 | .userinfo-nickname {
31 | font-size: 32rpx;
32 | color: #323233;
33 | display: inline-block;
34 | }
35 | .userinfo-member{
36 | display: inline-block;
37 | }
38 | .userinfo-vip-image{
39 | width: 80rpx;
40 | height: 55rpx;
41 | margin-bottom: -15rpx;
42 | }
43 | .userinfo-tip{
44 | color: #cdcdcd;
45 | font-size: 24rpx;
46 | }
47 | .userinfo-clickLogin{
48 | color: #ff8862;
49 | height: 114rpx;
50 | line-height: 114rpx;
51 | }
52 | .userinfo-info{
53 | position: relative;
54 | width: 600rpx;
55 | }
56 | .userinfo-login{
57 | height: 114rpx;
58 | line-height: 114rpx;
59 | width: 600rpx;
60 | position: relative;
61 | }
62 | .user-list{
63 | width: 750rpx;
64 | margin-top: 40rpx;
65 | text-align: left;
66 | border: 2rpx solid rgba(0, 0, 0, .1);
67 | border-left: none;
68 | border-right: none;
69 | background: #FFF;
70 | }
71 | .user-list-item{
72 | max-width: 750rpx;
73 | position: relative;
74 | font-size: 38rpx;
75 | }
76 | .user-list-icon{
77 | width: 50rpx;
78 | height: 50rpx;
79 | display: inline-block;
80 | vertical-align: middle;
81 | margin: 0 20rpx;
82 | border-radius: 10rpx;
83 | }
84 | .userinfo-avatar-more{
85 | width: 40rpx;
86 | height: 40rpx;
87 | position: absolute;
88 | right: 20rpx;
89 | bottom: 35rpx;
90 | }
91 | .user-list-vipTime{
92 | color: #cdcdcd;
93 | position: absolute;
94 | top: 20rpx;
95 | right: 77rpx;
96 | font-size: 30rpx;
97 | }
98 | .user-list-more{
99 | width: 40rpx;
100 | height: 40rpx;
101 | position: absolute;
102 | top: 20rpx;
103 | right: 20rpx;
104 | }
105 | .user-list-title{
106 | font-size: 35rpx;
107 | color: #323233;
108 | display: inline-block;
109 | padding: 20rpx 0 20rpx 25rpx;
110 | width: 100%;
111 | border-bottom: 1rpx solid #ddd;
112 | box-sizing: border-box;
113 | }
--------------------------------------------------------------------------------
/pages/userInfo/userInfo.js:
--------------------------------------------------------------------------------
1 |
2 | var util = require('../../utils/util.js')
3 |
4 | Page({
5 | data: {
6 | userInfo: {},
7 | logged: false,
8 | isPassword: true,
9 | userInfoType: '未登录',
10 | defaultSize: 'default',
11 | primarySize: 'default',
12 | warnSize: 'default',
13 | disabled: false,
14 | plain: false,
15 | loading: false,
16 | typeName: '',
17 | selectName: '1个月',
18 | colletBookList: [],
19 | bookActivityUrl: 'https://mp.weixin.qq.com/s?__biz=MzAxOTUzNTcyMg==&mid=2648503562&idx=2&sn=470aa293bd37e7ac1dc6c8dd2b02a36b&chksm=83edd70fb49a5e198e75dbca2f157179415b97a40d2d7c42b44550cf1e8a91374cf3218b3b9b&mpshare=1&scene=1&srcid=0222paEmfy4wI1I8f82aw4r3#rd',
20 | useHelpUrl: 'https://jisihui.com/user/notice'
21 | },
22 | bindKeyInputMail: function(e) {
23 | this.setData({
24 | inputMail: e.detail.value
25 | })
26 | },
27 | bindKeyInputPassword: function(e) {
28 | this.setData({
29 | inputPassword: e.detail.value
30 | })
31 | },
32 | doLogin: function () {
33 | var that = this;
34 | var url = '/m/login';
35 | var data = {
36 | username: this.data.inputMail,
37 | password: this.data.inputPassword
38 | };
39 | var header = "application/x-www-form-urlencoded";
40 | util.http('POST', url, data, (response) => {
41 | if(response.data) {
42 | wx.showToast({
43 | title: response.data.msg,
44 | icon: 'none',
45 | duration: 2000
46 | })
47 | } else {
48 |
49 | wx.showToast({
50 | title: '登录成功',
51 | icon: 'none',
52 | duration: 2000
53 | })
54 | that.setData({
55 | auth: response.msg
56 | })
57 | wx.setStorage({
58 | key: 'auth',
59 | data: response.msg
60 | });
61 | that.doGetUserInfo();
62 | }
63 |
64 | }, header)
65 | },
66 | doGetUserInfo: function () {
67 | var that = this;
68 | var url = '/m/auth/user';
69 | var header = "application/json";
70 | util.http('POST', url, {}, (response) => {
71 | if(response.id) {
72 | that.setData({
73 | userInfo: response
74 | })
75 | wx.setStorage({
76 | key: 'userInfo',
77 | data: response
78 | });
79 | that.goUserCenter();
80 | } else {
81 | wx.showToast({
82 | title: response.data.msg,
83 | icon: 'none',
84 | duration: 2000
85 | })
86 | }
87 |
88 | },'',that.data.auth)
89 | },
90 | doLogout: function(){
91 | wx.removeStorageSync('userInfo');
92 | wx.removeStorageSync('auth');
93 | this.goUserCenter();
94 | },
95 | getUserInfo: function() {
96 | var that = this;
97 | wx.getStorage({
98 | key: 'userInfo',
99 | success (res) {
100 | var nowTime = new Date().getTime();
101 | if(res.data.expiration && res.data.expiration > nowTime){
102 | that.setData({
103 | isInVipTime: true
104 | });
105 | }else{
106 | that.setData({
107 | isInVipTime: false
108 | });
109 | }
110 |
111 | that.setData({
112 | userInfo: res.data,
113 | isLogin: true
114 | });
115 | },
116 | fail (error) {
117 | that.setData({
118 | typeName: '登录'
119 | });
120 | that.setNavigationBarTitleText('登录');
121 | }
122 | });
123 | wx.getStorage({
124 | key: 'auth',
125 | success (res) {
126 | that.setData({
127 | auth: res.data || ''
128 | });
129 | if(that.data.typeName == '收藏'){
130 | that.getUserCollect();
131 | }
132 | if(that.data.typeName == '推送记录'){
133 | that.getPushHistory();
134 | }
135 | },
136 | fail (error) {
137 | that.setData({
138 | typeName: '登录'
139 | })
140 | that.setNavigationBarTitleText('登录');
141 | }
142 | });
143 | },
144 | vipButton: function(){
145 | wx.showToast({
146 | title: '请在 APP 上完成',
147 | icon: 'none',
148 | duration: 1000
149 | })
150 | },
151 | getUserCollect: function () {
152 | wx.showLoading({
153 | title: '加载中'
154 | });
155 | var that = this;
156 | var url = '/m/auth/collect';
157 | util.http('POST', url, {}, (response) => {
158 | if(Array.isArray(response)){
159 | var array = response;
160 | for (let i = 0; i < array.length; i++) {
161 | array[i].formatTime = array[i].time ? that.timeFormat(array[i].time) : '';
162 | }
163 | that.setData({
164 | colletBookList: array
165 | });
166 | setTimeout(function(){
167 | wx.hideLoading()
168 | },500)
169 | }else if(response.data.msg == '未登录'){
170 | this.setData({
171 | typeName: '登录'
172 | })
173 | this.setNavigationBarTitleText('登录');
174 | }
175 | },'',that.data.auth)
176 | },
177 | getPushHistory: function () {
178 | wx.showLoading({
179 | title: '加载中'
180 | });
181 |
182 | var that = this;
183 | var url = '/m/auth/push';
184 | util.http('POST', url, {}, (response) => {
185 | if(Array.isArray(response)){
186 | var array = response;
187 | for (let i = 0; i < array.length; i++) {
188 | array[i].formatTime = array[i].time ? that.timeFormat(array[i].time) : '';
189 | }
190 | that.setData({
191 | colletBookList: array
192 | });
193 | setTimeout(function(){
194 | wx.hideLoading()
195 | },1000)
196 | }else if(response.data.msg == '未登录'){
197 | this.setData({
198 | typeName: '登录'
199 | })
200 | this.setNavigationBarTitleText('登录');
201 | }
202 | },'',that.data.auth)
203 | },
204 | clickOne: function(e){
205 | this.setData({
206 | selectName: e.currentTarget.dataset.type
207 | })
208 | },
209 | timeFormat: function(timestamp) {
210 | var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
211 | var Y = date.getFullYear() + '-';
212 | var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
213 | var D = date.getDate() + ' ';
214 | var h = date.getHours() + ':';
215 | var m = date.getMinutes() + ':';
216 | var s = date.getSeconds();
217 | return Y+M+D+h+m+s;
218 | },
219 | setNavigationBarTitleText: function (name) {
220 | wx.setNavigationBarTitle({
221 | title: name
222 | })
223 | },
224 | goUserCenter: function(){
225 | wx.switchTab({
226 | url: '../../pages/userCenter/userCenter'
227 | })
228 | },
229 | goBookDetail(e){
230 | wx.navigateTo({
231 | url: '../../pages/bookDetail/bookDetail?id=' + e.currentTarget.dataset.id
232 | })
233 | },
234 | goRegister: function(){
235 | wx.showToast({
236 | title: '请在网站上注册',
237 | icon: 'none',
238 | duration: 1000
239 | })
240 | },
241 | goForget: function(){
242 | wx.showToast({
243 | title: '请在网站上找回密码',
244 | icon: 'none',
245 | duration: 1000
246 | })
247 | },
248 | onPullDownRefresh: function () {
249 | if(this.data.typeName == '推送记录'){
250 | this.getPushHistory();
251 | };
252 | if(this.data.typeName == '收藏'){
253 | this.getUserCollect();
254 | };
255 | wx.stopPullDownRefresh();
256 | },
257 | onLoad: function (option) {
258 | var type = option.type || '登录';
259 | this.setNavigationBarTitleText(option.type);
260 | this.setData({
261 | typeName: option.type
262 | })
263 | },
264 | onShow: function(){
265 | if(this.data.typeName != '关于我们'){
266 | this.getUserInfo();
267 | }
268 | }
269 | })
--------------------------------------------------------------------------------
/pages/userInfo/userInfo.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
9 |
10 | 新用户注册 >
11 | 忘记密码?
12 |
13 |
14 |
15 | {{userInfo.nickName ? userInfo.nickName : ''}}
16 | 开通会员可享更多推送数量哦~
17 |
18 |
19 |
20 |
21 | 1个月
22 | 6元
23 |
24 |
25 |
26 | 6个月
27 | 32元
28 | 原价36元
29 |
30 |
31 |
32 | 12个月
33 | 60元
34 | 原价72元
35 |
36 |
37 |
38 |
39 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | {{item.book.name}}
49 | {{item.book.author}}
50 |
51 |
52 | {{item.book.tags || '暂无标签'}}
53 |
54 |
55 | {{item.formatTime}}
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | 官方QQ群
76 | 246388544
77 |
78 |
79 | 微信公众号
80 | jisihuidushu
81 |
82 |
83 | 意见反馈
84 | jisihui@yeah.net
85 |
86 |
87 | 官网
88 | https://jisihui.com
89 |
90 |
91 |
92 | Copyright.集思会
93 |
94 |
95 |
96 |
97 |
98 | 昵称:
99 | {{userInfo.nickName}}
100 |
101 |
102 | 账号:
103 | {{userInfo.username}}
104 |
105 |
106 | 推送邮箱:
107 | {{userInfo.pushMail}}
108 |
109 |
110 |
111 |
113 |
--------------------------------------------------------------------------------
/pages/userInfo/userInfo.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background: #F6F6F6;
3 | display: flex;
4 | flex-direction: column;
5 | justify-content: flex-start;
6 | position: relative;
7 | padding-bottom: 40rpx;
8 | height: 100%;
9 | }
10 | .userInfo{
11 | margin-left: 20rpx;
12 | margin-right: 20rpx;
13 | margin-top: 50rpx;
14 | }
15 | .inputInfo{
16 | padding: 5rpx;
17 | }
18 | .userInfo-write{
19 | margin-bottom: 30rpx;
20 | background-color: #fff;
21 | }
22 | .userInfo-input{
23 | padding: 20rpx;
24 | font-size: 30rpx;
25 | }
26 | .userInfo-register{
27 | color: #9e9b9b;
28 | font-size: 30rpx;
29 | margin-top: 30rpx;
30 | text-align: right;
31 | /* display: inline-block; */
32 | float: right;
33 | }
34 | .userInfo-forget{
35 | color: #ff8862;
36 | font-size: 30rpx;
37 | margin-top: 30rpx;
38 | /* display: inline-block; */
39 | float: left;
40 | }
41 | .userInfo-input-name{
42 | border-bottom: 2rpx solid #F6F6F6;
43 | }
44 | .login-button{
45 | background-color: #ff8862;
46 | color: #fff;
47 | }
48 | .vip-button{
49 | background-color: #ff8862;
50 | color: #fff;
51 | width: 600rpx;
52 | box-shadow: 5rpx 5rpx 5rpx 5rpx #ccc;
53 | }
54 | .userInfo-vipCenter-username{
55 | text-align: center;
56 | margin-top: 40rpx;
57 | }
58 | .userInfo-vipCenter-remind{
59 | color: #ccc;
60 | font-size: 28rpx;
61 | text-align: center;
62 | margin-top: 20rpx;
63 | }
64 | .userInfo-vipCenter-tequan{
65 | width: 100%;
66 | height: 180rpx;
67 | width: 750rpx;
68 | margin-top: 30rpx;
69 | }
70 | .userInfo-vipCenter-vipTime{
71 | width: 450rpx;
72 | display: inline-block;
73 | }
74 | .userInfo-vipCenter-price{
75 | color: #ff8862;
76 | }
77 | .userInfo-vipCenter-priceContainer{
78 | background-color: #fff;
79 | margin-bottom: 80rpx;
80 | }
81 | .userInfo-vipCenter-priceContainerListOne{
82 | border-bottom: 2rpx solid #ccc;
83 | padding: 20rpx;
84 | }
85 | .userInfo-vipCenter-oldPrice{
86 | margin-left: 10rpx;
87 | text-decoration:line-through;
88 | font-size: 25rpx;
89 | color: #ccc;
90 | }
91 | .userInfo-vipCenter-selected{
92 | width: 25rpx;
93 | height: 25rpx;
94 | float: right;
95 | }
96 | .userInfo-collect{
97 | background-color: #fff;
98 | }
99 | .userInfo-collect-listOne{
100 | padding: 20rpx;
101 | border-bottom: 2rpx solid #ccc;
102 | }
103 | .userInfo-collect-listOne-title{
104 | margin-bottom: 20rpx;
105 | }
106 | .userInfo-collect-listOne-author{
107 | float: right;
108 | font-size: 30rpx;
109 | color: #ccc;
110 | text-overflow: ellipsis;
111 | overflow: hidden;
112 | white-space:nowrap;
113 | width: 200rpx;
114 | text-align: right;
115 | }
116 | .userInfo-collect-listOne-tags{
117 | color: rgb(136, 135, 135);
118 | font-size: 30rpx;
119 | margin-bottom: 20rpx;
120 | }
121 | .userInfo-collect-listOne-time{
122 | color: rgb(136, 135, 135);
123 | font-size: 25rpx;
124 | }
125 | .userCenter-about-title{
126 | text-align: center;
127 | margin-top: 50rpx;
128 | margin-bottom: 30rpx;
129 | }
130 | .userCenter-about-logo{
131 | width: 100rpx;
132 | height: 100rpx;
133 | }
134 | .userCenter-about-offical{
135 | background-color: #fff;
136 | }
137 | .userCenter-about-listOne{
138 | border-bottom: 2rpx solid #ccc;
139 | padding: 20rpx;
140 | }
141 | .userCenter-about-listOne-key{
142 |
143 | }
144 | .userCenter-about-listOne-value{
145 | color: #696361;
146 | font-size: 30rpx;
147 | float: right;
148 | }
149 | .userCenter-about-bottom{
150 | color: #696361;
151 | position: absolute;
152 | text-align: center;
153 | bottom: 100rpx;
154 | font-size: 30rpx;
155 | /* display: inline-block; */
156 | width: 750rpx;
157 | }
158 | .userCenter-account{
159 | background-color: #fff;
160 | width: 700rpx;
161 | margin: 0 auto;
162 | border-radius: 15rpx;
163 | margin-bottom: 30rpx;
164 | margin-top: 20rpx;
165 | }
166 | .userCenter-account-listOne{
167 | padding: 20rpx;
168 | border-bottom: 2rpx solid #ccc;
169 | font-size: 30rpx;
170 | color: #696361;
171 | }
172 | .logout-button{
173 | width: 600rpx;
174 | background-color: #ff8862;
175 | color: #fff;
176 | }
177 |
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件。",
3 | "setting": {
4 | "urlCheck": true,
5 | "es6": true,
6 | "postcss": true,
7 | "minified": true,
8 | "newFeature": true
9 | },
10 | "compileType": "miniprogram",
11 | "libVersion": "1.9.1",
12 | "appid": "wx567d71d198e94f0d",
13 | "projectname": "jisihui-lite",
14 | "condition": {
15 | "search": {
16 | "current": -1,
17 | "list": []
18 | },
19 | "conversation": {
20 | "current": -1,
21 | "list": []
22 | },
23 | "game": {
24 | "currentL": -1,
25 | "list": []
26 | },
27 | "miniprogram": {
28 | "current": -1,
29 | "list": []
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/template/searchMask.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 取消
7 |
8 |
9 | 搜索历史
10 |
11 |
12 | {{item}}
13 |
14 |
15 |
16 |
17 | 清空搜索历史
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/utils/api.config.js:
--------------------------------------------------------------------------------
1 | var base = 'https://www.easy-mock.com/mock/5a39d3d2717d4953ed48bd47/weChatApp/';
2 | var url = 'https://www.easy-mock.com/mock/5a6a944f396ee930b9c4b8bc/jisihui';
3 | var officalUrl = 'https://jisihui.com';
4 | var api = {
5 | officalUrl: 'https://jisihui.com',
6 | indexListApi: {
7 | development: officalUrl + '/app/getIndexInfo'
8 | },
9 | weekAndMonth: {
10 | development: officalUrl + '/m /weekAndMonth'
11 | },
12 | bookDetailApi: {
13 | development: officalUrl + '/book'
14 | },
15 | bookCategoryApi: {
16 | development: url + '/m/good/c/1/1'
17 | },
18 | bookListApi: {
19 | development: url + '/bookList/bookList'
20 | },
21 | }
22 |
23 | module.exports = api;
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | //全局公共函数
2 | var development = 'development';
3 | var api = require('./api.config.js');
4 |
5 | const formatTime = date => {
6 | const year = date.getFullYear()
7 | const month = date.getMonth() + 1
8 | const day = date.getDate()
9 | const hour = date.getHours()
10 | const minute = date.getMinutes()
11 | const second = date.getSeconds()
12 |
13 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
14 | }
15 |
16 | const formatNumber = n => {
17 | n = n.toString()
18 | return n[1] ? n : '0' + n
19 | }
20 |
21 | // 显示繁忙提示
22 | var showBusy = text => wx.showToast({
23 | title: text,
24 | icon: 'loading',
25 | duration: 10000
26 | })
27 |
28 | // 显示成功提示
29 | var showSuccess = text => wx.showToast({
30 | title: text,
31 | icon: 'success'
32 | })
33 |
34 | // 显示失败提示
35 | var showModel = (title, content) => {
36 | wx.hideToast();
37 |
38 | wx.showModal({
39 | title,
40 | content: JSON.stringify(content),
41 | showCancel: false
42 | })
43 | }
44 |
45 | // 请求
46 | var http = (method, url, data, fun, header, auth) => {
47 | wx.request({
48 | method: method,
49 | // url: api[url][development],
50 | url: api['officalUrl'] + url,
51 | data: data,
52 | header: {
53 | 'content-type': header || 'application/json', // 默认值
54 | 'auth': auth || ''
55 | },
56 | success: function (response) {
57 | console.log(response.errMsg)
58 | response.statusCode === 200 ? fun(response.data) : fun(response);
59 | },
60 | fail: function (response) {
61 | console.log(response.statusCode, response.errMsg)
62 | }
63 | })
64 | }
65 |
66 | module.exports = { formatTime, showBusy, showSuccess, showModel, http }
67 |
--------------------------------------------------------------------------------