Compare commits

...

23 Commits
dev ... main

@ -1,2 +1,45 @@
# CampusDelivery
123
#### 简介
校惠递是一个面向中航大学生的C2C互助跑腿微信小程序
#### 功能
1. 注册:用户首次使用时需要使用学号和姓名并上传校园卡进行验证,只有人证一致才能成功注册;
2. 发单:目前用户可以发布订单、包括代取快递、取外卖及其他自定义跑腿任务;
3. 接单:用户可以在接单页查看目前有哪些任务可以接取;
4. 订单管理:订单页展示了用户所发布和接取的订单,对于还未接单的订单,用户可以取消,已接单的订单,用户可以在骑手确认送达后支付并确认收货;
5. 问题与反馈用户可以通过骑手或发单人的Id号对有问题的订单进行反馈反馈成功后可扣除对方部分信誉分。
#### 环境要求
[微信开发者工具]
#### 在本地部署
1. 在开发工具创建自己的小程序项目;
2. 将miniprogram文件夹替换为该项目的miniprogram文件夹
3. 重新用开发工具打开项目。
#### 云开发
1. 该小程序使用了微信官方提供的云开发功能,包括云函数与云数据库;
2. 云函数相关代码位于cloudfunctions文件夹内云数据库的两个集合名为“order”和“user_info”
3. 如需完整部署该小程序,需要开启小程序云开发功能,并创建相应的云函数和云数据库;
4. 具体可参考[小程序云开发文档]。
#### License
[GPLv3]
#### 项目所使用到的第三方开源组件/库
```
iview-weapp (MIT) https://github.com/TalkingData/iview-weapp
Wux-Weapp (MIT) https://github.com/wux-weapp/wux-weapp/
```
[GPLv3]: https://github.com/Fewing/buaa_takeaway/blob/master/LICENSE
[微信开发者工具]: https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html
[小程序云开发文档]: https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html

@ -1 +0,0 @@
1

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

16
src/.gitignore vendored

@ -0,0 +1,16 @@
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/
project.config.json
project.config.json

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

@ -0,0 +1,44 @@
#### 简介
校惠递是一个面向中航大学生的C2C互助跑腿微信小程序
#### 功能
1. 注册:用户首次使用时需要使用学号和姓名并上传校园卡进行验证,只有人证一致才能成功注册;
2. 发单:目前用户可以发布打饭和取快递两种跑腿任务,或者发布自定义任务;
3. 接单:用户可以在接单页查看目前有哪些任务可以接取;
4. 订单管理:订单页展示了用户所发布和接取的订单,对于还未接单的订单,用户可以取消,已接单的订单,用户可以在骑手确认送达后支付确认收货,
5. 问题与反馈用户可以通过Id举报骑手或发单者对有问题的单子进行举报在审核通过后将扣除被举报人的信誉分。
#### 环境要求
[微信开发者工具]
#### 在本地部署
1. 在开发工具创建自己的小程序项目;
2. 将miniprogram文件夹替换为该项目的miniprogram文件夹
3. 重新用开发工具打开项目。
#### 云开发
1. 该小程序使用了微信官方提供的云开发功能,包括云函数与云数据库;
2. 云函数相关代码位于cloudfunctions文件夹内云数据库的两个集合名为“order”和“user_info”
3. 如需完整部署该小程序,需要开启小程序云开发功能,并创建相应的云函数和云数据库;
4. 具体可参考[小程序云开发文档]。
#### License
[GPLv3]
#### 项目所使用到的第三方开源组件/库
```
iview-weapp (MIT) https://github.com/TalkingData/iview-weapp
Wux-Weapp (MIT) https://github.com/wux-weapp/wux-weapp/
```
[GPLv3]: https://github.com/Fewing/buaa_takeaway/blob/master/LICENSE
[微信开发者工具]: https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html
[小程序云开发文档]: https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html

@ -0,0 +1,41 @@
// 云函数入口文件
//获取推送token
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
const _ = db.command
var access_token
var request = require('request')
// 云函数入口函数
exports.main = async (event, context) => {
/*var e = await db.collection('order').where({
_id: event.id
})
.update({
data: {
status: event.userInfo.openId
},
})
var e = await db.collection('order').doc(event.id).get()
await cloud.callFunction({
name: 'sendmessage',
data: {
order: e,
}
})*/
var err
var resp
var body
return new Promise((resolve, reject) => {
try {
request('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx0a053365786e17f8&secret=f938a9bbc142010255ad84bd66fbc166', (err, resp, body) => {
if (err) {
return reject(err)
}
return resolve(body)
})
} catch (e) {
return reject(err)
}
})
}

