├── .gitignore
├── LICENSE
├── README.md
├── miniProgram
├── .gitignore
├── app.js
├── app.json
├── app.wxss
├── image
│ ├── icon
│ │ ├── index-select.png
│ │ ├── index.png
│ │ ├── money.png
│ │ ├── password.png
│ │ ├── right-arrow.png
│ │ ├── user-center-select.png
│ │ ├── user-center.png
│ │ └── user.png
│ └── page
│ │ ├── buy.png
│ │ ├── index_bg.jpg
│ │ ├── sell.png
│ │ ├── 头像.JPG
│ │ ├── 封面.jpg
│ │ └── 背景1.gif
├── pages
│ ├── _center
│ │ ├── _center.js
│ │ ├── _center.json
│ │ ├── _center.wxml
│ │ └── _center.wxss
│ ├── _public
│ │ ├── _public.js
│ │ ├── _public.json
│ │ ├── _public.wxml
│ │ └── _public.wxss
│ ├── center
│ │ ├── center.js
│ │ ├── center.json
│ │ ├── center.wxml
│ │ └── center.wxss
│ ├── details
│ │ ├── details.js
│ │ ├── details.json
│ │ ├── details.wxml
│ │ └── details.wxss
│ ├── help
│ │ ├── help.js
│ │ ├── help.json
│ │ ├── help.wxml
│ │ └── help.wxss
│ ├── index
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── login
│ │ ├── login.js
│ │ ├── login.json
│ │ ├── login.wxml
│ │ └── login.wxss
│ ├── messageBoard
│ │ ├── messageBoard.js
│ │ ├── messageBoard.json
│ │ ├── messageBoard.wxml
│ │ └── messageBoard.wxss
│ ├── person
│ │ ├── person.js
│ │ ├── person.json
│ │ ├── person.wxml
│ │ └── person.wxss
│ ├── public
│ │ ├── public.js
│ │ ├── public.json
│ │ ├── public.wxml
│ │ └── public.wxss
│ ├── register
│ │ ├── register.js
│ │ ├── register.json
│ │ ├── register.wxml
│ │ └── register.wxss
│ ├── revise
│ │ ├── revise.js
│ │ ├── revise.json
│ │ ├── revise.wxml
│ │ └── revise.wxss
│ ├── revisebook
│ │ ├── revisebook.js
│ │ ├── revisebook.json
│ │ ├── revisebook.wxml
│ │ └── revisebook.wxss
│ ├── sell
│ │ ├── sell.js
│ │ ├── sell.json
│ │ ├── sell.wxml
│ │ └── sell.wxss
│ ├── updatacenter
│ │ ├── updatacenter.js
│ │ ├── updatacenter.json
│ │ ├── updatacenter.wxml
│ │ └── updatacenter.wxss
│ └── user
│ │ ├── user.js
│ │ ├── user.json
│ │ ├── user.wxml
│ │ └── user.wxss
├── project.config.json
├── sitemap.json
└── utils
│ └── util.js
└── server
├── .gitignore
├── .mvn
└── wrapper
│ ├── MavenWrapperDownloader.java
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
├── main
├── java
│ └── com
│ │ └── ouc
│ │ └── usedbook
│ │ ├── UsedbookApplication.java
│ │ ├── config
│ │ └── SwaggerConfig.java
│ │ ├── controller
│ │ ├── CommentController.java
│ │ ├── UsedbookController.java
│ │ └── UserController.java
│ │ ├── dto
│ │ ├── CommentDTO.java
│ │ ├── CommentViewDTO.java
│ │ ├── DeleteDTO.java
│ │ ├── LoginDTO.java
│ │ ├── RegisterDTO.java
│ │ └── UsedbookDTO.java
│ │ ├── entity
│ │ ├── Comment.java
│ │ ├── Usedbook.java
│ │ └── User.java
│ │ ├── repository
│ │ ├── CommentRepository.java
│ │ ├── UsedbookRepository.java
│ │ └── UserRepository.java
│ │ ├── service
│ │ ├── CommentService.java
│ │ ├── UsedbookService.java
│ │ └── UserService.java
│ │ └── util
│ │ └── Response.java
└── resources
│ ├── application.properties
│ └── static
│ └── cover
│ ├── cyuyan.jpg
│ ├── czxt.jpg
│ ├── rjjh.jpg
│ └── shjk.jpg
└── test
└── java
└── com
└── ouc
└── usedbook
├── UsedbookApplicationTests.java
└── repository
└── UserRepositoryTest.java
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.nar
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23 | hs_err_pid*
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 sunshine2285
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # used-books-market-miniProgram
2 | 基于微信小程序的二手书交易市场
3 |
--------------------------------------------------------------------------------
/miniProgram/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**
5 | !**/src/test/**
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 |
30 | ### VS Code ###
31 | .vscode/
32 |
--------------------------------------------------------------------------------
/miniProgram/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 | // 展示本地存储能力
5 | var logs = wx.getStorageSync('logs') || []
6 | logs.unshift(Date.now())
7 | wx.setStorageSync('logs', logs)
8 |
9 | // 登录
10 | wx.login({
11 | success: res => {
12 | // 发送 res.code 到后台换取 openId, sessionKey, unionId
13 | }
14 | })
15 | // 获取用户信息
16 | wx.getSetting({
17 | success: res => {
18 | if (res.authSetting['scope.userInfo']) {
19 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
20 | wx.getUserInfo({
21 | success: res => {
22 | // 可以将 res 发送给后台解码出 unionId
23 | this.globalData.userInfo = res.userInfo
24 |
25 | // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
26 | // 所以此处加入 callback 以防止这种情况
27 | if (this.userInfoReadyCallback) {
28 | this.userInfoReadyCallback(res)
29 | }
30 | }
31 | })
32 | }
33 | }
34 | })
35 | },
36 | globalData: {
37 | userInfo: null
38 | }
39 | })
--------------------------------------------------------------------------------
/miniProgram/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/login/login",
4 | "pages/help/help",
5 | "pages/person/person",
6 | "pages/_public/_public",
7 | "pages/register/register",
8 | "pages/index/index",
9 | "pages/center/center",
10 | "pages/messageBoard/messageBoard",
11 | "pages/details/details",
12 | "pages/revise/revise",
13 | "pages/public/public",
14 | "pages/revisebook/revisebook",
15 | "pages/updatacenter/updatacenter"
16 | ],
17 | "window": {
18 | "backgroundTextStyle": "light",
19 | "navigationBarBackgroundColor": "#fff",
20 | "navigationBarTitleText": "书香墨海",
21 | "navigationBarTextStyle": "black"
22 | },
23 | "tabBar": {
24 | "list": [
25 | {
26 | "pagePath": "pages/index/index",
27 | "text": "主页",
28 | "iconPath": "/image/icon/index.png",
29 | "selectedIconPath": "/image/icon/index-select.png"
30 | },
31 | {
32 | "pagePath": "pages/person/person",
33 | "text": "个人中心",
34 | "iconPath": "/image/icon/user-center.png",
35 | "selectedIconPath": "/image/icon/user-center-select.png"
36 | }
37 | ]
38 | },
39 | "style": "v2",
40 | "sitemapLocation": "sitemap.json"
41 | }
--------------------------------------------------------------------------------
/miniProgram/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | box-sizing: border-box;
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/miniProgram/image/icon/index-select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/icon/index-select.png
--------------------------------------------------------------------------------
/miniProgram/image/icon/index.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/icon/index.png
--------------------------------------------------------------------------------
/miniProgram/image/icon/money.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/icon/money.png
--------------------------------------------------------------------------------
/miniProgram/image/icon/password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/icon/password.png
--------------------------------------------------------------------------------
/miniProgram/image/icon/right-arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/icon/right-arrow.png
--------------------------------------------------------------------------------
/miniProgram/image/icon/user-center-select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/icon/user-center-select.png
--------------------------------------------------------------------------------
/miniProgram/image/icon/user-center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/icon/user-center.png
--------------------------------------------------------------------------------
/miniProgram/image/icon/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/icon/user.png
--------------------------------------------------------------------------------
/miniProgram/image/page/buy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/page/buy.png
--------------------------------------------------------------------------------
/miniProgram/image/page/index_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/page/index_bg.jpg
--------------------------------------------------------------------------------
/miniProgram/image/page/sell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/page/sell.png
--------------------------------------------------------------------------------
/miniProgram/image/page/头像.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/page/头像.JPG
--------------------------------------------------------------------------------
/miniProgram/image/page/封面.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/page/封面.jpg
--------------------------------------------------------------------------------
/miniProgram/image/page/背景1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/image/page/背景1.gif
--------------------------------------------------------------------------------
/miniProgram/pages/_center/_center.js:
--------------------------------------------------------------------------------
1 | // pages/center/center.js
2 | const app=getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | college: '',
10 | mail: '',
11 | major: '',
12 | password: '',
13 | tel: '',
14 | username: '',
15 | year: ''
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面加载
20 | */
21 | onLoad: function (options) {
22 | var th = this;
23 | let data = app.globalData.userInfo
24 | th.setData({
25 | college: data.college,
26 | mail: data.mail,
27 | major: data.major,
28 | password: data.password,
29 | tel: data.tel,
30 | username: data.username,
31 | year: data.year
32 | })
33 | },
34 |
35 | /**
36 | * 生命周期函数--监听页面初次渲染完成
37 | */
38 | onReady: function () {
39 |
40 | },
41 |
42 | /**
43 | * 生命周期函数--监听页面显示
44 | */
45 | onShow: function () {
46 |
47 | },
48 |
49 | /**
50 | * 生命周期函数--监听页面隐藏
51 | */
52 | onHide: function () {
53 |
54 | },
55 |
56 | /**
57 | * 生命周期函数--监听页面卸载
58 | */
59 | onUnload: function () {
60 |
61 | },
62 |
63 | /**
64 | * 页面相关事件处理函数--监听用户下拉动作
65 | */
66 | onPullDownRefresh: function () {
67 |
68 | },
69 |
70 | /**
71 | * 页面上拉触底事件的处理函数
72 | */
73 | onReachBottom: function () {
74 |
75 | },
76 |
77 | /**
78 | * 用户点击右上角分享
79 | */
80 | onShareAppMessage: function () {
81 |
82 | }
83 | })
--------------------------------------------------------------------------------
/miniProgram/pages/_center/_center.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/_center/_center.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{username}}
8 |
9 |
10 | 学院:
11 |
12 | {{college}}
13 |
14 |
15 |
16 | 专业:
17 |
18 | {{major}}
19 |
20 |
21 |
22 | 年级:
23 |
24 | {{year}}
25 |
26 |
27 |
28 | 手机号:
29 |
30 | {{tel}}
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/miniProgram/pages/_center/_center.wxss:
--------------------------------------------------------------------------------
1 | /* pages/center/center.wxss */
2 | .photo-ground{
3 | height: 175rpx;
4 | }
5 | .user-item{
6 | display: flex;
7 | align-items: center;
8 | }
9 | .username{
10 | margin-left: 80rpx;
11 | }
12 | .user-photo{
13 | width: 150rpx;
14 | height: 150rpx;
15 | margin-left: 40rpx;
16 | }
17 | .conton-item{
18 | font-size: 30rpx;
19 | color: black;
20 | margin-top: 50rpx;
21 | margin-left: 40rpx;
22 | }
23 | .conton-item>.text-boder{
24 | margin-top: 20rpx;
25 | align-items: center;
26 | font-size: 30rpx;
27 | color: gray;
28 | }
29 | .bt{
30 | margin-top: 80rpx;
31 | margin-left: 40rpx;
32 | font-size: 20rpx;
33 | display: flex;
34 | align-items: center;
35 | }
--------------------------------------------------------------------------------
/miniProgram/pages/_public/_public.js:
--------------------------------------------------------------------------------
1 | // pages/_public/_public.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/miniProgram/pages/_public/_public.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/_public/_public.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/miniProgram/pages/_public/_public.wxss:
--------------------------------------------------------------------------------
1 | /* pages/_public/_public.wxss */
2 | .cover{
3 | margin: 40rpx 40rpx;
4 | width: 200rpx;
5 | height: 200rpx;
6 | }
7 | .book-name{
8 | margin-left: 40rpx;
9 | }
10 | .book-author-pub-old{
11 | display: flex;
12 | flex-direction: column;
13 | margin-left: 80rpx;
14 | font-size: 30rpx;
15 | color: gray;
16 | }
17 | .search-v{
18 | display: flex;
19 | align-items: center;
20 | }
21 | .search{
22 | margin-left: 40rpx;
23 | border: 1rpx solid black;
24 | }
25 | .search1{
26 | font-size: 30rpx;
27 | }
28 | .book-message{
29 | display: flex;
30 | align-items: center;
31 | }
--------------------------------------------------------------------------------
/miniProgram/pages/center/center.js:
--------------------------------------------------------------------------------
1 | // pages/center/center.js
2 | const app = getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | college: '',
10 | mail: '',
11 | major: '',
12 | password: '',
13 | tel: '',
14 | username:'',
15 | year: ''
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面加载
20 | */
21 | onLoad: function (options) {
22 | var th=this;
23 | let data = app.globalData.userInfo
24 | th.setData({
25 | college: data.college,
26 | mail: data.mail,
27 | major: data.major,
28 | password: data.password,
29 | tel: data.tel,
30 | username: data.username,
31 | year: data.year
32 | })
33 | },
34 |
35 | /**
36 | * 生命周期函数--监听页面初次渲染完成
37 | */
38 | onReady: function () {
39 |
40 | },
41 |
42 | /**
43 | * 生命周期函数--监听页面显示
44 | */
45 | onShow: function () {
46 |
47 | },
48 |
49 | /**
50 | * 生命周期函数--监听页面隐藏
51 | */
52 | onHide: function () {
53 |
54 | },
55 |
56 | /**
57 | * 生命周期函数--监听页面卸载
58 | */
59 | onUnload: function () {
60 |
61 | },
62 |
63 | /**
64 | * 页面相关事件处理函数--监听用户下拉动作
65 | */
66 | onPullDownRefresh: function () {
67 |
68 | },
69 |
70 | /**
71 | * 页面上拉触底事件的处理函数
72 | */
73 | onReachBottom: function () {
74 |
75 | },
76 |
77 | /**
78 | * 用户点击右上角分享
79 | */
80 | onShareAppMessage: function () {
81 |
82 | }
83 | })
--------------------------------------------------------------------------------
/miniProgram/pages/center/center.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/center/center.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{username}}
8 |
9 |
10 | 学院:
11 |
12 | {{college}}
13 |
14 |
15 |
16 | 专业:
17 |
18 | {{major}}
19 |
20 |
21 |
22 | 年级:
23 |
24 | {{year}}
25 |
26 |
27 |
28 | 手机号:
29 |
30 | {{tel}}
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/miniProgram/pages/center/center.wxss:
--------------------------------------------------------------------------------
1 | /* pages/center/center.wxss */
2 | .photo-ground{
3 | height: 175rpx;
4 | }
5 | .user-item{
6 | display: flex;
7 | align-items: center;
8 | }
9 | .username{
10 | margin-left: 80rpx;
11 | }
12 | .user-photo{
13 | width: 150rpx;
14 | height: 150rpx;
15 | margin-left: 40rpx;
16 | }
17 | .conton-item{
18 | font-size: 30rpx;
19 | color: black;
20 | margin-top: 50rpx;
21 | margin-left: 40rpx;
22 | }
23 | .conton-item>.text-boder{
24 | margin-top: 20rpx;
25 | align-items: center;
26 | font-size: 30rpx;
27 | color: gray;
28 | }
--------------------------------------------------------------------------------
/miniProgram/pages/details/details.js:
--------------------------------------------------------------------------------
1 | // pages/details/details.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/miniProgram/pages/details/details.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/details/details.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | I am here
10 |
11 | 水产学院 海洋资源与环境
12 |
13 |
14 |
15 |
16 |
17 |
18 | C Primer Plus
19 |
20 | 作者:史蒂芬 普拉达
21 | 出版社:人民邮电出版社
22 | 新旧程度:八成新
23 | 备注:可私聊价格
24 |
25 |
26 |
27 |
28 | 售价:10元
29 |
30 |
31 |
32 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | 全部留言
41 |
50 |
--------------------------------------------------------------------------------
/miniProgram/pages/details/details.wxss:
--------------------------------------------------------------------------------
1 | /* pages/details/details.wxss */
2 | .photo-ground{
3 | height: 175rpx;
4 | }
5 | .con{
6 | display: flex;
7 | flex-direction: column;
8 | }
9 | .user-item{
10 | display: flex;
11 | align-items: center;
12 | }
13 | .username{
14 | margin-left: 40rpx;
15 | }
16 | .user-photo{
17 | width: 150rpx;
18 | height: 150rpx;
19 | margin-left: 40rpx;
20 | }
21 | .other-detils{
22 | margin-top: 20rpx;
23 | display: flex;
24 | align-items: center;
25 | margin-left: 40rpx;
26 | font-size: 25rpx;
27 | color: gray;
28 | }
29 | .right-arrow{
30 | width: 30rpx;
31 | height: 30rpx;
32 | margin-left: 100rpx;
33 | }
34 | .cover{
35 | margin: 40rpx 50rpx 50rpx 50rpx;
36 | width: 650rpx;
37 | }
38 | .book-name{
39 | margin-left: 40rpx;
40 | }
41 | .book-author-pub-old{
42 | display: flex;
43 | flex-direction: column;
44 | margin-left: 80rpx;
45 | font-size: 30rpx;
46 | color: gray;
47 | }
48 | .price{
49 | margin-left: 40rpx;
50 | font-size: 30rpx;
51 | }
52 | .Button{
53 | margin: 40rpx 40rpx;
54 | margin-top: 20rpx;
55 | display: flex;
56 | align-items: center;
57 | border-bottom: gainsboro 1rpx solid;
58 | }
59 |
60 | .message{
61 | margin-top: 20rpx;
62 | font-size: 30rpx;
63 | margin-left: 40rpx;
64 | margin-bottom: 100rpx;
65 | }
66 | .user-photo-test{
67 | height: 80rpx;
68 | width: 80rpx;
69 | }
70 | .user-item-test{
71 | margin-top: 10rpx;
72 | display: flex;
73 | flex-direction: column;
74 | }
75 | .head-photo{
76 | display: flex;
77 | align-items: center;
78 | }
79 | .Button-right > button{
80 | margin-left: 40rpx;
81 | font-size: 28rpx;
82 | }
--------------------------------------------------------------------------------
/miniProgram/pages/help/help.js:
--------------------------------------------------------------------------------
1 | // pages/help/help.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/miniProgram/pages/help/help.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/help/help.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 本小程序旨在为校园的二手书交易提供一个信息展示平台,二手书的交易不在本平台进行,需要自行在发布者的联系方式一栏进行联系。
4 |
--------------------------------------------------------------------------------
/miniProgram/pages/help/help.wxss:
--------------------------------------------------------------------------------
1 | /* pages/help/help.wxss */
2 | .center{
3 | align-content: center;
4 | }
--------------------------------------------------------------------------------
/miniProgram/pages/index/index.js:
--------------------------------------------------------------------------------
1 | // pages/index/index.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/miniProgram/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 我要买书
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | 我要卖书
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/miniProgram/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /* pages/index/index.wxss */
2 | .index-bg{
3 | width: 100%;
4 | height: 650rpx;
5 | margin-bottom: 40rpx;
6 | }
7 |
8 | .item{
9 | display: flex;
10 | justify-content: space-between;
11 | align-items: center;
12 | padding: 30rpx 40rpx;
13 | transition: ease 0.3s;
14 | }
15 |
16 | .item-hover{
17 | background-color: #f4f4f4;
18 | }
19 |
20 | .item-body{
21 | display: flex;
22 | align-items: center;
23 | }
24 |
25 | .item-icon{
26 | width: 120rpx;
27 | height: 120rpx;
28 | margin-right: 30rpx;
29 | }
30 |
31 | .right-arrow{
32 | width: 40rpx;
33 | height: 40rpx;
34 | }
35 |
36 | .subtle-bottom-border{
37 | border-bottom: rgba(225, 225, 225, 0.3) solid 1rpx;
38 | margin: 0 70rpx;
39 | }
--------------------------------------------------------------------------------
/miniProgram/pages/login/login.js:
--------------------------------------------------------------------------------
1 | // pages/login/login.js
2 | const app = getApp();
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 |
10 | },
11 |
12 | forget_pwd: function (e) {
13 | wx.showModal({
14 | title: '忘记密码',
15 | content: '请发送邮件给管理员!sxmh_OUC@163.com',
16 | showCancel: false,
17 | })
18 | },
19 | login: function (e) {
20 | let data = e.detail.value;
21 | wx.request({
22 | url: 'http://sunshine-sun.cn:8080/user/login',
23 | method: 'POST',
24 | data: {
25 | mail: data.user,
26 | password: data.password
27 | },
28 | success(res) {
29 | if (res.data.code === 200) {
30 | //保存返回的数据到全局对象
31 | app.globalData.userInfo=res.data.data;
32 | wx.showToast({
33 | title: '登录成功',
34 | icon: 'success'
35 | });
36 | //跳转页面
37 | wx.switchTab({
38 | url: '/pages/index/index',
39 | });
40 | }
41 | }
42 | })
43 | },
44 | register: function (e) {
45 | wx.navigateTo({
46 | url: '/pages/register/register',
47 | })
48 | },
49 |
50 | /**
51 | * 生命周期函数--监听页面加载
52 | */
53 | onLoad: function (options) {
54 |
55 | },
56 |
57 | /**
58 | * 生命周期函数--监听页面初次渲染完成
59 | */
60 | onReady: function () {
61 |
62 | },
63 |
64 | /**
65 | * 生命周期函数--监听页面显示
66 | */
67 | onShow: function () {
68 |
69 | },
70 |
71 | /**
72 | * 生命周期函数--监听页面隐藏
73 | */
74 | onHide: function () {
75 |
76 | },
77 |
78 | /**
79 | * 生命周期函数--监听页面卸载
80 | */
81 | onUnload: function () {
82 |
83 | },
84 |
85 | /**
86 | * 页面相关事件处理函数--监听用户下拉动作
87 | */
88 | onPullDownRefresh: function () {
89 |
90 | },
91 |
92 | /**
93 | * 页面上拉触底事件的处理函数
94 | */
95 | onReachBottom: function () {
96 |
97 | },
98 |
99 | /**
100 | * 用户点击右上角分享
101 | */
102 | onShareAppMessage: function () {
103 |
104 | }
105 | })
--------------------------------------------------------------------------------
/miniProgram/pages/login/login.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/login/login.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/miniProgram/pages/login/login.wxss:
--------------------------------------------------------------------------------
1 | /* pages/login/login.wxss */
2 | .icon {
3 | width: 40rpx;
4 | height: 40rpx;
5 | }
6 |
7 | .btn {
8 | font-size: 30rpx;
9 | font-weight: normal;
10 | }
11 |
12 | .primary-btn{
13 | margin-top: 40rpx;
14 | background-color: #4da84d;
15 | color: #fff;
16 | }
17 |
18 | .primary-btn-hover{
19 | background-color: #3db13d;
20 | color: #fff;
21 | }
22 |
23 | .secondary-btn{
24 | margin-top: 30rpx;
25 | background-color: #dcdde1;
26 | color: #000;
27 | }
28 |
29 | .secondary-btn-hover{
30 | background-color: #f5f6fa;
31 | color: #000;
32 | }
33 |
34 | .input-placeholder{
35 | font-size: 28rpx;
36 | }
37 |
38 | .login-title{
39 | font-size: 38rpx;
40 | margin-left: 40rpx;
41 | }
42 |
43 | .login-warper{
44 | margin: 100rpx 50rpx;
45 | }
46 |
47 | .login-item{
48 | padding: 20rpx;
49 | margin: 40rpx 20rpx;
50 | }
51 |
52 | .login-item > .login-item-header{
53 | display: flex;
54 | align-items: center;
55 | }
56 | .login-item > .login-item-header > .icon{
57 | margin-right: 15rpx;
58 | }
59 | .login-item > input{
60 | padding: 10rpx;
61 | margin: 20rpx 0;
62 | font-size: 30rpx;
63 | border-bottom: rgba(0, 0, 0, 0.3) solid 1rpx;
64 | }
65 |
66 | .login-item > .forget-pwd{
67 | display: inline;
68 | padding: 0;
69 | font-size: 28rpx;
70 | font-weight: normal;
71 | color: #4da84d;
72 | background-color: #fff;
73 | }
74 |
75 | .login-item > .forget-pwd-hover{
76 | background-color: #fff;
77 | }
78 |
79 | .login-item > .forget-pwd:hover{
80 | color: #63cd63;
81 | }
82 |
83 | .login-item > .forget-pwd:active{
84 | color: #53cd53;
85 | }
--------------------------------------------------------------------------------
/miniProgram/pages/messageBoard/messageBoard.js:
--------------------------------------------------------------------------------
1 | // pages/messageBoard/messageBoard.js
2 | const app=getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 |
10 | },
11 | evaSubmit:function(e){
12 | let data=e.detial.value;
13 | wx.request({
14 | url: 'http://sunshine-sun.cn:8080/comment/add',
15 | method: 'POST',
16 | data: {
17 | bid: 0,
18 | content: data.evaContent,
19 | uid: 0
20 | },
21 | success(res) {
22 | if (res.data.code === 200) {
23 | //保存返回的数据到全局对象
24 | app.globalData.userInfo = res.data.data;
25 | wx.showToast({
26 | title: '留言成功',
27 | icon: 'success'
28 | });
29 | //跳转页面
30 | wx.navigateTo({
31 | url: '/pages/details/details',
32 | });
33 | }
34 | }
35 | })
36 |
37 | },
38 | /**
39 | * 生命周期函数--监听页面加载
40 | */
41 | onLoad: function (options) {
42 |
43 | },
44 |
45 | /**
46 | * 生命周期函数--监听页面初次渲染完成
47 | */
48 | onReady: function () {
49 |
50 | },
51 |
52 | /**
53 | * 生命周期函数--监听页面显示
54 | */
55 | onShow: function () {
56 |
57 | },
58 |
59 | /**
60 | * 生命周期函数--监听页面隐藏
61 | */
62 | onHide: function () {
63 |
64 | },
65 |
66 | /**
67 | * 生命周期函数--监听页面卸载
68 | */
69 | onUnload: function () {
70 |
71 | },
72 |
73 | /**
74 | * 页面相关事件处理函数--监听用户下拉动作
75 | */
76 | onPullDownRefresh: function () {
77 |
78 | },
79 |
80 | /**
81 | * 页面上拉触底事件的处理函数
82 | */
83 | onReachBottom: function () {
84 |
85 | },
86 |
87 | /**
88 | * 用户点击右上角分享
89 | */
90 | onShareAppMessage: function () {
91 |
92 | }
93 | })
--------------------------------------------------------------------------------
/miniProgram/pages/messageBoard/messageBoard.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/messageBoard/messageBoard.wxml:
--------------------------------------------------------------------------------
1 |
2 | 请留下您宝贵的意见:
3 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/miniProgram/pages/messageBoard/messageBoard.wxss:
--------------------------------------------------------------------------------
1 | /* pages/messageBoard/messageBoard.wxss */
2 | .title{
3 | margin-top: 50rpx;
4 | font-size: 40rpx;
5 | }
6 | .Submit{
7 | margin: 50rpx 50rpx;
8 | line-height:60rpx;
9 | border: gray 1rpx solid;
10 | }
11 | .Button{
12 | display: flex;
13 | align-items:center;
14 | }
--------------------------------------------------------------------------------
/miniProgram/pages/person/person.js:
--------------------------------------------------------------------------------
1 | // pages/person/person.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/miniProgram/pages/person/person.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/person/person.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | I am here
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 |
--------------------------------------------------------------------------------
/miniProgram/pages/person/person.wxss:
--------------------------------------------------------------------------------
1 | /* pages/person/person.wxss */
2 | .photo-ground{
3 | height: 175rpx;
4 | }
5 | .user-item{
6 | display: flex;
7 | align-items: center;
8 | }
9 | .username{
10 | margin-left: 80rpx;
11 | }
12 | .user-photo{
13 | width: 150rpx;
14 | height: 150rpx;
15 | margin-left: 40rpx;
16 | }
17 | .conton-item{
18 | font-size: 30rpx;
19 | color: black;
20 | margin-top: 50rpx;
21 | margin-left: 40rpx;
22 | }
23 | .conton-item>.text-boder{
24 | margin-top: 20rpx;
25 | align-items: center;
26 | font-size: 30rpx;
27 | color: gray;
28 | }
29 |
30 | .style{
31 | font-size: 16px;
32 | display: flex;
33 | justify-content: space-between;
34 | align-items: center;
35 | padding: 20rpx 40rpx;
36 | }
37 |
38 | .subtle-bottom-border{
39 | border-bottom: rgba(225, 225, 225, 0.3) solid 5rpx;
40 | margin: 0 40rpx;
41 | }
--------------------------------------------------------------------------------
/miniProgram/pages/public/public.js:
--------------------------------------------------------------------------------
1 | // pages/public/public.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | id: '',
9 | uid: '',
10 | bookname: '',
11 | price: '',
12 | author:'',
13 | publisher: '',
14 | recency: '',
15 | coverimg: '',
16 | note: ''
17 |
18 | },
19 |
20 | /**
21 | * 生命周期函数--监听页面加载
22 | */
23 | onLoad: function (options) {
24 | let that =this
25 | wx.request({
26 | url: 'http://sunshine-sun.cn:8080/usedbook/list',
27 | method: 'GET',
28 | success(res){
29 | if (res.data.code === 200){
30 | that.setData({
31 | list:res.data.data
32 | })
33 | }
34 | }
35 | })
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面初次渲染完成
41 | */
42 | onReady: function () {
43 |
44 | },
45 |
46 | /**
47 | * 生命周期函数--监听页面显示
48 | */
49 | onShow: function () {
50 |
51 | },
52 |
53 | /**
54 | * 生命周期函数--监听页面隐藏
55 | */
56 | onHide: function () {
57 |
58 | },
59 |
60 | /**
61 | * 生命周期函数--监听页面卸载
62 | */
63 | onUnload: function () {
64 |
65 | },
66 |
67 | /**
68 | * 页面相关事件处理函数--监听用户下拉动作
69 | */
70 | onPullDownRefresh: function () {
71 |
72 | },
73 |
74 | /**
75 | * 页面上拉触底事件的处理函数
76 | */
77 | onReachBottom: function () {
78 |
79 | },
80 |
81 | /**
82 | * 用户点击右上角分享
83 | */
84 | onShareAppMessage: function () {
85 |
86 | }
87 | })
--------------------------------------------------------------------------------
/miniProgram/pages/public/public.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/public/public.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{itName.bookname}}
12 |
13 | 作者:{{itName.author}}
14 | 出版社:{{itName.publisher}}
15 | 新旧程度:{{itName.recency}}
16 | 备注:{{itName.note}}
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/miniProgram/pages/public/public.wxss:
--------------------------------------------------------------------------------
1 | /* pages/public/public.wxss */
2 | .cover{
3 | margin: 40rpx 40rpx;
4 | width: 200rpx;
5 | height: 200rpx;
6 | }
7 | .book-name{
8 | margin-left: 40rpx;
9 | }
10 | .book-author-pub-old{
11 | display: flex;
12 | flex-direction: column;
13 | margin-left: 80rpx;
14 | font-size: 30rpx;
15 | color: gray;
16 | }
17 | .search-v{
18 | display: flex;
19 | align-items: center;
20 | }
21 | .search{
22 | margin-left: 40rpx;
23 | border: 1rpx solid black;
24 | }
25 | .search1{
26 | font-size: 30rpx;
27 | }
28 | .book-message{
29 | display: flex;
30 | align-items: center;
31 | }
--------------------------------------------------------------------------------
/miniProgram/pages/register/register.js:
--------------------------------------------------------------------------------
1 | // pages/register/register.js
2 |
3 | const app = getApp()
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 |
11 |
12 | },
13 | login:function(e){
14 | let data = e.detail.value;
15 | wx.request({
16 | url: 'http://sunshine-sun.cn:8080/user/register',
17 | method: 'POST',
18 | data: {
19 | college: data.collage,
20 | mail: data.email,
21 | major: data.major,
22 | password: data.password,
23 | tel: data.tel,
24 | username: data.user,
25 | year: data.grade
26 | },
27 | success(res) {
28 | console.log(res.data);
29 | if (res.data.code === 200) {
30 | //保存返回的数据到全局对象
31 | console.log(app.globalData.userInfo);
32 | wx.showToast({
33 | title: '注册成功',
34 | icon: 'success'
35 | });
36 | //跳转页面
37 | wx.navigateTo({
38 | url: '/pages/login/login',
39 | });
40 | }
41 | }
42 | })
43 | },
44 | /**
45 | * 生命周期函数--监听页面加载
46 | */
47 | onLoad: function (options) {
48 |
49 | },
50 |
51 | /**
52 | * 生命周期函数--监听页面初次渲染完成
53 | */
54 | onReady: function () {
55 |
56 | },
57 |
58 | /**
59 | * 生命周期函数--监听页面显示
60 | */
61 | onShow: function () {
62 |
63 | },
64 |
65 | /**
66 | * 生命周期函数--监听页面隐藏
67 | */
68 | onHide: function () {
69 |
70 | },
71 |
72 | /**
73 | * 生命周期函数--监听页面卸载
74 | */
75 | onUnload: function () {
76 |
77 | },
78 |
79 | /**
80 | * 页面相关事件处理函数--监听用户下拉动作
81 | */
82 | onPullDownRefresh: function () {
83 |
84 | },
85 |
86 | /**
87 | * 页面上拉触底事件的处理函数
88 | */
89 | onReachBottom: function () {
90 |
91 | },
92 |
93 | /**
94 | * 用户点击右上角分享
95 | */
96 | onShareAppMessage: function () {
97 |
98 | }
99 | })
--------------------------------------------------------------------------------
/miniProgram/pages/register/register.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/register/register.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 欢迎注册书香墨海
5 |
6 |
57 |
58 |
--------------------------------------------------------------------------------
/miniProgram/pages/register/register.wxss:
--------------------------------------------------------------------------------
1 | /* pages/register/register.wxss */
2 | /* pages/login/login.wxss */
3 |
4 |
5 | .btn {
6 | font-size: 30rpx;
7 | font-weight: normal;
8 | }
9 |
10 | .primary-btn{
11 | margin-top: 20rpx;
12 | background-color:#3db13d;
13 | color: #fff;
14 | }
15 |
16 |
17 | .input-placeholder{
18 | font-size: 28rpx;
19 | }
20 |
21 | .login-title{
22 | font-size: 38rpx;
23 | margin: 0rpx 150rpx;
24 | }
25 |
26 | .login-warper{
27 | margin: 100rpx 50rpx;
28 | }
29 |
30 | .login-item{
31 | padding: 10rpx;
32 | margin: 40rpx 20rpx;
33 | }
34 |
35 | .login-item > .login-item-header{
36 | display: flex;
37 | align-items: center;
38 | font-size: 30rpx;
39 | }
--------------------------------------------------------------------------------
/miniProgram/pages/revise/revise.js:
--------------------------------------------------------------------------------
1 | // pages/revise/revise.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/miniProgram/pages/revise/revise.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/revise/revise.wxml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/miniProgram/pages/revise/revise.wxml
--------------------------------------------------------------------------------
/miniProgram/pages/revise/revise.wxss:
--------------------------------------------------------------------------------
1 | /* pages/revise/revise.wxss */
2 | .photo-ground{
3 | height: 175rpx;
4 | }
5 | .con{
6 | display: flex;
7 | flex-direction: column;
8 | }
9 | .user-item{
10 | display: flex;
11 | align-items: center;
12 | }
13 | .username{
14 | margin-left: 40rpx;
15 | }
16 | .user-photo{
17 | width: 150rpx;
18 | height: 150rpx;
19 | margin-left: 40rpx;
20 | }
21 | .other-detils{
22 | margin-top: 20rpx;
23 | display: flex;
24 | align-items: center;
25 | margin-left: 40rpx;
26 | font-size: 25rpx;
27 | color: gray;
28 | }
29 | .right-arrow{
30 | width: 30rpx;
31 | height: 30rpx;
32 | margin-left: 100rpx;
33 | }
34 | .cover{
35 | margin: 40rpx 50rpx 50rpx 50rpx;
36 | width: 650rpx;
37 | }
38 | .book-name{
39 | margin-left: 40rpx;
40 | }
41 | .book-author-pub-old{
42 | display: flex;
43 | flex-direction: column;
44 | margin-left: 80rpx;
45 | font-size: 30rpx;
46 | color: gray;
47 | }
48 | .price{
49 | margin-left: 40rpx;
50 | font-size: 30rpx;
51 | }
52 | .Button{
53 | margin-top: 20rpx;
54 | display: flex;
55 | align-items: center;
56 | border-bottom: gainsboro 1rpx solid;
57 | margin-bottom: 50rpx;
58 | }
59 | .Button-left{
60 | font-size: 20rpx;
61 | }
62 | .Button-right{
63 | font-size: 20rpx;
64 | margin-left: 250rpx;
65 | }
66 |
67 |
--------------------------------------------------------------------------------
/miniProgram/pages/revisebook/revisebook.js:
--------------------------------------------------------------------------------
1 | // pages/revisebook/revisebook.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/miniProgram/pages/revisebook/revisebook.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/revisebook/revisebook.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
24 |
25 |
26 |
39 |
40 |
41 |
54 |
55 |
56 |
69 |
70 |
71 |
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 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/miniProgram/pages/revisebook/revisebook.wxss:
--------------------------------------------------------------------------------
1 | /* pages/revisebook/revisebook.wxss */
--------------------------------------------------------------------------------
/miniProgram/pages/sell/sell.js:
--------------------------------------------------------------------------------
1 | // pages/sell/sell.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 |
8 | data: {
9 |
10 | },
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | uploadBook:function(e){
15 | let data = e.detail.value;
16 | wx.request({
17 | url: 'http://sunshine-sun.cn:8080//usedbook/add',
18 | method: 'POST',
19 | data: {
20 | bookname: data.bookname,
21 | author: data.author,
22 | publisher: data.publisher,
23 | recency: data.recency,
24 | note: data.note,
25 | prcie: data.price
26 | },
27 | success(res) {
28 | console.log(res.data);
29 | if (res.data.code === 200) {
30 | //保存返回的数据到全局对象
31 | console.log(app.globalData.userInfo);
32 | //跳转页面
33 | wx.navigateTo({
34 | url: '/pages/_public/_pulic',
35 | });
36 | }
37 | }
38 | })
39 | },
40 | onLoad: function (options) {
41 | var that = this;
42 | wx.getSystemInfo({
43 | success: function (res) {
44 | console.log(res);
45 | // 屏幕宽度、高度
46 | console.log('height=' + res.windowHeight);
47 | console.log('width=' + res.windowWidth);
48 | // 高度,宽度 单位为px
49 | that.setData({
50 | windowWidth: res.windowWidth,
51 | windowHeight: res.windowHeight,
52 | })
53 | }
54 | })
55 | },
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | get_name:function(e){
64 | console.log(e.detail);
65 | var that=this;
66 |
67 | if (!that.data.is_anonymous) {
68 | if (e.detail.cursor > 4) {
69 | wx.showToast({
70 | title: '姓名不能超过四个字符',
71 | icon: 'none',
72 | duration: 2000
73 | });
74 |
75 | }
76 | }
77 | that.setData({
78 | name: e.detail
79 | });
80 | },
81 |
82 | is_anonymous:function(e){
83 | console.log(e.detail);
84 | var that = this;
85 | that.setData({
86 | is_anonymous: e.detail.value
87 | });
88 |
89 | },
90 |
91 |
92 | get_textarea:function(e){
93 | console.log(e.detail);
94 | var that = this;
95 | that.setData({
96 | textarea: e.detail.value
97 | });
98 |
99 | },
100 | uploader: function () {
101 | var that = this;
102 | let imagesList = [];
103 | let maxSize = 1024 * 1024;
104 | let maxLength = 6;
105 | let flag = true;
106 | wx.chooseImage({
107 | count: 6, //最多可以选择的图片总数
108 | sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
109 | sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
110 | success: function (res) {
111 | wx.showToast({
112 | title: '正在上传...',
113 | icon: 'loading',
114 | mask: true,
115 | duration: 500
116 | })
117 | for (let i = 0; i < res.tempFiles.length; i++) {
118 | if (res.tempFiles[i].size > maxSize) {
119 | flag = false;
120 | console.log(111)
121 | wx.showModal({
122 | content: '图片太大,不允许上传',
123 | showCancel: false,
124 | success: function (res) {
125 | if (res.confirm) {
126 | console.log('用户点击确定')
127 | }
128 | }
129 | });
130 | }
131 | }
132 | if (res.tempFiles.length > maxLength) {
133 | console.log('222');
134 | wx.showModal({
135 | content: '最多能上传' + maxLength + '张图片',
136 | showCancel: false,
137 | success: function (res) {
138 | if (res.confirm) {
139 | console.log('确定');
140 | }
141 | }
142 | })
143 | }
144 | if (flag == true && res.tempFiles.length <= maxLength) {
145 | that.setData({
146 | imagesList: res.tempFilePaths
147 | })
148 | }
149 | console.log(res);
150 | },
151 | fail: function (res) {
152 | console.log(res);
153 | }
154 | })
155 | },
156 | submit: function (res) {
157 | console.log(res);
158 | var that = this;
159 | if (!that.data.is_anonymous){
160 | if (that.data.name.cursor>4){
161 | wx.showToast({
162 | title: '姓名不能超过四个字符',
163 | icon: 'none',
164 | duration: 2000
165 | });
166 | return false;
167 | }
168 | }
169 |
170 |
171 | var id=false;
172 | wx.showLoading({
173 | title: '上传中...',
174 |
175 | })
176 | wx.request({
177 | url: 'https://www.top/index.php/api/index/index',
178 | method: 'post',
179 | data: {
180 | name: that.data.name.value,
181 | phone: that.data.phone.value,
182 | is_anonymous: that.data.is_anonymous,
183 | textarea: that.data.textarea
184 | }, success: function (res) {
185 | console.log(res);
186 | if (res.data.success){
187 | id = res.data.id;
188 | for (let i = 0; i < that.data.imagesList.length; i++) {
189 | wx.uploadFile({
190 | url: 'https://www.top/index.php/api/index/upload.html?id=' + id,
191 | filePath: that.data.imagesList[i],
192 | name: 'uploadfile_ant',
193 | header: {
194 | "Content-Type": "multipart/form-data"
195 | // 'Content-Type': 'application/json'
196 | },
197 | success: function (data) {
198 | if ((that.data.imagesList.length - 1)==i){
199 | wx.hideLoading();
200 | wx.showToast({
201 | title: '成功',
202 | icon: 'success',
203 | duration: 2000
204 | })
205 |
206 | that.setData({
207 | imagesList: []
208 | , img: '/images/up.png',
209 | file: '',
210 | is_anonymous: false,
211 | name: '',
212 | phone: '',
213 | textarea: ''
214 | });
215 | setTimeout(function () {
216 | wx.navigateTo({
217 | url: '../success/success',
218 | })
219 | }, 2000)
220 |
221 | }
222 | },
223 | fail: function (data) {
224 | console.log(data);
225 | }
226 | });
227 | }
228 | }
229 | }
230 | });
231 | },
232 | /**
233 | * 生命周期函数--监听页面初次渲染完成
234 | */
235 | onReady: function () {
236 | },
237 | /**
238 | * 生命周期函数--监听页面显示
239 | */
240 | onShow: function () {
241 | },
242 | /**
243 | * 生命周期函数--监听页面隐藏
244 | */
245 | onHide: function () {
246 | },
247 | /**
248 | * 生命周期函数--监听页面卸载
249 | */
250 | onUnload: function () {
251 | },
252 |
253 | /**
254 | * 页面相关事件处理函数--监听用户下拉动作
255 | */
256 | onPullDownRefresh: function () {
257 | },
258 |
259 | /**
260 | * 页面上拉触底事件的处理函数
261 | */
262 | onReachBottom: function () {
263 |
264 | },
265 |
266 | /**
267 | * 用户点击右上角分享
268 | */
269 | onShareAppMessage: function () {
270 |
271 | }
272 | })
--------------------------------------------------------------------------------
/miniProgram/pages/sell/sell.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/sell/sell.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
97 |
98 |
99 | 上传图片:
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/miniProgram/pages/sell/sell.wxss:
--------------------------------------------------------------------------------
1 | pages/sell/sell.wxss
2 | .sellbooks{
3 | width: 100%;
4 | height: calc(100vw * 427 / 1572);
5 | }
6 |
7 | .name{
8 | font-size: 12px;
9 | margin-left: 40rpx;
10 | justify-content: space-between;
11 |
12 | }
13 |
14 | ._name{
15 | font-size: 10px;
16 | margin-left: 40rpx;
17 | padding: 10rpx 10rpx;
18 | }
19 |
20 | .subtle-bottom-border{
21 | border-bottom: rgba(225, 225, 225, 0.3) solid 1rpx;
22 | margin: 0 40rpx;
23 | }
24 |
25 |
26 | .body {
27 | background: #f6f6f6;
28 | }
29 |
30 | .title {
31 | position: relative;
32 | top: 60rpx;
33 | text-align: center;
34 | }
35 |
36 |
37 | button {
38 | line-height: 80rpx;
39 | width: 80%;
40 | height: 80rpx;
41 | margin-top: 40rpx;
42 | position: relative;
43 | }
44 |
45 | page {
46 | background: #f6f7f8;
47 | }
48 |
49 | .question-form {
50 | margin: 25rpx;
51 | }
52 |
53 | .question-input-area {
54 | background-color: #fff;
55 | border: 1rpx solid #f2f2f2;
56 | border-radius: 4rpx;
57 | }
58 |
59 | .question-title-wrap {
60 | display: flex;
61 | align-items: center;
62 | border-bottom: 1rpx solid #ccc;
63 | margin: 10rpx 30rpx;
64 | padding: 20rpx 0;
65 | }
66 |
67 | .question-title {
68 | flex: 1;
69 | }
70 |
71 | .weui-textarea-counter, .title-input-counter {
72 | color: #b3b3b3;
73 | font-size: 14px;
74 | padding-left: 10rpx;
75 | }
76 |
77 | .weui-cell::before, .weui-cells::before, .weui-cell::after, .weui-cells::after {
78 | border: none;
79 | }
80 |
81 | .question-images-area {
82 | padding: 40rpx 0;
83 | }
84 |
85 | .question-images-tool {
86 | display: flex;
87 | align-items: center;
88 | }
89 |
90 | .question-images {
91 | display: flex;
92 | align-items: center;
93 | margin-top: 40rpx;
94 | }
95 |
96 | .q-image-wrap {
97 | width: 31%;
98 | margin-right: 10rpx;
99 |
100 | }
101 |
102 | .q-image {
103 | flex: 1;
104 | height: 200rpx;
105 | width: 100%;
106 | }
107 |
108 | .q-image-remover {
109 | text-align: center;
110 | }
111 |
112 | .weui-uploader__file image {
113 | width: 30%;
114 | height: 192rpx;
115 | padding: 10rpx;
116 | margin-bottom: 10rpx;
117 | }
118 |
119 | .weui-uploader__bd {
120 | width: 85%;
121 | height: auto;
122 | margin: 0 auto;
123 | background-color: #fff;
124 | padding: 20rpx;
125 | }
126 |
127 | .js_file {
128 | background: url('https://www.gdzhisheng.top/xqxcz/public/weixin/up.png') no-repeat;
129 | width: 160rpx;
130 | height: 155rpx;
131 | }
132 |
133 | .weui-uploader__file {
134 | display: flex;
135 | flex-wrap: wrap;
136 | justify-content: flex-start;
137 | }
138 | #name{
139 | height: 40rpx;
140 | }
141 | .inp_1{
142 | width:85%;
143 | margin:0 auto;
144 | background-color:#ffffff;
145 | padding:20rpx;
146 | }
147 | .inp{
148 | padding:20rpx;
149 | }
150 | .inp_name{
151 | border-bottom:solid #e0dddd 1rpx;
152 | }
153 | .label{
154 | width:30%;display: inline-block;
155 | }
156 | .input{
157 | width:80%;
158 | display: inline-block;
159 | }
160 |
161 | .wx-switch-input{
162 | width:78rpx !important;
163 | height:44rpx !important;
164 | /* background: #50D2C2 !important;
165 | border: #50d2c2 !important; */
166 | /* 2018-07-18 重置开关边框颜色 */
167 | }
168 | /*白色样式(false的样式)*/
169 | .wx-switch-input::before{
170 | width:76rpx !important;
171 | height: 40rpx !important;
172 | }
173 | /*绿色样式(true的样式)*/
174 | .wx-switch-input::after{
175 | width: 36rpx !important;
176 | height: 40rpx !important;
177 | }
178 |
179 | .icon {
180 | width: 40rpx;
181 | height: 40rpx;
182 | }
183 | .price{
184 | font-size: 15px;
185 | display: flex;
186 | justify-content: space-between;
187 | align-items: center;
188 | padding: 20rpx 40rpx;
189 | }
190 |
--------------------------------------------------------------------------------
/miniProgram/pages/updatacenter/updatacenter.js:
--------------------------------------------------------------------------------
1 | // pages/updatacenter/updatacenter.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/miniProgram/pages/updatacenter/updatacenter.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/updatacenter/updatacenter.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 请输入修改的信息:
5 |
6 |
57 |
58 |
--------------------------------------------------------------------------------
/miniProgram/pages/updatacenter/updatacenter.wxss:
--------------------------------------------------------------------------------
1 | /* pages/updatacenter/updatacenter.wxss */
2 | .btn {
3 | font-size: 30rpx;
4 | font-weight: normal;
5 | }
6 |
7 | .primary-btn{
8 | margin-top: 20rpx;
9 | background-color:#3db13d;
10 | color: #fff;
11 | }
12 |
13 |
14 | .input-placeholder{
15 | font-size: 28rpx;
16 | }
17 |
18 | .login-title{
19 | font-size: 38rpx;
20 | margin: 0rpx 150rpx;
21 | }
22 |
23 | .login-warper{
24 | margin: 100rpx 50rpx;
25 | }
26 |
27 | .login-item{
28 | padding: 10rpx;
29 | margin: 40rpx 20rpx;
30 | }
31 |
32 | .login-item > .login-item-header{
33 | display: flex;
34 | align-items: center;
35 | font-size: 30rpx;
36 | }
--------------------------------------------------------------------------------
/miniProgram/pages/user/user.js:
--------------------------------------------------------------------------------
1 | // pages/user/user.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/miniProgram/pages/user/user.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/miniProgram/pages/user/user.wxml:
--------------------------------------------------------------------------------
1 |
2 | pages/user/user.wxml
3 |
--------------------------------------------------------------------------------
/miniProgram/pages/user/user.wxss:
--------------------------------------------------------------------------------
1 | /* pages/user/user.wxss */
--------------------------------------------------------------------------------
/miniProgram/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": false,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true,
12 | "coverView": true,
13 | "autoAudits": false,
14 | "checkInvalidKey": true,
15 | "checkSiteMap": true,
16 | "uploadWithSourceMap": true,
17 | "babelSetting": {
18 | "ignore": [],
19 | "disablePlugins": [],
20 | "outputPath": ""
21 | },
22 | "showShadowRootInWxmlPanel": true,
23 | "scopeDataCheck": false
24 | },
25 | "compileType": "miniprogram",
26 | "libVersion": "2.10.3",
27 | "appid": "wxec1809c416127765",
28 | "projectname": "%E6%B5%B7%E5%A4%A7%E4%B9%A6%E9%A6%99",
29 | "debugOptions": {
30 | "hidedInDevtools": []
31 | },
32 | "isGameTourist": false,
33 | "simulatorType": "wechat",
34 | "simulatorPluginLibVersion": {},
35 | "condition": {
36 | "search": {
37 | "current": -1,
38 | "list": []
39 | },
40 | "conversation": {
41 | "current": -1,
42 | "list": []
43 | },
44 | "game": {
45 | "currentL": -1,
46 | "list": []
47 | },
48 | "miniprogram": {
49 | "current": -1,
50 | "list": []
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/miniProgram/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/miniProgram/utils/util.js:
--------------------------------------------------------------------------------
1 | const formatTime = date => {
2 | const year = date.getFullYear()
3 | const month = date.getMonth() + 1
4 | const day = date.getDate()
5 | const hour = date.getHours()
6 | const minute = date.getMinutes()
7 | const second = date.getSeconds()
8 |
9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
10 | }
11 |
12 | const formatNumber = n => {
13 | n = n.toString()
14 | return n[1] ? n : '0' + n
15 | }
16 |
17 | module.exports = {
18 | formatTime: formatTime
19 | }
20 |
--------------------------------------------------------------------------------
/server/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**
5 | !**/src/test/**
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 |
30 | ### VS Code ###
31 | .vscode/
32 |
--------------------------------------------------------------------------------
/server/.mvn/wrapper/MavenWrapperDownloader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2007-present the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import java.net.*;
18 | import java.io.*;
19 | import java.nio.channels.*;
20 | import java.util.Properties;
21 |
22 | public class MavenWrapperDownloader {
23 |
24 | private static final String WRAPPER_VERSION = "0.5.6";
25 | /**
26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
27 | */
28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
30 |
31 | /**
32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
33 | * use instead of the default one.
34 | */
35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
36 | ".mvn/wrapper/maven-wrapper.properties";
37 |
38 | /**
39 | * Path where the maven-wrapper.jar will be saved to.
40 | */
41 | private static final String MAVEN_WRAPPER_JAR_PATH =
42 | ".mvn/wrapper/maven-wrapper.jar";
43 |
44 | /**
45 | * Name of the property which should be used to override the default download url for the wrapper.
46 | */
47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
48 |
49 | public static void main(String args[]) {
50 | System.out.println("- Downloader started");
51 | File baseDirectory = new File(args[0]);
52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
53 |
54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
55 | // wrapperUrl parameter.
56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
57 | String url = DEFAULT_DOWNLOAD_URL;
58 | if (mavenWrapperPropertyFile.exists()) {
59 | FileInputStream mavenWrapperPropertyFileInputStream = null;
60 | try {
61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
62 | Properties mavenWrapperProperties = new Properties();
63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
65 | } catch (IOException e) {
66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
67 | } finally {
68 | try {
69 | if (mavenWrapperPropertyFileInputStream != null) {
70 | mavenWrapperPropertyFileInputStream.close();
71 | }
72 | } catch (IOException e) {
73 | // Ignore ...
74 | }
75 | }
76 | }
77 | System.out.println("- Downloading from: " + url);
78 |
79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
80 | if (!outputFile.getParentFile().exists()) {
81 | if (!outputFile.getParentFile().mkdirs()) {
82 | System.out.println(
83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
84 | }
85 | }
86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
87 | try {
88 | downloadFileFromURL(url, outputFile);
89 | System.out.println("Done");
90 | System.exit(0);
91 | } catch (Throwable e) {
92 | System.out.println("- Error downloading");
93 | e.printStackTrace();
94 | System.exit(1);
95 | }
96 | }
97 |
98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
100 | String username = System.getenv("MVNW_USERNAME");
101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
102 | Authenticator.setDefault(new Authenticator() {
103 | @Override
104 | protected PasswordAuthentication getPasswordAuthentication() {
105 | return new PasswordAuthentication(username, password);
106 | }
107 | });
108 | }
109 | URL website = new URL(urlString);
110 | ReadableByteChannel rbc;
111 | rbc = Channels.newChannel(website.openStream());
112 | FileOutputStream fos = new FileOutputStream(destination);
113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
114 | fos.close();
115 | rbc.close();
116 | }
117 |
118 | }
119 |
--------------------------------------------------------------------------------
/server/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/server/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/server/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/server/mvnw:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ----------------------------------------------------------------------------
3 | # Licensed to the Apache Software Foundation (ASF) under one
4 | # or more contributor license agreements. See the NOTICE file
5 | # distributed with this work for additional information
6 | # regarding copyright ownership. The ASF licenses this file
7 | # to you under the Apache License, Version 2.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # https://www.apache.org/licenses/LICENSE-2.0
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | # KIND, either express or implied. See the License for the
17 | # specific language governing permissions and limitations
18 | # under the License.
19 | # ----------------------------------------------------------------------------
20 |
21 | # ----------------------------------------------------------------------------
22 | # Maven Start Up Batch script
23 | #
24 | # Required ENV vars:
25 | # ------------------
26 | # JAVA_HOME - location of a JDK home dir
27 | #
28 | # Optional ENV vars
29 | # -----------------
30 | # M2_HOME - location of maven2's installed home dir
31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven
32 | # e.g. to debug Maven itself, use
33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files
35 | # ----------------------------------------------------------------------------
36 |
37 | if [ -z "$MAVEN_SKIP_RC" ]; then
38 |
39 | if [ -f /etc/mavenrc ]; then
40 | . /etc/mavenrc
41 | fi
42 |
43 | if [ -f "$HOME/.mavenrc" ]; then
44 | . "$HOME/.mavenrc"
45 | fi
46 |
47 | fi
48 |
49 | # OS specific support. $var _must_ be set to either true or false.
50 | cygwin=false
51 | darwin=false
52 | mingw=false
53 | case "$(uname)" in
54 | CYGWIN*) cygwin=true ;;
55 | MINGW*) mingw=true ;;
56 | Darwin*)
57 | darwin=true
58 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
59 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
60 | if [ -z "$JAVA_HOME" ]; then
61 | if [ -x "/usr/libexec/java_home" ]; then
62 | export JAVA_HOME="$(/usr/libexec/java_home)"
63 | else
64 | export JAVA_HOME="/Library/Java/Home"
65 | fi
66 | fi
67 | ;;
68 | esac
69 |
70 | if [ -z "$JAVA_HOME" ]; then
71 | if [ -r /etc/gentoo-release ]; then
72 | JAVA_HOME=$(java-config --jre-home)
73 | fi
74 | fi
75 |
76 | if [ -z "$M2_HOME" ]; then
77 | ## resolve links - $0 may be a link to maven's home
78 | PRG="$0"
79 |
80 | # need this for relative symlinks
81 | while [ -h "$PRG" ]; do
82 | ls=$(ls -ld "$PRG")
83 | link=$(expr "$ls" : '.*-> \(.*\)$')
84 | if expr "$link" : '/.*' >/dev/null; then
85 | PRG="$link"
86 | else
87 | PRG="$(dirname "$PRG")/$link"
88 | fi
89 | done
90 |
91 | saveddir=$(pwd)
92 |
93 | M2_HOME=$(dirname "$PRG")/..
94 |
95 | # make it fully qualified
96 | M2_HOME=$(cd "$M2_HOME" && pwd)
97 |
98 | cd "$saveddir"
99 | # echo Using m2 at $M2_HOME
100 | fi
101 |
102 | # For Cygwin, ensure paths are in UNIX format before anything is touched
103 | if $cygwin; then
104 | [ -n "$M2_HOME" ] &&
105 | M2_HOME=$(cygpath --unix "$M2_HOME")
106 | [ -n "$JAVA_HOME" ] &&
107 | JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
108 | [ -n "$CLASSPATH" ] &&
109 | CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
110 | fi
111 |
112 | # For Mingw, ensure paths are in UNIX format before anything is touched
113 | if $mingw; then
114 | [ -n "$M2_HOME" ] &&
115 | M2_HOME="$( (
116 | cd "$M2_HOME"
117 | pwd
118 | ))"
119 | [ -n "$JAVA_HOME" ] &&
120 | JAVA_HOME="$( (
121 | cd "$JAVA_HOME"
122 | pwd
123 | ))"
124 | fi
125 |
126 | if [ -z "$JAVA_HOME" ]; then
127 | javaExecutable="$(which javac)"
128 | if [ -n "$javaExecutable" ] && ! [ "$(expr \"$javaExecutable\" : '\([^ ]*\)')" = "no" ]; then
129 | # readlink(1) is not available as standard on Solaris 10.
130 | readLink=$(which readlink)
131 | if [ ! $(expr "$readLink" : '\([^ ]*\)') = "no" ]; then
132 | if $darwin; then
133 | javaHome="$(dirname \"$javaExecutable\")"
134 | javaExecutable="$(cd \"$javaHome\" && pwd -P)/javac"
135 | else
136 | javaExecutable="$(readlink -f \"$javaExecutable\")"
137 | fi
138 | javaHome="$(dirname \"$javaExecutable\")"
139 | javaHome=$(expr "$javaHome" : '\(.*\)/bin')
140 | JAVA_HOME="$javaHome"
141 | export JAVA_HOME
142 | fi
143 | fi
144 | fi
145 |
146 | if [ -z "$JAVACMD" ]; then
147 | if [ -n "$JAVA_HOME" ]; then
148 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then
149 | # IBM's JDK on AIX uses strange locations for the executables
150 | JAVACMD="$JAVA_HOME/jre/sh/java"
151 | else
152 | JAVACMD="$JAVA_HOME/bin/java"
153 | fi
154 | else
155 | JAVACMD="$(which java)"
156 | fi
157 | fi
158 |
159 | if [ ! -x "$JAVACMD" ]; then
160 | echo "Error: JAVA_HOME is not defined correctly." >&2
161 | echo " We cannot execute $JAVACMD" >&2
162 | exit 1
163 | fi
164 |
165 | if [ -z "$JAVA_HOME" ]; then
166 | echo "Warning: JAVA_HOME environment variable is not set."
167 | fi
168 |
169 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
170 |
171 | # traverses directory structure from process work directory to filesystem root
172 | # first directory with .mvn subdirectory is considered project base directory
173 | find_maven_basedir() {
174 |
175 | if [ -z "$1" ]; then
176 | echo "Path not specified to find_maven_basedir"
177 | return 1
178 | fi
179 |
180 | basedir="$1"
181 | wdir="$1"
182 | while [ "$wdir" != '/' ]; do
183 | if [ -d "$wdir"/.mvn ]; then
184 | basedir=$wdir
185 | break
186 | fi
187 | # workaround for JBEAP-8937 (on Solaris 10/Sparc)
188 | if [ -d "${wdir}" ]; then
189 | wdir=$(
190 | cd "$wdir/.."
191 | pwd
192 | )
193 | fi
194 | # end of workaround
195 | done
196 | echo "${basedir}"
197 | }
198 |
199 | # concatenates all lines of a file
200 | concat_lines() {
201 | if [ -f "$1" ]; then
202 | echo "$(tr -s '\n' ' ' <"$1")"
203 | fi
204 | }
205 |
206 | BASE_DIR=$(find_maven_basedir "$(pwd)")
207 | if [ -z "$BASE_DIR" ]; then
208 | exit 1
209 | fi
210 |
211 | ##########################################################################################
212 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
213 | # This allows using the maven wrapper in projects that prohibit checking in binary data.
214 | ##########################################################################################
215 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
216 | if [ "$MVNW_VERBOSE" = true ]; then
217 | echo "Found .mvn/wrapper/maven-wrapper.jar"
218 | fi
219 | else
220 | if [ "$MVNW_VERBOSE" = true ]; then
221 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
222 | fi
223 | if [ -n "$MVNW_REPOURL" ]; then
224 | jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
225 | else
226 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
227 | fi
228 | while IFS="=" read key value; do
229 | case "$key" in wrapperUrl)
230 | jarUrl="$value"
231 | break
232 | ;;
233 | esac
234 | done <"$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
235 | if [ "$MVNW_VERBOSE" = true ]; then
236 | echo "Downloading from: $jarUrl"
237 | fi
238 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
239 | if $cygwin; then
240 | wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
241 | fi
242 |
243 | if command -v wget >/dev/null; then
244 | if [ "$MVNW_VERBOSE" = true ]; then
245 | echo "Found wget ... using wget"
246 | fi
247 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
248 | wget "$jarUrl" -O "$wrapperJarPath"
249 | else
250 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
251 | fi
252 | elif command -v curl >/dev/null; then
253 | if [ "$MVNW_VERBOSE" = true ]; then
254 | echo "Found curl ... using curl"
255 | fi
256 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
257 | curl -o "$wrapperJarPath" "$jarUrl" -f
258 | else
259 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
260 | fi
261 |
262 | else
263 | if [ "$MVNW_VERBOSE" = true ]; then
264 | echo "Falling back to using Java to download"
265 | fi
266 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
267 | # For Cygwin, switch paths to Windows format before running javac
268 | if $cygwin; then
269 | javaClass=$(cygpath --path --windows "$javaClass")
270 | fi
271 | if [ -e "$javaClass" ]; then
272 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
273 | if [ "$MVNW_VERBOSE" = true ]; then
274 | echo " - Compiling MavenWrapperDownloader.java ..."
275 | fi
276 | # Compiling the Java class
277 | ("$JAVA_HOME/bin/javac" "$javaClass")
278 | fi
279 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
280 | # Running the downloader
281 | if [ "$MVNW_VERBOSE" = true ]; then
282 | echo " - Running MavenWrapperDownloader.java ..."
283 | fi
284 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
285 | fi
286 | fi
287 | fi
288 | fi
289 | ##########################################################################################
290 | # End of extension
291 | ##########################################################################################
292 |
293 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
294 | if [ "$MVNW_VERBOSE" = true ]; then
295 | echo $MAVEN_PROJECTBASEDIR
296 | fi
297 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
298 |
299 | # For Cygwin, switch paths to Windows format before running java
300 | if $cygwin; then
301 | [ -n "$M2_HOME" ] &&
302 | M2_HOME=$(cygpath --path --windows "$M2_HOME")
303 | [ -n "$JAVA_HOME" ] &&
304 | JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
305 | [ -n "$CLASSPATH" ] &&
306 | CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
307 | [ -n "$MAVEN_PROJECTBASEDIR" ] &&
308 | MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
309 | fi
310 |
311 | # Provide a "standardized" way to retrieve the CLI args that will
312 | # work with both Windows and non-Windows executions.
313 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
314 | export MAVEN_CMD_LINE_ARGS
315 |
316 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
317 |
318 | exec "$JAVACMD" \
319 | $MAVEN_OPTS \
320 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
321 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
322 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
323 |
--------------------------------------------------------------------------------
/server/mvnw.cmd:
--------------------------------------------------------------------------------
1 | @REM ----------------------------------------------------------------------------
2 | @REM Licensed to the Apache Software Foundation (ASF) under one
3 | @REM or more contributor license agreements. See the NOTICE file
4 | @REM distributed with this work for additional information
5 | @REM regarding copyright ownership. The ASF licenses this file
6 | @REM to you under the Apache License, Version 2.0 (the
7 | @REM "License"); you may not use this file except in compliance
8 | @REM with the License. You may obtain a copy of the License at
9 | @REM
10 | @REM https://www.apache.org/licenses/LICENSE-2.0
11 | @REM
12 | @REM Unless required by applicable law or agreed to in writing,
13 | @REM software distributed under the License is distributed on an
14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | @REM KIND, either express or implied. See the License for the
16 | @REM specific language governing permissions and limitations
17 | @REM under the License.
18 | @REM ----------------------------------------------------------------------------
19 |
20 | @REM ----------------------------------------------------------------------------
21 | @REM Maven Start Up Batch script
22 | @REM
23 | @REM Required ENV vars:
24 | @REM JAVA_HOME - location of a JDK home dir
25 | @REM
26 | @REM Optional ENV vars
27 | @REM M2_HOME - location of maven2's installed home dir
28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31 | @REM e.g. to debug Maven itself, use
32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34 | @REM ----------------------------------------------------------------------------
35 |
36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37 | @echo off
38 | @REM set title of command window
39 | title %0
40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
42 |
43 | @REM set %HOME% to equivalent of $HOME
44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
45 |
46 | @REM Execute a user defined script before this one
47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending
49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
51 | :skipRcPre
52 |
53 | @setlocal
54 |
55 | set ERROR_CODE=0
56 |
57 | @REM To isolate internal variables from possible post scripts, we use another setlocal
58 | @setlocal
59 |
60 | @REM ==== START VALIDATION ====
61 | if not "%JAVA_HOME%" == "" goto OkJHome
62 |
63 | echo.
64 | echo Error: JAVA_HOME not found in your environment. >&2
65 | echo Please set the JAVA_HOME variable in your environment to match the >&2
66 | echo location of your Java installation. >&2
67 | echo.
68 | goto error
69 |
70 | :OkJHome
71 | if exist "%JAVA_HOME%\bin\java.exe" goto init
72 |
73 | echo.
74 | echo Error: JAVA_HOME is set to an invalid directory. >&2
75 | echo JAVA_HOME = "%JAVA_HOME%" >&2
76 | echo Please set the JAVA_HOME variable in your environment to match the >&2
77 | echo location of your Java installation. >&2
78 | echo.
79 | goto error
80 |
81 | @REM ==== END VALIDATION ====
82 |
83 | :init
84 |
85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86 | @REM Fallback to current working directory if not found.
87 |
88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
90 |
91 | set EXEC_DIR=%CD%
92 | set WDIR=%EXEC_DIR%
93 | :findBaseDir
94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound
95 | cd ..
96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound
97 | set WDIR=%CD%
98 | goto findBaseDir
99 |
100 | :baseDirFound
101 | set MAVEN_PROJECTBASEDIR=%WDIR%
102 | cd "%EXEC_DIR%"
103 | goto endDetectBaseDir
104 |
105 | :baseDirNotFound
106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
107 | cd "%EXEC_DIR%"
108 |
109 | :endDetectBaseDir
110 |
111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
112 |
113 | @setlocal EnableExtensions EnableDelayedExpansion
114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
116 |
117 | :endReadAdditionalConfig
118 |
119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122 |
123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
124 |
125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127 | )
128 |
129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131 | if exist %WRAPPER_JAR% (
132 | if "%MVNW_VERBOSE%" == "true" (
133 | echo Found %WRAPPER_JAR%
134 | )
135 | ) else (
136 | if not "%MVNW_REPOURL%" == "" (
137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
138 | )
139 | if "%MVNW_VERBOSE%" == "true" (
140 | echo Couldn't find %WRAPPER_JAR%, downloading it ...
141 | echo Downloading from: %DOWNLOAD_URL%
142 | )
143 |
144 | powershell -Command "&{"^
145 | "$webclient = new-object System.Net.WebClient;"^
146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148 | "}"^
149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150 | "}"
151 | if "%MVNW_VERBOSE%" == "true" (
152 | echo Finished downloading %WRAPPER_JAR%
153 | )
154 | )
155 | @REM End of extension
156 |
157 | @REM Provide a "standardized" way to retrieve the CLI args that will
158 | @REM work with both Windows and non-Windows executions.
159 | set MAVEN_CMD_LINE_ARGS=%*
160 |
161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
162 | if ERRORLEVEL 1 goto error
163 | goto end
164 |
165 | :error
166 | set ERROR_CODE=1
167 |
168 | :end
169 | @endlocal & set ERROR_CODE=%ERROR_CODE%
170 |
171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
175 | :skipRcPost
176 |
177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
179 |
180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
181 |
182 | exit /B %ERROR_CODE%
183 |
--------------------------------------------------------------------------------
/server/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.0.RELEASE
9 |
10 |
11 | com.ouc
12 | usedbook
13 | 1.0
14 | usedbook
15 | Used Book Server
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-data-jpa
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 |
32 | org.springframework.boot
33 | spring-boot-devtools
34 | runtime
35 | true
36 |
37 |
38 | mysql
39 | mysql-connector-java
40 | runtime
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-configuration-processor
45 | true
46 |
47 |
48 | org.projectlombok
49 | lombok
50 | true
51 |
52 |
53 | org.springframework.boot
54 | spring-boot-starter-test
55 | test
56 |
57 |
58 | org.junit.vintage
59 | junit-vintage-engine
60 |
61 |
62 |
63 |
64 |
65 |
66 | io.springfox
67 | springfox-swagger2
68 | 2.9.2
69 |
70 |
71 |
72 | com.github.xiaoymin
73 | swagger-bootstrap-ui
74 | 1.9.6
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | org.springframework.boot
83 | spring-boot-maven-plugin
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/UsedbookApplication.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * springBoot主体程序
8 | *
9 | * @author 孙浩杰
10 | * @date 2020/05/31
11 | */
12 |
13 | @SpringBootApplication
14 | public class UsedbookApplication {
15 |
16 | public static void main(String[] args) {
17 | SpringApplication.run(UsedbookApplication.class, args);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/config/SwaggerConfig.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.config;
2 |
3 |
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 | import springfox.documentation.builders.PathSelectors;
7 | import springfox.documentation.builders.RequestHandlerSelectors;
8 | import springfox.documentation.service.ApiInfo;
9 | import springfox.documentation.service.Contact;
10 | import springfox.documentation.spi.DocumentationType;
11 | import springfox.documentation.spring.web.plugins.Docket;
12 | import springfox.documentation.swagger2.annotations.EnableSwagger2;
13 |
14 | import java.util.Collections;
15 |
16 | /**
17 | * @author 孙浩杰
18 | * @version 1.0
19 | * @description Swagger2的配置文件
20 | * @date 2020/6/1 20:53
21 | */
22 |
23 | @Configuration
24 | @EnableSwagger2
25 | public class SwaggerConfig {
26 | @Bean
27 | public Docket api() {
28 | return new Docket(DocumentationType.SWAGGER_2)
29 | .select()
30 | .apis(RequestHandlerSelectors.basePackage("com.ouc.usedbook.controller"))
31 | .paths(PathSelectors.any())
32 | .build()
33 | .apiInfo(apiInfo());
34 | }
35 |
36 | private ApiInfo apiInfo() {
37 | return new ApiInfo(
38 | "UserBook Market后端Api文档",
39 | "restful风格的api接口",
40 | "API V1.0",
41 | "https://github.com/sunshine2285/used-books-market-miniProgram",
42 | new Contact("UserBook Market",
43 | "https://github.com/sunshine2285/used-books-market-miniProgram",
44 | "sunshine2285@163.com"),
45 | "Apache2", "http://www.apache2.org/", Collections.emptyList());
46 | }
47 | }
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/controller/CommentController.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.controller;
2 |
3 | import com.ouc.usedbook.dto.CommentDTO;
4 | import com.ouc.usedbook.dto.CommentViewDTO;
5 | import com.ouc.usedbook.entity.Comment;
6 | import com.ouc.usedbook.service.CommentService;
7 | import com.ouc.usedbook.util.Response;
8 | import io.swagger.annotations.ApiOperation;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | import java.util.ArrayList;
13 |
14 | /**
15 | * @author 孙浩杰
16 | * @version 1.0
17 | * @description TODO
18 | * @date 2020/6/2 10:33
19 | */
20 | @RestController
21 | @CrossOrigin("*")
22 | @RequestMapping("/comment")
23 | public class CommentController {
24 |
25 | final CommentService commentService;
26 |
27 | public CommentController(CommentService commentService) {
28 | this.commentService = commentService;
29 | }
30 |
31 | @ApiOperation(value = "获取留言", notes = "根据二手书的bid获取书籍的留言列表", httpMethod = "GET")
32 | @GetMapping("/list/{bid}")
33 | Response list(@PathVariable Long bid){
34 | ArrayList comments = commentService.get(bid);
35 | return Response.ok(comments);
36 | }
37 |
38 | @ApiOperation(value = "留言", notes = "根据二手书的bid和用户uid添加留言", httpMethod = "POST")
39 | @PostMapping("/add")
40 | Response add(@RequestBody CommentDTO commentDTO){
41 | long cid = commentService.add(commentDTO.toComment());
42 | return Response.ok(cid);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/controller/UsedbookController.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.controller;
2 |
3 | import com.ouc.usedbook.dto.DeleteDTO;
4 | import com.ouc.usedbook.dto.UsedbookDTO;
5 | import com.ouc.usedbook.entity.Usedbook;
6 | import com.ouc.usedbook.service.UsedbookService;
7 | import com.ouc.usedbook.util.Response;
8 | import io.swagger.annotations.ApiOperation;
9 | import org.springframework.web.bind.annotation.*;
10 |
11 | /**
12 | * @author 孙浩杰
13 | * @version 1.0
14 | * @description TODO
15 | * @date 2020/6/2 9:28
16 | */
17 | @RestController
18 | @CrossOrigin("*")
19 | @RequestMapping("/usedbook")
20 | public class UsedbookController {
21 |
22 | final UsedbookService usedbookService;
23 |
24 | public UsedbookController(UsedbookService usedbookService) {
25 | this.usedbookService = usedbookService;
26 | }
27 |
28 | @ApiOperation(value = "二手书列表", notes = "获取所有二手书列表", httpMethod = "GET")
29 | @GetMapping("/list")
30 | Response allUsedbookList() {
31 | return Response.ok(usedbookService.findAll());
32 | }
33 |
34 | @ApiOperation(value = "用户二手书列表", notes = "根据用户的id获取其出售的所有二手书列表", httpMethod = "GET")
35 | @GetMapping("/user/{uid}")
36 | Response userUsedbookList(@PathVariable Long uid) {
37 | return Response.ok(usedbookService.findByUid(uid));
38 | }
39 |
40 | @ApiOperation(value = "二手书详情", notes = "根据二手书的bid获取详细的二手书信息", httpMethod = "GET")
41 | @GetMapping("/{bid}")
42 | Response get(@PathVariable Long bid) {
43 | return Response.ok(usedbookService.findByBid(bid));
44 | }
45 |
46 | @ApiOperation(value = "删除二手书", notes = "用户删除待售书二手书信息", httpMethod = "POST")
47 | @PostMapping("/delete")
48 | Response delete(@RequestBody DeleteDTO deleteDTO) {
49 | usedbookService.delete(deleteDTO.getBid());
50 | return Response.ok("delete success", null);
51 | }
52 |
53 | @ApiOperation(value = "添加二手书", notes = "用户上传待售书二手书信息", httpMethod = "POST")
54 | @PostMapping("/add")
55 | Response add(@RequestBody UsedbookDTO usedbookDTO) {
56 | Usedbook usedbook = usedbookDTO.toUsedbook("");
57 | return Response.ok(usedbookService.add(usedbook));
58 | }
59 |
60 | @ApiOperation(value = "更新二手书", notes = "用户更新待售书二手书信息", httpMethod = "POST")
61 | @PostMapping("/update")
62 | Response update(@RequestBody UsedbookDTO usedbookDTO) {
63 | Usedbook usedbook = usedbookDTO.toUsedbook("");
64 | return Response.ok(usedbookService.update(usedbook));
65 | }
66 |
67 | }
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.controller;
2 |
3 | import com.ouc.usedbook.dto.LoginDTO;
4 | import com.ouc.usedbook.dto.RegisterDTO;
5 | import com.ouc.usedbook.entity.User;
6 | import com.ouc.usedbook.service.UserService;
7 | import com.ouc.usedbook.util.Response;
8 | import io.swagger.annotations.ApiOperation;
9 | import org.springframework.web.bind.annotation.*;
10 |
11 | import java.util.Optional;
12 |
13 | /**
14 | * @author 孙浩杰
15 | * @version 1.0
16 | * @description 用户控制器
17 | * @date 2020/5/31 21:55
18 | */
19 | @RestController
20 | @CrossOrigin("*")
21 | @RequestMapping("user")
22 | public class UserController {
23 | final UserService userService;
24 |
25 | public UserController(UserService userService) {
26 | this.userService = userService;
27 | }
28 |
29 | @ApiOperation(value = "用户登录", notes = "用户通过账号和密码登录", httpMethod = "POST")
30 | @PostMapping("/login")
31 | public Response login(@RequestBody LoginDTO loginDTO) {
32 | User user = userService.login(loginDTO.getMail(), loginDTO.getPassword());
33 | if (null == user) {
34 | return Response.forbidden(null);
35 | } else {
36 | return Response.ok(user);
37 | }
38 | }
39 |
40 | @ApiOperation(value = "用户注册", notes = "用户通过用户信息注册账号", httpMethod = "POST")
41 | @PostMapping("/register")
42 | public Response register(@RequestBody RegisterDTO registerDTO) {
43 | User user = userService.add(registerDTO.toUser());
44 | if (null == user){
45 | return Response.forbidden("wrong info about register");
46 | }else{
47 | return Response.ok(user);
48 | }
49 | }
50 |
51 | @ApiOperation(value = "获取用户信息", notes = "根据用户id获取用户相关信息", httpMethod = "GET")
52 | @GetMapping("/{uid}")
53 | public Response userInfo(@PathVariable Long uid) {
54 | Optional user = userService.get(uid);
55 | return user.map(Response::ok).orElseGet(() -> Response.notfound(uid));
56 | }
57 |
58 | @ApiOperation(value = "更新用户信息[未实现]", notes = "根据用户id修改用户相关信息", httpMethod = "POST")
59 | @PostMapping("/{uid}")
60 | public Response update(@PathVariable String uid, @RequestBody RegisterDTO registerDTO){
61 | return Response.ok(null);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/dto/CommentDTO.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.dto;
2 |
3 | import com.ouc.usedbook.entity.Comment;
4 | import lombok.Data;
5 |
6 | import java.sql.Date;
7 |
8 | /**
9 | * @author 孙浩杰
10 | * @version 1.0
11 | * @description TODO
12 | * @date 2020/6/2 10:39
13 | */
14 | @Data
15 | public class CommentDTO {
16 | Long uid;
17 | Long bid;
18 | String content;
19 |
20 | public Comment toComment(){
21 | Comment comment = new Comment();
22 | comment.setUid(this.uid);
23 | comment.setBid(this.bid);
24 | comment.setContent(this.content);
25 | comment.setDate(new Date(System.currentTimeMillis()));
26 | return comment;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/dto/CommentViewDTO.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.dto;
2 |
3 | import lombok.Data;
4 | import lombok.NoArgsConstructor;
5 |
6 | import java.util.Date;
7 |
8 | /**
9 | * @author 孙浩杰
10 | * @version 1.0
11 | * @description TODO
12 | * @date 2020/6/17 0:58
13 | */
14 | @Data
15 | @NoArgsConstructor
16 | public class CommentViewDTO {
17 | String username;
18 | String college;
19 | String major;
20 | String message;
21 | String date;
22 | }
23 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/dto/DeleteDTO.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.dto;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author 孙浩杰
7 | * @version 1.0
8 | * @description TODO
9 | * @date 2020/6/2 10:29
10 | */
11 | @Data
12 | public class DeleteDTO {
13 | Long bid;
14 | Long uid;
15 | }
16 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/dto/LoginDTO.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.dto;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * 登录dto
7 | *
8 | * @author 孙浩杰
9 | * @version 1.0
10 | * @description TODO
11 | * @date 2020/5/31 22:18
12 | */
13 | @Data
14 | public class LoginDTO {
15 | String mail;
16 | String password;
17 | }
18 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/dto/RegisterDTO.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.dto;
2 |
3 | import com.ouc.usedbook.entity.User;
4 | import lombok.Data;
5 |
6 | /**
7 | * 注册dto
8 | *
9 | * @author 孙浩杰
10 | * @version 1.0
11 | * @description TODO
12 | * @date 2020/6/2 9:13
13 | */
14 | @Data
15 | public class RegisterDTO {
16 | String username;
17 | String password;
18 | String mail;
19 | String tel;
20 | String college;
21 | String major;
22 | String year;
23 |
24 | public User toUser(){
25 | User user = new User();
26 | user.setUsername(this.username);
27 | user.setPassword(this.password);
28 | user.setMail(this.mail);
29 | user.setTel(this.tel);
30 | user.setCollege(this.college);
31 | user.setMajor(this.major);
32 | user.setYear(this.year);
33 | return user;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/dto/UsedbookDTO.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.dto;
2 |
3 | import com.ouc.usedbook.entity.Usedbook;
4 | import lombok.Data;
5 | import org.springframework.web.multipart.MultipartFile;
6 |
7 | /**
8 | * @author 孙浩杰
9 | * @version 1.0
10 | * @description TODO
11 | * @date 2020/6/2 10:14
12 | */
13 | @Data
14 | public class UsedbookDTO {
15 | private Long uid;
16 | private String bookname;
17 | private Double price;
18 | private String author;
19 | private String publisher;
20 | private String recency;
21 | private String coverimg;
22 | private String note;
23 |
24 | public Usedbook toUsedbook(String coverImg) {
25 | Usedbook usedbook = new Usedbook();
26 | usedbook.setBookname(bookname);
27 | usedbook.setPrice(price);
28 | usedbook.setAuthor(author);
29 | usedbook.setPublisher(publisher);
30 | usedbook.setRecency(recency);
31 | usedbook.setNote(note);
32 | usedbook.setCoverimg(coverImg);
33 |
34 | return usedbook;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/entity/Comment.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.entity;
2 | import com.ouc.usedbook.dto.CommentDTO;
3 | import lombok.Data;
4 | import lombok.NoArgsConstructor;
5 |
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 | import java.sql.Date;
11 |
12 | /**
13 | * 评论
14 | *
15 | * @author 孙浩杰
16 | * @date 2020/06/01
17 | */
18 | @Entity
19 | @Data
20 | @NoArgsConstructor
21 | public class Comment {
22 | @Id
23 | @GeneratedValue(strategy = GenerationType.IDENTITY)
24 | private long id;
25 | private long uid;
26 | private long bid;
27 | private Date date;
28 | private String content;
29 | }
30 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/entity/Usedbook.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.entity;
2 |
3 | import lombok.Data;
4 | import lombok.NoArgsConstructor;
5 |
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 |
11 | /**
12 | * usedbook
13 | *
14 | * @author 孙浩杰
15 | * @date 2020/06/01
16 | */
17 | @Entity
18 | @Data
19 | @NoArgsConstructor
20 | public class Usedbook {
21 | @Id
22 | @GeneratedValue(strategy = GenerationType.IDENTITY)
23 | private long id;
24 | private long uid;
25 | private String bookname;
26 | private double price;
27 | private String author;
28 | private String publisher;
29 | private String recency;
30 | private String coverimg;
31 | private String note;
32 | }
33 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/entity/User.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.entity;
2 |
3 | import lombok.Data;
4 | import lombok.NoArgsConstructor;
5 |
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 |
11 | /**
12 | * @author 孙浩杰
13 | * @version 1.0
14 | * @description TODO
15 | * @date 2020/5/31 22:21
16 | */
17 | @Entity
18 | @Data
19 | @NoArgsConstructor
20 | public class User {
21 | @Id
22 | @GeneratedValue(strategy = GenerationType.IDENTITY)
23 | Long id;
24 | String username;
25 | String password;
26 | String mail;
27 | String tel;
28 | String college;
29 | String major;
30 | String year;
31 | }
32 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/repository/CommentRepository.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.repository;
2 |
3 | import com.ouc.usedbook.entity.Comment;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.data.jpa.repository.Query;
6 |
7 | import java.util.ArrayList;
8 |
9 | /**
10 | * @author 孙浩杰
11 | * @version 1.0
12 | * @description TODO
13 | * @date 2020/6/1 23:12
14 | */
15 | public interface CommentRepository extends JpaRepository {
16 | /**
17 | * 通过书籍的Id查找对于评论
18 | *
19 | * @param bid 报价
20 | * @return {@link ArrayList}
21 | */
22 | @Query
23 | public ArrayList findByBid(Long bid);
24 | }
25 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/repository/UsedbookRepository.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.repository;
2 |
3 | import com.ouc.usedbook.entity.Usedbook;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.data.jpa.repository.Query;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author 孙浩杰
11 | * @version 1.0
12 | * @description TODO
13 | * @date 2020/6/1 23:09
14 | */
15 | public interface UsedbookRepository extends JpaRepository {
16 | /**
17 | * 根据uid找到所有对应的二手书列表
18 | *
19 | * @param uid 用户id
20 | * @return {@link List}
21 | */
22 | @Query
23 | List findAllByUid(Long uid);
24 |
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/repository/UserRepository.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.repository;
2 |
3 | import com.ouc.usedbook.entity.User;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.data.jpa.repository.Query;
6 | import org.springframework.stereotype.Repository;
7 |
8 | /**
9 | * @author 孙浩杰
10 | * @version 1.0
11 | * @description TODO
12 | * @date 2020/5/31 22:29
13 | */
14 | @Repository
15 | public interface UserRepository extends JpaRepository {
16 | /**
17 | * 通过邮件和密码查找用户
18 | *
19 | * @param mail 邮件
20 | * @param password 密码
21 | * @return {@link User}
22 | */
23 | @Query
24 | public User findByMailAndPassword(String mail, String password);
25 | }
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/service/CommentService.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.service;
2 |
3 | import com.ouc.usedbook.dto.CommentViewDTO;
4 | import com.ouc.usedbook.entity.Comment;
5 | import com.ouc.usedbook.entity.User;
6 | import com.ouc.usedbook.repository.CommentRepository;
7 | import com.ouc.usedbook.repository.UserRepository;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.sql.Date;
11 | import java.util.ArrayList;
12 | import java.util.Optional;
13 |
14 | /**
15 | * @author 孙浩杰
16 | * @version 1.0
17 | * @description TODO
18 | * @date 2020/6/2 10:43
19 | */
20 | @Service
21 | public class CommentService {
22 | final CommentRepository commentRepository;
23 | final UserRepository userRepository;
24 |
25 | public CommentService(CommentRepository commentRepository, UserRepository userRepository) {
26 | this.commentRepository = commentRepository;
27 | this.userRepository = userRepository;
28 | }
29 |
30 | /**
31 | * 获取某二手书的所有评论
32 | *
33 | * @param bid 二手书id
34 | * @return {@link ArrayList}
35 | */
36 | public ArrayList get(Long bid){
37 | ArrayList comments = commentRepository.findByBid(bid);
38 | ArrayList commentViewDTOS = new ArrayList<>();
39 | for (Comment comment : comments) {
40 | CommentViewDTO commentViewDTO = new CommentViewDTO();
41 | commentViewDTO.setMessage(comment.getContent());
42 | commentViewDTO.setDate(comment.getDate().toString());
43 | Optional user = userRepository.findById(comment.getUid());
44 | user.ifPresent(presentUser -> {
45 | commentViewDTO.setUsername(presentUser.getUsername());
46 | commentViewDTO.setCollege(presentUser.getCollege());
47 | commentViewDTO.setMajor(presentUser.getMajor());
48 | });
49 | commentViewDTOS.add(commentViewDTO);
50 | }
51 | return commentViewDTOS;
52 | }
53 |
54 | /**
55 | * 添加评论,返回成功添加的评论的id
56 | *
57 | * @param comment 评论
58 | * @return long
59 | */
60 | public long add(Comment comment){
61 | comment.setDate(new Date(System.currentTimeMillis()));
62 | return commentRepository.save(comment).getId();
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/service/UsedbookService.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.service;
2 |
3 | import com.ouc.usedbook.entity.Usedbook;
4 | import com.ouc.usedbook.repository.UsedbookRepository;
5 | import org.springframework.stereotype.Service;
6 |
7 | import java.util.List;
8 | import java.util.Optional;
9 |
10 | /**
11 | * @author 孙浩杰
12 | * @version 1.0
13 | * @description TODO
14 | * @date 2020/6/2 12:44
15 | */
16 | @Service
17 | public class UsedbookService {
18 |
19 | final UsedbookRepository usedbookRepository;
20 |
21 | public UsedbookService(UsedbookRepository usedbookRepository) {
22 | this.usedbookRepository = usedbookRepository;
23 | }
24 |
25 | public List findAll() {
26 | return usedbookRepository.findAll();
27 | }
28 |
29 | public Optional findByBid(Long bid) {
30 | return usedbookRepository.findById(bid);
31 | }
32 |
33 | public List findByUid(Long uid) {
34 | return usedbookRepository.findAllByUid(uid);
35 | }
36 |
37 | public Usedbook add(Usedbook usedbook){
38 | return usedbookRepository.saveAndFlush(usedbook);
39 | }
40 |
41 | public void delete(Long bid){
42 | usedbookRepository.deleteById(bid);
43 | }
44 |
45 | public Usedbook update(Usedbook usedbook){
46 | return usedbookRepository.saveAndFlush(usedbook);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.service;
2 |
3 | import com.ouc.usedbook.entity.User;
4 | import com.ouc.usedbook.repository.UserRepository;
5 | import org.springframework.stereotype.Service;
6 |
7 | import java.util.Optional;
8 |
9 | /**
10 | * @author 孙浩杰
11 | * @version 1.0
12 | * @description TODO
13 | * @date 2020/6/2 12:45
14 | */
15 | @Service
16 | public class UserService {
17 | final UserRepository userRepository;
18 |
19 | public UserService(UserRepository userRepository) {
20 | this.userRepository = userRepository;
21 | }
22 |
23 | public Optional get(Long uid) {
24 | return userRepository.findById(uid);
25 | }
26 |
27 | public User add(User user){
28 | return userRepository.save(user);
29 | }
30 |
31 | public User login(String mail, String password){
32 | return userRepository.findByMailAndPassword(mail, password);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/server/src/main/java/com/ouc/usedbook/util/Response.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.util;
2 |
3 | import io.swagger.annotations.ApiModel;
4 | import io.swagger.models.auth.In;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * 统一响应类
10 | *
11 | * @author 孙浩杰
12 | * @version 1.0
13 | * @description TODO
14 | * @date 2020/6/1 21:34
15 | */
16 | @Data
17 | @NoArgsConstructor
18 | public class Response {
19 | private static final Integer OK = 200;
20 | private static final Integer FORBIDDEN = 403;
21 | private static final Integer NOT_FOUND = 404;
22 | private static final Integer SERVER_ERROR = 500;
23 |
24 | private Integer code;
25 | private String msg;
26 | private Object data;
27 |
28 | public Response(Integer code, String msg, Object data){
29 | this.code = code;
30 | this.msg = msg;
31 | this.data = data;
32 | }
33 |
34 | public static Response ok(String msg, Object data){
35 | return new Response(OK, msg, data);
36 | }
37 |
38 | public static Response ok(Object data){
39 | return new Response(OK, "success", data);
40 | }
41 |
42 | public static Response error(Object data){
43 | return new Response(SERVER_ERROR, "server error", data);
44 | }
45 |
46 | public static Response forbidden(Object data){
47 | return new Response(FORBIDDEN, "forbidden", data);
48 | }
49 |
50 | public static Response notfound(Object data){
51 | return new Response(NOT_FOUND, "not found", data);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/server/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/server/src/main/resources/application.properties
--------------------------------------------------------------------------------
/server/src/main/resources/static/cover/cyuyan.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/server/src/main/resources/static/cover/cyuyan.jpg
--------------------------------------------------------------------------------
/server/src/main/resources/static/cover/czxt.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/server/src/main/resources/static/cover/czxt.jpg
--------------------------------------------------------------------------------
/server/src/main/resources/static/cover/rjjh.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/server/src/main/resources/static/cover/rjjh.jpg
--------------------------------------------------------------------------------
/server/src/main/resources/static/cover/shjk.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunshine2285/used-books-market-miniProgram/fe3ad7855bd05d354751af9082a00413254bbe62/server/src/main/resources/static/cover/shjk.jpg
--------------------------------------------------------------------------------
/server/src/test/java/com/ouc/usedbook/UsedbookApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class UsedbookApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/server/src/test/java/com/ouc/usedbook/repository/UserRepositoryTest.java:
--------------------------------------------------------------------------------
1 | package com.ouc.usedbook.repository;
2 |
3 | import com.ouc.usedbook.entity.User;
4 | import org.junit.jupiter.api.Test;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.boot.test.context.SpringBootTest;
7 |
8 | /**
9 | * @author 孙浩杰
10 | * @version 1.0
11 | * @description TODO
12 | * @date 2020/5/31 22:30
13 | */
14 | @SpringBootTest
15 | public class UserRepositoryTest {
16 | @Autowired
17 | UserRepository userRepository;
18 |
19 | @Test
20 | void select() {
21 | System.out.println(userRepository.findAll());
22 | }
23 |
24 | @Test
25 | void save() {
26 | User user = new User();
27 | user.setUsername("xiaoxiao");
28 | user.setPassword("123456");
29 | user.setTel("17686523750");
30 | user.setCollege("信息学院");
31 | user.setMajor("计算机");
32 | user.setYear("2018");
33 | user.setMail("sunshine2285@163.com");
34 | System.out.println(userRepository.save(user));
35 | }
36 | }
37 |
--------------------------------------------------------------------------------