2026.1.27修改

This commit is contained in:
ryx 2026-01-27 00:52:00 +08:00
commit 45d9d9fd1c
695 changed files with 153231 additions and 0 deletions

18
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ciyon main",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}",
"env": {},
"args": [],
"showLog": true
}
]
}

4
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"editor.unicodeHighlight.includeComments": false,
"editor.unicodeHighlight.includeStrings": false
}

18
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "刷新CDN缓存",
"type": "shell",
"command": "node ../../nodejs/refreshcdn/refreshcdn.js ${workspaceFolder}",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always"
},
"problemMatcher": []
}
]
}

117
LICENSE Normal file
View File

@ -0,0 +1,117 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) 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 this service 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 make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. 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.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of the 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 a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 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.
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 convey 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 an idea of what it does. Copyright (C) yyyy 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision 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, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice

129
README.md Normal file
View File

@ -0,0 +1,129 @@
# Ciyon - 众产全栈开发框架
## 技术特点
### AI辅助决策
 基于Function Call和JSON的AI能力实现了定期AI决策及渐进式主动决策执行能力。
 利用置信度缓解AI幻觉难题基于量化函数可实现专用AI能力。
### Web3D地球
 基于Cesium与ThreeJS实现了三维场景可视化配置和开发JS独立组件。
 支持多种地图源、地形图、GLB模型、光照、无人机建模等。
### 原生重构组件
 内生发展,尽量不引用第三方库,拆解掌握原理后重写。
 PC端组件20+移动端组件60+,不断扩展中。
### PHP+Golang
 PHP在项目原型验证阶段快速开发上线。
 Golang作为服务器集群降成本的高并发优化。
### 免编译模式
 尽量用免编译模式开发,降低老旧代码维护难度。
 是未来演进的重要研究基础。
### 代码生成器
 支持基于数据表的通用功能的代码生成能力。
 数据表注解定义自动生成代码再利用AI补全微调。
 遵循一定的开发规范能产生90%高质量直接运行代码。
## 软件架构
### 总控端原生JS
 使用原生JS实现一系列的常用函数封装。
 包括websocket、bigscreen、openai、sse、i18n等。
 结合Web3D的数据大屏驾驶舱示例代码实现。
### 总控端PHP
 原生实现独立开发框架,输入安全校验、唯一访问入口。
 拆解吸收多种大型框架源码。本框架结构简单,可读性强。
### 总控端Golang
 原生实现独立开发框架未实现函数自动转至PHP执行。
 支持mock、连接池、自更新等。
### 移动端Vue3
 在Vue3基础上极简封装各类常用组件。
 统一封装常见函数,页面全面可自定义,多语言。
 提供路由工具,一键生成路由代码。
### Web站原生JS库
 让Web呈现扁平的价值传达减少酷炫效果对阅读的干扰整站SEO可完整解析。
### Web站缓存机制
 自定义的动态页面缓存模式结合各类CDN回源策略减轻对源服务器请求。
## 软件工程
### 项目可行性验证阶段
 用原生JS+PHP+微信小程序开发。
 在数周内完成项目快速开发。
 低成本投入市场验证迭代。
### 项目快速发展阶段
 Web服务器集群规模或数据库服务器连接数承压后
 用Golang重写高并发请求的函数接口逐步替代。
### 项目稳定运营阶段
 Golang将业务侧数据全部重写完全替换PHP低效代码。
 根据业务特点拆分,扩展成多地多中心异构拓扑。
## 未来演进
### 全量区块链
 创新的实现区块链底层架构,将上传的文件图片视频资源、数据库资源全部完整上链。
 非简单的hash上链。
### 无后端时代
 底层研发基于海量矿机的多中心(无中心)异构拓扑,
 实现统一的JS访问入口实现区块链级分布式事务。
### 大前端时代
 从区块链上下载前端包后,加载到用户端(PC/手机/XR眼镜等),任何交互操作均直接请求区块链接口。
### 代码可审计
 区块链基于共识算法开放协议,天然可审计。
 前端代码不允许混淆和编译。
 用户端可随时调阅源码分析。
# 在线演示
https://ciyon.ciy.cn/
https://ciyon.ciy.cn/admin/
# 环境部署建议
安装Nginx
统一处理80/443端口
安装MariaDB数据库
开启慢查询日志
PHP需配置PHP-fpm建议用PHP8
Golang虽然可以独立运行但建议Nginx转发
IDE开发工具
PC端推荐用VSCode、Cursor
移动端推荐用Uniapp、VSCode

3655
c5_ciyon.ciy_arearpc.sql Normal file

File diff suppressed because it is too large Load Diff

2096
c5_ciyon.sql Normal file

File diff suppressed because it is too large Load Diff

1921
c5_labsci.sql Normal file

File diff suppressed because it is too large Load Diff

0
cert/.gitkeep Normal file
View File

View File

@ -0,0 +1,32 @@
{
// launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version" : "0.0",
"configurations" : [
{
"app-plus" : {
"launchtype" : "local"
},
"default" : {
"launchtype" : "local"
},
"mp-weixin" : {
"launchtype" : "local"
},
"type" : "uniCloud"
},
{
"openVueDevtools" : false,
"type" : "uni-app:app-ios"
},
{
"openVueDevtools" : false,
"playground" : "standard",
"type" : "uni-app:app-android"
},
{
"openVueDevtools" : false,
"type" : "uni-app:h5"
}
]
}

266
fapp/ciyon_ap/App.vue Normal file
View File

@ -0,0 +1,266 @@
<script>
export default {
globalData: {},
onLaunch: function(lopn) {
var bggray1 = '#dfdfdf';
var bggray2 = '#bbbbbb';
var bgsel1 = '#ffdc72';
var bgsel2 = '#e65411';
var app = this;
app.globalData.scrollcbs = {};
app.globalData.launchopn = lopn;
console.log('launchopn', lopn);
app.launch();
app.globalData.tabbarArr = [];
var svg = '<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M10,515c0,277,225,503,503,503s503-225,503-503l0,0c0-277-225-503-503-503S9,238,10,515L10,515z" fill="{{bg2}}"></path><path d="M777,322L547,178c-28-18-64-18-91,0L226,322c-25,16-40,43-40,73v263c0,76,61,137,137,137h61V633l0,0c0-66,53-119,119-119l0,0c66,0,119,53,119,119v162h61l0,0c76,0,137-61,137-137V395c-1-29-17-56-42-73H777z" fill="{{bg1}}"></path></svg>';
app.globalData.tabbarArr.push({
name: 'tabbar.index',
fullpath: '/pages/main/index',
selecticon: svg.replaceAll(/{{bg1}}/g, bgsel1).replaceAll(/{{bg2}}/g, bgsel2),
icon: svg.replaceAll(/{{bg1}}/g, bggray1).replaceAll(/{{bg2}}/g, bggray2)
});
// var svg = '<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M969,956L913,810c51-81,107-209,103-313C1008,230,789,15,522,10C237,5,5,237,9,522c4,274,223,494,497,494c69,0,208-38,265-75L932,997C954,998,972,979,969,956L969,956z" fill="{{bg2}}"></path><path d="M715,299l-22,133c-3,16,3,32,15,43l99,94c20,19,20,49,1,69c-7,7-17,12-28,15l-134,21c-16,3-30,12-37,27l-59,122c-12,25-42,35-65,22c-10-5-17-12-22-22l-62-121c-7-15-21-25-37-27l-134-19c-27-4-46-28-42-55c1-11,6-21,14-28l96-96c11-11,17-27,14-43l-23-134c-5-27,14-52,39-57c11-1,22,0,31,5l121,63c15,7,32,7,46,0l119-64c23-12,54-4,67,20C715,277,716,288,715,299z" fill="{{bg1}}"></path></svg>';
// app.globalData.tabbarArr.push({
// name: 'tabbar.zh',
// fullpath: '/pages/expo',
// selecticon: svg.replaceAll(/{{bg1}}/g, bgsel1).replaceAll(/{{bg2}}/g, bgsel2),
// icon: svg.replaceAll(/{{bg1}}/g, bggray1).replaceAll(/{{bg2}}/g, bggray2)
// });
// var svg = '<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M788,950h-551c-80,0-144-64-144-144V281h839v524C933,886,869,950,788,950L788,950z" fill="{{bg2}}"></path><path d="M685,842H352c-33,0-60-27-60-60s27-60,60-60h333c33,0,60,27,60,60S718,842,685,842z M946,322H80c-41,0-75-33-75-75V136c0-41,33-75,75-75h866c41,0,75,33,75,75v111C1021,288,988,322,946,322z" fill="{{bg1}}"></path></svg>';
// app.globalData.tabbarArr.push({
// name: 'tabbar.sq',
// fullpath: '/pages/socg',
// selecticon: svg.replaceAll(/{{bg1}}/g, bgsel1).replaceAll(/{{bg2}}/g, bgsel2),
// icon: svg.replaceAll(/{{bg1}}/g, bggray1).replaceAll(/{{bg2}}/g, bggray2)
// });
// var svg = '<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M207,110h614c109,0,197,88,197,197v416c0,109-88,197-197,197H207c-109,0-197-88-197-197V308C9,198,97,110,207,110z" fill="{{bg2}}"></path><path d="M865,819H118c-10,0-19-9-19-19c0-3,1-7,2-10l26-35c3-6,10-9,17-9h748c10,0,19,9,19,19c0,3-1,7-2,10l-26,35C878,815,872,819,865,819z M451,285c0-8-6-14-14-14h-246c-8,0-14,6-14,14v246c0,8,6,14,14,14h246c8,0,14-6,14-14V285z M909,503c0-8-6-14-14-14H562c-8,0-14,6-14,14v25c0,8,6,14,14,14h333c8,0,14-6,14-14V503z" fill="{{bg1}}"></path></svg>';
// app.globalData.tabbarArr.push({
// name: 'tabbar.cd',
// fullpath: '/pages/card',
// selecticon: svg.replaceAll(/{{bg1}}/g, bgsel1).replaceAll(/{{bg2}}/g, bgsel2),
// icon: svg.replaceAll(/{{bg1}}/g, bggray1).replaceAll(/{{bg2}}/g, bggray2)
// });
// SVG{{bg1}}/{{bg2}}
var svg = '<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M512.3 79.6c-243 0-440 165.9-440 370.5 0 122.6 70.7 231.3 179.7 298.8 12.2 7.5 19.1 21.3 18.1 35.6L259 939c-0.7 9.2 8.8 15.8 17.3 12L543 828.9c16.1-7.4 33.3-11.8 50.8-14.6 204.1-32.2 358.5-183 358.5-364.2 0-204.7-197-370.5-440-370.5z" fill="{{bg2}}"></path><path d="M256.2 511.1c-35.3 0-64-28.7-64-64s28.7-64 64-64 64 28.7 64 64-28.6 64-64 64z m256.1 0c-35.3 0-64-28.7-64-64s28.7-64 64-64 64 28.7 64 64-28.7 64-64 64z m256 3.4c-35.3 0-64-28.7-64-64s28.7-64 64-64 64 28.7 64 64-28.6 64-64 64z" fill="{{bg1}}"></path></svg>';
app.globalData.tabbarArr.push({
name: 'tabbar.message',
fullpath: '/pages/main/message',
selecticon: svg.replaceAll(/{{bg1}}/g, bgsel1).replaceAll(/{{bg2}}/g, bgsel2),
icon: svg.replaceAll(/{{bg1}}/g, bggray1).replaceAll(/{{bg2}}/g, bggray2)
});
var svg = '<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M706,460c64-38,107-104,107-179c0-118-106-213-237-213c-131,0-237,95-237,213c0,75,43,141,107,179c-181,51-311,206-311,385c0,39,35,70,78,70H938c43,0,78-32,78-70v-5C1017,661,886,511,706,460L706,460z" fill="{{bg1}}"/><path d="M580,472c64-42,107-115,107-197c0-131-106-237-237-237c-131,0-237,106-237,237c0,83,43,155,107,199c-181,57-311,228-311,427c0,43,14,76,57,76l745,1c43,0,78-35,78-78v-6C891,696,761,528,580,472L580,472z" fill="{{bg2}}"/></svg>';
app.globalData.tabbarArr.push({
name: 'tabbar.me',
fullpath: '/pages/main/me',
selecticon: svg.replaceAll(/{{bg1}}/g, bgsel1).replaceAll(/{{bg2}}/g, bgsel2),
icon: svg.replaceAll(/{{bg1}}/g, bggray1).replaceAll(/{{bg2}}/g, bggray2)
});
app.globalData.errdata = app.getstorage('err');
if (!(app.globalData.errdata instanceof Array))
app.globalData.errdata = [];
app.globalData.mqfunc = [];
app.globalData.srv = 't';
app.globalData.jsnajax = 'ambap/';
app.globalData.jsnurl = {};
app.globalData.jsnurl.t = 'https://labsci.local.ciy.cn/';
app.globalData.demourl = 'https://i.qiboc.cn/app.goc'; //
app.globalData.tokenfield = "ciyap";
app.globalData.tokensalt = "ast34h$3";
app.globalData.mainpage = '/pages/main/index';
app.globalData.sharefirstpage = '';// /pages/pub/index';
app.globalData.meid = 0;
app.globalData.dupsec = 60;
app.globalData.storselect = '/';
app.globalData.storlist = {
'/': 'https://labsci.local.ciy.cn/ud/',
'A': 'https://cf5.nyyzsoft.cn/ud/'
};
app.globalData.stortransfer = ['/'];
if (process.env.NODE_ENV === 'development') {
//#ifdef H5
app.globalData.jsnurl.t = 'https://labsci.local.ciy.cn/';
app.globalData.storlist['/'] = 'https://labsci.local.ciy.cn/ud/';
//golang
// app.globalData.jsnurl.t = 'http://ciyonhgo.local.ciy.cn/';
//#endif
}
setInterval(() => {
if (app.globalData._restorage) {
app.callfunc({
func: 'login.restorage',
data: {},
loadhide: true,
}).then(retjson => {
if (retjson.code != 1)
return;
console.log('新字典已刷新', retjson);
var userdata = app.setuserstorage(retjson);
var ps = getCurrentPages();
userdata.g = app.getstorage('g', {});
for (var p = 0; p < ps.length; p++) {
for (var key in userdata) {
//#ifdef MP-WEIXIN
ps[p].$vm[key] = userdata[key];
//#endif
//#ifndef MP-WEIXIN
ps[p][key] = userdata[key];
//#endif
}
}
});
}
app.globalData._restorage = false;
if (app.globalData.errdata.length > 0) {
app.callfunc({
func: 'login.uperr',
data: {
meid: app.getme().id,
err: app.globalData.errdata
},
loadhide: true,
});
app.globalData.errdata = [];
app.removestorage('err');
}
}, 1000);
setInterval(async () => {
if (app.globalData.mqfunc.length > 0) {
console.log(app.globalData.mqfunc);
var ret = await app.callfunc({
func: app.globalData.mqfunc[0].func,
data: app.globalData.mqfunc[0].data,
loadhide: true,
});
var name = app.globalData.mqfunc[0].name;
for (var i = app.globalData.mqfunc.length - 1; i >= 0; i--) {
if (app.globalData.mqfunc[i].name == name) {
app.globalData.mqfunc[i].callback(ret);
app.globalData.mqfunc.splice(i, 1);
}
}
}
}, 200);
setInterval(() => {
getnewnotice();
}, 120000); //2notice
getnewnotice();
//lopn me
function getnewnotice() {
return;
app.callfunc({
func: 'me.notice_new',
showload: false,
success: json => {
app.setTabbar({
'index.detail': {
reddot: false
}
});
}
});
}
//#ifdef MP-WEIXIN
const accountInfo = uni.getAccountInfoSync();
app.globalData._wxappid = accountInfo.miniProgram.appId;
app.globalData._wxenv = accountInfo.miniProgram.envVersion;
app.globalData._version = accountInfo.miniProgram.version;
if (!app.globalData._version)
app.globalData._version = accountInfo.miniProgram.envVersion;
//#endif
// #ifdef APP-PLUS
plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
app.globalData._version = widgetInfo.version;
});
app.appupdate('app');
uni.getPushClientId({
success: (res) => {
console.log('客户端推送标识:',res);
app.globalData._appcid = res.cid;
}
})
uni.onPushMessage((res)=>{
this.alert(JSON.stringify(res));
})
// #endif
var sysinfo = app.globalData._sysinfo;
// #ifdef APP-PLUS
if (sysinfo.model == 'k71v1_64_bsp') {
app.device_rfid = uni.requireNativePlugin("UhfGModule"); // 133/134/135
app.device_rfid_gunkey = 134;
} else if (sysinfo.model == 'k62v1_6c') {
app.device_rfid = uni.requireNativePlugin(
"UhfGModule"); //C61137135136 F1-F4131-134
app.device_rfid_gunkey = 137;
}
console.log('device_rfid', app.device_rfid);
// #endif
// #ifndef H5
app.globalData.dev_bt = {};
//
this.info = uni.getStorageInfoSync();
this.info.kv = {};
this.info.total = 0;
for (var i in this.info.keys) {
var key = this.info.keys[i];
if (key.indexOf('dev_bt_') !== 0)
continue;
var savedev = app.getstorage(key);
var devup = key.substr(7);
console.log('auto', savedev, devup);
if (devup != savedev.devup) {
console.log('蓝牙自动连接设置错误', devup, savedev.devup);
continue;
}
app.connectbt(savedev.devup, savedev.devtype, savedev.id);
}
uni.onBLEConnectionStateChange(res => {
//dev_bt
console.log('statechanged', res);
for (var dup in app.globalData.dev_bt) {
var devbt = app.globalData.dev_bt[dup];
if (devbt.deviceid != res.deviceId)
continue;
devbt.opened = res.connected ? 10 : 9;
if (typeof(devbt.onmsg) == 'function')
devbt.onmsg(res);
if (res.connected)
return;
if (devbt.enableclose)
return;
console.log('re devopen' + devbt.deviceid);
devbt.bt_devopen(devbt.deviceid);
return;
}
});
uni.onBLECharacteristicValueChange(res => {
console.log('onBLECharacteristicValueChange', res);
for (var dup in app.globalData.dev_bt) {
var devbt = app.globalData.dev_bt[dup];
if (devbt.deviceid != res.deviceId)
continue;
var dat = devbt.convertmsg(res);
res.data = dat;
if (typeof(devbt.onmsg) == 'function')
devbt.onmsg(res);
}
});
// #endif
},
onShow: function() {},
onHide: function() {},
methods: {}
}
</script>
<style>
</style>

View File

@ -0,0 +1,272 @@
<template>
<view class="_vocr">
<view>
<view v-if="workstep == 1" class="rel">
<cover-image v-if="maskpng" :src="file_stor(maskpng)" class="abs t0 l0" :style="{opacity:0.8,width: '100%', height: height + 'vw'}"></cover-image>
<camera device-position="back" flash="off" :style="{width: '100%', height: height + 'vw'}"></camera>
</view>
<view v-if="workstep == 2" class="rel">
<image :src="src" :style="{width: '100%', height: height + 'vw',display:'block'}"></image>
<view v-for="txtpo in txtpos" class='abs' @tap="boxclick(txtpo)" :style="{top:txtpo.top,left:txtpo.left,width:txtpo.width,height:txtpo.height,minWidth:'0.7em',minHeight:'0.7em',border:'1px solid ' + bordercolor,borderRadius:'3px'}"></view>
<view v-if="txtpos.length == 0" class='abs b0 r0 _noocr'>无文字</view>
</view>
<view class="flex px2" style="justify-content: space-between;height:3em;">
<view>
<ciy-svgimg v-if="workstep==0" @tap="workstep=1" :src="svg.opencamera" ciystyle="width:2em;height:2em;"></ciy-svgimg>
<ciy-svgimg v-else @tap="workstep=0" :src="svg.closecamera" ciystyle="width:2em;height:2em;"></ciy-svgimg>
</view>
<view>
<button v-if="workstep==1" class="btn lg cc" @tap="ocrnow">拍摄识别</button>
</view>
<view>
<ciy-svgimg v-if="workstep == 2" @tap="workstep=1" :src="svg.recamera" ciystyle="width:2em;height:2em;"></ciy-svgimg>
<view v-else style="width:2em;height:2em;"></view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
emits: ['change', 'textclick'],
props: {
maskpng: {
type: String,
default: ''
},
height: {
type: String,
default: '66'
},
bordercolor: {
type: String,
default: '#00e112'
},
mode: {
type: String,
default: 'text' //idcardnone ocrtext ocr(5)
},
checkidcard: {
type: String,
default: '' //frontback
},
},
data() {
return {
txtpos: [],
src: '',
svg:{
opencamera:'<svg viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg"><path d="M868 288a64 64 0 0 1 101 52l3 303a64 64 0 0 1-103 51l-207-158a64 64 0 0 1 2-103l204-145z" fill="#1296db"></path><path d="M144 192h456a96 96 0 0 1 96 96v417a96 96 0 0 1-96 96H144a96 96 0 0 1-96-96V288a96 96 0 0 1 96-96z" fill="#1296db"></path></svg>',
closecamera:'<svg viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg"><path d="M107 152A32 32 0 1 1 149 104l768 672a32 32 0 0 1-42 48l-768-672z" fill="#1296db"></path><path d="M733 462l-37-52 172-122a64 64 0 0 1 101 52l3 303a64 64 0 0 1-20 47l-44-47-3-303-172 122z m-35-54l36 53c-11 7-24 12-37 12a64 64 0 0 1-64-64V288a32 32 0 0 0-32-32h-206V192h206a96 96 0 0 1 96 96v121c0-0 1-1 2-1zM632 608h64v97a96 96 0 0 1-96 96H144a96 96 0 0 1-96-96V288a96 96 0 0 1 96-96h96v64h-96a32 32 0 0 0-32 32v417a32 32 0 0 0 32 32h456a32 32 0 0 0 32-32V608z" fill="#1296db"></path></svg>',
recamera:'<svg viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg"><path d="M533 175v-62l-228 143 228 143v-107c114 26 200 128 200 249 0 141-116 257-257 257s-257-116-257-257c0-32-26-57-57-57-32 0-57 26-57 57 0 204 167 371 371 371s371-167 371-371c0-185-137-339-314-366z" fill="#1296db"></path></svg>'
},
workstep: 0,
};
},
watch: {},
computed: {},
mounted() {
var vkopn = {};
vkopn.version = 'v1';
vkopn.track = {};
vkopn.track.IDCard = {};
vkopn.track.IDCard.mode = 2;
vkopn.track.OCR = {};
vkopn.track.OCR.mode = 2;
vkopn.gl = this.gl;
this.session = wx.createVKSession(vkopn);
this.session.start(err => {
this.session.on('updateAnchors', this.onanchor);
});
},
unmounted() {
this.session.off('updateAnchors', this.onanchor);
this.session.stop();
this.session.destroy();
},
methods: {
boxclick(po) {
this.$emit('textclick', po);
},
onanchor(anchors) {
if (typeof(this.auchorcb) == 'function')
this.auchorcb(anchors);
},
Step(step) {
this.workstep = step;
},
//
//便
//
//
//
//
//
//
//
//
//+
//
//
//
async runvk(mode, file) {
return new Promise(async (resolve, reject) => {
var _time = setTimeout(() => {
reject('timeout');
}, 5000);
this.auchorcb = anchors => {
clearTimeout(_time);
resolve(anchors);
};
if (mode == 'idcard') {
this.session.detectIDCard({
frameBuffer: file.buffer,
width: file.width,
height: file.height,
getAffineImg: true,
});
} else {
this.session.runOCR({
frameBuffer: file.buffer,
width: file.width,
height: file.height,
});
}
}).catch(e => {
console.error('vk error', e);
return e;
});
},
ocrnow() {
const ctx = wx.createCameraContext();
ctx.takePhoto({
quality: 'high',
success: async (res) => {
this.workstep = 2;
this.txtpos = [];
this.src = res.tempImagePath;
res.buffer = await this.getimgbuffer(res);
var ret = {};
ret.tempimg = res.tempImagePath;
ret.width = res.width;
ret.height = res.height;
if (this.mode == 'idcard') {
var anchors = await this.runvk('idcard', res);
var anchor = anchors[0];
if (anchor.isComplete != 1)
return this.alert('身份证拍摄不完整');
if (this.checkidcard == 'front') {
if (anchor.label != 0)
return this.alert('请拍摄身份证人像面');
if (anchor.orientation != 0)
return this.alert('请朝上放正拍摄身份证');
}
if (this.checkidcard == 'back') {
if (anchor.label != 1)
return this.alert('请拍摄身份证国徽面');
if (anchor.orientation != 0)
return this.alert('请朝上放正拍摄身份证');
}
ret.idcardface = anchor.label; //0 / 1
ret.orientation = anchor.orientation; // 0 1 2 3
const canvas = wx.createOffscreenCanvas({
type: '2d',
width: anchor.affineImgWidth,
height: anchor.affineImgHeight,
});
const context = canvas.getContext('2d');
context.clearRect(0, 0, anchor.affineImgWidth, anchor.affineImgHeight);
context.setTransform(
Number(anchor.affineMat[0]), Number(anchor.affineMat[3]), Number(anchor.affineMat[1]),
Number(anchor.affineMat[4]), Number(anchor.affineMat[2]), Number(anchor.affineMat[5])
);
context.drawImage(this._img, 0, 0, res.width, res.height);
const imageData = context.getImageData(0, 0, anchor.affineImgWidth, anchor.affineImgHeight);
res.buffer = imageData.data.buffer;
res.width = anchor.affineImgWidth;
res.height = anchor.affineImgHeight;
this.src = canvas.toDataURL();
}
ret.txts = [];
ret.txtall = '';
if (this.mode != 'none') { //bug
try {
var anchors = await this.runvk('ocr', res);
ret.anchors = anchors;
for (var i in anchors) {
if (anchors[i].text)
ret.txtall = anchors[i].text;
if (!anchors[i].subtext)
continue;
ret.txts.push(anchors[i].subtext);
var pos = anchors[i].box;
this.txtpos.push({
text: anchors[i].subtext,
alltext: anchors[i].text,
pos: pos,
top: (pos[0].y * 100) + '%',
left: (pos[0].x * 100) + '%',
width: ((pos[1].x - pos[0].x) * 100) + '%',
height: ((pos[2].y - pos[0].y) * 100) + '%',
});
}
} catch (e) {
console.log(e);
//this.toast('');
//this.workstep = 1;
//return;
}
}
this.$emit('change', ret);
}
});
},
async getimgbuffer(file) {
const canvas = wx.createOffscreenCanvas({
type: '2d',
width: file.width,
height: file.height,
});
const context = canvas.getContext('2d');
this._img = canvas.createImage();
this._img.src = file.tempImagePath;
var err = await this.goe(this.go_load(this._img));
if (err)
return reject('Image Load Error');
context.clearRect(0, 0, file.width, file.height);
context.drawImage(this._img, 0, 0, file.width, file.height);
var imgData = context.getImageData(0, 0, file.width, file.height);
return imgData.data.buffer;
}
}
}
</script>
<style scoped>
._vocr {
margin: 0;
padding: 0;
position: relative;
}
._noocr {
background: #00000044;
color: #000000;
text-shadow: 1px 1px 0 #ffffff88;
padding: 0.3em 0.8em;
border-radius: 0.5em 0 0 0;
}
</style>

View File

@ -0,0 +1,104 @@
<template>
<view class="_voice" @touchstart="start" @touchend="stop" v-if="benable">
<ciy-ani class="_txt" ref="ani">{{txt}}</ciy-ani>
<ciy-svgimg :src="svg" class="_img" :style="{filter:'hue-rotate('+deg+'deg)'}"></ciy-svgimg>
</view>
</template>
<script>
export default {
emits: ['change'],
props: {
maskpng: {
type: String,
default: ''
},
},
data() {
return {
benable: true,
bst: false,
txt: '',
deg: 0, //150
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" version="1"><path fill="#1989d8" d="M1006 520c0 269-218 486-486 486-56 0-110-10-161-28-13 10-28 18-46 18-41 0-74-33-74-74 0-41 33-74 74-74 33 0 61 23 72 54 44 15 90 23 136 23 225 0 407-182 407-407 0-79-23-154-61-215-3-5-3-10-3-15 0-20 5-28 20-38 13-8 23-5 38-5 54 79 84 174 84 276z m-266-159v317c0 20-15 36-36 36-20 0-36-15-36-36V361c0-20 15-36 36-36 18 0 36 15 36 36z m-133 343h-8l-20 8c-8 0-18-13-20-20l-38-102h-146l-56 102c-3 8-13 20-20 20l-26-8c-10 0-18-8-18-18v-8L394 333c3-8 10-10 15-10h46c8 0 13 5 15 10L614 681c5 10 0 20-8 23zM435 404l-61 115h123L435 404z m269-238c-26 0-49-15-61-36-38-13-79-18-120-18-225 0-407 182-407 407 0 46 8 92 23 133 5 18 13 38 15 49 8 18-15 36-36 36-33 0-44-26-44-26-26-59-41-125-41-195 0-269 218-486 486-486 44 0 84 5 123 18 13-18 36-31 59-31 41 0 74 33 74 74 0 41-33 74-72 74z"/></svg>'
};
},
watch: {},
computed: {},
mounted() {
var app = getApp();
if (app.globalData.plugin_wechatsi_manager) {
app.globalData.plugin_wechatsi_manager.onStop = res => {
this.$emit('change', {
txt: res.result,
data: res
});
this.getrefsSync('ani', this).Doani('op0|op1,200');
this.txt = res.result;
if (this._t)
clearTimeout(this._t);
this._t = setTimeout(() => {
this.getrefsSync('ani', this).Doani('op1|op0,sa1.5,300|hide');
}, 5000);
}
app.globalData.plugin_wechatsi_manager.onStart = res => {
console.log("成功开始录音识别", res)
}
app.globalData.plugin_wechatsi_manager.onError = res => {
clearInterval(this._an);
this.deg = 150; //
console.error("error msg", res.msg)
}
this._an = setInterval(() => {
this.deg += 10;
}, 100);
} else {
this.benable = false;
}
},
unmounted() {
clearInterval(this._an);
},
methods: {
test() {
this.getrefsSync('ani', this).Doani('op0|op1,200');
this.txt = 'res.result';
if (this._t)
clearTimeout(this._t);
this._t = setTimeout(() => {
this.getrefsSync('ani', this).Doani('op1|op0,sa1.5,300|hide');
}, 5000);
},
start() {
this.bst = true;
var app = getApp();
app.globalData.plugin_wechatsi_manager.start({
duration: 60000
});
},
stop() {
this.bst = false;
var app = getApp();
app.globalData.plugin_wechatsi_manager.stop();
}
}
}
</script>
<style scoped>
._voice ._img {
width: 3em;
height: 3em;
display: block;
}
._voice ._txt {
position: fixed;
bottom: 7em;
left: 0;
right: 0;
opacity: 0;
text-align: center;
}
</style>

View File

@ -0,0 +1,167 @@
<template>
<view :animation="anidatamask" class="_mask" @tap="close('mask')" v-if="popsh" :style="{background:'#00000044',zIndex:50020,opacity:0}"></view>
<view :animation="anidatapop" v-if="popsh" class="_dialog" :style="dialogstyle" @tap="nobtnclose" style="z-index:50020">
<view class="_title" v-if="title">{{title}}</view>
<view class="_content" :style="{maxHeight:maxheight,height:height}">
<view v-if="html" v-html="html"></view>
<view v-if="ele" style="padding:1em;">
<view v-if="content" v-html="tobr(content)" style="padding-bottom:1em;"></view>
<ciy-input v-if="ele == 'input'" bb v-model="inputtxt"></ciy-input>
<view v-else>
<ciy-textarea bb v-model="inputtxt"></ciy-textarea>
</view>
</view>
<view v-else-if="content" v-html="tobr(content)" style="padding:1.5em 0.5em;" :style="{textAlign:align}"></view>
<view style="display: flex;gap: 0.5em;justify-content: flex-end;padding: 0.5em 1em;" v-if="btns.length > 0">
<view v-for="(item,index) in btns" :key="index" class="btn" :class="item.cls" @tap="chkbtn(item.btn)">{{item.name}}</view>
</view>
</view>
</view>
</template>
<style scoped>
._mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
._dialog {
position: fixed;
left: 1.5em;
right: 1.5em;
border: 1px solid var(--bg6);
border-radius: 0.5em;
background: var(--bg1);
transform: scale(0.8);
opacity: 0;
}
._dialog ._title {
line-height: 1.5em;
background: linear-gradient(150deg, var(--bg2), var(--bg4));
padding: 0.5em 1em;
border-radius: 0.5em 0.5em 0 0;
}
._dialog ._content {
overflow: scroll;
margin-bottom: 0.5em;
}
</style>
<script>
export default {
props: {},
data() {
return {
popsh: false,
dialogstyle: {},
anidatamask: {},
anidatapop: {},
maxheight: 'auto',
height: 'auto',
title: '',
content: '',
align: '',
ele: null,
inputtxt: '',
html: '',
btns: [],
};
},
methods: {
async Open(res) {
return new Promise(async (resolve, reject) => {
if (this.popsh) {
this.popsh = false;
await this.sleep(500);
}
this.cb = resolve;
res = res || {};
if (typeof(res) == 'string') {
res = {
content: res
};
}
this.title = res.title === undefined ? this.lang('alert.deftitle') : res.title;
this.align = res.align || 'center';
this.inputtxt = res.value ? res.value : '';
this.ele = res.ele;
if (res.content && res.content[0] == '<') {
this.html = res.content;
this.content = '';
} else {
this.html = '';
this.content = res.content;
}
const {
headerheight,
footerheight
} = await this.com_gethdft();
var app = getApp();
if (res.height) {
this.height = res.height;
this.maxheight = 'auto';
} else {
this.height = 'auto';
var height = app.globalData._sysinfo.screenHeight - 80;
this.maxheight = height + 'px';
}
this.btns = [];
if (res.btns) {
if (typeof(res.btns) == 'string') {
var btns = res.btns.split(',');
for (var i in btns) {
this.btns.push({
name: this.lang(btns[i]),
btn: btns[i]
});
}
} else {
for (var i in res.btns) {
this.btns.push(res.btns[i]);
}
}
}
var top = (app.globalData._sysinfo.windowHeight / 4);
if (top < headerheight + 20)
top = headerheight + 20;
this.dialogstyle.marginTop = top + 'px';
this.popsh = true;
this.goani('sa0.8,op0|sa1,op1,400', data => this.anidatapop = data);
this.goani('op0|op1,400', data => this.anidatamask = data);
}).catch(e => {
return e;
});
},
chkbtn(btn) {
if (!this.ele)
return this.close(btn);
if (btn == 'cancel')
return this.close({
text: '',
btn
});
this.close({
text: this.inputtxt,
btn
});
this.inputtxt = '';
},
nobtnclose() {
if (this.btns.length > 0)
return;
this.close('nobtnclose');
},
async close(btn) {
this.goani('sa1,op1|sa0.8,op0,400', data => this.anidatapop = data);
await this.goani('op0,400', data => this.anidatamask = data);
this.popsh = false;
this.cb(btn);
}
}
}
</script>

View File

@ -0,0 +1,85 @@
<template>
<view :animation="animationData" class="_refani" v-if="show" :style="cstyle">
<slot></slot>
</view>
</template>
<style scoped>
</style>
<script>
export default {
options: {
virtualHost: true
},
props: {
ani: {
type: String,
default: ''
},
ciystyle: {
type: [String, Object],
default: ''
}
},
data() {
return {
show: true,
mastyle: {height:'auto'},
animationData: {}
};
},
watch: {
ani(newD, oldD) {
this.Doani(newD);
}
},
computed: {
cstyle() {
this.mastyle.overflow = 'hidden';
var sty = this.ciystyle;
if(typeof(sty) == 'string')
sty = this.style2obj(sty, this.mastyle);
return sty;
}
},
mounted() {
this.rect = {};
if (this.ani)
this.Doani(this.ani);
},
methods: {
async Doani(opn) {
if (this._aniing)
return;
//opnstring=anis
//{anis:string/array, init:obj}
//in out showshowoutshow=false
//stepbug
//style16ms
//initstepanis[array]step
//matrixxx3danis[string]anis[array]
this.show = true;
if (typeof(opn) == 'string') {
//ResizeObserver
if (opn.indexOf('hhauto') > -1) {
this.mastyle.height = 'auto';
this.mastyle.display = 'block';
await this.$nextTick();
var rect = await this.getrect('._refani');
//console.log('rect.height',rect.height,this.rect.height);
if (rect.width != 0 && rect.height != 0)
this.rect = rect;
if(this.rect.height)
opn = opn.replace('hhauto', 'hh' + this.rect.height);
else
opn = opn.replace('hhauto', 'hh0');
}
}
this._aniing = true;
await this.goani(opn, data => this.animationData = data, (key, val) => {
this.show = false;
});
this._aniing = false;
}
}
}
</script>

View File

@ -0,0 +1,93 @@
<template>
<view class="_refani" v-if="anishow" :style="cstyle">
<slot></slot>
</view>
</template>
<style scoped>
</style>
<script>
export default {
options: {
virtualHost: true
},
props: {
show: {
type: Boolean,
default: false
},
speedms: {
type: [String, Number],
default: 500
},
ciystyle: {
type: [String, Object],
default: ''
}
},
data() {
return {
anishow: false,
height: -1
};
},
watch: {
show(newD, oldD) {
this.Showani(newD);
}
},
computed: {
cstyle() {
var sty = this.ciystyle;
var mastyle = {};
mastyle.overflow = 'hidden';
if(this.height == -1){
mastyle.height = 'auto';
if(this.op == 0)
mastyle.opacity = 0;
}else{
mastyle.height = this.height + 'px';
mastyle.opacity = 1;
}
sty = this.style2obj(sty, mastyle);
return sty;
}
},
mounted() {
this.rect = {};
if (this.show)
this.Showani(this.show);
},
methods: {
async Showani(bshow) {
if(this.height == 0)
this.op = 0;
else
this.op = 1;
this.height = -1;
this.anishow = true;
var rect = await this.getrect('._refani');
if (rect && rect.height != 0)
this.rect = rect;
clearInterval(this.anitimeout);
//cancelAnimationFrame(this.animationFrameId);
if (bshow) {
this.animateHeight(0, this.rect.height, this.toint(this.speedms));
} else {
this.animateHeight(this.rect.height, 0, this.toint(this.speedms));
}
},
animateHeight(startHeight, targetHeight, duration) {
this.height = startHeight;
const startTime = Date.now();//performance.now();
this.anitimeout = setInterval(() => {
const elapsed = Date.now() - startTime;
const progress = Math.min(elapsed / duration, 1);
this.height = startHeight + (targetHeight - startHeight) * progress;
if (progress >= 1)
clearInterval(this.anitimeout);
}, 16);
//this.animationFrameId = uni.requestAnimationFrame(step);
}
}
}
</script>

View File

@ -0,0 +1,193 @@
<template>
<view :animation="anidatamask" class="_mask" @tap="close('mask')" v-if="show" :style="{background:maskbg,zIndex:zindex,opacity:0}"></view>
<view :animation="anidatapop" ref="_anipop" class="_anipop" v-if="show" :style="popstyle">
<view class="_anicontent">
<view v-if="title" class="ciy-caption">
{{title}}
<view class="_close" @tap="close('closebtn')">×</view>
</view>
<view style="overflow: auto;" :style="{maxHeight:maxheight+'px'}">
<slot></slot>
</view>
<view class="footer_safe" :style="{height:footer_safe_height+'px'}"></view>
</view>
</view>
</template>
<style scoped>
._close {
position: absolute;
right: 0.3em;
font-size: 2em;
color: var(--txt4);
}
._mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
._anipop {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
background: var(--bg2);
}
</style>
<script>
export default {
emits: ['change', 'update:modelValue'],
props: {
modelValue: {
type: Boolean,
default: false
},
noclose: {
type: Boolean,
default: false
},
direction: {
type: String,
default: 'bottom'
},
edge: {
type: [String, Number],
default: 0
},
maskbg: {
type: String,
default: ''
},
bg: {
type: String,
default: '#ffffff'
},
title: {
type: String,
default: ''
},
zindex: {
type: Number,
default: 992
},
anispeed: {
type: [String, Number],
default: 300
},
},
data() {
return {
show: false,
maxheight: 0,
popstyle: {},
anidatapop: {},
anidatamask: {}
};
},
watch: {
modelValue(newD, oldD) {
if (newD) {
this.Open();
} else {
this.close('user');
}
}
},
computed: {},
mounted() {},
methods: {
async Open() {
this.bclose = false;
this.pagenoscroll(true);
const {
headerheight,
footerheight
} = await this.com_gethdft();
this.show = true;
var app = getApp();
var edge = this.toint(this.edge);
var totalms = this.toint(this.anispeed);
this.maxheight = (app.globalData._sysinfo.windowHeight - headerheight - this.footer_safe_height);
if(this.direction != 'left' && this.direction != 'right')
this.maxheight -= this.edge;
if (this.title)
this.maxheight -= 55;
var mainrect = await this.getrect('._anicontent');
if (!mainrect)
return;
this.popstyle = {
zIndex: this.zindex
};
if (this.direction == 'left') {
//this.popstyle.transform = 'translateX(-100vw)';
this.popstyle.background = this.bg;
this.popstyle.marginTop = headerheight + 'px';
this.popstyle.marginRight = this.edge + 'px';
var top = 0;
this.goani('tx-100vh,op0|tx' + top + 'px,op1,' + totalms, data => this.anidatapop = data);
} else if (this.direction == 'right') {
//this.popstyle.transform = 'translateX(100vw)';
this.popstyle.background = this.bg;
this.popstyle.marginTop = headerheight + 'px';
this.popstyle.marginLeft = this.edge + 'px';
var top = 0;
this.goani('tx100vh,op0|tx' + top + 'px,op1,' + totalms, data => this.anidatapop = data);
} else if (this.direction == 'top') {
//this.popstyle.transform = 'translateY(-100vh)';
this.popstyle.height = mainrect.height + 'px';
var top = headerheight;
this.goani('ty-100vh,op0|ty' + top + 'px,op1,' + totalms, data => this.anidatapop = data);
} else {
//this.popstyle.transform = 'translateY(100vh)'; //selcas
var top = app.globalData._sysinfo.windowHeight - mainrect.top - mainrect.height - this.footer_safe_height;
if (top < headerheight + edge) {
top = headerheight + edge;
}
this.goani('ty100vh,op0|ty' + top + 'px,op1,' + totalms, data => this.anidatapop = data);
}
this.goani('op0|op0,100|op1,' + totalms, data => this.anidatamask = data);
this.$emit('change', {
from: 'open',
value: true
});
},
close(from) {
if (this.noclose && from == 'mask')
return;
if (from != 'user') {
this.$emit('update:modelValue', false);
}
if (!this.show)
return;
if (this.bclose)
return;
this.bclose = true;
this.pagenoscroll(false);
var totalms = this.toint(this.anispeed);
if (this.direction == 'left') {
this.goani('tx-100vw,op0,' + totalms + '|tx0', data => this.anidatapop = data);
} else if (this.direction == 'right') {
this.goani('tx100vw,op0,' + totalms + '|tx0', data => this.anidatapop = data);
} else if (this.direction == 'top') {
this.goani('ty-100vh,op0,' + totalms + '|ty0', data => this.anidatapop = data);
} else {
this.goani('ty100vh,op0,' + totalms + '|ty0', data => this.anidatapop = data);
}
this.goani('op0,' + totalms, data => this.anidatamask = data);
this.$emit('change', {
from: from,
value: false
});
setTimeout(() => {
this.show = false;
}, totalms + 50);
}
}
}
</script>

View File

@ -0,0 +1,216 @@
<template>
<view class="_audio" v-if="!nonedisplay">
<view class="_main">
<view style="align-self: center;margin-right:0.5em;">
<view class="_icon" :class="btncls" @tap="play"></view>
</view>
<view class="flex1 rel">
<view style="text-align:left;font-weight:bold;margin-bottom:0.5em;letter-spacing: 2px;">{{title}}</view>
<view class="flex flex-center">
<view class="txt-smm">{{statxt}}</view>
<view class="flex1 _timepct">
<view class="itm" :style="{width:percent + '%'}"></view>
</view>
<view class="txt-smm">{{endtxt}}</view>
</view>
<view class="abs txt-right txt-smm" style="right:0;top:0;">
{{lang('audio.rate')}} <text class="kbd" @tap="setrate()">{{rates[rateidx].name}}</text>
</view>
</view>
</view>
</view>
</template>
<style scoped>
._main {
display: flex;
border-top: 1px solid var(--bg3);
border-bottom: 3px solid var(--bg5);
padding: 0.5em;
border-radius: 0.8em;
}
._timepct {
background: var(--bg6);
margin: 0 0.5em;
height: 3px;
}
._timepct>.itm {
background: var(--txt7);
height: 2px;
}
._audio {
color: var(--txt7);
border: 1px solid var(--bg7);
border-radius: 0.8em;
background: linear-gradient(0deg, var(--bg3), var(--bg5));
}
._icon {
width: 3em;
height: 3em;
}
._icon.play {
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTUxMiA4OTZjMjEyLjA3NDY2NyAwIDM4NC0xNzEuOTI1MzMzIDM4NC0zODRTNzI0LjA3NDY2NyAxMjggNTEyIDEyOCAxMjggMjk5LjkyNTMzMyAxMjggNTEyczE3MS45MjUzMzMgMzg0IDM4NCAzODR6IiBmaWxsPSIjMDAwMDAwIj48L3BhdGg+PHBhdGggZD0iTTg1LjMzMzMzMyA1MTJDODUuMzMzMzMzIDI3Ni4zNTIgMjc2LjM1MiA4NS4zMzMzMzMgNTEyIDg1LjMzMzMzM3M0MjYuNjY2NjY3IDE5MS4wMTg2NjcgNDI2LjY2NjY2NyA0MjYuNjY2NjY3LTE5MS4wMTg2NjcgNDI2LjY2NjY2Ny00MjYuNjY2NjY3IDQyNi42NjY2NjdTODUuMzMzMzMzIDc0Ny42NDggODUuMzMzMzMzIDUxMnpNNTEyIDE3MC42NjY2NjdDMzIzLjQ3NzMzMyAxNzAuNjY2NjY3IDE3MC42NjY2NjcgMzIzLjQ3NzMzMyAxNzAuNjY2NjY3IDUxMnMxNTIuODEwNjY3IDM0MS4zMzMzMzMgMzQxLjMzMzMzMyAzNDEuMzMzMzMzIDM0MS4zMzMzMzMtMTUyLjgxMDY2NyAzNDEuMzMzMzMzLTM0MS4zMzMzMzNTNzAwLjUyMjY2NyAxNzAuNjY2NjY3IDUxMiAxNzAuNjY2NjY3eiIgZmlsbD0iIzAwMDAwMCI+PC9wYXRoPjxwYXRoIGQ9Ik00MjYuNjY2NjY3IDUxMnYtMTQ5LjMzMzMzM2wxMTcuMzMzMzMzIDc0LjY2NjY2Nkw2NjEuMzMzMzMzIDUxMmwtMTE3LjMzMzMzMyA3NC42NjY2NjdMNDI2LjY2NjY2NyA2NjEuMzMzMzMzdi0xNDkuMzMzMzMzeiIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPjxwYXRoIGQ9Ik00MDYuMTQ0IDMyNS4yNjkzMzNhNDIuNjY2NjY3IDQyLjY2NjY2NyAwIDAgMSA0My40MzQ2NjcgMS40MDhsMjM0LjY2NjY2NiAxNDkuMzMzMzM0YTQyLjY2NjY2NyA0Mi42NjY2NjcgMCAwIDEgMCA3MS45Nzg2NjZsLTIzNC42NjY2NjYgMTQ5LjMzMzMzNEE0Mi42NjY2NjcgNDIuNjY2NjY3IDAgMCAxIDM4NCA2NjEuMzMzMzMzVjM2Mi42NjY2NjdhNDIuNjY2NjY3IDQyLjY2NjY2NyAwIDAgMSAyMi4xNDQtMzcuMzk3MzM0ek00NjkuMzMzMzMzIDQ0MC4zODR2MTQzLjIzMkw1ODEuODY2NjY3IDUxMiA0NjkuMzMzMzMzIDQ0MC4zODR6IiBmaWxsPSIjRkZGRkZGIj48L3BhdGg+PC9zdmc+");
}
._icon.pause {
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTUxNCAxMTQuM2MtMjE5LjkgMC0zOTguOSAxNzguOS0zOTguOSAzOTguOCAwLjEgMjIwIDE3OSAzOTguOSAzOTguOSAzOTguOSAyMTkuOSAwIDM5OC44LTE3OC45IDM5OC44LTM5OC45IDAtMjE5LjgtMTc4LjktMzk4LjgtMzk4LjgtMzk4Ljh6IG0tMzUuNiA1MzEuNWMwIDMyLjUtMjYuMyA1OC44LTU4LjggNTguOHMtNTguOC0yNi4zLTU4LjgtNTguOFYzODEuNGMwLTMyLjUgMjYuMy01OC44IDU4LjgtNTguOHM1OC44IDI2LjMgNTguOCA1OC44djI2NC40eiBtMTg4LjcgMGMwIDMyLjUtMjYuMyA1OC44LTU4LjggNTguOHMtNTguOC0yNi4zLTU4LjgtNTguOFYzODEuNGMwLTMyLjUgMjYuMy01OC44IDU4LjgtNTguOHM1OC44IDI2LjMgNTguOCA1OC44djI2NC40eiIgZmlsbD0iIzBDMEMwQyI+PC9wYXRoPjwvc3ZnPg==");
}
</style>
<script>
export default {
emits: ['change'],
props: {
src: {
type: String,
default: ''
},
title: {
type: String,
default: '无题'
},
background: {
type: Boolean,
default: false
},
nonedisplay: {
type: Boolean,
default: false
},
coverimg: {
type: String,
default: ''
},
epname: { //
type: String,
default: ''
},
singer: { //
type: String,
default: ''
},
},
data() {
return {
btncls: 'play',
percent: 0,
rateidx: 1,
rates: [{
rate: 0.5,
name: 'x0.5'
}, {
rate: 1,
name: 'x1'
}, {
rate: 1.25,
name: 'x1.25'
}, {
rate: 1.5,
name: 'x1.5'
}, {
rate: 2,
name: 'x2'
}],
statxt: '00:00',
endtxt: '00:00'
};
},
watch: {
src(newD, oldD) {
this.sesrc(newD);
},
title(newD, oldD) {
this.aud.title = newD;
},
coverimg(newD, oldD) {
this.aud.coverImgUrl = newD;
},
epname(newD, oldD) {
this.aud.epname = newD;
},
singer(newD, oldD) {
this.aud.singer = newD;
}
},
mounted() {
if (!this.aud) {
if (this.background)
this.aud = wx.getBackgroundAudioManager();
else
this.aud = uni.createInnerAudioContext();
}
this.aud.title = this.title;
if (this.background) {
this.aud.epname = this.epname;
this.aud.singer = this.singer;
this.aud.coverImgUrl = this.coverimg;
}
this.setsrc(this.src);
this.aud.onPlay(e => {
this.btncls = 'pause';
this.$emit('change', {
from: 'play',
value: this.aud
});
});
this.aud.onEnded(e => {
this.percent = 100;
this.statxt = this.endtxt;
this.btncls = 'play';
this.$emit('change', {
from: 'stop',
value: this.aud
});
});
this.aud.onPause(e => {
this.btncls = 'play';
this.$emit('change', {
from: 'pause',
value: this.aud
});
});
this.aud.onTimeUpdate(e => {
this.endtxt = this.sttime(this.aud.duration);
this.statxt = this.sttime(this.aud.currentTime);
this.percent = this.aud.currentTime / this.aud.duration * 100;
this.btncls = 'pause';
});
},
unmounted() {
this.aud.stop();
this.aud.destroy();
},
methods: {
setsrc(src) {
if (!this.aud)
return;
this.aud.src = src;
//this.aud.protocol = 'hls';
},
setrate() {
this.rateidx++;
if (this.rateidx >= this.rates.length)
this.rateidx = 0;
this.aud.playbackRate = this.rates[this.rateidx].rate;
},
sttime(s) {
var m = parseInt(s / 60);
var ss = parseInt(s - m * 60);
if (ss < 10)
ss = '0' + ss;
return m + ':' + ss;
},
play() {
if (this.btncls == 'play')
this.aud.play();
else
this.aud.pause();
}
}
}
</script>

View File

@ -0,0 +1,412 @@
<template>
<view :animation="anidataauth" class="auth">
<view class="swiper" :style="{transform: 'translateX(' + pg + 'vw)',height:height}">
<view class="content">
<view class="title">
<ciy-gesture @toleft="gopg(1)" class="mid" style="letter-spacing: 1em;">{{lang('login.tabreg')}}</ciy-gesture>
<view class="itm" @tap="gopg(1)">{{lang('login.tablogin')}}</view>
<view class="itm" @tap="gopg(2)">{{lang('login.tabforget')}}</view>
</view>
<form @submit="submitreg">
<view style="width:600rpx;margin:0.5em auto;">
<view class="ciy-form">
<label>{{lang('login.form_mobile')}}</label>
<view>
<ciy-input type="number" name="user" placeholder="请输入手机号"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>{{lang('login.form_setpass')}}</label>
<view>
<ciy-input name="pass" type="password" placeholder="请输入登录密码"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>{{lang('login.form_repass')}}</label>
<view>
<ciy-input name="pass2" type="password" placeholder="再次输入登录密码"></ciy-input>
</view>
</view>
<view style="margin:1em 0;">
<ciy-checkitem sq v-model="xieyi">
已阅读并同意
<text @tap="gourl" :data-url="lang('login.xieyi')" style="color:#0000FF;">
用户协议
</text>
</ciy-checkitem>
</view>
<view style="text-align: center;padding-top:1em;">
<button class="btn lg cc" form-type="submit">{{lang('login.btn_reg')}}</button>
</view>
</view>
</form>
</view>
<view class="content">
<view class="title">
<view @tap="gopg(0)" style="padding-right:2em;">{{lang('login.tabreg')}}</view>
<ciy-gesture @todown="close" class="mid" style="letter-spacing: 1em;padding-left: 0.5em;" @toright="gopg(0)" @toleft="gopg(2)">{{lang('login.tablogin')}}</ciy-gesture>
<view @tap="gopg(2)">{{lang('login.tabforget')}}</view>
</view>
<form @submit="submitlogin">
<view style="width:600rpx;margin:0.5em auto;">
<view class="ciy-form">
<label @tap="showver">{{lang('login.form_mobile')}}</label>
<view>
<ciy-input :value="user" type="number" name="user" placeholder="请输入手机号"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>{{lang('login.form_pass')}}</label>
<view>
<ciy-input :value="pass" name="pass" type="password" placeholder="请输入密码"></ciy-input>
</view>
</view>
<view style="margin:1em 0;">
<ciy-checkitem sq v-model="xieyi">
已阅读并同意
<text @tap="gourl" :data-url="lang('login.xieyi')" style="color:#0000FF;">
用户协议
</text>
</ciy-checkitem>
</view>
<view style="text-align: center;padding-top:1em;">
<button class="btn lg cc" style="width: 100%;" form-type="submit">{{lang('login.btn_login')}}</button>
</view>
<view style="display:inline-block;min-width:2em;min-height:2em;">
<view v-if="tusers.length > 0" class="cuser">
<view class="itm code" @tap="setdbg(index)" v-for="(item,index) in tusers" :key="index">
{{item.name}}
</view>
</view>
</view>
<view v-if="ver<-6" style="text-align: center;color:var(--txt1)">众产(杭州)科技有限公司</view>
</view>
</form>
</view>
<view class="content">
<view class="title">
<view @tap="gopg(0)">{{lang('login.tabreg')}}</view>
<view @tap="gopg(1)">{{lang('login.tablogin')}}</view>
<ciy-gesture @toright="gopg(1)" class="mid">{{lang('login.tabforget')}}</ciy-gesture>
</view>
<form @submit="submitforget">
<view style="width:600rpx;margin:0.5em auto;">
<view class="ciy-form">
<label>{{lang('login.form_mobile')}}</label>
<view>
<ciy-input v-model="forgetmobile" name="user" type="number" placeholder="请输入手机号"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>验证码</label>
<view>
<ciy-capcode hasmore name="capsms" btntxt="发送短信" :account="forgetmobile" :func="smsfunc" placeholder="请输入验证码"></ciy-capcode>
</view>
</view>
<view class="ciy-form">
<label>新密码</label>
<view>
<ciy-input name="pass" type="password" placeholder="请输入新密码"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>再次输入</label>
<view>
<ciy-input name="pass2" type="password" placeholder="再次输入新密码"></ciy-input>
</view>
</view>
<view style="text-align: center;padding-top:1em;">
<button class="btn lg cc" form-type="submit">{{lang('login.btn_forget')}}</button>
</view>
</view>
</form>
</view>
</view>
</view>
<view :animation="anidatabg" class="authbg" @tap="close"></view>
</template>
<style scoped>
.cuser {
display: flex;
flex-wrap: wrap;
padding-bottom: 2em;
}
.cuser>.itm {
margin: 0.5em;
}
.title {
display: flex;
text-align: center;
font-size: 1em;
margin: 1em;
align-items: flex-end;
}
.title>.itm {
text-decoration: underline;
padding: 0 1em;
min-width: 4em;
}
.title .mid {
text-decoration: none;
font-weight: bolder;
font-size: 1.6em;
padding: 0;
flex: 1;
background: linear-gradient(30deg, var(--man5), var(--man7));
background-clip: text;
-webkit-background-clip: text;
color: transparent;
}
.auth {
position: fixed;
z-index: 50002;
/*51*/
bottom: -2em;
left: 0;
right: 0;
transform: translateY(28em)
}
.authbg {
position: fixed;
z-index: 50001;
/*50*/
top: 0;
bottom: 0;
left: -0.5em;
right: -0.5em;
touch-action: none;
background: linear-gradient(0deg, var(--bg2), transparent);
transform: translateY(100vh);
}
.auth .swiper {
display: flex;
width: 300vw;
flex-wrap: nowrap;
transition: all 0.3s;
}
.auth .content {
width: 100vw;
margin: 0 0.5em;
border-radius: 1em 1em 0 0;
background: radial-gradient(at center 5em, var(--bg1), var(--bg3));
overflow: auto;
box-shadow: 2px 2px 20px -10px var(--bg9);
}
</style>
<script>
import md5 from '@/util/md5.js';
export default {
props: {},
data() {
return {
forgetmobile: '',
smsfunc: '',
user: '',
pass: '',
xieyi: false,
pg: -100, //-100
ver: 6,
height: '28em',
tusers: [],
anidataauth: {},
anidatabg: {},
};
},
options: {
virtualHost: true
},
watch: {},
computed: {},
mounted() {},
methods: {
async Open(authcb, must) {
this.authcb = authcb;
if (!must) {
var me = this.getme();
if (me.id > 0) {
authcb({
me: me
});
this.authcb = null;
return;
}
//#ifdef MP-WEIXIN
var upid = this.toint(this.getstorage('upid'));
var res = await uni.login({
provider: 'weixin',
scopes: 'auth_base',
onlyAuthorize: true
});
var retjson = await this.callfunc({
func: 'login.wx_autouser',
loadhide: true,
data: {
code: res.code,
upid: upid
}
});
if (retjson.code != 1)
return;
this.tologin(retjson);
return;
//#endif
}
var animation = uni.createAnimation({
timingFunction: 'ease'
});
animation.translateY(0);
animation.step({
duration: 700
});
this.anidataauth = animation.export();
var animation = uni.createAnimation({
timingFunction: 'ease'
});
animation.translateY(0);
animation.step({
duration: 400
});
this.anidatabg = animation.export();
this.user = this.getstorage('login_mb');
this.smsfunc = 'login.sendsms';
},
async submitlogin(e) {
var app = getApp();
var post = e.detail.value;
if (post.user.length > 0)
this.setstorage('login_mb', post.user);
if (post.user == '')
return this.toast('请填写手机号');
if (post.pass == '')
return this.toast('请填写密码');
if (!this.xieyi && await this.askmsg('是否阅读并同意协议?', '同意') != 'ok')
return;
post.auth = (new Date()).getTime();
post.appcid = app.globalData._appcid;
var epass = md5.md5(post.pass + app.globalData.tokensalt);
post.pass = md5.md5(epass + post.auth);
//._from = app.globalData._sysinfo;
var retjson = await this.callfunc({
func: 'login.login_mobile', // login.login
data: post
});
if (retjson.code != 1)
return this.toast(retjson.errmsg);
this.setstorage('_dbgs', retjson.dbgs);
this.tologin(retjson);
},
async submitreg(e) {
var app = getApp();
var post = e.detail.value;
if (post.user == '')
return this.toast('请填写手机号');
if (post.pass == '')
return this.toast('请填写密码');
if (post.pass != post.pass2)
return this.toast('两次密码输入不同');
if (!this.xieyi && await this.askmsg('是否阅读并同意协议?', '同意') != 'ok')
return;
post.upid = app.getstorage('upid');
post.appcid = app.globalData._appcid;
post.pass = md5.md5(post.pass + app.globalData.tokensalt);
post.pass2 = '';
//._from = app.globalData._sysinfo;
var retjson = await this.callfunc({
func: 'login.reg_mobile', // login.reg
data: post
});
if (retjson.code != 1)
return this.toast(retjson.errmsg);
this.setstorage('login_mb', post.user);
this.tologin(retjson);
this.toast('注册成功,已自动登录');
},
async submitforget(e) {
var app = getApp();
var post = e.detail.value;
if (post.user == '')
return this.toast('请填写手机号');
if (post.captcha == '')
return this.toast('请填写验证码');
if (post.pass == '')
return this.toast('请填写密码');
if (post.pass != post.pass2)
return this.toast('两次密码输入不同');
post.pass = md5.md5(post.pass + app.globalData.tokensalt);
var retjson = await this.callfunc({
func: 'login.forgetpass', // login.reg
data: post
});
if (retjson.code != 1)
return this.toast(retjson.errmsg);
this.tologin(retjson);
this.toast('密码找回成功,已自动登录');
},
tologin(json) {
var app = getApp();
var auth = app.setuserstorage(json);
if (this.authcb != null)
this.authcb(auth);
this.authcb = null;
this.close();
},
gopg(idx) {
this.pg = idx * -100;
},
close() {
if (this.authcb != null)
this.authcb({
me: {
id: 0
}
});
this.authcb = null;
var animation = uni.createAnimation({
timingFunction: 'ease'
});
animation.translateY(this.height);
animation.step({
duration: 1000
});
this.anidataauth = animation.export();
var animation = uni.createAnimation({
timingFunction: 'ease'
});
animation.translateY('100vh');
animation.step({
duration: 1000
});
this.anidatabg = animation.export();
},
async showver(e) {
this.ver--;
if (this.ver !== 0)
return;
var app = getApp();
if (app.globalData._wxenv == 'release')
return;
var retjson = await this.callfunc({
func: 'login.debug_list',
data: {}
});
this.tusers = retjson.list;
},
setdbg(idx) {
this.xieyi = true;
this.user = this.tusers[idx].user;
this.pass = this.tusers[idx].pass;
},
}
}
</script>

View File

@ -0,0 +1,187 @@
<template>
暂未完成
<view>
<view class="vtopmsg" v-if="btmsg" :style="{background:btmsg == '蓝牙阅读器正常'?'':'#cc0000'}">{{btmsg}}</view>
<view class="_bg" v-if="bshow">
<view class="_dialog">
<view class="_title">选择目标</view>
<view class="_close" @tap="close()"></view>
<view class="_content" :style="{maxHeight:maxheight}">
<view style="text-align: center;margin:1em 0;">
<ciy-qrcode-show :value="epc"></ciy-qrcode-show>
</view>
<view v-for="(item,index) in sels" :key="index" @tap="sendme(item)" class="selbtn">
{{item}}
</view>
</view>
</view>
</view>
</view>
</template>
<style scoped>
._bg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.2);
z-index: 100;
}
._dialog {
position: fixed;
border-radius: 0.5em;
/* #ifdef MP-WEIXIN */
top: 1em;
/* #endif */
/* #ifndef MP-WEIXIN */
top: 4em;
/* #endif */
left: 1em;
right: 1em;
background: #ffffff;
}
._dialog ._title {
line-height: 1.5em;
background: #fafafa;
padding: 0.5em 1em;
border-radius: 0.5em 0.5em 0 0;
}
._dialog ._content {
overflow: scroll;
margin-bottom: 0.5em;
}
._dialog ._close {
position: absolute;
right: 0.5em;
top: 0.5em;
width: 1.5em;
height: 1.5em;
background-image: url("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyB2ZXJzaW9uPScxLjEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc+PHBhdGggZD0nTTUxLjI4NTk0ODA3IDUyMC4wMTYwMTM1NGMwIDI1Ni40ODg5MDI4MyAyMDcuNTg2OTEzMzUgNDY0LjA3NTgxNjIgNDY0LjA3NTgxNjE3IDQ2NC4wNzU4MTYxN3M0NjQuMDc1ODE2Mi0yMDcuNTg2OTEzMzUgNDY0LjA3NTgxNjItNDY0LjA3NTgxNjE3Uzc3MS44NTA2NjcwOCA1NS45NDAxOTczMyA1MTUuMzYxNzY0MjQgNTUuOTQwMTk3MzNzLTQ2NC4wNzU4MTYyIDIwNy41ODY5MTMzNS00NjQuMDc1ODE2MTcgNDY0LjA3NTgxNjIxeicgZmlsbD0nI2Q4MWUwNic+PC9wYXRoPjxwYXRoIGQ9J001NjAuMjYxMDk5MDIgNTE5LjU1MTkzNzU5bDE3OC4zNzkxNDI5MSAxNzguMzc5MTQxNDZjMTEuODkxOTQyNTcgMTEuODkxOTQyNTcgMTEuODkxOTQyNTcgMzIuODkxMzczNTkgMCA0NC44MTIzMjE5LTExLjg5MTk0MjU3IDExLjg5MTk0MjU3LTMyLjg5MTM3MzU5IDExLjg5MTk0MjU3LTQ0LjgxMjMyMTkxIDBsLTE3OC4zNzkxNDE0NS0xNzguMzc5MTQyOS0xNzguMzc5MTQxNDMgMTc4LjM3OTE0MjljLTExLjg5MTk0MjU3IDExLjg5MTk0MjU3LTMyLjg5MTM3MzU5IDExLjg5MTk0MjU3LTQ0LjgxMjMyMTkxIDAtMTEuODkxOTQyNTctMTEuOTIwOTQ2ODYtMTEuODkxOTQyNTctMzIuOTIwMzc3ODkgMC00NC44MTIzMjE5bDE3OC4zNzkxNDI5LTE3OC4zNzkxNDE0Ni0xNzcuNzk5MDQ2OS0xNzcuODI4MDUyNjRjLTExLjkyMDk0Njg2LTExLjg5MTk0MjU3LTExLjkyMDk0Njg2LTMyLjg5MTM3MzU5IDAtNDQuODEyMzIwNDUgMTEuODkxOTQyNTctMTEuODkxOTQyNTcgMzIuODkxMzczNTktMTEuODkxOTQyNTcgNDQuNzgzMzE2MTYgMGwxNzcuODI4MDUxMTggMTc3Ljc5OTA0Njg5IDE3Ny43OTkwNDY5MS0xNzcuNzk5MDQ2ODljMTIuNTAxMDQyODctMTEuODkxOTQyNTcgMzIuOTIwMzc3ODktMTEuODkxOTQyNTcgNDQuODQxMzI2MjEgMCAxMS44OTE5NDI1NyAxMS44OTE5NDI1NyAxMS44OTE5NDI1NyAzMi44OTEzNzM1OSAwIDQ0LjgxMjMyMDQ1bC0xNzcuODI4MDUyNjcgMTc3Ljc5OTA0ODM2eicgZmlsbD0nI2ZmZmZmZic+PC9wYXRoPjwvc3ZnPg==");
}
.selbtn {
margin: 1em;
text-align: center;
border: 1px solid #0c59a9;
padding: 0.5em;
background: #007aff;
font-size:1.5em;
color: #ffffff;
border-radius: 0.3em;
}
</style>
<script>
import ciyQrcodeShow from '@/components/ciy-qrcode-show/ciy-qrcode-show'
var app = getApp();
export default {
props: {
select: {
type: String
}
}
, data() {
return {
bshow: false
, btmsg: ''
, sels: []
, maxheight: '30em'
, epc: ''
, };
}
, destroyed() {
console.log('unmounted');
}
, mounted() {
console.log('mounte');
}
, methods: {
open() {
this.bshow = true;
var app = getApp();
var height = app.globalData._sysinfo.screenHeight - 80;
this.maxheight = height + 'px';
}
, sendme(select) {
console.log('sendme', select);
this.$emit('scan', {
select: select
, value: this.epc
});
this.close();
}
, unmonitor() {
var devbt = app.globalData.dev_bt.reader;
if (!devbt)
return;
devbt.onmsg = null;
}
, monitor() {
console.log('monitor');
this.btmsg = '';
// setTimeout(() => {
// var epc = '372120220009998';
// this.sels = this.select.split(',');
// if (this.sels.length == 1) {
// this.$emit('scan', {
// select: this.select
// , value: epc
// });
// } else {
// this.epc = epc;
// this.open();
// }
// }, 500);
var devbt = app.globalData.dev_bt.reader;
if (!devbt)
return;
this.btmsg = '蓝牙阅读器未连接!';
if (devbt.opened == 10)
this.btmsg = '蓝牙阅读器正常';
devbt.onmsg = res => {
if (res.connected !== undefined) {
if (res.connected)
this.btmsg = '蓝牙阅读器正常';
else
this.btmsg = '蓝牙阅读器已断开';
return;
}
this.btmsg = '蓝牙阅读器正常';
var epc = res.data;
if (!epc)
return;
if (!this.isfront())
return;
this.sels = this.select.split(',');
if (this.sels.length == 1) {
this.$emit('scan', {
select: this.select
, value: epc
});
} else {
this.epc = epc;
this.open();
}
};
}
, isfront() {
var ps = getCurrentPages();
var ftroute = ps[ps.length - 1].route || ps[ps.length - 1].__route__;
var cproute = this.$parent.__route__ || this.$parent.$parent.route;
//console.log(this.select, ftroute,cproute);
return ftroute == cproute;
}
, close() {
this.bshow = false;
}
}
}
</script>

View File

@ -0,0 +1,562 @@
<template>
<view style="width: 100%;" :style="{height}">
<input type="hidden" :name="name" :value="tostamp(tvalue)" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_date'" :value="todatetime(tvalue,'d')" style="display:none;" />
<view class="yearmonth" :style="{padding:selectmonth?'0 1.5em':''}">
<view class="itm">
<view v-if="selectmonth" @tap="asyear(-10)" class="flex" style="padding-right:2em;">
<view class="arrow left ciy-icon-arrow" style="margin-right:-1em;"></view>
<view class="arrow left ciy-icon-arrow" style="margin-right:-1em;"></view>
</view>
<view class="arrow left ciy-icon-arrow" @tap="asyear(-1)"></view>
<view class="maintxt" @tap="chgpage(1)">{{year}} {{lang('calendar.year')}}</view>
<view class="arrow right ciy-icon-arrow" @tap="asyear(1)"></view>
<view v-if="selectmonth" @tap="asyear(10)" class="flex" style="padding-left:2em;">
<view class="arrow right ciy-icon-arrow" style="margin-left:-1em;"></view>
<view class="arrow right ciy-icon-arrow" style="margin-left:-1em;"></view>
</view>
</view>
<view class="itm" v-if="!selectmonth">
<view class="arrow left ciy-icon-arrow" @tap="asmonth(-1)"></view>
<view class="maintxt" @tap="chgpage(2)">{{month+1}} {{lang('calendar.month')}}</view>
<view class="arrow right ciy-icon-arrow" @tap="asmonth(1)"></view>
</view>
<view class="itm" v-else>
</view>
<view v-if="!selectmonth" class="itm today" @tap="today">{{lang('calendar.today')}}</view>
<view v-else class="itm today" @tap="today">{{lang('calendar.tomonth')}}</view>
</view>
<view v-if="cpage == 0" style="padding: 0 0.2em;position: relative;">
<view class="week">
<view class="itm" v-for="(w,index) in weeks">
<slot name="header" :itm="{week:w}">
<view class="defweek">
<view class="itm" :style="{borderLeftColor:index?bordercolor:''}">
{{lang('week.'+w)}}
</view>
</view>
</slot>
</view>
</view>
<ciy-gesture @toleft="asmonth(1)" @toright="asmonth(-1)">
<view class="days">
<view class="itm" v-for="item in dayarr" @tap="clksel(item)">
<slot name="data" :itm="{year:year,month:month+1,day:item,date:tvalue,select:cal_valueselect(item),cansel:cal_opminmax(item)}">
<view class="defday" :style="cal_valueselect(item)?'color:' + selecttextcolor + ';background:' + selectbg + ';border:1px solid ' + bordercolor:''">
<view :style="{opacity:cal_opminmax(item)?1:0.4}">{{item}}</view>
</view>
</slot>
</view>
</view>
</ciy-gesture>
<view style="position: absolute;bottom:0.8em;right:0.5em;" v-if="clearbtn">
<button class="btn def" @tap="clknodate">{{lang('calendar.nodate')}}</button>
</view>
</view>
<view v-if="cpage == 1" class="syear">
<view v-if="!selectmonth" class="itm lr" @tap="odyear(-10)">
<view class="arrow left ciy-icon-arrow"></view>
<view class="arrow left ciy-icon-arrow"></view>
</view>
<view v-if="!selectmonth" class="itm lr" @tap="odyear(10)">
<view class="arrow right ciy-icon-arrow"></view>
<view class="arrow right ciy-icon-arrow"></view>
</view>
<view class="itm" v-for="yy in 12" @tap="clkyear(startyear+yy)" :style="startyear+yy==year?'font-weight:bolder;color:' + selecttextcolor:''">
{{startyear+yy}}
</view>
</view>
<view v-if="cpage == 2" class="smonth">
<view class="itm" v-for="mon in 12" @tap="clkmon(mon)" :style="month+1==mon?'font-weight:bolder;color:' + selecttextcolor:''">
{{mon}} {{lang('calendar.month')}}
</view>
</view>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue', 'viewchange'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number, Date],
default: ''
},
value: {
type: [String, Number, Date],
default: ''
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
bordercolor: {
type: String,
default: 'var(--bg6)'
},
selecttextcolor: {
type: String,
default: 'var(--man5)'
},
selectbg: {
type: String,
default: 'var(--bg1)'
},
height: {
type: String,
default: '23em'
},
selectmonth: {
type: Boolean,
default: false
},
weekmonday: {
type: Boolean,
default: false
},
mindate: {
type: [String, Number, Date],
default: ''
},
maxdate: {
type: [String, Number, Date],
default: ''
},
clearbtn: {
type: Boolean,
default: false
},
},
data() {
return {
v: '',
startyear: 0,
year: 0,
month: 0,
cpage: 0 //012
};
},
watch: {
value: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'modelValue';
},
immediate: true
}
},
computed: {
tvalue() {
var val = '';
if (this.v == 'modelValue') {
if (typeof(this.modelValue) == 'number')
val = new Date(this.modelValue * 1000);
else if (this.modelValue)
val = this.modelValue;
} else if (this.v == 'value') {
if (typeof(this.value) == 'number')
val = new Date(this.value * 1000);
else if (this.value)
val = this.value;
} else {
val = this.v;
}
this._is0 = false;
if (!(val instanceof Date)) {
if (val.indexOf('-') > -1 || val.indexOf('/') > -1) {
val = this.str2date(val);
} else {
val = this.toint(val);
if (val == 0) {
this._is0 = true;
val = new Date();
} else {
val = new Date(val * 1000);
}
}
} else if (isNaN(val.getTime())) {
this._is0 = true;
val = new Date();
}
if (this.max && this.max <= val)
val = this.max;
if (this.min && this.min >= val && val.getTime() != 0)
val = this.min;
if (val.getTime() != 0) {
this.year = val.getFullYear();
this.month = val.getMonth();
}
return val;
},
max() {
var val = this.maxdate;
if (val instanceof Date) {
if (isNaN(val.getTime()))
val = null;
} else if (typeof(val) == 'number') {
val = new Date(val * 1000);
} else if (val.indexOf('-') > -1 || val.indexOf('/') > -1) {
val = this.str2date(val);
} else if (val == 'now') {
val = new Date();
} else {
val = this.toint(val);
if (val == 0)
val = null;
else {
val = new Date(val * 1000);
}
}
return val;
},
min() {
var val = this.mindate;
if (val instanceof Date) {
if (isNaN(val.getTime()))
val = null;
} else if (typeof(val) == 'number') {
val = new Date(val * 1000);
} else if (val.indexOf('-') > -1 || val.indexOf('/') > -1) {
val = new Date(val);
} else if (val == 'now') {
val = new Date();
} else {
val = this.toint(val);
if (val == 0)
val = null;
else {
val = new Date(val);
}
}
return val;
},
weeks() {
var wks = [];
if (!this.weekmonday)
wks.push(0);
wks.push(1);
wks.push(2);
wks.push(3);
wks.push(4);
wks.push(5);
wks.push(6);
if (this.weekmonday)
wks.push(0);
return wks;
},
dayarr() {
if (this.year == 0)
return;
var darr = [];
var monthdaycnt = new Date(this.year, this.month + 1, 0).getDate();
var day1 = new Date(this.year, this.month, 1);
var week = day1.getDay();
if (this.weekmonday)
week--;
for (var i = 0; i < week; i++)
darr.push('');
for (var i = 1; i <= monthdaycnt; i++)
darr.push(i);
var nt = 7 - (darr.length % 7);
for (var i = darr.length; i < 42; i++)
darr.push('');
return darr;
}
},
mounted() {
this.year = this.tvalue.getFullYear();
this.month = this.tvalue.getMonth();
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.tostamp(this.tvalue),
date: this.tvalue
});
}
if (this.selectmonth)
this.cpage = 2;
},
methods: {
clkyear(y) {
if (this.selectmonth) {
if (this.year != y)
this.month = -1;
this.year = y;
this.cpage = 2;
return;
}
this.year = y;
this.cpage = 0;
this.$emit('viewchange', {
name: this.name,
from: 'year',
month: this.month,
year: this.year
});
},
clkmon(mon) {
this.month = mon - 1;
if (this.selectmonth) {
this.clksel(1);
return;
}
this.cpage = 0;
this.$emit('viewchange', {
name: this.name,
from: 'month',
month: this.month,
year: this.year
});
},
chgpage(p) {
var page = this.cpage == p ? (this.selectmonth ? 2 : 0) : p;
if (page == 1)
this.startyear = parseInt((this.year - 1) / 10) * 10;
this.cpage = page;
},
odyear(od10) {
this.startyear += od10;
},
asyear(od) {
this.year += od;
if (this.selectmonth) {
this.cpage = 2;
this.month = -1;
return;
}
this.cpage = 0;
this.$emit('viewchange', {
name: this.name,
from: 'year',
month: this.month,
year: this.year
});
},
asmonth(od) {
this.month += od;
if (this.month < 0) {
this.year--;
this.month = 11;
}
if (this.month > 11) {
this.year++;
this.month = 0;
}
this.$emit('viewchange', {
name: this.name,
from: 'month',
month: this.month,
year: this.year
});
this.cpage = 0;
},
today(od) {
var val = new Date();
if (this.max && this.max <= val)
val = this.max;
if (this.min && this.min >= val)
val = this.min;
this.v = val;
this.year = val.getFullYear();
this.month = val.getMonth();
val.setHours(0);
val.setMinutes(0); //val.getTimezoneOffset()
val.setSeconds(0);
//var vt = this.tostamp(val);
// this.$emit('update:modelValue', vt);
// this.$emit('change', {
// name: this.name,
// from: 'today',
// value: vt,
// date: val
// });
if (this.selectmonth)
this.clksel(1);
else
this.clksel(val.getDate());
},
cal_opminmax(day) {
var date = new Date(this.year, this.month, day);
if (this.max) {
if (date > this.max)
return false;
}
if (this.min) {
if (date < this.min)
return false;
}
return true;
},
cal_valueselect(day) {
if (this._is0)
return false;
if (this.tvalue.getFullYear() != this.year)
return false;
if (this.tvalue.getMonth() != this.month)
return false;
if (this.tvalue.getDate() != day)
return false;
return true;
},
clknodate() {
var date = new Date(0);
this.$emit('update:modelValue', 0);
this.$emit('change', {
name: this.name,
from: 'nodate',
value: 0,
date: date
});
this.v = date;
},
clksel(day) {
if (!day)
return;
var date = new Date(this.year, this.month, day);
if (this.max) {
if (date > this.max)
return;
}
if (this.min) {
if (date < this.min)
return;
}
var val = this.tostamp(date);
this.$emit('update:modelValue', val);
this.$emit('change', {
name: this.name,
from: 'click',
value: val,
date: date
});
this.v = date;
}
}
}
</script>
<style scoped>
.syear {
display: flex;
flex-wrap: wrap;
}
.syear>.itm {
text-align: center;
flex: 0 0 25%;
line-height: 6em;
}
.syear .lr {
flex: 0 0 50%;
line-height: 2em;
margin-bottom: -1em;
padding-top: 1em;
}
.smonth {
display: flex;
flex-wrap: wrap;
line-height: 6em;
}
.smonth>.itm {
text-align: center;
flex: 0 0 25%;
}
.week {
display: flex;
}
.week>.itm {
flex: 1;
text-align: center;
}
.week .defweek {
padding: 0.5em 0;
}
.week .defweek>.itm {
font-weight: bolder;
border-left: 1px solid transparent;
}
.days {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.days .itm {
text-align: center;
flex: 0 0 14.28%;
}
.days .defday {
height: 3em;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 0.5em;
}
.yearmonth {
display: flex;
height: 3em;
gap: 1em;
}
.yearmonth>.itm {
flex: 1;
display: flex;
align-items: center;
}
.yearmonth .today {
flex: none;
padding-right: 0.5em;
white-space: nowrap;
}
.yearmonth .maintxt {
flex: 1;
text-align: center;
white-space: nowrap;
}
.arrow {
width: 1.5em;
height: 1.5em;
display: inline-block;
}
.arrow.left {
transform: rotate(90deg);
}
.arrow.right {
transform: rotate(-90deg);
}
</style>

View File

@ -0,0 +1,111 @@
<template>
<view class="_capmain">
<input class="inp flex1" type="number" :name="name" :placeholder="placeholder" :maxlength="codelength" confirm-type="done" cursor-spacing="120" />
<input v-if="hasmore" type="hidden" :name="name+'_id'" :value="dbid" style="display:none;" />
<view class="itm">
<view v-if="sec>0">{{maxsec-sec}}</view>
<button v-else class="btn sm sq" @tap="sendcap">{{btntxt}}</button>
</view>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change'],
props: {
name: {
type: String,
default: ''
},
hasmore: {
type: Boolean,
default: false
},
btntxt: {
type: String,
default: ''
},
account: {
type: String,
default: ''
},
func: {
type: String,
default: ''
},
placeholder: {
type: String,
default: ''
},
codelength: {
type: [String,Number],
default: 4
},
maxsec: {
type: [String,Number],
default: 60
}
},
data() {
return {
sec: 0,
dbid: 0,
capid: '',
};
},
watch: {},
mounted() {
},
methods: {
async sendcap(e) {
if(!this.account)
return this.toast(this.lang('capcode.noinput'));
var retjson = await this.callfunc({
func: this.func,
data:{account:this.account,length:this.codelength}
});
if(retjson.code != 1)
return this.toast(retjson.errmsg);
this.dbid = retjson.id;
this.sec++;
this._sectick = setInterval(() => {
this.sec++;
if (this.sec < this.toint(this.maxsec))
return;
this.sec = 0;
clearInterval(this._sectick);
this.$emit('change', {
from: 'tickend',
value: 0
});
}, 1000);
this.$emit('change', {
from: 'send',
value: retjson
});
}
}
}
</script>
<style scoped>
._capmain {
display: flex;
align-items: center;
position: relative;
}
._capmain>.inp {
text-align: center;
font-size: 1em;
height: 1em;
}
._capmain>.itm {
min-width: 6em;
text-align: right;
}
</style>

View File

@ -0,0 +1,74 @@
<template>
<view class="pie" :style="{background:tvalue.bg}">
<slot>
</slot>
</view>
</template>
<style scoped>
.pie {
width: 100%;
height: 100%;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
</style>
<script>
export default {
props: {
data: {
type: [String, Array],
default: '100|#128dea'
}
},
data() {
return {};
},
computed: {
tvalue() {
var colors = ['#4fa6f1', '#57c85b', '#9C27B0', '#FFEB3B', '#2353c3', '#FF5722', '#87b800', '#a66100',
'#00796B', '#E91E63', '#a1a1a1'
];
var dats = [...this.data];
if (typeof(this.data) == 'string') {
dats = [];
var das = this.data.split(',');
for (var i in das) {
var dc = das[i].split('|');
if (dc.length == 1 || dc[1][0] != '#') {
dc[1] = colors[i];
}
dats.push({
num: this.tofloat(dc),
color: dc[1]
});
}
}
var total = 0;
for (var i in dats) {
total += dats[i].num;
}
var ret = {
bg: '#cccccc'
};
if (total > 0) {
ret.bg = 'conic-gradient(from 270deg';
var nextdeg = 0;
for (var i in dats) {
var medeg = dats[i].num * 360 / total
ret.bg += ', ' + dats[i].color + ' '+nextdeg+'deg ';
nextdeg += medeg;
ret.bg += nextdeg+'deg';
}
}
return ret;
}
},
methods: {
}
}
</script>

View File

@ -0,0 +1,301 @@
<template>
<view style="width:100%;">
<input type="hidden" :maxlength="-1" :name="name" :value="tkvs.value" style="display:none;" />
<template v-if="hasmore">
<checkbox-group :name="name+'_name'" style="display:none;">
<checkbox v-for="(item,index) in tkvs.vals" :key="index" :value="item.name+''" checked />
</checkbox-group>
</template>
<template v-if="hasmore && moreno">
<checkbox-group :name="name+'_noname'" style="display:none;">
<checkbox v-for="(item,index) in tkvs.novals" :key="index" :value="item.name+''" checked />
</checkbox-group>
</template>
<template v-if="moreno">
<checkbox-group :name="name+'_id'" style="display:none;">
<checkbox v-for="(item,index) in tkvs.vals" :key="index" :value="item.id+''" checked />
</checkbox-group>
<checkbox-group :name="name+'_no'" style="display:none;">
<checkbox v-for="(item,index) in tkvs.novals" :key="index" :value="item.id+''" checked />
</checkbox-group>
</template>
<view v-if="innerrang.length==0" :style="{color:'var(--bg6)',textAlign:left?'left':''}">无选项</view>
<radio-group class="_gp" :class="{'_line':line,'_left':left,'_itemright':itemright}">
<view @tap="chgitem(item)" class="_item" v-for="(item,index) in innerrang" :key="index">
<ciy-checkitem style="pointer-events: none;" sq :disabled="disabled" :tag="(byname?item.name:item.id)+''" :value="tkvs.ids.indexOf((byname?item.name:item.id)+'') > -1"></ciy-checkitem>
<view :style="{color:disabled?'var(--txt1)':''}">{{item.name}}</view>
</view>
</radio-group>
</view>
</template>
<style scoped>
._gp {
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: flex-end;
}
._gp._left {
flex-direction: row;
justify-content: flex-start;
}
._gp._left ._item {
flex-direction: row;
}
._gp ._item {
white-space: nowrap;
display: flex;
align-items: center;
gap: 0.5em;
padding: 0.5em;
min-width: 7em;
flex-direction: row-reverse;
}
._gp._itemright ._item {
justify-content: flex-start;
flex-direction: row-reverse;
}
._gp._line ._item {
width: 100%;
white-space: normal;
}
</style>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number],
default: ''
},
value: {
type: [String, Number],
default: ''
},
initevent: {
type: Boolean,
default: false
},
byname: {
type: Boolean,
default: false
},
bin: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
chkuse: {
type: Boolean,
default: false
},
range: {
type: [String, Array],
default: []
},
moreno: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
itemright: {
type: Boolean,
default: false
},
line: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
v: ''
};
},
watch: {
tkvs: {
handler(newD, oldD) {
if (this.from && newD.value == oldD.value)
return;
if (this.innerrang.length == 0)
return;
if (!this.from)
this.from = 'init';
else if (this.from == 'init')
this.from = 'check';
this.$emit('update:modelValue', newD.value);
if (this.from != 'init' || this.initevent) {
this.$emit('change', {
name: this.name,
from: this.from,
value: newD.value,
idvalue: newD.vals,
novalue: newD.novals
});
}
}
},
value: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'modelValue';
},
immediate: true
}
},
computed: {
innerrang() {
if (typeof(this.range) == 'string') {
const lis = this.range.split(',');
var lst = [];
for (let i = 0; i < lis.length; i++) {
const ls = lis[i].split(':');
if (ls.length < 2)
continue;
lst.push({
id: ls[0],
name: ls[1]
});
}
return lst;
}
let range = [];
for (let i = 0; i < this.range.length; i++) {
if (this.chkuse && this.range[i].isuse == 2)
continue;
range.push(this.range[i]);
}
return range;
},
tkvs() {
var val = ''; //id/name
if (this.v == 'modelValue') {
if (typeof(this.modelValue) == 'number')
val = this.modelValue + '';
else if (this.modelValue)
val = this.modelValue;
} else if (this.v == 'value') {
if (typeof(this.value) == 'number')
val = this.value + '';
else if (this.value)
val = this.value;
} else if (this.v instanceof Array) {
val = this.v;
}
if (!(val instanceof Array)) {
if (this.bin) {
var values = [];
var ibin = parseInt(val);
for (var tt = 0; tt < 64; tt++) {
if (ibin & Math.pow(2, tt))
values.push((tt + 1) + '');
}
val = values;
} else {
val = val.split(',');
}
}
var kvs = {
ids: [],
vals: [],
novals: []
};
if (this.byname) {
for (var i in this.innerrang) {
if (val.indexOf(this.innerrang[i].name + '') > -1) {
kvs.ids.push(this.innerrang[i].name + '');
kvs.vals.push({
...this.innerrang[i]
});
} else {
kvs.novals.push({
...this.innerrang[i]
});
}
}
} else {
for (var i in this.innerrang) {
if (val.indexOf(this.innerrang[i].id + '') > -1) {
kvs.ids.push(this.innerrang[i].id + '');
kvs.vals.push({
...this.innerrang[i]
});
} else {
kvs.novals.push({
...this.innerrang[i]
});
}
}
}
if (this.bin) {
var bval = 0;
for (var bi in kvs.ids) {
var bc = this.toint(kvs.ids[bi]);
if (bc < 1 || bc > 63)
continue;
bval += Math.pow(2, (bc - 1));
}
kvs.value = bval;
} else {
kvs.value = '';
if (kvs.ids.length > 0)
kvs.value = ',' + kvs.ids.join(',') + ',';
}
return kvs;
}
},
mounted() {},
methods: {
chgitem(itm) {
if (this.disabled)
return;
this.v = this.tkvs.ids;
if (this.byname) {
if (this.tkvs.ids.includes(itm.name + '')) {
var idx = this.v.indexOf(itm.name + '');
if (idx > -1)
delete this.v[idx];
} else {
this.v.push(itm.name + '');
}
} else {
if (this.tkvs.ids.includes(itm.id + '')) {
var idx = this.v.indexOf(itm.id + '');
if (idx > -1)
delete this.v[idx];
} else {
this.v.push(itm.id + '');
}
}
}
}
}
</script>

View File

@ -0,0 +1,213 @@
<template>
<label style="min-width:auto;">
<view class="_radio" :class="{_sq:sq,_disabled:disabled}" @tap="clickswitch(!this.tvalue)">
<switch :name="name" :checked="tvalue" @change="chg" style="display:none;" />
<view class="_bn" :class="{_checked:tvalue}" :animation="anidatabn"></view>
</view>
<slot></slot>
</label>
</template>
<style scoped>
._radio {
position: relative;
display: inline-block;
vertical-align: middle;
flex-shrink: 0;
height: 1.6em;
width: 1.6em;
margin: 0 0.3em;
border-radius: 1em;
background: var(--e-switch-bg);
box-shadow: var(--e-switch-shadow);
}
._radio._disabled {
background: var(--bg5);
}
._radio._sq {
border-radius: 0.4em;
}
._radio._sq ._bn {
border-radius: 0.4em;
}
._radio ._bn {
position: relative;
height: 100%;
width: 100%;
border-radius: 1em;
background: var(--e-switch-chkbg);
opacity: 0.05;
transform: scale(0.6);
}
._radio._disabled ._bn {
background: var(--e-switch-chkbgdis);
}
._radio ._bn._checked {
box-shadow: var(--e-switch-shadow);
opacity: 1;
}
</style>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['update:modelValue', 'change'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number, Boolean],
default: -998
},
value: {
type: [String, Number, Boolean],
default: -998
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
ms: { //
type: [String, Number],
default: 200
},
sq: { //
type: Boolean,
default: false
}
},
data() {
return {
v: '',
anidatabn: {},
};
},
watch: {
tvalue: {
handler(newD, oldD) {
if (this.v == 'modelValue' || this.v == 'value')
this.ani();
}
},
value: {
handler(newD, oldD) {
if (newD === -998)
return;
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD === -998)
return;
if (newD || oldD)
this.v = 'modelValue';
},
immediate: true
}
},
computed: {
tvalue() {
if (this.v == 'modelValue') {
if (typeof(this.modelValue) == 'boolean')
return this.modelValue;
else if (typeof(this.modelValue) == 'number')
return this.modelValue != 0;
else if (this.modelValue.toLowerCase() == 'true')
return true;
else
return false;
} else if (this.v == 'value') {
if (typeof(this.value) == 'boolean')
return this.value;
else if (typeof(this.value) == 'number')
return this.value != 0;
else if (this.value.toLowerCase() == 'true')
return true;
else
return false;
}
return this.v;
}
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.tvalue
});
}
if (this.tvalue)
this.ani();
},
methods: {
ani() {
var time = this.toint(this.ms);
if (this.tvalue) {
var animation = uni.createAnimation({});
animation.opacity(0.3);
animation.scale(1.1);
animation.step({
duration: time / 2
});
animation.opacity(1);
animation.scale(0.6);
animation.step({
duration: time / 2
});
this.anidatabn = animation.export();
} else {
var animation = uni.createAnimation({});
animation.opacity(0.8);
animation.scale(0.2);
animation.step({
duration: time / 2
});
animation.scale(0.6);
animation.opacity(0.05);
animation.step({
duration: time
});
this.anidatabn = animation.export();
}
},
chg(e) {
this.clickswitch(!this.tvalue);
},
clickswitch(chk) {
if (this.disabled)
return;
if (!chk && !this.sq)
return;
var time = this.toint(this.ms);
if (time < 500)
time = 500;
if (new Date().getTime() - this._time < time)
return;
this._time = new Date().getTime();
this.v = chk;
this.ani();
this.$emit('update:modelValue', chk);
this.$emit('change', {
name: this.name,
from: 'input',
value: chk
});
}
}
}
</script>

View File

@ -0,0 +1,164 @@
<template>
<view class="_dbg" :style="{left:left}" @tap.stop="showdbglist" v-if="bshow && me.id>0 && dbgs">
<view class="_dbgbg">
</view>
<view class="_dbgtxt">
{{me.id}}<br />
{{me.name}}
</view>
</view>
</template>
<style scoped>
._dbg {
top: 25em;
position: fixed;
width: 4em;
height: 4em;
z-index: 10000000;
transition: left 0.5s;
}
._dbgbg {
position: relative;
background: #9412cc;
width: 100%;
height: 100%;
border-radius: 50%;
opacity: 0.2;
}
._dbgtxt {
position: absolute;
width: 100%;
height: 100%;
text-align: center;
padding: 0 0.3em;
line-height: 1.3em;
text-shadow: 1px 1px #ffffff, -1px -1px #ffffff, -1px 1px #ffffff, 1px -1px #ffffff;
top: 0.7em;
left: 0;
font-size: 0.8em;
color: #000000;
}
</style>
<script>
export default {
props: {},
data() {
return {
left: '0.3rem',
dbgs: null,
bshow: true
};
},
watch: {},
computed: {},
mounted() {
this.me = this.getme();
this.dbgs = this.getstorage('_dbgs');
},
methods: {
async chguser(item) {
var retjson = await this.callfunc({
func: 'login.debug_chguser',
data: {
code: item.data.user
}
});
if (retjson.code != 1)
return this.alert(retjson.errmsg);
this.me = this.objdeepmerge(this.me, retjson.me);
getApp().setuserstorage(retjson);
var page = this.com_getpage();
page.me = this.me;
if (page.dbgcallback)
page.dbgcallback();
},
async mehide(item) {
this.bshow = false;
if (item.data > 0) {
setTimeout(() => {
this.bshow = true;
}, item.data);
}
},
async meusr(item) {
var btn = await this.inputmsg({
title: '用户ID',
ele: 'input'
}, [{
name: '添加',
btn: 'add'
}, {
name: '删除',
btn: 'del',
cls: 'dag'
}, {
name: '取消',
btn: 'cancel',
cls: 'def'
}]);
if (btn.btn == 'cancel')
return;
if (!btn.text)
return this.toast('请填写用户ID');
var retjson = await this.callfunc({
func: 'login.debug_opuser',
data: btn
});
if (retjson.code != 1)
return this.alert(retjson.errmsg);
if (btn.btn == 'add') {
this.dbgs.push(retjson.data);
} else {
var idx = this.arrayfind(this.dbgs, btn.text, 'user');
if (idx > -1)
this.dbgs.splice(idx, 1);
}
this.setstorage('_dbgs', this.dbgs);
},
async showdbglist() {
var items = [];
for (var i = 0; i < this.dbgs.length; i++) {
items.push({
func: 'chguser',
name: this.dbgs[i].name,
sub: this.dbgs[i].user,
data: this.dbgs[i]
});
}
items.push({
br: true
});
items.push({
func: 'mehide',
name: '消失5秒',
style: 'color:var(--warn6)',
data: 5000
});
items.push({
func: 'mehide',
name: '永久隐藏',
style: 'color:var(--dag6)',
data: 0
});
items.push({
func: 'meusr',
name: '增删用户',
style: 'color:var(--man6)',
data: 0
});
this.left = '-2rem';
this.popmenu({
rowcount: 3,
items,
closecb: () => {
this.left = '-0.3rem';
}
});
},
}
}
</script>

View File

@ -0,0 +1,96 @@
<template>
<view class="_bg" v-if="bshow">
<view class="_dialog" :style="{top:top}">
<view class="_title">{{title}}</view>
<view class="_close" @tap="Close(true)"></view>
<view class="_content" :style="{maxHeight:maxheight,height:height}">
<slot></slot>
</view>
</view>
</view>
</template>
<style scoped>
._bg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.2);
z-index: 100;
}
._dialog {
position: fixed;
border-radius: 0.5em;
left: 1em;
right: 1em;
background: #ffffff;
}
._dialog ._title {
line-height: 1.5em;
background: #fafafa;
padding: 0.5em 1em;
border-radius: 0.5em 0.5em 0 0;
}
._dialog ._content {
overflow: scroll;
margin-bottom: 0.5em;
}
._dialog ._close {
position: absolute;
right: 0.5em;
top: 0.5em;
width: 1.5em;
height: 1.5em;
background-image: url("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyB2ZXJzaW9uPScxLjEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc+PHBhdGggZD0nTTUxLjI4NTk0ODA3IDUyMC4wMTYwMTM1NGMwIDI1Ni40ODg5MDI4MyAyMDcuNTg2OTEzMzUgNDY0LjA3NTgxNjIgNDY0LjA3NTgxNjE3IDQ2NC4wNzU4MTYxN3M0NjQuMDc1ODE2Mi0yMDcuNTg2OTEzMzUgNDY0LjA3NTgxNjItNDY0LjA3NTgxNjE3Uzc3MS44NTA2NjcwOCA1NS45NDAxOTczMyA1MTUuMzYxNzY0MjQgNTUuOTQwMTk3MzNzLTQ2NC4wNzU4MTYyIDIwNy41ODY5MTMzNS00NjQuMDc1ODE2MTcgNDY0LjA3NTgxNjIxeicgZmlsbD0nI2Q4MWUwNic+PC9wYXRoPjxwYXRoIGQ9J001NjAuMjYxMDk5MDIgNTE5LjU1MTkzNzU5bDE3OC4zNzkxNDI5MSAxNzguMzc5MTQxNDZjMTEuODkxOTQyNTcgMTEuODkxOTQyNTcgMTEuODkxOTQyNTcgMzIuODkxMzczNTkgMCA0NC44MTIzMjE5LTExLjg5MTk0MjU3IDExLjg5MTk0MjU3LTMyLjg5MTM3MzU5IDExLjg5MTk0MjU3LTQ0LjgxMjMyMTkxIDBsLTE3OC4zNzkxNDE0NS0xNzguMzc5MTQyOS0xNzguMzc5MTQxNDMgMTc4LjM3OTE0MjljLTExLjg5MTk0MjU3IDExLjg5MTk0MjU3LTMyLjg5MTM3MzU5IDExLjg5MTk0MjU3LTQ0LjgxMjMyMTkxIDAtMTEuODkxOTQyNTctMTEuOTIwOTQ2ODYtMTEuODkxOTQyNTctMzIuOTIwMzc3ODkgMC00NC44MTIzMjE5bDE3OC4zNzkxNDI5LTE3OC4zNzkxNDE0Ni0xNzcuNzk5MDQ2OS0xNzcuODI4MDUyNjRjLTExLjkyMDk0Njg2LTExLjg5MTk0MjU3LTExLjkyMDk0Njg2LTMyLjg5MTM3MzU5IDAtNDQuODEyMzIwNDUgMTEuODkxOTQyNTctMTEuODkxOTQyNTcgMzIuODkxMzczNTktMTEuODkxOTQyNTcgNDQuNzgzMzE2MTYgMGwxNzcuODI4MDUxMTggMTc3Ljc5OTA0Njg5IDE3Ny43OTkwNDY5MS0xNzcuNzk5MDQ2ODljMTIuNTAxMDQyODctMTEuODkxOTQyNTcgMzIuOTIwMzc3ODktMTEuODkxOTQyNTcgNDQuODQxMzI2MjEgMCAxMS44OTE5NDI1NyAxMS44OTE5NDI1NyAxMS44OTE5NDI1NyAzMi44OTEzNzM1OSAwIDQ0LjgxMjMyMDQ1bC0xNzcuODI4MDUyNjcgMTc3Ljc5OTA0ODM2eicgZmlsbD0nI2ZmZmZmZic+PC9wYXRoPjwvc3ZnPg==");
}
</style>
<script>
export default {
props: {},
data() {
return {
bshow: false,
maxheight: 'auto',
top: 0,
height: 'auto',
title: '',
};
},
methods: {
async Open(res) {
var app = getApp();
res = res || {};
if (typeof(res) == 'string')
res = {
title: res
};
this.title = res.title || '操作';
this.cb = res.cb;
const {
headerheight,
footerheight
} = await this.com_gethdft();
this.top = (headerheight + 60) + 'px';
if (res.height) {
this.height = res.height;
} else {
var height = app.globalData._sysinfo.windowHeight - 100 - this.header_statusbar_height - this.header_title_height;
this.maxheight = height + 'px';
}
this.bshow = true;
},
Close(mustcb) {
this.bshow = false;
if (mustcb && typeof(this.cb) == 'function')
this.cb('close');
}
}
}
</script>

View File

@ -0,0 +1,89 @@
<template>
<view @touchstart="touchstart" @touchend="touchend" @touchmove="touchmove">
<slot></slot>
</view>
</template>
<style scoped>
</style>
<script>
export default {
emits: ['start', 'toleft', 'toright', 'todown', 'toup', 'end'],
props: {
pxlen: { //pxlen px
type: Number,
default: 40
},
move: { //
type: Boolean,
default: false
}
},
data() {
return {};
},
watch: {},
computed: {},
mounted() {},
methods: {
touchstart(e) {
this.$emit('start', e.touches[0]);
this.startx = e.touches[0].pageX;
this.starty = e.touches[0].pageY;
this.movex = e.touches[0].pageX;
this.movey = e.touches[0].pageY;
this.st = true;
},
touchend(e) {
this.st = false;
var x = this.movex - this.startx;
var y = this.movey - this.starty;
var needend = true;
if (Math.abs(x) > this.pxlen) {
if (x < 0)
this.$emit('toleft', {
x,
y
});
else
this.$emit('toright', {
x,
y
});
needend = false;
}
if (Math.abs(y) > this.pxlen) {
if (y > 0)
this.$emit('todown', {
x,
y
});
else
this.$emit('toup', {
x,
y
});
needend = false;
}
if (needend) {
this.$emit('end', {
x,
y
});
}
},
touchmove(e) {
if (!this.st)
return;
this.movex = e.touches[0].pageX;
this.movey = e.touches[0].pageY;
if (!this.move)
return;
this.$emit('tomove', {
x: this.movex - this.startx,
y: this.movey - this.starty
});
}
}
}
</script>

View File

@ -0,0 +1,499 @@
<template>
<view>
<input type="hidden" :name="name" :value="pic" style="display:none;" />
<view v-if="doing" class="_vtop" :style="{top:(header_statusbar_height+header_title_height)+'px'}" style="left:0;right:0;bottom:0;background:#ffffff;z-index: 998;">
<view style="position: absolute;top:5px;left:5px;bottom:5px;width:4em;">
<button @tap="btn_close" class="lbtn" style="top:2em;">{{lang('handsign.close')}}</button>
<button @tap="btn_clear" class="lbtn" style="top:8em;">{{lang('handsign.rewrite')}}</button>
<button @tap="btn_done" type="primary" class="lbtn" style="bottom:2em;">{{lang('handsign.done')}}</button>
</view>
<view style="position:absolute;top:5px;left:4.5em;right:5px;bottom:5px;border: 4rpx dashed #e9e9e9;">
<canvas class="handsign" canvas-id="handsign" style="background:#ffffff;width:100%;height: 100%;" disable-scroll="true" @touchstart="uploadScaleStart" @touchmove="uploadScaleMove" @touchend="uploadScaleEnd">
</canvas>
</view>
</view>
<view v-else>
<image :src="file_stor(pic)" mode="aspectFill" style="width:70vw;height:35vw;border: 1px solid #cccccc;" @tap="showsign"></image>
</view>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
props: {
name: {
type: String
},
value: {
type: String,
default: ''
},
uploadurl: {
type: String,
default: ''
},
imgact: {
type: String,
default: 'cp|300|70'
},
color: {
type: String,
default: '#0555ad'
}
},
data() {
return {
doing: false,
canvasWidth: 0,
canvasHeight: 0,
lineSize: 1.5 //
,
lineMin: 1 //
,
lineMax: 4 //
,
pressure: 1 //
,
smoothness: 60 //60
,
currentPoint: {},
currentLine: [] // 线
,
firstTouch: true //
,
radius: 1 //
,
cutArea: {
top: 0,
right: 0,
bottom: 0,
left: 0
} //
,
bethelPoint: [] //线
,
lastPoint: 0,
chirography: [] //
,
currentChirography: {} //
,
linePrack: [] //线 , 线
,
pic: ''
};
},
watch: {
value(newD, oldD) {
this.showvalue();
}
},
mounted() {
this.showvalue('created');
},
methods: {
showvalue(frombase) {
var val = this.value || '';
this.pic = val;
if (frombase) {
this.$emit('change', {
name: this.name,
from: frombase,
value: val
});
}
},
uploadScaleStart: function(e) {
if (e.type != 'touchstart') return false;
this.ctx.setFillStyle(this.color); // 线
//this.ctx.setGlobalAlpha(this.transparent); //
var currentPoint = {
x: e.touches[0].x,
y: e.touches[0].y
}
var currentLine = this.currentLine;
currentLine.unshift({
time: new Date().getTime(),
dis: 0,
x: currentPoint.x,
y: currentPoint.y
})
this.currentPoint = currentPoint;
if (this.firstTouch) {
this.cutArea = {
top: currentPoint.y,
right: currentPoint.x,
bottom: currentPoint.y,
left: currentPoint.x
};
this.firstTouch = false;
}
this.pointToLine(currentLine);
}
//
,
uploadScaleMove: function(e) {
if (e.type != 'touchmove')
return false;
if (e.cancelable) {
//
if (!e.defaultPrevented) {
e.preventDefault();
}
}
var point = {
x: e.touches[0].x,
y: e.touches[0].y
}
//
if (point.y < this.cutArea.top) {
this.cutArea.top = point.y;
}
if (point.y < 0) this.cutArea.top = 0;
if (point.x > this.cutArea.right) {
this.cutArea.right = point.x;
}
if (this.canvasWidth - point.x <= 0) {
this.cutArea.right = this.canvasWidth;
}
if (point.y > this.cutArea.bottom) {
this.cutArea.bottom = point.y;
}
if (this.canvasHeight - point.y <= 0) {
this.cutArea.bottom = this.canvasHeight;
}
if (point.x < this.cutArea.left) {
this.cutArea.left = point.x;
}
if (point.x < 0) this.cutArea.left = 0;
this.lastPoint = this.currentPoint;
this.currentPoint = point;
var currentLine = this.currentLine;
currentLine.unshift({
time: new Date().getTime(),
dis: this.distance(this.currentPoint, this.lastPoint),
x: point.x,
y: point.y
});
this.pointToLine(currentLine);
}
//
,
uploadScaleEnd(e) {
if (e.type != 'touchend') return 0;
if (e.changedTouches.length == 0)
return;
var point = {
x: e.changedTouches[0].x,
y: e.changedTouches[0].y
}
this.lastPoint = this.currentPoint;
this.currentPoint = point;
var currentLine = this.currentLine
currentLine.unshift({
time: new Date().getTime(),
dis: this.distance(this.currentPoint, this.lastPoint),
x: point.x,
y: point.y
})
if (currentLine.length > 2) {
var info = (currentLine[0].time - currentLine[currentLine.length - 1].time) / currentLine.length;
}
//
//
this.pointToLine(currentLine);
var currentChirography = {
lineSize: this.lineSize,
lineColor: this.color
};
this.chirography.unshift(currentChirography);
var linePrack = this.linePrack;
linePrack.unshift(this.currentLine);
this.linePrack = linePrack;
this.currentLine = [];
}
//线:line
,
pointToLine: function(line) {
this.calcBethelLine(line);
return;
}
//
,
calcBethelLine: function(line) {
if (line.length <= 1) {
line[0].r = this.radius;
return;
}
var x0, x1, x2, y0, y1, y2, r0, r1, r2, len, lastRadius, dis = 0,
time = 0,
curveValue = 0.5;
if (line.length <= 2) {
x0 = line[1].x
y0 = line[1].y
x2 = line[1].x + (line[0].x - line[1].x) * curveValue;
y2 = line[1].y + (line[0].y - line[1].y) * curveValue;
//x2 = line[1].x;
//y2 = line[1].y;
x1 = x0 + (x2 - x0) * curveValue;
y1 = y0 + (y2 - y0) * curveValue;;
} else {
x0 = line[2].x + (line[1].x - line[2].x) * curveValue;
y0 = line[2].y + (line[1].y - line[2].y) * curveValue;
x1 = line[1].x;
y1 = line[1].y;
x2 = x1 + (line[0].x - x1) * curveValue;
y2 = y1 + (line[0].y - y1) * curveValue;
}
//(x0,y0),(x1,y1),(x2,y2) (x1,y1)线线
len = this.distance({
x: x2,
y: y2
}, {
x: x0,
y: y0
});
lastRadius = this.radius;
for (var n = 0; n < line.length - 1; n++) {
dis += line[n].dis;
time += line[n].time - line[n + 1].time;
if (dis > this.smoothness) break;
}
this.radius = Math.min(time / len * this.pressure + this.lineMin, this.lineMax) * this.lineSize;
line[0].r = this.radius;
//
if (line.length <= 2) {
r0 = (lastRadius + this.radius) / 2;
r1 = r0;
r2 = r1;
//return;
} else {
r0 = (line[2].r + line[1].r) / 2;
r1 = line[1].r;
r2 = (line[1].r + line[0].r) / 2;
}
var n = 5;
var point = [];
for (var i = 0; i < n; i++) {
var t = i / (n - 1);
var x = (1 - t) * (1 - t) * x0 + 2 * t * (1 - t) * x1 + t * t * x2;
var y = (1 - t) * (1 - t) * y0 + 2 * t * (1 - t) * y1 + t * t * y2;
var r = lastRadius + (this.radius - lastRadius) / n * i;
point.push({
x: x,
y: y,
r: r
});
if (point.length == 3) {
var a = this.ctaCalc(point[0].x, point[0].y, point[0].r, point[1].x, point[1].y, point[1].r, point[2].x, point[2].y, point[2].r);
a[0].color = this.color;
this.bethelDraw(a, 1);
point = [{
x: x,
y: y,
r: r
}];
}
}
this.currentLine = line;
}
//
,
distance: function(a, b) {
var x = b.x - a.x;
var y = b.y - a.y;
return Math.sqrt(x * x + y * y);
},
ctaCalc: function(x0, y0, r0, x1, y1, r1, x2, y2, r2) {
var a = [],
vx01, vy01, norm, n_x0, n_y0, vx21, vy21, n_x2, n_y2;
vx01 = x1 - x0;
vy01 = y1 - y0;
norm = Math.sqrt(vx01 * vx01 + vy01 * vy01 + 0.0001) * 2;
vx01 = vx01 / norm * r0;
vy01 = vy01 / norm * r0;
n_x0 = vy01;
n_y0 = -vx01;
vx21 = x1 - x2;
vy21 = y1 - y2;
norm = Math.sqrt(vx21 * vx21 + vy21 * vy21 + 0.0001) * 2;
vx21 = vx21 / norm * r2;
vy21 = vy21 / norm * r2;
n_x2 = -vy21;
n_y2 = vx21;
a.push({
mx: x0 + n_x0,
my: y0 + n_y0,
color: "#1A1A1A"
});
a.push({
c1x: x1 + n_x0,
c1y: y1 + n_y0,
c2x: x1 + n_x2,
c2y: y1 + n_y2,
ex: x2 + n_x2,
ey: y2 + n_y2
});
a.push({
c1x: x2 + n_x2 - vx21,
c1y: y2 + n_y2 - vy21,
c2x: x2 - n_x2 - vx21,
c2y: y2 - n_y2 - vy21,
ex: x2 - n_x2,
ey: y2 - n_y2
});
a.push({
c1x: x1 - n_x2,
c1y: y1 - n_y2,
c2x: x1 - n_x0,
c2y: y1 - n_y0,
ex: x0 - n_x0,
ey: y0 - n_y0
});
a.push({
c1x: x0 - n_x0 - vx01,
c1y: y0 - n_y0 - vy01,
c2x: x0 + n_x0 - vx01,
c2y: y0 + n_y0 - vy01,
ex: x0 + n_x0,
ey: y0 + n_y0
});
a[0].mx = a[0].mx.toFixed(1);
a[0].mx = parseFloat(a[0].mx);
a[0].my = a[0].my.toFixed(1);
a[0].my = parseFloat(a[0].my);
for (var i = 1; i < a.length; i++) {
a[i].c1x = a[i].c1x.toFixed(1);
a[i].c1x = parseFloat(a[i].c1x);
a[i].c1y = a[i].c1y.toFixed(1);
a[i].c1y = parseFloat(a[i].c1y);
a[i].c2x = a[i].c2x.toFixed(1);
a[i].c2x = parseFloat(a[i].c2x);
a[i].c2y = a[i].c2y.toFixed(1);
a[i].c2y = parseFloat(a[i].c2y);
a[i].ex = a[i].ex.toFixed(1);
a[i].ex = parseFloat(a[i].ex);
a[i].ey = a[i].ey.toFixed(1);
a[i].ey = parseFloat(a[i].ey);
}
return a;
},
bethelDraw: function(point, is_fill, color) {
var ctx = this.ctx;
ctx.beginPath();
ctx.moveTo(point[0].mx, point[0].my);
if (undefined != color) {
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
} else {
ctx.setFillStyle(point[0].color);
ctx.setStrokeStyle(point[0].color);
}
for (var i = 1; i < point.length; i++) {
ctx.bezierCurveTo(point[i].c1x, point[i].c1y, point[i].c2x, point[i].c2y, point[i].ex, point[i].ey);
}
ctx.stroke();
if (undefined != is_fill) {
ctx.fill(); // ( , )
}
ctx.draw(true)
},
setCanvasBg: function(color) {
this.ctx.rect(0, 0, this.canvasWidth, this.canvasHeight - 4);
this.ctx.setFillStyle(color);
this.ctx.fill();
this.ctx.draw();
},
showsign: function() {
this.doing = true;
this.$nextTick(() => {
this.ctx = uni.createCanvasContext('handsign', this);
var query = uni.createSelectorQuery();
var thos = this;
query.in(this).select('.handsign').boundingClientRect(function(rect) {
thos.canvasWidth = rect.width;
thos.canvasHeight = rect.height;
thos.setCanvasBg('#ffffff');
}).exec();
});
},
btn_close: function() {
this.doing = false;
},
btn_clear: function() {
this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
this.ctx.draw();
this.setCanvasBg("#ffffff");
this.linePrack = [];
},
btn_done: function() {
var thos = this;
if (this.linePrack.length == 0)
return this.toast('请签名后再点击完成');
uni.canvasToTempFilePath({
canvasId: 'handsign',
fileType: 'png',
quality: 1,
success: res => {
var updata = {};
updata._uid = this.getstorage("uid"); //UserID
updata._sid = this.getstorage("sid"); //SID
updata.imgact = thos.imgact;
updata.imgrotate = '90';
uni.uploadFile({
url: this.uploadurl,
filePath: res.tempFilePath,
name: 'file',
formData: updata,
header: {
'ciyauth': this.getstorage("_auth"),
'ciyorg': this.getstorage("_org")
},
success: res => {
var jsonup = this.json_parse(res.data);
if (jsonup === null)
jsonup = {
result: false,
msg: 'JSON Parse ERROR:' + res.data.substr(0, 30)
};
if (jsonup.code != 1) {
return this.alert('上传失败:' + jsonup.errmsg);
}
thos.pic = jsonup.url;
thos.doing = false;
thos.$emit('input', thos.pic);
thos.$emit('change', {
name: thos.name,
from: 'sign',
value: thos.pic
});
}
});
}
}, this);
}
}
}
</script>
<style scoped>
._vtop{
position: fixed;
left: 0;
right: 0;
z-index: 1;
}
.lbtn {
transform: rotate(90deg);
position: absolute;
white-space: nowrap;
}
</style>

View File

@ -0,0 +1,185 @@
<template>
<view class="_header_all" v-if="headershow">
<template v-if="mode=='title'">
<view class="_header_title bg2" :style="{height:header_statusbar_height+'px'}"></view>
<view class="_header_title bg2" :style="{height:header_title_height+'px',lineHeight:header_title_height+'px'}">
<view class="_header_btn">
<view v-if="hasbackbtn" @tap="goback" class="_header_title_btn">
<view class="itm _back"></view>
</view>
<view v-else @tap="gourl" :data-url="mainpage" class="_header_title_btn">
<view class="itm _home"></view>
</view>
</view>
<slot>
<view class="_header_title_text" :style="{margin:'0 '+header_title_margin+'px'}">{{title}}</view>
</slot>
</view>
</template>
<template v-if="mode=='tran'">
<view class="_header_title" :style="{height:header_statusbar_height+'px'}"></view>
<view class="_header_title" :style="{height:header_title_height+'px',lineHeight:header_title_height+'px'}">
<view class="_header_btn">
<view v-if="hasbackbtn" @tap="goback" class="_header_tran_btn">
<view class="itm _back"></view>
</view>
<view v-else @tap="gourl" :data-url="mainpage" class="_header_tran_btn">
<view class="itm _home"></view>
</view>
</view>
<slot></slot>
</view>
</template>
<template v-if="mode=='scroll'">
<view :style="{opacity:opac}" style="background:linear-gradient(21deg, var(--e-headerbg1), var(--e-headerbg2));">
<view class="_header_title" :style="{height:header_statusbar_height+'px'}"></view>
<view class="_header_title" :style="{height:header_title_height+'px',lineHeight:header_title_height+'px'}">
<view class="_header_btn">
<view v-if="hasbackbtn" @tap="goback" class="_header_title_btn">
<view class="itm _back"></view>
</view>
<view v-else @tap="gourl" :data-url="mainpage" class="_header_title_btn">
<view class="itm _home"></view>
</view>
</view>
<slot>
<view class="_header_title_text" :style="{margin:'0 '+header_title_margin+'px'}">{{title}}</view>
</slot>
</view>
</view>
</template>
</view>
<view :style="{height:seatheight+'px'}" v-if="headershow"></view>
</template>
<style scoped>
._header_all {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 990;
color: var(--txt9);
}
._header_title {
position: relative;
overflow: hidden;
}
._header_btn {
position: absolute;
top: 0;
left: 0;
bottom: 0;
display: flex;
align-items: center;
}
._header_title_text {
text-align: center;
font-size: 1.2em;
}
._header_title_btn {
padding: 0.3em;
margin-left: 0.1em;
}
._header_title_btn>.itm {
width: 1.5em;
height: 1.5em;
}
._header_tran_btn {
padding: 0.3em;
margin-left: 0.3em;
border-radius: 50%;
background-color: #dddddd88;
}
._header_tran_btn>.itm {
width: 1.5em;
height: 1.5em;
}
._back {
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0iIzc3Nzc3NyIgZD0iTTc0NC4zMzcyNTYzIDEwMTcuMTM2OTI0NDVjMTEuMTI4OTgzNyAwIDIyLjI3MDEwMzctNC4yNDc3MDM3IDMwLjc2NTUxMTExLTEyLjc0MzExMTEyIDE2Ljk5MDgxNDgyLTE2Ljk5MDgxNDgyIDE2Ljk5MDgxNDgyLTQ0LjU0MDIwNzQxIDAtNjEuNTE4ODg1OTJMMzQ1LjAyODgzNTU1IDUxMi44MDA5OTU1NSA3NzUuMTAyNzY3NDEgODIuNzM5MmMxNi45OTA4MTQ4Mi0xNi45Nzg2Nzg1MiAxNi45OTA4MTQ4Mi00NC41NDAyMDc0MSAwLTYxLjUxODg4NTkyLTE2Ljk5MDgxNDgyLTE2Ljk5MDgxNDgyLTQ0LjUyODA3MTExLTE2Ljk5MDgxNDgyLTYxLjUxODg4NTkzIDBMMjUyLjc0NDQzODUyIDQ4Mi4wNDc2MjA3NWE0My41MTQ2OTAzNyA0My41MTQ2OTAzNyAwIDAgMCAwIDYxLjUzMTAyMjIybDQ2MC44Mzk0NDI5NiA0NjAuODE1MTcwMzZjOC40ODMyNzExMSA4LjQ5NTQwNzQxIDE5LjYyNDM5MTExIDEyLjc0MzExMTExIDMwLjc1MzM3NDgyIDEyLjc0MzExMTEyeiI+PC9wYXRoPjwvc3ZnPg==");
}
._home {
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIzMC40IDk5MmMtNjQgMC0xMTUuMi01MS4yLTExNS4yLTExNS4yTDExNS4yIDU0NCA3Ni44IDU4Mi40QzcwLjQgNTg4LjggNTcuNiA1OTUuMiA0NC44IDU5NS4yYy0xMi44IDAtMjUuNi02LjQtMzItMTIuOEM2LjQgNTY5LjYgMCA1NTYuOCAwIDU0NCAwIDUzNy42IDYuNCA1MjQuOCAxMi44IDUxMmw0NjcuMi00NjcuMkM0ODYuNCAzOC40IDQ5OS4yIDMyIDUxMiAzMnMyNS42IDYuNCAzMiAxMi44TDEwMTEuMiA1MTJDMTAxNy42IDUyNC44IDEwMjQgNTM3LjYgMTAyNCA1NDRjMCAxMi44LTYuNCAyNS42LTEyLjggMzItNi40IDYuNC0xOS4yIDEyLjgtMzIgMTIuOHMtMjUuNi02LjQtMzItMTIuOEw1MTIgMTQ3LjIgMjExLjIgNDQ4bDAgNDIyLjRjMCAxMi44IDEyLjggMjUuNiAyNS42IDI1LjZsMTE1LjIgMCAwLTE4NS42YzAtMjUuNiAxOS4yLTQ0LjggNDQuOC00NC44bDIzMC40IDBjMjUuNiAwIDQ0LjggMTkuMiA0NC44IDQ0LjhzLTE5LjIgNDQuOC00NC44IDQ0LjhMNDQxLjYgNzU1LjJsMCAxODUuNmMwIDI1LjYtMTkuMiA0NC44LTQ0LjggNDQuOEwyMzAuNCA5ODUuNnpNNjI3LjIgOTkyYy0yNS42IDAtNDQuOC0xOS4yLTQ0LjgtNDQuOCAwLTI1LjYgMTkuMi00NC44IDQ0LjgtNDQuOGwxNjAgMGMxMi44IDAgMjUuNi0xMi44IDI1LjYtMjUuNmwwLTI1NmMwLTI1LjYgMTkuMi00NC44IDQ0LjgtNDQuOCAyNS42IDAgNDQuOCAxOS4yIDQ0LjggNDQuOGwwIDI1NmMwIDY0LTUxLjIgMTE1LjItMTE1LjIgMTE1LjJMNjI3LjIgOTkyeiIgZmlsbD0iIzc3Nzc3NyI+PC9wYXRoPjwvc3ZnPg==");
}
</style>
<script>
export default {
props: {
mode: {
type: String,
default: 'title'
},
title: {
type: String,
default: ''
}
},
data() {
return {
headershow: true,
hasbackbtn: false,
header_statusbar_height: 0,
header_title_height: 40,
header_title_margin: 0,
mainpage: '',
opac: 0,
};
},
watch: {},
computed: {
seatheight() {
if (this.mode == 'title')
return this.header_statusbar_height + this.header_title_height;
return 0;
}
},
mounted() {
//#ifdef H5
if (process.env.NODE_ENV !== 'development') {
this.headershow = false;
return;
}
//#endif
var app = getApp();
this.header_statusbar_height = app.globalData._header_statusbar_height;
this.header_title_height = app.globalData._header_title_height;
this.header_title_margin = app.globalData._header_title_margin;
this.mainpage = app.globalData.mainpage;
if (getCurrentPages().length > 1)
this.hasbackbtn = true;
this.scrollname = this.title;
if (this.mode == 'scroll')
app.globalData.scrollcbs['header' + this.scrollname] = e => {
var sc = e.scrollTop - this.header_statusbar_height - this.header_title_height;
if (sc < 0) {
this.opac = 0;
} else if (sc < this.header_title_height) {
this.opac = sc / this.header_title_height;
} else {
this.opac = 1;
}
}
},
unmounted() {
if (this.mode == 'scroll')
delete getApp().globalData.scrollcbs['header' + this.scrollname];
},
methods: {
Getheight() {
return this.seatheight;
},
goback() {
uni.navigateBack();
}
}
}
</script>

View File

@ -0,0 +1,150 @@
<template>
<input class="_input" :style="ciystyle" :type="type" :name="name" :value="txtvalue" :password="password" :placeholder="placeholder" :disabled="disabled" :maxlength="maxlength" :confirm-type="confirmType" @input="textinput" @focus="textfocus" @blur="textblur" @confirm="textconfirm" :cursor-spacing="120" :class="{_bb:bb,_left:left,_disabled:disabled}" />
</template>
<script>
export default {
options: {
virtualHost: true
},
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue', 'focus', 'blur'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number],
default: ''
},
value: {
type: [String, Number],
default: ''
},
initevent: {
type: Boolean,
default: false
},
type: {
type: String, //textnumberidcarddigit :safe-passwordnickname
default: 'text'
},
ciystyle: {
type: [String, Object]
},
password: {
type: Boolean,
default: false
},
bb: { //
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
placeholder: {
type: String,
default: ''
},
disabled: {
type: Boolean,
default: false
},
maxlength: {
type: Number,
default: 180
},
confirmType: {
type: String, // sendsearchnextgodone
default: 'done'
}
},
data() {
return {};
},
watch: {},
computed: {
txtvalue() {
if (typeof(this.modelValue) == 'number')
return this.modelValue;
if (typeof(this.value) == 'number')
return this.value;
if (this.modelValue)
return this.modelValue;
if (this.value)
return this.value;
return '';
}
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.txtvalue
});
}
},
methods: {
textfocus(e) {
this.$emit('focus', e);
},
textblur(e) {
this.$emit('blur', e);
},
textinput(e) {
var txt = e.detail.value;
if (txt === undefined)
txt = e.data;
this.$emit('update:modelValue', txt);
this.$emit('change', {
name: this.name,
from: 'input',
value: txt
});
},
textconfirm(e) {
var txt = e.detail.value;
if (txt === undefined)
txt = e.data;
this.$emit('update:modelValue', txt);
this.$emit('change', {
name: this.name,
from: 'confirm',
value: txt
});
}
}
}
</script>
<style scoped>
._input {
font-size: 1em;
height: 1em;
width: inherit;
padding: 0 0.5em;
}
._input._left {
text-align: left;
}
._input._disabled {
color: var(--txt1);
}
._input._bb._disabled {
background: var(--bg4);
}
._input._bb {
background: var(--bg1);
text-align: left;
padding: 0.5em;
border-radius: 0.5em;
border: 1px solid var(--bg5);
}
</style>

View File

@ -0,0 +1,190 @@
<template>
<view class="_input" :class="{_bb:bb,_left:left,_disabled:disabled}">
<input type="hidden" :name="name" :value="tvalue" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_unit'" :value="unit" style="display:none;" />
<input type="digit" :name="hasmore?name+'_num':''" :class="{_disabled:disabled}" :value="txvalue" :placeholder="placeholder" :confirm-type="confirmType" @input="textinput" @focus="textfocus" @blur="textblur" @confirm="textconfirm" :cursor-spacing="120" :disabled="disabled" :style="ciystyle" />
<view class="_unit" :class="{_disabled:disabled}">{{unit}}</view>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue', 'focus', 'blur'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number],
default: ''
},
value: {
type: [String, Number],
default: ''
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
bb: { //
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
ciystyle: {
type: [String, Object],
default: {
width: '4em'
}
},
placeholder: {
type: String,
default: ''
},
bet: {
type: [String, Number],
default: 1
},
unit: {
type: [String],
default: ""
},
confirmType: {
type: String, // sendsearchnextgodone
default: 'done'
}
},
data() {
return {
tvalue: 0
};
},
watch: {},
computed: {
txvalue() {
var v = 0;
if (this.modelValue)
v = this.toint(this.modelValue);
if (this.value)
v = this.toint(this.value);
this.tvalue = v;
return this.tofix(v / this.mybet, -4);
},
mybet() {
var bet = this.toint(this.bet);
if (bet < 1)
bet = 1;
return bet;
},
},
mounted() {
this.tvalue = this.txvalue * this.mybet;
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.tvalue
});
}
},
methods: {
textfocus(e) {
this.$emit('focus', e);
},
textblur(e) {
this.$emit('blur', e);
var txt = e.detail.value;
if (txt === undefined)
txt = e.data;
txt = this.toint(this.tofloat(txt) * this.mybet);
this.tvalue = txt;
this.$emit('update:modelValue', txt);
},
textinput(e) {
var txt = e.detail.value;
if (txt === undefined)
txt = e.data;
txt = this.toint(this.tofloat(txt) * this.mybet);
this.tvalue = txt;
this.$emit('change', {
name: this.name,
from: 'input',
value: txt
});
},
textconfirm(e) {
var txt = e.detail.value;
if (txt === undefined)
txt = e.data;
txt = this.toint(this.tofloat(txt) * this.mybet);
this.tvalue = txt;
this.$emit('update:modelValue', txt);
this.$emit('change', {
name: this.name,
from: 'confirm',
value: txt
});
}
}
}
</script>
<style scoped>
._input {
padding: 0;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 0.5em;
}
._input._left {
justify-content: flex-start;
}
._input input {
font-size: 1em;
height: 1em;
text-align: right;
}
._input._bb {
gap: 0;
}
._input._bb input {
background: var(--bg1);
padding: 0.5em;
border-radius: 0.5em 0 0 0.5em;
border: 1px solid var(--bg5);
}
._input._bb ._unit {
background: var(--bg1);
padding: 0.5em;
height: 2.5em;
border-radius: 0 0.5em 0.5em 0;
border: 1px solid var(--bg5);
}
._input._bb ._disabled {
background: var(--bg3);
color: var(--txt1);
}
._input ._disabled {
color: var(--bg7);
}
</style>

View File

@ -0,0 +1,215 @@
<template>
<view class="_cyc" :class="{_bb:bb,_left:left,_disabled:disabled}">
<input type="hidden" :name="name" :value="tvalue" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_num'" :value="num" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_unit'" :value="unit" style="display:none;" />
<ciy-input @change="chgnum" :disabled="disabled" style="width:4em;" v-model="num"></ciy-input>
<view class="_unit">
<ciy-select @change="chgunit" :disabled="disabled" v-model="unit" :rows="trowcnt" align="center" :range="trange"></ciy-select>
</view>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number],
default: ''
},
value: {
type: [String, Number],
default: ''
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
bb: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
range: {
type: String,
default: 'month,day,min'
},
},
data() {
return {
v: '',
num: 0,
unit: ''
};
},
watch: {
value: {
handler(newD, oldD) {
this.setvalue(newD, oldD);
}
},
modelValue: {
handler(newD, oldD) {
this.setvalue(newD, oldD);
}
},
},
computed: {
tvalue() {
if (this.unit == 'month') {
return -this.toint(this.num);
} else if (this.unit == 'day') {
return this.toint(this.num) * 86400;
} else if (this.unit == 'hour') {
return this.toint(this.num) * 3600;
} else if (this.unit == 'min') {
return this.toint(this.num) * 60;
} else {
return this.num;
}
},
trange() {
var rg = [];
var rs = this.range.split(',');
for (var i = 0; i < rs.length; i++) {
rg.push({
id: rs[i],
name: this.lang('cyc.' + rs[i])
})
}
return rg;
},
trowcnt() {
var cnt = this.range.split(',').length;
if(cnt > 4)
return 3;
return cnt;
},
},
mounted() {
this.setvalue(this.value || this.modelValue);
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.tvalue,
num: this.num,
unit: this.unit
});
}
},
methods: {
setvalue(val, old) {
var vi = this.toint(val);
if (vi == 0)
vi = 86400;
var unit = 'day';
var num = 0;
if (vi < 0) {
unit = 'month';
num = -vi;
} else if (vi % 86400 == 0) {
unit = 'day';
num = this.toint(vi / 86400);
} else if (vi % 3600 == 0) {
unit = 'hour';
num = this.toint(vi / 3600);
} else if (vi % 60 == 0) {
unit = 'min';
num = this.toint(vi / 60);
} else {
unit = 'sec';
num = this.toint(vi);
}
if (this.unit != unit)
this.unit = unit;
if (this.num != num)
this.num = num;
},
chgnum(e) {
this.$emit('update:modelValue', this.tvalue);
this.$emit('change', {
name: this.name,
from: 'num',
value: this.tvalue,
num: this.toint(this.num),
unit: this.unit
});
},
chgunit(e) {
this.$emit('update:modelValue', this.tvalue);
this.$emit('change', {
name: this.name,
from: 'unit',
value: this.tvalue,
num: this.num,
unit: this.unit
});
}
}
}
</script>
<style scoped>
._cyc {
padding: 0;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 0.5em;
}
._cyc._left {
justify-content: flex-start;
}
._cyc input {
font-size: 1em;
height: 1em;
text-align: right;
}
._cyc._bb {
gap: 0;
}
._cyc._bb input {
background: var(--bg1);
padding: 0.5em;
border-radius: 0.5em 0 0 0.5em;
border: 1px solid var(--bg5);
}
._cyc._bb ._unit {
background: var(--bg1);
padding: 0.5em;
height: 2.5em;
border-radius: 0 0.5em 0.5em 0;
border: 1px solid var(--bg5);
}
._cyc._bb._disabled input {
background: var(--bg3);
color: var(--txt1);
}
._cyc._bb._disabled ._unit {
background: var(--bg3);
color: var(--txt1);
}
</style>

View File

@ -0,0 +1,185 @@
<template>
<view style="position: relative;" :style="{textAlign:left?'left':'right'}">
<input type="hidden" :name="name" :value="tvalue" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_date1'" :value="date1" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_date2'" :value="date2" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_str1'" :value="todatetime(date1,btime?'':'d')" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_str2'" :value="todatetime(date2,btime?'':'d')" style="display:none;" />
<ciy-inputdatetime :disabled="disabled" @change="chg" class="_dt" v-model="date1" :bordercolor="bordercolor" clearbtn :placeholder="placeholder" :btime="btime" :selectbg="selectbg" :selecttextcolor="selecttextcolor" :weekmonday="weekmonday" :diastema="diastema"></ciy-inputdatetime>
<view class="_spn">~</view>
<ciy-inputdatetime :disabled="disabled" @change="chg" class="_dt" v-model="date2" :bordercolor="bordercolor" clearbtn :placeholder="placeholder" :btime="btime" :selectbg="selectbg" :selecttextcolor="selecttextcolor" :weekmonday="weekmonday" :diastema="diastema"></ciy-inputdatetime>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: String,
default: ''
},
value: {
type: String,
default: ''
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
placeholder: {
type: String
},
btime: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
bordercolor: {
type: String,
default: 'var(--bg6)'
},
selecttextcolor: {
type: String,
default: 'var(--man5)'
},
selectbg: {
type: String,
default: 'var(--bg1)'
},
weekmonday: {
type: Boolean,
default: false
},
diastema: { //
type: Number,
default: 16
},
},
data() {
return {
v: '',
date1: 0,
date2: 0
};
},
watch: {
value: {
handler(newD, oldD) {
this.setvalue(newD, oldD);
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
this.setvalue(newD, oldD);
},
immediate: true
},
},
computed: {
tvalue() {
if (this.date1 && this.date2) {
if (this.date1 < this.date2)
return this.todatetime(this.date1, this.btime ? '' : 'd') + '~' + this.todatetime(this.date2, this.btime ? '' : 'd');
else
return this.todatetime(this.date2, this.btime ? '' : 'd') + '~' + this.todatetime(this.date1, this.btime ? '' : 'd');
} else if (this.date1) {
return this.todatetime(this.date1, this.btime ? '' : 'd') + '~';
} else if (this.date2) {
return '~' + this.todatetime(this.date2, this.btime ? '' : 'd');
}
}
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.tvalue ? this.tvalue : '',
date1: this.date1,
date2: this.date2
});
}
},
methods: {
setvalue(val, old) {
var vals = (val || '').split('~');
if (vals.length < 2) {
if (this.date1 != 0)
this.date1 = 0;
if (this.date2 != 0)
this.date2 = 0;
return;
}
var date1 = new Date(vals[0]);
var date2 = new Date(vals[1]);
if (isNaN(date1.getTime()))
date1 = 0;
else
date1 = this.tostamp(date1);
if (isNaN(date2.getTime()))
date2 = 0;
else
date2 = this.tostamp(date2);
if (this.date1 != date1)
this.date1 = date1;
if (this.date2 != date2)
this.date2 = date2;
},
chg(e) {
if (e.from != 'done')
return;
this.$emit('update:modelValue', this.tvalue);
this.$emit('change', {
name: this.name,
from: 'value',
value: this.tvalue ? this.tvalue : '',
date1: this.date1,
date2: this.date2
});
}
}
}
</script>
<style scoped>
._dt {
display: inline-block;
margin-left: 0.3em;
text-align: center;
padding: 0.5em;
border-radius: 0.5em;
}
._dtx {
min-width: 7em;
display: inline-block;
margin-left: 0.3em;
text-align: center;
background: var(--bg2);
border: 1px solid var(--bg6);
padding: 0.5em;
border-radius: 0.5em;
}
._spn {
display: inline-block;
margin: 0 0 0 0.3em;
}
</style>

View File

@ -0,0 +1,543 @@
<template>
<view style="position: relative;">
<input type="hidden" :name="name" :value="tostamp(tvalue)" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_date'" :value="todatetime(tvalue,btime?'':(selectmonth?'m':'d'))" style="display:none;" />
<view class="_show" :class="{_left:left,_disabled:disabled}" @tap="showpop" v-if="tostamp(tvalue)==0" style="color:var(--txt1)">{{placeholder===undefined?lang('placeholder.select'):placeholder}}</view>
<view class="_show" :class="{_left:left,_disabled:disabled}" @tap="showpop" v-else>{{todatetime(tvalue,btime?'':(selectmonth?'m':'d'))}}</view>
<view class="_mask" v-if="popclass" @tap="hidepop"></view>
<view class="_pop" :animation="anidatapop" v-if="popclass" :class="popclass">
<view class="_main" :class="popclass">
<view class="ciy-hr" style="flex:none;"></view>
<ciy-calendar :selectmonth="selectmonth" :value="vdate" @change="chgcalendar" v-if="cpage == 0" name="tp" :mindate="mindate" :maxdate="maxdate" :weekmonday="weekmonday" :selectbg="selectbg" :bordercolor="bordercolor" :selecttextcolor="selecttextcolor" :clearbtn="clearbtn"></ciy-calendar>
<view v-if="cpage == 1" class="_shour">
<view class="itm" v-for="(_,val) in 24" @tap="clkhour(val)" :style="val==vhour?'font-weight:bolder;color:var(--man5);':''">
{{val}}
</view>
</view>
<view v-if="cpage == 2" class="_smin" :class="popclass">
<view class="_smin2">
<view class="itm" v-for="(_,val) in 10" @tap="clkmin2(val)" :style="val==vminute2?'font-weight:bolder;color:var(--man5);':''">
{{val}}
</view>
</view>
<view class="ciy-hr"></view>
<view class="_smin1">
<view class="itm" v-for="(_,val) in 6" @tap="clkmin1(val)" :style="val==vminute1?'font-weight:bolder;color:var(--man5);':''">
{{val*10}}
</view>
</view>
</view>
<view class="_selcard" v-if="btime">
<view class="itm" :class="{_sel:cpage==0}" @tap="clkpage(0)">
<view>{{todatetime(vdate,'y', ' ')}}</view>
<view>{{todatetime(vdate,'x', ' ')}}</view>
<view class="_txt">{{lang('inputdate.date')}}</view>
</view>
<view class="itm" :class="{_sel:cpage==1}" @tap="clkpage(1)">
<view style="font-size:2em;">{{topad0(vhour,2)}}</view>
<view class="_txt">{{lang('inputdate.hour')}}</view>
</view>
<view class="itm" :class="{_sel:cpage==2}" @tap="clkpage(2)">
<view style="font-size:2em;">{{topad0(vminute1*10+vminute2,2)}}</view>
<view class="_txt">{{lang('inputdate.minute')}}</view>
</view>
<view class="itm _bbtn" :class="popclass">
<view class="btn def" @tap="today">{{lang('inputdate.now')}}</view>
<view class="btn" @tap="done">{{lang('inputdate.done')}}</view>
</view>
</view>
<view class="ciy-hr"></view>
</view>
</view>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number, Date],
default: ''
},
value: {
type: [String, Number, Date],
default: ''
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
placeholder: {
type: String
},
btime: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
bordercolor: {
type: String,
default: 'var(--bg6)'
},
selecttextcolor: {
type: String,
default: 'var(--man5)'
},
selectbg: {
type: String,
default: 'var(--bg1)'
},
selectmonth: {
type: Boolean,
default: false
},
weekmonday: {
type: Boolean,
default: false
},
mindate: {
type: [String, Number, Date],
default: ''
},
maxdate: {
type: [String, Number, Date],
default: ''
},
clearbtn: {
type: Boolean,
default: false
},
diastema: { //
type: Number,
default: 16
},
},
data() {
return {
v: '',
vdate: 0,
vhour: 0,
vminute1: 0,
vminute2: 0,
cpage: 0,
anidatapop: {},
popclass: ''
};
},
watch: {
value: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'modelValue';
},
immediate: true
}
},
computed: {
tvalue() {
var val = '';
if (this.v == 'modelValue') {
if (typeof(this.modelValue) == 'number')
val = new Date(this.modelValue * 1000);
else if (this.modelValue)
val = this.modelValue;
} else if (this.v == 'value') {
if (typeof(this.value) == 'number')
val = new Date(this.value * 1000);
else if (this.value)
val = this.value;
} else {
val = this.v;
}
if (!(val instanceof Date)) {
if (val.indexOf('-') > -1 || val.indexOf('/') > -1) {
val = this.str2date(val);
} else {
val = this.toint(val);
val = new Date(val * 1000);
}
} else if (isNaN(val.getTime()))
val = new Date();
return val;
},
max() {
var val = this.maxdate;
if (val instanceof Date) {
if (isNaN(val.getTime()))
val = null;
} else if (typeof(val) == 'number') {
val = new Date(val * 1000);
} else if (val.indexOf('-') > -1 || val.indexOf('/') > -1) {
val = this.str2date(val);
} else if (val == 'now') {
val = new Date();
} else {
val = this.toint(val);
if (val == 0)
val = null;
else
val = new Date(val * 1000);
}
return val;
},
min() {
var val = this.mindate;
if (val instanceof Date) {
if (isNaN(val.getTime()))
val = null;
} else if (typeof(val) == 'number') {
val = new Date(val * 1000);
} else if (val.indexOf('-') > -1 || val.indexOf('/') > -1) {
val = this.str2date(val);
} else if (val == 'now') {
val = new Date();
} else {
val = this.toint(val);
if (val == 0)
val = null;
else
val = new Date(val * 1000);
}
return val;
}
},
mounted() {
// var vd = new Date(this.tvalue.getFullYear(), this.tvalue.getMonth(), this.tvalue.getDate());
// vd.setMinutes(-vd.getTimezoneOffset());
// this.vdate = this.tostamp(vd);
var date = this.tostamp(this.onlydate(this.tvalue));
this.vdate = date;
this.vhour = this.tvalue.getHours();
var minute = this.tvalue.getMinutes();
this.vminute1 = parseInt(minute / 10);
this.vminute2 = minute - this.vminute1 * 10;
if (this.vdate == 0 && this.vhour == 8)
this.vhour = 0;
if (this.initevent) {
this.emit('init', this.tvalue, true);
}
},
methods: {
onlydate(val) {
var dt = new Date(val.toLocaleDateString());
dt.setMinutes(-dt.getTimezoneOffset());
return dt;
},
chgcalendar(e) {
var from = 'calendar'; //false value
if (!this.btime || e.from == 'today' || e.from == 'nodate')
from = 'done';
if (from == 'done') {
setTimeout(() => {
this.hidepop();
}, 300);
}
if (e.from == 'nodate') {
this.vhour = 0;
this.vminute1 = 0;
this.vminute2 = 0;
}
this.vdate = e.value;
this.updatevalue(from);
},
updatevalue(from) {
var d = new Date(this.vdate * 1000);
if (this.vdate != 0) {
d.setHours(this.vhour);
d.setMinutes(this.vminute1 * 10 + this.vminute2);
}
if (d.getTime() == this.tvalue.getTime())
return;
this.emit(from, d);
},
emit(from, date) {
if (!this.btime) {
var date = new Date(date.getTime());
if (date.getTime() != 0) {
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
}
}
// if (date.getFullYear() == 1970 && date.getMonth() == 0 && date.getDate() == 1)
// date.setMinutes(-date.getTimezoneOffset());
var stramp = this.tostamp(date);
if (from == 'done') {
this.$emit('update:modelValue', stramp);
this.v = date;
}
this.$emit('change', {
name: this.name,
from: from,
value: stramp,
date: date
});
},
today() {
var dt = new Date();
this.vhour = dt.getHours();
var min = dt.getMinutes();
this.vminute1 = parseInt(min / 10);
this.vminute2 = min - parseInt(min / 10) * 10;
dt.setSeconds(0);
this.vdate = this.tostamp(dt);
//this.updatevalue('today', this.vdate, true);
},
done() {
var date = new Date(this.vdate * 1000);
if (this.vdate != 0) {
date.setHours(this.vhour);
date.setMinutes(this.vminute1 * 10 + this.vminute2);
date.setSeconds(0);
}
this.emit('done', date);
this.hidepop();
},
clkhour(val) {
this.vhour = val;
this.updatevalue('hour');
},
clkmin1(val) {
this.vminute1 = val;
this.updatevalue('minute');
},
clkmin2(val) {
this.vminute2 = val;
this.updatevalue('minute');
},
clkpage(page) {
this.cpage = page;
},
hidepop() {
var app = getApp();
var animation = uni.createAnimation({});
animation.translateX('100vw');
animation.opacity(0);
animation.step({
duration: 200
});
this.anidatapop = animation.export();
setTimeout(() => {
this.popclass = '';
}, 300);
},
async showpop() {
if (this.disabled)
return;
if (this.popclass) {
return this.hidepop();
}
var app = getApp();
app.globalData.scrollcbs['com_datetime'] = e => {
delete app.globalData.scrollcbs['com_datetime'];
this.hidepop();
};
const {
headerheight,
footerheight
} = await this.com_gethdft();
var fixtop = 0;
if (this.fix) {
//fixedabsolutetop
}
this.cpage = 0;
// if (this.tvalue.getTime() == 0)
// this.vdate = this.tostamp();
var showrect = await this.getrect('._show');
if (!showrect) {
return;
}
this.popclass = 'temp';
var mainrect = await this.getrect('._main');
if (!mainrect)
return;
this.vdate = this.tostamp(this.tvalue);
if (this.vdate != 0) {
this.vhour = this.tvalue.getHours();
var minute = this.tvalue.getMinutes();
this.vminute1 = parseInt(minute / 10);
this.vminute2 = minute - this.vminute1 * 10;
} else {
this.vhour = 0;
this.vminute1 = 0;
this.vminute2 = 0;
}
var bott = app.globalData._sysinfo.windowHeight - showrect.bottom - footerheight - this.diastema;
var topcls = '_btm';
var sytop = showrect.bottom + this.diastema - fixtop;
if (bott < mainrect.height) {
sytop = showrect.top - this.diastema - mainrect.height;
if (sytop < headerheight + fixtop)
sytop = headerheight + fixtop;
topcls = '_top';
}
this.popclass = topcls;
this.$nextTick(() => {
var animation = uni.createAnimation({});
animation.translateX(0);
animation.top(sytop);
animation.opacity(1);
animation.step({
duration: 200
});
this.anidatapop = animation.export();
});
}
}
}
</script>
<style scoped>
._show {
white-space: nowrap;
}
._show._left {
text-align: left;
}
._show._disabled {
color: var(--bg7);
}
._smin {
display: flex;
flex-wrap: wrap;
width: 100%;
}
._smin1 {
display: flex;
flex-wrap: wrap;
line-height: 7em;
width: 100%;
}
._smin1>.itm {
text-align: center;
flex: 0 0 16.667%;
}
._smin2 {
display: flex;
flex-wrap: wrap;
line-height: 7em;
width: 100%;
}
._smin2>.itm {
text-align: center;
flex: 0 0 20%;
}
._shour {
display: flex;
flex-wrap: wrap;
line-height: 5.5em;
width: 100%;
}
._shour>.itm {
text-align: center;
flex: 0 0 16.6666%;
}
._selcard {
display: flex;
width: calc(100% - 1em);
margin: 0.5em;
white-space: nowrap;
gap: 0.3em;
}
._selcard ._sel {
background: linear-gradient(33deg, var(--bg1), var(--bg4));
border-radius: 0.5em;
border: 1px solid var(--bg6);
}
._selcard ._txt {
color: var(--txt1);
}
._selcard>.itm {
flex: 1;
text-align: center;
padding: 0.5em 0;
border: 1px solid transparent;
transition: all 0.3s;
height: 5em;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
._selcard ._bbtn {
position: relative;
padding: 0;
display: flex;
flex-direction: column;
flex: none;
}
._pop {
position: fixed;
display: flex;
flex-direction: column;
align-items: flex-start;
transform: translateX(100vw);
opacity: 0;
left: 0;
right: 0;
z-index: 50001;
}
._pop ._main {
background: var(--bg2);
width: 100%;
display: flex;
flex-direction: column;
}
._btm,
._pop ._main._btm,
._selcard ._bbtn._btm {
justify-content: flex-end;
flex-direction: column-reverse;
}
._mask {
position: fixed;
left: 0;
right: 0;
bottom: 0;
top: 0;
z-index: 50001;
flex: 1;
backgroundx: #f3abec99;
}
</style>

View File

@ -0,0 +1,153 @@
<template>
<view class="_input" :class="{_left:left,_disabled:disabled}">
<view class="_btn" @tap="op(-1)">-</view>
<input :name="name" :value="tvalue" @input="textinput" :disabled="disabled" @confirm="textconfirm" :cursor-spacing="120" :style="{width:width}" />
<view class="_btn" @tap="op(1)">+</view>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue', 'input'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number]
},
value: {
type: [String, Number]
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
width: {
type: String,
default: "2em"
},
min: {
type: [String, Number],
default: 1
},
max: {
type: [String, Number],
default: 9999999
}
},
data() {
return {
tvalue: 0
};
},
watch: {
modelValue(n, d) {
this.emit(n, 'watch'); //computed
},
value(n, d) {
this.emit(n, 'watch'); //computed
}
},
computed: {
innervalue() {
var val = 0;
if (this.modelValue)
val = this.toint(this.modelValue);
if (this.value)
val = this.toint(this.value);
if (val > this.max)
val = this.max;
if (val < this.min)
val = this.min;
this.tvalue = val;
return val;
}
},
mounted() {
this.emit(this.innervalue, this.initevent ? 'init' : '');
},
methods: {
emit(val, from) {
val = this.toint(val);
if (val > this.max)
val = this.max;
if (val < this.min)
val = this.min;
if (this.old === val)
return;
if (this.modelValue !== undefined && from != 'watch') {
this.$emit('update:modelValue', val);
} else {}
this.tvalue = val;
if (from) {
this.$emit('change', {
name: this.name,
from: from,
value: val
});
}
this.old = val;
},
textinput(e) {
this.emit(e.detail.value || e.data, 'input');
},
textconfirm(e) {
this.emit(e.detail.value || e.data, 'confirm');
},
op(oe) {
if (this.disabled)
return;
this.emit(this.tvalue + oe, 'op');
}
}
}
</script>
<style scoped>
._input {
padding: 0;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 0.5em;
}
._input._left {
justify-content: flex-start;
}
._input input {
font-size: 1em;
height: 2em;
text-align: center;
}
._btn {
background: linear-gradient(100deg, var(--bg4), var(--bg6));
width: 1.5rem;
height: 1.5rem;
font-size: 1rem;
text-align: center;
line-height: 1.5rem;
border-radius: 0.3em;
}
._input._disabled input {
color: var(--txt1);
}
._input._disabled ._btn {
color: var(--txt1);
background: linear-gradient(100deg, var(--bg3), var(--bg5));
}
</style>

View File

@ -0,0 +1,189 @@
<template>
<view class="rel _input _bb">
<input :style="ciystyle" style="margin-right:3em;" :type="type" :name="name" :value="txtvalue" :placeholder="placeholder" :disabled="disabled" :maxlength="maxlength" :confirm-type="confirmType" @input="textinput" @focus="textfocus" @blur="textblur" @confirm="textconfirm" :cursor-spacing="120" :class="{_left:left,_disabled:disabled}" />
<button class="btn sm def abs r0 t0 b0" style="z-index:10;line-height: 2em;" @tap="ocr">OCR</button>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue', 'focus', 'blur'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number],
default: ''
},
value: {
type: [String, Number],
default: ''
},
initevent: {
type: Boolean,
default: false
},
type: {
type: String, //textnumberidcarddigit :safe-passwordnickname
default: 'text'
},
ciystyle: {
type: [String, Object]
},
bb: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
placeholder: {
type: String,
default: ''
},
height: {
type: String,
default: '66'
},
clktxt: {
type: String,
default: ''
},
disabled: {
type: Boolean,
default: false
},
maxlength: {
type: Number,
default: 140
},
confirmType: {
type: String, // sendsearchnextgodone
default: 'done'
}
},
data() {
return {
v: '',
};
},
watch: {
value: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'modelValue';
},
immediate: true
}
},
computed: {
txtvalue() {
var val = '';
if (this.v == 'modelValue') {
val = this.modelValue + '';
} else if (this.v == 'value') {
val = this.value + '';
} else {
val = this.v;
}
return val;
}
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.txtvalue
});
}
},
methods: {
textfocus(e) {
this.$emit('focus', e);
},
textblur(e) {
this.$emit('blur', e);
},
textinput(e) {
var txt = e.detail.value;
if (txt === undefined)
txt = e.data;
this.$emit('update:modelValue', txt);
this.$emit('change', {
name: this.name,
from: 'input',
value: txt
});
},
textconfirm(e) {
var txt = e.detail.value;
if (txt === undefined)
txt = e.data;
this.$emit('update:modelValue', txt);
this.$emit('change', {
name: this.name,
from: 'confirm',
value: txt
});
},
ocr(e) {
var app = getApp();
app.globalData.ciy_page_ocr = {
txt: this.txtvalue,
clktxt: this.clktxt ? this.clktxt.split(',') : []
};
uni.navigateTo({
url: '/pages/pub/ocrdata',
events: {
writedata: data => {
this.v = data;
this.$emit('update:modelValue', this.v);
this.$emit('change', {
name: this.name,
from: 'ocr',
value: this.v
});
}
}
});
}
},
}
</script>
<style scoped>
._input {
font-size: 1em;
height: 1em;
width: inherit;
padding: 0 0.5em;
}
._input._left {
text-align: left;
}
._input._disabled {
color: var(--txt1);
}
._input._bb {
background: var(--bg1);
text-align: left;
padding: 0.5em;
border-radius: 0.5em;
border: 1px solid var(--bg5);
height:2.5em;
}
</style>

View File

@ -0,0 +1,144 @@
<template>
<view class="_tp" :class="{_left:left,_disabled:disabled}">
<input type="hidden" :name="name" :value="innervalue" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_name'" :value="hour+':'+minute+(bsec?':' + sec:'')" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_hour'" :value="hour" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_min'" :value="minute" style="display:none;" />
<input v-if="hasmore && bsec" type="hidden" :name="name+'_sec'" :value="sec" style="display:none;" />
<ciy-select v-model="hour" :disabled="disabled" :diastema="diastema" noarrow :rows="6" itemalign="center" :minselectsearch="100" :range="hours" :ciystyle="{width:'2em',textAlign:'center'}" @change="chg"></ciy-select>
:
<ciy-select v-model="minute" :disabled="disabled" :diastema="diastema" noarrow :rows="5" itemalign="center" :minselectsearch="100" :range="minutes" :ciystyle="{width:'2em',textAlign:'center'}" @change="chg"></ciy-select>
<template v-if="bsec">
:
<ciy-select v-model="sec" :disabled="disabled" :diastema="diastema" noarrow :rows="5" itemalign="center" :minselectsearch="100" :range="minutes" :ciystyle="{width:'2em',textAlign:'center'}" @change="chg"></ciy-select>
</template>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number]
},
value: {
type: [String, Number]
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
bsec: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
diastema: { //
type: Number,
default: 16
}
},
data() {
return {
innervalue: this.modelValue !== undefined ? this.modelValue : this.value,
hours: [],
minutes: [],
hour: 0,
minute: 0,
sec: 0
};
},
watch: {
modelValue(newD) {
if (newD !== undefined) {
this.innervalue = newD;
}
},
value(newD) {
if (this.modelValue === undefined) {
this.innervalue = newD;
}
},
innervalue: {
handler(newD, oldD) {
var time = this.toint(newD);
if (time <= 0 || time > 86400)
return;
time--;
this.hour = this.toint(time / 3600);
this.minute = this.toint((time - this.hour * 3600) / 60);
this.sec = time - this.hour * 3600 - this.minute * 60;
},
immediate: true
},
},
computed: {},
mounted() {
for (var i = 0; i < 24; i++)
this.hours.push({
id: i,
name: this.topad0(i, 2)
});
for (var i = 0; i < 60; i++)
this.minutes.push({
id: i,
name: this.topad0(i, 2)
});
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.innervalue
});
}
},
methods: {
updatevalue() {
this.innervalue = this.hour * 3600 + this.minute * 60 + 1;
if (this.bsec)
this.innervalue += this.sec;
},
chg(e) {
if (this.disabled)
return;
this.updatevalue();
this.$emit('update:modelValue', this.innervalue);
this.$emit('change', {
name: this.name,
from: 'click',
value: this.innervalue
});
}
}
}
</script>
<style scoped>
._tp {
display: flex;
justify-content: flex-end;
}
._tp._left {
justify-content: start;
}
._tp._disabled {
color: var(--bg7);
}
</style>

View File

@ -0,0 +1,188 @@
<template>
<view class="_unitedit" :class="{_left:left}">
<input type="hidden" :name="name" :value="tvalue" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_unit1'" :value="unit1" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_num12'" :value="num12" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_unit2'" :value="unit2" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_num23'" :value="num23" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_unit3'" :value="unit3" style="display:none;" />
<ciy-input @change="chg" :disabled="disabled" v-model="unit1" class="_unit" type="text" />
<ciy-input @change="chg" :disabled="disabled" v-model="num12" class="_num" type="number" />
<ciy-input @change="chg" :disabled="disabled" v-model="unit2" class="_unit" type="text" />
<ciy-input @change="chg" :disabled="disabled" v-model="num23" class="_num" type="number" />
<ciy-input @change="chg" :disabled="disabled" v-model="unit3" class="_unit" type="text" />
</view>
</template>
<style scoped>
._unitedit {
display: flex;
align-items: center;
justify-content: flex-end;
}
._unitedit._left {
justify-content: start;
}
._unitedit ._unit {
width: 3em;
text-align: center;
padding: 0.5em 0px;
border: 1px solid var(--bg6);
background: var(--bg1);
border-radius: 0.3em;
}
._unitedit ._num {
width: 3em;
text-align: center;
margin-top: 0.3em;
padding: 0.3em 0;
font-size: 0.7em;
border-top: 1px solid var(--bg6);
border-left: none;
border-right: none;
border-bottom: 1px solid var(--bg6);
background: var(--bg2);
}
._unitedit ._num._disabled {
background: var(--bg5);
}
._unitedit ._unit._disabled {
background: var(--bg4);
}
</style>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: String,
default: ''
},
value: {
type: String,
default: ''
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
},
data() {
return {
unit1: '',
unit2: '',
unit3: '',
num12: '',
num23: '',
};
},
watch: {
value: {
handler(newD, oldD) {
this.setvalue(newD, oldD);
}
},
modelValue: {
handler(newD, oldD) {
this.setvalue(newD, oldD);
}
},
},
computed: {
tvalue() {
if (this.unit1) {
var num12 = this.toint(this.num12);
var num23 = this.toint(this.num23);
if (this.unit2 && num12 > 0 && this.unit2 != this.unit1) {
if (this.unit3 && num23 > 0 && this.unit3 != this.unit1 && this.unit3 != this.unit2)
return this.unit1 + '|' + num12 + '|' + this.unit2 + '|' + num23 + '|' + this.unit3;
else
return this.unit1 + '|' + num12 + '|' + this.unit2;
} else
return this.unit1;
} else
return "";
},
},
mounted() {
this.setvalue(this.value || this.modelValue);
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.tvalue,
unit1: this.unit1,
unit2: this.unit2,
unit3: this.unit3,
num12: this.num12,
num23: this.num23,
});
}
},
methods: {
setvalue(val, old) {
var us = val.split('|'); // |24| |24||20|
this.unit1 = '';
this.unit2 = '';
this.unit3 = '';
this.num12 = '';
this.num23 = '';
if (this.unit1 != us[0])
this.unit1 = us[0];
if (us.length < 3)
return;
var num = this.toint(us[1]);
if (num <= 0 || !us[2])
return;
if (this.num12 != num)
this.num12 = num;
if (this.unit2 != us[2])
this.unit2 = us[2];
if (us.length < 5)
return;
num = this.toint(us[3]);
if (num <= 0 || !us[4])
return;
if (this.num23 != num)
this.num23 = num;
if (this.unit3 != us[4])
this.unit3 = us[4];
},
chg(e) {
this.$emit('update:modelValue', this.tvalue);
this.$emit('change', {
name: this.name,
from: 'input',
value: this.tvalue,
unit1: this.unit1,
unit2: this.unit2,
unit3: this.unit3,
num12: this.num12,
num23: this.num23,
});
}
}
}
</script>

View File

@ -0,0 +1,74 @@
<template>
<view>
<view v-if="listlen==0">
<view class="_vlistnodata">
<image v-if="nodataimg" :src="nodataimg" mode="widthFix" />
<view>{{nodatamsg?nodatamsg:lang('list.nodatamsg')}}</view>
</view>
</view>
<view class="_vlistend" v-if="listlen > 0 && page < 0"> </view>
<view class="_obs_listend"></view>
</view>
</template>
<script>
export default {
emits: ['show'],
props: {
listlen: {
type: Number,
default: 0
},
page: {
type: Number,
default: 0
},
nodatamsg: {
type: String
},
nodataimg: {
type: String,
default: ''
}
},
data() {
return {};
},
mounted() {
this.observer = uni.createIntersectionObserver(this, {
nativeMode: true
});
this.observer.relativeToViewport();
this.observer.observe('._obs_listend', res => {
if (res.intersectionRatio == 1) {
this.$emit('show');
}
});
},
unmounted() {
this.observer.disconnect();
},
methods: {}
}
</script>
<style scoped>
._vlistnodata {
text-align: center;
padding: 1em;
font-size: 1.2em;
}
._vlistend {
position: relative;
text-align: center;
color: var(--txt1);
font-size: 0.8em;
padding: 1em;
margin-bottom: 1em;
}
._obs_listend {
width: 100%;
height: 1px;
}
</style>

View File

@ -0,0 +1,69 @@
<template>
<view style="border-radius:5px;transition: all .5s;" :style="{width:pix+'px',height:pix+'px',border:'1px solid ' + color}">
<view :style="{opacity: (count >= maxclk?0:1),background:color,marginTop:top+'px',marginLeft:left+'px'}" @tap="chkxw" style="transition: all .5s; width:20px;height:20px;border-radius: 10px;"></view>
</view>
</template>
<script>
//hidden:
//
//
//img
//img
//img
//img
//
//()
var app = getApp();
export default {
behaviors: ['uni://form-field-group']
, props: {
pix: {
type: Number
, default: 100
}
, maxclk: {
type: Number
, default: 3
}
, }
, data() {
return {
count: -1
, color: ''
, top: 0
, left: 0
};
}
, mounted() {
this.chkxw();
}
, methods: {
chkxw(e) {
this.count++;
if (this.count >= this.maxclk) {
this.color = '#21c33c';
}else{
this.color = '#cc0000';
this.top = parseInt(Math.random() * (this.pix - 20));
this.left = parseInt(Math.random() * (this.pix - 20));
}
if (!e)
return;
this.$emit('change', {
ok: this.maxclk <= this.count
, top: this.top
, left: this.left
, detail: e.detail
});
}
, init(){
this.count = -1;
this.chkxw();
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,254 @@
<template>
<template v-for="(item,index) in htmls" :key="index">
<view v-if="item.type == 'image'" style="text-align:center;">
<image :src="file_stor(item.content)" mode="heightFix" style="max-width:100%;"></image>
</view>
<view v-else-if="item.type == 'video'" style="text-align:center;">
<video :src="file_stor(item.content)" style="width:100%;"></video>
</view>
<view v-else-if="item.type == 'audio'" style="padding:1em;">
<ciy-audio :src="file_stor(item.content)"></ciy-audio>
</view>
<view v-else v-html="item.content" style="width:100%;position: relative;" :style="{padding:padding}"></view>
</template>
</template>
<script>
export default {
props: {
md: {
type: String,
default: ''
},
padding: {
type: String,
default: '0 0.5em'
}
},
data() {
return {
htmls: []
};
},
watch: {
md: {
handler(newD, oldD) {
this.htmls = this.convert(newD);
},
immediate: true
}
},
mounted() {},
methods: {
fillmdlines() {
},
convert(markdown) {
// #,!,`,@lcr,|
markdown = markdown || '';
if (markdown.substring(0, 4) == '[MD]')
markdown = markdown.substring(4).trim();
var mds = markdown.split('\n');
var htmls = [];
var html = '';
var isol = false;
var titnum = [0, 0, 0, 0, 0];
for (var m in mds) {
if (mds[m].length == 0) {
continue;
}
if (mds[m].length > 0 && mds[m].trim() == '') {
if (isol) {
isol = false;
html += '</ol>';
}
html += '<br/>';
continue;
}
if (mds[m][0] == '#') { //1/2/3
if (isol) {
isol = false;
html += '</ol>';
}
var cr = mds[m].substring(1, 2).toLowerCase();
if (mds[m].substring(0, 5) == '#####') {
oladd(4, titnum);
if (mds[m].substring(5, 6) == '.')
html += '<h5 class="md-h5">' + olnum(4, titnum, '、') + convertcode(mds[m].substring(6)) + '</h5>';
else if (mds[m].substring(5, 6) == ':')
html += '<div class="md-content">' + olnum(4, titnum, ' ') + convertcode(mds[m].substring(6)) + '</div>';
else
html += '<h5 class="md-h5">' + convertcode(mds[m].substring(5)) + '</h5>';
} else if (mds[m].substring(0, 4) == '####') {
oladd(3, titnum);
if (mds[m].substring(4, 5) == '.')
html += '<h4 class="md-h4">' + olnum(3, titnum, '、') + convertcode(mds[m].substring(5)) + '</h4>';
else if (mds[m].substring(4, 5) == ':')
html += '<div class="md-content">' + olnum(3, titnum, ' ') + convertcode(mds[m].substring(5)) + '</div>';
else
html += '<h4 class="md-h4">' + convertcode(mds[m].substring(4)) + '</h4>';
} else if (mds[m].substring(0, 3) == '###') {
oladd(2, titnum);
if (mds[m].substring(3, 4) == '.')
html += '<h3 class="md-h3">' + olnum(2, titnum, '、') + convertcode(mds[m].substring(4)) + '</h3>';
else if (mds[m].substring(3, 4) == ':')
html += '<div class="md-content">' + olnum(2, titnum, ' ') + convertcode(mds[m].substring(4)) + '</div>';
else
html += '<h3 class="md-h3">' + convertcode(mds[m].substring(3)) + '</h3>';
} else if (mds[m].substring(0, 2) == '##') {
oladd(1, titnum);
if (mds[m].substring(2, 3) == '.')
html += '<h2 class="md-h2">' + olnum(1, titnum, '、') + convertcode(mds[m].substring(3)) + '</h2>';
else if (mds[m].substring(2, 3) == ':')
html += '<div class="md-content">' + olnum(1, titnum, ' ') + convertcode(mds[m].substring(3)) + '</div>';
else
html += '<h2 class="md-h2">' + convertcode(mds[m].substring(2)) + '</h2>';
} else {
oladd(0, titnum);
if (cr == 'c')
html += '<h1 class="md-h1" style="text-align:center;">' + convertcode(mds[m].substring(2)) +
'</h1>';
else if (cr == 'r')
html += '<h1 class="md-h1" style="text-align:right;">' + convertcode(mds[m].substring(2)) +
'</h1>';
else if (cr == '.')
html += '<h1 class="md-h1">' + olnum(0, titnum, '、') + convertcode(mds[m].substring(2)) + '</h1>';
else if (cr == ':')
html += '<div class="md-content">' + olnum(0, titnum, ' ') + convertcode(mds[m].substring(2)) + '</div>';
else
html += '<h1 class="md-h1">' + convertcode(mds[m].substring(1)) + '</h1>';
}
} else if (mds[m][0] == '@') { //cr
var cr = mds[m].substring(1, 2).toLowerCase();
if (cr == 'c')
html += '<div class="md-content" style="text-align:center;">' + convertcode(mds[m].substring(2)) + '</div>';
else if (cr == 'r')
html += '<div class="md-content" style="text-align:right;margin-right:1em;">' + convertcode(mds[m].substring(2)) + '</div>';
else if (mds[m][1] == '.') {
if (!isol) {
isol = true;
html += '<ol>';
}
html += '<li style="line-height: 1.5em;padding: 0.5em 0;">' + convertcode(mds[m].substring(2)) + '</li>';
} else
html += '<div class="md-content">' + mds[m].substring(1) + '</div>';
} else if (mds[m][0] == '!') { //
var mis = mds[m].split('|');
var url = mis[0];
url = this.file_stor(url.substring(1));
var ind = url.indexOf('?');
var match;
if (ind > -1) {
match = url.substring(0, ind).match(/\.([^./]+)$/);
} else
match = url.match(/\.([^./]+)$/);
var exurl = match ? match[1] : '';
htmls.push({
type: 'text',
content: html
});
html = '';
if (exurl == 'mp4' || exurl == 'm3u8') {
var alt = '';
if (mis[1])
alt = ' alt="' + mis[1].replace('"', "") + '"';
htmls.push({
type: 'video',
content: url
});
} else if (exurl == 'mp3') {
var alt = '';
if (mis[1])
alt = ' alt="' + mis[1].replace('"', "") + '"';
htmls.push({
type: 'audio',
content: url
});
} else {
var alt = '';
if (mis[1])
alt = ' alt="' + mis[1].replace('"', "") + '"';
htmls.push({
type: 'image',
content: url
});
}
} else if (mds[m][0] == '<') { //HTML
html += mds[m];
} else {
if (isol) {
isol = false;
html += '</ol>';
}
html += '<div class="md-content">' + convertcode(mds[m]) + '</div>';
}
}
if (html) {
if (isol) {
isol = false;
html += '</ol>';
}
htmls.push({
type: 'text',
content: html
});
}
return htmls;
function oladd(idx, olnum) {
olnum[idx]++;
for (var i = idx + 1; i < olnum.length; i++)
olnum[i] = 0;
}
function olnum(idx, olnum, end) {
for (var i = 0; i <= idx; i++) {
if (olnum[i] == 0)
continue;
var ols = [];
for (var j = i; j <= idx; j++) {
ols.push(olnum[j]);
}
return ols.join('.') + end;
}
}
function convertcode(md) {
var bcode = false;
md = md.replace(/ /g, ' ');
while (true) {
var ind = md.indexOf('`');
if (ind == -1)
break;
var el = '<span class="md-code">';
if (bcode) {
bcode = false;
el = '</span>';
} else
bcode = true;
md = md.substring(0, ind) + el + md.substring(ind + 1);
}
while (true) {
var ind = md.indexOf('**');
if (ind == -1)
break;
var el = '<span style="font-weight:bold;">';
if (bcode) {
bcode = false;
el = '</span>';
} else
bcode = true;
md = md.substring(0, ind) + el + md.substring(ind + 2);
}
if (bcode)
md += '</span>';
return md;
}
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,423 @@
<template>
<view style="width:100%;position: relative;">
<view style="min-height:10em;border:1px solid #dddddd;margin:0;background:#fafafa;">
<view v-for="(item,index) in mdlines" :key="index" @tap="rightmenu(index)" :class="item.vms">
<view v-if="item.cls == 'md-pic'">
<image :src="item.content" style="width:100%;display:block;" mode="widthFix"></image>
</view>
<view v-else :class="item.cls">{{item.content}}</view>
</view>
</view>
<view class="_edittip" style="top:-0.5em;">编辑区</view>
<input type="hidden" :name="name" :value="valuetxt" style="display:none;" />
<view style="position:relative;margin:0;border:1px solid #dddddd;">
<textarea :name="name + '_unup'" class="_textarea" v-model="etext" :fixed="true" auto-height maxlength="-1" />
<view style="display:flex;align-items: center;background:#ffffff;border-top:1px solid #dddddd;">
<view class="_icon _photo" @tap="upimg"></view>
<view style="position: absolute;bottom:0;left:4em;font-size:0.6em;color:#cccccc;">{{imgtip}}</view>
<view style="flex:1;text-align:right;padding:0 1em;">首行样式</view>
<ciy-picker name="linecls" v-model="elinecls" :range="styles" style="width:8em;"></ciy-picker>
<view class="_icon _uptxt" @tap="uptxt"></view>
</view>
<view class="_edittip" style="top:-1.5em;">录入区</view>
</view>
</view>
</template>
<script>
//
//
//
//()
//
//
//
var app = getApp();
export default {
behaviors: ['uni://form-field-group']
, props: {
name: {
type: String
}
, value: {
type: String
, default: ''
}
, imgact: {
type: String
, default: 'cp|1280|60'
}
, uploadurl: {
type: String
, default: ''
}
, }
, data() {
return {
Gvalue: false
, valuetxt: '' //
, valuelines: [] //
, mdlines: [] //
, eimgs: ''
, etext: ''
, imgtip: ''
, elinecls: 'md-content'
, styles: [{
id: 'md-content'
, pre: ''
, name: '正文'
}
, {
id: 'md-h1'
, pre: '#'
, name: '大标题'
}
, {
id: 'md-h1 _center'
, pre: '#c'
, name: '大标题居中'
}
, {
id: 'md-h1 _right'
, pre: '#r'
, name: '大标题靠右'
}
, {
id: 'md-h2'
, pre: '##'
, name: '二号标题 [n]'
}
, {
id: 'md-h3'
, pre: '###'
, name: '三号标题 [n.m]'
}
, {
id: 'md-h4'
, pre: '####'
, name: '四号标题 [n.m.k]'
}
, {
id: 'md-content _center'
, pre: '@c'
, name: '正文居中'
}
, {
id: 'md-content _right'
, pre: '@r'
, name: '正文靠右'
}
]
};
}
, watch: {
value(newD, oldD) {
if (this.Gvalue)
this.Gvalue = false;
else {
this.valuetxt = newD;
this.fillmdlines();
}
}
}
, mounted() {
this.valuetxt = this.value || '';
this.fillmdlines();
this.$emit('change', {
name: this.name
, from: 'create'
, value: this.valuetxt
});
}
, methods: {
fillmdlines() {
var markdown = this.valuetxt;
if (markdown.substr(0, 4) == '[MD]')
markdown = markdown.substr(4).trim();
var mds = markdown.split('\n');
var mdls = [];
for (var m in mds) {
if (mds[m].trim().length == 0) {
continue;
}
var mdl = {};
if (mds[m][0] == '#') { //1/2/3
if (mds[m].substr(0, 4) == '####') {
mdl.cls = 'md-h4';
mdl.content = 'n.m.k、' + mds[m].substr(4);
} else if (mds[m].substr(0, 3) == '###') {
mdl.cls = 'md-h3';
mdl.content = 'n.m、' + mds[m].substr(3);
} else if (mds[m].substr(0, 2) == '##') {
mdl.cls = 'md-h2';
mdl.content = 'n、' + mds[m].substr(2);
} else if (mds[m].substr(1, 1) == 'c') {
mdl.cls = 'md-h1 _center';
mdl.content = mds[m].substr(2);
} else if (mds[m].substr(1, 1) == 'r') {
mdl.cls = 'md-h1 _right';
mdl.content = mds[m].substr(2);
} else {
mdl.cls = 'md-h1';
mdl.content = mds[m].substr(1);
}
} else if (mds[m][0] == '@') { //cr
if (mds[m][1] == 'c') {
mdl.cls = 'md-content _center';
mdl.content = mds[m].substr(2);
} else if (mds[m][1] == 'r') {
mdl.cls = 'md-content _right';
mdl.content = mds[m].substr(2);
} else {
mdl.cls = 'md-content';
mdl.content = mds[m].substr(1);
}
} else if (mds[m][0] == '!') { //
var mis = mds[m].split('|');
var url = mis[0];
url = url.substring(1);
var alt = '';
if (mis[1])
alt = ' alt="' + mis[1].replace('"', "") + '"';
if (url.substr(0, 4).toLowerCase() != 'http')
url = this.file_stor(url);//xx
mdl.cls = 'md-pic';
mdl.content = url;
} else if (mds[m][0] == '_') {} else {
mdl.cls = 'md-content';
mdl.content = mds[m];
}
if (mdl.cls) {
mdl.idx = m;
mdl.vms = '';
mdls.push(mdl);
}
}
this.mdlines = mdls;
this.valuetxt = '[MD]' + markdown;
}
, rightmenu(idx) {
for (var i in this.mdlines)
this.mdlines[i].vms = '';
this.mdlines[idx].vms = '_sel';
var menus = [];
menus.push({
name: '插入'
, url: 'ins'
});
if (this.mdlines[idx].cls != 'md-pic') {
menus.push({
name: '编辑'
, url: 'edit'
});
}
menus.push({
name: '删除'
, url: 'del'
});
uni.showActionSheet({
itemList: menus.map(item => item.name)
, success: res => {
var menu = menus[res.tapIndex];
if (menu.url == 'del') {
app.askmsg('确认删除?', () => {
var ls = this.valuetxt.split('\n');
ls.splice(this.mdlines[idx].idx, 1);
this.valuetxt = ls.join('\n');
this.fillmdlines();
this.$emit('change', {
name: this.name
, from: 'delete'
, value: this.valuetxt
});
});
} else if (menu.url == 'edit') {
this.etext = this.mdlines[idx].content;
this.elinecls = this.mdlines[idx].cls;
this.mdlines[idx].vms = '_edit';
} else if (menu.url == 'ins') {
this.mdlines[idx].vms = '_ins';
}
}
, complete: res => {
if (this.mdlines[idx].vms == '_sel')
this.mdlines[idx].vms = '';
}
});
}
, doedit(pre, txt) {
var lineidx = -1;
var op = '_append';
for (var i in this.mdlines) {
if (this.mdlines[i].vms) {
lineidx = this.mdlines[i].idx;
op = this.mdlines[i].vms;
break;
}
}
var ls = this.valuetxt.split('\n');
if (op == '_append')
ls.push(pre + txt);
else if (op == '_edit') {
ls.splice(lineidx, 1, pre + txt);
} else {
ls.splice(lineidx, 0, pre + txt);
}
this.valuetxt = ls.join('\n');
this.fillmdlines();
}
, uptxt() {
var txt = this.etext;
if (txt == '')
return app.toast('请填写内容');
var pre = '';
for (var i = 0; i < this.styles.length; i++) {
if (this.styles[i].id == this.elinecls)
pre = this.styles[i].pre;
}
this.etext = '';
this.doedit(pre, txt);
this.$emit('change', {
name: this.name
, from: 'uptxt'
, pre: pre
, content: txt
, value: this.valuetxt
});
}
, upimg: function(b) {
if (this.Grunning)
return app.toast('上传中...');
//if (app.boi && app.boi.inboi()) {
var thos = this;
uni.chooseImage({
count: 9
, sizeType: ['original', 'compressed']
, success: res => {
console.log('choose', res);
var upcount = res.tempFilePaths.length;
thos.Grunning = true;
thos.imgtip = '上传 0/' + upcount;
var upidx = 0;
for (var u in res.tempFilePaths) {
(function(idx, img) {
var updata = {};
updata.imgact = thos.imgact;
uni.uploadFile({
url: thos.uploadurl
, filePath: img
, name: 'file'
, formData: updata
, header: {
'ciyauth': app.getstorage("_auth")
, 'ciyorg': app.getstorage("_org")
}
, success: res => {
var jsonup = app.json_parse(res.data);
if (jsonup === null)
jsonup = {
code: 0
, errmsg: 'JSON Parse ERROR:' + res.data.substr(0, 30)
}
upidx++;
if (jsonup.code != 1) {
thos.Grunning = false;
thos.imgtip = '';
if (jsonup.code == 2) {
app.askmsg('您尚未登录,请登录后上传\n立即前往登录', () => {
uni.navigateTo({
url: '/main/login'
});
});
} else
thos.alert('上传失败:' + jsonup.errmsg);
return;
}
thos.doedit('!', jsonup.url);
thos.$emit('change', {
name: thos.name
, from: 'upimg'
, url: jsonup.url
, value: thos.valuetxt
});
thos.imgtip = '上传 ' + upidx + '/' + upcount;
if (upidx == upcount) {
thos.Gvalue = true;
thos.imgtip = '';
thos.Grunning = false;
}
}
});
})(u, res.tempFilePaths[u]);
}
}
});
}
}
}
</script>
<style scoped>
._edittip {
position: absolute;
top: 0;
right: 0.5em;
background: #fffad7;
border: 1px solid #dddddd;
padding: 0.2em 0.5em;
font-size: 0.6em;
border-radius: 0.5em;
line-height: 1.3em;
}
._center {
text-align: center;
}
._right {
text-align: right;
}
._ins {
border-top: 3px solid #cc0000;
}
._sel {
border: 1px solid #cc0000;
border-radius: 0.3em;
}
._edit {
border: 2px solid #009000;
}
._textarea {
display: block;
padding: 0.5em;
min-height: 5em;
background: #ffffff;
line-height:1.2em;
width: 100%;
box-sizing: border-box;
}
._photo {
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQyOC41NzYgMzc4LjM2OGE1MC4xNzYgNTAuMTc2IDAgMSAwLTEwMC4zNTIgMCA1MC4xNzYgNTAuMTc2IDAgMCAwIDEwMC4zNTIgMG0wIDB6IG0xNjYuOTQ0IDI1Ni40NDhoNDEuNTA0di00MS41MDRjMC0zMC41NiAxOC4zMzYtNTYuOCA0NC41MTItNjguNzM2bC02Ljk0NC0yMy44MDh2LTEuNjY0aDAuMDY0bC00NS40MDgtMTM3LjE4NC0xNTguNDk2IDIwNC41MTItNDIuNDk2LTcxLjk2OC0xNjguNTc2IDE3MC4xMTJoMjc2LjA5NmE3NS4zNiA3NS4zNiAwIDAgMSA1OS43NDQtMjkuNzZtMjY3LjcxMi0zNjEuNjY0YTExMi43MDQgMTEyLjcwNCAwIDAgMC0xMTIuMzg0LTExMi4zODRIMjczLjE1MmExMTIuNzA0IDExMi43MDQgMCAwIDAtMTEyLjM4NCAxMTIuMzg0djQ3Ny42NjRhMTEyLjcwNCAxMTIuNzA0IDAgMCAwIDExMi4zODQgMTEyLjM4NGgzMzcuMTg0di0wLjAzMmwwLjEyOCAwLjAzMmEyMS4wODggMjEuMDg4IDAgMSAwIDAtNDIuMTc2bC0wLjEyOCAwLjAzMnYtMC4wMzJIMjczLjE1MmE3MC4zMDQgNzAuMzA0IDAgMCAxLTcwLjI0LTcwLjI0VjI3My4xNTJjMC0zOC43NTIgMzEuNDg4LTcwLjI0IDcwLjI0LTcwLjI0aDQ3Ny42NjRjMzguNzUyIDAgNzAuMjQgMzEuNDg4IDcwLjI0IDcwLjI0djMzNS4xMzZjMCAwLjI1Ni0wLjEyOCAwLjQ0OC0wLjEyOCAwLjY3MmEyMS4wODggMjEuMDg4IDAgMSAwIDQyLjE3NiAwbC0wLjA2NC0wLjI1NmgwLjE5MlYyNzMuMTUybS0yMS44ODggNDE2LjIyNGgtMTA3LjQyNHYtMTA3LjQyNGEyMS4wODggMjEuMDg4IDAgMSAwLTQyLjE3NiAwdjEwNy40MjRINTg0LjMyYTIxLjA4OCAyMS4wODggMCAxIDAgMCA0Mi4xNzZoMTA3LjQyNHYxMDcuNDI0YTIxLjA4OCAyMS4wODggMCAxIDAgNDIuMTc2IDBWNzMxLjUyaDEwNy40MjRhMjEuMDg4IDIxLjA4OCAwIDEgMCAwLTQyLjE0NCIgZmlsbD0iIzQ4OENDQiI+PC9wYXRoPjwvc3ZnPg==");
}
._uptxt {
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTUxMiAxMDIuNGM1NC42MTMzMzMgMCAxMDYuOTM5NzMzIDExLjM2NjQgMTU3LjAxMzMzMyAzMS44NDY0IDQ3Ljc4NjY2NyAyMC40OCA5My4yODY0IDUwLjA3MzYgMTMxLjk5MzYgODguNzQ2NjY3IDM4LjY3MzA2NyAzNi40MjAyNjcgNjguMjY2NjY3IDgxLjkyIDg4Ljc0NjY2NyAxMzEuOTkzNiAyMC40OCA1MC4wNzM2IDMxLjg0NjQgMTAyLjQgMzEuODQ2NCAxNTcuMDEzMzMzIDAgNTQuNjEzMzMzLTExLjM2NjQgMTA2LjkzOTczMy0zMS44NDY0IDE1Ny4wMTMzMzMtMjAuNDggNDcuNzg2NjY3LTUwLjA3MzYgOTMuMjg2NC04OC43NDY2NjcgMTMxLjk5MzYtMzYuNDIwMjY3IDM4LjY3MzA2Ny04MS45MiA2OC4yNjY2NjctMTMxLjk5MzYgODguNzQ2NjY3LTUwLjA3MzYgMjAuNDgtMTAyLjQgMzEuODQ2NC0xNTcuMDEzMzMzIDMxLjg0NjQtNTQuNjEzMzMzIDAtMTA2LjkzOTczMy0xMS4zNjY0LTE1Ny4wMTMzMzMtMzEuODQ2NC00Ny43ODY2NjctMjAuNDgtOTMuMjg2NC01MC4wNzM2LTEzMS45OTM2LTg4Ljc0NjY2Ny0zOC42NzMwNjctMzYuNDIwMjY3LTY4LjI2NjY2Ny04MS45Mi04OC43NDY2NjctMTMxLjk5MzYtMjAuNDgtNTAuMDczNi0zMS44NDY0LTEwMi40LTMxLjg0NjQtMTU3LjAxMzMzMyAwLTU0LjYxMzMzMyAxMS4zNjY0LTEwNi45Mzk3MzMgMzEuODQ2NC0xNTcuMDEzMzMzIDIwLjQ4LTQ3Ljc4NjY2NyA1MC4wNzM2LTkzLjI4NjQgODguNzQ2NjY3LTEzMS45OTM2IDM4LjcwNzItMzguNjczMDY3IDgxLjkyLTY4LjI2NjY2NyAxMzEuOTkzNi04OC43NDY2NjcgNTAuMDczNi0yMC40OCAxMDIuNC0zMS44NDY0IDE1Ny4wMTMzMzMtMzEuODQ2NHpNMjk1LjA4MjY2NyA1OTYuNjE2NTMzbC0yMS43MDg4IDk0LjkyNDggMzUuMjI1NiAzNS4yMjU2IDk0LjkyNDgtMjEuNzA4OC0xMDguNDQxNi0xMDguNDQxNnogbTIwOS4zNzM4NjYtMjg3LjA2MTMzM2wtMTc4Ljg1ODY2NiAxNzguODkyOGMtNC43NDQ1MzMgMzAuMTczODY3IDEuODQzMiA1MC4zMTI1MzMgMzIuOTcyOCA0Ny43ODY2NjdsMTIzLjkwNC0xMjAuMDgxMDY3IDEwLjk5MDkzMyAxMC45OTA5MzMtMTIwLjcyOTYgMTE2Ljk0MDhjNy41MDkzMzMgNDkuMDQ5NiAzOS41OTQ2NjcgNjguMjY2NjY3IDgyLjY3MDkzMyA3NC4yMDU4NjctNS42NjYxMzMgMzQuMjY5ODY3IDMuNDQ3NDY3IDU1LjAyMjkzMyA0NS45MDkzMzQgNDUuOTA5MzMzbDE3OC44NTg2NjYtMTc4Ljg5MjgtMTc1LjcxODQtMTc1Ljc1MjUzM3ogbTU1LjYzNzMzNC01NS4yOTZMNTIzLjk0NjY2NyAyOTAuMzcyMjY3bDE3NS43NTI1MzMgMTc1LjcxODQgMzYuMTQ3Mi0zNi4xNDcyYzE5Ljc5NzMzMy0xOS43OTczMzMgMTkuNzk3MzMzLTUyLjQ5NzA2NyAwLTcyLjI5NDRsLTEwMy40MjQtMTAzLjQyNGE1MS40Mzg5MzMgNTEuNDM4OTMzIDAgMCAwLTcyLjMyODUzMyAweiIgZmlsbD0iIzg1QzJGRiI+PC9wYXRoPjwvc3ZnPg==");
}
._icon {
width: 3em;
height: 3em;
background-size: cover;
}
</style>

View File

@ -0,0 +1,262 @@
<template>
<view @touchmove.prevent class="_movcontain" :style="'width:'+width+';height:'+height+'; overflow: hidden;'">
<view :style="{width:cwidth+'px',height:cheight+'px',transition:trans, transformOrigin:'0 0', transform: 'translate('+mapx+'px,'+mapy+'px) scale('+scale+')'}" @touchstart="handleTouchStart" @touchmove="handleTouchMove" @touchend="handleTouchEnd">
<image :src="src" style="width:100%;height:100%;" />
<view v-for="(item,index) in boxs" :key="index" class="abs t0 l0" :style="{zIndex:item.z,transform: 'translate('+item.x+'px,'+item.y+'px)'}" @tap="boxtap(index)" @touchstart="boxhandleTouchStart($event, index)" @touchmove="boxhandleTouchMove($event, index)" @touchend="boxhandleTouchEnd($event, index)">
<slot :box="item"></slot>
</view>
</view>
</view>
</template>
<script>
export default {
emits: ['change', 'boxclick'],
props: {
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100vw'
},
boxmove: {
type: Boolean,
default: false
},
},
data() {
return {
src: '',
containwidth: 0,
containheight: 0,
cwidth: 0,
cheight: 0,
trans: '',
scale: 1,
minScale: 0.5,
maxScale: 5,
mapx: 0,
mapy: 0,
last: {
x: 0,
y: 0
},
isDragging: false, //
initialDistance: 0, //
initialScale: 1, //
boxisDragging: false, //
boxindex: 0,
boxs: []
};
},
watch: {},
computed: {},
mounted() {},
methods: {
Setbox(boxs) {
this.zindex = 0;
this.boxs = boxs;
for (var i = 0; i < this.boxs.length; i++) {
if (this.boxs[i].z === undefined)
continue;
if (this.boxs[i].z > this.zindex)
this.zindex = this.boxs[i].z;
}
},
Getbox() {
return this.objclone(this.boxs);
},
Setmap(opn) {
this.src = this.file_stor(opn.src);
// #ifdef MP-WEIXIN
this.src = this.src.replace('http://', 'https://');
// #endif
this.getrect('._movcontain').then(res => {
this.containwidth = res.width;
this.containheight = res.height;
});
uni.getImageInfo({
src: this.src,
success: res => {
this.cwidth = res.width;
this.cheight = res.height;
this.mapx = -this.toint(opn.x);
this.mapy = -this.toint(opn.y);
this.scale = opn.scale;
},
fail: res => {
console.log('getImageInfo err', res);
}
});
},
handleTouchStart(e) {
this.trans = '';
this.pagenoscroll(true);
if (e.touches.length === 1) {
//
this.isDragging = true
this.last.x = e.touches[0].clientX
this.last.y = e.touches[0].clientY
} else if (e.touches.length === 2) {
//
this.isDragging = false
const x1 = e.touches[0].clientX
const y1 = e.touches[0].clientY
const x2 = e.touches[1].clientX
const y2 = e.touches[1].clientY
this.initialDistance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2))
this.initialScale = this.scale
}
},
handleTouchMove(e) {
if (e.touches.length === 1 && this.isDragging) {
// -
const deltaX = e.touches[0].clientX - this.last.x
const deltaY = e.touches[0].clientY - this.last.y
this.last.x = e.touches[0].clientX
this.last.y = e.touches[0].clientY
//
let newTranslateX = this.mapx + deltaX
let newTranslateY = this.mapy + deltaY
this.mapx = newTranslateX
this.mapy = newTranslateY
this.last.x = e.touches[0].clientX
this.last.y = e.touches[0].clientY
} else if (e.touches.length === 2) {
// -
const x1 = e.touches[0].clientX
const y1 = e.touches[0].clientY
const x2 = e.touches[1].clientX
const y2 = e.touches[1].clientY
const currentDistance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2))
if (this.initialDistance > 0) {
let newScale = this.initialScale * (currentDistance / this.initialDistance)
newScale = Math.min(Math.max(newScale, this.minScale), this.maxScale)
//
const centerX = (x1 + x2) / 2
const centerY = (y1 + y2) / 2
// 使
const ratio = (newScale - this.scale) / this.scale
this.mapx -= (centerX - this.mapx) * ratio
this.mapy -= (centerY - this.mapy) * ratio
this.scale = newScale
}
}
},
handleTouchEnd() {
this.trans = 'transform 0.5s';
this.pagenoscroll(false);
this.isDragging = false
this.initialDistance = 0
//
const containerWidth = this.containwidth
const containerHeight = this.containheight
const imageWidth = this.cwidth * this.scale
const imageHeight = this.cheight * this.scale
// X
const maxX = containerWidth - imageWidth
const minX = 0
if (this.mapx < maxX / 2) {
if (this.mapx < maxX)
this.mapx = maxX
} else {
if (this.mapx > minX)
this.mapx = minX
}
// Y
const maxY = containerHeight - imageHeight
const minY = 0
if (this.mapy < maxY / 2) {
if (this.mapy < maxY)
this.mapy = maxY
} else {
if (this.mapy > minY)
this.mapy = minY
}
this.$emit('change', {
x: this.mapx,
y: this.mapy,
sacle: this.sacle,
index: -1,
boxs: this.boxs
});
},
boxtap(index) {
this.$emit('boxclick', {
index: index,
boxs: this.boxs
});
},
boxhandleTouchStart(e, index) {
if (!this.boxmove)
return;
e.stopPropagation()
this.pagenoscroll(true);
this.boxisDragging = true
this.boxindex = index;
this.last.x = e.touches[0].clientX
this.last.y = e.touches[0].clientY
if (typeof(this.boxs[this.boxindex].z) == 'number')
this.boxs[this.boxindex].z = ++this.zindex;
},
boxhandleTouchMove(e, index) {
e.stopPropagation()
if (!this.boxisDragging)
return;
// -
const deltaX = (e.touches[0].clientX - this.last.x) / this.scale
const deltaY = (e.touches[0].clientY - this.last.y) / this.scale
this.last.x = e.touches[0].clientX
this.last.y = e.touches[0].clientY
//
let newTranslateX = this.boxs[this.boxindex].x + deltaX
let newTranslateY = this.boxs[this.boxindex].y + deltaY
this.boxs[this.boxindex].x = newTranslateX
this.boxs[this.boxindex].y = newTranslateY
this.last.x = e.touches[0].clientX
this.last.y = e.touches[0].clientY
},
boxhandleTouchEnd(e) {
e.stopPropagation()
this.pagenoscroll(false);
this.boxisDragging = false
if (this.boxs[this.boxindex].x < 0)
this.boxs[this.boxindex].x = 0;
if (this.boxs[this.boxindex].y < 0)
this.boxs[this.boxindex].y = 0;
const maxx = this.cwidth - this.toint(this.boxs[this.boxindex].w);
const maxy = this.cheight - this.toint(this.boxs[this.boxindex].h);
if (this.boxs[this.boxindex].x > maxx)
this.boxs[this.boxindex].x = maxx;
if (this.boxs[this.boxindex].y > maxy)
this.boxs[this.boxindex].y = maxy;
this.$emit('change', {
x: this.mapx,
y: this.mapy,
sacle: this.sacle,
index: this.boxindex,
boxs: this.boxs
});
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,128 @@
<template>
<ciy-anipop v-model="popsh" maskbg="#00000055" @change="popclose">
<view class="_menu">
<view class="_title" v-if="title">{{title}}</view>
<slot name="list" :data="{items:items, rowcount:rowcount}">
<view class="_list" :class="rowcount<=1?'_flex':'_grid'" :style="'grid-template-columns: repeat('+rowcount+', 1fr);'">
<template v-for="(item,index) in items" :key="index">
<view v-if="item.br" style="grid-column: 1 / -1;"></view>
<view v-else-if="item.line" style="grid-column: 1 / -1;height: 3px;width: 100%;background: linear-gradient(90deg, transparent, var(--bg5), transparent);"></view>
<view v-else class="_item" @tap="selitem(index)">
<view class="_icon" v-if="item.icon"><ciy-svgimg :src="item.icon"></ciy-svgimg></view>
<view class="_name" :style="item.style" v-if="item.name">{{lang(item.name)}}</view>
<view class="_sub" v-if="item.sub">{{item.sub}}</view>
</view>
</template>
</view>
<view style="height:2em;"></view>
</slot>
</view>
</ciy-anipop>
</template>
<style scoped>
._menu {
background: var(--bg2);
border-top: 1px solid var(--bg6);
}
._title {
text-align: center;
font-size: 1.2rem;
padding: 0.5rem 0;
font-weight: bold;
background: var(--bg1);
}
._list {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
._list._flex {
display: flex;
flex-direction: column;
width: 100%;
overflow: auto;
text-align: left;
}
._list._flex ._item {
padding: 1em;
text-align: center;
width: 100%;
border-top: 1px solid var(--bg4);
}
._list._grid {
display: grid;
width: 100%;
overflow: auto;
text-align: center;
}
._list._grid ._item {
padding: 1em 1em;
width: 100%;
}
._list ._icon {
width: 2rem;
height: 2rem;
display: inline-block;
}
._list ._name {
color: var(--txt7);
}
._list ._sub {
font-size:0.7em;
color: var(--txt1);
}
</style>
<script>
export default {
props: {},
data() {
return {
items: [],
rowcount: 0,
title: '',
popsh: false
};
},
watch: {},
mounted() {},
methods: {
Open(opn) {
return new Promise(async (resolve, reject) => {
opn = opn || {};
if(!opn.items || opn.items.length == 0)
return;
if(opn.one && opn.items.length == 1){
resolve({...opn.items[0]});
return;
}
this.resolvecb = resolve;
this.items = opn.items;
this.rowcount = opn.rowcount;
this.title = opn.title;
this.popsh = true;
}).catch(e => {
});
},
selitem(idx) {
this.popsh = false;
this.resolvecb({...this.items[idx]});
},
popclose(e) {
if(!e.value)
this.resolvecb({close:true});
},
}
}
</script>

View File

@ -0,0 +1,343 @@
<template>
<view class="_lnte" @tap="toggle">
<view class="_search">
<view v-if="!qshow" class="_itm">
<view class="itm" v-for="(item,index) in items" :key="index" :class="item.cls">{{item.txt}}</view>
</view>
<view v-if="qshow" class="_txt">{{lang('query.pselect')}}</view>
</view>
<view class="_sbtn" :class="{queryed}">
<view class="itm"></view>{{lang('query.btn_query')}}
</view>
</view>
<view :animation="anidatapop" v-if="qshow" class="_qshow">
<view :style="{height:qmtop+'px'}" @tap="close"></view>
<view class="_main">
<view class="_form" :style="{maxHeight: fheight + 'px'}">
<view class="ciy-form" v-for="(item,index) in qry" :key="index">
<label v-if="item.label != 'no'">{{item.name}}</label>
<view v-if="item.type == 'input'">
<ciy-input bb :name="item.form" v-model="data[item.form]" type="text"></ciy-input>
</view>
<view v-else-if="item.type == 'select'">
<ciy-select :name="item.form" v-model="data[item.form]"
:range="loadrange(gdict, item)"></ciy-select>
</view>
<view v-else-if="item.type == 'num'"
style="display:flex;align-items: center;justify-content: flex-end;">
<ciy-input bb :name="item.form + '_1'" v-model="data[item.form+'_1']" type="digit" style="width:4em;text-align:center;"></ciy-input>
<view style="margin-left:0.5em;">~</view>
<ciy-input bb :name="item.form + '_2'" v-model="data[item.form+'_2']" type="digit" style="width:4em;text-align:center;"></ciy-input>
</view>
<view v-else-if="item.type == 'bool'">
<ciy-selbool left :name="item.form" v-model="data[item.form]"></ciy-selbool>
</view>
<view v-else-if="item.type == 'radio'">
<ciy-radio left :name="item.form" v-model="data[item.form]" :range="loadrange(gdict, item)"></ciy-radio>
</view>
<view v-else-if="item.type == 'checkbox'">
<ciy-checkbox left :name="item.form" v-model="data[item.form]" :range="loadrange(gdict, item)"></ciy-checkbox>
</view>
<view v-else-if="item.type == 'daterange'">
<ciy-inputdaterange :name="item.form" v-model="data[item.form]"></ciy-inputdaterange>
</view>
<view v-else-if="item.type == 'day'">
<ciy-inputdatetime :name="item.form" v-model="data[item.form]"></ciy-inputdatetime>
</view>
<view v-else-if="item.type == 'month'">
<ciy-inputdatetime selectmonth :name="item.form" v-model="data[item.form]"></ciy-inputdatetime>
</view>
<view v-else>
<slot :itm="{item:item,data:data}"></slot>
</view>
</view>
</view>
<view class="_bottombtn">
<button class="btn def" @tap="close">{{lang('query.btn_close')}}</button>
<button class="btn lg" @tap="submit">{{lang('query.btn_run')}}</button>
<button class="btn def" @tap="reset">{{lang('query.btn_reset')}}</button>
</view>
</view>
<view class="_mask" @tap="close"></view>
</view>
</template>
<script>
export default {
emits: ['confirm'],
props: {
qry: {
type: Object,
default: {}
},
gdict: {
type: Object,
default: {}
}
},
data() {
return {
qshow: false,
qmtop:0,
fheight:0,
anidatapop: {},
data: {}
}
},
mounted() {},
computed: {
items() {
var itms = [];
for (var i in this.qry) {
if (this.hasdata(i))
itms.push({
txt: this.qry[i].name,
cls: '_valed'
});
}
for (var i in this.qry) {
if (!this.hasdata(i))
itms.push({
txt: this.qry[i].name,
cls: ''
});
}
return itms;
},
queryed() {
for (var i in this.qry) {
if (this.hasdata(i))
return '_queryed';
}
return '';
}
},
methods: {
toggle() {
if (this.qshow)
this.close();
else
this.open();
},
loadrange(gdict, item) {
var sels = [];
if (item.all)
sels.push({
id: '',
name: item.all
});
var gg = [];
if (item.select instanceof Array)
gg = item.select;
else {
if (item.select.substring(0, 5) == 'cata_') {
gg = gdict[item.select.substring(5)];
} else {
gg = gdict[item.select];
}
}
for (var i in gg) {
sels.push({
...gg[i]
});
}
return sels;
},
async open() {
this.pagenoscroll(true);
const {
headerheight,
footerheight
} = await this.com_gethdft();
var lnterect = await this.getrect('._lnte');
if (!lnterect)
return;
var app = getApp();
this.qmtop = lnterect.bottom;
this.fheight = app.globalData._sysinfo.windowHeight - lnterect.bottom - footerheight - 110;
this.qshow = true;
this.$nextTick(() => {
var animation = uni.createAnimation({
transformOrigin: "100% " + (lnterect.bottom - 60) + "px"
});
animation.scale(1);
animation.opacity(1);
animation.step({
duration: 200
});
this.anidatapop = animation.export();
});
},
close() {
this.pagenoscroll(false);
var animation = uni.createAnimation({
transformOrigin: "100% " + (this.qmtop - 60) + "px"
});
animation.scale(0);
animation.opacity(0);
animation.step({
duration: 200
});
this.anidatapop = animation.export();
setTimeout(() => {
this.qshow = false;
}, 300);
},
hasdata(idx) {
var form = this.qry[idx].form;
if (this.qry[idx].type == 'num') {
return this.data[form + '_1'] || this.data[form + '_2'];
} else if (this.qry[idx].type == 'bool') {
return this.data[form] == 1;
} else {
return !!this.data[form];
}
},
reset() {
for (var i in this.data) {
delete this.data[i];
}
this.$emit("confirm", {});
this.close();
},
submit() {
// #ifndef APP-PLUS
uni.hideKeyboard();
// #endif
// #ifdef APP-PLUS
plus.key.hideSoftKeybord();
// #endif
this.$emit("confirm", {...this.data});
this.close();
},
setdata(where){
if(!where)
return;
for(var i in this.data){
if(where[i])
this.data[i] = where[i];
}
}
}
};
</script>
<style scoped>
._qshow {
position: fixed;
left: 0;
right: 0;
opacity: 0;
top: 0;
transform-origin: 100% 0;
transform: scale(0);
}
._qshow>._main {
border-radius: 0 0 1em 1em;
background: linear-gradient(0deg, var(--man3), var(--bg1));
padding: 0 1em;
border-bottom: 2px solid var(--man7);
}
._qshow>._mask {
height: 100vh;
backdrop-filter: blur(2px);
}
._qshow ._form {
overflow: auto;
}
._qshow ._bottombtn {
margin: 1em 0px;
display: flex;
width: 100%;
align-items: flex-end;
justify-content: space-between;
}
._lnte {
display: flex;
padding: 0.5em;
background: var(--bg2);
align-items: center;
border-bottom: 1px solid var(--bg5);
height: 3.5em;
}
._lnte ._search {
flex: 1;
position: relative;
display: flex;
overflow-x: auto;
overflow-y: hidden;
}
._lnte ._search ._itm {
display: flex;
overflow-x: auto;
overflow-y: hidden;
}
._lnte ._search ._itm>.itm {
margin: 0.2em;
border-radius: 1em;
border: 1px solid var(--bg6);
color: var(--txt1);
padding: 0 0.5em;
line-height: 1.5em;
font-size: 0.8em;
white-space: nowrap;
}
._lnte ._search ._itm>.itm._valed {
border: 1px solid transparent;
background-clip: padding-box, border-box;
background-origin: padding-box, border-box;
background-image: linear-gradient(to right, var(--bg1), var(--bg1)), linear-gradient(331deg, var(--man5), var(--man7));
color: var(--man6);
}
._lnte ._search::after {
content: ' ';
position: absolute;
bottom: 0;
right: 0;
top: 0;
width: 4em;
background: linear-gradient(90deg, transparent, var(--bg2));
}
._lnte ._search ._txt {
background: linear-gradient(331deg, var(--man5), var(--man7));
background-clip: text;
-webkit-background-clip: text;
color: transparent;
letter-spacing: 0.1em;
font-size: 0.9em;
font-weight: bolder;
padding-left: 1em;
}
._lnte ._sbtn {
display: flex;
align-items: center;
font-size: 0.8em;
margin: 0 0.5em;
opacity: 0.6;
}
._lnte ._sbtn._queryed {
opacity: 1;
}
._lnte ._sbtn>.itm {
width: 1.8em;
height: 1.8em;
margin-right: 0.5em;
display: inline-block;
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTc0Ny45IDk4LjVIMjc2LjFjLTQ4LjUgMC03NC45IDU2LjctNDMuNiA5My44TDM2MiAzNDUuOHY0MDkuNmgwLjJjLTEuNSAxNS4yIDUuNyAzMC42IDE5LjggMzguN2wyMTguNSAxMjYuMWMxOS4xIDExIDQzLjYgNC41IDU0LjYtMTQuNnM0LjUtNDMuNi0xNC42LTU0LjZMNDQyIDczNi4zVjM0NS44YzAtMTguOS02LjctMzcuMS0xOC44LTUxLjZsLTk3LjYtMTE1LjdoMzcyLjlsLTk3LjYgMTE1LjdjLTEyLjIgMTQuNC0xOC44IDMyLjctMTguOCA1MS42djU5LjRjMCAyMi4xIDE3LjkgNDAgNDAgNDBzNDAtMTcuOSA0MC00MHYtNTkuNGwxMjkuNS0xNTMuNWMzMS4xLTM3LjEgNC44LTkzLjgtNDMuNy05My44eiIgZmlsbD0iIzRhNWZlMiI+PC9wYXRoPjxwYXRoIGQ9Ik02ODIgNDY0LjNINTYyYy0yMi4xIDAtNDAgMTcuOS00MCA0MHMxNy45IDQwIDQwIDQwaDEyMGMyMi4xIDAgNDAtMTcuOSA0MC00MCAwLTIyLTE3LjktNDAtNDAtNDB6TTY4MiA1ODIuM0g1NjJjLTIyLjEgMC00MCAxNy45LTQwIDQwczE3LjkgNDAgNDAgNDBoMTIwYzIyLjEgMCA0MC0xNy45IDQwLTQwIDAtMjItMTcuOS00MC00MC00MHpNNjgyIDcwMC4zSDU2MmMtMjIuMSAwLTQwIDE3LjktNDAgNDBzMTcuOSA0MCA0MCA0MGgxMjBjMjIuMSAwIDQwLTE3LjkgNDAtNDAgMC0yMi0xNy45LTQwLTQwLTQweiIgZmlsbD0iIzdjNDRlMiI+PC9wYXRoPjwvc3ZnPg==");
}
</style>

View File

@ -0,0 +1,230 @@
<template>
<view style="width:100%;">
<input type="hidden" :name="name" :value="tkv.id" style="display:none;" />
<template v-if="hasmore">
<input type="hidden" :name="name+'_name'" :value="tkv.name" style="display:none;" />
</template>
<view v-if="innerrang.length==0" :style="{color:'var(--bg6)',textAlign:left?'left':''}">无选项</view>
<radio-group class="_gp" :class="{'_line':line,'_left':left,'_itemright':itemright}">
<view @tap="chkitem(item)" class="_item" v-for="(item,index) in innerrang" :key="index">
<ciy-checkitem style="pointer-events: none;" :disabled="disabled" :tag="item.id+''" :value="tkv.id == item.id"></ciy-checkitem>
<view :style="{color:disabled?'var(--txt1)':''}">{{item.name}}</view>
</view>
</radio-group>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number],
default: ''
},
value: {
type: [String, Number],
default: ''
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
chkuse: {
type: Boolean,
default: false
},
range: {
type: [String, Array],
default: []
},
left: {
type: Boolean,
default: false
},
itemright: {
type: Boolean,
default: false
},
line: {
type: Boolean,
default: false
},
byname: {
type: Boolean,
default: false
}
},
data() {
return {
v: '',
valuearr: {
id: 0,
name: ''
},
};
},
watch: {
tkv: {
handler(newD, oldD) {
if (this.from && newD.id == oldD.id)
return;
if (!this.from)
this.from = 'init';
else if (this.from == 'init') {
this.from = 'check';
}
if (this.from != 'init') {
if (this.byname)
this.$emit('update:modelValue', newD.name);
else
this.$emit('update:modelValue', newD.id);
}
if (this.from != 'init' || this.initevent) {
this.$emit('change', {
name: this.name,
from: this.from,
value: {
id: newD.id,
name: newD.name
}
});
}
},
immediate: true
},
value: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'modelValue';
},
immediate: true
}
},
computed: {
innerrang() {
if (typeof(this.range) == 'string') {
const lis = this.range.split(',');
var lst = [];
for (let i = 0; i < lis.length; i++) {
const ls = lis[i].split(':');
if (ls.length < 2)
continue;
lst.push({
id: ls[0],
name: ls[1]
});
}
return lst;
}
let range = [];
for (let i = 0; i < this.range.length; i++) {
if (this.chkuse && this.range[i].isuse == 2)
continue;
range.push(this.range[i]);
}
return range;
},
tkv() {
var val = '';
if (this.v == 'modelValue') {
if (typeof(this.modelValue) == 'number')
val = this.modelValue;
else if (this.modelValue)
val = this.modelValue;
} else if (this.v == 'value') {
if (typeof(this.value) == 'number')
val = this.value;
else if (this.value)
val = this.value;
} else {
val = this.v;
}
if (this.byname) {
for (var i in this.innerrang) {
if (this.innerrang[i].name == val)
return {
...this.innerrang[i]
};
}
} else {
for (var i in this.innerrang) {
if (this.innerrang[i].id == val)
return {
...this.innerrang[i]
};
}
}
return {
id: 0,
name: ''
};
}
},
mounted() {},
methods: {
chkitem(itm) {
if (this.disabled)
return;
this.v = itm.id;
}
}
}
</script>
<style scoped>
._gp {
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: flex-end;
}
._gp._left {
flex-direction: row;
justify-content: flex-start;
}
._gp._left ._item {
flex-direction: row;
}
._gp ._item {
white-space: nowrap;
display: flex;
align-items: center;
gap: 0.5em;
min-width: 7em;
padding: 0.5em;
flex-direction: row-reverse;
}
._gp._itemright ._item {
justify-content: flex-start;
flex-direction: row-reverse;
}
._gp._line ._item {
width: 100%;
white-space: normal;
}
</style>

View File

@ -0,0 +1,134 @@
<template>
<view class="_star" :class="{_left:left,_disabled:disabled}">
<input type="hidden" :name="name" :value="innervalue" style="display:none;" />
<view @tap="selstar(item.id)" :class="item.cls" v-for="(item, index) in stars" :key="index" :style="{width:size,height:size}"></view>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue', 'update:value'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number]
},
value: {
type: [String, Number]
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
maxstar: {
type: [String, Number],
default: 5
},
size: {
type: String,
default: '2em'
},
},
data() {
return {
innervalue: this.modelValue !== undefined ? this.modelValue : this.value
};
},
watch: {
modelValue(newD) {
if (newD !== undefined) {
this.innervalue = newD;
}
},
value(newD) {
if (this.modelValue === undefined) {
this.innervalue = newD;
}
}
},
computed: {
stars() {
var stars = [];
for (var i = 1; i <= this.maxstar; i++) {
if (i <= this.innervalue)
stars.push({
id: i,
cls: '_sel'
});
else
stars.push({
id: i,
cls: '_unsel'
});
}
return stars;
},
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.innervalue
});
}
},
methods: {
updatevalue(val) {
if (val > this.maxstar)
val = this.maxstar;
this.innervalue = val;
},
selstar(id) {
if (this.disabled)
return;
var val = this.toint(id);
this.updatevalue(val);
this.$emit('update:modelValue', val);
this.$emit('change', {
name: this.name,
from: 'click',
value: val
});
}
}
}
</script>
<style scoped>
._star {
display: flex;
justify-content: flex-end;
}
._star._left {
justify-content: start;
}
._star._disabled ._sel,
._star._disabled ._unsel {
opacity: 0.3;
}
._star ._sel {
width: 2em;
height: 2em;
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTUxMS4wNDI1NiAxMTUuMzA3NTJsMTIxLjQ5NzYgMjc0LjMyNDQ4IDI5OC4zMjE5MiAzMS45NTkwNC0yMjMuMzYgMjAwLjMyNTEyIDYxLjc4ODE2IDI5My41ODU5Mi0yNTkuNTI3NjgtMTUwLjUyOC0yNjAuMTMxODQgMTQ5LjUwNCA2Mi45NTU1Mi0yOTMuMzYwNjQtMjIyLjU1NjE2LTIwMS4xOTU1MiAyOTguNDI5NDQtMzAuNzc2MzIgMTIyLjU4MzA0LTI3My44MzgwOHoiIGZpbGw9IiNGRjk2MkYiPjwvcGF0aD48L3N2Zz4=");
}
._star ._unsel {
width: 2em;
height: 2em;
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTg5Ny41NzE4NCA0MjAuNDQ0MTZsLTI2NS42NjY1Ni00MC41NDUyOEw1MTIgMTI1LjQ0IDM5Mi4wOTk4NCAzNzkuODk4ODhsLTI2NS42NjY1NiA0MC41NDUyOCAxOTIuMzUzMjggMTk2LjY2NDMyLTQ1LjcwNjI0IDI3OS40NjQ5Nkw1MTIgNzY0LjYxNTY4bDIzOC45MTk2OCAxMzEuOTU3NzYtNDUuNzExMzYtMjc5LjQ2NDk2IDE5Mi4zNjM1Mi0xOTYuNjY0MzJ6TTUxMiA3MDguNTI2MDhsLTE3OS40MDk5MiAxMDAuOTEwMDggMzQuNDk4NTYtMjAyLjcwNTkyLTE1NC4zOTg3Mi0xNTYuOTk5NjggMjA4Ljc0NzUyLTI3LjYwMTkyTDUxMiAyMjguOTE1Mmw4OS43MDc1MiAxOTMuMjEzNDQgMjA3Ljg2Njg4IDI5LjM0MjcyLTE1Mi42NTc5MiAxNTYuMTEzOTIgMzEuOTAyNzIgMjAyLjcxMTA0TDUxMiA3MDguNTI2MDh6IiBmaWxsPSIjRkY5NjJGIj48L3BhdGg+PC9zdmc+");
}
</style>

View File

@ -0,0 +1,103 @@
<template>
<view>
<view class="_searchbar" @tap="clksearch">
<view class="_icon _search"></view>
<input v-if="show" ref="refinp" :focus="showfocus" :placeholder="placeholder" style="flex: 1;font-size: 0.9em;color: #333333;" confirm-type="search" type="text" v-model="searchval" @confirm="confirm(true)" @blur="confirm(false)" />
<text v-else style="font-size: 0.9em;color: #808080;">{{ placeholder === undefined?lang('searchbar.placeholder'):placeholder }}</text>
<text @tap="confirm(true)" class="_btn" v-if="show">{{btntxt===undefined?lang('searchbar.btn'):btntxt}}</text>
</view>
</view>
</template>
<script>
export default {
emits: ['confirm'],
props: {
placeholder: {
type: String
},
btntxt: {
type: String
},
value: {
type: String,
default: ''
}
},
data() {
return {
show: false,
showfocus: false,
searchval: ''
}
},
mounted() {
this._time = 0;
this.searchval = this.value || '';
this.lastsearch = this.searchval;
if (this.searchval != '')
this.show = true;
},
methods: {
clksearch() {
this.show = true;
this.$nextTick(() => {
this.showfocus = true
});
},
confirm() {
this.hidekeyboard();
var x = new Date().getTime() - this._time;
if (x > 500) {
this._time = new Date().getTime();
this.$emit("confirm", {
value: this.searchval
});
}
if (!this.searchval)
this.show = false;
},
hidekeyboard() {
// #ifndef APP-PLUS
uni.hideKeyboard();
// #endif
// #ifdef APP-PLUS
plus.key.hideSoftKeybord();
// #endif
}
}
};
</script>
<style scoped>
._icon._search {
background-image: url("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyB2ZXJzaW9uPScxLjEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zycgd2lkdGg9JzIwMCcgaGVpZ2h0PScyMDAnPjxwYXRoIGQ9J000NTQuNjU2IDg0OS45MkMyMzEuNDI0IDg0OS45MiA1MS4yIDY2OC42NzIgNTEuMiA0NDUuNDQgNTEuMiAyMjMuMjMyIDIzMS40MjQgNDEuOTg0IDQ1NC42NTYgNDEuOTg0YzIyMi4yMDggMCA0MDMuNDU2IDE4MS4yNDggNDAzLjQ1NiA0MDMuNDU2Qzg1OC4xMTIgNjY4LjY3MiA2NzYuODY0IDg0OS45MiA0NTQuNjU2IDg0OS45MnogbTAtNzQ2LjQ5NkMyNjYuMjQgMTAzLjQyNCAxMTIuNjQgMjU3LjAyNCAxMTIuNjQgNDQ1LjQ0czE1My42IDM0Mi4wMTYgMzQyLjAxNiAzNDIuMDE2IDM0Mi4wMTYtMTUzLjYgMzQyLjAxNi0zNDIuMDE2LTE1My42LTM0Mi4wMTYtMzQyLjAxNi0zNDIuMDE2eicgZmlsbD0nIzEyOTZkYic+PC9wYXRoPjxwYXRoIGQ9J005NDIuMDggMTAwOC42NGMtMTIuMjg4IDAtMjMuNTUyLTQuMDk2LTMyLjc2OC0xMy4zMTJMNzM3LjI4IDgyMi4yNzJjLTE4LjQzMi0xOC40MzItMTguNDMyLTQ3LjEwNCAwLTY1LjUzNnM0Ny4xMDQtMTguNDMyIDY1LjUzNiAwbDE3Mi4wMzIgMTcyLjAzMmMxOC40MzIgMTguNDMyIDE4LjQzMiA0Ny4xMDQgMCA2NS41MzYtOS4yMTYgOS4yMTYtMjAuNDggMTQuMzM2LTMyLjc2OCAxNC4zMzZ6JyBmaWxsPScjMTMyMjdhJyBjbGFzcz0nJz48L3BhdGg+PC9zdmc+");
}
._icon {
width: 1em;
height: 1em;
margin: 0 0.4em;
background-size: cover;
}
._searchbar {
display: flex;
box-sizing: border-box;
overflow: hidden;
flex: 1;
justify-content: center;
align-items: center;
height: 2.5em;
border: 1px solid var(--bg5);
border-radius: 0.3em;
background: var(--bg1);
}
._btn {
padding: 0 0.5em;
line-height: 2.5em;
font-size: 0.9em;
color: var(--txt6);
}
</style>

View File

@ -0,0 +1,175 @@
<template>
<view class="_vli" v-if="lis.length > 0">
<view class="_ul">
<template v-for="(item,index) in lilist" :key="index">
<view class="itm" :class="{_active:liid==item.id}" @tap="changeli(index)">
{{lang(item.name)}}
</view>
</template>
</view>
</view>
</template>
<script>
export default {
emits: ['change', 'update:modelValue'],
props: {
modelValue: {
type: [String, Number],
default: 0
},
value: {
type: [String, Number],
default: 0
},
initevent: {
type: Boolean,
default: false
},
all: {
type: String,
default: ''
},
lis: {
type: [String, Array],
default: []
}
},
data() {
return {
v: ''
};
},
watch: {
value: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'modelValue';
},
immediate: true
}
},
computed: {
liid() {
var val = '';
if (this.v == 'modelValue') {
val = this.modelValue + '';
} else if (this.v == 'value') {
val = this.value + '';
} else {
val = this.v;
}
return val;
},
lilist() {
var lst = [];
var idx = 0;
if (this.all) {
lst.push({
id: '',
name: this.all
});
}
if (typeof(this.lis) == 'string') {
const lis = this.lis.split(',');
for (let i = 0; i < lis.length; i++) {
const ls = lis[i].split(':');
if (ls.length < 2)
continue;
lst.push({
id: ls[0],
name: ls[1]
});
}
}
if (this.isarray(this.lis)) {
for (var i = 0; i < this.lis.length; i++)
lst.push({
...this.lis[i]
});
}
return lst;
}
},
mounted() {
this._index = 0;
if (this.initevent) {
this.changeli(this._index);
}
},
methods: {
changeli(idx) {
if (!this.lilist)
return;
if (!this.lilist[idx])
return;
var val = {
_index: idx,
...this.lilist[idx]
};
this._index = idx;
this.v = val.id + '';
this.$emit('update:modelValue', val.id);
this.$emit('change', {
value: val
});
}
}
}
</script>
<style scoped>
._vli {
overflow-x: scroll;
overflow-y: hidden;
background: var(--bg1);
border-bottom: 1px solid var(--bg6);
}
._vli>._ul {
display: flex;
align-items: center;
height: 3em;
}
._vli>._ul>.itm {
flex: 1;
position: relative;
text-align: center;
white-space: nowrap;
padding: 0 0.5em;
color: var(--txt7);
}
._vli>._ul>.itm._active {
background: linear-gradient(331deg, var(--man5), var(--man7));
background-clip: text;
-webkit-background-clip: text;
color: transparent;
}
._vli>._ul>.itm::after {
content: "";
position: absolute;
border-radius: 0.3em;
height: 0.3em;
bottom: -0.5em;
width: 0em;
left: 50%;
background: linear-gradient(331deg, var(--man5), var(--man7));
opacity: 0;
transition: all 0.5s;
}
._vli>._ul>.itm._active::after {
width: 2em;
opacity: 1;
left: calc(50% - 1em);
}
</style>

View File

@ -0,0 +1,289 @@
<template>
<view class="_switch" :class="{_disabled:disabled}" @tap="clickswitch(!this.tvalue)" :animation="anidatabg">
<input :name="name" :value="tvalue?1:2" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_name'" :value="tvalue?this.y:this.n" style="display:none;" />
<view class="_y" :animation="anidatay">{{y}}</view>
<view class="_n" :animation="anidatan">{{n}}</view>
<ciy-gesture :pxlen="10" @toleft="gestureto(false)" @toright="gestureto(true)">
<view class="_bn" :animation="anidatabn"></view>
</ciy-gesture>
</view>
</template>
<style scoped>
._switch {
display: inline-block;
line-height: 2em;
height: 2em;
font-size: 1em;
position: relative;
border: 1px solid var(--e-switch-br);
background: var(--e-switch-bg);
color: var(--e-switch-txt);
border-radius: 1em;
overflow: hidden;
}
._switch._disabled {
background: var(--bg4);
}
._switch ._n {
position: relative;
margin-top: -2em;
margin-left: 2em;
margin-right: 0.8em;
color: var(--e-switch-txt);
text-align: right;
}
._switch ._y {
margin-right: 2em;
margin-left: 0.8em;
color: var(--e-switch-chktxt);
opacity: 0;
text-align: left;
}
._switch ._bn {
position: absolute;
top: 0;
left: 0;
width: 1.6em;
height: 1.6em;
margin: 0.1em;
border-radius: 0.8em;
background: var(--e-switch-bg);
box-shadow: var(--e-switch-shadow);
}
._switch._disabled ._bn {
background: var(--bg5);
}
</style>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number, Boolean],
default: -998
},
value: {
type: [String, Number, Boolean],
default: -998
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
y: { //
type: String,
default: ''
},
n: { //
type: String,
default: ''
},
ms: { //
type: Number,
default: 200
}
},
data() {
return {
v: '',
anidatabg: {},
anidatay: {},
anidatan: {},
anidatabn: {},
};
},
watch: {
tvalue: {
handler(newD, oldD) {
if (this.v == 'modelValue' || this.v == 'value')
this.ani();
}
},
value: {
handler(newD, oldD) {
if (newD === -998)
return;
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD === -998)
return;
if (newD || oldD)
this.v = 'modelValue';
},
immediate: true
}
},
computed: {
tvalue() {
if (this.v == 'modelValue') {
if (typeof(this.modelValue) == 'boolean')
return this.modelValue;
else if (typeof(this.modelValue) == 'number')
return (this.modelValue == 1);
else if (this.modelValue.toLowerCase() == 'true')
return true;
else if (this.modelValue == '1')
return true;
else
return false;
} else if (this.v == 'value') {
if (typeof(this.value) == 'boolean')
return this.value;
else if (typeof(this.value) == 'number')
return (this.value == 1);
else if (this.value.toLowerCase() == 'true')
return true;
else if (this.value == '1')
return true;
else
return false;
}
return this.v;
}
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.tvalue ? 1 : 2
});
}
if (this.tvalue)
this.ani();
},
methods: {
chg(e) {
this.clickswitch(!this.tvalue);
},
ani() {
uni.createSelectorQuery().in(this).select('._switch').boundingClientRect(data => {
if (!data)
return;
var ln = data.width - data.height;
var time = this.ms;
var len = this.y.length > this.n.length ? this.y.length : this.n.length;
len = 0;
if (this.tvalue) {
var animation = uni.createAnimation({});
if (len > 0) {
animation.translateX((ln / 2) + 'px');
animation.translateY('4px');
animation.scale(0.9);
animation.step({
duration: time / 2
});
}
animation.translateX(ln + 'px');
//animation.translateY(0);
animation.scale(1);
animation.step({
duration: (len > 0 ? time / 2 : time)
});
this.anidatabn = animation.export();
var animation = uni.createAnimation({});
animation.backgroundColor(this.disabled ? 'var(--e-switch-chkbgdis)' : 'var(--e-switch-chkbg)');
animation.step({
duration: time
});
this.anidatabg = animation.export();
var animation = uni.createAnimation({});
animation.translateX('20px');
animation.opacity(0);
animation.step({
duration: time
});
this.anidatan = animation.export();
var animation = uni.createAnimation({});
animation.opacity(1);
animation.step({
duration: time
});
this.anidatay = animation.export();
} else {
var animation = uni.createAnimation({});
if (len > 0) {
animation.translateX((ln / 2) + 'px');
animation.translateY('-4px');
animation.scale(0.9);
animation.step({
duration: time / 2
});
}
animation.translateX(0);
//animation.translateY(0);
animation.scale(1);
animation.step({
duration: (len > 0 ? time / 2 : time)
});
this.anidatabn = animation.export();
var animation = uni.createAnimation({});
animation.backgroundColor(this.disabled ? 'var(--e-switch-br)' : 'var(--e-switch-bg)');
animation.step({
duration: time
});
this.anidatabg = animation.export();
var animation = uni.createAnimation({});
animation.opacity(1);
animation.step({
duration: time
});
this.anidatan = animation.export();
var animation = uni.createAnimation({});
animation.translateX('-20px');
animation.opacity(0);
animation.step({
duration: time
});
this.anidatay = animation.export();
}
}).exec();
},
gestureto(chk) {
if (chk == this.v)
return;
this.clickswitch(chk);
},
clickswitch(chk) {
if (this.disabled)
return;
this.v = chk;
this.ani();
this.$emit('update:modelValue', this.tvalue ? 1 : 2);
this.$emit('change', {
name: this.name,
from: 'input',
value: this.tvalue ? 1 : 2
});
}
}
}
</script>

View File

@ -0,0 +1,410 @@
<template>
<view style="width:100%;">
<input type="hidden" :name="name" :value="tvalue.value" style="display:none;" />
<template v-if="hasmore">
<checkbox-group :name="name+'_name'" style="display:none;">
<checkbox v-for="(item,index) in tvalue.names" :key="index" :value="item" checked />
</checkbox-group>
<checkbox-group :name="name+'_id'" style="display:none;">
<checkbox v-for="(item,index) in tvalue.ids" :key="index" :value="item" checked />
</checkbox-group>
</template>
<view class="_show" @tap="showhide(true)" :class="{_disabled:disabled}">
<slot name="list" :data="{value:tvalue, range:range}">
<view class="_defshow" :class="{_left:left}">
<template v-for="(item,index) in tvalue.sels" :key="index">
<view style="padding-left:0.3em;" v-if="index>0">~</view>
<view class="itm" v-if="item.id > 0">{{item.name}}</view>
</template>
<view class="itm" v-if="tvalue.sels.length == 0">{{placeholder?placeholder:lang('placeholder.select')}}</view>
</view>
</slot>
</view>
<ciy-anipop v-model="popsh">
<view class="_pop">
<view class="_op">
<view class="_cata">
<template v-for="(item,index) in openvalue.sels" :key="index">
<view v-if="item.high" class="itm _level">{{item.name}}</view>
<view v-else @tap="sellevel(index)" class="itm">{{item.name}}</view>
</template>
</view>
<view>
<button class="btn sm def" @tap="selclear" v-if="clearbtn">{{lang('selcas.clear')}}</button>
<button class="btn sm" @tap="seldone">{{lang('selcas.done')}}</button>
</view>
</view>
<view class="_list">
<template v-for="(item,index) in range" :key="index">
<view class="itm" @tap="selandnext(index)" v-if="(!chkuse || item.isuse != 2) && item.upid == openvalue.upval" :class="{select:item.id == openvalue.value}">
{{item.name}}
</view>
</template>
</view>
</view>
</ciy-anipop>
</view>
</template>
<style scoped>
._defshow {
display: flex;
justify-content: flex-end;
flex-wrap: wrap;
}
._defshow._left {
justify-content: flex-start;
}
._defshow>.itm {
padding-left: 0.3em;
white-space: nowrap;
}
._show._disabled {
color: #cccccc;
}
._pop {
display: flex;
z-index: 1;
flex-direction: column;
background: var(--bg2);
border-top: 1px solid var(--bg6);
padding: 0.5em;
border-radius: 1em 1em 0 0;
height: 60vh;
}
._pop ._op {
display: flex;
}
._pop ._op ._cata {
flex: 1;
display: flex;
flex-wrap: wrap;
margin-top: 0.3em;
}
._pop ._op ._cata>.itm {
white-space: nowrap;
}
._pop ._op ._cata>.itm:first-child::before {
content: "";
display: none;
}
._pop ._op ._cata>.itm::before {
content: "";
vertical-align: middle;
display: inline-block;
width: 0.7em;
height: 0.7em;
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgZGF0YS1zcG0tYW5jaG9yLWlkPSJhMzEzeC5zZWFyY2hfaW5kZXguMC5pMy40MTE0M2E4MThFZlpjRiI+PHBhdGggZD0iTTM1OC42NzggODJMMjk2IDE0NC42NDZsMzUxLjg3IDM1MS42OTNjNy45ODggNy45ODQgOC42MDMgMjAuNTQ3IDEuODQzIDI5LjIzNmwtMS44NDMgMi4wODdMMjk2IDg3OS4zNTQgMzU4LjY3OCA5NDJsMzUxLjg3LTM1MS42OTJjNDEuOTU4LTQxLjkzOCA0My4yMy0xMDkuMTQyIDMuODE0LTE1Mi42MTFsLTMuODE0LTQuMDA1TDM1OC42NzggODJ6IiBkYXRhLXNwbS1hbmNob3ItaWQ9ImEzMTN4LnNlYXJjaF9pbmRleC4wLmkxLjQxMTQzYTgxOEVmWmNGIiBmaWxsPSIjNzc3Nzc3Ij48L3BhdGg+PC9zdmc+");
}
._pop ._op ._cata ._level {
color: var(--man5);
}
._pop ._list {
flex: 1;
text-align: left;
overflow: auto;
padding: 1em 0.5em 0 0.5em;
}
._pop ._list>.itm {
min-height: 3em;
}
._pop ._list>.itm.select {
color: var(--man5);
}
</style>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue', 'loaddata'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number],
default: ''
},
value: {
type: [String, Number],
default: ''
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
chkuse: {
type: Boolean,
default: false
},
range: {
type: Array,
default: []
},
left: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
placeholder: {
type: String
},
clearbtn: {
type: Boolean,
default: false
},
rootupid: {
type: [String, Number],
default: undefined
},
asyncdata: {
type: Boolean,
default: false
},
allowpart: { //
type: Boolean,
default: false
}
},
data() {
return {
v: '',
editval: {
value: 0,
enext: false
}, //openvalue
popsh: false
};
},
watch: {
value: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'value';
if (newD) {
this.$emit('update:modelValue', newD);
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: newD,
selvalue: {}
});
}
}
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'modelValue';
if (newD) {
this.$emit('update:modelValue', newD);
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: newD,
selvalue: {}
});
}
}
},
immediate: true
}
},
computed: {
tvalue() { //
var val = '';
if (this.v == 'modelValue') {
val = this.modelValue;
} else if (this.v == 'value') {
val = this.value;
} else {
val = this.v;
}
var vals = [];
var tval = {};
var fillvid = id => {
for (var i in this.range) {
if (this.range[i].id == id) {
fillvid(this.range[i].upid);
vals.push({
...this.range[i]
});
}
}
}
fillvid(val);
tval.sels = vals;
tval.value = val;
if (vals.length == 0) {
tval.upval = this.rootupid;
} else {
tval.upval = vals[vals.length - 1].upid;
}
var idarr = [];
var namearr = [];
for (var i in tval.sels) {
idarr.push(tval.sels[i].id + '');
namearr.push(tval.sels[i].name + '');
}
tval.names = namearr;
tval.ids = idarr;
return tval;
},
openvalue() { //
var val = this.editval.value;
var oval = {};
var vals = [];
var fillvid = id => {
for (var i in this.range) {
if (this.range[i].id == id) {
fillvid(this.range[i].upid);
vals.push({
...this.range[i]
});
}
}
}
fillvid(val);
if (this.editval.enext) {
var hasnext = this.arrayfind(this.range, this.editval.value, 'upid');
if (hasnext > -1)
vals.push({
id: this.editval.value,
upid: this.editval.value,
high: true,
name: this.placeholder
});
else
vals[vals.length - 1].high = true;
} else {
if (vals.length > 0)
vals[vals.length - 1].high = true;
else
vals.push({
id: this.editval.value,
upid: this.rootupid,
high: true,
name: this.placeholder
});
}
if (vals.length == 0) {
oval.upval = this.rootupid;
val = this.rootupid;
} else {
oval.upval = vals[vals.length - 1].upid;
}
oval.sels = vals;
oval.value = val;
return oval;
}
},
mounted() {},
methods: {
showhide(bsh) {
if (this.disabled)
return;
this.popsh = !this.popsh;
if (this.popsh) {
this._runajax = false;
this.editval = {
value: this.tvalue.value,
enext: false
};
}
},
sellevel(idx) {
this._runajax = false;
this.editval = {
value: this.openvalue.sels[idx].id,
enext: false
};
},
selandnext(idx) {
this._runajax = false;
if (this.asyncdata) {
if (!this.range[idx]._ajax) {
this.range[idx]._ajax = true;
var hasnext = this.arrayfind(this.range, this.range[idx].id, 'upid');
if (hasnext == -1) {
(index => {
this._runajax = true;
this.$emit('loaddata', {
range: this.range[index],
success: () => {
if (this._runajax)
this.selandnext(index);
},
fail: () => {
this.range[index]._ajax = false;
}
});
})(idx);
return;
}
}
}
this.editval = {
value: this.range[idx].id,
enext: true
};
},
selclear() {
this.$emit('update:modelValue', 0);
this.$emit('change', {
name: this.name,
from: 'clear',
value: 0,
selvalue: {}
});
this.v = 0;
this.popsh = false;
},
seldone() {
for (var i = this.openvalue.sels.length - 1; i >= 0; i--) {
if (this.openvalue.sels[i].id == 0)
continue;
var hasnext = this.arrayfind(this.range, this.openvalue.sels[i].id, 'upid');
if (hasnext > -1 && !this.allowpart)
return this.selandnext(hasnext);
var thisv = this.openvalue.sels[i];
this.$emit('update:modelValue', thisv.id);
this.$emit('change', {
name: this.name,
from: 'done',
value: thisv.id,
selvalue: {
...thisv
}
});
this.v = thisv.id;
this.popsh = false;
break;
}
}
}
}
</script>

View File

@ -0,0 +1,477 @@
<template>
<view class="_select">
<view class="_mask" @touchmove.stop.prevent="() => { }" v-if="popclass" @tap="hidepop"></view>
<view class="_pop" :animation="anidatapop" v-if="popclass" :class="popclass">
<view class="ciy-hr"></view>
<view class="_search" v-if="range.length > minselectsearch">
<view class="itm">
<input v-model="searchval" :placeholder="lang('placeholder.key')" @confirm="searchconfirm" />
</view>
</view>
<view class="_list" :class="rows==1?'_flex':'_grid'" :style="'grid-template-columns: repeat('+rows+', 1fr);text-align:' + itemalign">
<slot name="list" :data="{range:mrange,searchkey:searchval,popclass:popclass,onselect:Selitem}">
<view class="_item" :class="{_select:tvalue.id==item.id}" v-for="(item,index) in mrange" :key="index" @tap="Selitem(index)">
{{item.name}}
</view>
<template v-if="mrange.length == 0">
<view v-if="searchval" class="_nodata">
{{lang('select.nosearch')}}
<text class="_code">{{searchval}}</text>
</view>
<view v-else class="_nodata">{{lang('select.nodata')}}</view>
</template>
</slot>
</view>
<view class="ciy-hr"></view>
<view style="flex:1;pointer-events: none;width:100%;" @touchmove.stop.prevent="() => { }" @tap="hidepop"></view>
</view>
<view class="_show" :class="{_left:left}" @tap="showpop">
<view class="_txt" :style="ciystyle">
<view v-if="tvalue.name" :style="{color:disabled?'var(--bg6)':'var(--txt9)'}">{{tvalue.name}}</view>
<view v-else-if="placeholder !== ''" style="color:var(--txt1);">{{placeholder?placeholder:lang('placeholder.select')}}</view>
</view>
<view v-if="!noarrow" class="_arrow ciy-icon-arrow" :class="{_sel:popclass}"></view>
</view>
<input type="hidden" :name="name" :value="tvalue.id" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_name'" :value="tvalue.name" style="display:none;" />
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue', 'search'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number],
default: ''
},
value: {
type: [String, Number],
default: ''
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
ciystyle: {
type: [String, Object]
},
left: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
chkuse: {
type: Boolean,
default: false
},
range: {
type: Array,
default: []
},
placeholder: {
type: String
},
diastema: { //
type: Number,
default: 16
},
itemalign: { //item
type: String,
default: ''
},
all: { //0
type: String,
default: ''
},
noarrow: {
type: Boolean,
default: false
},
rows: {
type: Number,
default: 1
},
minselectsearch: { //n
type: Number,
default: 5
}
},
data() {
return {
v: '',
searchval: '', //
popclass: '', //[btm/top]
anidatapop: {}, //
addrange: [] //
};
},
watch: {
searchval: {
handler(newD, oldD) {
this.$emit('search', {
name: this.name,
from: 'input',
com: this,
value: newD
});
}
},
value: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'modelValue';
},
immediate: true
},
},
computed: {
mrange() {
var mr = [];
if (this.all)
mr.push({
id: 0,
name: this.all
});
for (var i in this.range) {
if(this.chkuse && this.range[i].isuse == 2)
continue;
if (this.range[i].name.indexOf(this.searchval) > -1)
mr.push(this.range[i]);
}
for (var i in this.addrange) {
if(this.chkuse && this.range[i].isuse == 2)
continue;
if (this.addrange[i].name.indexOf(this.searchval) > -1)
mr.push(this.addrange[i]);
}
return mr;
},
tvalue() {
var val = '';
if (this.v == 'modelValue') {
if (typeof(this.modelValue) == 'number')
val = this.modelValue;
else if (this.modelValue)
val = this.modelValue;
} else if (this.v == 'value') {
if (typeof(this.value) == 'number')
val = this.value;
else if (this.value)
val = this.value;
} else if (this.v instanceof Object) {
return this.v;
}
for (var i in this.range) {
if (this.range[i].id == val)
return {
_index: i,
...this.range[i]
};
}
if (this.range.length > 0 && this.placeholder === '')
return {
_index: 0,
...this.range[0]
};
return {
id: 0,
_index: -1,
name: ''
};
}
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: {
...this.tvalue
}
});
}
this.lastvalue = {
...this.tvalue
};
},
methods: {
searchconfirm(e) {
this.$emit('search', {
name: this.name,
from: 'confirm',
com: this,
value: e.detail.value
});
},
Addrange(newrange) {
if (!(newrange instanceof Array))
return 'ERR: Not Array.';
var addarr = [];
for (var i in newrange) {
var bfind = false;
for (var r in this.range) {
if (newrange[i].id == this.range[r].id) {
bfind = true;
break;
}
}
if (bfind)
continue;
for (var r in this.addrange) {
if (newrange[i].id == this.addrange[r].id) {
bfind = true;
break;
}
}
if (bfind)
continue;
for (var r in addarr) {
if (newrange[i].id == addarr[r].id) {
bfind = true;
break;
}
}
if (bfind)
continue;
addarr.push(newrange[i]);
}
this.addrange.push(...addarr);
return true;
},
Selitem(index) {
this.v = this.mrange[index];
this.$emit('update:modelValue', this.v.id);
this.$emit('change', {
name: this.name,
from: 'select',
value: {
_index: index,
...this.v
},
lastvalue: this.lastvalue
});
this.lastvalue = {
_index: index,
...this.v
};
this.hidepop();
},
hidepop() {
var animation = uni.createAnimation({});
animation.translateX('100vw');
animation.opacity(0);
animation.step({
duration: 200
});
animation.height('auto');
this.anidatapop = animation.export();
setTimeout(() => {
this.popclass = '';
}, 300);
},
async showpop() {
if (this.disabled)
return;
var app = getApp();
app.globalData.scrollcbs['com_select'] = e => {
delete app.globalData.scrollcbs['com_select'];
this.hidepop();
};
const {
headerheight,
footerheight
} = await this.com_gethdft();
var fixtop = 0;
this.searchval = '';
this.popclass = 'temp';
var mainrect = await this.getrect('._pop');
if (!mainrect)
return;
var showrect = await this.getrect('._show');
if (!showrect)
return;
var toph = showrect.top - headerheight - this.diastema;
var btmh = app.globalData._sysinfo.windowHeight - footerheight - showrect.bottom - this.diastema;
var topcls = '_btm';
var syheight, sytop;
if (toph > btmh) {
topcls = '_top';
syheight = mainrect.height;
if (syheight > toph)
syheight = toph;
sytop = headerheight + fixtop + toph - syheight;
} else {
syheight = mainrect.height;
if (syheight > btmh)
syheight = btmh;
sytop = showrect.bottom + this.diastema - fixtop;
}
this.popclass = topcls;
this.$nextTick(() => {
var animation = uni.createAnimation({});
animation.translateX(0);
animation.top(sytop);
animation.height(syheight);
animation.opacity(1);
animation.step({
duration: 200
});
this.anidatapop = animation.export();
});
}
}
}
</script>
<style scoped>
._select ._pop {
position: fixed;
display: flex;
flex-direction: column;
align-items: flex-start;
opacity: 0;
left: 0;
right: 0;
transform: translateX(100vw);
transform: translateY(38px);
z-index: 992;
}
._select ._pop ._search {
background: var(--bg2);
box-sizing: border-box;
padding: 0.5em;
width: 100%;
}
._select ._pop ._search>.itm {
background: var(--bg1);
border: 1px solid var(--bg4);
border-radius: 0.5em;
padding: 0.5em;
text-align: left;
}
._select ._pop._top {
justify-content: flex-end;
flex-direction: column-reverse;
}
._select ._pop._top ._list._flex {
/* flex-direction: column-reverse; */
}
._select ._pop ._list._flex {
display: flex;
flex-direction: column;
width: 100%;
overflow: auto;
text-align: left;
overscroll-behavior-y: contain !important;
background: var(--bg2);
}
._select ._item._select {
font-weight: bold;
color: var(--man6);
}
._select ._pop ._list._flex ._item {
padding: 1em 1em;
width: 100%;
border-top: 1px solid var(--bg4);
}
._select ._pop ._list._grid {
display: grid;
width: 100%;
overflow: auto;
text-align: left;
background: var(--bg2);
}
._select ._pop ._list._grid ._item {
padding: 1em 1em;
width: 100%;
border-top: 1px solid var(--bg4);
}
._select ._pop._top ._list._grid {
transform: rotate(180deg);
}
._select ._pop._top ._list._grid ._item {
transform: rotate(180deg);
}
._select ._pop ._list ._nodata {
background: var(--bg2);
text-align: center;
padding: 2em 0 1em 0;
color: var(--txt1);
}
._select {
position: relative;
}
._select ._show {
padding: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display: flex;
justify-content: flex-end;
align-items: center;
}
._select ._show._left {
justify-content: flex-start;
}
._select ._show._left ._txt {
text-align: left;
}
._select ._show ._arrow {
width: 1.5em;
height: 1.5em;
margin-left: 0.3em;
transition: transform 0.3s;
}
._select ._show ._arrow._sel {
transform: rotate(180deg);
}
._select ._mask {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
backgroundx: #f3abec99;
z-index: 992;
backdrop-filterx: blur(10px);
}
</style>

View File

@ -0,0 +1,229 @@
<template>
<view>
<input type="hidden" v-if="name=='loc'" name="lng" :value="tvalue.lng" style="display:none;" />
<input type="hidden" v-else :name="name+'_lng'" :value="tvalue.lng" style="display:none;" />
<input type="hidden" v-if="name=='loc'" name="lat" :value="tvalue.lat" style="display:none;" />
<input type="hidden" v-else :name="name+'_lat'" :value="tvalue.lat" style="display:none;" />
<template v-if="hasmore">
<input type="hidden" :name="name+'_name'" :value="loc.name" style="display:none;" />
<input type="hidden" :name="name+'_addr'" :value="loc.addr" style="display:none;" />
<input type="hidden" :name="name+'_latlng'" :value="tvalue.lat+','+tvalue.lng" style="display:none;" />
</template>
<view style="display:flex;align-items: center;">
<template v-if="left">
<view class="_btn" :class="{_disabled:disabled}" @tap="map_select">
<view class="_icon _mapicon"></view>
</view>
<slot name="show" :data="{value:tvalue, loc:loc, bet:innerbet}">
<view style="line-height:1.5em;font-size:0.9em;flex: 1; margin-left:0.5em;text-align:left;">
<view v-if="loc.name || loc.addr">{{loc.name}}<br />{{loc.addr}}</view>
<view v-else-if="tvalue.lat == 0" style="padding-top:0.3em;display:inline-block;">{{lang('selmap.select')}}</view>
<view v-else style="padding-top:0.3em;display:inline-block;">{{lang('selmap.loced')}}</view>
</view>
</slot>
</template>
<template v-else>
<slot name="show" :data="{value:tvalue, loc:loc, bet:innerbet}">
<view style="line-height:1.5em;font-size:0.9em;flex: 1; margin-right:0.5em;">
<view v-if="loc.name || loc.addr">{{loc.name}}<br />{{loc.addr}}</view>
<view v-else-if="tvalue.lat == 0" style="padding-top:0.3em;display:inline-block;">{{lang('selmap.select')}}</view>
<view v-else style="padding-top:0.3em;display:inline-block;">{{lang('selmap.loced')}}</view>
</view>
</slot>
<view class="_btn" :class="{_disabled:disabled}" @tap="map_select">
<view class="_icon _mapicon"></view>
</view>
</template>
</view>
</view>
</template>
<script>
import gcoord from '@/util/gcoord.js'
export default {
behaviors: ['uni://form-field-group'],
emits: ['update:lng', 'update:lat', 'change'],
props: {
name: {
type: String,
default: 'loc'
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
bet: {
type: [String, Number],
default: 10000000
},
lat: {
type: [String, Number],
default: ''
},
lng: {
type: [String, Number],
default: ''
}
},
data() {
return {
loc: {},
vlat: null,
vlng: null
};
},
watch: {
lat: {
handler(newD, oldD) {
if (newD || oldD)
this.vlat = null;
},
immediate: true
},
lng: {
handler(newD, oldD) {
if (newD || oldD)
this.vlng = null;
},
immediate: true
}
},
computed: {
tvalue() {
var ret = {};
if (this.vlat !== null) {
ret.lat = this.vlat;
} else {
ret.lat = this.tofloat(this.lat);
}
if (this.vlng !== null) {
ret.lng = this.vlng;
} else {
ret.lng = this.tofloat(this.lng);
}
return ret;
},
innerbet() {
var bet = this.bet;
if (bet <= 1)
return 1;
return this.toint(bet);
}
},
mounted() {},
methods: {
async map_select(e) {
if (this.disabled)
return;
var result;
if (this.toint(this.lat) == 0) {
result = this.getstorage('_map');
if (!result || result.length != 2) {
result = [1164000000, 398000000];
} else {
result[0] += 50000 * Math.random();
result[1] += 50000 * Math.random();
}
} else {
result = gcoord.transform([this.lng / this.innerbet, this.lat / this.innerbet], gcoord.WGS84, gcoord.GCJ02);
result[0] = this.caldectoint(result[0]);
result[1] = this.caldectoint(result[1]);
}
try {
var retchoose = await uni.chooseLocation({
longitude: result[0] / this.innerbet,
latitude: result[1] / this.innerbet
});
} catch (res) {
if (res.errMsg.indexOf('cancel') > -1)
return;
this.alert(res.errMsg);
return;
}
if (!retchoose.longitude)
return this.alert(this.lang('selmap.noselect'));
var result = gcoord.transform([retchoose.longitude, retchoose.latitude], gcoord.GCJ02, gcoord.WGS84);
result[0] = this.caldectoint(result[0]);
result[1] = this.caldectoint(result[1]);
this.setstorage('_map', result);
this.loc.name = retchoose.name;
this.loc.addr = retchoose.address;
this.loc.distance = retchoose.distance;
this.$emit('update:lng', result[0]);
this.$emit('update:lat', result[1]);
this.vlat = result[1];
this.vlng = result[0];
this.$emit('change', {
name: this.name,
from: 'choose',
value: {
...this.loc
},
lng: result[0],
lat: result[1]
});
//gcj02
// gcoord.WGS84 [lng,lat] WGS-84GPS
// gcoord.GCJ02 [lng,lat] GCJ-02googlesosoaliyunmapabc
// gcoord.BD09 [lng,lat] BD-09
// gcoord.BD09LL [lng,lat] BD09
// gcoord.BD09MC [x,y] BD-09
// gcoord.BD09Meter [x,y] BD09MC
// gcoord.Baidu [lng,lat] BD-09BD-09
// gcoord.BMap [lng,lat] BD-09BD-09
// gcoord.AMap [lng,lat] GCJ-02
// gcoord.WebMercator [x,y] Web MercatorEPSG3857
// gcoord.WGS1984 [lng,lat] WGS-84WGS-84
// gcoord.EPSG4326 [lng,lat] WGS-84WGS-84
// gcoord.EPSG3857 [x,y] Web MercatorWebMercator
// gcoord.EPSG900913 [x,y] Web MercatorWebMercator
},
caldectoint(dec) {
if (this.innerbet <= 1)
return dec;
return this.toint(dec * this.innerbet);
}
}
}
</script>
<style scoped>
._btn {
padding: 0.2em;
width: 2em;
height: 2em;
border: 1px solid #cccccc;
display: inline-block;
border-radius: 0.3em;
background: #ffffff;
}
._btn._disabled {
background: #ebebeb;
filter: grayscale(0.8);
}
._icon {
width: 100%;
height: 100%;
margin: 0 auto;
background-size: cover;
}
._icon._mapicon {
background-image: url("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyB2ZXJzaW9uPScxLjEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc+PHBhdGggZD0nTTUxMiA1MTJtLTUxMiAwYTUxMiA1MTIgMCAxIDAgMTAyNCAwIDUxMiA1MTIgMCAxIDAtMTAyNCAwWicgZmlsbD0nIzFFOUZGRic+PC9wYXRoPjxwYXRoIGQ9J002NjguNTQxIDM0NS43MTRjMC05MS41NzktODAuOTIxLTE2My45OS0xNzAuMzc3LTE2My45OS04OS40NSAwLTE2OC4yNDMgNzIuNDA5LTE2OC4yNDMgMTYzLjk4OSAwIDgzLjA1MyAxNjguMjQzIDI4My4yNTggMTY4LjI0MyAyODMuMjU4czE3MC4zNzctMTk1Ljk0MyAxNzAuMzc3LTI4My4yNTd6IG0tMjMyLjEzNSA4LjUyMmMwLTM2LjIxIDI5LjgxLTY2LjAyMiA2My44ODUtNjMuODk3IDM0LjA4OSAwIDYzLjg5OSAyNy42ODcgNjMuODk5IDYzLjg5NyAwLjAwMSAzNC4wNzUtMjcuNjkyIDYzLjg4NS02My44OTkgNjMuODg1LTM0LjA3NSAwLjAwMS02My44ODUtMjcuNjc5LTYzLjg4NS02My44ODV6JyBmaWxsPScjRkZGRkZGJz48L3BhdGg+PHBhdGggZD0nTTUzNi40NjUgNzU4Ljc2bC0yLjA4Ni02LjI2N2MyLjYwMi0wLjk3NyA1LjIwNC0xLjk1NSA3LjgyOC0yLjk1MyAzMi4zMDUtNDcuMjM5IDEwMC4xNDYtNzkuNzc2IDE3OC42MjMtNzkuNzc2IDIuOTM4IDAgNS44NTkgMC4wNTYgOC43NjcgMC4xNDZsLTEuNDIxLTQuNzMyYzIxLjMwMS02LjM5NiA0NC43My04LjUxNiA2Ni4wMjktMTAuNjU1aC0wLjAwMXYyMS4zMTFjLTMuNTA3IDAuMzg4LTcuMDE1IDAuNzc3LTEwLjUzNiAxLjE5MSAxMS44NTUgMi44MjMgMjMuMjEgNi40MjggMzMuOTU0IDEwLjcyMlY1MDEuMTg4YzAtMjMuNDI5LTE5LjE2NS00Mi41OTktNDQuNzE1LTQyLjU5OUg2NjQuMjk0Yy02MS43NjYgMTA4LjYxNi0xNjguMjUyIDIzMi4xNDctMTY4LjI1MiAyMzIuMTQ3UzM5My44MDkgNTY3LjIwNCAzMzQuMTc0IDQ1OC41OWgtODcuMzE4Yy0yMy40MyAwLTQ0LjcxNiAxOS4xNjctNDQuNzE2IDQyLjU5OXYyOTguMTY2YzAgMjMuNDE4IDIxLjI4NiA0Mi41ODYgNDQuNzE2IDQyLjU4NmgyNzkuNjljLTIuOTEtOS42ODEtNC40NTYtMTkuNzIzLTQuNDU2LTMwLjAyMyAwLTE4Ljc5NyA1LjExMS0zNi43MzYgMTQuMzc1LTUzLjE1OHogbS0yNDkuMTQyLTMzLjk0N2MtMTkuMTY3LTguNTI1LTM2LjIwNy0yMS4zMDEtNTUuMzcyLTM0LjA3NWwxMi43NzQtMTcuMDVjMTcuMDM3IDEyLjc4NiAzNi4yMDUgMjMuNDI5IDUzLjI0IDM0LjA3NmwtMTAuNjQyIDE3LjA0OXogbTk3Ljk3MiA0NC43MThjLTE5LjE2Ny04LjUxNi0zOC4zMzQtMTQuOTA3LTU5LjYzNS0yMy40MzRsOC41MTQtMTkuMTY5YzE5LjE2NiA4LjUyNiAzOC4zMzcgMTcuMDU0IDU3LjUwMyAyMS4zMTNsLTYuMzgyIDIxLjI5eiBtNzIuNDExIDEyLjc4NGMtOC41MjQgMC0xNy4wMzctMi4xMzQtMjcuNjkzLTQuMjYzbDQuMjY0LTIxLjI5OGM4LjUyMSAyLjEzIDE5LjE2NyAyLjEzIDI3LjY4MSA0LjI2MSAxMC42NTYgMi4xMzMgMjEuMjk4IDAgMzEuOTU3IDBsMi4xMjkgMjEuM2ExMTYuMzQ1IDExNi4zNDUgMCAwIDEtMzguMzM4IDB6JyBmaWxsPScjRkZGRkZGJz48L3BhdGg+PHBhdGggZD0nTTc3Mi45MDcgODQxLjkzOWMyMy40MTggMCA0NC43MTUtMTkuMTY2IDQ0LjcxNS00Mi41ODdWNjg3Ljc0NGMtMTAuNzQ0LTQuMjk0LTIyLjA5OS03Ljg5Ny0zMy45NTQtMTAuNzIyLTE1LjcxOSAxLjg1My0zMS42OTkgNC4yMjktNDkuMDk5IDkuNDVsLTQuOTc0LTE2LjU2M2EyNzkuOTgxIDI3OS45ODEgMCAwIDAtOC43NjctMC4xNDZjLTc4LjQ3NyAwLTE0Ni4zMTggMzIuNTM3LTE3OC42MjMgNzkuNzc2IDE0LjU2MS01LjU0MSAyOS44MTgtMTEuNzczIDQ5LjY2MS0yMi42MDlsOC41MjUgMTkuMTY5Yy0yMy40MyAxMC42NTctNDIuNTk4IDE5LjE2OS01OS42MzUgMjUuNTZsLTQuMjk1LTEyLjg5OGMtOS4yNjQgMTYuNDIyLTE0LjM3NSAzNC4zNjEtMTQuMzc1IDUzLjE1NiAwIDEwLjMwMiAxLjU0NiAyMC4zNDQgNC40NTYgMzAuMDIzaDI0Ni4zNjV6IG0tODMuMDY0LTE2My45ODZsOC41MjUgMTkuMTY0Yy0xOS4xNjkgOC41MjUtMzYuMjA3IDE3LjA1MS01OS42MzcgMjcuNjk0bC04LjUyMS0xOS4xNjhjMjMuNDMtMTAuNjQyIDQwLjQ2NS0xOS4xNjUgNTkuNjMzLTI3LjY5eicgZmlsbD0nI0ZGRkZGRicgb3BhY2l0eT0nLjQnPjwvcGF0aD48L3N2Zz4=");
}
</style>

View File

@ -0,0 +1,191 @@
<template>
<view class="_selpage">
<view class="_show" :class="{_left:left}">
<view class="btn sm" :class="{dis:disabled}" @tap="selpage">{{btn}}</view>
<view class="_txt" :style="style2obj(ciystyle, {color:disabled?'var(--bg6)':'var(--txt9)'})" v-if="tvalue.id>0">
<slot :data="tvalue">
<view v-html="tvalue.name"></view>
</slot>
</view>
<view class="_txt" :style="style2obj(ciystyle, {color:'var(--txt1)'})" v-else>{{placeholder?placeholder:lang('placeholder.select')}}</view>
</view>
<input type="hidden" :name="name" :value="tvalue.id" style="display:none;" />
<input v-if="hasmore" type="hidden" :name="name+'_more'" :value="tvalue._more" style="display:none;" />
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number],
default: ''
},
value: {
type: [String, Number],
default: ''
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
ciystyle: {
type: [String, Object]
},
left: {
type: Boolean,
default: false
},
hasmore: {
type: Boolean,
default: false
},
placeholder: {
type: String,
default: '请选择'
},
morevalue: {
type: Object,
default: {}
},
btn: {
type: String,
default: '选取'
},
page: {
type: String,
default: ''
},
},
data() {
return {
innermore: {},
v: {
id: 0,
_more: ''
},
};
},
watch: {
value: {
handler(newD, oldD) {
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD)
this.v = 'modelValue';
},
immediate: true
},
morevalue: {
handler(newD, oldD) {
this.v = this.modelValue || this.value;
this.innermore = {
...newD
};
},
immediate: true
},
},
computed: {
tvalue() {
var val = '';
var valmore = {
...this.innermore
};
if (this.v == 'modelValue') {
if (typeof(this.modelValue) == 'number')
val = this.modelValue;
else
val = this.modelValue;
valmore.id = val;
} else if (this.v == 'value') {
if (typeof(this.value) == 'number')
val = this.value;
else
val = this.value;
valmore.id = val;
} else if (this.v instanceof Object) {
valmore = {
...this.v
};
} else {
valmore.id = this.v;
}
valmore._more = this.setstrparam(valmore);
return valmore;
}
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: {
...this.tvalue
}
});
}
},
methods: {
selpage(e) {
if (this.disabled)
return;
uni.navigateTo({
url: this.page + '?sel=true&id=' + this.tvalue.id,
events: {
writedata: data => {
this.v = {
...data
};
this.innermore = {
...data
};
this.$emit('update:modelValue', data.id);
this.$emit('change', {
name: this.name,
from: 'selpage',
value: {
...data
}
});
}
}
});
},
}
}
</script>
<style scoped>
._selpage {
position: relative;
}
._selpage ._show {
display: flex;
align-items: center;
justify-content: flex-start;
flex-direction: row-reverse;
gap: 0.5em;
}
._selpage ._show._left {
flex-direction: row;
}
._selpage ._show._left ._txt {
text-align: left;
}
</style>

View File

@ -0,0 +1,140 @@
<template>
<view style="display:flex;">
<view v-if="picarr.length > 0 && label" style="width: 1em;margin-right: 0.5em;line-height: 1.2em;color: #999999;">{{label}}</view>
<view v-if="type == 'thumb'" style="flex:1;">
<video :id="'video' + index" v-for="(item,index) in videoarr" :key="index" :src="file_stor(item)" controls @tap="fullvideo('video' + index)" :show-fullscreen-btn="false" :style="{width:width,height:height,margin:'0 0.5em 0 0'}"></video>
<image lazy-load :lazy-load-margin="0" @tap.stop="preview(index)" :src="item" v-for="(item,index) in picarr" :key="index" :mode="mode" :style="{width:width,height:height,margin:'0 0.5em 0 0'}" style="border-radius:0.3em;" />
<view @tap.stop="openfile(index)" v-for="(item,index) in pdfarr" :key="index" :style="{width:width,height:height,lineHeight: height}" style="margin:0 0.5em 0 0;border-radius:0.3em;display:inline-block;vertical-align: top;border: 1px solid #cccccc;text-align: center;color:#000000;background: #ffffff;">{{lang('showimgs.att')}}{{index+1}}</view>
</view>
<view v-else style="flex:1;">
<video :id="'video' + index" v-for="(item,index) in videoarr" :key="index" :src="file_stor(item)" controls @tap="fullvideo('video' + index)" :show-fullscreen-btn="false" :style="{width:width,margin:'0 0 -2px 0;'}"></video>
<image lazy-load :lazy-load-margin="0" @tap.stop="preview(index)" :src="item" v-for="(item,index) in picarr" :key="index" :mode="mode" :style="{width:width}" style="margin:0 0 -2px 0;" />
<view @tap.stop="openfile(index)" v-for="(item,index) in pdfarr" :key="index" :style="{width:width,height:height,lineHeight: height,margin:index==0?'0':'0 0.5em 0 0'}" style="border-radius:0.3em;display:inline-block;vertical-align: top;border: 1px solid #cccccc;text-align: center;color:#000000;background: #ffffff;">{{lang('showimgs.att')}}{{index+1}}</view>
</view>
</view>
</template>
<script>
export default {
props: {
src: {
type: String,
default: ''
},
label: {
type: String,
default: ''
},
width: {
type: String,
default: '5em'
},
height: {
type: String,
default: '5em'
},
type: {
type: String,
default: 'thumb'
},
mode: {
type: String,
default: 'aspectFill'
},
whpre: {
type: String,
default: '?50'
},
},
data() {
return {
picarr: [],
picoriarr: [],
pdfarr: [],
videoarr: [],
};
},
watch: {
src(newD, oldD) {
this.fill();
}
},
created() {
this.fill();
},
methods: {
fill() {
this.picarr = [];
this.picoriarr = [];
var ps = this.src.split('~');
var images = [];
for (var i = 0; i < ps.length; i++) {
if (ps[i].length == 0)
continue;
var ind = ps[i].lastIndexOf('.');
var ext = ps[i].substring(ind + 1).toUpperCase();
if (ext == 'JPG' || ext == 'JPEG' || ext == 'GIF' || ext == 'PNG')
images.push(ps[i]);
else if (ext == 'MP4')
this.videoarr.push(ps[i]);
else
this.pdfarr.push(ps[i]);
}
for (var i in images) {
var ind = images[i].indexOf('|');
var psm = '';
var pbig = '';
if (ind > -1) {
psm = images[i].substr(0, ind);
pbig = images[i].substr(ind + 1);
} else {
pbig = images[i];
}
if (psm == '')
psm = pbig;
this.picarr.push(this.file_stor(psm));
this.picoriarr.push(this.file_stor(pbig));
}
},
preview(idx) {
uni.previewImage({
current: idx,
indicator: 'default',
urls: this.picoriarr
});
},
openfile(idx) {
var app = getApp();
app.toast('Downloading...');
var url = this.pdfarr[idx];
if (url.substr(0, 1) == '/')
url = app.globalData.jsnurl[this.srv] + url;
uni.downloadFile({
url: url,
success: res => {
uni.openDocument({
filePath: res.tempFilePath,
showMenu: true,
fail: res => {
app.toast('Open Document Fail:' + res.errMsg + '\n' + url);
}
});
},
fail: res => {
app.toast('Down Document Fail:' + res.errMsg + '\n' + url);
}
});
},
fullvideo(id) {
const videoContext = uni.createVideoContext(id, this);
videoContext.requestFullScreen({
direction: 0
})
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,63 @@
<template>
<view style="display:inline-block;" :style="ciystyle">
<text :style="intstyle">{{p1}}</text>
<text :style="decstyle">{{p2}}</text>
<text :style="decstyle">{{unit}}</text>
</view>
</template>
<style scoped>
</style>
<script>
export default {
props: {
value: {
type: [String, Number],
default: 0
},
dec0: {
type: Boolean,
default: false
},
unit: {
type: String,
default: ''
},
ciystyle: {
type: [String, Object],
default: ''
},
intstyle: {
type: String,
default: ''
},
decstyle: {
type: String,
default: 'font-size:0.7em;'
},
},
data() {
return {};
},
watch: {},
computed: {
p1() {
if (this.unit == '万元')
return this.toint(this.value / 1000000);
else
return this.toint(this.value / 100);
},
p2() {
if (this.unit == '万元')
return this.tonumdec(this.value / 1000000, this.dec0, 3);
else if (this.unit == '元')
return this.tonumdec(this.value / 100, this.dec0, 2);
else
return this.tonumdec(this.value / 100, this.dec0, 2);
}
},
mounted() {},
methods: {}
}
</script>

View File

@ -0,0 +1,114 @@
<template>
<view style="display:inline-block;">
{{p1}}<text style="font-size:0.6em;">{{p2}}</text><text style="font-size:0.6em;padding-left:0.3em;">{{punit}}</text>
</view>
</template>
<style scoped>
</style>
<script>
export default {
props: {
value: {
type: [String, Number],
default: 0
},
unit: {
type: String,
default: ''
}, //,100,2|,1000000,3|亿,10000000000,3 ,,
speed: {
type: [String, Number],
default: 30
},
},
data() {
return {
p1: 0,
p2: '',
punit: '',
};
},
watch: {
value(newD, oldD) {
if (this.inter) {
setTimeout(() => {
this.fillnum(newD);
}, 500);
} else
this.ani(newD, oldD);
}
},
computed: {
speeddata() {
var speed = this.toint(this.speed);
if(speed < 3)
speed = 10;
return speed;
},
units() {
var unitss = this.unit.replace(/\*/g, '').split('|');
var units = [];
for (var i in unitss) {
var u = {};
var ss = unitss[i].split(',');
u.unit = ss[0];
u.bet = parseInt(ss[1]);
u.fix = parseInt(ss[2]);
if (isNaN(u.bet))
u.bet = 1;
if (u.bet < 1)
u.bet = 1;
if (isNaN(u.fix))
u.fix = 0;
units.unshift(u);
}
return units;
}
},
mounted() {
this.ani(this.value, -1);
},
methods: {
ani(newD, oldD) {
if (newD == oldD)
return;
var step = (newD - oldD) / this.speeddata;
var val = parseFloat(oldD);
var stepi = 0;
this.inter = setInterval(() => {
val += step;
stepi++;
if (stepi > this.speeddata) {
clearInterval(this.inter);
this.inter = null;
this.fillnum(newD);
} else
this.fillnum(val);
}, 16);
},
fillnum(value) {
value = parseInt(value);
if (isNaN(value))
value = 0;
for (var u in this.units) {
var val = value / this.units[u].bet;
if (val < 1 && u < this.units.length - 1)
continue;
val = this.tofix(val, this.units[u].fix) + '';
var ind = val.indexOf('.');
if (ind === -1) {
this.p1 = val;
this.p2 = '';
} else {
this.p1 = val.substr(0, ind);
this.p2 = val.substr(ind);
}
this.punit = this.units[u].unit;
break;
}
}
}
}
</script>

View File

@ -0,0 +1,102 @@
<template>
<view style="width:100%;position: relative;display:flex;">
<slider :name="name" :value="txtvalue" :style="ciystyle" :disabled="disabled" :min="min" :max="max" :step="step" :show-value="false" @changing="textchanging" @change="textchange" style="width: 100%;margin: 0 1em;" />
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number],
default: 0
},
value: {
type: [String, Number],
default: 0
},
initevent: {
type: Boolean,
default: false
},
ciystyle: {
type: [String, Object]
},
min: {
type: [String, Number],
default: 0
},
max: {
type: [String, Number],
default: 100
},
step: {
type: [String, Number],
default: 1
},
disabled: {
type: Boolean,
default: false
},
},
data() {
return {};
},
watch: {
},
computed: {
txtvalue() {
if (typeof(this.modelValue) == 'number')
return this.modelValue;
if (typeof(this.value) == 'number')
return this.value;
if (this.modelValue)
return this.modelValue;
if (this.value)
return this.value;
return this.min;
}
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.txtvalue
});
}
},
methods: {
textchanging(e) {
var txt = e.detail.value;
if (txt === undefined)
txt = e.data;
this.$emit('update:modelValue', txt);
this.$emit('change', {
name: this.name,
from: 'changing',
value: txt
});
},
textchange(e) {
var txt = e.detail.value;
if (txt === undefined)
txt = e.data;
this.$emit('update:modelValue', txt);
this.$emit('change', {
name: this.name,
from: 'changed',
value: txt
});
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,88 @@
<template>
<template v-if="!src"></template>
<image v-else-if="type == 'img'" class="_wh100" :src="srcdata" :mode="mode" :style="cstyle" />
<view v-else-if="type == 'svg'" class="_wh100" :style="cstyle"></view>
</template>
<style scoped>
._wh100 {
width: 100%;
height: 100%;
}
</style>
<script>
export default {
options: {
virtualHost: false
},
props: {
src: {
type: String,
default: ''
},
mode: {
type: String,
default: 'widthFix'
},
ciystyle: {
type: [String, Object]
}
},
data() {
return {
type: '',
srcdata: '',
};
},
watch: {
src: {
handler(newD, oldD) {
if (typeof(newD) != 'string')
return;
if (newD.substring(0, 5).toLowerCase() == '<svg ') {
this.type = 'svg';
this.srcdata = this.svg2bg(newD);
return;
}
var ext = this.file_ext(newD);
if (ext == 'SVG') {
uni.request({
url: this.file_stor(newD),
dataType: 'text',
method: 'GET',
fail: res => {
res._url = url;
this.uperr("h5.loadsvg.fail", res);
return reject({
errmsg: res.errMsg
});
},
success: res => {
this.type = 'svg';
this.srcdata = this.svg2bg(res.data);
}
});
} else {
this.type = 'img';
this.srcdata = this.file_stor(newD);
}
},
immediate: true
},
},
computed: {
cstyle() {
var csty = this.style2obj(this.ciystyle);
if (this.type == 'svg' && this.srcdata) {
if (!csty['display'])
csty['display'] = 'inline-block';
csty['backgroundImage'] = this.srcdata;
}
return csty;
}
},
mounted() {},
methods: {}
}
</script>

View File

@ -0,0 +1,117 @@
<template>
<view class="_list" :style="{borderBottom:noborder?'none':''}">
<view class="_icon" v-if="icon">
<ciy-svgimg :src="icon"></ciy-svgimg>
</view>
<view class="_title">{{title}}</view>
<slot></slot>
<view class="_right txt-wl" v-if="right" v-html="right"></view>
<view class="_reddot" v-if="reddot">{{reddot>99?'99+':reddot}}</view>
<view class="_more" v-if="more"></view>
</view>
</template>
<style scoped>
._list {
position: relative;
background: var(--bg2);
display: flex;
align-items: center;
border-bottom: 1px solid var(--bg6);
height: 3.5em;
}
._list>._icon {
pointer-events: none;
flex-shrink: 0;
width: 1.6em;
height: 1.6em;
margin-left: 0.7em;
}
._list>._title {
pointer-events: none;
flex: 1;
margin-left: 1em;
white-space: nowrap;
color: var(--txt9);
/* overflow: hidden;
text-overflow: ellipsis;
min-width: 7em; */
line-height: 1.1em;
}
._list>._right {
pointer-events: none;
text-align: right;
margin: 0 1em;
line-height: 1.2em;
overflow: hidden;
max-height: 100%;
color: var(--txt6);
}
._list>._more {
pointer-events: none;
margin-right: 1em;
width: 1em;
height: 1em;
flex-shrink: 0;
background-image: url("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyB2ZXJzaW9uPScxLjEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc+PHBhdGggZD0nTTM5Mi4zMDgzNjQgNzEuODE5NjM2YTU4LjE4MTgxOCA1OC4xODE4MTggMCAwIDAtNzcuOTE3MDkxIDg2LjMxODU0NmwzLjA3MiAyLjc5MjcyNyAzNzkuOTA0IDMxOS4wOTIzNjRhMzQuOTA5MDkxIDM0LjkwOTA5MSAwIDAgMSA0LjI1ODkwOSA0OS4xOTg1NDVsLTEuODM4NTQ2IDIuMDI0NzI3LTIuMDAxNDU0IDEuODYxODE5TDMxNi43NDE4MTggODYzLjcyMDcyN0E1OC4xODE4MTggNTguMTgxODE4IDAgMCAwIDM4OS44MTgxODIgOTU0LjE4MTgxOGwzLjIzNDkwOS0yLjYyOTgxOCAzODAuOTk3ODE4LTMzMC41NDI1NDVhMTUxLjI3MjcyNyAxNTEuMjcyNzI3IDAgMCAwIDIuNTYtMjI2LjI4MDcyOGwtNC4zNzUyNzMtMy44MTY3MjdMMzkyLjMwODM2NCA3MS44MTk2MzZ6JyBmaWxsPScjOTk5OTk5Jz48L3BhdGg+PC9zdmc+");
}
._list ._reddot{
background: var(--dag5);
border:1px solid var(--dag6);
border-radius: 50%;
text-align: center;
color:var(--bg1);
height:2.5em;
width:2.5em;
line-height: 2.5em;
font-size:0.6em;
margin:0 1em;
overflow: hidden;
white-space: nowrap;
}
</style>
<script>
export default {
props: {
icon: {
type: String,
default: ''
},
title: {
type: String,
default: ''
},
right: {
type: String,
default: ''
},
more: {
type: Boolean,
default: false
},
noborder: {
type: Boolean,
default: false
},
reddot: {
type: [String, Number],
default: 0
}
},
data() {
return {
};
},
watch: {},
computed: {
},
mounted() {},
methods: {
}
}
</script>

View File

@ -0,0 +1,62 @@
<template>
<view style="background: linear-gradient(354deg, #f3fcff, #ffffff);" :style="{minHeight:height}">
<swiper v-if="banner && banner.length > 0" :indicator-dots="banner.length > 1" :autoplay="false" :interval="interval" :style="{height:height}">
<swiper-item v-for="(item,index) in banner" :key="item.id">
<view v-if="isvideo(item.img)">
<cover-image v-if="vmuted" @tap="vmute" class="_swiper_mute" :style="{opacity: vop}" :src="file_stor('/img/wav2.png')"></cover-image>
<cover-image v-else @tap="vmute" class="_swiper_mute" :style="{opacity: vop}" :src="file_stor('/img/wav1.png')"></cover-image>
<video @tap="showop" object-fit="cover" :poster="file_stor(item.img + '.jpg')" :src="file_stor(item.img)" controls autoplay loop show-mute-btn :muted="vmuted" :enable-progress-gesture="false" style="width:100%;height:80vw;"></video>
</view>
<image v-else @tap="gourl" :data-url="item.url" :src="file_stor(item.img)" style="width:100%;height:100%;" />
</swiper-item>
</swiper>
</view>
</template>
<script>
export default {
props: {
banner: {
type: Array,
default: []
},
height: {
type: [String, Number],
default: ''//min-height:80vw;
},
interval: {
type: [String, Number],
default: '3000'//min-height:80vw;
}
},
data() {
return {
vmuted: false,
vop: 0.2,
}
},
watch: {
},
created() {
},
methods: {
showop() {
this.vop = 2;
},
vmute() {
this.vmuted = !this.vmuted;
}
}
}
</script>
<style scoped>
._swiper_mute {
position: absolute;
right: 0.5em;
top: 0.5em;
z-index: 100;
height: 1.5em;
width: 1.5em;
}
</style>

View File

@ -0,0 +1,283 @@
<template>
<view class="_switch" :class="{_disabled:disabled}" @tap="clickswitch(!this.tvalue)" :animation="anidatabg">
<switch :name="name" :checked="tvalue" @change="chg" style="display:none;" />
<view class="_y" :animation="anidatay">{{y}}</view>
<view class="_n" :animation="anidatan">{{n}}</view>
<ciy-gesture :pxlen="10" @toleft="gestureto(false)" @toright="gestureto(true)">
<view class="_bn" :animation="anidatabn"></view>
</ciy-gesture>
</view>
</template>
<style scoped>
@import '@/pages/demo/zdemo.css';
._switch {
display: inline-block;
line-height: 2em;
height: 2em;
font-size: 1em;
position: relative;
border: 1px solid var(--e-switch-br);
background: var(--e-switch-bg);
color: var(--e-switch-txt);
border-radius: 1em;
overflow: hidden;
}
._switch._disabled {
background: var(--bg4);
}
._switch ._n {
position: relative;
margin-top: -2em;
margin-left: 2em;
margin-right: 0.8em;
color: var(--e-switch-txt);
text-align: right;
}
._switch ._y {
margin-right: 2em;
margin-left: 0.8em;
color: var(--e-switch-chktxt);
opacity: 0;
}
._switch ._bn {
position: absolute;
top: 0;
left: 0;
width: 1.6em;
height: 1.6em;
margin: 0.1em;
border-radius: 0.8em;
background: var(--e-switch-bg);
box-shadow: var(--e-switch-shadow);
}
._switch._disabled ._bn {
background: var(--bg5);
}
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: [String, Number, Boolean],
default: -998
},
value: {
type: [String, Number, Boolean],
default: -998
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
y: { //
type: String,
default: ''
},
n: { //
type: String,
default: ''
},
ms: { //
type: Number,
default: 200
}
},
data() {
return {
v: false,
anidatabg: {},
anidatay: {},
anidatan: {},
anidatabn: {},
};
},
watch: {
tvalue: {
handler(newD, oldD) {
if (this.v == 'modelValue' || this.v == 'value')
this.ani();
}
},
value: {
handler(newD, oldD) {
if (newD === -998)
return;
if (newD || oldD)
this.v = 'value';
},
immediate: true
},
modelValue: {
handler(newD, oldD) {
if (newD === -998)
return;
if (newD || oldD)
this.v = 'modelValue';
},
immediate: true
}
},
computed: {
tvalue() {
if (this.v == 'modelValue') {
if (typeof(this.modelValue) == 'boolean')
return this.modelValue;
else if (typeof(this.modelValue) == 'number')
return this.modelValue != 0;
else if (this.modelValue.toLowerCase() == 'true')
return true;
else
return false;
} else if (this.v == 'value') {
if (typeof(this.value) == 'boolean')
return this.value;
else if (typeof(this.value) == 'number')
return this.value != 0;
else if (this.value.toLowerCase() == 'true')
return true;
else
return false;
}
return this.v;
}
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.tvalue
});
}
if (this.tvalue)
this.ani();
},
methods: {
chg(e) {
this.clickswitch(!this.tvalue);
},
ani() {
var query = uni.createSelectorQuery().in(this);
query.select('._switch').boundingClientRect(data => {
if (!data)
return;
var ln = data.width - data.height;
var time = this.ms;
var len = this.y.length > this.n.length ? this.y.length : this.n.length;
len = 0;
if (this.tvalue) {
var animation = uni.createAnimation({});
if (len > 0) {
animation.translateX((ln / 2) + 'px');
animation.translateY('4px');
animation.scale(0.9);
animation.step({
duration: time / 2
});
}
animation.translateX(ln + 'px');
//animation.translateY(0);
animation.scale(1);
animation.step({
duration: (len > 0 ? time / 2 : time)
});
this.anidatabn = animation.export();
var animation = uni.createAnimation({});
animation.backgroundColor(this.disabled ? 'var(--e-switch-chkbgdis)' : 'var(--e-switch-chkbg)');
animation.step({
duration: time
});
this.anidatabg = animation.export();
var animation = uni.createAnimation({});
animation.translateX('20px');
animation.opacity(0);
animation.step({
duration: time
});
this.anidatan = animation.export();
var animation = uni.createAnimation({});
animation.opacity(1);
animation.step({
duration: time
});
this.anidatay = animation.export();
} else {
var animation = uni.createAnimation({});
if (len > 0) {
animation.translateX((ln / 2) + 'px');
animation.translateY('-4px');
animation.scale(0.9);
animation.step({
duration: time / 2
});
}
animation.translateX(0);
//animation.translateY(0);
animation.scale(1);
animation.step({
duration: (len > 0 ? time / 2 : time)
});
this.anidatabn = animation.export();
var animation = uni.createAnimation({});
animation.backgroundColor(this.disabled ? 'var(--e-switch-br)' : 'var(--e-switch-bg)');
animation.step({
duration: time
});
this.anidatabg = animation.export();
var animation = uni.createAnimation({});
animation.opacity(1);
animation.step({
duration: time
});
this.anidatan = animation.export();
var animation = uni.createAnimation({});
animation.translateX('-20px');
animation.opacity(0);
animation.step({
duration: time
});
this.anidatay = animation.export();
}
}).exec();
},
gestureto(chk) {
if (chk == this.v)
return;
this.clickswitch(chk);
},
clickswitch(chk) {
if (this.disabled)
return;
this.v = chk;
this.ani();
this.$emit('update:modelValue', this.tvalue);
this.$emit('change', {
name: this.name,
from: 'input',
value: this.tvalue
});
}
}
}
</script>

View File

@ -0,0 +1,147 @@
<template>
<view :style="{height:seatheight+'px'}"></view>
<view class="_footer">
<!-- <view class="mid"></view> -->
<view class="_tabbarsafe">
<view class="_tabbar">
<template v-for="(item,index) in tabbarArr" :key="index">
<view v-if="!item.hide" @tap="gotab(item.fullpath)" class="_bar" :class="{_active:item.fullpath == fullpath}">
<view class="_icon" :style="{backgroundImage:svg2bg(item.fullpath == fullpath?item.selecticon:item.icon)}">
</view>
<view class="_name">{{lang(item.name)}}</view>
<view v-if="item.reddot" class="_reddot"></view>
</view>
</template>
</view>
<view class="_footer_safe" :style="{height:footer_safe_height+'px'}"></view>
</view>
</view>
</template>
<style scoped>
._mid {
left: calc(50% - 3em);
height: 6em;
position: absolute;
top: 0.5em;
width: 6em;
border-radius: 50%;
background: var(--bg3);
}
._footer {
position: fixed;
width: 100%;
bottom: 0;
z-index: 990;
}
._tabbarsafe {
position: relative;
}
._tabbar {
display: flex;
justify-content: space-around;
margin: 1em;
border-radius: 2.5em;
background: #dddddd22;
/* box-shadow: 0 0 50px 5px #ffffff; */
border: 1px solid var(--bg6);
backdrop-filter: blur(20px);
}
._tabbar ._bar {
position: relative;
text-align: center;
color: var(--txt1);
margin: 0.5em 0;
flex: 1;
}
._tabbar ._bar._active {
color: var(--txt9);
}
._tabbar ._icon {
width: 1.6em;
height: 1.6em;
margin: 0 auto;
}
._tabbar ._name {
color: var(--txt6);
padding-top: 0.2em;
font-size: 0.9em;
text-shadow: 0 0 3px var(--bg1);
}
._tabbar ._active ._name {
font-weight: bold;
color: var(--man5);
}
._tabbar ._reddot {
position: absolute;
top: 0;
left: calc(50% + 1em);
background: var(--dag5);
border-radius: 50%;
width: 0.5em;
height: 0.5em;
}
._footer_safe {
/* background-color: #1cf11899; */
}
</style>
<script>
export default {
props: {},
data() {
return {
footer_safe_height: 0,
seatheight: 0,
fullpath: '',
tabbarArr: null
};
},
watch: {},
mounted() { //h5 wx ok
var app = getApp();
var pg = app.getpage();
if (pg.route)
this.fullpath = '/' + pg.route;
else if (pg.__route__)
this.fullpath = '/' + pg.__route__;
this.footer_safe_height = app.globalData._footer_safe_height;
if(this.tabbarArr == null)
this.loadtabbardata();
setTimeout(() => { //ios
uni.createSelectorQuery().in(this).select('._footer').boundingClientRect(data => {
if (data)
this.seatheight = data.height;
}).exec();
}, 10);
},
activated() {
this.loadtabbardata();
},
methods: {
Getheight() {
return this.seatheight;
},
loadtabbardata() {
var app = getApp();
this.tabbarArr = this.objclone(app.globalData.tabbarArr);
},
gotab(url) {
uni.switchTab({
url: url,
fail: res => {
console.warn(res.errMsg);
}
});
}
}
}
</script>

View File

@ -0,0 +1,66 @@
<template>
<slot></slot>
</template>
<style scoped>
</style>
<script>
export default {
props: {},
data() {
return {
};
},
watch: {},
lifetimes: {
attached: function() {
console.log("lifetimes attached");
},
detached: function() {
console.log("lifetimes detached");
},
},
pageLifetime: {
show: function() {
console.log("pageLifetime show");
},
hide: function() {
console.log("pageLifetime hide");
},
attached: function() {
console.log("pageLifetime attached");
},
detached: function() {
console.log("pageLifetime detached");
},
},
ready() {
console.log("ready");
},
mounted() {
console.log("mounted");
},
activated() {
console.log("activated");
},
show() {
console.log("show");
},
detached() {
console.log("detached");
},
deactivated() {
console.log("deactivated");
},
unmounted() {
console.log("unmounted");
},
hide() {
console.log("hide");
},
methods: {
Rander() {
console.log('rander');
}
}
}
</script>

View File

@ -0,0 +1,152 @@
<template>
<textarea class="_textarea" :class="{_bb:bb,_disabled:disabled}" :name="name" :value="txtvalue" :placeholder="placeholder" :cursor="cursor" :cursor-spacing="120" :disabled="disabled" :maxlength="maxlength" :auto-height="!ciystyle.height" :fixed="fixed" @input="textinput" :style="ciystyle" @focus="textfocus" @blur="textblur" @linechange="textline"></textarea>
<view v-if="showtotal" class="txt-right txt1 txt-smmm" style="line-height:1em;margin:-0.5em 0.4em 0.6em 0;">{{totaltxt}}<text v-if="maxlength>-1">/{{maxlength}}</text></view>
</template>
<script>
export default {
options: {
virtualHost: true
},
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue', 'focus', 'blur', 'linechange'],
props: {
name: {
type: String
},
modelValue: {
type: String,
default: ''
},
value: {
type: String,
default: ''
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
ciystyle: {
type: [String, Object],
default: {}
},
placeholder: {
type: String,
default: ''
},
bb: { //
type: Boolean,
default: false
},
showtotal: {
type: Boolean,
default: false
},
maxlength: {
type: Number,
default: -1
},
fixed: {
type: Boolean,
default: false
}
},
data() {
return {
totaltxt: '0字',
cursor:0
};
},
watch: {},
computed: {
txtvalue() {
var val = '';
if (this.modelValue)
val = this.modelValue;
else if (this.value)
val = this.value;
this.total(val);
return val;
}
},
mounted() {
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.txtvalue
});
}
},
methods: {
textfocus(e) {
this.$emit('focus', e);
},
textblur(e) {
this._cursor = e.detail.cursor;
this.$emit('blur', e);
},
textline(e) {
this.$emit('linechange', e);
},
textinput(e) {
this._cursor = e.detail.cursor;
var txt = e.detail.value;
if (txt === undefined)
txt = e.data;
this.total(txt);
this.$emit('update:modelValue', txt);
this.$emit('change', {
name: this.name,
from: 'input',
value: txt
});
},
total(val) {
if (!val) {
this.totaltxt = '0';
return;
}
var linelen = val.split('\n').length;
this.totaltxt = linelen + '行,' + val.length;
},
Getcursor() {
return this._cursor;
}
}
}
</script>
<style scoped>
._textarea {
text-align: left;
display: block;
padding: 1rem 0.5rem;
box-sizing: border-box;
line-height: 1.6em;
font-size: 1em;
min-height: 3em;
overflow: auto;
width: 100%;
z-index: 0;
max-height:80vh;
/* 解决微信覆盖bug */
}
._textarea._bb {
border: 1px solid var(--bg4);
border-radius: 0.2em;
padding: 0.5rem;
margin: 0.5em 0;
background: var(--bg1);
}
._textarea._disabled {
color: var(--txt1);
background: var(--bg4);
}
</style>

View File

@ -0,0 +1,85 @@
<template>
<view :style="{height:more?'':height}" class="_divmore">
<slot></slot>
<view v-if="!more" class="_mark" @tap="showall" :style="{background:maskbg?'linear-gradient(0deg, '+maskbg+', transparent)':''}">
<view class="itm">»</view>
</view>
</view>
</template>
<style scoped>
._divmore {
overflow: hidden;
display: block;
position: relative;
}
._mark {
position: absolute;
left: 0;
right: 0;
bottom: 0;
padding: 0;
margin: 0;
z-index: 1;
height: 3em;
display: flex;
align-items: flex-end;
justify-content: center;
}
._mark>.itm {
font-size: 2em;
color:var(--txt1);
animation: _slideDown 3s ease-in infinite;
}
@keyframes _slideDown {
0% {
transform: rotate(75deg) translateX(-1em);
opacity: 0;
}
12% {
transform: rotate(90deg) translateX(0);
opacity: 1;
}
95% {
transform: rotate(90deg) translateX(0);
opacity: 1;
}
100% {
transform: rotate(110deg) translateX(0.5em);
opacity: 0;
}
}
</style>
<script>
export default {
emits: ['change'],
props: {
height: {
type: String,
default: '10em'
},
maskbg: {
type: String,
default: ''
}
},
data() {
return {
more: false,
};
},
watch: {},
computed: {},
mounted() {},
methods: {
showall(){
this.more = true;
this.$emit('change', true);
}
}
}
</script>

View File

@ -0,0 +1,71 @@
<template>
<view class="_dialog" @tap="close('click')" v-if="popsh">
<view class="_content" :style="dialogstyle" v-html="tobr(content, true)"></view>
</view>
</template>
<style scoped>
._dialog {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
text-align: center;
z-index:50030;
}
._dialog ._content {
border-radius: 0.5em;
background: var(--txt7);
color: var(--bg2);
display: inline-block;
max-width:100%;
padding: 1em 2em;
text-align: center;
}
</style>
<script>
export default {
props: {},
data() {
return {
popsh: false,
dialogstyle: {},
content: ''
};
},
methods: {
async Open(res) {
return new Promise(async (resolve, reject) => {
this.cb = resolve;
res = res || {};
if (typeof(res) == 'string') {
res = {
content: res,
sec: 2
};
}
var sec = this.toint(res.sec);
this.content = res.content;
var app = getApp();
this.dialogstyle.marginTop = (app.globalData._sysinfo.windowHeight / 3) + 'px';
this.popsh = true;
if (sec <= 0)
return;
this._tick = setTimeout(() => {
this.close('timeout');
}, sec * 1000);
}).catch(e => {
return e;
});
},
close(act) {
clearTimeout(this._tick);
this.popsh = false;
this.cb(act);
}
}
}
</script>

View File

@ -0,0 +1,43 @@
<template>
<view v-for="(item,index) in sem" :key="index" class="flex1" @tap="clkitem(index)">
<view :class="numclass">
<ciy-shownum :value="item.num" :unit="item.unit"></ciy-shownum>
</view>
<view :class="nameclass">{{item.name}}</view>
</view>
</template>
<script>
export default {
emits: ['change', 'update:modelValue'],
props: {
sem: {
type: [Array],
default: []
},
numclass: {
type: [String],
default: 'txt-lgg'
},
nameclass: {
type: [String],
default: 'txt-sm py2'
},
},
data() {
return {};
},
watch: {},
computed: {},
mounted() {},
methods: {
clkitem(idx) {
if (this.sem[idx].url)
this.gourl(this.sem[idx].url);
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,689 @@
<template>
<view class="_vphoto" :class="{left}">
<input type="hidden" :maxlength="-1" :name="name" :value="tvalue.value" style="display:none;" />
<view class="_btn" :class="{_disabled:disabled}" @tap="photo_select" v-if="tvalue.imgs.length < num">
<view class="_icon _photo"></view>
</view>
<ciy-gesture class="_pimg" v-for="(item,index) in tvalue.imgs" :key="index" :style="{'display':'block','width':showwh}" @toleft="toleft(index)" @toright="toright(index)">
<view class="_del" :data-idx="index" @tap="photo_delone"></view>
<image v-if="isimg(item)" :src="file_stor(item, '?50')" @tap="preview(index)" mode="widthFix" style="display:block;"></image>
<video v-else-if="isvideo(item)" :id="'video' + index" :src="file_stor(item)" controls @tap="fullvideo('video' + index)" :show-fullscreen-btn="false" :style="{width:showwh,height:showwh}"></video>
<view v-else class="_file">{{file_ext(item)}}</view>
</ciy-gesture>
<view class="_tip">{{tip}}</view>
<canvas type="2d" id="canvas" :style="{'width':cvwidth+'px','height':cvheight+'px','top':-cvheight+'px'}" style="position:fixed;z-index:-999;left:100vw;"></canvas>
</view>
<view v-if="showrecam" :style="{top:header_height+'px'}" style="z-index:50005;position: fixed;left:0;right:0;bottom:0;background:linear-gradient(327deg,var(--bg1),var(--man3))">
<image v-if="cammaskpng" :src="file_stor(cammaskpng)" class="abs t0 l0" :style="{pointerEvents: 'none',zIndex:50006,opacity:0.8,width: '100%', height: cameraheight + 'vw'}"></image>
<camera style="border: 1px solid #cccccc;" device-position="back" flash="off" :style="{width: '100%', height: cameraheight + 'vw'}"></camera>
<view>
</view>
<view style="opacity: 0.7;position: absolute;bottom:8em;left:0;right:0;text-align:center;">
<button class="btn lg cc" @tap="recamphoto" style="margin-top:0.5em;">拍照</button>
</view>
<view style="position: absolute;bottom:1em;left:0;right:0;">
<view v-if="!camheight">
<view style="position: absolute;bottom:0.5em;right:0.8em;">
<ciy-select :rows="2" itemalign="center" :minselectsearch="20" :range="recamrange" v-model="cameraheight" @change="setcamheight"></ciy-select>
</view>
<view style="position: absolute;bottom:0.2em;left:0.5em;">
<button class="btn def" @tap="setcamaddheight(2)"></button>
<button class="btn def" @tap="setcamaddheight(-2)"></button>
<button class="btn smm def" @tap="setcamswapheight()" style="padding:0.8em 1em;">转向</button>
</view>
</view>
<view class="px3 flex flex-center" style="gap:0.2em;" v-if="recamimgs.length > 0">
<image v-for="img in recamimgs.slice(-6)" :src="img" style="height:3em;width:3em;border:1px solid var(--bg9);border-radius: 5px;"></image>
<view class="flex1 px2" style="font-size:1.5em;">x{{recamimgs.length}}</view>
</view>
<view style="text-align: center;">
<button class="btn cc" @tap="closerecam" style="margin-top:0.5em;">完成</button>
<!-- <view @tap="showrecam=false" style="display:inline-block;background: var(--man6);color: #ffffff;width: 1.5em;height: 1.5em;line-height:1.5em;border-radius: 50%;text-align: center;font-size: 2em;"></view> -->
</view>
</view>
</view>
</template>
<script>
export default {
behaviors: ['uni://form-field-group'],
emits: ['change', 'update:modelValue'],
props: {
name: {
type: String
},
modelValue: {
type: String,
default: ''
},
value: {
type: String,
default: ''
},
disabled: {
type: Boolean,
default: false
},
initevent: {
type: Boolean,
default: false
},
left: {
type: Boolean,
default: false
},
action: {
type: String,
default: ''
},
sourcetype: {
type: String,
default: 'camera,album,message' //rehcam
},
camheight: {
type: String,
default: ''
},
cammaskpng: {
type: String,
default: ''
},
filetype: {
type: String,
default: 'image' //all image video
},
ext: {
type: String,
default: ''
},
num: {
type: [String, Number],
default: 1
},
stor: {
type: String,
default: ''
},
imgwidth: {
type: [String, Number],
default: 0
},
imgheight: {
type: [String, Number],
default: 0
},
maxkb: {
type: [String, Number],
default: 0
},
zipjpg: {
type: [String, Number],
default: 70
},
waterfont: {
type: String,
default: '28px Arial'
},
watertext: {
type: String,
default: ''
},
watertype: {
type: String,
default: ''
},
watercolors: {
type: String,
default: ''
},
wateralpha: {
type: String,
default: ''
},
waterpadding: {
type: String,
default: '30'
},
waterangle: {
type: String,
default: '-20'
},
showwh: {
type: String,
default: '4em'
},
path: {
type: String,
default: 'nopath'
},
saas: {
type: String,
default: ''
},
},
data() {
return {
tip: '',
updatevalue: false,
val: '',
showrecam: false,
header_height: 0,
cameraheight: '141.4',
recamrange: [],
recamimgs: [],
cvwidth: 0,
cvheight: 0
};
},
watch: {
value: {
async handler(newD, oldD) {
this.val = newD;
},
immediate: true
},
modelValue: {
async handler(newD, oldD) {
if (this.updatevalue) {
this.updatevalue = false;
return;
}
this.val = newD;
},
immediate: true
},
camheight: {
async handler(newD, oldD) {
var val = 0;
if (newD)
val = this.tofloat(newD);
else {
var dh = this.getstorage('_cameraheight_' + this.name);
if (dh)
val = this.tofloat(dh);
}
if (val < 10 || val > 200)
return;
this.cameraheight = val + '';
},
immediate: true
},
camrefheight: {
async handler(newD, oldD) {
if (newD) {
var url = this.file_stor(newD);
url = url.replace('http://', 'https://');
uni.getImageInfo({
src: url,
success: res => {
this.cameraheight = this.toint(res.height * 100 / res.width) + '';
}
});
}
},
immediate: true
},
},
computed: {
tvalue() {
// this.val null/undefined
var v = this.val || '';
var ret = {};
ret.value = v;
var pimgs = v.split('~'); // vnullsplit
ret.imgs = [];
for (var i in pimgs) {
if (!pimgs[i])
continue;
ret.imgs.push(pimgs[i]);
}
return ret;
}
},
mounted() {
var app = getApp();
this.header_height = app.globalData._header_statusbar_height;
this.recamrange.push({
id: '100',
name: '1:1'
});
this.recamrange.push({
id: '63',
name: '名片'
});
this.recamrange.push({
id: '75',
name: '4:3'
});
this.recamrange.push({
id: '134',
name: '3:4'
});
this.recamrange.push({
id: '56',
name: '16:9'
});
this.recamrange.push({
id: '179',
name: '9:16'
});
this.recamrange.push({
id: '162',
name: '黄金 纵向'
});
this.recamrange.push({
id: '62',
name: '黄金 横向'
});
this.recamrange.push({
id: '141',
name: 'A4 纵向'
});
this.recamrange.push({
id: '71',
name: 'A4 横向'
});
if (this.initevent) {
this.$emit('change', {
name: this.name,
from: 'init',
value: this.tvalue.value
});
}
},
methods: {
toleft(idx) {
if (idx == 0)
return;
var imgs = [...this.tvalue.imgs];
var swap = imgs[idx];
imgs[idx] = imgs[idx - 1];
imgs[idx - 1] = swap;
this.val = imgs.join('~');
this.updatevalue = true;
this.$emit('update:modelValue', this.val);
this.$emit('change', {
name: this.name,
from: 'toleft',
value: this.val
});
},
toright(idx) {
if (this.tvalue.imgs.length == idx + 1)
return;
var imgs = [...this.tvalue.imgs];
var swap = imgs[idx];
imgs[idx] = imgs[idx + 1];
imgs[idx + 1] = swap;
this.val = imgs.join('~');
this.updatevalue = true;
this.$emit('update:modelValue', this.val);
this.$emit('change', {
name: this.name,
from: 'toright',
value: this.val
});
},
preview(idx) {
var imgs = [...this.tvalue.imgs];
for (var i in imgs) {
imgs[i] = this.file_stor(imgs[i]);
}
uni.previewImage({
current: idx,
indicator: 'default',
urls: imgs
});
},
fullvideo(id) {
const videoContext = uni.createVideoContext(id, this);
videoContext.requestFullScreen({
direction: 0
})
},
async photo_select(b) {
if (this.disabled)
return;
if (this.tip)
return this.toast(this.lang('upload.uploadingmsg'));
var items = [];
var sourcetypes = this.sourcetype.split(',');
if (sourcetypes.includes('rehcam')) {
items.push({
act: 'rehcam',
name: this.lang('upload.menu_rehcam')
});
}
if (sourcetypes.includes('camera')) {
items.push({
act: 'camera',
name: this.lang('upload.menu_camera')
});
}
if (sourcetypes.includes('album')) {
items.push({
act: 'album',
name: this.lang('upload.menu_album')
});
}
if (sourcetypes.includes('message')) {
items.push({
act: 'message',
name: this.lang('upload.menu_message')
});
}
var item = await this.popmenu({
items,
one: true
});
if (item.act == 'rehcam')
this.vrehcam();
if (item.act == 'camera')
this.vcamera();
if (item.act == 'album')
this.valbum();
if (item.act == 'message')
this.vmessage();
},
photo_delone(b) {
if (this.disabled)
return;
if (this.tip)
return this.toast(this.lang('upload.uploading'));
var imgs = [...this.tvalue.imgs];
imgs.splice(b.currentTarget.dataset.idx, 1);
this.val = imgs.join('~');
this.updatevalue = true;
this.$emit('update:modelValue', this.val);
this.$emit('change', {
name: this.name,
from: 'del',
value: this.val
});
},
addfile(url, from) {
var imgs = [...this.tvalue.imgs, url];
this.val = imgs.join('~');
if (!from)
return;
this.updatevalue = true;
this.$emit('update:modelValue', this.val);
this.$emit('change', {
name: this.name,
from: from,
value: this.val
});
if (from == 'rehcam') {
if (this.tvalue.imgs.length < this.num) {
this.vrehcam();
}
}
},
setcamheight(e) {
this.cameraheight = e.value.id;
this.setstorage('_cameraheight_' + this.name, this.cameraheight);
},
setcamaddheight(hei) {
var h = this.tofloat(this.cameraheight) + hei;
if (h < 10)
return;
this.cameraheight = h + '';
this.setstorage('_cameraheight_' + this.name, this.cameraheight);
},
setcamswapheight(hei) {
var h = this.tofloat(this.cameraheight);
this.cameraheight = Math.ceil(10000 / h) + '';
this.setstorage('_cameraheight_' + this.name, this.cameraheight);
},
recamphoto() {
const ctx = wx.createCameraContext();
ctx.takePhoto({
quality: 'high',
success: async (res) => {
this.showrecam = false;
this.recamimgs.push(res.tempImagePath);
this.upfiles([res], 'rehcam');
}
});
},
closerecam() {
this.showrecam = false;
this.recamimgs = [];
},
async vrehcam(b) {
this.showrecam = true;
},
async vcamera(b) {
if (!uni.chooseMedia) {
return this.vh5();
}
var count = this.toint(this.num) - this.tvalue.imgs.length;
if (count <= 0)
return this.toast(this.lang('upload.maxmsg').replace('{n}', this.num));
var opt = {};
opt.count = 1;
if (this.filetype == 'all') {
opt.mediaType = ['mix'];
}
if (this.filetype == 'image') {
opt.mediaType = ['image'];
}
if (this.filetype == 'video') {
opt.mediaType = ['video'];
}
opt.sizeType = ['original', 'compressed'];
opt.sourceType = ['camera'];
opt.maxDuration = 60;
var [err, retchoose] = await this.go(uni.chooseMedia(opt));
if (err)
return console.warn('chooseMedia', err);
this.upfiles(retchoose.tempFiles, 'camera');
},
async valbum(b) {
if (!uni.chooseMedia) {
return this.vh5();
}
var count = this.toint(this.num) - this.tvalue.imgs.length;
if (count <= 0)
return this.toast(this.lang('upload.maxmsg').replace('{n}', this.num));
var opt = {};
opt.count = count;
if (this.filetype == 'all') {
opt.mediaType = ['mix'];
}
if (this.filetype == 'image') {
opt.mediaType = ['image'];
}
if (this.filetype == 'video') {
opt.mediaType = ['video'];
}
opt.sizeType = ['original', 'compressed'];
opt.sourceType = ['album'];
var [err, retchoose] = await this.go(uni.chooseMedia(opt));
if (err)
return console.warn('chooseMedia', err);
this.upfiles(retchoose.tempFiles, 'album');
},
async vmessage(b) {
if (!uni.chooseMessageFile) {
return this.vh5();
}
var count = this.toint(this.num) - this.tvalue.imgs.length;
if (count <= 0)
return this.toast(this.lang('upload.maxmsg').replace('{n}', this.num));
var opt = {};
opt.count = count;
if (this.filetype == 'all') {
if (this.ext) {
opt.type = 'file';
opt.extension = this.ext.split(',');
} else {
opt.type = 'all';
}
}
if (this.filetype == 'image') {
opt.type = 'image';
}
if (this.filetype == 'video') {
opt.type = 'video';
}
var [err, retchoose] = await this.go(uni.chooseMessageFile(opt));
if (err)
return console.warn('chooseMessageFile', err);
this.upfiles(retchoose.tempFiles, 'message');
},
async vh5(b) {
var count = this.toint(this.num) - this.tvalue.imgs.length;
if (count <= 0)
return this.toast(this.lang('upload.maxmsg').replace('{n}', this.num));
var opt = {};
opt.count = count;
opt.sizeType = ['original', 'compressed'];
opt.sourceType = ['camera', 'album'];
var [err, retchoose] = await this.go(uni.chooseImage(opt));
if (err)
return console.warn('chooseImage', err);
await this.upfiles(retchoose.tempFiles, 'h5');
},
async upfiles(temps, from) {
var thos = this;
var app = getApp();
this.upcount = temps.length;
this.tip = this.lang('upload.tip') + ' 0/' + this.upcount;
this.upidx = 0;
var opn = {};
//opn.canvasid = 'canvas';
opn.post = {
from: from
};
opn.basepath = this.path;
opn.saas = this.saas;
if(this.stor)
opn.stor = this.stor;
else
opn.stor = app.globalData.storselect;
opn.action = this.action;
opn.maxkb = this.toint(this.maxkb);
opn.imgwidth = this.toint(this.imgwidth);
opn.imgheight = this.toint(this.imgheight);
opn.zipjpg = this.toint(this.zipjpg);
opn.watertext = this.watertext;
opn.watertype = this.watertype;
opn.waterpadding = this.toint(this.waterpadding);
opn.waterangle = this.toint(this.waterangle);
opn.wateralpha = this.tofloat(this.wateralpha);
if (opn.wateralpha <= 0) {
if (this.watertype == 'full')
opn.wateralpha = 0.1;
else
opn.wateralpha = 1;
}
if (this.watercolors)
opn.watercolors = this.watercolors.split(',');
await this.file_uploads(temps, opn, {
success(url, file) {
thos.upidx++;
thos.tip = thos.lang('upload.tip') + ' ' + thos.upidx + '/' + thos.upcount;
if (thos.upidx == thos.upcount) {
thos.tip = '';
thos.addfile(url, from);
} else {
thos.addfile(url);
}
},
fail(err, gf, al) {
console.warn(err, gf, al);
thos.upidx++;
thos.tip = '';
return thos.alert('Upload Fail:' + err);
}
});
}
}
}
</script>
<style scoped>
._vphoto ._photo {
background-image: url("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyB2ZXJzaW9uPScxLjEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zycgd2lkdGg9JzIwMCcgaGVpZ2h0PScyMDAnPjxwYXRoIGQ9J00xMjUuOTUyIDIzNC40OTZoMTY2LjkxMmMyMS41MDQgMCAyOS42OTYtNDguMTI4IDU0LjI3Mi03MS42OCA3LjE2OC03LjE2OCAyOC42NzItMTIuMjg4IDM2Ljg2NC0xMi4yODhoMjc4LjUyOGM4LjE5MiAwIDI5LjY5NiAxMS4yNjQgMzYuODY0IDI1LjYgMTMuMzEyIDI0LjU3NiAxMi4yODggNTguMzY4IDI1LjYgNTguMzY4aDE4MS4yNDhjNDYuMDggMCA4My45NjggMzcuODg4IDgzLjk2OCA4My45Njh2NDc0LjExMmMwIDQ2LjA4LTM3Ljg4OCA4My45NjgtODMuOTY4IDgzLjk2OEgxMjUuOTUyYy00Ni4wOCAwLTgzLjk2OC0zNy44ODgtODMuOTY4LTgzLjk2OFYzMTcuNDRjMS4wMjQtNDYuMDggMzcuODg4LTgyLjk0NCA4My45NjgtODIuOTQ0eicgZmlsbD0nIzNFQkRGRic+PC9wYXRoPjxwYXRoIGQ9J002MzQuODggMjc1LjQ1NmgxNC4zMzZjMTEuMjY0IDAgMjAuNDggOS4yMTYgMjAuNDggMjAuNDhzLTkuMjE2IDIwLjQ4LTIwLjQ4IDIwLjQ4SDYzNC44OGMtMTEuMjY0IDAtMjAuNDgtOS4yMTYtMjAuNDgtMjAuNDggMC0xMC4yNCA5LjIxNi0yMC40OCAyMC40OC0yMC40OHpNNzMyLjE2IDI3NS40NTZoMTY2LjkxMmMxMS4yNjQgMCAyMC40OCA5LjIxNiAyMC40OCAyMC40OHMtOS4yMTYgMjAuNDgtMjAuNDggMjAuNDhINzMyLjE2Yy0xMS4yNjQgMC0yMC40OC05LjIxNi0yMC40OC0yMC40OCAwLTEwLjI0IDkuMjE2LTIwLjQ4IDIwLjQ4LTIwLjQ4eicgZmlsbD0nI0ZGRkZGRic+PC9wYXRoPjxwYXRoIGQ9J001MzAuNDMyIDM1OS40MjRjMTIyLjg4IDAgMjIzLjIzMiA5OS4zMjggMjIzLjIzMiAyMjMuMjMyIDAgMTIyLjg4LTk5LjMyOCAyMjMuMjMyLTIyMy4yMzIgMjIzLjIzMi0xMjIuODggMC0yMjMuMjMyLTk5LjMyOC0yMjMuMjMyLTIyMy4yMzIgMC0xMjIuODggMTAwLjM1Mi0yMjMuMjMyIDIyMy4yMzItMjIzLjIzMnonIGZpbGw9JyNBMkRFRkQnPjwvcGF0aD48L3N2Zz4=");
}
._vphoto {
margin: 0.5em auto 0 auto;
padding: 0;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: flex-end;
position: relative;
}
._vphoto.left {
justify-content: flex-start;
}
._vphoto ._tip {
position: absolute;
top: 0.1em;
left: 0.2em;
line-height: 1em;
font-size: 0.7em;
color: #999999;
}
._vphoto>._btn {
padding: 0.5em;
width: 3em;
height: 3em;
margin: 0 0.5em 0.5em 0;
border: 1px solid #cccccc;
display: inline-block;
border-radius: 0.3em;
background: #ffffff;
}
._vphoto>._btn._disabled {
background: #ebebeb;
filter: grayscale(0.8);
}
._vphoto ._icon {
width: 100%;
height: 100%;
margin: 0 auto;
background-size: cover;
}
._vphoto ._pimg {
margin: 0 0.5em 0.5em 0;
background: #ffffff;
position: relative;
border: 1px solid #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
._vphoto ._pimg ._file {
margin: 1.2em 0;
text-align: center;
}
._vphoto ._pimg image {
width: 100%;
height: 100%;
border-radius: 0.3em;
}
._vphoto ._pimg ._del {
background-image: url("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyB2ZXJzaW9uPScxLjEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc+PHBhdGggZD0nTTUxMiAzMC4xMTc2NDdhNDgxLjg4MjM1MyA0ODEuODgyMzUzIDAgMSAwIDQ4MS44ODIzNTMgNDgxLjg4MjM1MyA0ODEuODgyMzUzIDQ4MS44ODIzNTMgMCAwIDAtNDgxLjg4MjM1My00ODEuODgyMzUzeicgZmlsbD0nI0ZENDgzNyc+PC9wYXRoPjxwYXRoIGQ9J003MDUuMTc0NTg4IDY1Ny43MDkxNzZhMzMuOTcyNzA2IDMzLjk3MjcwNiAwIDEgMS00OC4xODgyMzUgNDcuODI2ODI0TDUxMiA1NjAuMDA3NTI5bC0xNDUuMjI3Mjk0IDE0NS44ODk4ODNhMzMuOTcyNzA2IDMzLjk3MjcwNiAwIDEgMS00OC4xODgyMzUtNDcuODI2ODI0bDE0NS40MDgtMTQ1Ljc2OTQxMkwzMTguNzY1MTc2IDM2Ni4yMzA1ODhhMzMuOTcyNzA2IDMzLjk3MjcwNiAwIDAgMSA0OC4xODgyMzYtNDcuODI2ODIzTDUxMiA0NjMuOTkyNDcxbDE0NS4yMjcyOTQtMTQ1LjcwOTE3N2EzMy45NzI3MDYgMzMuOTcyNzA2IDAgMSAxIDQ4LjE4ODIzNSA0Ny44MjY4MjRMNTU5Ljc2NjU4OCA1MTJ6JyBmaWxsPScjRkZGRkZGJz48L3BhdGg+PC9zdmc+");
width: 1.2em;
height: 1.2em;
position: absolute;
top: -0.3em;
right: -0.3em;
z-index: 10;
}
</style>

View File

@ -0,0 +1,77 @@
<template>
<text :style="ciystyle" v-if="user>0">
<text style="font-size:0.7em;" v-if="!usrinfo" @tap.stop="getname">No.</text>
<text @tap.stop="getname">{{showtxt}}</text>
<button class="btn def smm" style="margin-left:1em;" @tap.stop="showinfo">成员详情</button>
</text>
<text :style="ciystyle" v-else>
<text style="color:var(--bg6)">暂无</text>
</text>
</template>
<style scoped>
</style>
<script>
//
export default {
props: {
user: {
type: [String, Number],
default: 0
},
ciystyle: {
type: [String, Object],
default: ''
},
},
data() {
return {
usrinfo: null
};
},
watch: {},
computed: {
showtxt() {
if (this.usrinfo)
return this.usrinfo.name;
return this.user;
},
},
mounted() {
this.usrinfo = this.getstorage('d' + this.user);
if (!this.usrinfo)
this.getuserinfo();
},
methods: {
async getuserinfo() {
if (this.usrinfo) {
if (this.usrinfo._times > this.tostamp())
return;
}
const app = getApp();
app.globalData.mqfunc.push({
name: 'userinfo_' + this.user,
func: 'dao.userinfo_get',
data: {
id: this.user,
},
callback: retjson => {
if (retjson.code != 1)
return;
retjson.user._times = this.tostamp() + 60;
this.setstorage('d' + this.user, retjson.user);
this.usrinfo = retjson.user;
}
});
},
async getname() {
this.getuserinfo();
},
async showinfo() {
await this.getuserinfo();
this.gourl('/pages/me/user_show', '', this.usrinfo, 'userinfo');
},
}
}
</script>

View File

@ -0,0 +1,63 @@
<template>
<view class="_main" @tap="gourl" :data-url="'/pages/?id=' + data.id">
<image class="_img" :src="file_stor(data.avar, '?100')" mode="scaleToFill" />
<view class="flex1 rel">
<view class="_name" style="min-height:3em;">{{data.name}}</view>
<view>
金额 <ciy-shownum style="font-size:1.6em;" :value="data.bankmoney" unit="元,100,2|万元,1000000,3|亿元,10000000000,3"></ciy-shownum>
</view>
<view class="abs r0 b0 kbd">{{ccode(initdata.zc_menu,data.menuid)}}</view>
</view>
</view>
</template>
<script>
export default {
props: {
initdata: {
type: Object,
default: {}
},
data: {
type: Object,
default: {}
},
index: {
type: Number,
default: -1
}
},
data() {
return {}
},
mounted() {},
methods: {}
};
</script>
<style scoped>
._main {
background: var(--bg1);
display: flex;
padding: 0.5em;
margin-bottom: 0.5em;
border-bottom: 1px solid var(--bg6);
border-top: 1px solid var(--bg4);
}
._img {
width: 5em;
height: 5em;
margin-top: 0.5em;
margin-right: 0.5em;
border-radius: 0.2em;
background: linear-gradient(329deg, #f3ffef, #f1f8ff);
}
._name {
margin-top: 0.3em;
font-size: 1em;
letter-spacing: 1px;
color: var(--txt9);
}
</style>

View File

@ -0,0 +1,35 @@
{
"pages": [{
"path": "pages/main/index",
"style": {
"enablePullDownRefresh": true
}
}],
"ciycfg": {
"mainpackage": ["main", "pub"]
},
"globalStyle": {
"navigationBarTitleText": "众产Ciyon",
"navigationStyle": "custom",
"navigationBarTextStyle": "black"
},
"tabBar": {
"list": [{
"pagePath": "pages/main/index"
},
{
"pagePath": "pages/main/message"
},
{
"pagePath": "pages/main/me"
}
]
},
"preloadRule": {
"pages/main/index": {
"packages": ["pages/demo"],
"network": "all"
}
}
}

20
fapp/ciyon_ap/index.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"></div>
<script type="module" src="/main.js"></script>
</body>
</html>

38
fapp/ciyon_ap/main.js Normal file
View File

@ -0,0 +1,38 @@
/*
=================================================================================
* License: GPL-2.0 license
* Author: 众产® https://ciy.cn/code
* Version: 0.1.0
=================================================================================
支持i18n多语言深色模式通用css色系
在ciy.js中混入了常用函数库自定义组件与页面均可调用
app.* 系统函数
c.* 独立函数
this.* 页面函数
*/
import messages from './util/langload';
let lang = uni.getStorageSync("_lang");
if(!lang)
lang = uni.getLocale();
let i18nConfig = {
locale: lang,
silentTranslationWarn: true,
silentFallbackWarn: true,
messages
};
import App from './App';
import { createSSRApp } from 'vue';
import { createI18n } from 'vue-i18n';
import ciy from './util/ciy';
import './util/style.css';
import './prod.css';
const i18n = createI18n(i18nConfig);
export function createApp() {
const app = createSSRApp(App);
app.use(i18n);
app.use(ciy, App);
return {
app
};
}

173
fapp/ciyon_ap/manifest.json Normal file
View File

@ -0,0 +1,173 @@
{
"name" : "众产DAO",
"appid" : "__UNI__0372782",
"description" : "",
"versionName" : "1.0.1",
"versionCode" : 1000001,
"transformPx" : false,
/* 5+App */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* */
"modules" : {
"Bluetooth" : {},
"iBeacon" : {}
},
/* */
"distribute" : {
/* android */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios */
"ios" : {
"dSYMs" : false
},
/* SDK */
"sdkConfigs" : {
"push" : {
"unipush" : {
"version" : "2",
"offline" : true,
"hms" : {},
"oppo" : {},
"vivo" : {},
"mi" : {},
"meizu" : {},
"honor" : {},
"fcm" : {}
}
},
"share" : {
"weixin" : {
"appid" : "",
"UniversalLinks" : ""
}
},
"speech" : {
"baidu" : {
"appid" : "",
"apikey" : "",
"secretkey" : ""
}
},
"payment" : {},
"oauth" : {},
"maps" : {
"amap" : {
"name" : "",
"appkey_ios" : "",
"appkey_android" : ""
}
},
"ad" : {}
},
"icons" : {
"android" : {
"hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi" : "unpackage/res/icons/192x192.png"
},
"ios" : {
"appstore" : "unpackage/res/icons/1024x1024.png",
"ipad" : {
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"iphone" : {
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
}
}
},
"h5" : {
"router" : {
"base" : "./"
},
"sdkConfigs" : {
"maps" : {
"qqmap" : {
"key" : "TCEBZ-PACWI-OQCGA-5ST3L-CYEDS-OJFW4"
}
}
}
},
/* */
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wx0408640a187feb35",
"setting" : {
"urlCheck" : false,
"minified" : false
},
"usingComponents" : true,
"requiredBackgroundModes" : [ "audio" ],
"libVersion" : "3.4",
"plugins" : {
"WechatSI" : {
"version" : "0.3.6",
"provider" : "wx069ba97219f66d99"
}
},
"permission" : {
"scope.userLocation" : {
"desc" : "用户位置自动获取"
}
},
"requiredPrivateInfos" : [ "chooseLocation", "getLocation", "chooseAddress" ]
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3"
}

428
fapp/ciyon_ap/pages.json Normal file
View File

@ -0,0 +1,428 @@
{
"pages": [
{
"path": "pages/main/index",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "pages/main/me",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "pages/main/message",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "pages/pub/camera"
},
{
"path": "pages/pub/paper"
},
{
"path": "pages/pub/part"
},
{
"path": "pages/pub/psection",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "pages/pub/web",
"style": {
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}
],
"ciycfg": {
"mainpackage": [
"main",
"pub"
]
},
"globalStyle": {
"navigationBarTitleText": "众产Ciyon",
"navigationStyle": "custom",
"navigationBarTextStyle": "black"
},
"tabBar": {
"list": [
{
"pagePath": "pages/main/index"
},
{
"pagePath": "pages/main/message"
},
{
"pagePath": "pages/main/me"
}
]
},
"preloadRule": {
"pages/main/index": {
"packages": [
"pages/demo"
],
"network": "all"
}
},
"subPackages": [
{
"root": "pages/demo",
"pages": [
{
"path": "case/comlife"
},
{
"path": "case/dict"
},
{
"path": "case/pagecal"
},
{
"path": "case/pagefix"
},
{
"path": "case/promise"
},
{
"path": "case/proxy"
},
{
"path": "case/vproject"
},
{
"path": "comform/calendar"
},
{
"path": "comform/capcode"
},
{
"path": "comform/checkbox"
},
{
"path": "comform/checkitem"
},
{
"path": "comform/define"
},
{
"path": "comform/handsign"
},
{
"path": "comform/input"
},
{
"path": "comform/inputbet"
},
{
"path": "comform/inputcyc"
},
{
"path": "comform/inputdaterange"
},
{
"path": "comform/inputdatetime"
},
{
"path": "comform/inputnumber"
},
{
"path": "comform/inputtimepoint"
},
{
"path": "comform/inputunitedit"
},
{
"path": "comform/radiobox"
},
{
"path": "comform/ratestar"
},
{
"path": "comform/selbool"
},
{
"path": "comform/selcas"
},
{
"path": "comform/select"
},
{
"path": "comform/selmap"
},
{
"path": "comform/selpage"
},
{
"path": "comform/slider"
},
{
"path": "comform/switch"
},
{
"path": "comform/textarea"
},
{
"path": "comform/upload"
},
{
"path": "comview/alert"
},
{
"path": "comview/ani"
},
{
"path": "comview/aniheight"
},
{
"path": "comview/anipop"
},
{
"path": "comview/audio"
},
{
"path": "comview/auth"
},
{
"path": "comview/cameraocr"
},
{
"path": "comview/gesture"
},
{
"path": "comview/header"
},
{
"path": "comview/listend",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "comview/markdown"
},
{
"path": "comview/movable"
},
{
"path": "comview/popmenu"
},
{
"path": "comview/query"
},
{
"path": "comview/searchbar"
},
{
"path": "comview/segment"
},
{
"path": "comview/showemoney"
},
{
"path": "comview/showimgs"
},
{
"path": "comview/shownum"
},
{
"path": "comview/svgimg"
},
{
"path": "comview/swipelist"
},
{
"path": "comview/swiper"
},
{
"path": "comview/tabbar"
},
{
"path": "comview/textmore"
},
{
"path": "comview/toast"
},
{
"path": "css/chart_pie"
},
{
"path": "css/cssdemo"
},
{
"path": "css/grid"
},
{
"path": "css/pageflex"
},
{
"path": "css/skeleton"
},
{
"path": "css/tailwind"
},
{
"path": "css/waterfall"
},
{
"path": "css/zindex"
},
{
"path": "curd/demo_edit"
},
{
"path": "curd/demo_list",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "curd/me"
},
{
"path": "index"
},
{
"path": "page/func"
},
{
"path": "page/lang"
},
{
"path": "page/oldfont"
},
{
"path": "page/sysinfo"
},
{
"path": "page/theme"
},
{
"path": "test"
}
]
},
{
"root": "pages/me",
"pages": [
{
"path": "cashie_lst",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "cashin_lst",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "cashoe_lst",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "cashout_cash"
},
{
"path": "cashout_lst",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "cash_charge"
},
{
"path": "invoicetitle"
},
{
"path": "invoice_lst",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "invoicing"
},
{
"path": "me_bank_info"
},
{
"path": "pnt_buylst",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "pnt_buynow"
},
{
"path": "pnt_lst",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "problem_chat"
},
{
"path": "problem_pub",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "safe_ccub"
},
{
"path": "safe_password"
},
{
"path": "safe_real"
},
{
"path": "share_qrcode"
},
{
"path": "suggest"
},
{
"path": "user_bank"
},
{
"path": "user_info"
},
{
"path": "user_shipaddr"
},
{
"path": "user_show"
}
]
},
{
"root": "pages/lab",
"pages": [
{
"path": "user_list"
},
{
"path": "user_edit"
}
]
}
]
}

View File

@ -0,0 +1,60 @@
<template>
<ciy-header title="组件生命周期事件"></ciy-header>
<ciy-test></ciy-test>
<view class="txt-lggg txt-center py4">
<view @tap="gourl" data-url="/pages/pub/paper?id=1">跳转测试</view>
</view>
<view class="ciy-card">
<view class="title">H5页面</view>
<view class="content">
mounted: 页面建立<br/>
activated: 二次进入<br/>
deactivated: 页面离开<br/>
unmounted: 页面销毁<br/>
</view>
</view>
<view class="ciy-card">
<view class="title">event</view>
<view class="content">
readymountedactivatedshowdetacheddeactivatedunmountedhide<br/>
</view>
</view>
<view class="ciy-card">
<view class="title">lifetimes</view>
<view class="content">
attacheddetached
</view>
</view>
<view class="ciy-card">
<view class="title">pageLifetime</view>
<view class="content">
showhideattacheddetached
</view>
</view>
</template>
<style>
</style>
<script>
export default {
data() {
return {
ciy_arearpc: []
}
},
onLoad() {},
watch: {},
computed: {},
methods: {
async loadjs(js) {
var retjson = await this.load_ciydict(this.file_stor('/dict/' + js + '.js'));
if (json.code != 1)
return this.alert(json.errmsg);
this.ciy_arearpc = retjson.arr;
},
demo() {
}
}
}
</script>

View File

@ -0,0 +1,100 @@
<template>
<ciy-header title="字典模式"></ciy-header>
<view class="ciy-card">
<view class="title">传统字典</view>
<view class="content">
<view>总控表名为zc_cata其他saas主体xx_cata</view>
<view>字段一般以字典名称命名注解支持CATA/CATM/CATS/TBIN</view>
<view>例如状态分类型号方案属性等</view>
<view>字典项较多但每一项包含数据应不超过百条</view>
<view>框架在用户登录时加载并缓存到本地localstorage</view>
<view>写页面代码时可直接使用当字典变更时框架在最近一次请求中感知并异步更新</view>
</view>
</view>
<view class="ciy-card">
<view class="title">SaaS字典</view>
<view class="content">
<view>字典表名为xx_catsaas带saasid租户</view>
<view>例如自定义合同分类自定义客户分类等</view>
<view>当用户字典中无数据则使用传统字典的数据</view>
<view>框架在用户登录时加载并缓存到本地localstorage</view>
<view>写页面代码时可直接使用当字典变更时框架在最近一次请求中感知并异步更新</view>
</view>
</view>
<view class="ciy-card">
<view class="title">表字典/页字典</view>
<view class="content">
<view>字段一般以xxid或xxuser命名注解为DB,表名</view>
<view>例如所属用户所属合同所属订单等</view>
<view>可按估算数据量少于百条可用表字典否则用页字典</view>
<view>表字典: 放入once初始化页面首次初始化加载</view>
<view>页字典: 每次调用list时动态加载</view>
<view>若更新频率低且数据量适中可当传统字典在登录时加载</view>
<view>数据量特别大且使用频率很高可集中下载到本地indexdb中</view>
</view>
</view>
<view class="ciy-card">
<view class="title">静态字典</view>
<view class="content">
<view>字段一般以xxcode命名注解为,CATx,ciy_xxx</view>
<view>例如省市区ciy_arearpc行业分类等</view>
<view>适用于数据量较大且基本不变化</view>
<view>导出成ciy_xxx.js文件可同时兼容PC和小程序</view>
<view>JS文件内容var ciy_xxx=[]</view>
<view>页面需要时调用ajax动态加载</view>
</view>
</view>
<view class="ciy-card">
<view class="title">当前传统/用户字典项</view>
<view class="content">
<view>
<button class="btn" @tap="demo">登录后加载</button>
</view>
<view v-for="(item,index) in g">
<view style="font-weight: bolder;color:var(--man6);">{{index}}</view>
<view style="margin-left:1em;">
<view v-for="(item2,index2) in item">
{{item2}}
</view>
</view>
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">加载静态字典</view>
<view class="content">
<view>
<button class="btn" @tap="loadjs('ciy_arearpc')">加载ciy_arearpc</button>
</view>
<view v-for="(item,index) in ciy_arearpc">
{{item}}
</view>
</view>
</view>
</template>
<style>
</style>
<script>
export default {
data() {
return {
ciy_arearpc: []
}
},
onLoad() {},
watch: {},
computed: {},
methods: {
async loadjs(js) {
var retjson = await this.load_ciydict(this.file_stor('/dict/' + js + '.js'));
if (json.code != 1)
return this.alert(json.errmsg);
this.ciy_arearpc = retjson.arr;
},
demo() {
}
}
}
</script>

View File

@ -0,0 +1,70 @@
<template>
<ciy-header title="watch computed示例"></ciy-header>
<view>
<view class="ciy-card" style="padding:1em;">
<view>compute: {{compute}}</view>
<view>test: {{test}}</view>
<view>tobj: {{tobj}}</view>
</view>
<view class="px2 py2">
<button @tap="test='bbbb'">改变test=bbbb</button>
<button @tap="test='ccc'">改变test=ccc</button>
<button @tap="tobj.x=11.3">改变tobj.x</button>
<button @tap="tobj.y=12">改变tobj.y</button>
<button @tap="tobj={c:3,b:0}">改变tobj</button>
<button @tap="tnor='aaaa'">改变tnor=aaaa</button>
<button @tap="tnor='bbbb'">改变tnor=bbbb</button>
<view v-for="item in log" :key="item">{{item}}</view>
</view>
</view>
</template>
<style>
</style>
<script>
export default {
data() {
return {
tnor: 'nnn',
test: 'tt',
tobj: {
y: 34
},
log: []
}
},
onLoad() {},
watch: {
tnor(newVal, oldval) {
this.log.unshift('watch tnor:' + newVal + ',' + oldval);
},
test: {
handler(newVal, oldval) {
this.log.unshift('watch test:' + newVal + ',' + oldval);
},
immediate: true //
},
tobj: {
handler(newVal, oldval) {
this.log.unshift('watch tobj:' + JSON.stringify(newVal) + ',' + JSON.stringify(oldval));
},
deep: true, //obj
immediate: true
},
'tobj.y': { //
handler(newVal, oldval) {
this.log.unshift('watch tobj.y:' + newVal + ',' + oldval);
},
immediate: true
}
},
computed: {
compute() {
this.log.unshift('computed test:' + this.test);
return 'computed-' + this.test;
}
},
methods: {}
}
</script>

View File

@ -0,0 +1,238 @@
<template>
<ciy-header :title="'fix页面位置计算'" transparent></ciy-header>
<view style="position: fixed;bottom:0;z-index: 2;">
<button class="btn" @tap="addscroll">滚动切换</button>
<button class="btn" @tap="addheight">高度切换</button>
</view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:hei+'px'}"></view>
<view class="viw">
<view>view:{{viw}}</view>
<view>screenHeight:{{sys.screenHeight}}  windowHeight:{{sys.windowHeight}}</view>
<view>statusBarHeight:{{sys.statusBarHeight}}  windowBottom:{{sys.windowBottom}}</view>
<view>sA:{{tostr(sys.safeArea)}}</view>
<view>safeAreaInsets:{{tostr(sys.safeAreaInsets)}}</view>
</view>
<view class="sw fix l dat_f">
Fix: 0{{dat_f}}
<view style="top:250px;" class="sw fix l dat_ff">
f-Fix: 250{{dat_ff}}
<view style="top:300px;" class="sw fix l dat_fff">
f-f-Fix: 300{{dat_fff}}
</view>
<view style="top:100px;" class="sw abs l dat_ffa">
f-f-Abs: 100{{dat_ffa}}
</view>
</view>
<view style="top:300px;" class="sw abs l dat_fa">
f-Abs: 300{{dat_fa}}
<view style="top:500px;" class="sw fix l dat_faf">
f-a-Fix: 500{{dat_faf}}
</view>
<view style="top:150px;" class="sw abs l dat_faa">
f-a-Abs: 150{{dat_faa}}
</view>
</view>
</view>
<view style="border-top: 1px solid #ee00ff;" class="sw abs r dat_a">
Abs: 0{{dat_a}}
<view style="top:250px;" class="sw fix r dat_af">
a-Fix: 250{{dat_af}}
<view style="top:300px;" class="sw fix r dat_aff">
a-f-Fix: 300{{dat_aff}}
</view>
<view style="top:100px;" class="sw abs r dat_afa">
a-f-Abs: 100{{dat_afa}}
</view>
</view>
<view style="top:300px;" class="sw abs r dat_aa">
a-Abs: 300{{dat_aa}}
<view style="top:500px;" class="sw fix r dat_aaf">
a-a-Fix: 500{{dat_aaf}}
</view>
<view style="top:150px;" class="sw abs r dat_aaa">
a-a-Abs: 150{{dat_aaa}}
</view>
</view>
</view>
<view class="fx">
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
</view>
<view :style="{height:hei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view :style="{height:tophei+'px'}"></view>
<view style="height:100px"></view>
<view style="height:100px"></view>
<view style="height:100px"></view>
<view style="height:100px"></view>
<view style="height:100px"></view>
<view style="height:100px"></view>
<view style="height:100px"></view>
<view style="height:100px"></view>
<view style="height:100px"></view>
</template>
<style>
.viw {
font-size: 0.8em;
}
.viw>view {
white-space: nowrap;
}
.fix {
position: fixed;
}
.abs {
position: absolute;
}
.sw {
z-index: 2;
border-top: 1px solid #00aaff;
white-space: nowrap;
box-sizing: border-box;
font-size: 0.9em;
}
.fx {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 0;
box-sizing: border-box;
}
.fx>view:nth-child(odd) {
box-sizing: border-box;
height: 50px;
border-left: 8px solid #00aa00;
border-right: 8px solid #00aa00;
border-bottom: 1px dashed #cccccc;
}
.fx>view:nth-child(even) {
box-sizing: border-box;
height: 50px;
border-left: 8px solid #cc0000;
border-right: 8px solid #cc0000;
border-bottom: 1px solid #eea3a5;
}
.l {
left: 10px;
}
.r {
right: 10px;
}
</style>
<script>
export default {
data() {
return {
sys: {},
stdata: false,
hei: 0,
tophei: 0,
viw: 0,
dat_a: 0,
dat_af: 0,
dat_aff: 0,
dat_afa: 0,
dat_aa: 0,
dat_aaa: 0,
dat_aaf: 0,
dat_f: 0,
dat_ff: 0,
dat_fff: 0,
dat_ffa: 0,
dat_fa: 0,
dat_faa: 0,
dat_faf: 0
}
},
onLoad() {
setTimeout(() => {
this.getdata2();
this._tick = setInterval(() => {
this.getdata2();
}, 1000);
}, 100);
},
onUnload() {
clearInterval(this._tick);
},
methods: {
addscroll() {
if (this.hei)
this.hei = 0;
else
this.hei = 1000;
},
addheight() {
if (this.tophei)
this.tophei = 0;
else
this.tophei = 100;
},
getdata2() {
this.sys = uni.getWindowInfo();
this.classrect('viw');
this.classrect('dat_f');
this.classrect('dat_ff');
this.classrect('dat_fff');
this.classrect('dat_ffa');
this.classrect('dat_fa');
this.classrect('dat_faf');
this.classrect('dat_faa');
this.classrect('dat_a');
this.classrect('dat_af');
this.classrect('dat_aff');
this.classrect('dat_afa');
this.classrect('dat_aa');
this.classrect('dat_aaf');
this.classrect('dat_aaa');
},
classrect(cls) {
uni.createSelectorQuery().in(this).select('.' + cls).boundingClientRect(data => {
if (!data)
return this.alert('data.' + cls + '未获取到');
this[cls] = '/' + this.toint(data.top) + '; h:' + this.toint(data.height) + '; l:' + this
.toint(data.left);
}).exec();
}
}
}
</script>

View File

@ -0,0 +1,63 @@
<template>
<ciy-header title="Promise极简示例"></ciy-header>
<view>
<view class="txt-center py4">
<button class="btn long" @tap="prom(true)">请求Promise success</button>
</view>
<view class="txt-center py4">
<button class="btn long" @tap="prom(false)">请求Promise fail</button>
</view>
<view class="ciy-card" style="padding:1em;">
Result: {{msg}}
</view>
<view class="px4 py1" v-for="item in log" :key="item">{{item}}</view>
</view>
</template>
<style>
</style>
<script>
export default {
data() {
return {
msg: '--',
log: []
}
},
onLoad() {},
watch: {},
computed: {},
methods: {
async prom(ret) {
this.msg = '... ...';
var res = await this.dopromise({
ret: ret
});
this.log.unshift('prom: ' + res);
console.log('prom', res);
this.msg = res ? res : 'undefined';
},
async dopromise(opt) {
return new Promise((resolve, reject) => {
this.log.unshift('run 1');
console.log('run 1');
setTimeout(() => {
if (opt.ret)
resolve('success');
else
return reject('fail');
this.log.unshift('result 3');
console.log('result 3');
}, 1000);
this.log.unshift('run 2');
console.log('run 2');
}).catch(e => {
this.log.unshift('catch 4: ' + e);
console.log('catch 4', e);
return e; //res undefined
});
}
}
}
</script>

View File

@ -0,0 +1,64 @@
<template>
<ciy-header title="Vue3 Proxy"></ciy-header>
<view class="ciy-card">
<view class="title">Proxy响应式数据</view>
<view class="content">
<view>相比Vue2Vue3更少的考虑$set绑定问题</view>
<view class="txt-center py4">
<button @tap="addstart" class="btn">新增到头部</button>
<button @tap="addend" class="btn">新增到底部</button>
</view>
<view v-for="(item,index) in list" :key="index" style="display: flex;align-items: center;gap: 6px;margin: 16px 0;">
<button @tap="edit(index)" class="btn def">更新</button>
<button @tap="del(index)" class="btn def">删除</button>
<view style="flex:1;">
{{item.id}}|{{item.name}}|{{item.ext}}|{{item.ext2}}
</view>
</view>
</view>
</view>
</template>
<style>
</style>
<script>
export default {
data() {
return {
list: []
}
},
onLoad() {},
methods: {
addstart() {
var edited = {
id: 5,
name: Math.random().toFixed(2),
ext2: '头部ext2'
};
this.list.unshift(edited);
},
addend() {
var edited = {
id: 5,
name: Math.random().toFixed(2),
ext: '底部ext'
};
this.list.push(edited);
},
edit(index) {
// this.$set(this.list, index, json.edited);
this.list[index] = {
id: 6,
name: this.lang('tabbar.me') + Math.random().toFixed(2),
ext2: 'ass'
};
console.log(this.list);
},
del(index) {
this.list.splice(index, 1);
}
}
}
</script>

View File

@ -0,0 +1,53 @@
<template>
<ciy-header title="工程化改进"></ciy-header>
<view class="ciy-card">
<view class="title mk">
页面自动添加通用组件
</view>
<view class="right">template</view>
<view class="content">
<view>在vite.config.js中添加htmlPlugin_ciy plugins</view>
<view>在每个页面的template后添加通用组件</view>
<view>例如: ciy-authciy-alertciy-toastciy-popmenu等</view>
<!-- 修改vite工具
D:\Program Files\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\vite-plugin-uni\dist\utils\polyfill.js
在if (options?.filename) {下加入
if (options.filename.indexOf('/pages/') > -1)
source = source.replace('<template>','<template>\n<ciy-auth id="auth" ref="auth"></ciy-auth>'); -->
</view>
</view>
<view class="ciy-card">
<view class="title">自动生成pages.json路由</view>
<view class="content">
<view>将所有vue文件放入/pages/目录下</view>
<view>配置defpages.json只保留pages数组第一行</view>
<view>自建公用目录xx复制createpages.js</view>
<view>外部命令中添加ctrl+alt+p快捷键</view>
<view>[</view>
<view> "name":"Create Pages",</view>
<view> "command": ["node", "xx\createpages.js","$projectDir"],</view>
<view> "workingDir" : "xx\createpages",</view>
<view> "key": "ctrl+alt+p",</view>
<view> "type": "shell"</view>
<view>]</view>
</view>
</view>
</template>
<style>
</style>
<script>
export default {
data() {
return {
}
},
onLoad() {},
watch: {
},
computed: {
},
methods: {}
}
</script>

View File

@ -0,0 +1,208 @@
<template>
<ciy-header ref="header" title="ciy-calendar组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">日历选择器</view>
<view class="content">
显示日历选择某个日期<br />
可定制周框和日框显示效果<br />
原生开发无依赖<br />
</view>
</view>
<form @submit="submitlog">
<view class="tip">默认效果:</view>
<ciy-calendar name="ciy1" v-model="formvalue" @change="chglog('change', $event)" @viewchange="chglog('viewchange', $event)"></ciy-calendar>
<view class="tip">简单定制:</view>
<view style="margin: 0 2em;background:linear-gradient(45deg,var(--man7),var(--man4))">
<ciy-calendar name="ciy2" weekmonday clearbtn hasmore bordercolor="#ff0000" selecttextcolor="#ff0000" selectbg="linear-gradient(335deg, #8fffac, #32bcf1);" :value="formvalue" mindate="2024-6-10" :maxdate="maxdate" @change="chglog('change', $event)" @viewchange="chglog('viewchange', $event)"></ciy-calendar>
</view>
<view class="tip">
多语言:
<text v-for="(item,index) in locales" class="lang" :class="{selected:locale == item.id}" @tap="setlocale(item.id)">{{item.name}}</text>
</view>
<view class="tip">选择月份:</view>
<view>
<ciy-calendar name="ciy3" selectmonth weekmonday clearbtn hasmore :value="formvalue" @change="chglog('change', $event)" @viewchange="chglog('viewchange', $event)"></ciy-calendar>
</view>
<view class="tip">Slot定制:</view>
<view style="margin: 0 0.5em;background:#ffffff;border-radius: 0.5em;border:1px solid #dddddd;box-shadow: 2px 2px 5px #cccccc;">
<ciy-calendar name="ciy4" height="29em" :value="formvalue" @change="chglog('change', $event)" @viewchange="chglog('viewchange', $event)">
<template v-slot:header="{itm}">
<view class="week">{{itm.week}}</view>
</template>
<template v-slot:data="{itm}">
<view class="day" :class="{qdday:qd(itm),qdsel:itm.select}">{{itm.day}}</view>
</template>
</ciy-calendar>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue=1723456700">改变值</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">bordercolor</view>
<view class="tip">
选中日期边框和周列分隔线颜色<br />
默认 var(--bg6)
</view>
<view class="hr"></view>
<view class="prp">selecttextcolor</view>
<view class="tip">
选中日期选择年选择月的文字色<br />
默认 var(--man5)
</view>
<view class="hr"></view>
<view class="prp">selectbg</view>
<view class="tip">
选中日期背景色<br />
默认 var(--bg1)
</view>
<view class="hr"></view>
<view class="prp">height</view>
<view class="tip">
组件高度<br />
默认 23em
</view>
<view class="hr"></view>
<view class="prp">selectmonth</view>
<view class="tip">
选择月份模式<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">weekmonday</view>
<view class="tip">
是否周一在第一列<br />
默认 false 周日在第一列
</view>
<view class="hr"></view>
<view class="prp">mindate,maxdate</view>
<view class="tip">
可选日期范围如果不设则不限制<br />
数据格式: 2020-12-121607702400
</view>
<view class="hr"></view>
<view class="prp">clearbtn</view>
<view class="tip">
是否显示不选日期按钮点击则清空日期<br />
默认 false 不显示
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数值变更事件<br />
from: init,click,today,nodate
</view>
<view class="hr"></view>
<view class="evt">@viewchange</view>
<view class="tip">
数值变更事件<br />
from: year,month
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
.week {
text-align: center;
line-height: 2em;
background: linear-gradient(0deg, #ffffff, #d3ebf3);
border-right: 1px solid #ffffff;
}
.day {
line-height: 4em;
}
.qdday {
background: linear-gradient(45deg, var(--man4), var(--man7));
color: var(--bg1);
overflow: hidden;
position: relative;
}
.qdday::before {
content: '';
position: absolute;
bottom: -1.8em;
right: 0;
background-color: var(--bg3);
width: 2em;
height: 2em;
border: 1px solid var(--man5);
transform: rotate(45deg);
transform-origin: right bottom;
}
.qdsel {
color: var(--dag6);
}
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: 0,
maxdate: 0
}
},
onLoad() {
this.maxdate = this.tostamp() + 86400 * 7;
},
methods: {
qd(e) {
if (e.day == '')
return false;
return Math.random() > 0.7;
}
}
}
</script>

View File

@ -0,0 +1,131 @@
<template>
<ciy-header ref="header" title="ciy-capcode组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">验证码组件</view>
<view class="content">
数秒倒计时后台交互联动<br />
判断真人点击
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>账号</label>
<view>
<ciy-input name="account" bb v-model="account"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>验证码</label>
<view>
<ciy-capcode hasmore name="ciy1" btntxt="发送短信" :account="account" :btntxt="props.btntxt" :func="props.func" :placeholder="props.placeholder" :maxlength="props.maxlength" :maxsec="props.maxsec" @change="chglog('change', $event)"></ciy-capcode>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="hr"></view>
<view class="prp">placeholder</view>
<view class="tip">
占位文字<br />
默认 请选择
</view>
<ciy-input bb v-model="props.placeholder"></ciy-input>
<view class="hr"></view>
<view class="prp">btntxt</view>
<view class="tip">
按钮文字<br />
</view>
<ciy-input bb v-model="props.btntxt"></ciy-input>
<view class="hr"></view>
<view class="prp">account</view>
<view class="tip">
外部账号数据<br />
</view>
<view class="hr"></view>
<view class="prp">func</view>
<view class="tip">
调用的函数名称<br />
</view>
<ciy-input bb v-model="props.func"></ciy-input>
<view class="hr"></view>
<view class="prp">codelength</view>
<view class="tip">
生成的验证码长度<br />
默认 4
</view>
<ciy-input bb v-model="props.codelength" style="width:4em;"></ciy-input>
<view class="hr"></view>
<view class="prp">maxsec</view>
<view class="tip">
数秒倒计时<br />
默认 60
</view>
<ciy-input bb v-model="props.maxsec" style="width:4em;"></ciy-input>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change</view>
<view class="tip">
发送事件<br />
from: send,tickend
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: 0,
account: '',
props:{
btntxt:'发送短信',
placeholder:'请选择',
func:'login.sendsms',
codelength:4,
maxsec:60
}
}
},
onLoad() {
},
methods: {
}
}
</script>

View File

@ -0,0 +1,199 @@
<template>
<ciy-header ref="header" title="ciy-checkbox组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">复选框</view>
<view class="content">
相比传统checkbox-group组件可与字典联动<br />
选项数据格式[{id,name}]数组<br />
数据用小写逗号分隔两边都有逗号<br />
方便like数据库查询法(简单低效)<br />
大数据量的多选筛选应独立建副表或用ES<br />
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>原始组件</label>
<view>
<checkbox-group name="ori">
<label>
<checkbox value="r1" />选项1
</label>
<label>
<checkbox value="r2" />选项2
</label>
<label>
<checkbox value="r3" />选项3
</label>
</checkbox-group>
</view>
</view>
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-checkbox v-model="formvalue" name="ciy1" :range="rang" @change="chglog('change', $event)"></ciy-checkbox>
</view>
</view>
<view class="ciy-form">
<label>整行排列</label>
<view>
<ciy-checkbox line itemright hasmore :value="formvalue" name="ciy2" :range="rang" @change="chglog('change', $event)"></ciy-checkbox>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-checkbox left disabled :value="formvalue" name="ciy3" :range="rang" @change="chglog('change', $event)"></ciy-checkbox>
</view>
</view>
<view class="ciy-form">
<label class="imp">每行一条</label>
<view>
<ciy-checkbox hasmore moreno line :value="formvalue" name="ciy4" :range="rang" @change="chglog('change', $event)"></ciy-checkbox>
</view>
</view>
<view class="ciy-form">
<label>十六进制</label>
<view>
<ciy-checkbox bin :value="formvalue16" name="ciy5" :range="rang" @change="chglog('change', $event)"></ciy-checkbox>
</view>
</view>
<view class="ciy-form">
<label>简易range</label>
<view>
<ciy-checkbox :value="formvalue" name="ciy6" range="10:待处理,20:已处理" @change="chglog('change', $event)"></ciy-checkbox>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue='1,3'">改变值</button>
<button class="btn" @tap="formvalue16=5">改变hex</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">moreno</view>
<view class="tip">
是否form携带未选中数据<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">range</view>
<view class="tip">
选项数组object需包含id,name,upid<br />
简易字符串id1.name1,id2.name2,...<br />
</view>
<view class="hr"></view>
<view class="prp">bin</view>
<view class="tip">
十六进制按位返回整数<br />
</view>
<view class="hr"></view>
<view class="prp">itemright</view>
<view class="tip">
是否选项方块在右侧<br />
默认 false 在左侧
</view>
<view class="hr"></view>
<view class="prp">line</view>
<view class="tip">
是否每一个选项单独一行<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">byname (即将废弃)</view>
<view class="tip">
以name匹配选项<br />
默认 false 以id匹配
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数值变更事件<br />
from: init,check
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: '',
formvalue16: 0,
rang: [{
id: 1,
name: '选项1'
}, {
id: 2,
name: '选项2'
}, {
id: 3,
name: '选项3'
}],
}
},
onLoad() {},
methods: {}
}
</script>
<style>
</style>

View File

@ -0,0 +1,163 @@
<template>
<ciy-header ref="header" title="ciy-checkitem组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">选择块</view>
<view class="content">
相比传统checkbox组件样式动画个性化<br />
</view>
</view>
<view class="ciy-card">
<view class="title">自定义样式</view>
<view class="content">
<view>颜色样式在style.css中设置css变量</view>
<view>--e-switch-br: 背景色</view>
<view>--e-switch-chk: 选中背景色</view>
<view>--e-switch-txt: 文字色</view>
<view>
<ciy-checkitem name="d1" style="font-size:0.6em;color:#666666;" v-model="txtciy" @change="chglog('change', $event)"></ciy-checkitem>
<ciy-checkitem sq name="d2" style="font-size:0.8em;" v-model="txtciy" @change="chglog('change', $event)"></ciy-checkitem>
<label>
<ciy-checkitem sq name="d3" style="font-size:2em;color:#cc0000;" v-model="txtciy" @change="chglog('change', $event)"></ciy-checkitem>
label for
</label>
<ciy-checkitem sq name="d4" v-model="txtciy" @change="chglog('change', $event)">lab标签</ciy-checkitem>
</view>
<view>label for在微信小程序无法穿透进组件</view>
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>原始组件</label>
<view>
<checkbox-group name="oricheckbox">
<checkbox value="a1"></checkbox>
<checkbox value="a2"></checkbox>
</checkbox-group>
<radio-group name="oriradio">
<radio value="r1"></radio>
<radio value="r2"></radio>
</radio-group>
</view>
</view>
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-checkitem v-model="formvalue" name="ciy1" @change="chglog('change', $event)"></ciy-checkitem>
</view>
</view>
<view class="ciy-form">
<label>方块</label>
<view>
<ciy-checkitem name="ciy2" sq :value="formvalue" @change="chglog('change', $event)"></ciy-checkitem>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-checkitem name="ciy3" :value="formvalue" @change="chglog('change', $event)" disabled></ciy-checkitem>
</view>
</view>
<view class="ciy-form">
<label class="imp">放慢</label>
<view>
<ciy-checkitem ms="1000" sq name="ciy4" :value="formvalue" @change="chglog('change', $event)"></ciy-checkitem>
</view>
</view>
<view class="ciy-form">
<label class="imp">带文字</label>
<view>
<ciy-checkitem sq name="ciy5" :value="formvalue" @change="chglog('change', $event)">文字</ciy-checkitem>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue=true">true</button>
<button class="btn" @tap="formvalue=false">false</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">ms</view>
<view class="tip">
动画毫秒数<br />
默认 200
</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">sq</view>
<view class="tip">
方形<br />
默认 false
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数值变更事件<br />
from: init,input
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: false,
rang: [{
id: 1,
name: '选项1'
}, {
id: 2,
name: '选项2'
}, {
id: 3,
name: '选项3'
}],
}
},
onLoad() {},
methods: {}
}
</script>
<style>
</style>

View File

@ -0,0 +1,88 @@
<template>
<ciy-header ref="header" title="全局通用组件定义"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">需同时支持:value和v-model</view>
<view class="content">
单向和双向数据流处理机制有所不同<br/>
组件开发时应同时考虑modelValue和value<br />
</view>
</view>
<view class="ciy-card">
<view class="title">通用change事件</view>
<view class="content">
change事件参数通用格式: <br/>
{name:'', from:'', value:obj, lastvalue:obj}<br/>
from=init收到父页面的有效数据<br />
from=其他组件内部操作如点击完成等<br/>
注意: change事件表示数据变化而非操作变化<br />
</view>
</view>
<view class="ciy-card">
<view class="title">通用ciystyle属性</view>
<view class="content">
弥补微信小程序问题通过该属性穿透到组件内部<br/>
<text style="color:var(--dag5)">组件上不能添加classstyle属性</text>
</view>
</view>
<view class="ciy-card">
<view class="title">通用disabled属性</view>
<view class="content">
组件不可用属性<br/>
</view>
</view>
<view class="ciy-card">
<view class="title">通用initevent属性</view>
<view class="content">
添加该属性则初始化后立即调用onchange事件<br/>
</view>
</view>
<view class="ciy-card">
<view class="title">通用left属性</view>
<view class="content">
组件默认右对齐添加该属性可改为传统左对齐<br/>
</view>
</view>
<view class="ciy-card">
<view class="title">通用hasmore属性</view>
<view class="content">
默认表单数据只有name一项与数据库原始数据匹配后端可直接原始存储<br/>
打开hasmore后表单数据增加附属数据满足前后端扩展数据解析需求<br/>
</view>
</view>
<view class="ciy-card">
<view class="title">外部方法首字母大写</view>
<view class="content">
外部方法首字母大写以示区分<br/>
内部方法名全小写<br/>
</view>
</view>
<view class="ciy-card">
<view class="title">class定义注意事项</view>
<view class="content">
组件内所有类名加下划线前缀<br/>
避免产生全局惯例类名冲突<br/>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
}
},
onLoad() {
},
methods: {
}
}
</script>

View File

@ -0,0 +1,149 @@
<template>
<ciy-header ref="header" title="ciy-handsign组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">手写输入</view>
<view class="content">
手写签名支持水印<br />
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>签名</label>
<view>
<ciy-handsign name="ciy1" v-model="formvalue" @change="chglog('change', $event)"></ciy-handsign>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">placeholder</view>
<view class="tip">
占位文字<br />
默认 请选择
</view>
<view class="hr"></view>
<view class="prp">btime</view>
<view class="tip">
是否选择时分时间<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">bordercolor</view>
<view class="tip">
选中日期边框和周列分隔线颜色<br />
默认 var(--bg6)
</view>
<view class="hr"></view>
<view class="prp">selecttextcolor</view>
<view class="tip">
选中日期选择年选择月的文字色<br />
默认 var(--man5)
</view>
<view class="hr"></view>
<view class="prp">selectbg</view>
<view class="tip">
选中日期背景色<br />
默认 var(--bg1)
</view>
<view class="hr"></view>
<view class="prp">weekmonday</view>
<view class="tip">
是否周一在第一列<br />
默认 false 周日在第一列
</view>
<view class="hr"></view>
<view class="prp">mindate,maxdate</view>
<view class="tip">
可选日期范围如果不设则不限制<br />
数据格式: 2020-12-121607702400
</view>
<view class="hr"></view>
<view class="prp">clearbtn</view>
<view class="tip">
是否显示不选日期按钮点击则清空日期<br />
默认 false 不显示
</view>
<view class="hr"></view>
<view class="prp">diastema</view>
<view class="tip">
弹出上下间隙弹出效果更好看<br />
默认 12 单位px
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数值变更事件<br />
from: init,calendar,hour,minute,done
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: 0,
maxdate: 0
}
},
onLoad() {
this.maxdate = this.tostamp() + 86400 * 7;
},
methods: {
qd(e) {
if (e.day == '')
return false;
return Math.random() > 0.7;
}
}
}
</script>

View File

@ -0,0 +1,195 @@
<template>
<ciy-header title="ciy-input组件"></ciy-header>
<view class="ciy-card">
<view class="title">输入框</view>
<view class="content">
相比传统input组件可在change直接写数据变化的响应代码无需为初始化单独处理<br />
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>原生组件</label>
<view>
<input name="ori" v-model="txtori" @focus="chglog('focus', $event)" @blur="chglog('blur', $event)" @change="chglog('change', $event)" @confirm="chglog('confirm', $event)" />
</view>
</view>
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-input name="ciy1" v-model="formvalue" @change="chglog('change', $event)"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>左侧</label>
<view>
<ciy-input left placeholder="请输入" :value="formvalue" name="ciy2" @change="chglog('change', $event)"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>传统</label>
<view>
<ciy-input bb :value="formvalue" name="ciy3" @change="chglog('change', $event)"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>自定义样式</label>
<view>
<ciy-input :ciystyle="{fontSize:'2em',color:'#cc0000',textAlign:'center'}" :value="formvalue" name="ciy4"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>密码</label>
<view>
<ciy-input password name="ciy5" :value="formvalue" @change="chglog('change', $event)"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>数字输入</label>
<view class="flex flex-center">
<ciy-input bb :ciystyle="{width:'3em',margin:'0 0.5em',textAlign:'center',display:'inline-block'}" type="number" name="ciy6" :value="formvalue" @change="chglog('change', $event)"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-input disabled name="ciy7" bb :value="formvalue" @change="chglog('change', $event)"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>输入限制</label>
<view>
<ciy-input maxlength="4" name="ciy8" :value="formvalue" @change="chglog('change', $event)"></ciy-input>
</view>
</view>
<view class="ciy-form">
<label>键盘按钮</label>
<view>
<ciy-input confirmType="search" name="ciy9" :value="formvalue" @change="chglog('change', $event)"></ciy-input>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue='1234abcd'">改变值</button>
<button class="btn" @tap="formvalue='1234'">改变数字</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
是否禁用<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">ciystyle</view>
<view class="tip">
针对微信小程序等问题传递style
</view>
<view class="hr"></view>
<view class="prp">bb</view>
<view class="tip">
是否传统文本框样式<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">placeholder</view>
<view class="tip">
占位文字<br />
</view>
<view class="hr"></view>
<view class="prp">type</view>
<view class="tip">
textnumber纯数字idcard身份证digit小数tel电话<br />
默认 text
</view>
<view class="hr"></view>
<view class="prp">password</view>
<view class="tip">
是否密码<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">maxlength</view>
<view class="tip">
最大可输入字符数<br />
默认 140
</view>
<view class="hr"></view>
<view class="prp">confirmType</view>
<view class="tip">
键盘的右下角按钮的文字text生效<br />
 send 发送search 搜索go 前往<br />
 next 下一个done 完成<br />
默认 done
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数据变更事件<br />
from: init,input,confirm
</view>
<view class="hr"></view>
<view class="evt">@focus, blur</view>
<view class="tip">
获取焦点失去焦点事件<br />
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: ''
}
},
onLoad() {},
methods: {
}
}
</script>

View File

@ -0,0 +1,177 @@
<template>
<ciy-header title="ciy-inputbet组件"></ciy-header>
<view class="ciy-card">
<view class="title">倍数数字输入框</view>
<view class="content">
用倍数关系将可能出现的小数整数化输入<br />
WCNY,万元,bet=1000000,<br />
CNY,,bet=100,<br />
MCNY,,bet=10000,<br />
TON,,bet=1000000,<br />
KG,公斤,bet=1000,<br />
METRE,,bet=1000,毫米<br />
PCT,,bet=100,万分之<br />
TC,,bet=1000<br />
INT,整数,bet=1<br />
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-inputbet bet="100" unit="元" name="ciy1" v-model="formvalue" @change="chglog('change', $event)"></ciy-inputbet>
</view>
</view>
<view class="ciy-form">
<label>左侧</label>
<view>
<ciy-inputbet left hasmore bet="100" unit="元" placeholder="请输入" name="ciy2" :value="formvalue" @change="chglog('change', $event)"></ciy-inputbet>
</view>
</view>
<view class="ciy-form">
<label>传统</label>
<view>
<ciy-inputbet bb bet="100" unit="元" name="ciy3" :value="formvalue" @change="chglog('change', $event)"></ciy-inputbet>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-inputbet disabled bet="100" unit="元" name="ciy4" :value="formvalue" @change="chglog('change', $event)"></ciy-inputbet>
</view>
</view>
<view class="ciy-form">
<label>输入框宽度</label>
<view>
<ciy-inputbet bb :ciystyle="{width:'6em'}" bet="1000" unit="公斤" name="ciy5" :value="formvalue" @change="chglog('change', $event)"></ciy-inputbet>
</view>
</view>
<view class="ciy-form">
<label>键盘按钮</label>
<view>
<ciy-inputbet confirmType="search" bet="10" unit="°" name="ciy6" :value="formvalue" @change="chglog('change', $event)"></ciy-inputbet>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue='350'">改变值</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据<br />
unit,num<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">bb</view>
<view class="tip">
是否传统文本框样式<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">ciystyle</view>
<view class="tip">
针对微信小程序等问题传递style<br />
默认 {width:'4em'}
</view>
<view class="hr"></view>
<view class="prp">placeholder</view>
<view class="tip">
占位文字<br />
</view>
<view class="hr"></view>
<view class="prp">bet</view>
<view class="tip">
倍数值<br />
默认 1
</view>
<view class="hr"></view>
<view class="prp">unit</view>
<view class="tip">
单位文字<br />
</view>
<view class="hr"></view>
<view class="prp">confirmType</view>
<view class="tip">
键盘的右下角按钮的文字text生效<br />
 send 发送search 搜索go 前往<br />
 next 下一个done 完成<br />
默认 done
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数据变更事件<br />
from: init,input,confirm
</view>
<view class="hr"></view>
<view class="evt">@focus, blur</view>
<view class="tip">
获取焦点失去焦点事件<br />
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: ''
}
},
onLoad() {},
methods: {}
}
</script>

View File

@ -0,0 +1,136 @@
<template>
<ciy-header title="ciy-inputcyc组件"></ciy-header>
<view class="ciy-card">
<view class="title">执行周期输入框</view>
<view class="content">
支持月/86400整除为天60整除为分钟<br />
月为负值秒为正值0为不设置周期<br />
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-inputcyc name="ciy1" v-model="formvalue" @change="chglog('change', $event)"></ciy-inputcyc>
</view>
</view>
<view class="ciy-form">
<label>左侧</label>
<view>
<ciy-inputcyc left hasmore name="ciy2" :value="formvalue" @change="chglog('change', $event)"></ciy-inputcyc>
</view>
</view>
<view class="ciy-form">
<label>传统</label>
<view>
<ciy-inputcyc bb name="ciy3" :value="formvalue" @change="chglog('change', $event)"></ciy-inputcyc>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-inputcyc disabled name="ciy4" :value="formvalue" @change="chglog('change', $event)"></ciy-inputcyc>
</view>
</view>
<view class="ciy-form">
<label>选择</label>
<view>
<ciy-inputcyc bb name="ciy5" range="month,day,hour,min,sec" :value="formvalue" @change="chglog('change', $event)"></ciy-inputcyc>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue='-2'">改月</button>
<button class="btn" @tap="formvalue='86400'">改天</button>
<button class="btn" @tap="formvalue='180'">改秒</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据<br />
unit,num<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">bb</view>
<view class="tip">
是否传统文本框样式<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">range</view>
<view class="tip">
可选择单位支持month,day,hour,min,sec<br />
默认 month,day,min
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数据变更事件<br />
from: init,num,unit
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: ''
}
},
onLoad() {},
methods: {}
}
</script>

View File

@ -0,0 +1,165 @@
<template>
<ciy-header ref="header" title="ciy-inputdaterange组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">日期区间选择框</view>
<view class="content">
选择日期时间区间<br />
自动将较小的日期调换到前
</view>
</view>
<view v-for="n in 9" :key="n" class="zw"> 占位 {{n}}</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>设置日期</label>
<view>
<ciy-inputdaterange name="ciy1" v-model="formvalue" @change="chglog('change', $event)"></ciy-inputdaterange>
</view>
</view>
<view class="ciy-form v">
<label>设置时间</label>
<view>
<ciy-inputdaterange hasmore left btime name="ciy2" :value="formvalue" @change="chglog('change', $event)"></ciy-inputdaterange>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-inputdaterange disabled name="ciy3" value="2024-2-2~2024-8-13" @change="chglog('change', $event)"></ciy-inputdaterange>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue='2024-1-2 12:12~2024-5-3'">改变值</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">placeholder</view>
<view class="tip">
占位文字<br />
默认 请选择
</view>
<view class="hr"></view>
<view class="prp">btime</view>
<view class="tip">
是否选择时分时间<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">bordercolor</view>
<view class="tip">
选中日期边框和周列分隔线颜色<br />
默认 var(--bg6)
</view>
<view class="hr"></view>
<view class="prp">selecttextcolor</view>
<view class="tip">
选中日期选择年选择月的文字色<br />
默认 var(--man5)
</view>
<view class="hr"></view>
<view class="prp">selectbg</view>
<view class="tip">
选中日期背景色<br />
默认 var(--bg1)
</view>
<view class="hr"></view>
<view class="prp">weekmonday</view>
<view class="tip">
是否周一在第一列<br />
默认 false 周日在第一列
</view>
<view class="hr"></view>
<view class="prp">diastema</view>
<view class="tip">
弹出上下间隙弹出效果更好看<br />
默认 16, 单位px
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数值变更事件<br />
from: init,value
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: '',
}
},
onLoad() {
},
methods: {
qd(e) {
if (e.day == '')
return false;
return Math.random() > 0.7;
}
}
}
</script>

View File

@ -0,0 +1,188 @@
<template>
<ciy-header ref="header" title="ciy-inputdatetime组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">时间日期选择框</view>
<view class="content">
选择日期时间<br />
数据为1970年至今时间戳
</view>
</view>
<view v-for="n in 7" :key="n" class="zw"> 占位 {{n}}</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>设置日期</label>
<view>
<ciy-inputdatetime name="ciy1" v-model="formvalue" @change="chglog('change', $event)"></ciy-inputdatetime>
</view>
</view>
<view class="ciy-form">
<label>设置时间</label>
<view>
<ciy-inputdatetime hasmore clearbtn left btime name="ciy2" :value="formvalue" @change="chglog('change', $event)"></ciy-inputdatetime>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-inputdatetime disabled btime name="ciy2" value="356253434" @change="chglog('change', $event)"></ciy-inputdatetime>
</view>
</view>
<view class="ciy-form">
<label>选择月份</label>
<view>
<ciy-inputdatetime hasmore selectmonth name="ciy3" v-model="formvalue" @change="chglog('change', $event)"></ciy-inputdatetime>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue=1723456700">改变值</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">placeholder</view>
<view class="tip">
占位文字<br />
默认 请选择
</view>
<view class="hr"></view>
<view class="prp">btime</view>
<view class="tip">
是否选择时分时间<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">bordercolor</view>
<view class="tip">
选中日期边框和周列分隔线颜色<br />
默认 var(--bg6)
</view>
<view class="hr"></view>
<view class="prp">selecttextcolor</view>
<view class="tip">
选中日期选择年选择月的文字色<br />
默认 var(--man5)
</view>
<view class="hr"></view>
<view class="prp">selectbg</view>
<view class="tip">
选中日期背景色<br />
默认 var(--bg1)
</view>
<view class="hr"></view>
<view class="prp">selectmonth</view>
<view class="tip">
是否选择月份<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">weekmonday</view>
<view class="tip">
是否周一在第一列<br />
默认 false 周日在第一列
</view>
<view class="hr"></view>
<view class="prp">mindate,maxdate</view>
<view class="tip">
可选日期范围如果不设则不限制<br />
数据格式: 2020-12-121607702400
</view>
<view class="hr"></view>
<view class="prp">clearbtn</view>
<view class="tip">
是否显示不选日期按钮点击则清空日期<br />
默认 false 不显示
</view>
<view class="hr"></view>
<view class="prp">diastema</view>
<view class="tip">
弹出上下间隙弹出效果更好看<br />
默认 16, 单位px
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数值变更事件<br />
from: init,calendar,hour,minute,done
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: 0,
maxdate: 0
}
},
onLoad() {
this.maxdate = this.tostamp() + 86400 * 7;
},
methods: {
qd(e) {
if (e.day == '')
return false;
return Math.random() > 0.7;
}
}
}
</script>

View File

@ -0,0 +1,121 @@
<template>
<ciy-header title="ciy-inputnumber组件"></ciy-header>
<view class="ciy-card">
<view class="title">数量加减框</view>
<view class="content">
数量操作<br />
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-inputnumber name="ciy1" v-model="formvalue" @change="chglog('change', $event)"></ciy-inputnumber>
</view>
</view>
<view class="ciy-form">
<label>左侧</label>
<view>
<ciy-inputnumber left name="ciy2" :value="formvalue" @change="chglog('change', $event)"></ciy-inputnumber>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-inputnumber disabled name="ciy3" :value="formvalue" @change="chglog('change', $event)"></ciy-inputnumber>
</view>
</view>
<view class="ciy-form">
<label>限制范围</label>
<view>
<ciy-inputnumber min="3" max="8" name="ciy4" :value="formvalue" @change="chglog('change', $event)"></ciy-inputnumber>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue='2'">改值</button>
<button class="btn" @tap="formvalue=3">改值</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">width</view>
<view class="tip">
文本框宽度<br />
默认 2em
</view>
<view class="hr"></view>
<view class="prp">min,max</view>
<view class="tip">
限制范围<br />
默认 1,9999999
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数据变更事件<br />
from: init,input,confirm,op,watch
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: 2
}
},
onLoad() {},
methods: {}
}
</script>

View File

@ -0,0 +1,142 @@
<template>
<ciy-header ref="header" title="ciy-inputtimepoint组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">时间选择框</view>
<view class="content">
选择时间例如营业起止时间<br />
数据为0点之后的秒数<br/>
同时支持 时分秒 00:00:00 格式<br/>
1为00:0086400为23:59:590未选
</view>
</view>
<view v-for="n in 7" :key="n" class="zw"> 占位 {{n}}</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-inputtimepoint name="ciy1" v-model="formvalue" @change="chglog('change', $event)"></ciy-inputtimepoint>
</view>
</view>
<view class="ciy-form">
<label>时分</label>
<view>
<ciy-inputtimepoint hasmore eft name="ciy2" :value="formvalue" @change="chglog('change', $event)"></ciy-inputtimepoint>
</view>
</view>
<view class="ciy-form">
<label>时分秒</label>
<view>
<ciy-inputtimepoint hasmore bsec name="ciy3" :value="formvalue" @change="chglog('change', $event)"></ciy-inputtimepoint>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-inputtimepoint disabled name="ciy4" value="34234" @change="chglog('change', $event)"></ciy-inputtimepoint>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue=17700">改变值</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">bsec</view>
<view class="tip">
是否设置秒<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">diastema</view>
<view class="tip">
弹出上下间隙弹出效果更好看<br />
默认 16, 单位px
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数值变更事件<br />
from: init,calendar,hour,minute,done
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: 25234,
maxdate: 0
}
},
onLoad() {
this.maxdate = this.tostamp() + 86400 * 7;
},
methods: {
qd(e) {
if (e.day == '')
return false;
return Math.random() > 0.7;
}
}
}
</script>

View File

@ -0,0 +1,113 @@
<template>
<ciy-header title="ciy-inputunitedit组件"></ciy-header>
<view class="ciy-card">
<view class="title">三级单位编辑</view>
<view class="content">
支持1/2/3级单位单位间递进整数换算关系<br />
文本存储格式为AA|1|BA|1|B|2|C<br />
相关数据使用最小单位为准显示时将转成合适的单位
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-inputunitedit name="ciy1" v-model="formvalue" @change="chglog('change', $event)"></ciy-inputunitedit>
</view>
</view>
<view class="ciy-form">
<label>左侧</label>
<view>
<ciy-inputunitedit left hasmore name="ciy2" :value="formvalue" @change="chglog('change', $event)"></ciy-inputunitedit>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-inputunitedit disabled name="ciy3" :value="formvalue" @change="chglog('change', $event)"></ciy-inputunitedit>
</view>
</view>
<view>{{tounit(formvalue)}}</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue='瓶|10|盒'">改值</button>
<button class="btn" @tap="formvalue='个|12|捆|24|箱'">改值</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据<br />
unit1,unit2,unit3,num12,num23<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数据变更事件<br />
from: init,input
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: ''
}
},
onLoad() {},
methods: {}
}
</script>

View File

@ -0,0 +1,171 @@
<template>
<ciy-header ref="header" title="ciy-radio组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">单选框</view>
<view class="content">
相比传统checkbox-group组件可与字典联动<br />
选项数据格式[{id,name}]数组<br />
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>原始组件</label>
<view>
<radio-group name="ori">
<label>
<radio value="r1"></radio>选项1
</label>
<label>
<radio value="r2"></radio>选项2
</label>
<label>
<radio value="r3"></radio>选项3
</label>
</radio-group>
</view>
</view>
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-radio v-model="formvalue" name="ciy1" :range="rang" @change="chglog('change', $event)"></ciy-radio>
</view>
</view>
<view class="ciy-form">
<label>整行排列</label>
<view>
<ciy-radio line itemright hasmore :value="formvalue" name="ciy2" :range="rang" @change="chglog('change', $event)"></ciy-radio>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-radio left disabled :value="formvalue" name="ciy3" :range="rang" @change="chglog('change', $event)"></ciy-radio>
</view>
</view>
<view class="ciy-form">
<label class="imp">每行一条</label>
<view>
<ciy-radio line :value="formvalue" name="ciy4" :range="rang" @change="chglog('change', $event)"></ciy-radio>
</view>
</view>
<view class="ciy-form">
<label>简易range</label>
<view>
<ciy-radio :value="formvalue" name="ciy5" range="10:待处理,20:已处理" @change="chglog('change', $event)"></ciy-radio>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue='3'">改变值</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">range</view>
<view class="tip">
选项数组object需包含id,name,upid<br />
简易字符串id1.name1,id2.name2,...<br />
</view>
<view class="hr"></view>
<view class="prp">itemright</view>
<view class="tip">
是否选项方块在右侧<br />
默认 false 在左侧
</view>
<view class="hr"></view>
<view class="prp">line</view>
<view class="tip">
是否每一个选项单独一行<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">byname (即将废弃)</view>
<view class="tip">
以name匹配选项<br />
默认 false 以id匹配
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数值变更事件<br />
from: init,check
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: '',
rang: [{
id: 1,
name: '选项1'
}, {
id: 2,
name: '选项2'
}, {
id: 3,
name: '选项3'
}],
}
},
onLoad() {},
methods: {}
}
</script>
<style>
</style>

View File

@ -0,0 +1,140 @@
<template>
<ciy-header ref="header" title="ciy-ratestar组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">评价星级选择</view>
<view class="content">
选择星级返回数字<br/>
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-ratestar name="ciy1" v-model="formvalue" @change="chglog('change', $event)"></ciy-ratestar>
</view>
</view>
<view class="ciy-form">
<label>value绑定</label>
<view>
<ciy-ratestar :value="formvalue" name="ciy2" @change="chglog('change', $event)"></ciy-ratestar>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-ratestar disabled :value="formvalue" name="ciy3" @change="chglog('change', $event)"></ciy-ratestar>
</view>
</view>
<view class="ciy-form">
<label>左侧</label>
<view>
<ciy-ratestar left :value="formvalue" name="ciy4" @change="chglog('change', $event)"></ciy-ratestar>
</view>
</view>
<view class="ciy-form">
<label>七星</label>
<view>
<ciy-ratestar maxstar="7" :value="formvalue" name="ciy5" @change="chglog('change', $event)"></ciy-ratestar>
</view>
</view>
<view class="ciy-form">
<label>大星</label>
<view>
<ciy-ratestar size="4em" maxstar="3" :value="formvalue" name="ciy6" @change="chglog('change', $event)"></ciy-ratestar>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue=2">改变值</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="slt">list自定义选项</view>
<view class="hr"></view>
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">initevent</view>
<view class="tip">
是否产生初始事件<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">maxstar</view>
<view class="tip">
最大星数<br />
默认 5
</view>
<view class="hr"></view>
<view class="prp">size</view>
<view class="tip">
星尺寸<br />
默认 2em
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数值变更事件<br />
from: init,click<br/>
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: ''
}
},
onLoad() {
},
methods: {
}
}
</script>

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