@ -0,0 +1,14 @@
{
"name": "get",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

@ -0,0 +1,174 @@
// cloudfunctions/login/index.js
const cloud = require('wx-server-sdk')
cloud.init({
env: 'cloud1-0gtigwg3df80d098'
})
// 生成数字ID的函数 - 基于user_info集合
async function generateUserId(db) {
try {
// 获取当前最大的用户ID
const maxUserRes = await db.collection('user_info')
.orderBy('userId', 'desc')
.limit(1)
.get()
let maxUserId = 10000; // 起始ID
if (maxUserRes.data.length > 0 && maxUserRes.data[0].userId) {
maxUserId = maxUserRes.data[0].userId;
}
// 返回下一个ID
return maxUserId + 1;
} catch (error) {
console.error('生成用户ID失败:', error);
// 如果出错返回一个基于时间的ID作为fallback
return Math.floor(Date.now() / 1000) % 100000 + 10000;
}
}
// 处理用户数字ID分配
async function handleUserNumber(db, openid, userInfo) {
try {
// 检查用户是否已存在
const userRes = await db.collection('user_info').where({
_openid: openid
}).get()
let userId
let userNumber
let userData
if (userRes.data.length === 0) {
// 新用户生成数字ID
userId = await generateUserId(db)
userNumber = userId.toString().padStart(4, '0')
// 创建用户记录
userData = {
_openid: openid,
userId: userId,
userNumber: userNumber,
userInfo: userInfo || {},
creditScore: 100,
createTime: db.serverDate(),
updateTime: db.serverDate()
}
await db.collection('user_info').add({
data: userData
})
console.log('新用户注册分配数字ID:', userNumber)
} else {
// 老用户,使用现有数据
userData = userRes.data[0]
userId = userData.userId
userNumber = userData.userNumber || (userId ? userId.toString().padStart(4, '0') : '0000')
// 如果老用户没有数字ID为其分配一个
if (!userData.userId) {
userId = await generateUserId(db)
userNumber = userId.toString().padStart(5, '0')
await db.collection('user_info').doc(userData._id).update({
data: {
userId: userId,
userNumber: userNumber,
updateTime: db.serverDate()
}
})
console.log('老用户分配数字ID:', userNumber)
}
// 更新用户信息(如果需要)
if (userInfo && Object.keys(userInfo).length > 0) {
await db.collection('user_info').doc(userData._id).update({
data: {
userInfo: userInfo,
updateTime: db.serverDate()
}
})
}
}
return {
userId: userId,
userNumber: userNumber,
userData: userData
}
} catch (error) {
console.error('处理用户数字ID失败:', error)
// 如果出错,返回默认值,不影响登录流程
return {
userId: null,
userNumber: '0000',
userData: null
}
}
}
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
const db = cloud.database()
const openid = wxContext.OPENID
console.log('=== login云函数执行 ===')
console.log('openid:', openid)
try {
// 处理用户数字ID
const userNumberResult = await handleUserNumber(db, openid, event.userInfo)
// 检查用户的认证状态
const authRes = await db.collection('user_auth').where({
_openid: openid
}).get()
console.log('登录时认证状态检查:', authRes)
let authStatus = 'none'
let authData = null
if (authRes.data.length > 0) {
authData = authRes.data[0]
authStatus = authData.status
}
// 可选:记录用户登录信息(用于后续分析)
try {
await db.collection('user_login_log').add({
data: {
_openid: openid,
loginTime: new Date(),
authStatus: authStatus,
userNumber: userNumberResult.userNumber,
userInfo: event.userInfo || {}
}
})
} catch (logError) {
console.warn('记录登录日志失败:', logError)
// 不影响主要登录流程
}
return {
success: true,
openid: openid,
userId: userNumberResult.userId,
userNumber: userNumberResult.userNumber,
userInfo: event.userInfo || {},
authStatus: authStatus,
authData: authData,
creditScore: userNumberResult.userData?.creditScore || 100,
message: '登录成功'
}
} catch (error) {
console.error('login云函数错误:', error)
return {
success: false,
error: '登录失败: ' + error.message
}
}
}

