Compare commits
141 Commits
Author | SHA1 | Date | |
---|---|---|---|
bb962cb8cf | |||
d733c75371 | |||
2fd3f5a0db | |||
f2f68c1f4a | |||
1917828eab | |||
afae6b7903 | |||
b2854908a4 | |||
7f86ae9fd2 | |||
22188907c2 | |||
33e49cb8be | |||
1dcc09980c | |||
6a4cae757d | |||
18381aa0c4 | |||
943798f53c | |||
a5dc26cd17 | |||
464a9d3e59 | |||
292a4c26c5 | |||
e97514a67f | |||
27ac19141f | |||
c385965655 | |||
43d87b40f7 | |||
660f6921de | |||
86101e01d1 | |||
1f2a2ad6bd | |||
b91a9271a7 | |||
ec635b9ae6 | |||
6f96a69900 | |||
58d8d74158 | |||
96b3414d22 | |||
529011b0dd | |||
4da257c2e2 | |||
f11eb63ee1 | |||
49c4f7f0d4 | |||
4158887d2e | |||
a8e16f5972 | |||
d9825d6d68 | |||
fab73f00ab | |||
edb26b3d8b | |||
443f82ea75 | |||
75adb97abb | |||
b36996e352 | |||
6bef08f12e | |||
1f24a59bd9 | |||
14d0c9c123 | |||
b99a3412e2 | |||
63300f68f8 | |||
acf4f94798 | |||
87f4d220e5 | |||
cf4dd727c5 | |||
49055e892c | |||
afedb81633 | |||
04b8bf365f | |||
874c64829a | |||
82e1c0941e | |||
3119c862b1 | |||
23f46a24c9 | |||
fc8aa19c67 | |||
72448038d1 | |||
196be3099a | |||
87d33bb1df | |||
efd9b9be57 | |||
7dd46dbd15 | |||
d70ead2f77 | |||
95f1f6d484 | |||
54d87fc5db | |||
f434ad531c | |||
![]() |
3bb47109ed | ||
84bc1c6fbc | |||
![]() |
a92f2d06ea | ||
![]() |
45e8ef9322 | ||
![]() |
7c1e4e441a | ||
7a5d43281b | |||
4d3c44be6e | |||
2b300b83a4 | |||
77f9bc5223 | |||
f4d21f918f | |||
6531a07b26 | |||
9dd73138e0 | |||
3285dba789 | |||
40dac39ba4 | |||
ac511387bc | |||
4f83dd6822 | |||
891c9be907 | |||
478eafa4a3 | |||
67ff1f8c76 | |||
d52ddee947 | |||
1db7507293 | |||
1c3171f1e4 | |||
28d6870a84 | |||
b312b2e57b | |||
5b4842b261 | |||
691ac03cfd | |||
5e4c4fdd22 | |||
de67ab0d68 | |||
121b620312 | |||
49ed8e588a | |||
22af68428f | |||
4f49012bb6 | |||
73563de980 | |||
eb77678686 | |||
fc6fee74b0 | |||
9543fa8409 | |||
fadbc4dc72 | |||
ad4570dae0 | |||
8d248466eb | |||
bfa5ed0e3a | |||
582c8446e2 | |||
0fc0fa932a | |||
98f4236c35 | |||
b37977418a | |||
7a78cf0594 | |||
![]() |
af68984caa | ||
623307ef2b | |||
![]() |
14b03af584 | ||
c3773a3c71 | |||
![]() |
0140136a0b | ||
41519b78e4 | |||
9b4cfe95a5 | |||
6937b93517 | |||
e1d4745ecb | |||
faa7ed0b0e | |||
77370eb3eb | |||
82f438056e | |||
8d08589b4c | |||
af2d88f651 | |||
0528c2865d | |||
df10c22a8d | |||
773da154ff | |||
55d52f446f | |||
da658cb371 | |||
ce7d6c74f0 | |||
7fa3a215cf | |||
cea68f5145 | |||
18b167266d | |||
84b927a71b | |||
004ea1895b | |||
0f70998a5f | |||
d02cc5db3b | |||
2a85beba68 | |||
93d47426d8 | |||
cf88f314f1 |
5
.gitignore
vendored
@ -12,4 +12,9 @@ $RECYCLE.BIN/
|
||||
|
||||
# Node.js
|
||||
node_modules/
|
||||
|
||||
# wxss
|
||||
*.wxss
|
||||
|
||||
# idea
|
||||
.idea
|
674
LICENSE
Normal file
@ -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>.
|
163
README.md
Normal file
@ -0,0 +1,163 @@
|
||||
# 第三代掌上教务处小程序
|
||||
|
||||
掌上教务处作为工业大学的社区开源项目,自从2017年开始已有近5年岁月,在无数同学的贡献之下,为大家打造便捷的校园服务。
|
||||
|
||||
__*!!!警告!!!*__
|
||||
|
||||
*请在主仓库提交代码,而非镜像仓库!在镜像仓库提交的代码将会在同步时被覆盖!*
|
||||
|
||||
主仓库: http://git.mrkbear.com/MrKBear/mini-dlpu-v3
|
||||
|
||||
镜像仓库: https://github.com/Mr-k-bear/mini-dlpu-v3
|
||||
|
||||
## 目录
|
||||
|
||||
- [社区介绍](#小程序社区)
|
||||
- [项目设计](#第三代小程序)
|
||||
- [贡献规范](#社区贡献规范)
|
||||
- [社区福利](#贡献者分配制度)
|
||||
- [API文档](https://docs.apipost.cn/preview/e737de418d4ef150/419d45d8c97d6a9f)
|
||||
- [入门文档(等待撰写)](#快速入门)
|
||||
- [设计架构(等待撰写)](#第三代掌上教务处小程序)
|
||||
|
||||
## 小程序社区
|
||||
|
||||
掌上教务处小程序诞生于2017年中旬,此时微信小程序刚刚公测。
|
||||
|
||||
2017年,信息学院吴学长因兴趣设计了一款方便课表查询的小工具,在班级范围内使用,就这样掌上教务处诞生了。
|
||||
|
||||
随着大家的好评和认可,小程序使用范围慢慢扩大,从班级到专业到学院,同时,吴学长也面临着越来越大的责任和压力。
|
||||
|
||||
正当小程序维护困难之际,很多热心的同学,为吴学长贡献代码,创意,UI设计图纸,从此"成绩查询"、"考试日程"、"空教室"这样的小功能如雨后春笋,慢慢诞生......
|
||||
|
||||
此时,作为大家努力的结晶,小程序开放了源代码。
|
||||
|
||||
> PS:
|
||||
> 哈哈,你可能会好奇为什么小程序的LOGO看起来很奇怪,其实这个 LOGO 是一个热心的同学在2018年贡献的,为了纪念小程序最初的贡献者们一直沿用至今。
|
||||
|
||||
毕竟服务器是有成本的,随着用户的增多,吴学长自掏腰包租赁的服务器,已不再能维持小程序流畅运行,小程序再次陷入困境。
|
||||
|
||||
这时有其他热心同学,赞助了自己租赁的服务器...
|
||||
越来越多,越来越多,不愿透露名字的热心人给服务器取了有趣的名字。
|
||||
|
||||
就这样,"笔芯"、"妲己"、"猪蹄"、"MOS"...一台台自租赁的服务器支撑起了大家的日常使用。
|
||||
|
||||
> PS:
|
||||
> 如果你愿意考古的话,去看看老版本小程序的切换服务器页面,它们就这样静静的挺拨在那里,为大家默默的服务着...
|
||||
|
||||
后来随着开发者们的加入,小程序有了更多的功能、更好的技术、更高的性能。
|
||||
|
||||
2019年期间,在吴学长、秦学长、梁学长、潘学姐、隋学长以及其他社区贡献者的共同努力下,第二代小程序诞生了,并更名为"掌上教务处"。
|
||||
|
||||
重构后的小程序,犹如脱胎换骨,性能提高很多倍,得到了很多同学的关注,用户数量达到19000人。
|
||||
|
||||
2020年随着小程序的稳定,大家也已经习惯了目前的设计,但是小程序仍有部分设计缺陷,导致可拓展性降低,难以拓展新功能,无法和其他商业产品竞争。
|
||||
|
||||
老一代社区贡献者们开始逐渐毕业,社区迎来前所未有的空窗期。
|
||||
社区团队逐渐消退,仅剩梁学长、秦学长在日常爱心维护小程序代码,供大家日常使用。
|
||||
|
||||
## 第三代小程序
|
||||
|
||||
突破内容:
|
||||
|
||||
1. 小程序在技术上突破更高的性能瓶颈
|
||||
|
||||
2. 更漂亮的UI,和更好的交互体验
|
||||
|
||||
3. 更好的拓展性,加入更多大家喜欢的功能
|
||||
|
||||
新功能:
|
||||
|
||||
1. 正在讨论设计,等待你的建议...
|
||||
|
||||
## 社区贡献规范
|
||||
|
||||
请仔细阅读!
|
||||
### 项目贡献流程
|
||||
|
||||
请先邮件联系 ```mrkbear@mrkbear.com``` 获得 Gitea 平台账号
|
||||
|
||||
在仓库中创建自己的分支,分支命名规范为 ```dev-你的昵称```,例如 ```dev-mrkbear```
|
||||
|
||||
克隆此储库,在本地 ```git checkout dev-你的昵称``` 到自己的分支,进行改动。
|
||||
|
||||
开发完成后 ```git push``` 到自己的远程分支,并发起合并请求到 ```master``` 分支
|
||||
|
||||
发起合并请求时,需要指派给 ```MrKBear``` 进行代码审核,审核通过后,代码将完成合并。
|
||||
|
||||
### 注意事项
|
||||
|
||||
1. ```master``` 分支处于保护状态,仅通过合并请求进行修改
|
||||
|
||||
2. 代码提交时,请使用清晰明确的 ```message```
|
||||
|
||||
正例: ```Add timetable page``` 反例: ```阿巴阿巴阿巴阿巴```
|
||||
|
||||
3. 请勿将任何个人隐私信息以任何方式,放入代码中
|
||||
|
||||
4. 为保证 CI/CD,提交代码前必须保证编译可以通过
|
||||
|
||||
5. 一个文件不要超过 1000 行代码,尽量保证代码可读性
|
||||
|
||||
## 贡献者分配制度
|
||||
|
||||
作为公益的开源项目:
|
||||
|
||||
第三代开发时,将计划加入一个赞助功能,每个月赞助累计到达一定数额,将在下个月去除开屏广告。
|
||||
|
||||
第三代上线后,我们将在每个月公示小程序的账目流水,去除服务器成本和其他费用(微信认证,微信支付,域名,...)后,若有剩余数额将按照开发时大家的贡献分配。
|
||||
|
||||
小程序的广告位将计划外包给其他组织管理,我们也会得到一定收入,此收入也将按上面的规则处理。
|
||||
|
||||
小程序开屏广告收入也同样按上面的规则处理。
|
||||
|
||||
以上内容请大家仔细阅读,另外有意向负责项目财务的同学,处理财务账目也算做贡献。
|
||||
|
||||
## 快速入门
|
||||
|
||||
下面对大家的小问题进行解答:
|
||||
|
||||
> 我在参与贡献之前,我需要先会哪些知识?他们好学吗?
|
||||
|
||||
下面列出此项目使用的全部技术,从上到下是推荐学习顺序和学习重点,也是难度顺序:
|
||||
- HTML
|
||||
- 标签结构和语法
|
||||
- CSS
|
||||
- 基础样式
|
||||
- 选择器
|
||||
- 盒模型
|
||||
- 布局和定位
|
||||
- 行内元素和块级元素
|
||||
- JS
|
||||
- 数据类型
|
||||
- 基础运算符
|
||||
- 流程控制语句
|
||||
- 函数与闭包 (瓶颈)
|
||||
- 原型和对象 (突破)
|
||||
- Vue (不用深入了解)
|
||||
- 组件化设计思想
|
||||
- 小程序 API
|
||||
- 了解小程序如何编写页面
|
||||
- 了解小程序大概的 API
|
||||
- 不用深入了解,随时查阅
|
||||
- TypeScript (只要JS数据结构玩的6,TS五分钟学会)
|
||||
- 类型约束
|
||||
- 接口
|
||||
- 泛型
|
||||
- 类型运算
|
||||
- Sass (拓展了CSS语法,实际上没有任何新知识)
|
||||
- 语法
|
||||
|
||||
> 小程序和主流前端技术差别在哪?对我以后职业发展帮助大嘛?
|
||||
|
||||
如果你已经掌握了前端主流技术,例如 Vue,React,那么上手小程序只是 __1__ 天的事情
|
||||
|
||||
换句话来说小程序开发用到技术和主流前端技术,有大概 __90%__ 是重叠的。
|
||||
|
||||
小程序学了可以成为加分项,参与贡献拥有 __20000__ 人的项目,丰富项目经历,稳赚不亏。
|
||||
|
||||
掌上教务处前端项目采用了很多创新的架构设计,虽然不一定优秀,但是一定是值得学习的。
|
||||
|
||||
## 贡献者
|
||||
|
||||
@MrKBear (熊鲜森)
|
95
miniprogram/api/EduBase.ts
Normal file
@ -0,0 +1,95 @@
|
||||
import { API, IAnyData, GeneralCallbackResult } from "../core/Api";
|
||||
import { EventType, Emitter } from "../core/Emitter";
|
||||
|
||||
type ILoginEvent = {
|
||||
|
||||
/**
|
||||
* session 过期
|
||||
*/
|
||||
expire: GeneralCallbackResult;
|
||||
|
||||
/**
|
||||
* 登录失败
|
||||
*/
|
||||
unauthorized: GeneralCallbackResult;
|
||||
|
||||
/**
|
||||
* 未知的问题
|
||||
*/
|
||||
error: GeneralCallbackResult;
|
||||
|
||||
/**
|
||||
* 数据损坏或丢失
|
||||
*/
|
||||
badData: GeneralCallbackResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 教务处基础 API
|
||||
* @template I API 输入数据
|
||||
* @template O API 输出数据
|
||||
* @template E API 中的事件
|
||||
* @template U 用户自定义的输出数据
|
||||
*/
|
||||
abstract class EduBase<
|
||||
I extends IAnyData = IAnyData,
|
||||
O extends IAnyData = IAnyData,
|
||||
E extends Record<EventType, any> = {}
|
||||
> extends API<I, O, {
|
||||
[P in (keyof ILoginEvent | keyof E)]: P extends keyof ILoginEvent ? ILoginEvent[P] : E[P]
|
||||
}> {
|
||||
|
||||
protected useEduCallback(
|
||||
parseFunction: (data: any) => O
|
||||
): void {
|
||||
|
||||
this.addFailedCallBack();
|
||||
|
||||
this.on("success", (data) => {
|
||||
|
||||
let isSuccess = true;
|
||||
let errMsg = "";
|
||||
let res: O | undefined;
|
||||
const info: any = data.data;
|
||||
|
||||
// 数据缺失检测
|
||||
if(!info) {
|
||||
isSuccess = false;
|
||||
errMsg = "Bad Data";
|
||||
(this as Emitter<IAnyData>).emit("badData", { errMsg });
|
||||
}
|
||||
|
||||
if (isSuccess) switch (info.code) {
|
||||
case (1):
|
||||
res = parseFunction(info.data);
|
||||
errMsg = info.err_msg ?? "Success";
|
||||
(this as Emitter<IAnyData>).emit("ok", res!);
|
||||
break;
|
||||
|
||||
case (2):
|
||||
isSuccess = false;
|
||||
errMsg = info.err_msg ?? "Session Expire";
|
||||
(this as Emitter<IAnyData>).emit("expire", { errMsg });
|
||||
break;
|
||||
|
||||
case (3):
|
||||
isSuccess = false;
|
||||
errMsg = info.err_msg ?? "Unauthorized";
|
||||
(this as Emitter<IAnyData>).emit("unauthorized", { errMsg });
|
||||
break;
|
||||
|
||||
case (4):
|
||||
isSuccess = false;
|
||||
errMsg = info.err_msg ?? "Error";
|
||||
(this as Emitter<IAnyData>).emit("error", { errMsg });
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isSuccess) (this as Emitter<IAnyData>).emit("no", { errMsg });
|
||||
(this as Emitter<IAnyData>).emit("done", { errMsg, data: res });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { EduBase };
|
||||
export default EduBase;
|
78
miniprogram/api/Login.ts
Normal file
@ -0,0 +1,78 @@
|
||||
import { HTTPMethod, IParamSetting } from "../core/Api";
|
||||
import { EduBase } from "./EduBase";
|
||||
|
||||
interface ILoginInput {
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
studentId: string;
|
||||
|
||||
/**
|
||||
* 教务处密码
|
||||
*/
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface ILoginOutput {
|
||||
|
||||
/**
|
||||
* 身份证后六位
|
||||
* 用于尝试水卡登录
|
||||
*/
|
||||
idCardLast6: string;
|
||||
|
||||
/**
|
||||
* 使用的教务处链接
|
||||
*/
|
||||
eduService: string;
|
||||
|
||||
/**
|
||||
* 用户的真实姓名
|
||||
*/
|
||||
actualName: string;
|
||||
|
||||
/**
|
||||
* 教务处的 session
|
||||
*/
|
||||
eduSession: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Login API
|
||||
* 此 API 用来向教务处发起登录请求
|
||||
* 请求成功后将获得教务处返回的 session
|
||||
*/
|
||||
class Login extends EduBase<ILoginInput, ILoginOutput> {
|
||||
|
||||
public override url: string = "/login";
|
||||
|
||||
public override method: HTTPMethod = HTTPMethod.POST;
|
||||
|
||||
public override params: IParamSetting<ILoginInput> = {
|
||||
|
||||
studentId: {
|
||||
mapKey: "id",
|
||||
tester: /^\d{8,12}$/,
|
||||
},
|
||||
|
||||
password: {
|
||||
mapKey: "pwd"
|
||||
}
|
||||
};
|
||||
|
||||
public constructor() {
|
||||
super();
|
||||
this.initDebugLabel("Login");
|
||||
|
||||
this.useEduCallback((data) => ({
|
||||
idCardLast6: data.idCard,
|
||||
eduService: data.ip,
|
||||
actualName: data.name,
|
||||
isSubscribeWxAccount: data.official,
|
||||
eduSession: data.session
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
export { Login, ILoginInput, ILoginOutput };
|
110
miniprogram/api/Schedule.ts
Normal file
@ -0,0 +1,110 @@
|
||||
import { HTTPMethod, IParamSetting } from "../core/Api";
|
||||
import { EduBase } from "./EduBase";
|
||||
|
||||
interface IScheduleInput {
|
||||
|
||||
/**
|
||||
* session
|
||||
*/
|
||||
cookie: string;
|
||||
|
||||
/**
|
||||
* 学期
|
||||
*/
|
||||
semester: string;
|
||||
}
|
||||
|
||||
interface IClassData {
|
||||
|
||||
/**
|
||||
* 课程名字
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* 上课地点
|
||||
*/
|
||||
room?: string;
|
||||
|
||||
/**
|
||||
* 课程老师
|
||||
*/
|
||||
teacher?: string;
|
||||
|
||||
/**
|
||||
* 周数
|
||||
*/
|
||||
week: string;
|
||||
}
|
||||
|
||||
type IScheduleOutput = {
|
||||
|
||||
/**
|
||||
* 课程列表
|
||||
*/
|
||||
classList: IClassData[];
|
||||
|
||||
/**
|
||||
* 稀疏矩阵编号
|
||||
*/
|
||||
index: number;
|
||||
}[];
|
||||
|
||||
/**
|
||||
* Schedule API
|
||||
* 需要session与semester
|
||||
* 此 API 用来向教务处发起获取课程表的请求
|
||||
* 请求成功后将获得教务处返回的课程表JSON文件
|
||||
*/
|
||||
class Schedlue extends EduBase<IScheduleInput, IScheduleOutput> {
|
||||
|
||||
public override url = "/course_timetable";
|
||||
|
||||
public override method: HTTPMethod = HTTPMethod.GET;
|
||||
|
||||
public override params: IParamSetting<IScheduleInput> = {
|
||||
|
||||
cookie: {
|
||||
mapKey: "cookie",
|
||||
isHeader: true
|
||||
},
|
||||
|
||||
semester: {
|
||||
mapKey: "semester",
|
||||
}
|
||||
};
|
||||
|
||||
public constructor() {
|
||||
super();
|
||||
this.initDebugLabel("Schedule");
|
||||
|
||||
this.useEduCallback((data) => {
|
||||
const res: IScheduleOutput = [];
|
||||
|
||||
for( let i = 0; i < data.length; i++ ) {
|
||||
const classList: IClassData[] = [];
|
||||
const CTTDetails = data[i].CTTDetails ?? [];
|
||||
|
||||
for( let j = 0; j < CTTDetails.length; j++ ) {
|
||||
|
||||
classList.push({
|
||||
name: CTTDetails[j].Name,
|
||||
room: CTTDetails[j].Room,
|
||||
teacher: CTTDetails[j].Teacher,
|
||||
week: CTTDetails[j].Week,
|
||||
})
|
||||
}
|
||||
|
||||
res.push({
|
||||
classList,
|
||||
index: data[i].Id
|
||||
})
|
||||
}
|
||||
return res;
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { Schedlue };
|
||||
export default Schedlue;
|
@ -0,0 +1,119 @@
|
||||
|
||||
$theme-color-blue: #3EA3D8;
|
||||
$theme-color-red: #FF9393;
|
||||
|
||||
$theme-color-light-layout: #F8F8F8;
|
||||
$theme-color-light-background: #f4f0f1;
|
||||
$theme-color-light-title: rgba(0, 0, 0, .65);
|
||||
$theme-color-light-text: rgba(0, 0, 0, .5);
|
||||
|
||||
$theme-color-dark-layout: #1f1f1f;
|
||||
$theme-color-dark-background: #181615;
|
||||
$theme-color-dark-title: rgba(255, 255, 255, .65);
|
||||
$theme-color-dark-text: rgba(255, 255, 255, .5);
|
||||
|
||||
$black-filter: brightness(0) opacity(.65);
|
||||
$white-filter: brightness(100) opacity(.65);
|
||||
$blue-filter: opacity(1);
|
||||
|
||||
@mixin container {
|
||||
width: 88%;
|
||||
padding: 0 6%;
|
||||
}
|
||||
|
||||
// 页面容器外边距
|
||||
view.container {
|
||||
@include container;
|
||||
}
|
||||
|
||||
// 带阴影的 card
|
||||
view.card {
|
||||
width: calc( 100% - 40px );
|
||||
padding: 0 20px;
|
||||
border-radius: 15px;
|
||||
background-color: $theme-color-light-layout;
|
||||
box-shadow: 0 1.6px 3.6px 0 rgba(0, 0, 0, .08),
|
||||
0 0.3px 0.9px 0 rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
image.icon {
|
||||
filter: $black-filter;
|
||||
}
|
||||
|
||||
image.icon-sub {
|
||||
filter: $black-filter;
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
// 顶部导航栏阴影
|
||||
view.top-shadow {
|
||||
position: fixed;
|
||||
z-index: 9999;
|
||||
width: 100%;
|
||||
height: 10px;
|
||||
top: -10px;
|
||||
box-shadow: 0 1.6px 3.6px 0 rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
page {
|
||||
background-color: $theme-color-light-background;
|
||||
color: $theme-color-light-text;
|
||||
}
|
||||
|
||||
view, text {
|
||||
font-size: .97em;
|
||||
letter-spacing: .1em;
|
||||
font-family: Hiragino Sans GB, MicroSoft YaHei;
|
||||
}
|
||||
|
||||
view.h1 {
|
||||
color: $theme-color-light-title;
|
||||
font-size: 1.5em;
|
||||
letter-spacing: .1em;
|
||||
}
|
||||
|
||||
view.h2 {
|
||||
color: $theme-color-light-title;
|
||||
font-size: 1.3em;
|
||||
letter-spacing: .1em;
|
||||
}
|
||||
|
||||
view.h3 {
|
||||
color: $theme-color-light-title;
|
||||
font-size: 1em;
|
||||
letter-spacing: .1em;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark){
|
||||
page {
|
||||
background-color: $theme-color-dark-background;
|
||||
color: $theme-color-dark-text;
|
||||
}
|
||||
|
||||
view.card {
|
||||
background-color: $theme-color-dark-layout;
|
||||
}
|
||||
|
||||
image.icon {
|
||||
filter: $white-filter;
|
||||
}
|
||||
|
||||
image.icon-sub {
|
||||
filter: $white-filter;
|
||||
}
|
||||
|
||||
view.h1 {
|
||||
color: $theme-color-dark-title;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
view.h2 {
|
||||
color: $theme-color-dark-title;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
view.h3 {
|
||||
color: $theme-color-dark-title;
|
||||
font-size: 1em;
|
||||
}
|
||||
}
|
@ -1,27 +1,29 @@
|
||||
import {Logger} from "./utils/Logger";
|
||||
import * as label from "./utils/LogLabel";
|
||||
import { IAppAPIParam, IAnyData } from "./core/Api";
|
||||
import { IAppStorageParam, Storage, IStorageData } from "./core/Storage";
|
||||
import { Logger, LevelLogLabel, LifeCycleLogLabel } from "./core/Logger";
|
||||
|
||||
|
||||
App<IAppOption>({
|
||||
App<IAppAPIParam & IAppStorageParam & IAnyData>({
|
||||
|
||||
/**
|
||||
* 全局数据
|
||||
* API 模块需要的全局数据
|
||||
* 参见 "/core/Api"
|
||||
*/
|
||||
globalData: {},
|
||||
api: {
|
||||
nextId: 1,
|
||||
pool: new Set()
|
||||
},
|
||||
|
||||
/**
|
||||
* 存储缓存键值
|
||||
*/
|
||||
storage: new Map<string, Storage<IStorageData>>(),
|
||||
|
||||
/**
|
||||
* 小程序加载时
|
||||
*/
|
||||
onLaunch() {
|
||||
|
||||
Logger.log("hh",
|
||||
label.FatalLabel,label.ErrorLabel,label.WarnLabel,
|
||||
label.InfoLabel,label.DebugLabel,label.TraceLabel
|
||||
);
|
||||
|
||||
Logger.logM(
|
||||
[label.FatalLabel,label.ErrorLabel,label.WarnLabel,
|
||||
label.InfoLabel,label.DebugLabel,label.TraceLabel], "hh"
|
||||
);
|
||||
Logger.log("小程序启动...",
|
||||
LevelLogLabel.InfoLabel, LifeCycleLogLabel.OnLaunchLabel);
|
||||
}
|
||||
})
|
692
miniprogram/core/Api.ts
Normal file
@ -0,0 +1,692 @@
|
||||
import { Emitter, EventType, EventMixin } from "./Emitter";
|
||||
import { API_FAILED_SHOW_MESSAGE } from "./Config";
|
||||
import { Logger, LogLabel, LevelLogLabel, colorRadio, StatusLabel } from "./Logger";
|
||||
interface IAppAPIParam {
|
||||
api: {
|
||||
|
||||
/**
|
||||
* API 编号
|
||||
*/
|
||||
nextId: number;
|
||||
|
||||
/**
|
||||
* 请求池
|
||||
* 保存正在等待的 API 请求
|
||||
*/
|
||||
pool: Set<API<IAnyData, IAnyData>>;
|
||||
}
|
||||
}
|
||||
|
||||
interface IAnyData {
|
||||
[x:string]: any
|
||||
}
|
||||
|
||||
type IWxRequestOption<O> = WechatMiniprogram.RequestOption<O>;
|
||||
|
||||
type DeepReadonly<T> = {
|
||||
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 请求参数设置
|
||||
*/
|
||||
type IParamSetting<T extends IAnyData> = {
|
||||
[P in keyof T]: {
|
||||
|
||||
/**
|
||||
* 键值映射
|
||||
*/
|
||||
mapKey?: string,
|
||||
|
||||
/**
|
||||
* 默认值
|
||||
*/
|
||||
defaultValue?: T[P],
|
||||
|
||||
/**
|
||||
* ### 数据测试
|
||||
* 1、支持正则表达式测试 \
|
||||
* 2、支持使用 string === string 测试 \
|
||||
* 3、支持使用 number === number 测试 \
|
||||
* 4、支持使用自定义函数测试
|
||||
*/
|
||||
tester?: RegExp | ((data:T[P]) => boolean) | string | number,
|
||||
|
||||
/**
|
||||
* ### 预解析函数
|
||||
* 1、此函数用来处理该键值 \
|
||||
* 2、当返回 undefined 时此键值被遗弃 \
|
||||
* 3、返回值时,此键值被覆盖
|
||||
*
|
||||
* @param data 当前给定数据
|
||||
* @param key 当前给定数据键值
|
||||
* @param all 全部输入数据
|
||||
* @returns 解析结果
|
||||
*/
|
||||
parse?: ((data:T[P], key:string, all:DeepReadonly<Partial<T>>) => T[P] | undefined),
|
||||
|
||||
/**
|
||||
* 是否为请求头数据
|
||||
*/
|
||||
isHeader?: boolean,
|
||||
|
||||
/**
|
||||
* 是否为模板
|
||||
*/
|
||||
isTemplate?: boolean
|
||||
|
||||
/**
|
||||
* 是否可选
|
||||
*/
|
||||
Optional?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
type SuccessCallbackResult<O extends IAnyData> = WechatMiniprogram.RequestSuccessCallbackResult<O>;
|
||||
type GeneralCallbackResult = WechatMiniprogram.GeneralCallbackResult;
|
||||
|
||||
/**
|
||||
* API 事件
|
||||
*/
|
||||
type IAPIEvent<I extends IAnyData, O extends IAnyData> = {
|
||||
|
||||
/**
|
||||
* 当数据初始化事件
|
||||
*/
|
||||
initData: Partial<I>;
|
||||
|
||||
/**
|
||||
* 请求数据解析完成后
|
||||
*/
|
||||
parseRequestData: Partial<I>;
|
||||
|
||||
/**
|
||||
* 请求发送前
|
||||
*/
|
||||
request: IWxRequestOption<O>;
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
success: SuccessCallbackResult<O>;
|
||||
|
||||
/**
|
||||
* 失败回调
|
||||
*/
|
||||
fail: GeneralCallbackResult;
|
||||
|
||||
/**
|
||||
* 完成回调
|
||||
*/
|
||||
complete: GeneralCallbackResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出事件类型
|
||||
*/
|
||||
type IAPIResultEvent<O extends IAnyData, U extends IAnyData> = {
|
||||
|
||||
/**
|
||||
* 成功获取数据
|
||||
*/
|
||||
ok: O,
|
||||
|
||||
/**
|
||||
* 无论因为什么
|
||||
* 总之数据获取到
|
||||
*/
|
||||
no: GeneralCallbackResult & U,
|
||||
|
||||
/**
|
||||
* 完成了
|
||||
* 无论失败与否
|
||||
*/
|
||||
done: { data?: O } & GeneralCallbackResult & U
|
||||
}
|
||||
|
||||
/**
|
||||
* API 接口调用
|
||||
* @template I API 输入数据
|
||||
* @template O API 输出数据
|
||||
* @template E API 中的事件
|
||||
* @template U 用户自定义的输出数据
|
||||
*/
|
||||
class API<
|
||||
I extends IAnyData = IAnyData,
|
||||
O extends IAnyData = IAnyData,
|
||||
E extends Record<EventType, any> = Record<EventType, any>,
|
||||
U extends IAnyData = IAnyData
|
||||
> extends Emitter<EventMixin<IAPIEvent<I, O> & IAPIResultEvent<O, U>, E>> {
|
||||
|
||||
/**
|
||||
* 默认调试标签
|
||||
*/
|
||||
public static defaultLogLabel:LogLabel = new LogLabel(
|
||||
`API:API`, colorRadio(200, 120, 222)
|
||||
);
|
||||
|
||||
/**
|
||||
* 基础 URL
|
||||
* TODO: 这里可能涉及负载均衡
|
||||
*/
|
||||
public baseUrl: string = "https://jwc.nogg.cn";
|
||||
|
||||
/**
|
||||
* Logger 使用的标签
|
||||
*/
|
||||
private LogLabel:LogLabel = API.defaultLogLabel;
|
||||
|
||||
/**
|
||||
* Api 唯一 ID
|
||||
*/
|
||||
public key:string = "API";
|
||||
|
||||
/**
|
||||
* API url
|
||||
*/
|
||||
public url:string = "/";
|
||||
|
||||
/**
|
||||
* API 需要的参数列表
|
||||
*/
|
||||
public params:IParamSetting<I> = {} as any;
|
||||
|
||||
/**
|
||||
* API 需要的数据
|
||||
*/
|
||||
public data?:Partial<I>;
|
||||
|
||||
/**
|
||||
* 请求数据
|
||||
*/
|
||||
public requestData?:IWxRequestOption<O>;
|
||||
|
||||
//#region wx.request
|
||||
|
||||
public timeout?:number;
|
||||
public method:HTTPMethod = HTTPMethod.GET;
|
||||
public enableHttp2:boolean = false;
|
||||
public enableQuic:boolean = false;
|
||||
public enableCache:boolean = false;
|
||||
|
||||
/**
|
||||
* 是否自动解析返回的 json
|
||||
* 对应 wx.request 的 dataType
|
||||
*/
|
||||
public jsonParse:boolean = true;
|
||||
|
||||
//#endregion wx.request
|
||||
|
||||
/**
|
||||
* 初始化标签
|
||||
*/
|
||||
public initDebugLabel(key: string) {
|
||||
this.key = key;
|
||||
this.LogLabel = new LogLabel(
|
||||
`API:${ this.key }`, colorRadio(200, 120, 222)
|
||||
);
|
||||
|
||||
// 添加 API 生命周期调试事件
|
||||
this.on("request", (data) => {
|
||||
Logger.logMultiple(
|
||||
[LevelLogLabel.InfoLabel, this.LogLabel, StatusLabel.Pending],
|
||||
`请求发送中: `, data
|
||||
);
|
||||
})
|
||||
|
||||
this.on("success", (data) => {
|
||||
Logger.logMultiple(
|
||||
[LevelLogLabel.InfoLabel, this.LogLabel, StatusLabel.Success],
|
||||
`请求成功: `, data
|
||||
);
|
||||
})
|
||||
|
||||
this.on("fail", (data) => {
|
||||
Logger.logMultiple(
|
||||
[LevelLogLabel.ErrorLabel, this.LogLabel, StatusLabel.Failed],
|
||||
`请求失败: `, data.errMsg
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
* 注意:data 是不安全的,请传入数据副本
|
||||
* @param data API需要的全部数据
|
||||
*/
|
||||
public param(data?: Partial<I>):this {
|
||||
|
||||
this.data = data;
|
||||
|
||||
if (this.data === void 0) {
|
||||
Logger.log(`数据初始化异常: 没有输入 [data] 数据!`,
|
||||
LevelLogLabel.ErrorLabel, this.LogLabel);
|
||||
return this;
|
||||
}
|
||||
|
||||
for (let key in this.params) {
|
||||
|
||||
let data = this.data[key];
|
||||
let { defaultValue, Optional, tester } = this.params[key];
|
||||
|
||||
// 默认值赋予
|
||||
if (data === void 0 && defaultValue !== void 0) {
|
||||
this.data[key] = defaultValue;
|
||||
}
|
||||
|
||||
// 数据存在测试
|
||||
if (data === void 0 && !Optional) {
|
||||
Logger.log(`数据校验异常: 数据 [${key}] 是必须的,但是并没有接收到!`,
|
||||
LevelLogLabel.ErrorLabel, this.LogLabel);
|
||||
}
|
||||
|
||||
// 用户自定义测试
|
||||
if (data !== void 0 && tester !== void 0) {
|
||||
let testRes:boolean = false;
|
||||
|
||||
if (tester instanceof RegExp) {
|
||||
testRes = tester.test(data!);
|
||||
} else if (typeof tester === "string" || typeof tester === "number") {
|
||||
testRes = tester === data;
|
||||
} else if (tester instanceof Function) {
|
||||
testRes = tester(data!);
|
||||
} else {
|
||||
Logger.logMultiple(
|
||||
[LevelLogLabel.ErrorLabel, this.LogLabel],
|
||||
`数据校验异常: [${ key }] 参数存在未知类型的 tester:`, tester
|
||||
);
|
||||
}
|
||||
|
||||
if (!testRes) {
|
||||
Logger.logMultiple(
|
||||
[LevelLogLabel.ErrorLabel, this.LogLabel],
|
||||
`数据校验异常: [${ key }] 参数数据未通过自定义的 tester:`, data
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 触发数据初始化事件
|
||||
(this as Emitter<IAnyData>).emit("initData", this.data);
|
||||
|
||||
// 重置请求数据
|
||||
const requestData:IWxRequestOption<O> = this.requestData = {
|
||||
url: this.baseUrl + this.url,
|
||||
data: {}, header: {},
|
||||
timeout: this.timeout,
|
||||
method: this.method,
|
||||
dataType: this.jsonParse ? "json" : undefined,
|
||||
enableHttp2: this.enableHttp2,
|
||||
enableQuic: this.enableQuic,
|
||||
enableCache: this.enableCache
|
||||
};
|
||||
|
||||
// 数据解析
|
||||
for (let key in this.params) {
|
||||
|
||||
let data = this.data[key];
|
||||
let { parse } = this.params[key];
|
||||
|
||||
// 数据预解析
|
||||
if (parse !== void 0) {
|
||||
this.data[key] = parse(data!, key, this.data as DeepReadonly<Partial<I>>);
|
||||
}
|
||||
}
|
||||
|
||||
// 触发数据解析
|
||||
(this as Emitter<IAnyData>).emit("parseRequestData", this.data);
|
||||
|
||||
// 数据收集
|
||||
for (let key in this.params) {
|
||||
|
||||
let data = this.data[key];
|
||||
let { isHeader, isTemplate, mapKey } = this.params[key];
|
||||
let useKey = mapKey ?? key;
|
||||
|
||||
// 加载数据
|
||||
if (!isTemplate) {
|
||||
if (isHeader) {
|
||||
requestData.header![useKey] = data;
|
||||
} else {
|
||||
(requestData.data as IAnyData)[useKey] = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求的唯一标识符
|
||||
*/
|
||||
protected id:number = 0;
|
||||
|
||||
/**
|
||||
* 将此请求加入到请求池
|
||||
*/
|
||||
protected addPool():this {
|
||||
|
||||
let app = getApp<IAppAPIParam>();
|
||||
if (app.api.pool.has(this as any)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// 获取标识符
|
||||
if (!this.id) {
|
||||
this.id = app.api.nextId;
|
||||
app.api.nextId ++;
|
||||
}
|
||||
|
||||
app.api.pool.add(this as any);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从 pool 中移除
|
||||
*/
|
||||
protected removePool():this {
|
||||
let app = getApp<IAppAPIParam>();
|
||||
app.api.pool.delete(this as any);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 寻找相似的请求
|
||||
*/
|
||||
protected findSameAPI():API<IAnyData, IAnyData> | undefined {
|
||||
|
||||
if (this.requestData === void 0) {
|
||||
Logger.log(`搜索相似请求异常: 没有收集 [requestData] 数据!`,
|
||||
LevelLogLabel.ErrorLabel, this.LogLabel);
|
||||
return;
|
||||
}
|
||||
|
||||
let app = getApp<IAppAPIParam>();
|
||||
let sameAPI:API<IAnyData, IAnyData> | undefined;
|
||||
|
||||
// 判断 API 是否相似
|
||||
app.api.pool.forEach((api) => {
|
||||
if ((api as API | this) === this) return;
|
||||
if (!api.requestData) return;
|
||||
if (api.requestData!.url !== this.requestData!.url) return;
|
||||
if (api.requestData!.method !== this.requestData!.method) return;
|
||||
sameAPI = api;
|
||||
});
|
||||
|
||||
return sameAPI;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记此实例是否已被使用
|
||||
*/
|
||||
private isUsed = false;
|
||||
|
||||
/**
|
||||
* 请求策略
|
||||
*/
|
||||
public policy:RequestPolicy = RequestPolicy.RequestAnyway;
|
||||
|
||||
/**
|
||||
* 运行 API
|
||||
*/
|
||||
public request():this {
|
||||
|
||||
if (this.requestData === void 0) {
|
||||
Logger.log(`请求发送异常: 没有收集 [requestData] 数据!`,
|
||||
LevelLogLabel.ErrorLabel, this.LogLabel);
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.isUsed) {
|
||||
Logger.log(`请求发送异常: 此实例已经使用过了,请使用新实例操作`,
|
||||
LevelLogLabel.ErrorLabel, this.LogLabel);
|
||||
return this;
|
||||
} else {
|
||||
this.isUsed = true;
|
||||
}
|
||||
|
||||
// 加入请求池
|
||||
this.addPool();
|
||||
|
||||
// 发起请求
|
||||
let request = () => {
|
||||
|
||||
// 触发请求发送事件
|
||||
(this as Emitter<IAnyData>).emit("request", this.requestData!)
|
||||
|
||||
wx.request<O>({
|
||||
...this.requestData!,
|
||||
success: (e) => {
|
||||
(this as Emitter<IAnyData>).emit("success", e);
|
||||
},
|
||||
fail: (e) => {
|
||||
(this as Emitter<IAnyData>).emit("fail", e);
|
||||
},
|
||||
complete: (e) => {
|
||||
(this as Emitter<IAnyData>).emit("complete", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.policy !== RequestPolicy.RequestAnyway) {
|
||||
let lastAPI = this.findSameAPI();
|
||||
|
||||
if (lastAPI) {
|
||||
|
||||
// 被上次请求阻止
|
||||
if (this.policy === RequestPolicy.BlockByLastRequest) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// 使用上次请求结果
|
||||
if (this.policy === RequestPolicy.useLastRequest) {
|
||||
lastAPI.on("success", (e) => {
|
||||
(this as Emitter<IAnyData>).emit("success", e as SuccessCallbackResult<O>);
|
||||
(this as Emitter<IAnyData>).emit("complete", {errMsg: e.errMsg});
|
||||
});
|
||||
lastAPI.on("fail", (e) => {
|
||||
(this as Emitter<IAnyData>).emit("fail", e);
|
||||
(this as Emitter<IAnyData>).emit("complete", {errMsg: e.errMsg});
|
||||
});
|
||||
}
|
||||
|
||||
// 等待上次请求
|
||||
if (this.policy === RequestPolicy.waitLastRequest) {
|
||||
lastAPI.on("success", () => request());
|
||||
lastAPI.on("fail", () => request());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
request();
|
||||
}
|
||||
|
||||
// 监听请求完成后,从 pool 中移除,释放内存
|
||||
this.on("complete", () => {
|
||||
this.removePool();
|
||||
})
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 等待结果
|
||||
*/
|
||||
public waitRequest(): Promise<IRespondData<O>>;
|
||||
public waitRequest(callBack: ICallBack<O>): this;
|
||||
public waitRequest(callBack?: ICallBack<O>): Promise<IRespondData<O>> | this {
|
||||
|
||||
// 存在 callback 使用传统回调
|
||||
if (callBack) {
|
||||
callBack.success && this.on("success", callBack.success);
|
||||
callBack.fail && this.on("fail", callBack.fail);
|
||||
callBack.complete && this.on("complete", callBack.complete);
|
||||
return this;
|
||||
}
|
||||
|
||||
// 不存在 callback 使用 Promise 对象
|
||||
else {
|
||||
return new Promise((r) => {
|
||||
this.on("success", r);
|
||||
this.on("fail", r);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public wait(): Promise<IAPIResultEvent<O, U>["done"]>;
|
||||
public wait(callBack: IResCallBack<O, U>): this;
|
||||
public wait(callBack?: IResCallBack<O, U>): Promise<IAPIResultEvent<O, U>["done"]> | this {
|
||||
|
||||
// 存在 callback 使用传统回调
|
||||
if (callBack) {
|
||||
callBack.ok && this.on("ok", callBack.ok);
|
||||
callBack.no && this.on("no", callBack.no);
|
||||
callBack.done && this.on("done", callBack.done);
|
||||
return this;
|
||||
}
|
||||
|
||||
// 不存在 callback 使用 Promise 对象
|
||||
else {
|
||||
return new Promise((r) => {
|
||||
this.on("done", r);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求加载时显示加载动画
|
||||
* @param message 消息 可以为函数
|
||||
* @param mask 使用蒙版阻止点击穿透
|
||||
*/
|
||||
public showLoading(message: string | ((data?: Partial<I>) => string), mask: boolean = false): this {
|
||||
|
||||
// 获取标题
|
||||
let title: string = message instanceof Function ? message(this.data) : message;
|
||||
|
||||
this.on("request", () => {
|
||||
wx.showLoading({
|
||||
title, mask
|
||||
})
|
||||
});
|
||||
|
||||
this.on("complete", () => {
|
||||
wx.hideLoading();
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* 显示导航栏加载动画
|
||||
*/
|
||||
public showNavigationBarLoading(): this {
|
||||
|
||||
this.on("request", () => {
|
||||
wx.showNavigationBarLoading()
|
||||
});
|
||||
|
||||
this.on("complete", () => {
|
||||
wx.hideNavigationBarLoading();
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动挂载失败回调
|
||||
*/
|
||||
public addFailedCallBack(): this {
|
||||
this.on("fail", (e) => {
|
||||
(this as Emitter<IAnyData>).emit("no", e as any);
|
||||
(this as Emitter<IAnyData>).emit("done", e as any);
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求失败后的提示语句
|
||||
*/
|
||||
public showFailed(): this {
|
||||
|
||||
// 生成随机索引值
|
||||
let randomIndex = Math.floor(
|
||||
Math.random() * API_FAILED_SHOW_MESSAGE.length
|
||||
);
|
||||
|
||||
this.on("fail", () => {
|
||||
wx.showToast({
|
||||
title: API_FAILED_SHOW_MESSAGE[randomIndex],
|
||||
icon: "none"
|
||||
});
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动响应数据
|
||||
*/
|
||||
type IRespondData<O extends IAnyData> = Partial<IAPIEvent<IAnyData, O>["success"]> & IAPIEvent<IAnyData, O>["fail"];
|
||||
|
||||
/**
|
||||
* 回调对象
|
||||
*/
|
||||
interface ICallBack<O extends IAnyData> {
|
||||
success?: (data: IAPIEvent<{}, O>["success"]) => any;
|
||||
fail?: (data: IAPIEvent<{}, O>["fail"]) => any;
|
||||
complete?: (data: IAPIEvent<{}, O>["complete"]) => any;
|
||||
}
|
||||
|
||||
interface IResCallBack<O extends IAnyData, U extends IAnyData> {
|
||||
ok?: (data: IAPIResultEvent<O, U>["ok"]) => any;
|
||||
no?: (data: IAPIResultEvent<O, U>["no"]) => any;
|
||||
done?: (data: IAPIResultEvent<O, U>["done"]) => any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request 请求策略
|
||||
* 此策略用于节流
|
||||
*/
|
||||
enum RequestPolicy {
|
||||
|
||||
/**
|
||||
* 什么都不管,发就完了
|
||||
*/
|
||||
RequestAnyway = 1,
|
||||
|
||||
/**
|
||||
* 如果存在等待中的相似请求
|
||||
* 等待相似请求结束后在发送
|
||||
*/
|
||||
waitLastRequest = 2,
|
||||
|
||||
/**
|
||||
* 如果存在等待中的相似请求
|
||||
* 阻止本次请求发送
|
||||
* 将相似请求的结果作为本次请求结果
|
||||
*/
|
||||
useLastRequest = 3,
|
||||
|
||||
/**
|
||||
* 如果存在等待中的相似请求
|
||||
* 阻止本次请求发送
|
||||
*/
|
||||
BlockByLastRequest = 4
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP 请求类型
|
||||
*/
|
||||
enum HTTPMethod {
|
||||
OPTIONS = "OPTIONS",
|
||||
GET = "GET",
|
||||
HEAD = "HEAD",
|
||||
POST = "POST",
|
||||
PUT = "PUT",
|
||||
DELETE = "DELETE",
|
||||
TRACE = "TRACE",
|
||||
CONNECT = "CONNECT"
|
||||
}
|
||||
|
||||
export default API;
|
||||
export { API, IParamSetting, IAppAPIParam, IAnyData, ICallBack, HTTPMethod, RequestPolicy, GeneralCallbackResult }
|
@ -10,12 +10,19 @@
|
||||
*/
|
||||
export const LOGGER_CONSOLE:boolean = true;
|
||||
|
||||
/**
|
||||
* 是否在控制台输出时启用标签样式
|
||||
* 如果在手机上调试可以关闭此选项
|
||||
* 因为手机上的控制台无法正确显示样式
|
||||
*/
|
||||
export const LOGGER_STYLE:boolean = true;
|
||||
|
||||
/**
|
||||
* 调试过滤器
|
||||
* 按照 LogLabel 进行过滤
|
||||
*
|
||||
* 注意:
|
||||
* 1、行与行是之间是 || 关系
|
||||
* 1、行与行之间是 || 关系
|
||||
* 2、每行的元素之间是 && 关系
|
||||
* 3、支持正则表达式
|
||||
* 4、字符串使用 === 严格匹配
|
||||
@ -29,3 +36,14 @@ export const LOGGER_FILTER:Array<RegExp | string>[] = [
|
||||
// 输出警告和错误
|
||||
// ["WARN", "ERROR", "FATAL"],
|
||||
];
|
||||
|
||||
/**
|
||||
* 请求失败的提示用语
|
||||
* 请求失败时如果选择自动显示消息
|
||||
* 则会从以下内容中选择
|
||||
*/
|
||||
export const API_FAILED_SHOW_MESSAGE: string[] = [
|
||||
"失败啦(ó_ò。)", "服务器睡着了", "数据移民火星了",
|
||||
"数据在半路走丢了", "服务器打了个瞌睡", "服务器被玩坏了",
|
||||
"服务器在扶老奶奶过马路", "服务器累了", "服务器在拯救世界"
|
||||
]
|
277
miniprogram/core/Data.ts
Normal file
@ -0,0 +1,277 @@
|
||||
import { Storage } from "./Storage";
|
||||
|
||||
/**
|
||||
* 数据层键值设置
|
||||
*/
|
||||
interface IDataParamSettingItem {
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
type: any;
|
||||
|
||||
/**
|
||||
* 键值是否可以获取
|
||||
*/
|
||||
get?: ((...P: any) => this["type"]) | INone;
|
||||
|
||||
/**
|
||||
* 键值是否可以设置
|
||||
*/
|
||||
set?: ((...P: [this["type"], ...any]) => any) | INone;
|
||||
|
||||
/**
|
||||
* 是否仅为异步获取
|
||||
*/
|
||||
getAsync?: ((...P: any) => Promise<this["type"]>) | INone;
|
||||
|
||||
/**
|
||||
* 是否仅为异步设置
|
||||
*/
|
||||
setAsync?: ((...P: [this["type"], ...any]) => Promise<any>) | INone;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据层参数类型
|
||||
*/
|
||||
interface IDataParamSetting {
|
||||
[x: string]: IDataParamSettingItem
|
||||
}
|
||||
|
||||
type INone = undefined | void;
|
||||
|
||||
/**
|
||||
* 注册表结构
|
||||
*/
|
||||
type IRegistryItem<S extends IDataParamSettingItem> = {
|
||||
|
||||
/**
|
||||
* 获取方法
|
||||
*/
|
||||
get: S["get"];
|
||||
|
||||
/**
|
||||
* 异步获取方法
|
||||
*/
|
||||
getAsync: S["getAsync"] extends Function ? S["getAsync"] :
|
||||
S["get"] extends ((...P: any) => S["type"]) ? (...param: Parameters<S["get"]>) => Promise<S["type"]> : INone;
|
||||
|
||||
/**
|
||||
* 设置方法
|
||||
*/
|
||||
set: S["set"];
|
||||
|
||||
/**
|
||||
* 异步设置方法
|
||||
*/
|
||||
setAsync: S["setAsync"] extends Function ? S["setAsync"] :
|
||||
S["set"] extends ((...P: [S["type"], ...any]) => any) ? (...param: Parameters<S["set"]>) => Promise<ReturnType<S["set"]>> : INone;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册表参数类型
|
||||
*/
|
||||
type IRegistry<D extends IDataParamSetting> = {
|
||||
[P in keyof D]: IRegistryItem<D[P]>;
|
||||
}
|
||||
|
||||
type IRegistryPartial<D extends IDataParamSetting> = {
|
||||
[P in keyof D]?: Partial<IRegistryItem<D[P]>>;
|
||||
}
|
||||
|
||||
|
||||
type IAutoSelect<IF extends boolean, A, B> = IF extends true ? A : B;
|
||||
|
||||
/**
|
||||
* Core 数据层架构
|
||||
*
|
||||
* 使用示例:
|
||||
* ```typescript
|
||||
* class TestData extends Data<{
|
||||
* test: {
|
||||
* type: number
|
||||
* get: () => number,
|
||||
* set: (val: number) => void,
|
||||
* getAsync: () => Promise<number>
|
||||
* }
|
||||
* }> {
|
||||
* public onLoad() {
|
||||
* let dataObject = {key: 1}
|
||||
* this.getter("test", () => 1);
|
||||
* this.registerKeyFromObject(dataObject, "test", "key");
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Data<D extends IDataParamSetting> {
|
||||
|
||||
/**
|
||||
* getter setter 注册表
|
||||
*/
|
||||
private registryList: IRegistryPartial<D> = {};
|
||||
|
||||
/**
|
||||
* 加载函数
|
||||
*/
|
||||
public onLoad(): any {};
|
||||
|
||||
/**
|
||||
* 注册一个 Setter 到键值上
|
||||
* @param key 注册的键值
|
||||
* @param setter 注册的 Setter
|
||||
* @param isAsync 是否为异步函数
|
||||
*/
|
||||
protected setter<KEY extends keyof D> (key: KEY, setter: IRegistryItem<D[KEY]>["set"]): this
|
||||
protected setter<KEY extends keyof D> (key: KEY, setter: IRegistryItem<D[KEY]>["setAsync"], isAsync: true): this
|
||||
protected setter<
|
||||
KEY extends keyof D,
|
||||
ASYNC extends boolean
|
||||
> (
|
||||
key: KEY,
|
||||
setter: IAutoSelect<ASYNC, IRegistryItem<D[KEY]>["setAsync"], IRegistryItem<D[KEY]>["set"]>,
|
||||
isAsync?: ASYNC
|
||||
): this {
|
||||
|
||||
// 如果此键值不存在,新建
|
||||
if (!this.registryList[key]) this.registryList[key] = {};
|
||||
|
||||
// 设置异步 setter
|
||||
if (isAsync) this.registryList[key]!.setAsync = setter as IRegistryItem<D[KEY]>["setAsync"];
|
||||
|
||||
// 设置同步 setter
|
||||
else this.registryList[key]!.set = setter as IRegistryItem<D[KEY]>["set"];
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册一个 Getter 到键值上
|
||||
* @param key 注册的键值
|
||||
* @param getter 注册的 Getter
|
||||
* @param isAsync 是否为异步函数
|
||||
*/
|
||||
protected getter<KEY extends keyof D> (key: KEY, getter: IRegistryItem<D[KEY]>["get"]): this
|
||||
protected getter<KEY extends keyof D> (key: KEY, getter: IRegistryItem<D[KEY]>["getAsync"], isAsync: true): this
|
||||
protected getter<
|
||||
KEY extends keyof D,
|
||||
ASYNC extends boolean
|
||||
> (
|
||||
key: KEY,
|
||||
getter: IAutoSelect<ASYNC, IRegistryItem<D[KEY]>["getAsync"], IRegistryItem<D[KEY]>["get"]>,
|
||||
isAsync?: ASYNC
|
||||
): this {
|
||||
|
||||
// 如果此键值不存在,新建
|
||||
if (!this.registryList[key]) this.registryList[key] = {};
|
||||
|
||||
// 设置异步 getter
|
||||
if (isAsync) this.registryList[key]!.getAsync = getter as IRegistryItem<D[KEY]>["getAsync"];
|
||||
|
||||
// 设置同步 getter
|
||||
else this.registryList[key]!.get = getter as IRegistryItem<D[KEY]>["get"];
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象的键值关联到 Data 层中
|
||||
* @param key Data 层键值
|
||||
* @param keyFromObject 对象源键值
|
||||
* @param object 关联对象
|
||||
*/
|
||||
protected registerKeyFromObject<
|
||||
KEY extends keyof D,
|
||||
F extends string,
|
||||
O extends {[K in F]: D[KEY]["type"]}
|
||||
> (object: O, key: KEY, keyFromObject: F = key as any) {
|
||||
|
||||
// 注册同步获取
|
||||
this.getter(key, () => {
|
||||
return object[keyFromObject]
|
||||
});
|
||||
|
||||
// 注册同步设置
|
||||
this.setter(key, (data: any) => {
|
||||
object[keyFromObject] = data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联 Storage 中的 key
|
||||
* @param key Data 层键值
|
||||
* @param keyFromStorage StorageKey
|
||||
*/
|
||||
protected registerKeyFromStorage<
|
||||
KEY extends keyof D,
|
||||
F extends string,
|
||||
S extends Storage<{[K in F]: D[KEY]["type"]}>
|
||||
> (storage: S, key: KEY, keyFromStorage: F = key as any) {
|
||||
|
||||
// 同步获取
|
||||
this.getter(key, () => {
|
||||
return storage.get(keyFromStorage);
|
||||
});
|
||||
|
||||
// 同步设置
|
||||
this.setter(key, (data: any) => {
|
||||
storage.set(keyFromStorage, data);
|
||||
});
|
||||
|
||||
// 异步设置
|
||||
this.setter(key, (async (data: any) => {
|
||||
await storage.set(keyFromStorage, data);
|
||||
}) as any, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据对象
|
||||
* @returns 数据对象
|
||||
*/
|
||||
public export(): IRegistry<D> {
|
||||
this.autoFillFunction();
|
||||
return this.registryList as IRegistry<D>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动填充缺失的异步函数
|
||||
* 在注册表中搜索全部的同步函数
|
||||
* 并自动填充对应的异步函数
|
||||
* 此函数会在 export 前静默执行
|
||||
*/
|
||||
protected autoFillFunction(): void {
|
||||
|
||||
// 填充函数
|
||||
const fillFunction = <KEY extends keyof D>(key: KEY): void => {
|
||||
|
||||
const item = this.registryList[key] as IRegistryItem<D[KEY]>;
|
||||
if (!item) return;
|
||||
|
||||
// 检验 getter
|
||||
if (item.get && !item.getAsync) {
|
||||
item.getAsync = this.syncFn2AsyncFn(item.get) as any;
|
||||
}
|
||||
|
||||
// 检验 setter
|
||||
if (item.set && !item.setAsync) {
|
||||
item.setAsync = this.syncFn2AsyncFn(item.set) as any;
|
||||
}
|
||||
}
|
||||
|
||||
// 在注册表中查找
|
||||
for (const key in this.registryList) fillFunction(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将同步函数转换为异步函数
|
||||
* @param fn 同步函数
|
||||
*/
|
||||
protected syncFn2AsyncFn<F extends (...p: any) => any> (fn: F): (...param: Parameters<F>) => ReturnType<F> {
|
||||
const asyncFn = async (...param: [D]) => {
|
||||
return fn(...param);
|
||||
};
|
||||
return asyncFn as any;
|
||||
}
|
||||
}
|
||||
|
||||
export { Data };
|
||||
export default Data;
|
104
miniprogram/core/Emitter.ts
Normal file
@ -0,0 +1,104 @@
|
||||
export type EventType = string | symbol;
|
||||
|
||||
// An event handler can take an optional event argument
|
||||
// and should not return a value
|
||||
export type Handler<T = any> = (event: T) => void;
|
||||
|
||||
// An array of all currently registered event handlers for a type
|
||||
export type EventHandlerList<T = any> = Array<Handler<T>>;
|
||||
|
||||
// A map of event types and their corresponding event handlers.
|
||||
export type EventHandlerMap<Events extends Record<EventType, any>> = Map<
|
||||
keyof Events,
|
||||
EventHandlerList<Events[keyof Events]>
|
||||
>;
|
||||
|
||||
// Emitter function type
|
||||
type IEmitParamType<E extends Record<EventType, any>, K extends keyof E> =
|
||||
E[K] extends ( undefined | void ) ? [type: K] : [type: K, evt: E[K]];
|
||||
|
||||
// Mixin to event object
|
||||
export type EventMixin<A extends Record<EventType, any>, B extends Record<EventType, any>> = {
|
||||
[P in (keyof A | keyof B)] :
|
||||
P extends (keyof A & keyof B) ?
|
||||
A[P] :
|
||||
P extends keyof A ?
|
||||
A[P] :
|
||||
P extends keyof B ? B[P] :
|
||||
never;
|
||||
}
|
||||
|
||||
export class Emitter<Events extends Record<EventType, any>> {
|
||||
|
||||
/**
|
||||
* A Map of event names to registered handler functions.
|
||||
*/
|
||||
public all: EventHandlerMap<Events>;
|
||||
|
||||
public constructor() {
|
||||
this.all = new Map();
|
||||
}
|
||||
|
||||
public resetAll() {
|
||||
this.all = new Map();
|
||||
}
|
||||
|
||||
public reset<Key extends keyof Events>(type: Key) {
|
||||
this.all!.set(type, [] as EventHandlerList<Events[keyof Events]>);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an event handler for the given type.
|
||||
* @param {string|symbol} type Type of event to listen for
|
||||
* @param {Function} handler Function to call in response to given event
|
||||
* @memberOf mitt
|
||||
*/
|
||||
public on<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>) {
|
||||
const handlers: Array<Handler<Events[Key]>> | undefined = this.all!.get(type);
|
||||
if (handlers) {
|
||||
handlers.push(handler);
|
||||
}
|
||||
else {
|
||||
this.all!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an event handler for the given type.
|
||||
* If `handler` is omitted, all handlers of the given type are removed.
|
||||
* @param {string|symbol} type Type of event to unregister `handler` from
|
||||
* @param {Function} [handler] Handler function to remove
|
||||
* @memberOf mitt
|
||||
*/
|
||||
public off<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>) {
|
||||
const handlers: Array<Handler<Events[Key]>> | undefined = this.all!.get(type);
|
||||
if (handlers) {
|
||||
if (handler) {
|
||||
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
|
||||
}
|
||||
else {
|
||||
this.all!.set(type, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke all handlers for the given type.
|
||||
*
|
||||
* @param {string|symbol} type The event type to invoke
|
||||
* @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
|
||||
* @memberOf mitt
|
||||
*/
|
||||
public emit<Key extends keyof Events>(...param: IEmitParamType<Events, Key>): this {
|
||||
const [ type, evt ] = param;
|
||||
let handlers = this.all!.get(type);
|
||||
if (handlers) {
|
||||
(handlers as EventHandlerList<Events[keyof Events]>)
|
||||
.slice()
|
||||
.map((handler) => {
|
||||
handler(evt!);
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
795
miniprogram/core/Logger.ts
Normal file
@ -0,0 +1,795 @@
|
||||
import { LOGGER_FILTER, LOGGER_CONSOLE, LOGGER_STYLE } from "./Config";
|
||||
|
||||
/**
|
||||
* 调试输出样式
|
||||
*/
|
||||
class LogStyle {
|
||||
|
||||
/**
|
||||
* 日志文字颜色
|
||||
*/
|
||||
private color:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志背景颜色
|
||||
*/
|
||||
private backgroundColor:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字粗细
|
||||
*/
|
||||
private weight:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字大小
|
||||
*/
|
||||
private size:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字字体
|
||||
*/
|
||||
private family:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字圆角
|
||||
*/
|
||||
private borderRadius:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字边框
|
||||
*/
|
||||
private border:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字外边距
|
||||
*/
|
||||
private margin:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字内边距
|
||||
*/
|
||||
private padding:string | undefined;
|
||||
|
||||
/**
|
||||
* 设置颜色
|
||||
* @param color 日志文字颜色
|
||||
* @param backgroundColor 日志背景颜色
|
||||
*/
|
||||
public setColor(color?:string, backgroundColor?:string):LogStyle {
|
||||
this.color = color ?? this.color;
|
||||
this.backgroundColor = backgroundColor ?? this.backgroundColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置边框
|
||||
* @param borderRadius 日志文字圆角
|
||||
* @param border 日志文字边框
|
||||
*/
|
||||
public setBorder(borderRadius?:string, border?:string):LogStyle {
|
||||
this.borderRadius = borderRadius ?? this.borderRadius;
|
||||
this.border = border ?? this.border;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置文字
|
||||
* @param weight 日志文字粗细
|
||||
* @param family 日志文字字体
|
||||
*/
|
||||
public setFont(weight?:string, family?:string):LogStyle {
|
||||
this.weight = weight ?? this.weight;
|
||||
this.family = family ?? this.family;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置文字大小
|
||||
* @param size 日志文字大小
|
||||
*/
|
||||
public setSize(size?:string):LogStyle {
|
||||
this.size = size ?? this.size;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置内边距外边距
|
||||
* @param padding 内边距
|
||||
* @param margin 外边距
|
||||
*/
|
||||
public setBlank(padding?:string, margin?:string):LogStyle {
|
||||
this.padding = padding ?? this.padding;
|
||||
this.margin = margin ?? this.margin;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符化转义样式
|
||||
*/
|
||||
public stringify():string {
|
||||
let stringArr:string[] = [];
|
||||
|
||||
this.color && stringArr.push(`color:${ this.color }`);
|
||||
this.backgroundColor && stringArr.push(`background-color:${ this.backgroundColor }`);
|
||||
this.weight && stringArr.push(`font-weight:${ this.weight }`);
|
||||
this.family && stringArr.push(`font-family:${ this.family }`);
|
||||
this.borderRadius && stringArr.push(`border-radius:${ this.borderRadius }`);
|
||||
this.border && stringArr.push(`border:${ this.border }`);
|
||||
this.size && stringArr.push(`font-size:${ this.size }`);
|
||||
this.padding && stringArr.push(`padding:${ this.padding }`);
|
||||
this.margin && stringArr.push(`margin:${ this.margin }`);
|
||||
|
||||
return stringArr.join(";");
|
||||
}
|
||||
|
||||
/**
|
||||
* 克隆一个新的 LogStyle
|
||||
*/
|
||||
public clone():LogStyle {
|
||||
return new LogStyle()
|
||||
.setColor(this.color, this.backgroundColor)
|
||||
.setBorder(this.borderRadius, this.border)
|
||||
.setFont(this.weight, this.family)
|
||||
.setBlank(this.padding, this.margin)
|
||||
.setSize(this.size)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志标签
|
||||
*/
|
||||
class LogLabel {
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
* 用于标识这个类别
|
||||
*/
|
||||
public key:string;
|
||||
|
||||
/**
|
||||
* 文字样式
|
||||
*/
|
||||
public style:LogStyle;
|
||||
|
||||
/**
|
||||
* 是否受到过滤器影响
|
||||
*/
|
||||
public checked:boolean;
|
||||
|
||||
/**
|
||||
* 是否输出
|
||||
*/
|
||||
public display:boolean;
|
||||
|
||||
/**
|
||||
* 是否为附件标签
|
||||
* 例如回车、时间、代码位置
|
||||
*/
|
||||
public attach:boolean;
|
||||
|
||||
/**
|
||||
* @param key 关键字
|
||||
* @param style 文字样式
|
||||
*/
|
||||
constructor(key:string, style:LogStyle,
|
||||
checked?:boolean, display?:boolean, attach?:boolean) {
|
||||
this.key = key;
|
||||
this.style = style;
|
||||
this.checked = checked ?? true;
|
||||
this.display = display ?? true;
|
||||
this.attach = attach ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得 Logger 输出使用的内容
|
||||
*/
|
||||
public getLoggerOutput():string {
|
||||
if(!this.display) return "";
|
||||
return `%c${ this.key }`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得 Text 输出内容
|
||||
*/
|
||||
public getTextOutput():string {
|
||||
if(!this.display) return "";
|
||||
return `[${ this.key }]`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得 style 格式化
|
||||
*/
|
||||
public getStyleOutput():string {
|
||||
if(!this.display) return "";
|
||||
return this.style.stringify();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验
|
||||
*/
|
||||
public checking(src:RegExp | string):boolean {
|
||||
|
||||
let pass = false;
|
||||
|
||||
// 关闭校验
|
||||
if(!this.checked) return pass;
|
||||
|
||||
if(src instanceof RegExp) {
|
||||
pass = (src as RegExp).test(this.key)
|
||||
} else {
|
||||
pass = (src as string) === this.key;
|
||||
}
|
||||
|
||||
return pass;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 多重内容捆绑
|
||||
* 用于 log 输出
|
||||
*/
|
||||
class MultipleLogContent<T extends Array<any>> {
|
||||
|
||||
/**
|
||||
* 输出内容
|
||||
*/
|
||||
private readonly content:T;
|
||||
|
||||
/**
|
||||
* @param content 输出内容
|
||||
*/
|
||||
public constructor(...content:T) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取内容
|
||||
*/
|
||||
public getContent():T {
|
||||
return this.content;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化日志输出
|
||||
*/
|
||||
class Logger {
|
||||
|
||||
/**
|
||||
* 标签过滤
|
||||
*/
|
||||
public static filterLog(filter:Array<RegExp | string>, labels:LogLabel[]):boolean {
|
||||
|
||||
let passNum:number = 0;
|
||||
|
||||
for(let i = 0; i < filter.length; i++) {
|
||||
|
||||
let pass:boolean = false;
|
||||
for(let j = 0; j < labels.length; j++) {
|
||||
|
||||
pass = labels[j].checking(filter[i]);
|
||||
if(pass) break;
|
||||
}
|
||||
|
||||
if(pass) passNum ++;
|
||||
}
|
||||
|
||||
return passNum === filter.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测是否应该输出
|
||||
* @param labels 使用标签
|
||||
*/
|
||||
public static testLog(...labels:LogLabel[]):boolean {
|
||||
|
||||
if(!LOGGER_CONSOLE) return false;
|
||||
|
||||
let isLogging = false;
|
||||
for(let i = 0; i < LOGGER_FILTER.length; i++) {
|
||||
|
||||
// 判断是否进行输出
|
||||
isLogging = Logger.filterLog(LOGGER_FILTER[i], labels);
|
||||
|
||||
if(isLogging) break;
|
||||
}
|
||||
|
||||
return isLogging;
|
||||
}
|
||||
|
||||
/**
|
||||
* 收集计算样式
|
||||
* @param labels 使用标签
|
||||
*/
|
||||
public static calcStyle(...labels:LogLabel[]):[string[], string[]] {
|
||||
|
||||
let consoleLabels:string[] = [];
|
||||
let consoleStyles:string[] = [];
|
||||
|
||||
// 放置标签
|
||||
for(let i = 0; i < labels.length; i++) {
|
||||
consoleLabels.push(labels[i].getLoggerOutput());
|
||||
|
||||
if (i !== ( labels.length - 1))
|
||||
consoleLabels.push("%c ");
|
||||
|
||||
consoleStyles.push(labels[i].getStyleOutput());
|
||||
|
||||
if (i !== ( labels.length - 1))
|
||||
consoleStyles.push("");
|
||||
}
|
||||
|
||||
return [consoleLabels, consoleStyles];
|
||||
}
|
||||
|
||||
/**
|
||||
* 收集计算标签没有样式
|
||||
* @param labels 标签
|
||||
*/
|
||||
public static calcLabel(...labels:LogLabel[]):string[] {
|
||||
|
||||
let consoleLabels:string[] = [];
|
||||
|
||||
// 放置标签
|
||||
for(let i = 0; i < labels.length; i++) {
|
||||
consoleLabels.push(labels[i].getTextOutput());
|
||||
}
|
||||
|
||||
return consoleLabels
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础调试输出
|
||||
* 其他的 Log 函数都是基于此封装
|
||||
* @param content 输出内容
|
||||
* @param label 使用标签
|
||||
* @param attachLabel 附加标签
|
||||
*/
|
||||
public static logBase<T extends Array<any>>
|
||||
(content:MultipleLogContent<T>, labels:LogLabel[], attachLabel:LogLabel[] = []):T {
|
||||
|
||||
// TODO: 这里可以添加一些钩子作为中间件处理日志输出
|
||||
|
||||
// 测试是否输出内容
|
||||
if(!Logger.testLog(...labels, ...attachLabel, StackLogLabel.filterUrlLabel))
|
||||
return content.getContent();
|
||||
|
||||
// 过滤出需要渲染的 Labels
|
||||
let labelsNeedRender:LogLabel[] = [...labels, ...attachLabel].filter((label:LogLabel)=>{
|
||||
return true
|
||||
});
|
||||
|
||||
// 使用样式输出
|
||||
if(LOGGER_STYLE) {
|
||||
|
||||
// 计算收集样式
|
||||
let [consoleLabels, consoleStyles]= Logger.calcStyle(...labelsNeedRender);
|
||||
|
||||
// 调试输出
|
||||
console.log(consoleLabels.join(""), ...consoleStyles, ...content.getContent());
|
||||
|
||||
} else {
|
||||
|
||||
// 计算收集标签
|
||||
let consoleLabels= Logger.calcLabel(...labelsNeedRender);
|
||||
|
||||
// 输出
|
||||
console.log(consoleLabels.join(" "), ...content.getContent());
|
||||
}
|
||||
|
||||
|
||||
|
||||
return content.getContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 调试输出
|
||||
* @param content 输出内容
|
||||
* @param label 使用标签
|
||||
*/
|
||||
public static log<T>(content:T, ...labels:LogLabel[]):T {
|
||||
return Logger.logBase<Array<T>>(
|
||||
new MultipleLogContent<Array<T>>(content), labels,
|
||||
[StackLogLabel.fileNameLabel]
|
||||
)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 函数 Logger.log 的别名
|
||||
*/
|
||||
public static l:typeof Logger.log = Logger.log;
|
||||
|
||||
/**
|
||||
* 多重调试输出
|
||||
* @param labels 输出内容
|
||||
* @param content 使用标签
|
||||
*/
|
||||
public static logMultiple<T extends Array<any>>(labels:LogLabel[], ...content:T):T {
|
||||
return Logger.logBase<T>(
|
||||
new MultipleLogContent<T>(...content), labels,
|
||||
[StackLogLabel.fileNameLabel]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 函数 Logger.logMultiple 的别名
|
||||
*/
|
||||
public static m:typeof Logger.logMultiple = Logger.logMultiple;
|
||||
|
||||
/**
|
||||
* 在下一行调试输出
|
||||
* @param content 输出内容
|
||||
* @param label 使用标签
|
||||
*/
|
||||
public static logLine<T>(content:T, ...labels:LogLabel[]):T {
|
||||
return Logger.logBase<Array<T>>(
|
||||
new MultipleLogContent<Array<T>>(content), labels,
|
||||
[StackLogLabel.fileNameLabel, StackLogLabel.blankLabel]
|
||||
)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 函数 Logger.logLine 的别名
|
||||
*/
|
||||
public static ll:typeof Logger.logLine = Logger.logLine;
|
||||
|
||||
/**
|
||||
* 在下一行多重调试输出
|
||||
* @param labels 输出内容
|
||||
* @param content 使用标签
|
||||
*/
|
||||
public static logLineMultiple<T extends Array<any>>(labels:LogLabel[], ...content:T):T {
|
||||
return Logger.logBase<T>(
|
||||
new MultipleLogContent<T>(...content), labels,
|
||||
[StackLogLabel.fileNameLabel, StackLogLabel.blankLabel]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 函数 Logger.logLineMultiple 的别名
|
||||
*/
|
||||
public static lm:typeof Logger.logLineMultiple = Logger.logLineMultiple;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 栈信息
|
||||
*/
|
||||
class StackInfo {
|
||||
|
||||
/**
|
||||
* 函数名
|
||||
*/
|
||||
public functionName:string | undefined;
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
public fileName:string | undefined;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
public url:string | undefined;
|
||||
|
||||
/**
|
||||
* 文件名和行号
|
||||
*/
|
||||
public fileNameLine: string | undefined;
|
||||
|
||||
/**
|
||||
* 设置信息
|
||||
* @param functionName 函数名
|
||||
* @param fileName 文件名
|
||||
* @param url 文件路径
|
||||
*/
|
||||
public setInfo(functionName:string, fileNameLine:string, url:string):StackInfo {
|
||||
this.functionName = functionName;
|
||||
this.fileNameLine = fileNameLine;
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算文件名
|
||||
*/
|
||||
public calcFileName():string | undefined {
|
||||
|
||||
let replaceToTs = this.fileNameLine?.replace(".js", ".ts");
|
||||
let matched = replaceToTs?.match(/^(.+\.(js|ts)):\d+:\d+$/);
|
||||
|
||||
return matched ? matched[1] : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算路径名
|
||||
*/
|
||||
public calcPathName():string | undefined {
|
||||
|
||||
let replaceToTs = this.url?.replace(".js", ".ts");
|
||||
let matched = replaceToTs?.match(/^https?:\/\/(\d+\.){3}\d+:\d+\/(.+):\d+:\d+$/);
|
||||
|
||||
return matched ? matched[2] : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取函数调用栈列表
|
||||
*/
|
||||
public static getCallStack():StackInfo[] {
|
||||
|
||||
// 获取堆栈信息
|
||||
let stack:string | undefined = new Error().stack;
|
||||
|
||||
if (stack === void 0) return [];
|
||||
|
||||
// 去除 Error
|
||||
stack = stack.replace(/^(Error)\s/, "");
|
||||
|
||||
// 获取堆栈信息
|
||||
let stackList:string[] = stack.split(/\n/);
|
||||
|
||||
let callStack:StackInfo[] = [];
|
||||
|
||||
for(let i = 0; i < stackList.length; i++) {
|
||||
|
||||
let matcher = stackList[i].match(/^\s+at\s+(.+)\s(\(.+\))/);
|
||||
if (matcher === null || matcher.length < 3) continue;
|
||||
|
||||
let fileName = matcher[2].match(/.+\/(.+\..+:\d+:\d+)\)/);
|
||||
if (fileName === null || matcher.length < 2) continue;
|
||||
|
||||
callStack.push(new StackInfo().setInfo(
|
||||
matcher[1], fileName[1], matcher[2]?.replace(/(\(|\))/g, "")
|
||||
))
|
||||
}
|
||||
|
||||
// console.log(callStack);
|
||||
|
||||
return callStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排除的
|
||||
*/
|
||||
public static readonly excludeFile:RegExp = /^.*(\\|\/)core(\\|\/)(.*Log.*).js:\d+:\d+/;
|
||||
|
||||
/**
|
||||
* 获取第一个调用栈
|
||||
*/
|
||||
public static getFirstStack():StackInfo | undefined {
|
||||
|
||||
let callStack = this.getCallStack();
|
||||
|
||||
for(let i = 0; i < callStack.length; i++) {
|
||||
|
||||
if(!callStack[i].url) continue;
|
||||
|
||||
if(!StackInfo.excludeFile.test(callStack[i].url ?? "")) {
|
||||
return callStack[i];
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 内部预定义的 LogLabel
|
||||
*/
|
||||
class StackLogLabel {
|
||||
|
||||
/**
|
||||
* 堆栈路径样式
|
||||
*/
|
||||
public static readonly normalStyle:LogStyle = new LogStyle()
|
||||
.setColor("#979797").setBorder("4px", "1px solid #979797").setBlank("0 5px");
|
||||
|
||||
/**
|
||||
* 一个回车
|
||||
*/
|
||||
public static readonly blankLabel = new LogLabel("\n\r",
|
||||
new LogStyle(), false, true, true);
|
||||
|
||||
/**
|
||||
* 包含文件名和行号的 label
|
||||
*/
|
||||
public static get fileNameLabel():LogLabel {
|
||||
|
||||
// 获得调用堆栈
|
||||
let stack = StackInfo.getFirstStack();
|
||||
|
||||
return new LogLabel(stack?.calcFileName() ?? "Unknown file name",
|
||||
StackLogLabel.normalStyle, false, true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 包含 URL 链接的 label
|
||||
*/
|
||||
public static get urlLabel():LogLabel {
|
||||
|
||||
// 获得调用堆栈
|
||||
let stack = StackInfo.getFirstStack();
|
||||
|
||||
return new LogLabel(stack?.calcPathName() ?? "Unknown url",
|
||||
StackLogLabel.normalStyle, false, true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅仅用来 filter 的 URL 链接的 label
|
||||
*/
|
||||
public static get filterUrlLabel():LogLabel {
|
||||
|
||||
// 获得调用堆栈
|
||||
let stack = StackInfo.getFirstStack();
|
||||
|
||||
return new LogLabel(stack?.calcPathName() ?? "Unknown url",
|
||||
StackLogLabel.normalStyle, true, false, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成圆角颜色标签样式
|
||||
*/
|
||||
const normalLevelStyleGen = (color:string):LogStyle => {
|
||||
return new LogStyle().setBorder("4px", `1px solid ${color}`)
|
||||
.setColor(color).setBlank("0 5px");
|
||||
}
|
||||
|
||||
/**
|
||||
* 调试等级标签
|
||||
*/
|
||||
class LevelLogLabel {
|
||||
|
||||
/**
|
||||
* 致命
|
||||
*/
|
||||
static readonly FatalLabel = new LogLabel(
|
||||
"FATAL", normalLevelStyleGen("#FF00CC")
|
||||
);
|
||||
|
||||
/**
|
||||
* 错误
|
||||
*/
|
||||
static readonly ErrorLabel = new LogLabel(
|
||||
"ERROR", normalLevelStyleGen("#FF0000")
|
||||
);
|
||||
|
||||
/**
|
||||
* 警告
|
||||
*/
|
||||
static readonly WarnLabel = new LogLabel(
|
||||
"WARN", normalLevelStyleGen("#FF9900")
|
||||
);
|
||||
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
static readonly InfoLabel = new LogLabel(
|
||||
"INFO", normalLevelStyleGen("#99FF00")
|
||||
);
|
||||
|
||||
/**
|
||||
* 调试
|
||||
*/
|
||||
static readonly DebugLabel = new LogLabel(
|
||||
"DEBUG", normalLevelStyleGen("#00FF99")
|
||||
);
|
||||
|
||||
/**
|
||||
* 追踪
|
||||
*/
|
||||
static readonly TraceLabel = new LogLabel(
|
||||
"TRACE", normalLevelStyleGen("#00CCFF")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成圆角颜色标签样式
|
||||
*/
|
||||
const normalLifeStyleGen = (r:number, g:number, b:number):LogStyle => {
|
||||
return new LogStyle().setBorder("4px", `1px solid rgb(${ r }, ${ g }, ${ b })`)
|
||||
.setColor(`rgb(${ r }, ${ g }, ${ b })`, `rgba(${ r }, ${ g }, ${ b }, .1)`)
|
||||
.setBlank("0 5px");
|
||||
}
|
||||
|
||||
/**
|
||||
* 生命周期标签
|
||||
*/
|
||||
class LifeCycleLogLabel {
|
||||
|
||||
/**
|
||||
* 小程序加载时
|
||||
*/
|
||||
static readonly OnLaunchLabel = new LogLabel(
|
||||
"onLaunch", normalLifeStyleGen(160, 32, 240)
|
||||
);
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
static readonly OnLoadLabel = new LogLabel(
|
||||
"onLoad", normalLifeStyleGen(255, 140, 105)
|
||||
);
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
static readonly OnReadyLabel = new LogLabel(
|
||||
"onReady", normalLifeStyleGen(255, 127, 36)
|
||||
);
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
static readonly OnShowLabel = new LogLabel(
|
||||
"onShow", normalLifeStyleGen(255, 215, 0)
|
||||
)
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
static readonly OnHideLabel = new LogLabel(
|
||||
"onHide", normalLifeStyleGen(173, 255, 47)
|
||||
);
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
static readonly OnUnloadLabel = new LogLabel(
|
||||
"onUnload", normalLifeStyleGen(127, 255, 212)
|
||||
);
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
static readonly OnPullDownRefreshLabel = new LogLabel(
|
||||
"onPullDownRefresh", normalLifeStyleGen(0, 191, 255)
|
||||
);
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
static readonly OnReachBottomLabel = new LogLabel(
|
||||
"onReachBottom", normalLifeStyleGen(84, 255, 159)
|
||||
);
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
static readonly OnShareAppMessageLabel = new LogLabel(
|
||||
"onShareAppMessage", normalLifeStyleGen(147, 112, 219)
|
||||
);
|
||||
}
|
||||
|
||||
class StatusLabel {
|
||||
|
||||
/**
|
||||
* 等待
|
||||
*/
|
||||
static readonly Pending = new LogLabel(
|
||||
"◉", new LogStyle().setBlank("0 2px").setBorder("1000px", "1px solid lightblue").setColor("lightblue")
|
||||
);
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
static readonly Success = new LogLabel(
|
||||
"√", new LogStyle().setBlank("0 4px").setBorder("1000px", "1px solid lightgreen").setColor("lightgreen")
|
||||
);
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
static readonly Failed = new LogLabel(
|
||||
"x", new LogStyle().setBlank("0 4px").setBorder("1000px", "1px solid red").setColor("red")
|
||||
);
|
||||
}
|
||||
|
||||
const NormalStyle = StackLogLabel.normalStyle;
|
||||
|
||||
export default Logger;
|
||||
export {
|
||||
Logger, LogLabel, LevelLogLabel, StackLogLabel, LifeCycleLogLabel, LogStyle,
|
||||
StackInfo, StatusLabel, NormalStyle, normalLifeStyleGen as colorRadio
|
||||
};
|
517
miniprogram/core/Module.ts
Normal file
@ -0,0 +1,517 @@
|
||||
import { Emitter } from "./Emitter";
|
||||
import { Logger, LogLabel, colorRadio, LevelLogLabel } from "./Logger";
|
||||
|
||||
/**
|
||||
* 自定义对象类型
|
||||
*/
|
||||
type IAnyTypeObject<T = any> = {
|
||||
[x:string]: T;
|
||||
};
|
||||
|
||||
// 微信 Data 类型
|
||||
type Data<D> = WechatMiniprogram.Page.Data<D>;
|
||||
|
||||
// 微信生命周期类型
|
||||
type ILifetime = WechatMiniprogram.Page.ILifetime;
|
||||
|
||||
// 继承的方法
|
||||
type InstanceMethods<D> = WechatMiniprogram.Page.InstanceMethods<D>;
|
||||
|
||||
// 继承的属性
|
||||
type InstanceProperties = WechatMiniprogram.Page.InstanceProperties;
|
||||
|
||||
/**
|
||||
* 定义微信微信上下文类型
|
||||
*
|
||||
* @template TD data 结构类型
|
||||
* @template TC 用户 MinIn 类型
|
||||
*
|
||||
* Partial<ILifetime> 可选的微信生命周期
|
||||
* Partial<Data<TD>> 可选的 data 结构
|
||||
* InstanceMethods<TD> 必选的微信继承方法
|
||||
* InstanceProperties 必选的微信继承属性
|
||||
*/
|
||||
type WXContext<TD, TC> = Partial<ILifetime> & Partial<Data<TD>>
|
||||
& InstanceMethods<TD> & InstanceProperties & TC;
|
||||
|
||||
/**
|
||||
* 任意的微信上下文
|
||||
* 当我们不关心具体是哪个上下文时
|
||||
* 使用这个类型
|
||||
*/
|
||||
type AnyWXContext = WXContext<IAnyTypeObject, IAnyTypeObject>;
|
||||
|
||||
/**
|
||||
* 依赖关系图谱
|
||||
* 注意: 这是一个递给类型
|
||||
* @template M 限制了所有依赖必须使用同一个 manager
|
||||
*/
|
||||
type Depends<M extends Manager<AnyWXContext>> = {
|
||||
[x:string]: Modular<M, Depends<M>>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 微信继承的函数
|
||||
*/
|
||||
class WXInstanceMethods<
|
||||
E extends IAnyTypeObject = IAnyTypeObject,
|
||||
W extends AnyWXContext = AnyWXContext
|
||||
>
|
||||
extends Emitter<E>
|
||||
implements InstanceMethods<W["data"]> {
|
||||
|
||||
public superContext: W;
|
||||
|
||||
public constructor(context: W) {
|
||||
super();
|
||||
this.superContext = context;
|
||||
}
|
||||
|
||||
public setData(data: Partial<W["data"]> & WechatMiniprogram.IAnyObject, callback?: () => void): void {
|
||||
return this.superContext.setData(data, callback);
|
||||
}
|
||||
|
||||
public hasBehavior(behavior: string): void {
|
||||
return this.superContext.hasBehavior(behavior);
|
||||
}
|
||||
|
||||
public triggerEvent<DetailType = any>(name: string, detail?: DetailType, options?: WechatMiniprogram.Component.TriggerEventOption): void {
|
||||
return this.superContext.triggerEvent(name, detail, options)
|
||||
}
|
||||
|
||||
public createSelectorQuery(): WechatMiniprogram.SelectorQuery {
|
||||
return this.superContext.createSelectorQuery();
|
||||
}
|
||||
|
||||
public createIntersectionObserver(options: WechatMiniprogram.CreateIntersectionObserverOption): WechatMiniprogram.IntersectionObserver {
|
||||
return this.superContext.createIntersectionObserver(options);
|
||||
}
|
||||
|
||||
public selectComponent(selector: string): WechatMiniprogram.Component.TrivialInstance {
|
||||
return this.superContext.selectComponent(selector);
|
||||
}
|
||||
|
||||
public selectAllComponents(selector: string): WechatMiniprogram.Component.TrivialInstance[] {
|
||||
return this.superContext.selectAllComponents(selector);
|
||||
}
|
||||
|
||||
public selectOwnerComponent(): WechatMiniprogram.Component.TrivialInstance {
|
||||
return this.superContext.selectOwnerComponent();
|
||||
}
|
||||
|
||||
public getRelationNodes(relationKey: string): WechatMiniprogram.Component.TrivialInstance[] {
|
||||
return this.superContext.getRelationNodes(relationKey);
|
||||
}
|
||||
|
||||
public groupSetData(callback?: () => void): void {
|
||||
return this.superContext.groupSetData(callback);
|
||||
}
|
||||
|
||||
public getTabBar(): WechatMiniprogram.Component.TrivialInstance {
|
||||
return this.superContext.getTabBar();
|
||||
}
|
||||
|
||||
public getPageId(): string {
|
||||
return this.superContext.getPageId();
|
||||
}
|
||||
|
||||
public animate(selector: string, keyFrames: WechatMiniprogram.Component.KeyFrame[], duration: number, callback?: () => void): void;
|
||||
public animate(selector: string, keyFrames: WechatMiniprogram.Component.ScrollTimelineKeyframe[], duration: number,
|
||||
scrollTimeline: WechatMiniprogram.Component.ScrollTimelineOption): void;
|
||||
public animate(selector: any, keyFrames: any, duration: any, scrollTimeline?: any): void {
|
||||
return this.superContext.animate(selector, keyFrames, duration, scrollTimeline);
|
||||
}
|
||||
|
||||
public clearAnimation(selector: string, callback: () => void): void;
|
||||
public clearAnimation(selector: string, options?: WechatMiniprogram.Component.ClearAnimationOptions, callback?: () => void): void;
|
||||
public clearAnimation(selector: any, options?: any, callback?: any): void {
|
||||
return this.superContext.clearAnimation(selector, options, callback);
|
||||
}
|
||||
|
||||
public getOpenerEventChannel(): WechatMiniprogram.EventChannel {
|
||||
return this.superContext.getOpenerEventChannel();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信继承的属性
|
||||
*/
|
||||
class WXInstanceProperties<
|
||||
E extends IAnyTypeObject = IAnyTypeObject,
|
||||
W extends AnyWXContext = AnyWXContext
|
||||
>
|
||||
extends WXInstanceMethods<E, W>
|
||||
implements InstanceProperties {
|
||||
|
||||
public override superContext: W;
|
||||
|
||||
constructor(context: W) {
|
||||
super(context);
|
||||
this.superContext = context;
|
||||
}
|
||||
|
||||
public get is(): string { return this.superContext.is };
|
||||
|
||||
public get route(): string { return this.superContext.route };
|
||||
|
||||
public get options(): Record<string, string | undefined> { return this.superContext.options };
|
||||
}
|
||||
|
||||
class WXILifetime<
|
||||
E extends IAnyTypeObject = IAnyTypeObject,
|
||||
W extends AnyWXContext = AnyWXContext
|
||||
>
|
||||
extends WXInstanceProperties<E, W>
|
||||
implements ILifetime {
|
||||
|
||||
public onLoad(query: Record<string, string | undefined>): void | Promise<void> {};
|
||||
|
||||
public onShow(): void | Promise<void> {};
|
||||
|
||||
public onReady(): void | Promise<void> {};
|
||||
|
||||
public onHide(): void | Promise<void> {};
|
||||
|
||||
public onUnload(): void | Promise<void> {};
|
||||
|
||||
public onPullDownRefresh(): void | Promise<void> {};
|
||||
|
||||
public onReachBottom(): void | Promise<void> {};
|
||||
|
||||
public onShareAppMessage(options: WechatMiniprogram.Page.IShareAppMessageOption): void | WechatMiniprogram.Page.ICustomShareContent {};
|
||||
|
||||
public onShareTimeline(): void | WechatMiniprogram.Page.ICustomTimelineContent {};
|
||||
|
||||
public onPageScroll(options: WechatMiniprogram.Page.IPageScrollOption): void | Promise<void> {};
|
||||
|
||||
public onTabItemTap(options: WechatMiniprogram.Page.ITabItemTapOption): void | Promise<void> {};
|
||||
|
||||
public onResize(options: WechatMiniprogram.Page.IResizeOption): void | Promise<void> {};
|
||||
|
||||
public onAddToFavorites(options: WechatMiniprogram.Page.IAddToFavoritesOption): WechatMiniprogram.Page.IAddToFavoritesContent {
|
||||
return {};
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面模组
|
||||
* @template M 所属 Manager
|
||||
* @template DEP 模组依赖
|
||||
* @template E 模组事件
|
||||
* @template TD 模组 Data 类型
|
||||
*/
|
||||
class Modular<
|
||||
M extends Manager<AnyWXContext> = Manager<AnyWXContext>,
|
||||
DEP extends Depends<M> = Depends<M>,
|
||||
E extends IAnyTypeObject = IAnyTypeObject,
|
||||
TD extends IAnyTypeObject = IAnyTypeObject
|
||||
>
|
||||
extends WXILifetime<E, M["context"]>
|
||||
implements WXContext<TD, IAnyTypeObject> {
|
||||
|
||||
// [x:string]: any;
|
||||
|
||||
/**
|
||||
* 保存页面上下文
|
||||
*/
|
||||
private manager:M;
|
||||
|
||||
/**
|
||||
* 映射 Manager 上下文
|
||||
*/
|
||||
private get context():M["context"] {
|
||||
return this.manager.context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模组依赖
|
||||
*/
|
||||
protected depends?:DEP
|
||||
|
||||
/**
|
||||
* 模组数据
|
||||
*/
|
||||
public data?:TD;
|
||||
|
||||
/**
|
||||
* 模组使用的函数列表
|
||||
*/
|
||||
public functionList:Set<string>;
|
||||
|
||||
/**
|
||||
* 模组使用的参数列表
|
||||
*/
|
||||
public paramList:Set<string>;
|
||||
|
||||
/**
|
||||
* 命名空间
|
||||
*/
|
||||
public nameSpace:string;
|
||||
|
||||
/**
|
||||
* 一旦被类被构造,整个页面的全部申明周期将
|
||||
* 由该类实例控制,此后请勿修改任何生命周期函数
|
||||
* @param manager 页面上下文
|
||||
* @param nameSpace 模组命名空间
|
||||
* @param depend 模组依赖
|
||||
*/
|
||||
public constructor(manager:M, nameSpace:string, depend?: DEP) {
|
||||
|
||||
super(manager.context);
|
||||
|
||||
// 保存微信上下文
|
||||
this.manager = manager;
|
||||
|
||||
// 保存模块依赖
|
||||
this.depends = depend;
|
||||
|
||||
// 初始化内部属性
|
||||
this.functionList = new Set<string>();
|
||||
this.paramList = new Set<string>();
|
||||
this.nameSpace = nameSpace;
|
||||
}
|
||||
|
||||
public override setData(data:Partial<TD>, callback?: () => void):void {
|
||||
|
||||
if(this.data === void 0) {
|
||||
this.data = {} as TD;
|
||||
}
|
||||
|
||||
let reportData:IAnyTypeObject = {};
|
||||
|
||||
for(let key in data) {
|
||||
(this.data as IAnyTypeObject)[key] = data[key];
|
||||
reportData[`${ this.nameSpace }$${ key }`] = data[key];
|
||||
this.paramList.add(key);
|
||||
}
|
||||
|
||||
return this.context.setData(reportData, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向上层上下文传递函数
|
||||
* @param fn 传递的函数
|
||||
* @param name 函数名字
|
||||
*/
|
||||
public setFunc(fn:Function, name:string):void {
|
||||
|
||||
this.functionList.add(name);
|
||||
(this.context as IAnyTypeObject)
|
||||
[`${ this.nameSpace }$${ name }`] = fn.bind(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面控件
|
||||
* 用于管理页面的所有模组
|
||||
*/
|
||||
class Manager<WXC extends AnyWXContext = AnyWXContext> {
|
||||
|
||||
/**
|
||||
* 微信生命周期
|
||||
*/
|
||||
static readonly WxLifeCycle:(keyof ILifetime)[] = [
|
||||
"onShow", "onReady", "onHide", "onUnload", "onPullDownRefresh", "onReachBottom",
|
||||
"onShareAppMessage", "onShareTimeline","onAddToFavorites","onPageScroll", "onResize", "onTabItemTap"
|
||||
];
|
||||
|
||||
/**
|
||||
* 保存页面上下文
|
||||
*/
|
||||
public context:WXC;
|
||||
|
||||
/**
|
||||
* 一旦被类被构造,整个页面的全部申明周期将
|
||||
* 由该类实例控制,此后请勿修改任何生命周期函数
|
||||
*/
|
||||
public constructor(context:WXC) {
|
||||
|
||||
// 保存微信上下文
|
||||
this.context = context;
|
||||
|
||||
// 初始化模组列表
|
||||
this.modules = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 模组列表
|
||||
*/
|
||||
public modules:Modular[];
|
||||
|
||||
/**
|
||||
* 添加一个模块
|
||||
* @param mode 模块类
|
||||
* @param nameSpace 命名空间
|
||||
* @param depend 模块依赖
|
||||
* @returns 模块实例
|
||||
*/
|
||||
public addModule<DEP extends Depends<this>, M extends Modular<this, DEP>> (
|
||||
mode: new (manager:this, nameSpace:string, depend?:DEP) => M,
|
||||
nameSpace:string, depend?:DEP
|
||||
):M {
|
||||
let mod = new mode(this, nameSpace, depend);
|
||||
this.modules.push(mod);
|
||||
return mod;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建指定生命周期的钩子
|
||||
* @param key 生命周期键值
|
||||
*/
|
||||
public creatHooks<Key extends keyof ILifetime>(key: Key): ILifetime[Key] {
|
||||
let hook = (async (...arg: any[]) => {
|
||||
|
||||
let hooks:Promise<any>[] = [];
|
||||
|
||||
for(let i = 0; i < this.modules.length; i++) {
|
||||
|
||||
let fn:Function = this.modules[i][key];
|
||||
|
||||
if(fn === void 0) continue;
|
||||
let res: Promise<any> | any = fn.apply(this.modules[i], arg);
|
||||
|
||||
if (res instanceof Promise) {
|
||||
hooks.push(res);
|
||||
} else {
|
||||
hooks.push(Promise.resolve(res));
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
key === "onShareAppMessage" ||
|
||||
key === "onShareTimeline" ||
|
||||
key === "onAddToFavorites"
|
||||
) {
|
||||
|
||||
// 如果返回值有特殊含义在处理时进行 MinIn
|
||||
return Promise.all(hooks).then((res) => {
|
||||
|
||||
let simple:IAnyTypeObject = {};
|
||||
|
||||
for(let i = 0; i < res.length; i++) {
|
||||
simple = Object.assign({}, simple, res);
|
||||
}
|
||||
|
||||
return Promise.resolve(simple);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
return Promise.all(hooks);
|
||||
});
|
||||
|
||||
// TODO: 此处为,关键位置,容易出错,请再次检查
|
||||
return (hook as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建全部生命周期钩子
|
||||
*/
|
||||
public creatAllHooks() {
|
||||
for(let i = 0; i < Manager.WxLifeCycle.length; i++) {
|
||||
(this.context as IAnyTypeObject)[Manager.WxLifeCycle[i]] =
|
||||
this.creatHooks(Manager.WxLifeCycle[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载全部的模块
|
||||
* @param query onLoad 接收的参数
|
||||
*/
|
||||
public loadAllModule(query:Record<string, string | undefined>) {
|
||||
|
||||
// 创建全部钩子
|
||||
this.creatAllHooks();
|
||||
|
||||
// 加载全部模组数据
|
||||
for(let i = 0; i < this.modules.length; i++) {
|
||||
|
||||
if(this.modules[i].data)
|
||||
for(let key in this.modules[i].data) {
|
||||
|
||||
if(this.context.data === void 0) this.context.data = {};
|
||||
|
||||
if(this.modules[i].data !== void 0) {
|
||||
this.context.data[`${ this.modules[i].nameSpace }$${ key }`] =
|
||||
( this.modules[i].data as IAnyTypeObject )[key];
|
||||
this.modules[i].paramList.add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 将全部数据发布到视图层
|
||||
if(this.context.data !== void 0)
|
||||
this.context.setData(this.context.data);
|
||||
|
||||
// 调用全部模块的 onLoad 周期
|
||||
let res = this.creatHooks("onLoad")(query);
|
||||
|
||||
// 打印每个模块的键值对使用情况
|
||||
for(let i = 0; i < this.modules.length; i++) {
|
||||
let data:string[] = [];
|
||||
let func:string[] = [];
|
||||
|
||||
for(let key of this.modules[i].paramList) {
|
||||
data.push(`[${ key }]`);
|
||||
}
|
||||
|
||||
for(let key of this.modules[i].functionList) {
|
||||
func.push(`[${ key }]`);
|
||||
}
|
||||
|
||||
let log:string = `模块 [${ this.modules[i].nameSpace }] 完成绑定...\n`;
|
||||
if(data.length > 0) log += `Using Props: ${ data.join(", ") }\n`;
|
||||
if(func.length > 0) log += `Using Function: ${ func.join(", ") }\n`;
|
||||
|
||||
Logger.log(log, LevelLogLabel.InfoLabel, Manager.AddModuleLabel);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模块被添加时的标签
|
||||
*/
|
||||
public static readonly AddModuleLabel = new LogLabel(
|
||||
"addModule",
|
||||
colorRadio(54, 0, 255)
|
||||
)
|
||||
|
||||
/**
|
||||
* 加载 Manager 控件
|
||||
* @param fn 约束后调用的函数用来添加模块
|
||||
*/
|
||||
public static Page(fn:(manager:Manager<AnyWXContext>) => void) {
|
||||
Page({
|
||||
async onLoad(query) {
|
||||
let manager = new Manager(this);
|
||||
fn(manager);
|
||||
manager.loadAllModule(query);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步页面加载
|
||||
*
|
||||
* *注意*
|
||||
* 页面模块加载后,必须手动执行 loadAllModule
|
||||
* loadAllModule Modular 才会真正的被加载
|
||||
* 模块加载后可以处理逻辑绑定
|
||||
*/
|
||||
public static async PageAsync(): Promise<{
|
||||
manager: Manager<AnyWXContext>,
|
||||
query: Record<string, string | undefined>
|
||||
}> {
|
||||
return new Promise((solve) => {
|
||||
Page({
|
||||
async onLoad(query) {
|
||||
let manager = new Manager(this);
|
||||
await solve({ manager, query });
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { Manager, Modular, AnyWXContext, WXContext, ILifetime}
|
270
miniprogram/core/Storage.ts
Normal file
@ -0,0 +1,270 @@
|
||||
import { Logger, LogLabel, LevelLogLabel, colorRadio } from "./Logger";
|
||||
|
||||
interface IAppStorageParam {
|
||||
|
||||
/**
|
||||
* storage 缓存
|
||||
*/
|
||||
storage: Map<string, Storage<IStorageData>>
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
enum StorageState {
|
||||
|
||||
/**
|
||||
* 有 waiter 存在的工作状态
|
||||
*/
|
||||
WORK = 1,
|
||||
|
||||
/**
|
||||
* 无 waiter 存在的完成状态
|
||||
*/
|
||||
DONE = 2
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务等待列表
|
||||
*/
|
||||
class Waiter {
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
public get state():StorageState {
|
||||
if(this.waiterList.length <= 0) {
|
||||
return StorageState.DONE;
|
||||
} else {
|
||||
return StorageState.WORK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 函数列表
|
||||
*/
|
||||
private waiterList:Function[] = [];
|
||||
|
||||
/**
|
||||
* 添加等待者
|
||||
* @param fn 等待者
|
||||
*/
|
||||
public addWaiter(fn:Function) {
|
||||
this.waiterList.push(fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成
|
||||
* 清空 waiterList
|
||||
* 并返回合并的 waiterList
|
||||
*/
|
||||
public done():Function {
|
||||
|
||||
// 复制 waiterList 生成闭包
|
||||
let fnList = this.waiterList.concat([]);
|
||||
|
||||
let runAllWaiter = () => {
|
||||
for(let i = 0; i < fnList.length; i++) {
|
||||
fnList[i]();
|
||||
}
|
||||
}
|
||||
|
||||
this.waiterList = [];
|
||||
return runAllWaiter;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储数据类型
|
||||
*/
|
||||
type IStorageData = {
|
||||
[x:string]:any
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储库
|
||||
* @template T 数据类型
|
||||
*
|
||||
* 特点:
|
||||
* 1. 该类封装了 wxStorage 操作
|
||||
* 2. 全异步获取无阻塞
|
||||
* 3. 使用数据缓缓冲区,优化高频存取
|
||||
* 4. 如果全局范围内已存在莫键值 storage 的实例
|
||||
* 则此实例将链接到已存在实例
|
||||
*/
|
||||
class Storage<T extends IStorageData> {
|
||||
|
||||
/**
|
||||
* Logger 使用的标签
|
||||
*/
|
||||
public StorageLogLabel:LogLabel;
|
||||
|
||||
/**
|
||||
* 数据唯一索引
|
||||
*/
|
||||
public key:string;
|
||||
|
||||
/**
|
||||
* 数据键值的默认数据类型
|
||||
*/
|
||||
private readonly defaultData:T;
|
||||
|
||||
/**
|
||||
* 缓存数据
|
||||
*/
|
||||
private _cache: T = {} as T;
|
||||
private set cache(data: T) {
|
||||
if (this.cacheStorage) {
|
||||
for (const key in data) {
|
||||
this.cacheStorage.cache[key] = data[key];
|
||||
}
|
||||
} else {
|
||||
for (const key in data) {
|
||||
this._cache[key] = data[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
private get cache():T {
|
||||
if (this.cacheStorage) return this.cacheStorage.cache;
|
||||
else return this._cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* cache 到 storage 等待列表
|
||||
*/
|
||||
private saveWaiter:Waiter = new Waiter();
|
||||
|
||||
/**
|
||||
* 缓存对象
|
||||
*/
|
||||
private cacheStorage:Storage<T> | undefined;
|
||||
|
||||
/**
|
||||
* 将数据从 cache 同步到 storage
|
||||
*/
|
||||
public async save():Promise<void> {
|
||||
|
||||
// 如果存在链接的实例
|
||||
if (this.cacheStorage) return this.cacheStorage.save();
|
||||
|
||||
// 如果没有开始存储
|
||||
// 发起一次异步读取
|
||||
if(this.saveWaiter.state === StorageState.DONE)
|
||||
setTimeout(() => {
|
||||
|
||||
// 获取函数绑定列表
|
||||
let fnList = this.saveWaiter.done();
|
||||
|
||||
wx.setStorage<T>({
|
||||
key: this.key,
|
||||
data: this.cache,
|
||||
|
||||
success: (data) => {
|
||||
Logger.log(`数据保存成功! errMsg: ${ data.errMsg }`,
|
||||
LevelLogLabel.InfoLabel, this.StorageLogLabel);
|
||||
},
|
||||
|
||||
fail: (data) => {
|
||||
Logger.log(`数据保存失败! errMsg: ${ data.errMsg }`,
|
||||
LevelLogLabel.FatalLabel, this.StorageLogLabel);
|
||||
},
|
||||
|
||||
complete: () => {
|
||||
fnList();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return new Promise((r) => {
|
||||
|
||||
// 加入等待队列
|
||||
this.saveWaiter.addWaiter(r);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 在缓存中搜索此键值的实例
|
||||
*/
|
||||
private findStorageCache(): boolean {
|
||||
let { storage: storageMap } = getApp<IAppStorageParam>();
|
||||
|
||||
// 查找缓存
|
||||
let storage = storageMap.get(this.key);
|
||||
if (storage) {
|
||||
this.cacheStorage = storage as Storage<T>;
|
||||
return true;
|
||||
};
|
||||
|
||||
// 缓存此实例
|
||||
storageMap.set(this.key, this);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置全部数据
|
||||
*/
|
||||
public async reset() {
|
||||
this.cache = this.defaultData;
|
||||
Logger.logMultiple([LevelLogLabel.InfoLabel, this.StorageLogLabel],
|
||||
`正在重置为默认数据... 数据内容:\n`, this.cache
|
||||
);
|
||||
return this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param defaultData 键值默认数据
|
||||
*/
|
||||
public constructor(key:string, defaultData?:T) {
|
||||
this.key = key;
|
||||
this.defaultData = defaultData ?? {} as T;
|
||||
this.StorageLogLabel = new LogLabel(
|
||||
`Storage:${ this.key }`, colorRadio(34, 230, 258)
|
||||
);
|
||||
|
||||
// 如果已找到其他实力,将此实例链接到目标实例
|
||||
if (this.findStorageCache()) {
|
||||
|
||||
// 设置默认值
|
||||
for (const key in this.defaultData) {
|
||||
if (this.cache[key] === void 0) {
|
||||
this.set(key, this.defaultData[key]);
|
||||
}
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
// 读取数据到缓存
|
||||
this.cache = wx.getStorageSync<T>(this.key);
|
||||
|
||||
// 使用默认值
|
||||
if(!this.cache) {
|
||||
Logger.log(`找不到 Storage 数据!`,
|
||||
LevelLogLabel.InfoLabel, this.StorageLogLabel);
|
||||
this.reset();
|
||||
} else {
|
||||
Logger.logMultiple([LevelLogLabel.InfoLabel, this.StorageLogLabel],
|
||||
`数据成功从 Storage 读取, 数据内容:\n`, this.cache
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取键值对应数据
|
||||
* @param key 键值
|
||||
*/
|
||||
public get<M extends keyof T>(key:M):T[M] {
|
||||
return this.cache[key];
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置键值对应数据
|
||||
* @param key 键值
|
||||
*/
|
||||
public async set<M extends keyof T>(key:M, value:T[M]):Promise<void> {
|
||||
this.cache[key] = value;
|
||||
return this.save();
|
||||
}
|
||||
}
|
||||
|
||||
export default Storage;
|
||||
export { Storage, StorageState, Waiter, IAppStorageParam, IStorageData };
|
154
miniprogram/data/StudentInfo.ts
Normal file
@ -0,0 +1,154 @@
|
||||
import { Data } from "../core/Data";
|
||||
import { Storage } from "../core/Storage";
|
||||
import { Login, ILoginOutput } from "../api/Login";
|
||||
|
||||
/**
|
||||
* 登录状态
|
||||
*/
|
||||
enum LoginStatus {
|
||||
|
||||
/**
|
||||
* 已认证
|
||||
*/
|
||||
verified = 1,
|
||||
|
||||
/**
|
||||
* 失效的认证
|
||||
* 通常为用户名密码错误
|
||||
*/
|
||||
invalid = 2,
|
||||
|
||||
/**
|
||||
* 没有登录信息
|
||||
*/
|
||||
none = 3
|
||||
}
|
||||
|
||||
/**
|
||||
* API 返回数据
|
||||
*/
|
||||
type ILoginApiData = {
|
||||
[P in keyof ILoginOutput]: {
|
||||
type: ILoginOutput[P];
|
||||
getAsync: () => Promise<ILoginOutput[P]>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Storage 缓存数据类型
|
||||
*/
|
||||
type IStudentInfoStorageData = ILoginOutput & {
|
||||
[P in keyof IStudentInfoData]: IStudentInfoData[P]["type"];
|
||||
};
|
||||
|
||||
/**
|
||||
* 学生信息数据结构
|
||||
*/
|
||||
type IStudentInfoData = {
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
studentId: {
|
||||
type: string,
|
||||
};
|
||||
|
||||
/**
|
||||
* 教务处密码
|
||||
*/
|
||||
password: {
|
||||
type: string
|
||||
};
|
||||
|
||||
/**
|
||||
* 登录状态
|
||||
*/
|
||||
loginStatus: {
|
||||
type: LoginStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* 上次登录时间
|
||||
* 时间戳
|
||||
*/
|
||||
lastLoginTime: {
|
||||
type: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 距离上次登录后
|
||||
* 学号和密码是否发生过改变
|
||||
*/
|
||||
isUserInfoChange: {
|
||||
type: boolean
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 学生信息
|
||||
*/
|
||||
class StudentInfo extends Data<IStudentInfoData & ILoginApiData> {
|
||||
|
||||
/**
|
||||
* 学生信息缓存
|
||||
*/
|
||||
private eduStorage = new Storage<IStudentInfoStorageData>("StudentInfo", {
|
||||
idCardLast6: "",
|
||||
eduService: "",
|
||||
actualName: "",
|
||||
eduSession: "",
|
||||
studentId: "",
|
||||
password: "",
|
||||
loginStatus: LoginStatus.none,
|
||||
lastLoginTime: 0,
|
||||
isUserInfoChange: false
|
||||
});
|
||||
|
||||
public override onLoad() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
*/
|
||||
private async login(): Promise<boolean> {
|
||||
|
||||
// 获取账号密码
|
||||
const stuId = this.eduStorage.get("studentId");
|
||||
const pwd = this.eduStorage.get("password");
|
||||
|
||||
if (!stuId || !pwd) return false;
|
||||
|
||||
// 发送请求
|
||||
const data = await new Login().param({
|
||||
studentId: stuId,
|
||||
password: pwd
|
||||
}).request().wait();
|
||||
|
||||
// 请求成功
|
||||
let res = data.data;
|
||||
if (res) {
|
||||
|
||||
// 保存数据
|
||||
this.eduStorage.set("actualName", res.actualName);
|
||||
this.eduStorage.set("eduService", res.eduService);
|
||||
this.eduStorage.set("eduSession", res.eduSession);
|
||||
this.eduStorage.set("idCardLast6", res.idCardLast6);
|
||||
|
||||
// 记录时间
|
||||
this.eduStorage.set("lastLoginTime", new Date().getTime());
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态
|
||||
*/
|
||||
private async getStatus() {}
|
||||
}
|
||||
|
||||
export { StudentInfo };
|
||||
export default StudentInfo;
|
75
miniprogram/image/account/Account_AboutUs.svg
Normal file
@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000076592718380360388780000014023029871415092396_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<g>
|
||||
<path class="st2" d="M50,9.8c0.55,0,0.75,0.35,0.82,0.49l9.71,17.69c2.16,3.93,5.93,6.67,10.34,7.51l19.83,3.77
|
||||
c0.15,0.02,0.55,0.11,0.71,0.63c0.18,0.53-0.11,0.82-0.21,0.94L77.37,55.51c-3.08,3.26-4.52,7.7-3.95,12.16l2.55,20.02
|
||||
c0.02,0.21,0.02,0.46-0.2,0.71c-0.19,0.22-0.47,0.35-0.73,0.35c-0.13,0-0.26-0.03-0.41-0.11l-18.25-8.61
|
||||
c-1.99-0.94-4.2-1.43-6.39-1.43c-2.2,0-4.4,0.49-6.39,1.43l-18.25,8.61c-0.15,0.07-0.28,0.11-0.41,0.11
|
||||
c-0.26,0-0.53-0.14-0.73-0.35c-0.22-0.26-0.23-0.5-0.2-0.71l2.55-20.02c0.56-4.46-0.88-8.88-3.95-12.16L8.79,40.82
|
||||
c-0.11-0.11-0.37-0.4-0.21-0.94c0.18-0.53,0.56-0.6,0.71-0.63l19.83-3.77c4.41-0.84,8.18-3.58,10.34-7.51l9.71-17.69
|
||||
C49.25,10.15,49.45,9.8,50,9.8 M50,2.78c-2.74,0-5.47,1.38-6.97,4.13L33.31,24.6c-1.15,2.08-3.16,3.55-5.49,3.99L7.99,32.36
|
||||
c-6.17,1.17-8.61,8.69-4.31,13.27l13.83,14.7c1.63,1.73,2.4,4.1,2.09,6.46L17.06,86.8c-0.63,5,3.36,8.97,7.89,8.97
|
||||
c1.12,0,2.27-0.25,3.41-0.77l18.25-8.61c1.08-0.5,2.24-0.76,3.39-0.76c1.16,0,2.32,0.26,3.39,0.76l18.25,8.61
|
||||
c1.12,0.53,2.28,0.77,3.4,0.77c4.53,0,8.52-3.98,7.89-8.97l-2.55-20.02c-0.3-2.35,0.47-4.73,2.09-6.46l13.83-14.7
|
||||
c4.31-4.58,1.86-12.1-4.31-13.27l-19.83-3.77c-2.34-0.44-4.35-1.91-5.49-3.99L56.97,6.91C55.46,4.15,52.74,2.78,50,2.78L50,2.78z
|
||||
M50,2.78"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.2 KiB |
62
miniprogram/image/account/Account_Arrow.svg
Normal file
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000148643560888163687730000014354677953684036249_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<polyline class="st19" points="17.39,10.88 83.65,50 17.39,89.12 "/>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
71
miniprogram/image/account/Account_Customer.svg
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000126323571291076155810000009424538536835319964_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<g>
|
||||
<path class="st2" d="M58.58,71.91l25.74-14.13v-6.52L58.58,65.39V71.91z M15.68,57.78l25.74,14.13v-6.52L15.68,51.26V57.78z
|
||||
M15.68,57.78"/>
|
||||
<path class="st2" d="M90.04,19.77L55.72,2.5c-3.54-2.04-7.9-2.04-11.44,0L9.96,19.86c-3.53,2.04-5.71,5.8-5.72,9.87v40.76
|
||||
c-0.02,4.1,2.17,7.9,5.72,9.95L44.28,97.6c1.77,1.05,3.8,1.61,5.86,1.6c1.95,0.04,3.87-0.44,5.58-1.37l34.32-17.48
|
||||
c3.53-2.04,5.71-5.8,5.72-9.87V29.73C95.78,25.62,93.6,21.82,90.04,19.77L90.04,19.77z M12.82,24.86L47.14,7.42
|
||||
C48.01,6.91,49,6.65,50,6.64c1.09,0,2.16,0.29,3.09,0.86l34.32,17.16c0.52,0.34,1,0.75,1.4,1.23L50,47.23L11.33,26.01
|
||||
c0.36-0.45,0.79-0.84,1.29-1.14H12.82z M12.82,75.43c-1.77-1.02-2.86-2.91-2.86-4.95v-38.7l37.18,20.28v40.62h-0.2L12.82,75.43z
|
||||
M90.04,70.48c0,1.96-1,3.78-2.66,4.83L52.86,92.79V52.06l37.18-20.39V70.48z M90.04,70.48"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.7 KiB |
76
miniprogram/image/account/Account_DateList.svg
Normal file
@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000134231879972232262860000003624220645597976985_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<g>
|
||||
<path class="st2" d="M85.76,9.77h-14.9V6.79c0-1.65-1.33-2.98-2.98-2.98c-1.65,0-2.98,1.33-2.98,2.98v2.98H35.1V6.79
|
||||
c0-1.65-1.33-2.98-2.98-2.98c-1.65,0-2.98,1.33-2.98,2.98v2.98h-14.9c-3.16,0-6.19,1.26-8.43,3.49c-2.24,2.24-3.49,5.27-3.49,8.43
|
||||
v62.58c0,3.16,1.26,6.19,3.49,8.43c2.24,2.24,5.27,3.49,8.43,3.49h71.52c3.16,0,6.19-1.26,8.43-3.49
|
||||
c2.24-2.24,3.49-5.27,3.49-8.43V21.69c0-3.16-1.26-6.19-3.49-8.43C91.96,11.02,88.92,9.77,85.76,9.77L85.76,9.77z M8.28,21.69
|
||||
c0-1.58,0.63-3.1,1.75-4.21c1.12-1.12,2.63-1.75,4.21-1.75h14.9v2.98c0,1.65,1.33,2.98,2.98,2.98c1.65,0,2.98-1.33,2.98-2.98
|
||||
v-2.98h29.8v2.98c0,1.65,1.33,2.98,2.98,2.98c1.65,0,2.98-1.33,2.98-2.98v-2.98h14.9c3.29,0,5.96,2.67,5.96,5.96v8.94H8.28V21.69z
|
||||
M91.72,84.27c0,3.29-2.67,5.96-5.96,5.96H14.24c-3.29,0-5.96-2.67-5.96-5.96V36.59h83.45V84.27z M91.72,84.27"/>
|
||||
<path class="st2" d="M23.18,54.47h17.88c1.65,0,2.98-1.33,2.98-2.98s-1.33-2.98-2.98-2.98H23.18c-1.65,0-2.98,1.33-2.98,2.98
|
||||
S21.53,54.47,23.18,54.47L23.18,54.47z M23.18,72.35h17.88c1.65,0,2.98-1.33,2.98-2.98c0-1.65-1.33-2.98-2.98-2.98H23.18
|
||||
c-1.65,0-2.98,1.33-2.98,2.98C20.2,71.02,21.53,72.35,23.18,72.35L23.18,72.35z M58.94,54.47h17.88c1.65,0,2.98-1.33,2.98-2.98
|
||||
s-1.33-2.98-2.98-2.98H58.94c-1.65,0-2.98,1.33-2.98,2.98S57.3,54.47,58.94,54.47L58.94,54.47z M58.94,72.35h17.88
|
||||
c1.65,0,2.98-1.33,2.98-2.98c0-1.65-1.33-2.98-2.98-2.98H58.94c-1.65,0-2.98,1.33-2.98,2.98C55.96,71.02,57.3,72.35,58.94,72.35
|
||||
L58.94,72.35z M58.94,72.35"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
67
miniprogram/image/account/Account_DefaultAvator.svg
Normal file
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 210 210" style="enable-background:new 0 0 210 210;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000119800197593363267330000003343045337348892552_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
<circle class="st17" cx="105" cy="105" r="105"/>
|
||||
<circle class="st2" cx="105" cy="79.22" r="36.19"/>
|
||||
<path class="st2" d="M171.07,166.47c0,9.46-2.94,18.35-8.1,26.09C146.36,203.58,126.43,210,105,210s-41.36-6.42-57.97-17.44
|
||||
c-5.16-7.74-8.1-16.63-8.1-26.09c0-0.38,0-0.75,0.02-1.12c-0.01-0.04,0-0.08,0-0.11c0.04-1.46,0.14-2.9,0.32-4.33
|
||||
c0-0.02,0.01-0.05,0.01-0.08c3.43-17.58,31.54-31.28,65.72-31.28s62.29,13.7,65.72,31.28c0,0.03,0.01,0.06,0.01,0.08
|
||||
c0.18,1.43,0.28,2.87,0.32,4.33c0,0.03,0.01,0.07,0,0.11C171.07,165.72,171.07,166.09,171.07,166.47z"/>
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.5 KiB |
73
miniprogram/image/account/Account_FAQ.svg
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000182508922549869638690000002743709010317845661_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<g>
|
||||
<path class="st2" d="M50,10.66c5.29,0,10.41,1.03,15.22,3.08c4.66,1.97,8.85,4.79,12.44,8.38c3.59,3.59,6.42,7.78,8.38,12.44
|
||||
c2.04,4.82,3.08,9.95,3.08,15.22c0,5.28-1.03,10.41-3.08,15.22c-1.97,4.66-4.79,8.85-8.38,12.44c-3.59,3.59-7.78,6.42-12.44,8.38
|
||||
c-4.82,2.04-9.95,3.08-15.22,3.08c-5.28,0-10.41-1.03-15.22-3.08c-4.66-1.97-8.85-4.79-12.44-8.38
|
||||
c-3.59-3.59-6.42-7.78-8.38-12.44c-2.04-4.82-3.08-9.95-3.08-15.22c0-5.28,1.03-10.41,3.08-15.22c1.97-4.66,4.79-8.85,8.38-12.44
|
||||
c3.59-3.59,7.78-6.42,12.44-8.38C39.59,11.69,44.71,10.66,50,10.66 M50,4.61c-24.95,0-45.18,20.23-45.18,45.18
|
||||
S25.05,94.96,50,94.96s45.18-20.23,45.18-45.18S74.95,4.61,50,4.61L50,4.61z M50,4.61"/>
|
||||
<path class="st2" d="M64.78,35l-7.16,19.92c-0.41,1.16-1.32,2.06-2.48,2.47l-19.92,7.17l7.16-19.92c0.41-1.16,1.32-2.06,2.48-2.47
|
||||
L64.78,35 M67.32,27.94c-0.5,0-1.03,0.09-1.53,0.27l-22.98,8.27c-2.85,1.03-5.1,3.27-6.12,6.12l-8.27,22.98
|
||||
c-0.35,0.99-0.35,2.07,0,3.07c0.67,1.85,2.4,2.99,4.25,2.99c0.5,0,1.03-0.09,1.53-0.27l22.98-8.27c2.86-1.03,5.09-3.27,6.12-6.12
|
||||
l8.27-22.98c0.35-0.99,0.35-2.07,0-3.07C70.91,29.08,69.18,27.94,67.32,27.94L67.32,27.94z M67.32,27.94"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
65
miniprogram/image/account/Account_NO.svg
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000174590641328129768410000008888487617591348397_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<g>
|
||||
<line class="st19" x1="10.88" y1="10.88" x2="89.12" y2="89.12"/>
|
||||
<line class="st19" x1="89.12" y1="10.88" x2="10.88" y2="89.12"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
62
miniprogram/image/account/Account_OK.svg
Normal file
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000000193655916124849200000001531564748471850152_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<polyline class="st19" points="12.24,59.77 40.71,91.76 87.76,8.24 "/>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
75
miniprogram/image/account/Account_PubilcAccount.svg
Normal file
@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000089549096524624138190000001993487473804585391_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<g>
|
||||
<path class="st2" d="M51.82,18.46c0.22,0,0.53,0.12,0.81,0.44c0,0.02,0.01,0.05,0.01,0.06v62.07c0,0.18-0.27,0.47-0.67,0.47
|
||||
c-0.14,0-0.23-0.01-0.26-0.02l-0.09-0.05l-0.12-0.06l-14.95-8.83c-3.32-1.98-6.95-2.98-10.78-2.98h-9.97
|
||||
c-4.1,0-7.44-3.17-7.44-7.05V38.05c0-3.22,2.85-5.84,6.37-5.84h8.61c3.81,0,7.54-1.04,10.79-3.03h0.02l15.71-9.65h0.01l1.56-0.96
|
||||
C51.57,18.51,51.69,18.46,51.82,18.46 M51.82,12c-1.28,0-2.57,0.34-3.77,1.08h-0.01L30.75,23.65c-2.24,1.37-4.8,2.08-7.43,2.08
|
||||
h-8.59c-7.13,0-12.83,5.55-12.83,12.3v24.45C1.9,69.93,8.14,76,15.81,76h9.97c2.67,0,5.16,0.69,7.49,2.08l14.96,8.84
|
||||
c1.08,0.7,2.32,1.04,3.74,1.04c3.92,0,7.13-3.12,7.13-6.94V18.97c0-1.21-0.36-2.61-1.08-3.64C56.52,13.2,54.19,12,51.82,12
|
||||
L51.82,12z M94.55,46.53H73.17c-1.94-0.02-3.53,1.53-3.56,3.47c0,1.91,1.61,3.47,3.56,3.47h21.38c1.96,0,3.57-1.56,3.57-3.47
|
||||
C98.08,48.06,96.49,46.51,94.55,46.53L94.55,46.53z M93.13,76.01L74.59,65.61c-1.66-0.99-3.81-0.45-4.81,1.21
|
||||
c-0.48,0.78-0.64,1.72-0.4,2.61c0.24,0.88,0.83,1.64,1.64,2.07l18.54,10.4c1.66,0.99,3.81,0.45,4.81-1.21
|
||||
C95.44,79.13,94.9,77.05,93.13,76.01L93.13,76.01z M74.42,34.4L92.94,24c1.79-1.03,2.32-3.11,1.25-4.69
|
||||
c-1.07-1.73-3.2-2.25-4.81-1.21l-18.54,10.4c-1.78,1.04-2.32,3.12-1.25,4.69C70.68,34.75,72.81,35.44,74.42,34.4L74.42,34.4z
|
||||
M74.42,34.4"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.2 KiB |
83
miniprogram/image/account/Account_Settings.svg
Normal file
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000083775721639409305130000017638257817945677498_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<g>
|
||||
<path class="st2" d="M94.18,41.64l-5.54-1.68c-0.91-3.53-2.32-6.91-4.18-10.05l2.67-5.09c1.11-2.07,0.73-4.63-0.93-6.29
|
||||
l-4.64-4.74c-1.64-1.69-4.2-2.1-6.29-1.01l-5.09,2.66c-3.14-1.8-6.52-3.14-10.05-3.97L58.45,5.9c-0.68-2.24-2.75-3.78-5.09-3.78
|
||||
h-6.72c-2.34,0-4.41,1.54-5.09,3.78l-1.68,5.54c-3.53,0.9-6.92,2.31-10.05,4.18l-5.09-2.85c-2.07-1.12-4.62-0.75-6.29,0.91
|
||||
l-4.74,4.85c-1.69,1.64-2.1,4.2-1.01,6.29l2.66,5.09c-1.79,3.15-3.12,6.53-3.97,10.05l-5.57,1.68c-2.24,0.68-3.78,2.75-3.78,5.09
|
||||
v6.72c0,2.34,1.54,4.41,3.78,5.09l5.54,1.68c0.91,3.53,2.32,6.91,4.18,10.05l-2.85,5.09c-1.11,2.07-0.73,4.63,0.93,6.29l4.74,4.74
|
||||
c1.67,1.65,4.22,2.02,6.29,0.91l5.09-2.66c3.13,1.86,6.52,3.25,10.05,4.13l1.68,5.57c0.71,2.25,2.81,3.77,5.17,3.73h6.72
|
||||
c2.34,0,4.41-1.54,5.09-3.78l1.68-5.54c3.53-0.9,6.92-2.31,10.05-4.18l5.09,2.67c2.07,1.12,4.62,0.75,6.29-0.91l4.74-4.74
|
||||
c1.65-1.63,2.06-4.14,1.01-6.21l-2.66-5.09c1.84-3.14,3.23-6.52,4.13-10.05l5.57-1.68c2.18-0.74,3.64-2.79,3.62-5.09v-6.72
|
||||
C97.96,44.38,96.43,42.31,94.18,41.64L94.18,41.64z M87.09,55.09c-1.77,0.54-3.13,1.97-3.6,3.76c-0.8,3.05-2.01,5.99-3.6,8.71
|
||||
c-0.95,1.65-0.95,3.68,0,5.33l2.66,5.09l-4.77,4.61l-5.12-2.66c-1.65-0.95-3.68-0.95-5.33,0c-2.72,1.58-5.64,2.79-8.69,3.6
|
||||
c-1.8,0.46-3.24,1.82-3.78,3.6l-1.52,5.6h-6.69l-1.68-5.54c-0.55-1.78-1.98-3.14-3.78-3.6c-3.04-0.8-5.97-2.01-8.69-3.6
|
||||
c-0.81-0.48-1.73-0.74-2.66-0.75c-0.86,0-1.71,0.21-2.48,0.61l-5.09,2.66l-4.8-4.64l2.67-5.12c0.91-1.67,0.86-3.7-0.13-5.33
|
||||
c-1.59-2.73-2.8-5.66-3.6-8.71c-0.47-1.79-1.83-3.21-3.6-3.76l-5.46-1.52v-6.69l5.54-1.68c1.77-0.54,3.13-1.97,3.6-3.76
|
||||
c0.8-3.06,2.01-5.99,3.6-8.71c0.94-1.59,0.99-3.56,0.13-5.2l-2.67-5.09l4.64-4.74l5.12,2.67c1.64,0.86,3.6,0.81,5.2-0.13
|
||||
c2.72-1.56,5.65-2.74,8.69-3.52c1.8-0.46,3.24-1.82,3.78-3.6l1.65-5.54h6.69l1.68,5.54c0.55,1.78,1.98,3.14,3.78,3.6
|
||||
c3.04,0.8,5.97,2.01,8.69,3.6c1.63,0.99,3.66,1.04,5.33,0.13l5.09-2.67l4.74,4.74l-2.66,5.12c-0.9,1.62-0.9,3.58,0,5.2
|
||||
c1.59,2.73,2.8,5.66,3.6,8.71c0.47,1.79,1.83,3.21,3.6,3.76l5.54,1.65v6.69L87.09,55.09z M87.09,55.09"/>
|
||||
<path class="st2" d="M50,28.76c-11.77,0-21.32,9.54-21.32,21.32c0,11.77,9.54,21.32,21.32,21.32c11.77,0,21.32-9.55,21.32-21.32
|
||||
c0-5.65-2.25-11.08-6.24-15.07C61.08,31.01,55.65,28.76,50,28.76L50,28.76z M50,66.07c-8.83,0-15.99-7.16-15.99-15.99
|
||||
c0-8.83,7.16-15.99,15.99-15.99s15.99,7.16,15.99,15.99C65.99,58.91,58.83,66.07,50,66.07L50,66.07z M50,66.07"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.3 KiB |
73
miniprogram/image/account/Account_Sponsor.svg
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000178901070286266389090000005326459498747094661_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<g>
|
||||
<path class="st2" d="M69.01,17.31c0.79,0,1.74,0.47,2.24,1.12l0.02,0.03l0.02,0.03l18.38,22.89c0.89,1.17,0.76,2.92-0.33,4.12
|
||||
L52.88,84.81l-0.02,0.02c-0.44,0.48-1.13,0.78-2.03,0.86h-0.06c-0.66,0-1.42-0.28-1.97-0.74l-0.27-0.27L11.33,45.32
|
||||
c-0.99-1.12-1.1-2.79-0.25-3.82l0.03-0.04l0.03-0.04l18.41-22.93v-0.02c0.62-0.77,1.39-1.17,2.28-1.17h37.17 M69.01,10.16H31.84
|
||||
c-3.01,0-5.86,1.34-7.87,3.85L5.57,36.94c-3.18,3.85-2.85,9.54,0.5,13.23L43.4,89.68l0.5,0.5c1.84,1.67,4.35,2.68,6.86,2.68h0.34
|
||||
c2.68-0.17,5.19-1.17,7.03-3.18l36.49-39.34c3.51-3.85,3.68-9.54,0.67-13.39L76.89,14.03C75.03,11.66,72.02,10.16,69.01,10.16
|
||||
L69.01,10.16z M69.01,10.16"/>
|
||||
<path class="st2" d="M30.33,42.38c-0.81,0-1.62,0.29-2.32,0.93c-1.34,1.17-1.34,3.35-0.17,4.69l18.08,19.08l0.34,0.34
|
||||
c1.27,1.2,2.89,1.78,4.52,1.78c1.8,0,3.62-0.72,5.02-2.11L73.2,48.16c1.17-1.34,1.17-3.51-0.17-4.69
|
||||
c-0.67-0.53-1.46-0.78-2.23-0.78c-0.95,0-1.88,0.38-2.62,1.12l-16.5,17.6c-0.25,0.26-0.59,0.4-0.93,0.4
|
||||
c-0.34,0-0.66-0.13-0.92-0.39L32.85,43.47C32.14,42.75,31.24,42.38,30.33,42.38L30.33,42.38z M30.33,42.38"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.0 KiB |
72
miniprogram/image/account/Account_Support.svg
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000093862449718304528650000001831433815926670741_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<g>
|
||||
<path class="st2" d="M88.72,18.15c0.45,0,0.82,0.37,0.82,0.82v54.55c0,0.45-0.37,0.82-0.82,0.82H47.58c-3.3,0-6.44,1.23-8.86,3.47
|
||||
l-8.73,8.06l-0.31-1.34c-1.36-6-6.59-10.19-12.75-10.19h-5.58c-0.45,0-0.82-0.37-0.82-0.82V18.97c0-0.45,0.37-0.82,0.82-0.82
|
||||
H88.72 M88.72,12.03H11.36c-3.84,0-6.94,3.1-6.94,6.94v54.55c0,3.84,3.1,6.94,6.94,6.94h5.58c3.25,0,6.05,2.25,6.77,5.41
|
||||
l0.66,2.96c0.57,2.52,2.78,4.03,5.06,4.03c1.23,0,2.46-0.43,3.48-1.38l9.95-9.19c1.29-1.18,2.96-1.84,4.71-1.84h41.15
|
||||
c3.84,0,6.94-3.1,6.94-6.94V18.97C95.66,15.14,92.55,12.03,88.72,12.03L88.72,12.03z M88.72,12.03"/>
|
||||
<path class="st2" d="M29.73,37.66c-3.25,0-5.87,2.63-5.87,5.87c0,3.24,2.63,5.87,5.87,5.87c3.24,0,5.87-2.63,5.87-5.87
|
||||
C35.6,40.29,32.97,37.66,29.73,37.66L29.73,37.66z M51.1,38.07c-3.25,0-5.87,2.63-5.87,5.87c0,3.24,2.63,5.87,5.87,5.87
|
||||
c3.24,0,5.88-2.62,5.88-5.87C56.98,40.69,54.35,38.07,51.1,38.07L51.1,38.07z M72.47,38.07c-3.25,0-5.87,2.63-5.87,5.87
|
||||
c0,3.24,2.63,5.87,5.87,5.87c3.25,0,5.87-2.63,5.87-5.87C78.34,40.7,75.72,38.07,72.47,38.07L72.47,38.07z M72.47,38.07"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.0 KiB |
73
miniprogram/image/account/Account_Theme.svg
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000069362941054203318130000012565035162419057327_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<path class="st2" d="M94.28,26.98L76.8,12.11c-1.82-1.6-4.27-2.28-6.66-1.86c-2.39,0.42-4.45,1.9-5.62,4.03
|
||||
c-0.79,1.4-1.78,2.69-2.94,3.8c-6.44,5.96-16.38,5.96-22.82,0c-1.27-1.3-2.33-2.8-3.13-4.43c-1.1-2.15-3.12-3.68-5.49-4.14
|
||||
c-2.37-0.52-4.85,0.06-6.74,1.59L5.83,26.41c-1.64,1.41-2.63,3.43-2.74,5.59c-0.13,2.19,0.63,4.35,2.12,5.97
|
||||
c4.6,4.99,10,9.18,15.99,12.37c0.27,0.12,0.46,0.38,0.48,0.67v29.23c0,3.51,1.39,6.88,3.88,9.36c2.48,2.48,5.85,3.88,9.36,3.88
|
||||
h11.31c1.99,0,3.61-1.62,3.61-3.61c0-1.99-1.62-3.61-3.61-3.61H34.77c-3.32,0-6.02-2.69-6.02-6.02V51.06
|
||||
c-0.03-2.95-1.67-5.65-4.29-7.03c-5.23-2.83-9.95-6.5-13.96-10.88c-0.09-0.22-0.09-0.46,0-0.67c0.02-0.21,0.12-0.4,0.29-0.53
|
||||
l17.33-15.17c0.21-0.1,0.46-0.1,0.67,0c0.21,0.03,0.39,0.15,0.48,0.34c1.25,2.35,2.87,4.49,4.82,6.31
|
||||
c4.38,4.16,10.19,6.47,16.23,6.45c6.13,0,12.02-2.38,16.42-6.64c1.65-1.6,3.06-3.44,4.19-5.44c0.15-0.17,0.36-0.26,0.58-0.26
|
||||
c0.22,0,0.43,0.1,0.58,0.26l17.48,14.88c0.17,0.13,0.27,0.32,0.29,0.53c0.01,0.27-0.1,0.53-0.29,0.72
|
||||
c-3.92,4.1-8.45,7.56-13.43,10.26c-2.6,1.38-4.23,4.08-4.24,7.03v29.23c0,3.32-2.69,6.02-6.02,6.02c-1.99,0-3.61,1.62-3.61,3.61
|
||||
c0,1.99,1.62,3.61,3.61,3.61c3.51-0.04,6.86-1.47,9.32-3.98c2.46-2.51,3.81-5.89,3.78-9.41V51.01c0.03-0.3,0.21-0.55,0.48-0.67
|
||||
c5.65-3.07,10.78-7,15.22-11.65c1.55-1.63,2.37-3.82,2.26-6.07C96.85,30.46,95.9,28.42,94.28,26.98L94.28,26.98z M94.28,26.98"/>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.3 KiB |
75
miniprogram/image/account/Account_UserInfo.svg
Normal file
@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4F0F1;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
.st2{fill:#3EA3D8;}
|
||||
.st3{fill:#CCCCCC;}
|
||||
.st4{fill:none;stroke:#CCCCCC;stroke-linecap:square;stroke-miterlimit:10;}
|
||||
.st5{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;}
|
||||
.st6{fill:none;stroke:#CCCCCC;stroke-miterlimit:10;stroke-dasharray:1.9084,1.9084;}
|
||||
.st7{fill:#1A1A1A;}
|
||||
.st8{fill:none;stroke:#1A1A1A;stroke-width:3;stroke-miterlimit:10;}
|
||||
.st9{fill:none;stroke:#1A1A1A;stroke-miterlimit:10;}
|
||||
.st10{fill:none;stroke:#E6E6E6;stroke-miterlimit:10;}
|
||||
.st11{fill:#666666;}
|
||||
.st12{fill:none;stroke:#B3B3B3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
.st13{fill:#B3B3B3;}
|
||||
.st14{opacity:0.05;}
|
||||
.st15{clip-path:url(#SVGID_00000042694534944456839630000009249756808104012177_);}
|
||||
.st16{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
|
||||
.st17{opacity:0.4;fill:#3EA3D8;}
|
||||
.st18{fill:none;stroke:#3EA3D8;stroke-miterlimit:10;}
|
||||
.st19{fill:none;stroke:#3EA3D8;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="A1">
|
||||
<g id="NAV_x5F_BAR_00000129914889952932149030000011711506177042644156_">
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR_00000015351907221170818370000001589878730520391302_">
|
||||
</g>
|
||||
<g id="FUNC_x5F_LIST">
|
||||
</g>
|
||||
<g id="MAIN_x5F_FUNC">
|
||||
</g>
|
||||
<g id="USER_x5F_CARD">
|
||||
<g id="BG" class="st14">
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ICON">
|
||||
<g>
|
||||
<path class="st2" d="M60.93,54.42c7.91-6.23,12.37-15.86,12-25.92c0.05-4.54-0.88-9.04-2.74-13.18c0.01-0.1,0.01-0.2,0-0.3
|
||||
c-0.07-0.11-0.15-0.22-0.24-0.32C66.39,6.9,58.57,1.91,49.99,1.96c-13.3,0-22.94,11.18-22.94,26.54
|
||||
c-0.37,10.06,4.09,19.69,12,25.92C22.69,57.7,11.66,68.34,11.66,82.14c-0.2,3.81,1.18,7.53,3.8,10.29
|
||||
c5.13,5.1,14.54,5.6,26.54,5.6h14.74c13.12,0,22.59,0,27.75-5.01c2.73-2.94,4.11-6.88,3.83-10.88
|
||||
C88.33,68.34,77.3,57.7,60.93,54.42L60.93,54.42z M49.99,68.02l-6.66-8.35c4.43-0.55,8.9-0.55,13.33,0L49.99,68.02z M49.99,7.86
|
||||
c5.34-0.06,10.34,2.61,13.27,7.08c-18.67,8.23-27.84,5.25-28.93,4.81C36.34,12.75,42.71,7.91,49.99,7.86L49.99,7.86z M32.95,28.5
|
||||
c0-1,0-1.98,0.15-2.95c2.46,0.69,5.02,1.02,7.58,0.97c8.73-0.33,17.29-2.47,25.15-6.28c0.83,2.67,1.24,5.46,1.21,8.26
|
||||
c0,13-7.64,23.59-17.04,23.59C40.58,52.09,32.95,41.51,32.95,28.5L32.95,28.5z M80.36,88.87c-3.42,3.36-11.8,3.33-23.59,3.27
|
||||
H46.54c-12.3,0-22.88,0-26.92-3.89c-1.51-1.66-2.26-3.87-2.06-6.1c0-9.91,7.61-17.69,19.29-21.11l10.85,13.54
|
||||
c0,0,0.15,0,0.21,0.18c0.07,0.11,0.16,0.21,0.27,0.3c0.12,0.09,0.25,0.17,0.38,0.24l0.32,0.18c0.35,0.15,0.74,0.23,1.12,0.24
|
||||
c0.39,0,0.77-0.09,1.12-0.27l0.32-0.15c0.13-0.07,0.26-0.15,0.38-0.24c0.1-0.08,0.19-0.18,0.27-0.3s0.15,0,0.21-0.18l10.85-13.62
|
||||
c11.8,3.33,19.29,11.21,19.29,21.11C82.75,84.52,82,87,80.36,88.87L80.36,88.87z M80.36,88.87"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="DEFAULT_x5F_AVATOR">
|
||||
</g>
|
||||
<g id="COLOR">
|
||||
</g>
|
||||
<g id="NAV_x5F_BAR">
|
||||
<g id="ICON_x5F_SETTING">
|
||||
</g>
|
||||
<g id="ICON_x5F_INFO">
|
||||
</g>
|
||||
<g id="ICON_x5F_KCB">
|
||||
</g>
|
||||
</g>
|
||||
<g id="HEADER_x5F_BAR">
|
||||
<g id="BUTTON">
|
||||
</g>
|
||||
<g id="TOP">
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.3 KiB |
17
miniprogram/image/ui/last_semester.svg
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 1024 1024" style="enable-background:new 0 0 1024 1024;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#3EA3D8;}
|
||||
</style>
|
||||
<path class="st0" d="M839.8,71.8H715.5c-18.5-34.5-55.1-58.2-96.9-58.2H414.1c-41.9,0-78.3,23.6-96.9,58.2H192.9
|
||||
C131,71.8,80.8,122.2,80.8,184v711.4c0,61.9,50.2,112.1,112.1,112.1h646.9c61.9,0,112.1-50.2,112.1-112.1V184
|
||||
C951.8,122.1,901.6,71.8,839.8,71.8L839.8,71.8z M414.1,72.2h204.5c28.3,0,51.4,23.1,51.4,51.4S646.9,175,618.6,175H414.1
|
||||
c-28.3,0-51.4-23.1-51.4-51.4C362.6,95.3,385.8,72.2,414.1,72.2L414.1,72.2z M893.4,895.4c0,29.6-24,53.6-53.6,53.6H192.9
|
||||
c-29.6,0-53.6-24-53.6-53.6V184c0-29.6,24-53.6,53.6-53.6h111.6c3.5,57.5,51.4,103.1,109.6,103.1h204.5
|
||||
c58.3,0,106.1-45.6,109.6-103.1h111.6c29.6,0,53.6,24,53.6,53.6L893.4,895.4L893.4,895.4z"/>
|
||||
<path class="st0" d="M314.6,730.6H459v-350c0-15.8,9.9-24.4,29.7-25.7c19.8,1.3,30.3,9.9,31.6,25.7v96.9h172
|
||||
c17.1,1.3,26.4,11.2,27.7,29.7c-1.3,19.8-10.6,29.7-27.7,29.7h-172v193.8H722c14.5,1.3,22.4,9.9,23.7,25.7
|
||||
c-1.3,18.4-9.2,28.3-23.7,29.7H314.6c-15.8-1.3-24.4-11.2-25.7-29.7C290.2,740.4,298.8,731.9,314.6,730.6L314.6,730.6z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
18
miniprogram/image/ui/next_semester.svg
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 1024 1024" style="enable-background:new 0 0 1024 1024;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#3EA3D8;}
|
||||
</style>
|
||||
<path class="st0" d="M838.4,71.7H713.8c-18.5-34.6-55.2-58.3-97.1-58.3H412c-42,0-78.4,23.7-97,58.3H190.4
|
||||
c-62,0-112.2,50.5-112.2,112.3v712.6c0,62,50.3,112.2,112.2,112.2h648c62,0,112.2-50.3,112.2-112.2V184.1
|
||||
C950.6,122.1,900.3,71.7,838.4,71.7z M412,72.1h204.8c28.4,0,51.4,23.1,51.4,51.4c0,28.4-23.1,51.5-51.4,51.5H412
|
||||
c-28.4,0-51.4-23.1-51.4-51.5C360.4,95.2,383.6,72.1,412,72.1z M892,896.6c0,29.6-24.1,53.7-53.7,53.7h-648
|
||||
c-29.6,0-53.7-24.1-53.7-53.7V184.1c0-29.6,24.1-53.7,53.7-53.7h111.8c3.5,57.6,51.4,103.3,109.8,103.3h204.8
|
||||
c58.4,0,106.3-45.7,109.8-103.3h111.8c29.6,0,53.7,24.1,53.7,53.7C892,184.1,892,896.6,892,896.6z"/>
|
||||
<path class="st0" d="M308.4,358h411.9c15.8,1.3,25.1,11.2,27.7,29.7c-1.3,18.5-9.9,27.7-25.7,27.7H528.2V461
|
||||
c52.8,33,103.6,72,152.5,116.8c18.5,19.8,21.8,38.3,9.9,55.4c-13.2,11.9-30.4,8.6-51.5-9.9c-42.3-39.6-79.2-71.3-110.9-95.1V764
|
||||
c-1.3,14.5-11.2,22.4-29.7,23.8c-18.5-1.3-27.7-9.3-27.7-23.8V415.4H310.4c-15.8,0-24.4-9.2-25.7-27.7
|
||||
C284.7,369.2,292.6,359.3,308.4,358z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
12
miniprogram/image/ui/selectArror.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="D" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 1024 1024" style="enable-background:new 0 0 1024 1024;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#3EA3D8;}
|
||||
</style>
|
||||
<path class="st0" d="M474.1,995.9l5.4,4.9c33.6,27.3,86.1,4,86.1-41.4V729.7h371.2c29.3,0,53-23.7,53-53V346.7l-0.5-7.1
|
||||
c-3.6-26.3-26-45.9-52.5-45.9l-371.2,0.1V64c0-21.7-13.2-41.2-33.4-49.2c-20.2-8-43.2-3-58.1,12.8L49.9,475.3
|
||||
c-19.3,20.4-19.3,52.4,0,72.9L474.1,995.9z M161.4,511.7l298.1-314.7v149.7l0.5,7.2c3.6,26.3,26,45.8,52.5,45.8l371.1,0.1v223.8
|
||||
H512.5l-7.2,0.5c-26.3,3.6-45.8,26-45.8,52.5v149.8L161.4,511.7z M161.4,511.7"/>
|
||||
</svg>
|
After Width: | Height: | Size: 837 B |
99
miniprogram/modular/PopupLayer.scss
Normal file
@ -0,0 +1,99 @@
|
||||
@import "../app.scss";
|
||||
|
||||
view.mask {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba($color: #000000, $alpha: .2);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
view.layer {
|
||||
position: fixed;
|
||||
@include container;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
view.occlude {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
view.mask.block, view.layer.block, view.occlude.block {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
view.mask.none, view.layer.none, view.occlude.none {
|
||||
display: none;
|
||||
}
|
||||
|
||||
view.mask.show-fade, view.layer.show-fade, view.occlude.show-fade {
|
||||
animation: show-fade .1s cubic-bezier(0, 0, 1, 1) both;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
view.mask.hide-fade, view.layer.hide-fade, view.occlude.hide-fade {
|
||||
animation: hide-fade .1s cubic-bezier(0, 0, 1, 1) both;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
view.mask.show-scale, view.layer.show-scale, view.occlude.show-scale {
|
||||
animation: show-scale .3s cubic-bezier(.1, .9, .2, 1) both,
|
||||
show-fade .1s cubic-bezier(0, 0, 1, 1) both;
|
||||
transform: scale3d(1, 1, 1);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
view.mask.hide-scale, view.layer.hide-scale, view.occlude.hide-scale {
|
||||
animation: hide-scale .3s cubic-bezier(.1, .9, .2, 1) both,
|
||||
hide-fade .1s cubic-bezier(0, 0, 1, 1) both;
|
||||
transform: scale3d(.9, .9, 1);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
view.mask {
|
||||
background-color: rgba($color: #000000, $alpha: .5);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes show-fade{
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes hide-fade{
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes show-scale{
|
||||
from {
|
||||
transform: scale3d(1.15, 1.15, 1);
|
||||
}
|
||||
to {
|
||||
transform: scale3d(1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes hide-scale{
|
||||
from {
|
||||
transform: scale3d(1, 1, 1);
|
||||
}
|
||||
to {
|
||||
transform: scale3d(.9, .9, 1);
|
||||
}
|
||||
}
|
309
miniprogram/modular/PopupLayer.ts
Normal file
@ -0,0 +1,309 @@
|
||||
import { IAnyData } from "../core/Api";
|
||||
import { Emitter } from "../core/Emitter";
|
||||
import { Modular, Manager } from "../core/Module";
|
||||
|
||||
/**
|
||||
* 动画类型
|
||||
*/
|
||||
enum AnimateType {
|
||||
fade = 1,
|
||||
scale = 2,
|
||||
none = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示层
|
||||
*/
|
||||
class DisplayLayer {
|
||||
|
||||
/**
|
||||
* 类名
|
||||
*/
|
||||
public get className(): string {
|
||||
let res = this.isDisplay ? "block" : "none";
|
||||
|
||||
switch (this.animateType) {
|
||||
case AnimateType.fade:
|
||||
res += " mask";
|
||||
break;
|
||||
|
||||
case AnimateType.scale:
|
||||
res += " layer";
|
||||
break;
|
||||
|
||||
case AnimateType.none:
|
||||
res += " occlude";
|
||||
break;
|
||||
}
|
||||
|
||||
switch (this.animateType) {
|
||||
case AnimateType.fade:
|
||||
res += this.isShow ? " show-fade" : " hide-fade";
|
||||
break;
|
||||
|
||||
case AnimateType.scale:
|
||||
res += this.isShow ? " show-scale" : " hide-scale";
|
||||
break;
|
||||
|
||||
case AnimateType.none:
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Layer 使用的 key
|
||||
*/
|
||||
public key: string = "";
|
||||
|
||||
/**
|
||||
* 使用的动画类型
|
||||
*/
|
||||
public animateType: AnimateType = AnimateType.scale;
|
||||
|
||||
/**
|
||||
* 动画时间
|
||||
*/
|
||||
public get animateTime(): number {
|
||||
switch (this.animateType) {
|
||||
case AnimateType.fade:
|
||||
return 100;
|
||||
case AnimateType.scale:
|
||||
return 300;
|
||||
case AnimateType.none:
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
public isDisplay: boolean = false;
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
public isShow: boolean = false;
|
||||
|
||||
/**
|
||||
* 消失动画计时器
|
||||
*/
|
||||
public disappearTimer?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出层事件
|
||||
*/
|
||||
type IPopupLayerEvent<L extends string> = {
|
||||
|
||||
/**
|
||||
* 点击蒙版时
|
||||
*/
|
||||
clickMask: void
|
||||
|
||||
/**
|
||||
* 显示层
|
||||
*/
|
||||
show: L;
|
||||
|
||||
/**
|
||||
* 隐藏层
|
||||
*/
|
||||
hide: L;
|
||||
|
||||
/**
|
||||
* 层状态改变
|
||||
*/
|
||||
change: Readonly<DisplayLayer>;
|
||||
}
|
||||
|
||||
type commonLayerType = "mask" | "occlude";
|
||||
|
||||
/**
|
||||
* 弹出层
|
||||
*/
|
||||
class PopupLayer<
|
||||
L extends string,
|
||||
M extends Manager = Manager
|
||||
> extends Modular<M, {}, IPopupLayerEvent<L | commonLayerType>> {
|
||||
|
||||
/**
|
||||
* 当点击时是否自动关闭蒙版
|
||||
*/
|
||||
public autoCloseOnClick: boolean = true;
|
||||
|
||||
/**
|
||||
* 关闭动画执行时是否屏蔽用户点击
|
||||
*/
|
||||
public showOccludeWhenHide: boolean = true;
|
||||
|
||||
/**
|
||||
* 显示 Layer 时自动关闭其他层
|
||||
*/
|
||||
public hideOtherWhenShow: boolean = true;
|
||||
|
||||
/**
|
||||
* 层列表
|
||||
*/
|
||||
private layers: Map<L | commonLayerType, DisplayLayer> = new Map();
|
||||
|
||||
/**
|
||||
* 初始化层
|
||||
* @param key 初始化关键字
|
||||
*/
|
||||
public initLayers(key: L[]) {
|
||||
for (let i = 0; i < key.length; i++) {
|
||||
this.render(this.getDisplayLayer(key[i]));
|
||||
}
|
||||
}
|
||||
|
||||
public onLoad(): void {
|
||||
this.on("show", this.handleShowLayer);
|
||||
this.on("hide", this.handleHideLayer);
|
||||
this.setFunc(this.handleClickMask, "clickMask");
|
||||
|
||||
// 添加蒙版层
|
||||
const maskLayer = this.getDisplayLayer("mask");
|
||||
maskLayer.animateType = AnimateType.fade;
|
||||
this.render(maskLayer);
|
||||
|
||||
// 添加遮蔽层
|
||||
const occludeLayer = this.getDisplayLayer("occlude");
|
||||
occludeLayer.animateType = AnimateType.none;
|
||||
this.render(occludeLayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染 Layers
|
||||
*/
|
||||
private render(layer: DisplayLayer) {
|
||||
this.setData({ [`${ layer.key }$className`]: layer.className });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取显示层
|
||||
*/
|
||||
private getDisplayLayer<K extends L | commonLayerType>(e: K): DisplayLayer {
|
||||
let displayLayer = this.layers.get(e);
|
||||
if (!displayLayer) {
|
||||
displayLayer = new DisplayLayer();
|
||||
displayLayer.key = e;
|
||||
this.layers.set(e, displayLayer);
|
||||
}
|
||||
return displayLayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应蒙版点击事件
|
||||
*/
|
||||
private handleClickMask = () => {
|
||||
|
||||
if (!this.autoCloseOnClick) return;
|
||||
|
||||
// 关闭全部开启的层
|
||||
this.layers.forEach((layer) => {
|
||||
if (layer.isShow) (this as Emitter<IAnyData>).emit("hide", layer.key);
|
||||
});
|
||||
|
||||
// 关闭蒙版
|
||||
(this as Emitter<IAnyData>).emit("hide", "mask");
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应显示层事件
|
||||
*/
|
||||
private handleShowLayer = <K extends L | commonLayerType>(e: K) => {
|
||||
let displayLayer = this.getDisplayLayer(e);
|
||||
|
||||
// 阻止未发生的变化
|
||||
if (displayLayer.isShow) return;
|
||||
|
||||
// 关闭其他层
|
||||
if (e !== "mask" && e !== "occlude" && this.hideOtherWhenShow) {
|
||||
this.layers.forEach((layer) => {
|
||||
if (layer.key === "mask" || layer.key === "occlude") return;
|
||||
if (layer.isShow) {
|
||||
(this as Emitter<IAnyData>).emit("hide", layer.key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 显示蒙版
|
||||
if (e !== "mask" && e !== "occlude")
|
||||
(this as Emitter<IAnyData>).emit("show", "mask");
|
||||
|
||||
// 取消消失定时
|
||||
displayLayer.disappearTimer &&
|
||||
clearTimeout(displayLayer.disappearTimer);
|
||||
|
||||
displayLayer.isShow = true;
|
||||
displayLayer.isDisplay = true;
|
||||
this.render(displayLayer);
|
||||
|
||||
this.emit("change", displayLayer);
|
||||
};
|
||||
|
||||
/**
|
||||
* 响应隐藏层事件
|
||||
*/
|
||||
private handleHideLayer = <K extends L | commonLayerType>(e: K) => {
|
||||
let displayLayer = this.getDisplayLayer(e);
|
||||
|
||||
// 阻止未发生的变化
|
||||
if (!displayLayer.isShow) return;
|
||||
|
||||
if (displayLayer.animateTime <= 0) {
|
||||
|
||||
displayLayer.isShow = false;
|
||||
displayLayer.isDisplay = false;
|
||||
this.render(displayLayer);
|
||||
} else {
|
||||
|
||||
displayLayer.isShow = false;
|
||||
this.render(displayLayer);
|
||||
|
||||
// 开启遮蔽
|
||||
if (this.showOccludeWhenHide) {
|
||||
(this as Emitter<IAnyData>).emit("show", "occlude");
|
||||
}
|
||||
|
||||
displayLayer.disappearTimer = setTimeout(() => {
|
||||
displayLayer.isDisplay = false;
|
||||
this.render(displayLayer);
|
||||
|
||||
// 取消 timer
|
||||
displayLayer.disappearTimer = undefined;
|
||||
|
||||
// 检测是否关闭遮蔽
|
||||
let needOcclude = true;
|
||||
this.layers.forEach((layer) => {
|
||||
if (layer === displayLayer) return;
|
||||
if (layer.disappearTimer) needOcclude = false;
|
||||
});
|
||||
|
||||
// 关闭遮蔽
|
||||
if (needOcclude && this.showOccludeWhenHide) {
|
||||
(this as Emitter<IAnyData>).emit("hide", "occlude");
|
||||
}
|
||||
|
||||
}, displayLayer.animateTime);
|
||||
}
|
||||
|
||||
// 关闭蒙版
|
||||
if (e !== "mask" && e !== "occlude") {
|
||||
let needMask = true;
|
||||
this.layers.forEach((layer) => {
|
||||
if (layer === displayLayer) return;
|
||||
if (layer.isShow) needMask = false;
|
||||
});
|
||||
|
||||
if (needMask) (this as Emitter<IAnyData>).emit("hide", "mask");
|
||||
}
|
||||
|
||||
this.emit("change", displayLayer);
|
||||
}
|
||||
}
|
||||
|
||||
export { PopupLayer };
|
||||
export default PopupLayer;
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "设置"
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
@import "./UserCard.scss";
|
||||
@import "./MainFunction.scss";
|
||||
@import "./FunctionList.scss";
|
||||
@import "../../modular/PopupLayer.scss";
|
||||
|
||||
view.container{
|
||||
padding-top: 50rpx;
|
||||
}
|
||||
|
||||
|
@ -1,66 +1,38 @@
|
||||
// pages/Account/Account.ts
|
||||
Page({
|
||||
import { Manager } from "../../core/Module";
|
||||
import { UserCard } from "./UserCard";
|
||||
import { MainFunction } from "./MainFunction";
|
||||
import { FunctionList } from "./FunctionList";
|
||||
import { PopupLayer } from "../../modular/PopupLayer";
|
||||
import { TestLayerA } from "./TestLayerA";
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
(async () => {
|
||||
|
||||
},
|
||||
// 初始化页面
|
||||
const { manager, query } = await Manager.PageAsync();
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {
|
||||
// 添加弹出层 Modular
|
||||
const popupLayer: PopupLayer<"layerA" | "layerB"> = manager.addModule(PopupLayer, "mask") as any;
|
||||
|
||||
},
|
||||
// 添加 UserCard Modular
|
||||
const userCard = manager.addModule(UserCard, "userCard");
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
//#region test layer
|
||||
popupLayer.initLayers(["layerA", "layerB"]);
|
||||
const testLayerA = manager.addModule(TestLayerA, "testLayerA");
|
||||
userCard.on("clickChangeTheme", () => {
|
||||
popupLayer.emit("show", "layerA");
|
||||
})
|
||||
testLayerA.on("click", () => {
|
||||
popupLayer.emit("show", "layerB");
|
||||
})
|
||||
//#endregion
|
||||
|
||||
},
|
||||
// 添加 MainFunction Modular
|
||||
manager.addModule(MainFunction, "mainFunction");
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 添加 FunctionList Modular
|
||||
manager.addModule(FunctionList, "functionList");
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
// 初始化全部 Modular
|
||||
await manager.loadAllModule(query);
|
||||
})();
|
@ -1 +1,85 @@
|
||||
<text>pages/Account/Account.wxml</text>
|
||||
<!-- 层遮蔽层 -->
|
||||
<view class="{{ mask$occlude$className }}" bindtap="mask$clickMask"></view>
|
||||
|
||||
<!-- 蒙版 -->
|
||||
<view class="{{ mask$mask$className }}" bindtap="mask$clickMask"></view>
|
||||
|
||||
<!-- 层A -->
|
||||
<view class="{{ mask$layerA$className }}" bindtap="mask$clickMask">
|
||||
<view class="card" style="height: 300px; line-height: 300px; text-align:center" catchtap="testLayerA$click">layerA(点击显示layerB)</view>
|
||||
</view>
|
||||
|
||||
<!-- 层B -->
|
||||
<view class="{{ mask$layerB$className }}" bindtap="mask$clickMask">
|
||||
<view class="card" style="height: 200px; line-height: 200px; text-align:center" catchtap>layerB</view>
|
||||
</view>
|
||||
|
||||
<!-- 顶部的阴影 -->
|
||||
<view class="top-shadow"></view>
|
||||
|
||||
<!-- 页面容器 -->
|
||||
<view class="container">
|
||||
|
||||
<!-- 用户卡片 -->
|
||||
<view class="user-card card">
|
||||
<view class="avatar">
|
||||
<open-data type="userAvatarUrl" />
|
||||
</view>
|
||||
<view class="info">
|
||||
|
||||
<!-- 主题变换按钮 -->
|
||||
<view class="theme">
|
||||
<view bindtap="userCard$changeTheme">
|
||||
<image class="icon-sub" src="../../image/account/Account_Theme.svg" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 用户昵称 -->
|
||||
<view class="nick h1">
|
||||
<open-data type="userNickName" />
|
||||
</view>
|
||||
|
||||
<!-- 学生信息 -->
|
||||
<view class="student">
|
||||
<view class="name">秦浩轩</view>
|
||||
<view class="certified">
|
||||
<view class="certifi-info">已认证</view>
|
||||
<image class="text-icon" src="../../image/account/Account_OK.svg"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 学号信息 -->
|
||||
<view class="student-id">1806240113</view>
|
||||
|
||||
<!-- 学校 -->
|
||||
<view class="school">大连工业大学</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--主要功能-->
|
||||
<view class="card main-function">
|
||||
|
||||
<!--每个功能的容器-->
|
||||
<view class="branch-funtion" wx:for="{{ mainFunction$mainFunctionList }}" wx:key="index">
|
||||
<view style="{{ index == (mainFunction$mainFunctionList - 1) ? 'border-bottom: 0px' : '' }}">
|
||||
<!--每个功能的图片-->
|
||||
<image class="icon" src="../../image/account/Account_{{ item.iconUrl }}.svg"></image>
|
||||
<!--每个功能的文字-->
|
||||
<view>{{ item.displayName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能列表 -->
|
||||
<view class="card function-list">
|
||||
|
||||
<!-- 每一行 -->
|
||||
<view class="function" wx:for="{{ functionList$functionList }}" wx:key="index">
|
||||
<view style="{{ index == (functionList$functionList.length - 1) ? 'border-bottom: 0px' : '' }}">
|
||||
<image class="icon func-icon" src="../../image/account/Account_{{ item.iconUrl }}.svg" />
|
||||
<view>{{ item.displayName }}</view>
|
||||
<image class="icon-sub arrow" src="../../image/account/Account_Arrow.svg" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
@ -1 +0,0 @@
|
||||
/* pages/Account/Account.wxss */
|
43
miniprogram/pages/Account/FunctionList.scss
Normal file
@ -0,0 +1,43 @@
|
||||
@import "../../app.scss";
|
||||
|
||||
view.function-list {
|
||||
margin-top: 50rpx;
|
||||
margin-bottom: 50rpx;
|
||||
padding: 0 0 !important;
|
||||
width: 100% !important;
|
||||
|
||||
view.function {
|
||||
padding: 0 20px;
|
||||
width: calc( 100% - 40px );
|
||||
height: 55px;
|
||||
|
||||
> view {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgba($color: #000000, $alpha: .1);
|
||||
|
||||
image.func-icon {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
}
|
||||
|
||||
view {
|
||||
margin-left: 15px;
|
||||
flex-grow: 1;
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
image.arrow {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
view.function-list view.function > view {
|
||||
border-bottom: 1px solid rgba($color: #ffffff, $alpha: .1);
|
||||
}
|
||||
}
|
36
miniprogram/pages/Account/FunctionList.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { Modular, Manager } from "../../core/Module";
|
||||
|
||||
interface IFunctionListItem {
|
||||
|
||||
/**
|
||||
* 显示名称
|
||||
*/
|
||||
displayName: string;
|
||||
|
||||
/**
|
||||
* 图标路径
|
||||
*/
|
||||
iconUrl: string;
|
||||
}
|
||||
|
||||
class FunctionList<M extends Manager> extends Modular<M> {
|
||||
|
||||
public static readonly functionList: IFunctionListItem[] = [
|
||||
{ displayName: "赞助计划", iconUrl: "Sponsor" },
|
||||
{ displayName: "公众号", iconUrl: "PubilcAccount" },
|
||||
{ displayName: "自助问答", iconUrl: "FAQ" },
|
||||
{ displayName: "关于我们", iconUrl: "AboutUs" },
|
||||
{ displayName: "联系客服", iconUrl: "Support" }
|
||||
];
|
||||
|
||||
public data = {
|
||||
functionList: FunctionList.functionList
|
||||
};
|
||||
|
||||
public override onLoad() {
|
||||
// Do something
|
||||
}
|
||||
}
|
||||
|
||||
export { FunctionList };
|
||||
export default FunctionList;
|
39
miniprogram/pages/Account/MainFunction.scss
Normal file
@ -0,0 +1,39 @@
|
||||
@import "../../app.scss";
|
||||
|
||||
//主要功能
|
||||
view.main-function {
|
||||
display: flex;
|
||||
margin-top: 50rpx;
|
||||
padding: 0 !important;
|
||||
width: 100% !important;
|
||||
|
||||
view.branch-funtion {
|
||||
padding: 13px 0;
|
||||
width: 100%;
|
||||
|
||||
> view {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-self: center;
|
||||
border-right: 1px solid rgba($color: #000000, $alpha: .1);
|
||||
|
||||
image {
|
||||
height: 35px;
|
||||
width: 35px;
|
||||
}
|
||||
|
||||
view {
|
||||
text-align: center;
|
||||
margin-top: 5px;
|
||||
font-size: .9em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
view.main-function view.branch-funtion > view {
|
||||
border-right: 1px solid rgba($color: #ffffff, $alpha: .1);
|
||||
}
|
||||
}
|
35
miniprogram/pages/Account/MainFunction.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { Modular, Manager } from "../../core/Module";
|
||||
|
||||
interface IMainFunctionItem {
|
||||
|
||||
/**
|
||||
* 显示名称
|
||||
*/
|
||||
displayName: string;
|
||||
|
||||
/**
|
||||
* 图标路径
|
||||
*/
|
||||
iconUrl: string;
|
||||
}
|
||||
|
||||
class MainFunction<M extends Manager> extends Modular<M> {
|
||||
|
||||
public static readonly MainFunctionList: IMainFunctionItem[] = [
|
||||
{ displayName: "账号信息", iconUrl: "UserInfo" },
|
||||
{ displayName: "课表缓存", iconUrl: "DateList" },
|
||||
{ displayName: "功能定制", iconUrl: "Customer" },
|
||||
{ displayName: "更多设置", iconUrl: "Settings" }
|
||||
];
|
||||
|
||||
public data? = {
|
||||
mainFunctionList: MainFunction.MainFunctionList
|
||||
}
|
||||
|
||||
public override onLoad() {
|
||||
// Do something
|
||||
}
|
||||
}
|
||||
|
||||
export { MainFunction };
|
||||
export default MainFunction;
|
26
miniprogram/pages/Account/TestLayerA.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { Modular, Manager } from "../../core/Module";
|
||||
|
||||
type IUserCardEvent = {
|
||||
|
||||
/**
|
||||
* 主题更换按钮点击事件
|
||||
*/
|
||||
click: void;
|
||||
}
|
||||
|
||||
class TestLayerA<M extends Manager> extends Modular<M, {}, IUserCardEvent> {
|
||||
|
||||
public override onLoad() {
|
||||
this.setFunc(this.handleClick, "click");
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹窗点击时
|
||||
*/
|
||||
private handleClick() {
|
||||
this.emit("click");
|
||||
}
|
||||
}
|
||||
|
||||
export { TestLayerA };
|
||||
export default TestLayerA;
|
92
miniprogram/pages/Account/UserCard.scss
Normal file
@ -0,0 +1,92 @@
|
||||
@import "../../app.scss";
|
||||
|
||||
// 用户卡片
|
||||
view.user-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
|
||||
view.avatar {
|
||||
flex-basis: 80px;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 1000px;
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
view.info {
|
||||
flex-grow: 1;
|
||||
padding-left: 20px;
|
||||
max-width: calc(100% - 80px - 20px);
|
||||
|
||||
view.theme {
|
||||
width: 100%;
|
||||
padding: 20px 0 10px 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
view {
|
||||
width: 23px;
|
||||
height: 23px;
|
||||
padding: 20px;
|
||||
margin: -20px;
|
||||
border-radius: 20px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
view.nick {
|
||||
margin-bottom: 6px;
|
||||
word-break: keep-all;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
// 学生信息
|
||||
view.student {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
view.certified {
|
||||
color: $theme-color-blue;
|
||||
border: 1px solid $theme-color-blue;
|
||||
border-radius: 4px;
|
||||
margin-left: .3em;
|
||||
font-size: .85em;
|
||||
height: 1.2em;
|
||||
padding: 0 2px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
image.text-icon {
|
||||
margin-left: .25em;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
view.student-id {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
view.school {
|
||||
text-align: right;
|
||||
padding: 10px 0 20px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
view.container view.user-card view.avatar{
|
||||
filter: brightness(.8);
|
||||
}
|
||||
}
|
26
miniprogram/pages/Account/UserCard.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { Modular, Manager } from "../../core/Module";
|
||||
|
||||
type IUserCardEvent = {
|
||||
|
||||
/**
|
||||
* 主题更换按钮点击事件
|
||||
*/
|
||||
clickChangeTheme: void;
|
||||
}
|
||||
|
||||
class UserCard<M extends Manager> extends Modular<M, {}, IUserCardEvent> {
|
||||
|
||||
public override onLoad() {
|
||||
this.setFunc(this.handleChangeTheme, "changeTheme");
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理主题更换
|
||||
*/
|
||||
private handleChangeTheme() {
|
||||
this.emit("clickChangeTheme");
|
||||
}
|
||||
}
|
||||
|
||||
export { UserCard };
|
||||
export default UserCard;
|
@ -1 +0,0 @@
|
||||
/* pages/Information/Information.wxss */
|
120
miniprogram/pages/Timetable/StatusBar.scss
Normal file
@ -0,0 +1,120 @@
|
||||
@import "../../app.scss";
|
||||
|
||||
$status-bar-left-top-icon-width: 30px;
|
||||
$status-bar-middle-icon-width: 15px;
|
||||
|
||||
view.status-bar {
|
||||
top: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
position: fixed;
|
||||
justify-content: space-between;
|
||||
background-color: $theme-color-light-layout;
|
||||
|
||||
view.select {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
padding-left: 18px;
|
||||
|
||||
image {
|
||||
width: $status-bar-left-top-icon-width;
|
||||
height: $status-bar-left-top-icon-width;
|
||||
filter: $black-filter;
|
||||
}
|
||||
|
||||
view.semester {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
padding-left: 5px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
view.semester-title {
|
||||
@extend %status-bar-title;
|
||||
font-size: .9em;
|
||||
line-height: .9em;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
view.semester-intro {
|
||||
@extend %status-bar-subtitle;
|
||||
font-size: .9em;
|
||||
line-height: .9em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
view.capsule-holder {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
view.content {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
image {
|
||||
width: $status-bar-middle-icon-width;
|
||||
height: $status-bar-middle-icon-width;
|
||||
filter: $black-filter;
|
||||
}
|
||||
|
||||
view.week {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
height: 100%;
|
||||
|
||||
view.week-title {
|
||||
@extend %status-bar-title;
|
||||
font-weight: 600;
|
||||
font-size: 1.15em;
|
||||
line-height: 1.15em;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
view.week-intro {
|
||||
@extend %status-bar-subtitle;
|
||||
font-size: .85em;
|
||||
line-height: .85em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
view.status-bar-blank {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
%status-bar-title {
|
||||
color: $theme-color-light-title;
|
||||
}
|
||||
|
||||
%status-bar-subtitle {
|
||||
color: $theme-color-light-text;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark){
|
||||
|
||||
%status-bar-title {
|
||||
color: $theme-color-dark-title;
|
||||
}
|
||||
|
||||
%status-bar-subtitle {
|
||||
color: $theme-color-dark-text;
|
||||
}
|
||||
|
||||
view.status-bar {
|
||||
background-color: $theme-color-dark-layout;
|
||||
|
||||
view.select image {
|
||||
filter: $white-filter;
|
||||
}
|
||||
}
|
||||
}
|
117
miniprogram/pages/Timetable/StatusBar.ts
Normal file
@ -0,0 +1,117 @@
|
||||
import { Modular, Manager, ILifetime } from "../../core/Module";
|
||||
import { Logger, LogLabel, LevelLogLabel, LifeCycleLogLabel, NormalStyle } from "../../core/Logger";
|
||||
|
||||
/**
|
||||
* 在 UI 中显示的数据
|
||||
*/
|
||||
interface IDisplayData {
|
||||
|
||||
/**
|
||||
* 显示内容
|
||||
*/
|
||||
val:string;
|
||||
|
||||
/**
|
||||
* 唯一键值 用来做判断
|
||||
*/
|
||||
key:string;
|
||||
};
|
||||
|
||||
/**
|
||||
* 模组事件
|
||||
*/
|
||||
interface StatusBarEvent {
|
||||
m: IDisplayData
|
||||
};
|
||||
|
||||
/**
|
||||
* 顶部状态栏
|
||||
*/
|
||||
class StatusBar<M extends Manager> extends Modular<M, {}, StatusBarEvent>
|
||||
implements Partial<ILifetime> {
|
||||
|
||||
/**
|
||||
* 导航栏高度补偿
|
||||
*/
|
||||
public static readonly StatusBarHeightExtend:number = 2;
|
||||
|
||||
/**
|
||||
* 页面日志输出标签
|
||||
*/
|
||||
public static readonly StatusBarLabel = new LogLabel(
|
||||
"StatusBar", NormalStyle
|
||||
);
|
||||
|
||||
data = {
|
||||
|
||||
// 导航栏高度
|
||||
barHeight: 65,
|
||||
|
||||
// 状态栏高度
|
||||
barTop: 20,
|
||||
|
||||
// 胶囊占位
|
||||
capsule: 94
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置顶部状态栏高度
|
||||
*/
|
||||
public setHeight() {
|
||||
|
||||
let systemInfo = wx.getSystemInfoSync();
|
||||
let headerPos = wx.getMenuButtonBoundingClientRect();
|
||||
|
||||
//状态栏高度
|
||||
let statusBarHeight = Number(systemInfo.statusBarHeight);
|
||||
|
||||
// 胶囊实际位置,坐标信息不是左上角原点
|
||||
let btnPosI = {
|
||||
|
||||
// 胶囊实际高度
|
||||
height: headerPos.height,
|
||||
width: headerPos.width,
|
||||
|
||||
// 胶囊top - 状态栏高度
|
||||
top: headerPos.top - statusBarHeight,
|
||||
|
||||
// 胶囊bottom - 胶囊height - 状态栏height (胶囊实际bottom 为距离导航栏底部的长度)
|
||||
bottom: headerPos.bottom - headerPos.height - statusBarHeight,
|
||||
|
||||
// 这里不能获取 屏幕宽度,PC端打开小程序会有BUG,要获取窗口高度 - 胶囊right
|
||||
right: systemInfo.windowWidth - headerPos.right
|
||||
}
|
||||
|
||||
// 计算顶部导航栏高度
|
||||
let barHeight = btnPosI.height + btnPosI.top + btnPosI.bottom;
|
||||
|
||||
// 计算胶囊展位
|
||||
let capsule = btnPosI.right + btnPosI.width;
|
||||
|
||||
this.setData({
|
||||
|
||||
// 不知道为什么总是差 4px 距离
|
||||
// 别问为什么 加上就对了
|
||||
barHeight: barHeight + 4 + StatusBar.StatusBarHeightExtend,
|
||||
barTop: statusBarHeight - StatusBar.StatusBarHeightExtend,
|
||||
capsule: capsule
|
||||
});
|
||||
|
||||
Logger.log(`计算并设置 StatusBar 的高度为: ${ barHeight + 4 }px, ` +
|
||||
`状态栏高度: ${ statusBarHeight }px, 胶囊占位: ${ capsule }px`,
|
||||
LevelLogLabel.InfoLabel, StatusBar.StatusBarLabel);
|
||||
|
||||
}
|
||||
|
||||
public onLoad() {
|
||||
|
||||
Logger.log("StatusBar 模块加载...",
|
||||
LevelLogLabel.InfoLabel, LifeCycleLogLabel.OnLoadLabel, StatusBar.StatusBarLabel);
|
||||
|
||||
this.setHeight();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default StatusBar;
|
||||
export { StatusBar };
|
44
miniprogram/pages/Timetable/TestCore.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import { Modular, Manager, ILifetime } from "../../core/Module";
|
||||
import { Login } from "../../api/Login";
|
||||
import { Schedlue } from "../../api/Schedule"
|
||||
import { Storage } from "../../core/Storage";
|
||||
|
||||
/**
|
||||
* 顶部状态栏
|
||||
*/
|
||||
class TestCore<M extends Manager> extends Modular<M>
|
||||
implements Partial<ILifetime> {
|
||||
|
||||
public override onLoad() {
|
||||
|
||||
let s = new Storage("test", {
|
||||
a: new Date(),
|
||||
be: 2
|
||||
});
|
||||
|
||||
let s2 = new Storage("test", {
|
||||
be: 1,
|
||||
aa: "abc"
|
||||
});
|
||||
|
||||
s2.set("be", 4);
|
||||
|
||||
console.log(s, s2);
|
||||
|
||||
setTimeout(() => {
|
||||
s.set("be", 12);
|
||||
}, 1000)
|
||||
|
||||
// new Login().param({studentId: "2017060129", password: ""})
|
||||
// .request().wait({
|
||||
// ok: (w) => {console.log("ok", w)},
|
||||
// no: (w) => {console.log("no", w)},
|
||||
// done: (w) => {console.log("done", w)}
|
||||
// });
|
||||
// new Schedlue().param({cookie:"C729D1AB1B17077485ACCD9279135C22",semester:"2020-2021-2"})
|
||||
// .request()
|
||||
}
|
||||
}
|
||||
|
||||
export default TestCore;
|
||||
export { TestCore };
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
"usingComponents": {},
|
||||
"navigationStyle": "custom"
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
@import "./StatusBar.scss"
|
||||
|
@ -1,66 +1,22 @@
|
||||
// pages/Timetable/Timetable.ts
|
||||
Page({
|
||||
import { Manager} from "../../core/Module";
|
||||
import { StatusBar } from "./StatusBar";
|
||||
import { TestCore } from "./TestCore";
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
/**
|
||||
* 此页面使用 Manager 进行模块化管理
|
||||
* 若要添加先功能请先定义 Modular 并添加至 Manager
|
||||
*/
|
||||
data: {
|
||||
(async () => {
|
||||
|
||||
},
|
||||
// 初始化页面
|
||||
const { manager, query } = await Manager.PageAsync();
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {
|
||||
// 添加 StatusBar Modular
|
||||
manager.addModule(StatusBar, "statusBar");
|
||||
|
||||
},
|
||||
// 添加 TestCore Modular
|
||||
manager.addModule(TestCore, "testCore");
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
// 初始化全部 Modular
|
||||
await manager.loadAllModule(query);
|
||||
})()
|
@ -1 +1,30 @@
|
||||
<text>pages/Timetable/Timetable.wxml</text>
|
||||
|
||||
<!-- 顶部状态栏 -->
|
||||
<view class="status-bar" style="height:{{ statusBar$barHeight }}px; padding-top:{{ statusBar$barTop }}px;">
|
||||
|
||||
<!-- 学期选择 -->
|
||||
<view class="select">
|
||||
<image src="/image/ui/last_semester.svg"/>
|
||||
<view class="semester">
|
||||
<view class="semester-title">大四-上</view>
|
||||
<view class="semester-intro">2021-2022</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 周选择 -->
|
||||
<view class="content">
|
||||
<view class="week">
|
||||
<view class="week-title">第1周</view>
|
||||
<view class="week-intro">双击返回本周</view>
|
||||
</view>
|
||||
<image src="/image/ui/selectArror.svg"/>
|
||||
</view>
|
||||
|
||||
<!-- 胶囊占位 -->
|
||||
<view class="capsule-holder" style="width: {{ statusBar$capsule }}px"></view>
|
||||
</view>
|
||||
|
||||
<!-- 状态栏占位 -->
|
||||
<view class="status-bar-blank" style="height: {{ statusBar$barHeight + statusBar$barTop }}px"></view>
|
||||
|
||||
<!-- <text>afdff</text> -->
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"light": {
|
||||
"navigationBarBackgroundColor": "#f6f6f6",
|
||||
"navigationBarBackgroundColor": "#f8f8f8",
|
||||
"navigationBarTextStyle": "black",
|
||||
"backgroundColor": "#f4f0f1",
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
},
|
||||
|
||||
"dark": {
|
||||
"navigationBarBackgroundColor": "#191919",
|
||||
"navigationBarBackgroundColor": "#1f1f1f",
|
||||
"navigationBarTextStyle": "white",
|
||||
"backgroundColor": "#1f1f1f",
|
||||
"backgroundColor": "#191919",
|
||||
|
||||
"tabBarColor": "#666666",
|
||||
"tabBarImage0": "image/navBar/0_dark.png",
|
||||
|
@ -1,43 +0,0 @@
|
||||
import {LogLabel, LogStyle} from "./Logger";
|
||||
|
||||
// 成功
|
||||
export const SuccessLabel = new LogLabel(
|
||||
"SUCCESS", new LogStyle().setColor("#FFFFFF", "#EE113D").setBorder("5px")
|
||||
);
|
||||
|
||||
// 失败
|
||||
export const FailedLabel = new LogLabel(
|
||||
"SUCCESS", new LogStyle().setColor("#FFFFFF", "#33ff66").setBorder("3px")
|
||||
);
|
||||
|
||||
|
||||
|
||||
// 致命
|
||||
export const FatalLabel = new LogLabel(
|
||||
"FATAL", new LogStyle().setColor("#FFFFFF", "#FF00CC").setBorder("3px")
|
||||
);
|
||||
|
||||
// 错误
|
||||
export const ErrorLabel = new LogLabel(
|
||||
"ERROR", new LogStyle().setColor("#FFFFFF", "#FF0000").setBorder("3px")
|
||||
);
|
||||
|
||||
// 警告
|
||||
export const WarnLabel = new LogLabel(
|
||||
"WARN", new LogStyle().setColor("#FFFFFF", "#FF9900").setBorder("3px")
|
||||
);
|
||||
|
||||
// 消息
|
||||
export const InfoLabel = new LogLabel(
|
||||
"INFO", new LogStyle().setColor("#FFFFFF", "#99FF00").setBorder("3px")
|
||||
);
|
||||
|
||||
// 调试
|
||||
export const DebugLabel = new LogLabel(
|
||||
"DEBUG", new LogStyle().setColor("#FFFFFF", "#00FF99").setBorder("3px")
|
||||
);
|
||||
|
||||
// 追踪
|
||||
export const TraceLabel = new LogLabel(
|
||||
"TRACE", new LogStyle().setColor("#FFFFFF", "#00CCFF").setBorder("3px")
|
||||
);
|
@ -1,391 +0,0 @@
|
||||
import {LOGGER_CONSOLE, LOGGER_FILTER} from "./Config";
|
||||
|
||||
/**
|
||||
* 调试输出样式
|
||||
*/
|
||||
class LogStyle {
|
||||
|
||||
/**
|
||||
* 日志文字颜色
|
||||
*/
|
||||
private color:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志背景颜色
|
||||
*/
|
||||
private backgroundColor:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字粗细
|
||||
*/
|
||||
private weight:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字大小
|
||||
*/
|
||||
private size:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字字体
|
||||
*/
|
||||
private family:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字圆角
|
||||
*/
|
||||
private borderRadius:string | undefined;
|
||||
|
||||
/**
|
||||
* 日志文字边框
|
||||
*/
|
||||
private border:string | undefined;
|
||||
|
||||
/**
|
||||
* 设置颜色
|
||||
* @param color 日志文字颜色
|
||||
* @param backgroundColor 日志背景颜色
|
||||
*/
|
||||
public setColor(color:string, backgroundColor?:string):LogStyle {
|
||||
this.color = color;
|
||||
this.backgroundColor = backgroundColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置边框
|
||||
* @param borderRadius 日志文字圆角
|
||||
* @param border 日志文字边框
|
||||
*/
|
||||
public setBorder(borderRadius:string, border?:string):LogStyle {
|
||||
this.borderRadius = borderRadius;
|
||||
this.border = border;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置文字
|
||||
* @param weight 日志文字粗细
|
||||
* @param family 日志文字字体
|
||||
*/
|
||||
public setFont(weight:string, family:string):LogStyle {
|
||||
this.weight = weight;
|
||||
this.family = family;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置文字大小
|
||||
* @param size 日志文字大小
|
||||
*/
|
||||
public setSize(size:string):LogStyle {
|
||||
this.size = size;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符化转义样式
|
||||
*/
|
||||
public stringify():string {
|
||||
let stringArr:string[] = [];
|
||||
|
||||
this.color && stringArr.push(`color:${ this.color }`);
|
||||
this.backgroundColor && stringArr.push(`background-color:${ this.backgroundColor }`);
|
||||
this.weight && stringArr.push(`font-weight:${ this.weight }`);
|
||||
this.family && stringArr.push(`font-family:${ this.family }`);
|
||||
this.borderRadius && stringArr.push(`border-radius:${ this.borderRadius }`);
|
||||
this.border && stringArr.push(`border:${ this.border }`);
|
||||
this.size && stringArr.push(`font-size:${ this.size }`);
|
||||
|
||||
stringArr.push(`margin-bottom:5px`);
|
||||
|
||||
return stringArr.join(";");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志标签
|
||||
*/
|
||||
class LogLabel {
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
* 用于标识这个类别
|
||||
*/
|
||||
public key:string;
|
||||
|
||||
/**
|
||||
* 文字样式
|
||||
*/
|
||||
public style:LogStyle;
|
||||
|
||||
/**
|
||||
* @param key 关键字
|
||||
* @param style 文字样式
|
||||
*/
|
||||
constructor(key:string, style:LogStyle) {
|
||||
this.key = key;
|
||||
this.style = style;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得 Logger 输出使用的内容
|
||||
*/
|
||||
public getLoggerOutput():string {
|
||||
return `%c ${ this.key } `;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得 Text 输出内容
|
||||
*/
|
||||
public getTextOutput():string {
|
||||
return `[${ this.key }]`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得 style 格式化
|
||||
*/
|
||||
public getStyleOutput():string {
|
||||
return this.style.stringify();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 栈信息
|
||||
*/
|
||||
class StackInfo {
|
||||
|
||||
/**
|
||||
* 函数名
|
||||
*/
|
||||
public functionName:string | undefined;
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
public fileName:string | undefined;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
public url:string | undefined;
|
||||
|
||||
public setInfo(functionName:string, fileName:string, url:string):StackInfo {
|
||||
this.functionName = functionName;
|
||||
this.fileName = fileName;
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取函数调用栈列表
|
||||
*/
|
||||
static getCallStack():StackInfo[] {
|
||||
|
||||
// 获取堆栈信息
|
||||
let stack:string | undefined = new Error().stack;
|
||||
|
||||
if (stack === void 0) return [];
|
||||
|
||||
// 去除 Error
|
||||
stack = stack.replace(/^(Error)\s/, "");
|
||||
|
||||
// 获取堆栈信息
|
||||
let stackList:string[] = stack.split(/\n/);
|
||||
|
||||
let callStack:StackInfo[] = [];
|
||||
|
||||
for(let i = 0; i < stackList.length; i++) {
|
||||
|
||||
let matcher = stackList[i].match(/^\s+at\s+(.+)\s(\(.+\))/);
|
||||
if (matcher === null || matcher.length < 3) continue;
|
||||
|
||||
let fileName = matcher[2].match(/.+\/(.+\..+:\d+:\d+)\)/);
|
||||
if (fileName === null || matcher.length < 2) continue;
|
||||
|
||||
callStack.push(new StackInfo().setInfo(
|
||||
matcher[1], fileName[1], matcher[2]
|
||||
))
|
||||
}
|
||||
|
||||
return callStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排除的
|
||||
*/
|
||||
static readonly excludeFile:RegExp = /^Logger\.js:\d+:\d+/;
|
||||
|
||||
/**
|
||||
* 获取第一个调用栈
|
||||
*/
|
||||
static getFirstStack():StackInfo | undefined {
|
||||
|
||||
let callStack = this.getCallStack();
|
||||
|
||||
for(let i = 0; i < callStack.length; i++) {
|
||||
|
||||
if(!callStack[i].fileName) continue;
|
||||
|
||||
if(!StackInfo.excludeFile.test(callStack[i].fileName ?? "")) {
|
||||
return callStack[i];
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 多重内容捆绑
|
||||
* 用于 log 输出
|
||||
*/
|
||||
class MultipleLogContent {
|
||||
|
||||
/**
|
||||
* 输出内容
|
||||
*/
|
||||
private content:any[];
|
||||
|
||||
/**
|
||||
* @param content 输出内容
|
||||
*/
|
||||
public constructor(...content:any[]) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取内容
|
||||
*/
|
||||
public getContent():any[] {
|
||||
return this.content;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化日志输出
|
||||
*/
|
||||
class Logger {
|
||||
|
||||
/**
|
||||
* 堆栈路径样式
|
||||
*/
|
||||
static readonly pathStyle:LogStyle = new LogStyle().setColor("#CCCCCC");
|
||||
|
||||
/**
|
||||
* 标签过滤
|
||||
*/
|
||||
static filterLog(filter:Array<RegExp | string>, labels:LogLabel[]):boolean {
|
||||
|
||||
let passNum:number = 0;
|
||||
|
||||
for(let i = 0; i < filter.length; i++) {
|
||||
|
||||
let pass:boolean = false;
|
||||
for(let j = 0; j < labels.length; j++) {
|
||||
|
||||
if(filter[i] instanceof RegExp) {
|
||||
pass = (filter[i] as RegExp).test(labels[j].key)
|
||||
} else {
|
||||
pass = (filter[i] as String) === labels[j].key;
|
||||
}
|
||||
|
||||
if(pass) break;
|
||||
}
|
||||
|
||||
if(pass) passNum ++;
|
||||
}
|
||||
|
||||
return passNum === filter.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测是否应该输出
|
||||
* @param labels 使用标签
|
||||
*/
|
||||
static testLog(...labels:LogLabel[]):boolean {
|
||||
|
||||
if(!LOGGER_CONSOLE) return false;
|
||||
|
||||
let isLogging = false;
|
||||
for(let i = 0; i < LOGGER_FILTER.length; i++) {
|
||||
|
||||
// 判断是否进行输出
|
||||
isLogging = Logger.filterLog(LOGGER_FILTER[i], labels);
|
||||
|
||||
if(isLogging) break;
|
||||
}
|
||||
|
||||
return isLogging;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param styledLabel calcStyle的处理结果
|
||||
*/
|
||||
static addFileNameLabel():LogLabel {
|
||||
|
||||
// 获得调用堆栈
|
||||
let stack = StackInfo.getFirstStack();
|
||||
|
||||
return new LogLabel(stack?.fileName ?? "", Logger.pathStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收集计算样式
|
||||
* @param labels 使用标签
|
||||
*/
|
||||
static calcStyle(...labels:LogLabel[]):[string[], string[]] {
|
||||
|
||||
let consoleLabels:string[] = [];
|
||||
let consoleStyles:string[] = [];
|
||||
|
||||
// 放置标签
|
||||
for(let i = 0; i < labels.length; i++) {
|
||||
consoleLabels.push(labels[i].getLoggerOutput());
|
||||
|
||||
if (i !== ( labels.length - 1))
|
||||
consoleLabels.push("%c ");
|
||||
|
||||
consoleStyles.push(labels[i].getStyleOutput());
|
||||
|
||||
if (i !== ( labels.length - 1))
|
||||
consoleStyles.push("");
|
||||
}
|
||||
|
||||
return [consoleLabels, consoleStyles];
|
||||
}
|
||||
|
||||
/**
|
||||
* 调试输出
|
||||
* @param content 输出内容
|
||||
* @param label 使用标签
|
||||
*/
|
||||
static log<T>(content:T, ...labels:LogLabel[]):T {
|
||||
|
||||
let fileNameLabel = Logger.addFileNameLabel();
|
||||
|
||||
if(!Logger.testLog(...labels, fileNameLabel)) return content;
|
||||
|
||||
let styledLabel = Logger.calcStyle(...labels);
|
||||
|
||||
console.log(
|
||||
styledLabel[0].join("") + fileNameLabel.getLoggerOutput(),
|
||||
...[...styledLabel[1], fileNameLabel.getStyleOutput()],
|
||||
content
|
||||
);
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多重调试输出
|
||||
* @param labels 输出内容
|
||||
* @param content 使用标签
|
||||
*/
|
||||
static logM<T>(labels:LogLabel[], ...content:T[]):T[] {
|
||||
return Logger.log<T[]>(content, ...labels);
|
||||
}
|
||||
}
|
||||
|
||||
export default Logger;
|
||||
export {Logger, LogStyle, LogLabel}
|
@ -1,11 +1,12 @@
|
||||
{
|
||||
"description": "项目配置文件",
|
||||
"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||
"packOptions": {
|
||||
"ignore": []
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"miniprogramRoot": "miniprogram/",
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.21.0",
|
||||
"libVersion": "2.16.1",
|
||||
"projectname": "mini-dlpu-v3",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
@ -35,7 +36,7 @@
|
||||
"outputPath": ""
|
||||
},
|
||||
"enableEngineNative": false,
|
||||
"useIsolateContext": true,
|
||||
"useIsolateContext": false,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"packNpmManually": false,
|
||||
"packNpmRelationList": [],
|
||||
@ -46,10 +47,16 @@
|
||||
"useCompilerPlugins": [
|
||||
"typescript",
|
||||
"sass"
|
||||
]
|
||||
],
|
||||
"useStaticServer": true
|
||||
},
|
||||
"simulatorType": "wechat",
|
||||
"simulatorPluginLibVersion": {},
|
||||
"appid": "wx7d809f5e8955843d",
|
||||
"condition": {}
|
||||
"condition": {},
|
||||
"srcMiniprogramRoot": "miniprogram/",
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 2
|
||||
}
|
||||
}
|
19
project.private.config.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "Account",
|
||||
"pathName": "pages/Account/Account",
|
||||
"query": "",
|
||||
"scene": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"projectname": "mini-dlpu-v3",
|
||||
"setting": {
|
||||
"compileHotReLoad": true
|
||||
},
|
||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
|
||||
}
|
@ -19,7 +19,11 @@
|
||||
"lib": ["ES2020"],
|
||||
"typeRoots": [
|
||||
"./typings"
|
||||
]
|
||||
],
|
||||
"baseUrl": "./miniprogram/",
|
||||
"paths": {
|
||||
"@logger": ["logger/"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./**/*.ts"
|
||||
|