@ -0,0 +1,14 @@
{
"name": "login",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

@ -0,0 +1,478 @@
// cloudfunctions/order/index.js
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
})
const db = cloud.database()
// 获取天气加价信息 - 调用您的后端API
async function getWeatherPricing() {
try {
// 使用云函数调用您的天气API
const result = await cloud.callFunction({
name: 'httpRequest',
data: {
url: 'http://10.8.85.183:5000/api/weather/current',
method: 'GET'
}
})
if (result.result && result.result.success) {
const pricingInfo = result.result.pricing_info
return {
surcharge: pricingInfo.weather_surcharge || 0,
message: pricingInfo.message || "天气良好,无额外费用",
basePrice: pricingInfo.base_price || 2.0,
success: true
}
} else {
throw new Error('天气API返回失败')
}
} catch (err) {
console.error('获取天气定价失败:', err)
// 失败时返回默认值
return {
surcharge: 0,
message: "天气良好,无额外费用",
basePrice: 2.0,
success: false
}
}
}
// 计算订单价格
function calculatePrice(basePrice, isUrgent, urgentTip, weatherSurcharge, count) {
let total = parseFloat(basePrice) || 0
// 加急费用
if (isUrgent) {
total += parseFloat(urgentTip) || 0
}
// 天气加价
total += parseFloat(weatherSurcharge) || 0
// 根据物品数量调整价格
const itemCount = (count.small || 0) + (count.medium || 0) + (count.large || 0) + (count.xlarge || 0)
if (itemCount > 3) {
total += (itemCount - 3) * 1.0 // 超过3件每件加1元
}
return Math.max(total, 0).toFixed(2)
}
// 计算基础价格(基于物品数量)
function calculateBasePrice(count, basePricePerItem = 2.0) {
const itemCount = (count.small || 0) + (count.medium || 0) + (count.large || 0) + (count.xlarge || 0)
return itemCount * basePricePerItem
}
exports.main = async (event, context) => {
const { action, data } = event
switch (action) {
case 'createOrder':
return await createOrder(data)
case 'getWeatherPricing':
return await getWeatherPricing()
case 'calculatePrice':
return {
success: true,
price: calculatePrice(
data.basePrice,
data.isUrgent,
data.urgentTip,
data.weatherSurcharge,
data.count
)
}
case 'calculateTotalPrice':
return await calculateTotalPrice(data)
case 'takeOrder':
return await takeOrder(data)
case 'completeOrder': // 新增确认完成功能
return await completeOrder(data)
case 'verifyOfflinePayment':
return await verifyOfflinePayment(data)
default:
return {
success: false,
message: '未知操作'
}
}
}
// 新增确认完成函数
async function completeOrder(data) {
const { orderId } = data
const { OPENID } = cloud.getWXContext()
console.log('确认完成请求:', { orderId, OPENID })
try {
// 先检查订单是否存在且状态为进行中
const orderRes = await db.collection('order').doc(orderId).get()
const order = orderRes.data
if (!order) {
return {
success: false,
message: '订单不存在'
}
}
// 检查是否是接单人
if (order.taker_openid !== OPENID) {
return {
success: false,
message: '只有接单人才能确认完成'
}
}
// 检查订单状态
if (order.status !== '1') {
return {
success: false,
message: '订单状态不正确'
}
}
if (order.complete === '1') {
return {
success: false,
message: '订单已完成'
}
}
// 执行确认完成操作
const updateRes = await db.collection('order').doc(orderId).update({
data: {
complete: '1',
complete_time: db.serverDate()
}
})
console.log('确认完成数据库操作结果:', updateRes)
if (updateRes.stats.updated > 0) {
return {
success: true,
message: '确认完成成功',
orderId: orderId
}
} else {
return {
success: false,
message: '确认完成失败,请重试'
}
}
} catch (err) {
console.error('确认完成云函数错误:', err)
return {
success: false,
message: '确认完成失败: ' + err.message
}
}
}
// 新增接单函数
async function takeOrder(data) {
const { orderId } = data
const { OPENID } = cloud.getWXContext()
console.log('接单请求:', { orderId, OPENID })
try {
// 先检查订单是否存在且状态为待接单
const orderRes = await db.collection('order').doc(orderId).get()
const order = orderRes.data
if (!order) {
return {
success: false,
message: '订单不存在'
}
}
if (order.status !== '0') {
return {
success: false,
message: '订单已被接取'
}
}
if (order._openid === OPENID) {
return {
success: false,
message: '不能接取自己发布的订单'
}
}
// 执行接单操作
const updateRes = await db.collection('order').doc(orderId).update({
data: {
status: '1',
taker_openid: OPENID,
accept_time: db.serverDate()
}
})
if (updateRes.stats.updated > 0) {
return {
success: true,
message: '接单成功',
orderId: orderId
}
} else {
return {
success: false,
message: '接单失败'
}
}
} catch (err) {
console.error('接单云函数错误:', err)
return {
success: false,
message: '接单失败: ' + err.message
}
}
}
// 计算总价格(包含天气加价)
async function calculateTotalPrice(orderData) {
try {
// 获取天气定价信息
const weatherPricing = await getWeatherPricing()
// 计算基础价格
const basePrice = calculateBasePrice(orderData.count, weatherPricing.basePrice)
// 计算总价格
const totalPrice = calculatePrice(
basePrice,
orderData.isUrgent,
orderData.urgentTip,
weatherPricing.surcharge,
orderData.count
)
return {
success: true,
basePrice: basePrice,
weatherSurcharge: weatherPricing.surcharge,
totalPrice: totalPrice,
message: weatherPricing.message,
weatherInfo: weatherPricing
}
} catch (error) {
console.error('计算总价格失败:', error)
return {
success: false,
message: '价格计算失败'
}
}
}
// 创建订单
async function createOrder(orderData) {
try {
// 在创建订单前计算最终价格(包含天气加价)
const priceResult = await calculateTotalPrice(orderData)
if (!priceResult.success) {
return {
success: false,
message: '价格计算失败,无法创建订单'
}
}
const result = await db.collection('order').add({
data: {
...orderData,
basePrice: priceResult.basePrice, // 基础价格
weatherSurcharge: priceResult.weatherSurcharge, // 天气加价
fee: priceResult.totalPrice, // 总费用
weatherMessage: priceResult.message, // 天气信息
createtime: db.serverDate(),
status: '0', // 待接单
complete: '0', // 未完成
paid: '0', // 未支付
orderNumber: generateOrderNumber()
}
})
return {
success: true,
orderId: result._id,
message: '订单创建成功',
priceInfo: {
basePrice: priceResult.basePrice,
weatherSurcharge: priceResult.weatherSurcharge,
totalPrice: priceResult.totalPrice
}
}
} catch (err) {
console.error('创建订单失败:', err)
return {
success: false,
message: '订单创建失败'
}
}
}
// 生成订单号
function generateOrderNumber() {
const date = new Date()
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
const random = Math.random().toString(36).substr(2, 6).toUpperCase()
return `ORDER${year}${month}${day}${hours}${minutes}${seconds}${random}`
}
// 线下支付验证函数
async function verifyOfflinePayment(data) {
const { orderId, paymentCode, role } = data
const { OPENID } = cloud.getWXContext()
console.log('线下支付验证请求:', { orderId, paymentCode, role, OPENID })
try {
// 获取订单信息
const orderRes = await db.collection('order').doc(orderId).get()
const order = orderRes.data
if (!order) {
return {
success: false,
message: '订单不存在'
}
}
// 检查订单是否已完成但未支付
if (order.complete !== '1') {
return {
success: false,
message: '订单未完成,无法支付'
}
}
if (order.paid === '1') {
return {
success: false,
message: '订单已支付'
}
}
// 权限检查:发单人只能验证自己发布的订单,接单人只能验证自己接单的订单
if (role === 'publisher') {
if (order._openid !== OPENID) {
return {
success: false,
message: '只能验证自己发布的订单'
}
}
} else if (role === 'taker') {
if (order.taker_openid !== OPENID) {
return {
success: false,
message: '只能验证自己接单的订单'
}
}
} else {
return {
success: false,
message: '无效的角色'
}
}
// 验证支付交易号
if (!paymentCode || paymentCode.trim().length === 0) {
return {
success: false,
message: '请输入有效的交易订单号'
}
}
// 检查交易号长度和格式(基础验证)
const trimmedCode = paymentCode.trim()
if (trimmedCode.length < 6) {
return {
success: false,
message: '交易订单号格式不正确'
}
}
// 根据角色保存交易号到不同字段
const updateData = {
paymentTime: db.serverDate(),
offlinePayRole: role,
paymentMethod: 'offline'
}
if (role === 'publisher') {
updateData.publisherPaymentCode = trimmedCode
updateData.publisherSubmitTime = db.serverDate()
} else if (role === 'taker') {
updateData.takerPaymentCode = trimmedCode
updateData.takerSubmitTime = db.serverDate()
}
// 检查是否双方都已提交交易号
const hasPublisherCode = order.publisherPaymentCode || updateData.publisherPaymentCode
const hasTakerCode = order.takerPaymentCode || updateData.takerPaymentCode
let paymentVerified = false
let message = '交易号已提交,等待对方验证'
if (hasPublisherCode && hasTakerCode) {
// 双方都已提交,检查交易号是否一致
const publisherCode = updateData.publisherPaymentCode || order.publisherPaymentCode
const takerCode = updateData.takerPaymentCode || order.takerPaymentCode
if (publisherCode === takerCode) {
// 交易号一致,完成订单
updateData.paid = '1'
updateData.paymentCode = publisherCode // 保存最终确认的交易号
updateData.paymentVerifiedTime = db.serverDate()
paymentVerified = true
message = '支付验证成功,订单已完成'
} else {
// 交易号不一致
message = '交易号不一致,请与对方确认后重新提交'
}
}
// 更新订单
const updateRes = await db.collection('order').doc(orderId).update({
data: updateData
})
console.log('线下支付验证数据库操作结果:', updateRes)
if (updateRes.stats.updated > 0) {
return {
success: true,
paymentVerified: paymentVerified,
message: message,
orderId: orderId,
status: paymentVerified ? 'completed' : 'waiting'
}
} else {
return {
success: false,
message: '提交失败,请重试'
}
}
} catch (err) {
console.error('线下支付验证云函数错误:', err)
return {
success: false,
message: '支付验证失败: ' + err.message
}
}
}

@ -0,0 +1,9 @@
{
"name": "order",
"version": "1.0.0",
"description": "订单管理云函数",
"main": "index.js",
"dependencies": {
"wx-server-sdk": "~2.6.3"
}
}

@ -0,0 +1,195 @@
const cloud = require('wx-server-sdk')
cloud.init({
env: 'cloud1-0gtigwg3df80d098'
})
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
const openid = wxContext.OPENID
const db = cloud.database()
console.log('=== regist云函数执行 ===')
console.log('action:', event.action)
console.log('openid:', openid)
try {
// 检查认证状态
if (event.action === 'checkAuthStatus') {
const authRes = await db.collection('user_auth').where({
_openid: openid
}).get()
console.log('查询认证记录:', authRes)
if (authRes.data.length > 0) {
return {
success: true,
data: authRes.data[0]
}
} else {
return {
success: true,
data: null
}
}
}
// 提交认证申请
if (event.action === 'submitAuth') {
// 验证必填字段
if (!event.name || !event.studentId || !event.idCard || !event.phone) {
return {
success: false,
error: '请填写完整的认证信息'
}
}
// 检查图片是否上传
if (!event.idCardFront || !event.idCardBack || !event.studentCard) {
return {
success: false,
error: '请上传所有必需的证明图片'
}
}
// 检查是否已经提交过认证
const existingAuth = await db.collection('user_auth').where({
_openid: openid
}).get()
console.log('现有认证记录:', existingAuth)
let result
if (existingAuth.data.length > 0) {
// 已有记录,更新现有认证
const existingRecord = existingAuth.data[0]
// 关键修改:只有在审核被拒绝后,用户才能重新提交
if (existingRecord.status === 'pending') {
return {
success: false,
error: '您已有认证申请正在审核中,请耐心等待'
}
}
if (existingRecord.status === 'approved') {
return {
success: false,
error: '您已通过认证,无需重复提交'
}
}
// 只有在状态为 rejected 时才能重新提交
if (existingRecord.status === 'rejected') {
result = await db.collection('user_auth').doc(existingRecord._id).update({
data: {
name: event.name,
student_id: event.studentId,
id_card: event.idCard,
phone: event.phone,
id_card_front: event.idCardFront,
id_card_back: event.idCardBack,
student_card: event.studentCard,
status: 'pending',
update_time: db.serverDate(),
submit_time: db.serverDate(),
review_time: null,
review_remark: ''
}
})
} else {
return {
success: false,
error: '当前状态不允许重新提交认证'
}
}
console.log('更新认证记录结果:', result)
} else {
// 新认证申请
const authData = {
_openid: openid,
name: event.name,
student_id: event.studentId,
id_card: event.idCard,
phone: event.phone,
id_card_front: event.idCardFront,
id_card_back: event.idCardBack,
student_card: event.studentCard,
status: 'pending',
create_time: db.serverDate(),
update_time: db.serverDate(),
submit_time: db.serverDate(),
review_time: null,
review_remark: ''
}
result = await db.collection('user_auth').add({
data: authData
})
console.log('新增认证记录结果:', result)
}
return {
success: true,
data: result,
message: '认证申请提交成功,请等待审核'
}
}
// 新增:管理员审核功能
if (event.action === 'reviewAuth') {
const { authId, status, remark } = event
// 验证参数
if (!authId || !status) {
return {
success: false,
error: '缺少必要参数'
}
}
// 验证状态值
if (!['approved', 'rejected'].includes(status)) {
return {
success: false,
error: '无效的状态值'
}
}
// 更新认证状态
const result = await db.collection('user_auth').doc(authId).update({
data: {
status: status,
review_remark: remark || '',
review_time: db.serverDate(),
update_time: db.serverDate()
}
})
console.log('审核操作结果:', result)
return {
success: true,
data: result,
message: status === 'approved' ? '认证已通过' : '认证已拒绝'
}
}
// 默认返回
return {
success: false,
error: '未知操作类型'
}
} catch (error) {
console.error('regist云函数错误:', error)
return {
success: false,
error: '服务器错误: ' + error.message
}
}
}

@ -0,0 +1,14 @@
{
"name": "regist",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.13 (delivery-pricing)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,17 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="3">
<item index="0" class="java.lang.String" itemvalue="django" />
<item index="1" class="java.lang.String" itemvalue="djangorestframework" />
<item index="2" class="java.lang.String" itemvalue="django-cors-headers" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.13 (delivery-pricing)" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/delivery-pricing.iml" filepath="$PROJECT_DIR$/.idea/delivery-pricing.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../" vcs="Git" />
</component>
</project>

@ -0,0 +1,93 @@
# app.py
from flask import Flask, request, jsonify
from flask_cors import CORS
from pricing_service import pricing_service
from weather_service import weather_api
import logging
from config import Config
app = Flask(__name__)
CORS(app)
@app.route('/')
def home():
return jsonify({
'message': '跑腿小程序天气定价API服务 - 天津',
'status': 'running',
'version': '1.0.0'
})
@app.route('/api/health', methods=['GET'])
def health_check():
return jsonify({
'status': 'healthy',
'timestamp': '服务运行正常'
})
@app.route('/api/weather/current', methods=['GET'])
def get_current_weather():
"""获取天津当前天气信息和定价"""
try:
weather_data = weather_api.get_current_weather()
if weather_data:
# 计算天气加价
surcharge, reasons = pricing_service.calculate_weather_surcharge(weather_data)
message = pricing_service.generate_price_message(weather_data['text'], surcharge)
return jsonify({
'success': True,
'location': '天津',
'weather': weather_data,
'pricing_info': {
'weather_surcharge': round(surcharge, 2),
'surcharge_reasons': reasons,
'message': message,
'base_price': Config.BASE_DELIVERY_PRICE
}
})
else:
return jsonify({
'success': False,
'error': '获取天气数据失败'
}), 500
except Exception as e:
return jsonify({
'success': False,
'error': f'服务器错误: {str(e)}'
}), 500
@app.route('/api/delivery/price', methods=['POST'])
def calculate_delivery_price():
"""计算天津配送价格"""
try:
data = request.get_json() or {}
distance_km = data.get('distance_km', 0)
result = pricing_service.get_delivery_price(distance_km)
return jsonify(result)
except Exception as e:
return jsonify({
'success': False,
'error': f'服务器错误: {str(e)}'
}), 500
if __name__ == '__main__':
print("启动跑腿小程序天气定价API服务...")
print(f"服务地址: http://{Config.FLASK_HOST}:{Config.FLASK_PORT}")
print("可用接口:")
print(" GET /api/health - 健康检查")
print(" GET /api/weather/current - 获取天津天气和定价")
print(" POST /api/delivery/price - 计算天津配送价格")
app.run(
host=Config.FLASK_HOST,
port=Config.FLASK_PORT,
debug=Config.DEBUG
)

@ -0,0 +1,17 @@
# config.py
class Config:
# 您的和风天气API配置
HEWEATHER_API_KEY = "f0e3796b356f4ab38a80d5ae22369fe9"
HEWEATHER_API_HOST = "kb4bjab87d.re.qweatherapi.com"
# 默认位置配置 - 直接使用城市ID
DEFAULT_LOCATION_ID = "101030100" # 天津的城市ID
# 定价配置
BASE_DELIVERY_PRICE = 2.0
MAX_WEATHER_SURCHARGE = 4.0
# 服务器配置
FLASK_HOST = "0.0.0.0"
FLASK_PORT = 5000
DEBUG = True

@ -0,0 +1,50 @@
# main.py
from weather_service import weather_api
from pricing_service import pricing_service
def main():
"""主函数 - 测试天津天气定价系统"""
print("=" * 50)
print("跑腿小程序天气定价系统 - 天津")
print("=" * 50)
# 1. 测试API连接
print("1. 测试天气API连接...")
if not weather_api.test_connection():
print("API测试失败请检查网络和API Key")
return
# 2. 测试不同距离的定价
print("2. 测试天津配送定价计算...")
test_distances = [0, 2, 5, 10]
for distance in test_distances:
print("=" * 30)
print(f"距离: {distance}公里")
print("=" * 30)
result = pricing_service.get_delivery_price(distance)
if result['success']:
weather = result['weather']
pricing = result['pricing_breakdown']
print(f"天气: {weather['condition']} {weather['temperature']}C")
print(f"风速: {weather['windSpeed']}km/h 湿度: {weather['humidity']}%")
print(f"基础价: {pricing['base_price']}")
print(f"天气加价: {pricing['weather_surcharge']}")
print(f"距离费用: {pricing['distance_fee']}")
print(f"总价格: {pricing['total_price']}")
print(f"加价原因: {', '.join(result['surcharge_reasons']) or ''}")
print(f"提示: {result['message']}")
else:
print(f"失败: {result['error']}")
print("=" * 50)
print("天津地区系统测试完成!")
print("=" * 50)
if __name__ == "__main__":
main()

@ -0,0 +1,140 @@
# pricing_service.py
from datetime import datetime
from weather_service import weather_api
from config import Config
class DeliveryPricingService:
def __init__(self):
self.base_price = Config.BASE_DELIVERY_PRICE
def calculate_weather_surcharge(self, weather_data):
"""根据天气数据计算加价"""
surcharge = 0.0
reasons = []
weather_text = weather_data['text']
temperature = int(weather_data['temp'])
wind_speed = int(weather_data['windSpeed'])
visibility = int(weather_data.get('vis', 10))
print(f"分析天气条件: {weather_text}, {temperature}C, {wind_speed}km/h, 能见度{visibility}km")
# 天气状况加价规则
weather_rules = [
(['暴雨', '大暴雨'], 2, "暴雨天气"),
(['大雪', '暴雪'], 1.75, "强降雪"),
(['', '小雨', '中雨'], 1, "降雨"),
([''], 1.25, "降雪"),
(['', '浓雾'], 0.5, "大雾天气"),
([''], 0.75, "雾霾天气"),
(['沙尘'], 1.25, "沙尘天气")
]
for conditions, price, reason in weather_rules:
if any(condition in weather_text for condition in conditions):
surcharge += price
reasons.append(reason)
print(f" {reason}: +{price}")
break
# 温度加价规则
if temperature >= 35:
surcharge += 1.0
reasons.append("高温")
print(f" 高温天气: +1.0元")
elif temperature >= 30:
surcharge += 0.5
reasons.append("炎热")
print(f" 炎热天气: +0.5元")
elif temperature <= -10:
surcharge += 1.25
reasons.append("严寒")
print(f" 严寒天气: +1.25元")
elif temperature <= 5:
surcharge += 0.75
reasons.append("低温")
print(f" 低温天气: +0.75元")
# 大风加价
if wind_speed >= 40:
surcharge += 1.0
reasons.append("大风")
print(f" 大风天气: +1.0元")
elif wind_speed >= 20:
surcharge += 0.5
reasons.append("轻风")
print(f" 轻风天气: +0.5元")
# 能见度加价
if visibility < 5:
surcharge += 0.25
reasons.append("低能见度")
print(f" 低能见度: +0.25元")
# 封顶机制
surcharge = min(surcharge, Config.MAX_WEATHER_SURCHARGE)
print(f"总计天气加价: {surcharge}")
return surcharge, reasons
def get_delivery_price(self, distance_km=0):
"""获取天津的配送价格"""
print(f"计算天津的配送价格...")
# 获取天气数据
weather_data = weather_api.get_current_weather()
if not weather_data:
return {
'success': False,
'error': '获取天气数据失败'
}
# 计算加价
surcharge, reasons = self.calculate_weather_surcharge(weather_data)
# 距离费用
distance_fee = distance_km * 1.0
# 总价格
total_price = self.base_price + surcharge + distance_fee
result = {
'success': True,
'location': '天津',
'weather': {
'condition': weather_data['text'],
'temperature': weather_data['temp'],
'windSpeed': weather_data['windSpeed'],
'humidity': weather_data['humidity'],
'feelsLike': weather_data.get('feelsLike', weather_data['temp']),
'visibility': weather_data.get('vis', 10)
},
'pricing_breakdown': {
'base_price': self.base_price,
'weather_surcharge': round(surcharge, 2),
'distance_fee': round(distance_fee, 2),
'total_price': round(total_price, 2)
},
'surcharge_reasons': reasons,
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
'message': self.generate_price_message(weather_data['text'], surcharge)
}
print(f"价格计算完成: 总计 {total_price}")
return result
def generate_price_message(self, weather_condition, surcharge):
"""生成价格提示消息"""
if surcharge == 0:
return f"今日天津天气{weather_condition},适宜出行,按基础价格计算"
elif surcharge <= 1:
return f"因今日天津{weather_condition},价格小幅上调{surcharge}"
elif surcharge <= 2:
return f"因今日天津{weather_condition},价格上调{surcharge}"
else:
return f"因今日天津恶劣{weather_condition},价格大幅上调{surcharge}"
# 单例实例
pricing_service = DeliveryPricingService()

@ -0,0 +1,47 @@
# quick_verify.py
import requests
def quick_verify():
"""快速验证API修复"""
API_KEY = "f0e3796b356f4ab38a80d5ae22369fe9"
API_HOST = "kb4bjab87d.re.qweatherapi.com"
print("🚀 快速验证API修复...")
# 直接测试天气API
url = f"https://{API_HOST}/v7/weather/now"
headers = {
"X-QW-Api-Key": API_KEY,
"Accept-Encoding": "gzip"
}
params = {'location': '101010100'} # 北京ID
try:
response = requests.get(url, headers=headers, params=params, timeout=10)
print(f"状态码: {response.status_code}")
if response.status_code == 200:
data = response.json()
print(f"API响应: {data}")
if data.get('code') == '200':
print("✅ API修复成功")
print(f"🌤️ 天气: {data['now']['text']}")
print(f"🌡️ 温度: {data['now']['temp']}°C")
print(f"💨 风速: {data['now']['windSpeed']}km/h")
return True
else:
print(f"❌ API返回错误: {data}")
else:
print(f"❌ HTTP错误: {response.status_code}")
print(f"错误详情: {response.text}")
except Exception as e:
print(f"❌ 异常: {e}")
return False
if __name__ == "__main__":
quick_verify()

@ -0,0 +1,94 @@
# weather_service.py
import requests
import json
import logging
from config import Config
class HeWeatherAPI:
def __init__(self):
self.api_key = Config.HEWEATHER_API_KEY
self.api_host = Config.HEWEATHER_API_HOST
def _make_request(self, endpoint, params=None):
"""统一的API请求方法"""
url = f"https://{self.api_host}{endpoint}"
headers = {
"X-QW-Api-Key": self.api_key,
"Accept-Encoding": "gzip"
}
try:
print(f"请求: {url}")
print(f"参数: {params}")
response = requests.get(
url,
params=params,
headers=headers,
timeout=10
)
print(f"响应状态码: {response.status_code}")
if response.status_code == 200:
data = response.json()
print("请求成功!")
return data
else:
print(f"HTTP错误: {response.status_code}")
print(f"错误响应: {response.text[:500]}")
return None
except requests.exceptions.RequestException as e:
print(f"网络请求异常: {e}")
return None
except json.JSONDecodeError as e:
print(f"JSON解析失败: {e}")
print(f"原始响应: {response.text[:500] if 'response' in locals() else '无响应'}")
return None
except Exception as e:
print(f"其他异常: {e}")
return None
def get_current_weather(self, location_id=None):
"""获取实时天气数据 - 直接使用城市ID"""
if location_id is None:
location_id = Config.DEFAULT_LOCATION_ID
endpoint = "/v7/weather/now"
params = {
'location': location_id
}
print(f"获取天气数据位置ID: {location_id}")
data = self._make_request(endpoint, params)
if data and data.get('code') == '200':
print("天气数据获取成功!")
return data['now']
else:
print(f"天气数据获取失败: {data}")
return None
def test_connection(self):
"""测试API连接"""
print("测试API连接...")
result = self.get_current_weather()
if result:
print("API连接测试成功!")
print(f"天气: {result['text']}")
print(f"温度: {result['temp']}C")
print(f"湿度: {result['humidity']}%")
print(f"风速: {result['windSpeed']}km/h")
return True
else:
print("API连接测试失败!")
return False
# 单例实例
weather_api = HeWeatherAPI()

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

@ -0,0 +1,276 @@
// app.js
App({
onLaunch: function () {
// 初始化云开发
if (!wx.cloud) {
console.error('请使用 2.2.3 或以上的基础库以使用云能力')
} else {
wx.cloud.init({
env: 'cloud1-0gtigwg3df80d098',
traceUser: true,
})
}
// 检查本地缓存是否有登录状态
this.checkLocalLoginStatus();
// 初始化位置服务
this.initLocationService();
},
// 初始化位置服务
initLocationService: function() {
// 设置腾讯地图key可能用于后续扩展
this.globalData.tencentMapKey = 'ETYBZ-RKIWV-5WGPQ-535UW-NWICZ-MSB7R';
// 尝试获取用户位置
this.getUserLocation().then(location => {
console.log('用户位置获取成功:', location);
}).catch(err => {
console.warn('用户位置获取失败:', err);
});
},
// 获取用户位置
getUserLocation: function() {
return new Promise((resolve, reject) => {
// 先检查权限
wx.getSetting({
success: (res) => {
if (res.authSetting['scope.userLocation'] === false) {
// 已拒绝授权,需要引导用户打开设置
reject(new Error('用户已拒绝位置权限'));
} else if (res.authSetting['scope.userLocation'] === undefined) {
// 未请求过权限,发起授权请求
wx.authorize({
scope: 'scope.userLocation',
success: () => {
this.actuallyGetLocation(resolve, reject);
},
fail: () => {
reject(new Error('用户拒绝授权位置信息'));
}
});
} else {
// 已有权限,直接获取位置
this.actuallyGetLocation(resolve, reject);
}
},
fail: reject
});
});
},
// 实际获取位置信息
actuallyGetLocation: function(resolve, reject) {
wx.getLocation({
type: 'gcj02', // 返回国测局坐标,可用于腾讯地图
success: (res) => {
const userLocation = {
latitude: res.latitude,
longitude: res.longitude,
timestamp: new Date().getTime()
};
// 保存到全局数据和缓存
this.globalData.userLocation = userLocation;
this.globalData.hasLocationPermission = true;
wx.setStorageSync('userLocation', userLocation);
console.log('获取到用户位置:', userLocation);
resolve(userLocation);
},
fail: (err) => {
console.error('获取位置失败:', err);
this.globalData.hasLocationPermission = false;
reject(err);
}
});
},
// 重新请求位置权限
requestLocationPermission: function() {
return new Promise((resolve, reject) => {
wx.authorize({
scope: 'scope.userLocation',
success: () => {
this.actuallyGetLocation(resolve, reject);
},
fail: () => {
// 引导用户去设置页打开权限
wx.showModal({
title: '位置权限申请',
content: '需要获取您的位置信息来提供更好的服务,是否前往设置开启权限?',
success: (res) => {
if (res.confirm) {
wx.openSetting({
success: (settingRes) => {
if (settingRes.authSetting['scope.userLocation']) {
this.actuallyGetLocation(resolve, reject);
} else {
reject(new Error('用户未授权位置权限'));
}
}
});
} else {
reject(new Error('用户取消授权'));
}
}
});
}
});
});
},
checkLocalLoginStatus: function() {
const openid = wx.getStorageSync('openid');
const userInfo = wx.getStorageSync('userInfo');
const isLogin = wx.getStorageSync('isLogin');
const authStatus = wx.getStorageSync('authStatus') || 'none';
const isAdmin = wx.getStorageSync('isAdmin') || false;
const userLocation = wx.getStorageSync('userLocation');
if (openid && isLogin) {
this.globalData.openid = openid;
this.globalData.userInfo = userInfo;
this.globalData.isLogin = true;
this.globalData.authStatus = authStatus;
this.globalData.isAdmin = isAdmin;
this.globalData.isRider = authStatus === 'approved';
}
if (userLocation) {
this.globalData.userLocation = userLocation;
this.globalData.hasLocationPermission = true;
}
},
wechatLogin: function() {
const that = this;
wx.showLoading({
title: '登录中...',
mask: true
});
console.log('开始执行微信登录...');
// 直接调用云函数
wx.cloud.callFunction({
name: 'login',
success: (res) => {
console.log('云函数返回:', res);
wx.hideLoading();
if (res.result && res.result.success) {
// 登录成功
const { openid, userInfo, authStatus = 'none', authData = null } = res.result;
console.log('登录成功openid:', openid, '认证状态:', authStatus);
// 保存到全局数据
that.globalData.openid = openid;
that.globalData.userInfo = userInfo || {};
that.globalData.isLogin = true;
that.globalData.authStatus = authStatus;
that.globalData.authData = authData;
that.globalData.isRider = authStatus === 'approved';
that.globalData.login = true;
// 保存到缓存
wx.setStorageSync('openid', openid);
wx.setStorageSync('userInfo', userInfo || {});
wx.setStorageSync('isLogin', true);
wx.setStorageSync('authStatus', authStatus);
wx.showToast({
title: '登录成功',
icon: 'success',
duration: 2000
});
// 触发登录成功事件,通知其他页面
if (that.loginSuccessCallback) {
that.loginSuccessCallback();
}
// 登录成功后尝试获取位置
that.getUserLocation().catch(err => {
console.warn('登录后获取位置失败:', err);
});
} else {
wx.showToast({
title: res.result?.error || '登录失败',
icon: 'none'
});
}
},
fail: (err) => {
console.error('云函数调用失败:', err);
wx.hideLoading();
wx.showToast({
title: '登录失败: ' + err.errMsg,
icon: 'none'
});
}
});
},
// 新增:更新认证状态的方法
updateAuthStatus: function(status, data) {
this.globalData.authStatus = status;
this.globalData.authData = data;
this.globalData.isRider = status === 'approved';
wx.setStorageSync('authStatus', status);
},
// 新增:检查认证状态的方法
checkAuthStatus: function() {
const that = this;
return new Promise((resolve, reject) => {
if (!that.globalData.openid) {
reject(new Error('未登录'));
return;
}
wx.cloud.callFunction({
name: 'regist',
data: {
action: 'checkAuthStatus'
}
}).then(res => {
if (res.result && res.result.success) {
const authData = res.result.data;
const status = authData ? authData.status : 'none';
that.globalData.authStatus = status;
that.globalData.authData = authData;
that.globalData.isRider = status === 'approved';
wx.setStorageSync('authStatus', status);
resolve({ status, data: authData });
} else {
reject(new Error(res.result.error));
}
}).catch(reject);
});
},
globalData: {
openid: null,
userInfo: null,
isLogin: false,
login: false,
campus: 0,
isRegistered: false,
// 新增认证相关字段
authStatus: 'none', // none, pending, approved, rejected
authData: null,
isRider: false,
isAdmin: false,
// 新增位置相关字段
tencentMapKey: '',
userLocation: null, // 用户当前位置 {latitude, longitude, timestamp}
hasLocationPermission: false
}
})

@ -0,0 +1,60 @@
{
"pages": [
"pages/index/index",
"pages/my_info/my_info",
"pages/banned/banned",
"pages/order_list/order_list",
"pages/auth/auth",
"pages/admin_auth/admin_auth",
"pages/weather_detail/weather_detail",
"pages/filling/filling",
"pages/feedback/feedback",
"pages/simulate-pay/simulate-pay",
"pages/pay-result/pay-result",
"pages/details/details",
"pages/order_details/order_details",
"pages/feedback_review/feedback_review"
],
"window": {
"backgroundColor": "#F6F6F6",
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#F6F6F6",
"navigationBarTitleText": "校惠递",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#495060",
"selectedColor": "#2d8cf0",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "images/home.png",
"selectedIconPath": "images/home.png"
},
{
"pagePath": "pages/order_list/order_list",
"text": "订单",
"iconPath": "images/order.png",
"selectedIconPath": "images/order.png"
},
{
"pagePath": "pages/my_info/my_info",
"text": "我的",
"iconPath": "images/My.png",
"selectedIconPath": "images/My.png"
}
]
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序定位和选择位置"
}
},
"requiredPrivateInfos": [
"getLocation",
"chooseLocation"
],
"sitemapLocation": "sitemap.json"
}

@ -0,0 +1,7 @@
/**app.wxss**/
.container {
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
}

@ -0,0 +1,47 @@
Component({
externalClasses: ['i-class', 'i-class-mask', 'i-class-header'],
options: {
multipleSlots: true
},
properties: {
visible: {
type: Boolean,
value: false
},
maskClosable: {
type: Boolean,
value: true
},
showCancel: {
type: Boolean,
value: false
},
cancelText: {
type: String,
value: '取消'
},
actions: {
type: Array,
value: []
}
},
methods: {
handleClickMask () {
if (!this.data.maskClosable) return;
this.handleClickCancel();
},
handleClickItem ({ currentTarget = {} }) {
const dataset = currentTarget.dataset || {};
const { index } = dataset;
this.triggerEvent('click', { index });
},
handleClickCancel () {
this.triggerEvent('cancel');
}
}
});

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents":
{
"i-button": "../button/index",
"i-icon": "../icon/index"
}
}

@ -0,0 +1,23 @@
<view class="i-as-mask i-class-mask {{ visible ? 'i-as-mask-show' : '' }}" bindtap="handleClickMask"></view>
<view class="i-class i-as {{ visible ? 'i-as-show' : '' }}">
<view class="i-as-header i-class-header"><slot name="header"></slot></view>
<view class="i-as-actions">
<view class="i-as-action-item" wx:for="{{ actions }}" wx:key="{{ item.name }}">
<i-button
bind:click="handleClickItem"
data-index="{{ index }}"
open-type="{{ item.openType }}"
type="ghost"
size="large"
long
>
<view class="i-as-btn-loading" wx:if="{{ item.loading }}"></view>
<i-icon wx:if="{{ item.icon }}" type="{{ item.icon }}" i-class="i-as-btn-icon"></i-icon>
<view class="i-as-btn-text" style="{{ item.color ? 'color: ' + item.color : '' }}">{{ item.name }}</view>
</i-button>
</view>
</view>
<view class="i-as-cancel" wx:if="{{ showCancel }}">
<i-button i-class="i-as-cancel-btn" type="ghost" size="large" long="true" bind:click="handleClickCancel">{{ cancelText }}</i-button>
</view>
</view>

@ -0,0 +1 @@
.i-as{position:fixed;width:100%;box-sizing:border-box;left:0;right:0;bottom:0;background:#f7f7f7;transform:translate3d(0,100%,0);transform-origin:center;transition:all .2s ease-in-out;z-index:900;visibility:hidden}.i-as-show{transform:translate3d(0,0,0);visibility:visible}.i-as-mask{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.7);z-index:900;transition:all .2s ease-in-out;opacity:0;visibility:hidden}.i-as-mask-show{opacity:1;visibility:visible}.i-as-action-item{position:relative}.i-as-action-item::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-bottom-width:1px}.i-as-header{background:#fff;text-align:center;position:relative;font-size:12px;color:#80848f}.i-as-header::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-bottom-width:1px}.i-as-cancel{margin-top:6px}.i-as-btn-loading{display:inline-block;vertical-align:middle;margin-right:10px;width:12px;height:12px;background:0 0;border-radius:50%;border:2px solid #e5e5e5;border-color:#666 #e5e5e5 #e5e5e5 #e5e5e5;animation:btn-spin .6s linear;animation-iteration-count:infinite}.i-as-btn-text{display:inline-block;vertical-align:middle}.i-as-btn-icon{font-size:14px!important;margin-right:4px}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}

@ -0,0 +1,37 @@
Component({
externalClasses: ['i-class'],
options: {
multipleSlots: true
},
properties: {
//info, success, warning, error
type: {
type: String,
value: 'info'
},
closable: {
type: Boolean,
value: false
},
showIcon: {
type: Boolean,
default: false
},
desc: {
type: Boolean,
default: false
},
},
data: {
closed: false
},
methods: {
handleTap() {
this.setData({
closed: !this.data.closed,
});
this.triggerEvent('close');
},
}
});

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents":
{
"i-icon": "../icon/index"
}
}

@ -0,0 +1,15 @@
<view class="i-class i-alert {{'i-alert-'+type}} {{showIcon?'i-alert-with-icon':''}} {{desc?'i-alert-with-desc':''}}" wx:if="{{!closed}}">
<view wx:if="{{ showIcon }}" class="i-alert-icon">
<i-icon type="prompt" wx:if="{{ type === 'info' }}" size="{{desc?24:16}}"></i-icon>
<i-icon type="success" wx:if="{{ type === 'success' }}" size="{{desc?24:16}}"></i-icon>
<i-icon type="warning" wx:if="{{ type === 'warning' }}" size="{{desc?24:16}}"></i-icon>
<i-icon type="delete" wx:if="{{ type === 'error' }}" size="{{desc?24:16}}"></i-icon>
</view>
<slot></slot>
<view class="i-alert-desc">
<slot name="desc"></slot>
</view>
<view class="i-alert-close" wx:if="{{ closable }}" bindtap="handleTap">
<i-icon type="close"></i-icon>
</view>
</view>

@ -0,0 +1 @@
.i-alert{position:relative;margin:10px;padding:8px 48px 8px 16px;font-size:14px;border-radius:2px;color:#fff;background:#f7f7f7;color:#495060}.i-alert.i-alert-with-icon{padding:8px 48px 8px 38px}.i-alert-info{color:#fff;background:#2db7f5}.i-alert-success{color:#fff;background:#19be6b}.i-alert-warning{color:#fff;background:#f90}.i-alert-error{color:#fff;background:#ed3f14}.i-alert-icon{position:absolute;top:9px;left:16px;font-size:14px}.i-alert-desc{font-size:12px}.i-alert-with-desc{padding:16px;position:relative}.i-alert-with-desc.i-alert-with-icon{padding:16px 16px 16px 69px}.i-alert-with-desc .i-alert-icon{top:50%;left:24px;margin-top:-21px;font-size:28px}.i-alert-close{font-size:12px;position:absolute;right:16px;top:8px;overflow:hidden;cursor:pointer}

@ -0,0 +1,20 @@
Component({
externalClasses: ['i-class'],
properties: {
// circle || square
shape: {
type: String,
value: 'circle'
},
// small || large || default
size: {
type: String,
value: 'default'
},
src: {
type: String,
value: ''
}
}
});

@ -0,0 +1,3 @@
{
"component": true
}

@ -0,0 +1,4 @@
<view class="i-class i-avatar i-avatar-{{ shape }} i-avatar-{{ size }} {{ src ? 'i-avatar-image' : '' }}">
<image src="{{ src }}" wx:if="{{ src !== '' }}"></image>
<view class="i-avatar-string" wx:else><slot></slot></view>
</view>

@ -0,0 +1 @@
.i-avatar{display:inline-block;text-align:center;background:#ccc;color:#fff;white-space:nowrap;position:relative;overflow:hidden;vertical-align:middle;width:32px;height:32px;line-height:32px;border-radius:16px;font-size:18px}.i-avatar .ivu-avatar-string{line-height:32px}.i-avatar-large{width:40px;height:40px;line-height:40px;border-radius:20px;font-size:24px}.i-avatar-large .ivu-avatar-string{line-height:40px}.i-avatar-small{width:24px;height:24px;line-height:24px;border-radius:12px;font-size:14px}.i-avatar-small .ivu-avatar-string{line-height:24px}.i-avatar-image{background:0 0}.i-avatar-square{border-radius:4px}.i-avatar>image{width:100%;height:100%}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save