正在显示
22 个修改的文件
包含
4857 行增加
和
0 行删除
App.vue
0 → 100644
1 | +<!-- | ||
2 | + * @Descripttion: | ||
3 | + * @version: 0.0.0 | ||
4 | + * @Author: genglw | ||
5 | + * @Date: 2022-01-29 16:40:40 | ||
6 | + * @LastEditors: genglw | ||
7 | + * @LastEditTime: 2022-02-18 14:06:28 | ||
8 | +--> | ||
9 | +<template> | ||
10 | + <view> | ||
11 | + </view> | ||
12 | +</template> | ||
13 | + | ||
14 | +<script> | ||
15 | + export default { | ||
16 | + // 此处globalData为了演示其作用,不是uView框架的一部分 | ||
17 | + globalData: { | ||
18 | + username: '' | ||
19 | + }, | ||
20 | + | ||
21 | + onLaunch() { | ||
22 | + | ||
23 | + }, | ||
24 | + | ||
25 | + onShow() { | ||
26 | + console.log("App onshow") | ||
27 | + }, | ||
28 | + | ||
29 | + methods: { | ||
30 | + | ||
31 | + }, | ||
32 | + | ||
33 | + } | ||
34 | +</script> | ||
35 | + | ||
36 | +<style lang="scss"> | ||
37 | + /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */ | ||
38 | + @import "@/uni_modules/uview-ui/index.scss"; | ||
39 | + @import '@/static/common/css/icon.css'; | ||
40 | +</style> |
LICENSE
0 → 100644
1 | +MIT License | ||
2 | + | ||
3 | +Copyright (c) 2020 www.uviewui.com | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | +of this software and associated documentation files (the "Software"), to deal | ||
7 | +in the Software without restriction, including without limitation the rights | ||
8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | +copies of the Software, and to permit persons to whom the Software is | ||
10 | +furnished to do so, subject to the following conditions: | ||
11 | + | ||
12 | +The above copyright notice and this permission notice shall be included in all | ||
13 | +copies or substantial portions of the Software. | ||
14 | + | ||
15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
21 | +SOFTWARE. |
README.md
0 → 100644
1 | +<p align="center"> | ||
2 | + <img alt="logo" src="https://uviewui.com/common/logo.png" width="120" height="120" style="margin-bottom: 10px;"> | ||
3 | +</p> | ||
4 | +<h3 align="center" style="margin: 30px 0 30px;font-weight: bold;font-size:40px;">uView</h3> | ||
5 | +<h3 align="center">多平台快速开发的UI框架</h3> | ||
6 | + | ||
7 | +[![star](https://gitee.com/xuqu/uView/badge/star.svg?theme=gvp)](https://gitee.com/xuqu/uView/stargazers) | ||
8 | +[![fork](https://gitee.com/xuqu/uView/badge/fork.svg?theme=gvp)](https://gitee.com/xuqu/uView/members) | ||
9 | +[![stars](https://img.shields.io/github/stars/YanxinNet/uView?style=flat-square&logo=GitHub)](https://github.com/YanxinNet/uView) | ||
10 | +[![forks](https://img.shields.io/github/forks/YanxinNet/uView?style=flat-square&logo=GitHub)](https://github.com/YanxinNet/uView) | ||
11 | +[![issues](https://img.shields.io/github/issues/YanxinNet/uView?style=flat-square&logo=GitHub)](https://github.com/YanxinNet/uView/issues) | ||
12 | +[![Website](https://img.shields.io/badge/uView-up-blue?style=flat-square)](https://uviewui.com) | ||
13 | +[![release](https://img.shields.io/github/v/release/YanxinNet/uView?style=flat-square)](https://gitee.com/xuqu/uView/releases) | ||
14 | +[![license](https://img.shields.io/github/license/YanxinNet/uView?style=flat-square)](https://en.wikipedia.org/wiki/MIT_License) | ||
15 | + | ||
16 | +## 说明 | ||
17 | + | ||
18 | +uView UI,是[uni-app](https://uniapp.dcloud.io/)生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水 | ||
19 | + | ||
20 | +## [官方文档:https://www.uviewui.com](https://www.uviewui.com) | ||
21 | + | ||
22 | +### [点击加群交流反馈:863820668](https://jq.qq.com/?_wv=1027&k=uyZUkSlo) | ||
23 | + | ||
24 | +## 特性 | ||
25 | + | ||
26 | +- 兼容安卓,iOS,微信小程序,H5,QQ小程序,百度小程序,支付宝小程序,头条小程序 | ||
27 | +- 60+精选组件,功能丰富,多端兼容,让您快速集成,开箱即用 | ||
28 | +- 众多贴心的JS利器,让您飞镖在手,召之即来,百步穿杨 | ||
29 | +- 众多的常用页面和布局,让您专注逻辑,事半功倍 | ||
30 | +- 详尽的文档支持,现代化的演示效果 | ||
31 | +- 按需引入,精简打包体积 | ||
32 | + | ||
33 | + | ||
34 | +## 预览 | ||
35 | + | ||
36 | +您可以通过**微信**扫码,查看最佳的演示效果。 | ||
37 | +<br> | ||
38 | +<br> | ||
39 | +<img src="https://uviewui.com/common/weixin_mini_qrcode.png" width="220" height="220" > | ||
40 | + | ||
41 | + | ||
42 | +## 友情链接 | ||
43 | + | ||
44 | +#### **vue-admin-beautiful** —— [企业级、通用型中后台前端解决方案(基于vue/cli 4 最新版,同时支持电脑,手机,平板)](https://github.com/chuzhixin/vue-admin-beautiful) | ||
45 | + | ||
46 | +#### **vue-admin-beautiful** —— [在线演示](http://beautiful.panm.cn/vue-admin-beautiful/#/index) | ||
47 | + | ||
48 | +#### **pl-table** —— [ 完美解决 element 万级表格数据渲染卡顿问题](https://github.com/livelyPeng/pl-table) | ||
49 | + | ||
50 | +#### **luch-request** —— [基于 Promise 开发的 uni-app 跨平台、项目级别的请求库,它有更小的体积,易用的 api,方便简单的自定义能力](https://www.quanzhan.co/luch-request/) | ||
51 | +<br> | ||
52 | + | ||
53 | +## 链接 | ||
54 | + | ||
55 | +- [官方文档](https://uviewui.com/) | ||
56 | +- [更新日志](https://uviewui.com/components/changelog.html) | ||
57 | +- [升级指南](https://uviewui.com/components/changelog.html) | ||
58 | +- [关于我们](https://uviewui.com/cooperation/about.html) | ||
59 | + | ||
60 | +## 交流反馈 | ||
61 | + | ||
62 | +欢迎加入我们的QQ群交流反馈:[点此跳转](https://www.uviewui.com/components/addQQGroup.html) | ||
63 | + | ||
64 | +## 安装 | ||
65 | + | ||
66 | +#### **下载地址** —— [https://ext.dcloud.net.cn/plugin?id=1593](https://ext.dcloud.net.cn/plugin?id=1593) | ||
67 | + | ||
68 | +## 快速上手 | ||
69 | + | ||
70 | +1. `main.js`引入uView库 | ||
71 | +```js | ||
72 | +// main.js | ||
73 | +import uView from 'uview-ui'; | ||
74 | +Vue.use(uView); | ||
75 | +``` | ||
76 | + | ||
77 | +2. `App.vue`引入基础样式(注意style标签需声明scss属性支持) | ||
78 | +```css | ||
79 | +/* App.vue */ | ||
80 | +<style lang="scss"> | ||
81 | +/* 注意声明lang="scss"! */ | ||
82 | +@import "uview-ui/index.scss"; | ||
83 | +</style> | ||
84 | +``` | ||
85 | + | ||
86 | +3. `uni.scss`引入全局scss变量文件 | ||
87 | +```css | ||
88 | +/* uni.scss */ | ||
89 | +@import "uview-ui/theme.scss"; | ||
90 | +``` | ||
91 | + | ||
92 | +4. `pages.json`配置easycom规则(按需引入) | ||
93 | + | ||
94 | +```js | ||
95 | +// pages.json | ||
96 | +{ | ||
97 | + "easycom": { | ||
98 | + // 下载安装的方式需要前面的"@/",npm安装的方式无需"@/" | ||
99 | + // 下载安装方式 | ||
100 | + "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" | ||
101 | + // npm安装方式 | ||
102 | + // "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" | ||
103 | + }, | ||
104 | + // 此为本身已有的内容 | ||
105 | + "pages": [ | ||
106 | + // ...... | ||
107 | + ] | ||
108 | +} | ||
109 | +``` | ||
110 | + | ||
111 | +请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 | ||
112 | + | ||
113 | +## 使用方法 | ||
114 | +配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。 | ||
115 | + | ||
116 | +```html | ||
117 | +<template> | ||
118 | + <u-button>按钮</u-button> | ||
119 | +</template> | ||
120 | +``` | ||
121 | + | ||
122 | +请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 | ||
123 | + | ||
124 | + | ||
125 | +## 捐赠uView的研发 | ||
126 | + | ||
127 | +uView文档和源码全部开源免费,如果您认为uView帮到了您的开发工作,您可以捐赠uView的研发工作,捐赠无门槛,哪怕是一杯可乐也好(相信这比打赏主播更有意义)。 | ||
128 | + | ||
129 | +<img src="https://uviewui.com/common/wechat.png" width="220" > | ||
130 | +<img style="margin-left: 100px;" src="https://uviewui.com/common/alipay.png" width="220" > | ||
131 | + | ||
132 | +## 版权信息 | ||
133 | +uView遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uView应用到您的产品中。 |
common/area.js
0 → 100644
此 diff 太大无法显示。
common/city.js
0 → 100644
1 | +const citys = [{ | ||
2 | + "idx": "A", | ||
3 | + "cities": [{ | ||
4 | + "city": "阿坝藏族羌族自治州", | ||
5 | + "city_code": 513200 | ||
6 | + }, { | ||
7 | + "city": "阿克苏地区", | ||
8 | + "city_code": 652900 | ||
9 | + }, { | ||
10 | + "city": "阿拉善盟", | ||
11 | + "city_code": 152900 | ||
12 | + }, { | ||
13 | + "city": "阿勒泰地区", | ||
14 | + "city_code": 654300 | ||
15 | + }, { | ||
16 | + "city": "阿里地区", | ||
17 | + "city_code": 542500 | ||
18 | + }, { | ||
19 | + "city": "安康", | ||
20 | + "city_code": 610900 | ||
21 | + }, { | ||
22 | + "city": "安庆", | ||
23 | + "city_code": 340800 | ||
24 | + }, { | ||
25 | + "city": "鞍山", | ||
26 | + "city_code": 210300 | ||
27 | + }, { | ||
28 | + "city": "安顺", | ||
29 | + "city_code": 520400 | ||
30 | + }, { | ||
31 | + "city": "安阳", | ||
32 | + "city_code": 410500 | ||
33 | + }] | ||
34 | +}, { | ||
35 | + "idx": "B", | ||
36 | + "cities": [{ | ||
37 | + "city": "白城", | ||
38 | + "city_code": 220800 | ||
39 | + }, { | ||
40 | + "city": "百色", | ||
41 | + "city_code": 451000 | ||
42 | + }, { | ||
43 | + "city": "白山", | ||
44 | + "city_code": 220600 | ||
45 | + }, { | ||
46 | + "city": "白银", | ||
47 | + "city_code": 620400 | ||
48 | + }, { | ||
49 | + "city": "保定", | ||
50 | + "city_code": 130600 | ||
51 | + }, { | ||
52 | + "city": "宝鸡", | ||
53 | + "city_code": 610300 | ||
54 | + }, { | ||
55 | + "city": "保山", | ||
56 | + "city_code": 530500 | ||
57 | + }, { | ||
58 | + "city": "包头", | ||
59 | + "city_code": 150200 | ||
60 | + }, { | ||
61 | + "city": "巴彦淖尔", | ||
62 | + "city_code": 150800 | ||
63 | + }, { | ||
64 | + "city": "巴音郭楞蒙古自治州", | ||
65 | + "city_code": 652800 | ||
66 | + }, { | ||
67 | + "city": "巴中", | ||
68 | + "city_code": 511900 | ||
69 | + }, { | ||
70 | + "city": "北海", | ||
71 | + "city_code": 450500 | ||
72 | + }, { | ||
73 | + "city": "北京", | ||
74 | + "city_code": 110100 | ||
75 | + }, { | ||
76 | + "city": "蚌埠", | ||
77 | + "city_code": 340300 | ||
78 | + }, { | ||
79 | + "city": "本溪", | ||
80 | + "city_code": 210500 | ||
81 | + }, { | ||
82 | + "city": "毕节", | ||
83 | + "city_code": 520500 | ||
84 | + }, { | ||
85 | + "city": "滨州", | ||
86 | + "city_code": 371600 | ||
87 | + }, { | ||
88 | + "city": "博尔塔拉蒙古自治州", | ||
89 | + "city_code": 652700 | ||
90 | + }, { | ||
91 | + "city": "亳州", | ||
92 | + "city_code": 341600 | ||
93 | + }] | ||
94 | +}, { | ||
95 | + "idx": "C", | ||
96 | + "cities": [{ | ||
97 | + "city": "沧州", | ||
98 | + "city_code": 130900 | ||
99 | + }, { | ||
100 | + "city": "长城区", | ||
101 | + "city_code": 6202000 | ||
102 | + }, { | ||
103 | + "city": "长春", | ||
104 | + "city_code": 220100 | ||
105 | + }, { | ||
106 | + "city": "常德", | ||
107 | + "city_code": 430700 | ||
108 | + }, { | ||
109 | + "city": "昌都", | ||
110 | + "city_code": 542100 | ||
111 | + }, { | ||
112 | + "city": "昌吉回族自治州", | ||
113 | + "city_code": 652300 | ||
114 | + }, { | ||
115 | + "city": "长沙", | ||
116 | + "city_code": 430100 | ||
117 | + }, { | ||
118 | + "city": "长治市", | ||
119 | + "city_code": 140400 | ||
120 | + }, { | ||
121 | + "city": "常州", | ||
122 | + "city_code": 320400 | ||
123 | + }, { | ||
124 | + "city": "朝阳", | ||
125 | + "city_code": 211300 | ||
126 | + }, { | ||
127 | + "city": "潮州", | ||
128 | + "city_code": 445100 | ||
129 | + }, { | ||
130 | + "city": "承德", | ||
131 | + "city_code": 130800 | ||
132 | + }, { | ||
133 | + "city": "成都", | ||
134 | + "city_code": 510100 | ||
135 | + }, { | ||
136 | + "city": "郴州", | ||
137 | + "city_code": 431000 | ||
138 | + }, { | ||
139 | + "city": "赤峰", | ||
140 | + "city_code": 150400 | ||
141 | + }, { | ||
142 | + "city": "池州", | ||
143 | + "city_code": 341700 | ||
144 | + }, { | ||
145 | + "city": "重庆", | ||
146 | + "city_code": 500100 | ||
147 | + }, { | ||
148 | + "city": "崇左", | ||
149 | + "city_code": 451400 | ||
150 | + }, { | ||
151 | + "city": "楚雄彝族自治州", | ||
152 | + "city_code": 532300 | ||
153 | + }, { | ||
154 | + "city": "滁州", | ||
155 | + "city_code": 341100 | ||
156 | + }] | ||
157 | +}, { | ||
158 | + "idx": "D", | ||
159 | + "cities": [{ | ||
160 | + "city": "大连", | ||
161 | + "city_code": 210200 | ||
162 | + }, { | ||
163 | + "city": "大理白族自治州", | ||
164 | + "city_code": 532900 | ||
165 | + }, { | ||
166 | + "city": "丹东", | ||
167 | + "city_code": 210600 | ||
168 | + }, { | ||
169 | + "city": "大庆", | ||
170 | + "city_code": 230600 | ||
171 | + }, { | ||
172 | + "city": "大同", | ||
173 | + "city_code": 140200 | ||
174 | + }, { | ||
175 | + "city": "大兴安岭地区", | ||
176 | + "city_code": 232700 | ||
177 | + }, { | ||
178 | + "city": "达州", | ||
179 | + "city_code": 511700 | ||
180 | + }, { | ||
181 | + "city": "德宏傣族景颇族自治州", | ||
182 | + "city_code": 533100 | ||
183 | + }, { | ||
184 | + "city": "德阳", | ||
185 | + "city_code": 510600 | ||
186 | + }, { | ||
187 | + "city": "德州", | ||
188 | + "city_code": 371400 | ||
189 | + }, { | ||
190 | + "city": "定西", | ||
191 | + "city_code": 621100 | ||
192 | + }, { | ||
193 | + "city": "迪庆藏族自治州", | ||
194 | + "city_code": 533400 | ||
195 | + }, { | ||
196 | + "city": "东莞", | ||
197 | + "city_code": 441900 | ||
198 | + }, { | ||
199 | + "city": "东营", | ||
200 | + "city_code": 370500 | ||
201 | + }] | ||
202 | +}, { | ||
203 | + "idx": "E", | ||
204 | + "cities": [{ | ||
205 | + "city": "鄂尔多斯", | ||
206 | + "city_code": 150600 | ||
207 | + }, { | ||
208 | + "city": "恩施土家族苗族自治州", | ||
209 | + "city_code": 422800 | ||
210 | + }, { | ||
211 | + "city": "鄂州", | ||
212 | + "city_code": 420700 | ||
213 | + }] | ||
214 | +}, { | ||
215 | + "idx": "F", | ||
216 | + "cities": [{ | ||
217 | + "city": "防城港", | ||
218 | + "city_code": 450600 | ||
219 | + }, { | ||
220 | + "city": "佛山", | ||
221 | + "city_code": 440600 | ||
222 | + }, { | ||
223 | + "city": "抚顺", | ||
224 | + "city_code": 210400 | ||
225 | + }, { | ||
226 | + "city": "阜新", | ||
227 | + "city_code": 210900 | ||
228 | + }, { | ||
229 | + "city": "阜阳", | ||
230 | + "city_code": 341200 | ||
231 | + }, { | ||
232 | + "city": "福州", | ||
233 | + "city_code": 350100 | ||
234 | + }, { | ||
235 | + "city": "抚州", | ||
236 | + "city_code": 361000 | ||
237 | + }] | ||
238 | +}, { | ||
239 | + "idx": "G", | ||
240 | + "cities": [{ | ||
241 | + "city": "甘南藏族自治州", | ||
242 | + "city_code": 623000 | ||
243 | + }, { | ||
244 | + "city": "赣州", | ||
245 | + "city_code": 360700 | ||
246 | + }, { | ||
247 | + "city": "甘孜藏族自治州", | ||
248 | + "city_code": 513300 | ||
249 | + }, { | ||
250 | + "city": "广安", | ||
251 | + "city_code": 511600 | ||
252 | + }, { | ||
253 | + "city": "广元", | ||
254 | + "city_code": 510800 | ||
255 | + }, { | ||
256 | + "city": "广州", | ||
257 | + "city_code": 440100 | ||
258 | + }, { | ||
259 | + "city": "贵港", | ||
260 | + "city_code": 450800 | ||
261 | + }, { | ||
262 | + "city": "桂林", | ||
263 | + "city_code": 450300 | ||
264 | + }, { | ||
265 | + "city": "贵阳", | ||
266 | + "city_code": 520100 | ||
267 | + }, { | ||
268 | + "city": "果洛藏族自治州", | ||
269 | + "city_code": 632600 | ||
270 | + }, { | ||
271 | + "city": "固原", | ||
272 | + "city_code": 640400 | ||
273 | + }] | ||
274 | +}, { | ||
275 | + "idx": "H", | ||
276 | + "cities": [{ | ||
277 | + "city": "哈尔滨", | ||
278 | + "city_code": 230100 | ||
279 | + }, { | ||
280 | + "city": "海北藏族自治州", | ||
281 | + "city_code": 632200 | ||
282 | + }, { | ||
283 | + "city": "海东", | ||
284 | + "city_code": 630200 | ||
285 | + }, { | ||
286 | + "city": "海口", | ||
287 | + "city_code": 460100 | ||
288 | + }, { | ||
289 | + "city": "海南藏族自治州", | ||
290 | + "city_code": 632500 | ||
291 | + }, { | ||
292 | + "city": "海西蒙古族藏族自治州", | ||
293 | + "city_code": 632800 | ||
294 | + }, { | ||
295 | + "city": "哈密地区", | ||
296 | + "city_code": 652200 | ||
297 | + }, { | ||
298 | + "city": "邯郸", | ||
299 | + "city_code": 130400 | ||
300 | + }, { | ||
301 | + "city": "杭州", | ||
302 | + "city_code": 330100 | ||
303 | + }, { | ||
304 | + "city": "汉中", | ||
305 | + "city_code": 610700 | ||
306 | + }, { | ||
307 | + "city": "鹤壁", | ||
308 | + "city_code": 410600 | ||
309 | + }, { | ||
310 | + "city": "河池", | ||
311 | + "city_code": 451200 | ||
312 | + }, { | ||
313 | + "city": "合肥", | ||
314 | + "city_code": 340100 | ||
315 | + }, { | ||
316 | + "city": "鹤岗", | ||
317 | + "city_code": 230400 | ||
318 | + }, { | ||
319 | + "city": "黑河", | ||
320 | + "city_code": 231100 | ||
321 | + }, { | ||
322 | + "city": "衡水", | ||
323 | + "city_code": 131100 | ||
324 | + }, { | ||
325 | + "city": "衡阳", | ||
326 | + "city_code": 430400 | ||
327 | + }, { | ||
328 | + "city": "和田地区", | ||
329 | + "city_code": 653200 | ||
330 | + }, { | ||
331 | + "city": "河源", | ||
332 | + "city_code": 441600 | ||
333 | + }, { | ||
334 | + "city": "菏泽", | ||
335 | + "city_code": 371700 | ||
336 | + }, { | ||
337 | + "city": "贺州", | ||
338 | + "city_code": 451100 | ||
339 | + }, { | ||
340 | + "city": "红河州", | ||
341 | + "city_code": 532500 | ||
342 | + }, { | ||
343 | + "city": "淮安", | ||
344 | + "city_code": 320800 | ||
345 | + }, { | ||
346 | + "city": "淮北", | ||
347 | + "city_code": 340600 | ||
348 | + }, { | ||
349 | + "city": "怀化", | ||
350 | + "city_code": 431200 | ||
351 | + }, { | ||
352 | + "city": "淮南", | ||
353 | + "city_code": 340400 | ||
354 | + }, { | ||
355 | + "city": "黄冈", | ||
356 | + "city_code": 421100 | ||
357 | + }, { | ||
358 | + "city": "黄南藏族自治州", | ||
359 | + "city_code": 632300 | ||
360 | + }, { | ||
361 | + "city": "黄山", | ||
362 | + "city_code": 341000 | ||
363 | + }, { | ||
364 | + "city": "黄石", | ||
365 | + "city_code": 420200 | ||
366 | + }, { | ||
367 | + "city": "呼和浩特", | ||
368 | + "city_code": 150100 | ||
369 | + }, { | ||
370 | + "city": "惠州", | ||
371 | + "city_code": 441300 | ||
372 | + }, { | ||
373 | + "city": "葫芦岛", | ||
374 | + "city_code": 211400 | ||
375 | + }, { | ||
376 | + "city": "呼伦贝尔", | ||
377 | + "city_code": 150700 | ||
378 | + }, { | ||
379 | + "city": "湖州", | ||
380 | + "city_code": 330500 | ||
381 | + }] | ||
382 | +}, { | ||
383 | + "idx": "J", | ||
384 | + "cities": [{ | ||
385 | + "city": "佳木斯", | ||
386 | + "city_code": 230800 | ||
387 | + }, { | ||
388 | + "city": "吉安", | ||
389 | + "city_code": 360800 | ||
390 | + }, { | ||
391 | + "city": "江门", | ||
392 | + "city_code": 440700 | ||
393 | + }, { | ||
394 | + "city": "焦作", | ||
395 | + "city_code": 410800 | ||
396 | + }, { | ||
397 | + "city": "嘉兴", | ||
398 | + "city_code": 330400 | ||
399 | + }, { | ||
400 | + "city": "嘉峪关", | ||
401 | + "city_code": 620200 | ||
402 | + }, { | ||
403 | + "city": "揭阳", | ||
404 | + "city_code": 445200 | ||
405 | + }, { | ||
406 | + "city": "吉林", | ||
407 | + "city_code": 220200 | ||
408 | + }, { | ||
409 | + "city": "济南", | ||
410 | + "city_code": 370100 | ||
411 | + }, { | ||
412 | + "city": "金昌", | ||
413 | + "city_code": 620300 | ||
414 | + }, { | ||
415 | + "city": "晋城", | ||
416 | + "city_code": 140500 | ||
417 | + }, { | ||
418 | + "city": "景德镇", | ||
419 | + "city_code": 360200 | ||
420 | + }, { | ||
421 | + "city": "荆门", | ||
422 | + "city_code": 420800 | ||
423 | + }, { | ||
424 | + "city": "荆州", | ||
425 | + "city_code": 421000 | ||
426 | + }, { | ||
427 | + "city": "金华", | ||
428 | + "city_code": 330700 | ||
429 | + }, { | ||
430 | + "city": "济宁", | ||
431 | + "city_code": 370800 | ||
432 | + }, { | ||
433 | + "city": "晋中", | ||
434 | + "city_code": 140700 | ||
435 | + }, { | ||
436 | + "city": "锦州", | ||
437 | + "city_code": 210700 | ||
438 | + }, { | ||
439 | + "city": "九江", | ||
440 | + "city_code": 360400 | ||
441 | + }, { | ||
442 | + "city": "酒泉", | ||
443 | + "city_code": 620900 | ||
444 | + }, { | ||
445 | + "city": "鸡西", | ||
446 | + "city_code": 230300 | ||
447 | + }] | ||
448 | +}, { | ||
449 | + "idx": "K", | ||
450 | + "cities": [{ | ||
451 | + "city": "开封", | ||
452 | + "city_code": 410200 | ||
453 | + }, { | ||
454 | + "city": "喀什地区", | ||
455 | + "city_code": 653100 | ||
456 | + }, { | ||
457 | + "city": "克拉玛依", | ||
458 | + "city_code": 650200 | ||
459 | + }, { | ||
460 | + "city": "克孜勒苏柯尔克孜自治州", | ||
461 | + "city_code": 653000 | ||
462 | + }, { | ||
463 | + "city": "昆明", | ||
464 | + "city_code": 530100 | ||
465 | + }] | ||
466 | +}, { | ||
467 | + "idx": "L", | ||
468 | + "cities": [{ | ||
469 | + "city": "来宾", | ||
470 | + "city_code": 451300 | ||
471 | + }, { | ||
472 | + "city": "莱芜", | ||
473 | + "city_code": 371200 | ||
474 | + }, { | ||
475 | + "city": "廊坊", | ||
476 | + "city_code": 131000 | ||
477 | + }, { | ||
478 | + "city": "兰州", | ||
479 | + "city_code": 620100 | ||
480 | + }, { | ||
481 | + "city": "拉萨", | ||
482 | + "city_code": 540100 | ||
483 | + }, { | ||
484 | + "city": "乐山", | ||
485 | + "city_code": 511100 | ||
486 | + }, { | ||
487 | + "city": "凉山彝族自治州", | ||
488 | + "city_code": 513400 | ||
489 | + }, { | ||
490 | + "city": "连云港", | ||
491 | + "city_code": 320700 | ||
492 | + }, { | ||
493 | + "city": "聊城", | ||
494 | + "city_code": 371500 | ||
495 | + }, { | ||
496 | + "city": "辽阳", | ||
497 | + "city_code": 211000 | ||
498 | + }, { | ||
499 | + "city": "辽源", | ||
500 | + "city_code": 220400 | ||
501 | + }, { | ||
502 | + "city": "丽江", | ||
503 | + "city_code": 530700 | ||
504 | + }, { | ||
505 | + "city": "临沧", | ||
506 | + "city_code": 530900 | ||
507 | + }, { | ||
508 | + "city": "临汾", | ||
509 | + "city_code": 141000 | ||
510 | + }, { | ||
511 | + "city": "临夏回族自治州", | ||
512 | + "city_code": 622900 | ||
513 | + }, { | ||
514 | + "city": "临沂", | ||
515 | + "city_code": 371300 | ||
516 | + }, { | ||
517 | + "city": "林芝", | ||
518 | + "city_code": 542600 | ||
519 | + }, { | ||
520 | + "city": "丽水", | ||
521 | + "city_code": 331100 | ||
522 | + }, { | ||
523 | + "city": "六盘水", | ||
524 | + "city_code": 520200 | ||
525 | + }, { | ||
526 | + "city": "柳州", | ||
527 | + "city_code": 450200 | ||
528 | + }, { | ||
529 | + "city": "陇南", | ||
530 | + "city_code": 621200 | ||
531 | + }, { | ||
532 | + "city": "龙岩", | ||
533 | + "city_code": 350800 | ||
534 | + }, { | ||
535 | + "city": "娄底", | ||
536 | + "city_code": 431300 | ||
537 | + }, { | ||
538 | + "city": "六安", | ||
539 | + "city_code": 341500 | ||
540 | + }, { | ||
541 | + "city": "漯河", | ||
542 | + "city_code": 411100 | ||
543 | + }, { | ||
544 | + "city": "洛阳", | ||
545 | + "city_code": 410300 | ||
546 | + }, { | ||
547 | + "city": "泸州", | ||
548 | + "city_code": 510500 | ||
549 | + }, { | ||
550 | + "city": "吕梁", | ||
551 | + "city_code": 141100 | ||
552 | + }] | ||
553 | +}, { | ||
554 | + "idx": "M", | ||
555 | + "cities": [{ | ||
556 | + "city": "马鞍山", | ||
557 | + "city_code": 340500 | ||
558 | + }, { | ||
559 | + "city": "茂名", | ||
560 | + "city_code": 440900 | ||
561 | + }, { | ||
562 | + "city": "眉山", | ||
563 | + "city_code": 511400 | ||
564 | + }, { | ||
565 | + "city": "梅州", | ||
566 | + "city_code": 441400 | ||
567 | + }, { | ||
568 | + "city": "绵阳", | ||
569 | + "city_code": 510700 | ||
570 | + }, { | ||
571 | + "city": "牡丹江", | ||
572 | + "city_code": 231000 | ||
573 | + }] | ||
574 | +}, { | ||
575 | + "idx": "N", | ||
576 | + "cities": [{ | ||
577 | + "city": "南昌", | ||
578 | + "city_code": 360100 | ||
579 | + }, { | ||
580 | + "city": "南充", | ||
581 | + "city_code": 511300 | ||
582 | + }, { | ||
583 | + "city": "南京", | ||
584 | + "city_code": 320100 | ||
585 | + }, { | ||
586 | + "city": "南宁", | ||
587 | + "city_code": 450100 | ||
588 | + }, { | ||
589 | + "city": "南平", | ||
590 | + "city_code": 350700 | ||
591 | + }, { | ||
592 | + "city": "南通", | ||
593 | + "city_code": 320600 | ||
594 | + }, { | ||
595 | + "city": "南阳", | ||
596 | + "city_code": 411300 | ||
597 | + }, { | ||
598 | + "city": "那曲地区", | ||
599 | + "city_code": 542400 | ||
600 | + }, { | ||
601 | + "city": "内江", | ||
602 | + "city_code": 511000 | ||
603 | + }, { | ||
604 | + "city": "宁波", | ||
605 | + "city_code": 330200 | ||
606 | + }, { | ||
607 | + "city": "宁德", | ||
608 | + "city_code": 350900 | ||
609 | + }, { | ||
610 | + "city": "怒江傈僳族自治州", | ||
611 | + "city_code": 533300 | ||
612 | + }] | ||
613 | +}, { | ||
614 | + "idx": "P", | ||
615 | + "cities": [{ | ||
616 | + "city": "盘锦", | ||
617 | + "city_code": 211100 | ||
618 | + }, { | ||
619 | + "city": "攀枝花", | ||
620 | + "city_code": 510400 | ||
621 | + }, { | ||
622 | + "city": "平顶山", | ||
623 | + "city_code": 410400 | ||
624 | + }, { | ||
625 | + "city": "平凉", | ||
626 | + "city_code": 620800 | ||
627 | + }, { | ||
628 | + "city": "萍乡", | ||
629 | + "city_code": 360300 | ||
630 | + }, { | ||
631 | + "city": "普洱", | ||
632 | + "city_code": 530800 | ||
633 | + }, { | ||
634 | + "city": "莆田", | ||
635 | + "city_code": 350300 | ||
636 | + }, { | ||
637 | + "city": "濮阳", | ||
638 | + "city_code": 410900 | ||
639 | + }] | ||
640 | +}, { | ||
641 | + "idx": "Q", | ||
642 | + "cities": [{ | ||
643 | + "city": "黔东南苗族侗族自治州", | ||
644 | + "city_code": 522600 | ||
645 | + }, { | ||
646 | + "city": "黔南布依族苗族自治州", | ||
647 | + "city_code": 522700 | ||
648 | + }, { | ||
649 | + "city": "黔西南布依族苗族自治州", | ||
650 | + "city_code": 522300 | ||
651 | + }, { | ||
652 | + "city": "青岛", | ||
653 | + "city_code": 370200 | ||
654 | + }, { | ||
655 | + "city": "庆阳", | ||
656 | + "city_code": 621000 | ||
657 | + }, { | ||
658 | + "city": "清远", | ||
659 | + "city_code": 441800 | ||
660 | + }, { | ||
661 | + "city": "秦皇岛", | ||
662 | + "city_code": 130300 | ||
663 | + }, { | ||
664 | + "city": "钦州", | ||
665 | + "city_code": 450700 | ||
666 | + }, { | ||
667 | + "city": "齐齐哈尔", | ||
668 | + "city_code": 230200 | ||
669 | + }, { | ||
670 | + "city": "七台河", | ||
671 | + "city_code": 230900 | ||
672 | + }, { | ||
673 | + "city": "泉州", | ||
674 | + "city_code": 350500 | ||
675 | + }, { | ||
676 | + "city": "曲靖", | ||
677 | + "city_code": 530300 | ||
678 | + }, { | ||
679 | + "city": "衢州", | ||
680 | + "city_code": 330800 | ||
681 | + }] | ||
682 | +}, { | ||
683 | + "idx": "R", | ||
684 | + "cities": [{ | ||
685 | + "city": "日喀则", | ||
686 | + "city_code": 542300 | ||
687 | + }, { | ||
688 | + "city": "日照", | ||
689 | + "city_code": 371100 | ||
690 | + }] | ||
691 | +}, { | ||
692 | + "idx": "S", | ||
693 | + "cities": [{ | ||
694 | + "city": "三门峡", | ||
695 | + "city_code": 411200 | ||
696 | + }, { | ||
697 | + "city": "三明", | ||
698 | + "city_code": 350400 | ||
699 | + }, { | ||
700 | + "city": "三沙", | ||
701 | + "city_code": 460300 | ||
702 | + }, { | ||
703 | + "city": "三亚", | ||
704 | + "city_code": 460200 | ||
705 | + }, { | ||
706 | + "city": "上海", | ||
707 | + "city_code": 310100 | ||
708 | + }, { | ||
709 | + "city": "商洛", | ||
710 | + "city_code": 611000 | ||
711 | + }, { | ||
712 | + "city": "商丘", | ||
713 | + "city_code": 411400 | ||
714 | + }, { | ||
715 | + "city": "上饶", | ||
716 | + "city_code": 361100 | ||
717 | + }, { | ||
718 | + "city": "山南地区", | ||
719 | + "city_code": 542200 | ||
720 | + }, { | ||
721 | + "city": "汕头", | ||
722 | + "city_code": 440500 | ||
723 | + }, { | ||
724 | + "city": "汕尾", | ||
725 | + "city_code": 441500 | ||
726 | + }, { | ||
727 | + "city": "韶关", | ||
728 | + "city_code": 440200 | ||
729 | + }, { | ||
730 | + "city": "绍兴", | ||
731 | + "city_code": 330600 | ||
732 | + }, { | ||
733 | + "city": "邵阳", | ||
734 | + "city_code": 430500 | ||
735 | + }, { | ||
736 | + "city": "沈阳", | ||
737 | + "city_code": 210100 | ||
738 | + }, { | ||
739 | + "city": "深圳", | ||
740 | + "city_code": 440300 | ||
741 | + }, { | ||
742 | + "city": "石家庄", | ||
743 | + "city_code": 130100 | ||
744 | + }, { | ||
745 | + "city": "十堰", | ||
746 | + "city_code": 420300 | ||
747 | + }, { | ||
748 | + "city": "石嘴山", | ||
749 | + "city_code": 640200 | ||
750 | + }, { | ||
751 | + "city": "双鸭山", | ||
752 | + "city_code": 230500 | ||
753 | + }, { | ||
754 | + "city": "朔州", | ||
755 | + "city_code": 140600 | ||
756 | + }, { | ||
757 | + "city": "四平", | ||
758 | + "city_code": 220300 | ||
759 | + }, { | ||
760 | + "city": "松原", | ||
761 | + "city_code": 220700 | ||
762 | + }, { | ||
763 | + "city": "绥化", | ||
764 | + "city_code": 231200 | ||
765 | + }, { | ||
766 | + "city": "遂宁", | ||
767 | + "city_code": 510900 | ||
768 | + }, { | ||
769 | + "city": "随州", | ||
770 | + "city_code": 421300 | ||
771 | + }, { | ||
772 | + "city": "宿迁", | ||
773 | + "city_code": 321300 | ||
774 | + }, { | ||
775 | + "city": "苏州", | ||
776 | + "city_code": 320500 | ||
777 | + }, { | ||
778 | + "city": "宿州", | ||
779 | + "city_code": 341300 | ||
780 | + }] | ||
781 | +}, { | ||
782 | + "idx": "T", | ||
783 | + "cities": [{ | ||
784 | + "city": "塔城地区", | ||
785 | + "city_code": 654200 | ||
786 | + }, { | ||
787 | + "city": "泰安", | ||
788 | + "city_code": 370900 | ||
789 | + }, { | ||
790 | + "city": "太原", | ||
791 | + "city_code": 140100 | ||
792 | + }, { | ||
793 | + "city": "泰州", | ||
794 | + "city_code": 321200 | ||
795 | + }, { | ||
796 | + "city": "台州", | ||
797 | + "city_code": 331000 | ||
798 | + }, { | ||
799 | + "city": "唐山", | ||
800 | + "city_code": 130200 | ||
801 | + }, { | ||
802 | + "city": "天津", | ||
803 | + "city_code": 120100 | ||
804 | + }, { | ||
805 | + "city": "天水", | ||
806 | + "city_code": 620500 | ||
807 | + }, { | ||
808 | + "city": "铁岭", | ||
809 | + "city_code": 211200 | ||
810 | + }, { | ||
811 | + "city": "铜川", | ||
812 | + "city_code": 610200 | ||
813 | + }, { | ||
814 | + "city": "通化", | ||
815 | + "city_code": 220500 | ||
816 | + }, { | ||
817 | + "city": "通辽", | ||
818 | + "city_code": 150500 | ||
819 | + }, { | ||
820 | + "city": "铜陵", | ||
821 | + "city_code": 340700 | ||
822 | + }, { | ||
823 | + "city": "铜仁", | ||
824 | + "city_code": 520600 | ||
825 | + }, { | ||
826 | + "city": "吐鲁番", | ||
827 | + "city_code": 652100 | ||
828 | + }] | ||
829 | +}, { | ||
830 | + "idx": "W", | ||
831 | + "cities": [{ | ||
832 | + "city": "潍坊", | ||
833 | + "city_code": 370700 | ||
834 | + }, { | ||
835 | + "city": "威海", | ||
836 | + "city_code": 371000 | ||
837 | + }, { | ||
838 | + "city": "渭南", | ||
839 | + "city_code": 610500 | ||
840 | + }, { | ||
841 | + "city": "文山州", | ||
842 | + "city_code": 532600 | ||
843 | + }, { | ||
844 | + "city": "温州", | ||
845 | + "city_code": 330300 | ||
846 | + }, { | ||
847 | + "city": "乌海", | ||
848 | + "city_code": 150300 | ||
849 | + }, { | ||
850 | + "city": "武汉", | ||
851 | + "city_code": 420100 | ||
852 | + }, { | ||
853 | + "city": "芜湖", | ||
854 | + "city_code": 340200 | ||
855 | + }, { | ||
856 | + "city": "乌兰察布", | ||
857 | + "city_code": 150900 | ||
858 | + }, { | ||
859 | + "city": "乌鲁木齐", | ||
860 | + "city_code": 650100 | ||
861 | + }, { | ||
862 | + "city": "武威", | ||
863 | + "city_code": 620600 | ||
864 | + }, { | ||
865 | + "city": "无锡", | ||
866 | + "city_code": 320200 | ||
867 | + }, { | ||
868 | + "city": "吴忠", | ||
869 | + "city_code": 640300 | ||
870 | + }, { | ||
871 | + "city": "梧州", | ||
872 | + "city_code": 450400 | ||
873 | + }] | ||
874 | +}, { | ||
875 | + "idx": "X", | ||
876 | + "cities": [{ | ||
877 | + "city": "厦门", | ||
878 | + "city_code": 350200 | ||
879 | + }, { | ||
880 | + "city": "西安", | ||
881 | + "city_code": 610100 | ||
882 | + }, { | ||
883 | + "city": "湘潭", | ||
884 | + "city_code": 430300 | ||
885 | + }, { | ||
886 | + "city": "湘西土家族苗族自治州", | ||
887 | + "city_code": 433100 | ||
888 | + }, { | ||
889 | + "city": "襄阳", | ||
890 | + "city_code": 420600 | ||
891 | + }, { | ||
892 | + "city": "咸宁", | ||
893 | + "city_code": 421200 | ||
894 | + }, { | ||
895 | + "city": "咸阳", | ||
896 | + "city_code": 610400 | ||
897 | + }, { | ||
898 | + "city": "孝感", | ||
899 | + "city_code": 420900 | ||
900 | + }, { | ||
901 | + "city": "锡林郭勒盟", | ||
902 | + "city_code": 152500 | ||
903 | + }, { | ||
904 | + "city": "兴安盟", | ||
905 | + "city_code": 152200 | ||
906 | + }, { | ||
907 | + "city": "邢台", | ||
908 | + "city_code": 130500 | ||
909 | + }, { | ||
910 | + "city": "西宁", | ||
911 | + "city_code": 630100 | ||
912 | + }, { | ||
913 | + "city": "新乡", | ||
914 | + "city_code": 410700 | ||
915 | + }, { | ||
916 | + "city": "信阳", | ||
917 | + "city_code": 411500 | ||
918 | + }, { | ||
919 | + "city": "新余", | ||
920 | + "city_code": 360500 | ||
921 | + }, { | ||
922 | + "city": "忻州", | ||
923 | + "city_code": 140900 | ||
924 | + }, { | ||
925 | + "city": "西双版纳傣族自治州", | ||
926 | + "city_code": 532800 | ||
927 | + }, { | ||
928 | + "city": "宣城", | ||
929 | + "city_code": 341800 | ||
930 | + }, { | ||
931 | + "city": "许昌", | ||
932 | + "city_code": 411000 | ||
933 | + }, { | ||
934 | + "city": "虚拟城市", | ||
935 | + "city_code": 376600 | ||
936 | + }, { | ||
937 | + "city": "徐州", | ||
938 | + "city_code": 320300 | ||
939 | + }] | ||
940 | +}, { | ||
941 | + "idx": "Y", | ||
942 | + "cities": [{ | ||
943 | + "city": "雅安", | ||
944 | + "city_code": 511800 | ||
945 | + }, { | ||
946 | + "city": "延安", | ||
947 | + "city_code": 610600 | ||
948 | + }, { | ||
949 | + "city": "延边朝鲜族自治州", | ||
950 | + "city_code": 222400 | ||
951 | + }, { | ||
952 | + "city": "盐城", | ||
953 | + "city_code": 320900 | ||
954 | + }, { | ||
955 | + "city": "阳江", | ||
956 | + "city_code": 441700 | ||
957 | + }, { | ||
958 | + "city": "阳泉", | ||
959 | + "city_code": 140300 | ||
960 | + }, { | ||
961 | + "city": "扬州", | ||
962 | + "city_code": 321000 | ||
963 | + }, { | ||
964 | + "city": "烟台", | ||
965 | + "city_code": 370600 | ||
966 | + }, { | ||
967 | + "city": "宜宾", | ||
968 | + "city_code": 511500 | ||
969 | + }, { | ||
970 | + "city": "宜昌", | ||
971 | + "city_code": 420500 | ||
972 | + }, { | ||
973 | + "city": "宜春", | ||
974 | + "city_code": 360900 | ||
975 | + }, { | ||
976 | + "city": "伊春市", | ||
977 | + "city_code": 230700 | ||
978 | + }, { | ||
979 | + "city": "伊犁哈萨克自治州", | ||
980 | + "city_code": 654000 | ||
981 | + }, { | ||
982 | + "city": "银川", | ||
983 | + "city_code": 640100 | ||
984 | + }, { | ||
985 | + "city": "营口", | ||
986 | + "city_code": 210800 | ||
987 | + }, { | ||
988 | + "city": "鹰潭", | ||
989 | + "city_code": 360600 | ||
990 | + }, { | ||
991 | + "city": "益阳", | ||
992 | + "city_code": 430900 | ||
993 | + }, { | ||
994 | + "city": "永州", | ||
995 | + "city_code": 431100 | ||
996 | + }, { | ||
997 | + "city": "岳阳", | ||
998 | + "city_code": 430600 | ||
999 | + }, { | ||
1000 | + "city": "榆林", | ||
1001 | + "city_code": 610800 | ||
1002 | + }, { | ||
1003 | + "city": "玉林", | ||
1004 | + "city_code": 450900 | ||
1005 | + }, { | ||
1006 | + "city": "运城", | ||
1007 | + "city_code": 140800 | ||
1008 | + }, { | ||
1009 | + "city": "云浮", | ||
1010 | + "city_code": 445300 | ||
1011 | + }, { | ||
1012 | + "city": "玉树藏族自治州", | ||
1013 | + "city_code": 632700 | ||
1014 | + }, { | ||
1015 | + "city": "玉溪", | ||
1016 | + "city_code": 530400 | ||
1017 | + }] | ||
1018 | +}, { | ||
1019 | + "idx": "Z", | ||
1020 | + "cities": [{ | ||
1021 | + "city": "枣庄", | ||
1022 | + "city_code": 370400 | ||
1023 | + }, { | ||
1024 | + "city": "张家界", | ||
1025 | + "city_code": 430800 | ||
1026 | + }, { | ||
1027 | + "city": "张家口", | ||
1028 | + "city_code": 130700 | ||
1029 | + }, { | ||
1030 | + "city": "张掖", | ||
1031 | + "city_code": 620700 | ||
1032 | + }, { | ||
1033 | + "city": "漳州", | ||
1034 | + "city_code": 350600 | ||
1035 | + }, { | ||
1036 | + "city": "湛江", | ||
1037 | + "city_code": 440800 | ||
1038 | + }, { | ||
1039 | + "city": "肇庆", | ||
1040 | + "city_code": 441200 | ||
1041 | + }, { | ||
1042 | + "city": "昭通", | ||
1043 | + "city_code": 530600 | ||
1044 | + }, { | ||
1045 | + "city": "郑州", | ||
1046 | + "city_code": 410100 | ||
1047 | + }, { | ||
1048 | + "city": "镇江", | ||
1049 | + "city_code": 321100 | ||
1050 | + }, { | ||
1051 | + "city": "中山", | ||
1052 | + "city_code": 442000 | ||
1053 | + }, { | ||
1054 | + "city": "中卫", | ||
1055 | + "city_code": 640500 | ||
1056 | + }, { | ||
1057 | + "city": "周口", | ||
1058 | + "city_code": 411600 | ||
1059 | + }, { | ||
1060 | + "city": "舟山", | ||
1061 | + "city_code": 330900 | ||
1062 | + }, { | ||
1063 | + "city": "珠海", | ||
1064 | + "city_code": 440400 | ||
1065 | + }, { | ||
1066 | + "city": "驻马店", | ||
1067 | + "city_code": 411700 | ||
1068 | + }, { | ||
1069 | + "city": "株洲", | ||
1070 | + "city_code": 430200 | ||
1071 | + }, { | ||
1072 | + "city": "淄博", | ||
1073 | + "city_code": 370300 | ||
1074 | + }, { | ||
1075 | + "city": "自贡", | ||
1076 | + "city_code": 510300 | ||
1077 | + }, { | ||
1078 | + "city": "资阳", | ||
1079 | + "city_code": 512000 | ||
1080 | + }, { | ||
1081 | + "city": "遵义", | ||
1082 | + "city_code": 520300 | ||
1083 | + }] | ||
1084 | +}] | ||
1085 | + | ||
1086 | +export default citys |
common/commonUtil.js
0 → 100644
1 | +// 把文字中间4个字符换成“*”号 | ||
2 | +export const replaceTextToStar = (params = '') => { | ||
3 | + | ||
4 | + let value = String(params) | ||
5 | + | ||
6 | + if (!value || !value.length || value.length <= 0) return ''; | ||
7 | + | ||
8 | + let len = value.length; | ||
9 | + let medianNumber = Math.floor(len / 2); | ||
10 | + | ||
11 | + console.log(medianNumber) | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + return `${value.substr(0, medianNumber-2)}****${value.substr(medianNumber + 2, value.length)}`; | ||
16 | +} | ||
17 | + | ||
18 | + | ||
19 | +module.exports = { | ||
20 | + replaceTextToStar, | ||
21 | +} |
common/demo.scss
0 → 100644
1 | +/* #ifndef APP-NVUE */ | ||
2 | +view, | ||
3 | +text { | ||
4 | + box-sizing: border-box; | ||
5 | +} | ||
6 | +/* #endif */ | ||
7 | + | ||
8 | +/* start--演示页面使用的统一样式--start */ | ||
9 | +.u-demo { | ||
10 | + padding: 25px 20px; | ||
11 | +} | ||
12 | + | ||
13 | +.u-demo-wrap { | ||
14 | + border-width: 1px; | ||
15 | + border-color: #ddd; | ||
16 | + border-style: dashed; | ||
17 | + background-color: rgb(250, 250, 250); | ||
18 | + padding: 20px 10px; | ||
19 | + border-radius: 3px; | ||
20 | +} | ||
21 | + | ||
22 | +.u-demo-area { | ||
23 | + text-align: center; | ||
24 | +} | ||
25 | + | ||
26 | +.u-no-demo-here { | ||
27 | + color: $u-tips-color; | ||
28 | + font-size: 13px; | ||
29 | +} | ||
30 | + | ||
31 | +.u-demo-result-line { | ||
32 | + border-width: 1px; | ||
33 | + border-color: #ddd; | ||
34 | + border-style: dashed; | ||
35 | + padding: 5px 20px; | ||
36 | + margin-top: 30px; | ||
37 | + border-radius: 5px; | ||
38 | + background-color: rgb(240, 240, 240); | ||
39 | + color: $u-content-color; | ||
40 | + font-size: 16px; | ||
41 | + /* #ifndef APP-NVUE */ | ||
42 | + word-break: break-word; | ||
43 | + display: inline-block; | ||
44 | + /* #endif */ | ||
45 | + text-align: left; | ||
46 | + | ||
47 | +} | ||
48 | + | ||
49 | +.u-demo-title, | ||
50 | +.u-config-title { | ||
51 | + text-align: center; | ||
52 | + font-size: 16px; | ||
53 | + font-weight: bold; | ||
54 | + margin-bottom: 20px; | ||
55 | +} | ||
56 | + | ||
57 | +.u-config-item { | ||
58 | + margin-top: 25px; | ||
59 | +} | ||
60 | + | ||
61 | +.u-config-title { | ||
62 | + margin-top: 20px; | ||
63 | + padding-bottom: 5px; | ||
64 | +} | ||
65 | + | ||
66 | +.u-item-title { | ||
67 | + position: relative; | ||
68 | + font-size: 15px; | ||
69 | + padding-left: 8px; | ||
70 | + line-height: 1; | ||
71 | + margin-bottom: 11px; | ||
72 | +} | ||
73 | + | ||
74 | +.u-item-title:after { | ||
75 | + position: absolute; | ||
76 | + width: 4px; | ||
77 | + top: -1px; | ||
78 | + height: 16px; | ||
79 | + /* #ifndef APP-NVUE */ | ||
80 | + content: ''; | ||
81 | + /* #endif */ | ||
82 | + left: 0; | ||
83 | + border-radius: 10px; | ||
84 | + background-color: $u-content-color; | ||
85 | +} | ||
86 | +/* end--演示页面使用的统一样式--end */ |
common/index.list.js
0 → 100644
1 | +module.exports = { | ||
2 | + list: [{ | ||
3 | + "letter": "A", | ||
4 | + "data": [{ | ||
5 | + "name": "阿拉斯加", | ||
6 | + "mobile": "13588889999", | ||
7 | + "keyword": "阿拉斯加ABA13588889999" | ||
8 | + }, | ||
9 | + { | ||
10 | + "name": "阿克苏", | ||
11 | + "mobile": "0551-4386721", | ||
12 | + "keyword": "阿克苏AKESU0551-4386721" | ||
13 | + }, | ||
14 | + { | ||
15 | + "name": "阿拉善", | ||
16 | + "mobile": "4008009100", | ||
17 | + "keyword": "阿拉善ALASHAN4008009100" | ||
18 | + }, | ||
19 | + { | ||
20 | + "name": "阿勒泰", | ||
21 | + "mobile": "13588889999", | ||
22 | + "keyword": "阿勒泰ALETAI13588889999" | ||
23 | + }, | ||
24 | + { | ||
25 | + "name": "阿里", | ||
26 | + "mobile": "13588889999", | ||
27 | + "keyword": "阿里ALI13588889999" | ||
28 | + }, | ||
29 | + { | ||
30 | + "name": "安阳", | ||
31 | + "mobile": "13588889999", | ||
32 | + "keyword": "13588889999安阳ANYANG" | ||
33 | + } | ||
34 | + ] | ||
35 | + }, | ||
36 | + { | ||
37 | + "letter": "B", | ||
38 | + "data": [{ | ||
39 | + "name": "白城", | ||
40 | + "mobile": "该主子没有留电话~", | ||
41 | + "keyword": "白城BAICHENG" | ||
42 | + }, | ||
43 | + { | ||
44 | + "name": "白山", | ||
45 | + "mobile": "13588889999", | ||
46 | + "keyword": "白山BAISHAN13588889999" | ||
47 | + }, | ||
48 | + { | ||
49 | + "name": "白银", | ||
50 | + "mobile": "13588889999", | ||
51 | + "keyword": "白银BAIYIN13588889999" | ||
52 | + }, | ||
53 | + { | ||
54 | + "name": "保定", | ||
55 | + "mobile": "13588889999", | ||
56 | + "keyword": "保定BAODING13588889999" | ||
57 | + } | ||
58 | + ] | ||
59 | + }, | ||
60 | + { | ||
61 | + "letter": "C", | ||
62 | + "data": [{ | ||
63 | + "name": "沧州", | ||
64 | + "mobile": "13588889999", | ||
65 | + "keyword": "沧州CANGZHOU13588889999" | ||
66 | + }, | ||
67 | + { | ||
68 | + "name": "长春", | ||
69 | + "mobile": "13588889999", | ||
70 | + "keyword": "长春CHANGCHUN13588889999" | ||
71 | + } | ||
72 | + ] | ||
73 | + }, | ||
74 | + { | ||
75 | + "letter": "D", | ||
76 | + "data": [{ | ||
77 | + "name": "大理", | ||
78 | + "mobile": "13588889999", | ||
79 | + "keyword": "大理DALI13588889999" | ||
80 | + }, | ||
81 | + { | ||
82 | + "name": "大连", | ||
83 | + "mobile": "13588889999", | ||
84 | + "keyword": "大连DALIAN13588889999" | ||
85 | + } | ||
86 | + ] | ||
87 | + }, | ||
88 | + { | ||
89 | + "letter": "E", | ||
90 | + "data": [{ | ||
91 | + "name": "鄂尔多斯", | ||
92 | + "mobile": "13588889999", | ||
93 | + "keyword": "鄂尔多斯EERDUOSI13588889999" | ||
94 | + }, | ||
95 | + { | ||
96 | + "name": "恩施", | ||
97 | + "mobile": "13588889999", | ||
98 | + "keyword": "恩施ENSHI13588889999" | ||
99 | + }, | ||
100 | + { | ||
101 | + "name": "鄂州", | ||
102 | + "mobile": "13588889999", | ||
103 | + "keyword": "鄂州EZHOU13588889999" | ||
104 | + } | ||
105 | + ] | ||
106 | + }, | ||
107 | + { | ||
108 | + "letter": "F", | ||
109 | + "data": [{ | ||
110 | + "name": "防城港", | ||
111 | + "mobile": "该主子没有留电话~", | ||
112 | + "keyword": "防城港FANGCHENGGANG" | ||
113 | + }, | ||
114 | + { | ||
115 | + "name": "抚顺", | ||
116 | + "mobile": "13588889999", | ||
117 | + "keyword": "抚顺FUSHUN13588889999" | ||
118 | + }, | ||
119 | + { | ||
120 | + "name": "阜新", | ||
121 | + "mobile": "13588889999", | ||
122 | + "keyword": "阜新FUXIN13588889999" | ||
123 | + }, | ||
124 | + { | ||
125 | + "name": "阜阳", | ||
126 | + "mobile": "13588889999", | ||
127 | + "keyword": "阜阳FUYANG13588889999" | ||
128 | + }, | ||
129 | + { | ||
130 | + "name": "抚州", | ||
131 | + "mobile": "13588889999", | ||
132 | + "keyword": "抚州FUZHOU13588889999" | ||
133 | + }, | ||
134 | + { | ||
135 | + "name": "福州", | ||
136 | + "mobile": "13588889999", | ||
137 | + "keyword": "福州FUZHOU13588889999" | ||
138 | + } | ||
139 | + ] | ||
140 | + }, | ||
141 | + { | ||
142 | + "letter": "G", | ||
143 | + "data": [{ | ||
144 | + "name": "甘南", | ||
145 | + "mobile": "13588889999", | ||
146 | + "keyword": "甘南GANNAN13588889999" | ||
147 | + }, | ||
148 | + { | ||
149 | + "name": "赣州", | ||
150 | + "mobile": "13588889999", | ||
151 | + "keyword": "赣州GANZHOU13588889999" | ||
152 | + }, | ||
153 | + { | ||
154 | + "name": "甘孜", | ||
155 | + "mobile": "13588889999", | ||
156 | + "keyword": "甘孜GANZI13588889999" | ||
157 | + } | ||
158 | + ] | ||
159 | + }, | ||
160 | + { | ||
161 | + "letter": "H", | ||
162 | + "data": [{ | ||
163 | + "name": "哈尔滨", | ||
164 | + "mobile": "13588889999", | ||
165 | + "keyword": "哈尔滨HAERBIN13588889999" | ||
166 | + }, | ||
167 | + { | ||
168 | + "name": "海北", | ||
169 | + "mobile": "13588889999", | ||
170 | + "keyword": "海北HAIBEI13588889999" | ||
171 | + }, | ||
172 | + { | ||
173 | + "name": "海东", | ||
174 | + "mobile": "13588889999", | ||
175 | + "keyword": "海东HAIDONG13588889999" | ||
176 | + }, | ||
177 | + { | ||
178 | + "name": "海口", | ||
179 | + "mobile": "13588889999", | ||
180 | + "keyword": "海口HAIKOU13588889999" | ||
181 | + } | ||
182 | + ] | ||
183 | + }, | ||
184 | + { | ||
185 | + "letter": "I", | ||
186 | + "data": [{ | ||
187 | + "name": "ice", | ||
188 | + "mobile": "13588889999", | ||
189 | + "keyword": "佳木斯JIAMUSI13588889999" | ||
190 | + }] | ||
191 | + }, | ||
192 | + { | ||
193 | + "letter": "J", | ||
194 | + "data": [{ | ||
195 | + "name": "佳木斯", | ||
196 | + "mobile": "13588889999", | ||
197 | + "keyword": "佳木斯JIAMUSI13588889999" | ||
198 | + }, | ||
199 | + { | ||
200 | + "name": "吉安", | ||
201 | + "mobile": "13588889999", | ||
202 | + "keyword": "吉安JIAN13588889999" | ||
203 | + }, | ||
204 | + { | ||
205 | + "name": "江门", | ||
206 | + "mobile": "13588889999", | ||
207 | + "keyword": "江门JIANGMEN13588889999" | ||
208 | + } | ||
209 | + ] | ||
210 | + }, | ||
211 | + { | ||
212 | + "letter": "K", | ||
213 | + "data": [{ | ||
214 | + "name": "开封", | ||
215 | + "mobile": "13588889999", | ||
216 | + "keyword": "开封KAIFENG13588889999" | ||
217 | + }, | ||
218 | + { | ||
219 | + "name": "喀什", | ||
220 | + "mobile": "13588889999", | ||
221 | + "keyword": "喀什KASHI13588889999" | ||
222 | + }, | ||
223 | + { | ||
224 | + "name": "克拉玛依", | ||
225 | + "mobile": "13588889999", | ||
226 | + "keyword": "克拉玛依KELAMAYI13588889999" | ||
227 | + } | ||
228 | + ] | ||
229 | + }, | ||
230 | + { | ||
231 | + "letter": "L", | ||
232 | + "data": [{ | ||
233 | + "name": "来宾", | ||
234 | + "mobile": "13588889999", | ||
235 | + "keyword": "来宾LAIBIN13588889999" | ||
236 | + }, | ||
237 | + { | ||
238 | + "name": "兰州", | ||
239 | + "mobile": "13588889999", | ||
240 | + "keyword": "兰州LANZHOU13588889999" | ||
241 | + }, | ||
242 | + { | ||
243 | + "name": "拉萨", | ||
244 | + "mobile": "13588889999", | ||
245 | + "keyword": "拉萨LASA13588889999" | ||
246 | + }, | ||
247 | + { | ||
248 | + "name": "乐山", | ||
249 | + "mobile": "13588889999", | ||
250 | + "keyword": "乐山LESHAN13588889999" | ||
251 | + }, | ||
252 | + { | ||
253 | + "name": "凉山", | ||
254 | + "mobile": "13588889999", | ||
255 | + "keyword": "凉山LIANGSHAN13588889999" | ||
256 | + }, | ||
257 | + { | ||
258 | + "name": "连云港", | ||
259 | + "mobile": "13588889999", | ||
260 | + "keyword": "连云港LIANYUNGANG13588889999" | ||
261 | + }, | ||
262 | + { | ||
263 | + "name": "聊城", | ||
264 | + "mobile": "18322223333", | ||
265 | + "keyword": "聊城LIAOCHENG18322223333" | ||
266 | + }, | ||
267 | + { | ||
268 | + "name": "辽阳", | ||
269 | + "mobile": "18322223333", | ||
270 | + "keyword": "辽阳LIAOYANG18322223333" | ||
271 | + }, | ||
272 | + { | ||
273 | + "name": "辽源", | ||
274 | + "mobile": "18322223333", | ||
275 | + "keyword": "辽源LIAOYUAN18322223333" | ||
276 | + }, | ||
277 | + { | ||
278 | + "name": "丽江", | ||
279 | + "mobile": "18322223333", | ||
280 | + "keyword": "丽江LIJIANG18322223333" | ||
281 | + }, | ||
282 | + { | ||
283 | + "name": "临沧", | ||
284 | + "mobile": "18322223333", | ||
285 | + "keyword": "临沧LINCANG18322223333" | ||
286 | + }, | ||
287 | + { | ||
288 | + "name": "临汾", | ||
289 | + "mobile": "18322223333", | ||
290 | + "keyword": "临汾LINFEN18322223333" | ||
291 | + }, | ||
292 | + { | ||
293 | + "name": "临夏", | ||
294 | + "mobile": "18322223333", | ||
295 | + "keyword": "临夏LINXIA18322223333" | ||
296 | + }, | ||
297 | + { | ||
298 | + "name": "临沂", | ||
299 | + "mobile": "18322223333", | ||
300 | + "keyword": "临沂LINYI18322223333" | ||
301 | + }, | ||
302 | + { | ||
303 | + "name": "林芝", | ||
304 | + "mobile": "18322223333", | ||
305 | + "keyword": "林芝LINZHI18322223333" | ||
306 | + }, | ||
307 | + { | ||
308 | + "name": "丽水", | ||
309 | + "mobile": "18322223333", | ||
310 | + "keyword": "丽水LISHUI18322223333" | ||
311 | + } | ||
312 | + ] | ||
313 | + }, | ||
314 | + { | ||
315 | + "letter": "M", | ||
316 | + "data": [{ | ||
317 | + "name": "眉山", | ||
318 | + "mobile": "15544448888", | ||
319 | + "keyword": "眉山MEISHAN15544448888" | ||
320 | + }, | ||
321 | + { | ||
322 | + "name": "梅州", | ||
323 | + "mobile": "15544448888", | ||
324 | + "keyword": "梅州MEIZHOU15544448888" | ||
325 | + }, | ||
326 | + { | ||
327 | + "name": "绵阳", | ||
328 | + "mobile": "15544448888", | ||
329 | + "keyword": "绵阳MIANYANG15544448888" | ||
330 | + }, | ||
331 | + { | ||
332 | + "name": "牡丹江", | ||
333 | + "mobile": "15544448888", | ||
334 | + "keyword": "牡丹江MUDANJIANG15544448888" | ||
335 | + } | ||
336 | + ] | ||
337 | + }, | ||
338 | + { | ||
339 | + "letter": "N", | ||
340 | + "data": [{ | ||
341 | + "name": "南昌", | ||
342 | + "mobile": "15544448888", | ||
343 | + "keyword": "南昌NANCHANG15544448888" | ||
344 | + }, | ||
345 | + { | ||
346 | + "name": "南充", | ||
347 | + "mobile": "15544448888", | ||
348 | + "keyword": "南充NANCHONG15544448888" | ||
349 | + }, | ||
350 | + { | ||
351 | + "name": "南京", | ||
352 | + "mobile": "15544448888", | ||
353 | + "keyword": "南京NANJING15544448888" | ||
354 | + }, | ||
355 | + { | ||
356 | + "name": "南宁", | ||
357 | + "mobile": "15544448888", | ||
358 | + "keyword": "南宁NANNING15544448888" | ||
359 | + }, | ||
360 | + { | ||
361 | + "name": "南平", | ||
362 | + "mobile": "15544448888", | ||
363 | + "keyword": "南平NANPING15544448888" | ||
364 | + } | ||
365 | + ] | ||
366 | + }, | ||
367 | + { | ||
368 | + "letter": "O", | ||
369 | + "data": [{ | ||
370 | + "name": "欧阳", | ||
371 | + "mobile": "15544448888", | ||
372 | + "keyword": "欧阳ouyang15544448888" | ||
373 | + }] | ||
374 | + }, | ||
375 | + { | ||
376 | + "letter": "P", | ||
377 | + "data": [{ | ||
378 | + "name": "盘锦", | ||
379 | + "mobile": "15544448888", | ||
380 | + "keyword": "盘锦PANJIN15544448888" | ||
381 | + }, | ||
382 | + { | ||
383 | + "name": "攀枝花", | ||
384 | + "mobile": "15544448888", | ||
385 | + "keyword": "攀枝花PANZHIHUA15544448888" | ||
386 | + }, | ||
387 | + { | ||
388 | + "name": "平顶山", | ||
389 | + "mobile": "15544448888", | ||
390 | + "keyword": "平顶山PINGDINGSHAN15544448888" | ||
391 | + }, | ||
392 | + { | ||
393 | + "name": "平凉", | ||
394 | + "mobile": "15544448888", | ||
395 | + "keyword": "平凉PINGLIANG15544448888" | ||
396 | + }, | ||
397 | + { | ||
398 | + "name": "萍乡", | ||
399 | + "mobile": "15544448888", | ||
400 | + "keyword": "萍乡PINGXIANG15544448888" | ||
401 | + }, | ||
402 | + { | ||
403 | + "name": "普洱", | ||
404 | + "mobile": "15544448888", | ||
405 | + "keyword": "普洱PUER15544448888" | ||
406 | + }, | ||
407 | + { | ||
408 | + "name": "莆田", | ||
409 | + "mobile": "15544448888", | ||
410 | + "keyword": "莆田PUTIAN15544448888" | ||
411 | + }, | ||
412 | + { | ||
413 | + "name": "濮阳", | ||
414 | + "mobile": "15544448888", | ||
415 | + "keyword": "濮阳PUYANG15544448888" | ||
416 | + } | ||
417 | + ] | ||
418 | + }, | ||
419 | + { | ||
420 | + "letter": "Q", | ||
421 | + "data": [{ | ||
422 | + "name": "黔东南", | ||
423 | + "mobile": "15544448888", | ||
424 | + "keyword": "黔东南QIANDONGNAN15544448888" | ||
425 | + }, | ||
426 | + { | ||
427 | + "name": "黔南", | ||
428 | + "mobile": "15544448888", | ||
429 | + "keyword": "黔南QIANNAN15544448888" | ||
430 | + }, | ||
431 | + { | ||
432 | + "name": "黔西南", | ||
433 | + "mobile": "15544448888", | ||
434 | + "keyword": "黔西南QIANXINAN15544448888" | ||
435 | + } | ||
436 | + ] | ||
437 | + }, | ||
438 | + { | ||
439 | + "letter": "R", | ||
440 | + "data": [{ | ||
441 | + "name": "日喀则", | ||
442 | + "mobile": "15544448888", | ||
443 | + "keyword": "日喀则RIKAZE15544448888" | ||
444 | + }, | ||
445 | + { | ||
446 | + "name": "日照", | ||
447 | + "mobile": "15544448888", | ||
448 | + "keyword": "日照RIZHAO15544448888" | ||
449 | + } | ||
450 | + ] | ||
451 | + }, | ||
452 | + { | ||
453 | + "letter": "S", | ||
454 | + "data": [{ | ||
455 | + "name": "三门峡", | ||
456 | + "mobile": "15544448888", | ||
457 | + "keyword": "三门峡SANMENXIA15544448888" | ||
458 | + }, | ||
459 | + { | ||
460 | + "name": "三明", | ||
461 | + "mobile": "15544448888", | ||
462 | + "keyword": "三明SANMING15544448888" | ||
463 | + }, | ||
464 | + { | ||
465 | + "name": "三沙", | ||
466 | + "mobile": "15544448888", | ||
467 | + "keyword": "三沙SANSHA15544448888" | ||
468 | + } | ||
469 | + ] | ||
470 | + }, | ||
471 | + { | ||
472 | + "letter": "T", | ||
473 | + "data": [{ | ||
474 | + "name": "塔城", | ||
475 | + "mobile": "15544448888", | ||
476 | + "keyword": "塔城TACHENG15544448888" | ||
477 | + }, | ||
478 | + { | ||
479 | + "name": "漯河", | ||
480 | + "mobile": "15544448888", | ||
481 | + "keyword": "漯河TAHE15544448888" | ||
482 | + }, | ||
483 | + { | ||
484 | + "name": "泰安", | ||
485 | + "mobile": "15544448888", | ||
486 | + "keyword": "泰安TAIAN15544448888" | ||
487 | + } | ||
488 | + ] | ||
489 | + }, | ||
490 | + { | ||
491 | + "letter": "W", | ||
492 | + "data": [{ | ||
493 | + "name": "潍坊", | ||
494 | + "mobile": "15544448888", | ||
495 | + "keyword": "潍坊WEIFANG15544448888" | ||
496 | + }, | ||
497 | + { | ||
498 | + "name": "威海", | ||
499 | + "mobile": "15544448888", | ||
500 | + "keyword": "威海WEIHAI15544448888" | ||
501 | + }, | ||
502 | + { | ||
503 | + "name": "渭南", | ||
504 | + "mobile": "15544448888", | ||
505 | + "keyword": "渭南WEINAN15544448888" | ||
506 | + }, | ||
507 | + { | ||
508 | + "name": "文山", | ||
509 | + "mobile": "15544448888", | ||
510 | + "keyword": "文山WENSHAN15544448888" | ||
511 | + } | ||
512 | + ] | ||
513 | + }, | ||
514 | + { | ||
515 | + "letter": "X", | ||
516 | + "data": [{ | ||
517 | + "name": "厦门", | ||
518 | + "mobile": "15544448888", | ||
519 | + "keyword": "厦门XIAMEN15544448888" | ||
520 | + }, | ||
521 | + { | ||
522 | + "name": "西安", | ||
523 | + "mobile": "15544448888", | ||
524 | + "keyword": "西安XIAN15544448888" | ||
525 | + }, | ||
526 | + { | ||
527 | + "name": "湘潭", | ||
528 | + "mobile": "15544448888", | ||
529 | + "keyword": "湘潭XIANGTAN15544448888" | ||
530 | + } | ||
531 | + ] | ||
532 | + }, | ||
533 | + { | ||
534 | + "letter": "Y", | ||
535 | + "data": [{ | ||
536 | + "name": "雅安", | ||
537 | + "mobile": "15544448888", | ||
538 | + "keyword": "雅安YAAN15544448888" | ||
539 | + }, | ||
540 | + { | ||
541 | + "name": "延安", | ||
542 | + "mobile": "15544448888", | ||
543 | + "keyword": "延安YANAN15544448888" | ||
544 | + }, | ||
545 | + { | ||
546 | + "name": "延边", | ||
547 | + "mobile": "15544448888", | ||
548 | + "keyword": "延边YANBIAN15544448888" | ||
549 | + }, | ||
550 | + { | ||
551 | + "name": "盐城", | ||
552 | + "mobile": "15544448888", | ||
553 | + "keyword": "盐城YANCHENG15544448888" | ||
554 | + } | ||
555 | + ] | ||
556 | + }, | ||
557 | + { | ||
558 | + "letter": "Z", | ||
559 | + "data": [{ | ||
560 | + "name": "枣庄", | ||
561 | + "mobile": "15544448888", | ||
562 | + "keyword": "枣庄ZAOZHUANG15544448888" | ||
563 | + }, | ||
564 | + { | ||
565 | + "name": "张家界", | ||
566 | + "mobile": "15544448888", | ||
567 | + "keyword": "张家界ZHANGJIAJIE15544448888" | ||
568 | + }, | ||
569 | + { | ||
570 | + "name": "张家口", | ||
571 | + "mobile": "15544448888", | ||
572 | + "keyword": "张家口ZHANGJIAKOU15544448888" | ||
573 | + } | ||
574 | + ] | ||
575 | + }, | ||
576 | + { | ||
577 | + "letter": "#", | ||
578 | + "data": [{ | ||
579 | + "name": "其他.", | ||
580 | + "mobile": "16666666666", | ||
581 | + "keyword": "echo16666666666" | ||
582 | + }] | ||
583 | + } | ||
584 | + ] | ||
585 | +} |
common/locales/en.js
0 → 100644
1 | +export default { | ||
2 | + // 可以以页面为单位来写,比如首页的内容,写在index字段,个人中心写在center,共同部分写在common部分 | ||
3 | + components: { | ||
4 | + desc: 'Numerous components cover the various requirements of the development process, and the components are rich in functions and compatible with multiple terminals. Let you integrate quickly, out of the box' | ||
5 | + }, | ||
6 | + js: { | ||
7 | + desc: 'Numerous intimate gadgets are a weapon that you can call upon during the development process, allowing you to dart in your hand and pierce the Yang with a hundred steps' | ||
8 | + }, | ||
9 | + template: { | ||
10 | + desc: 'Collection of many commonly used pages and layouts, reducing the repetitive work of developers, allowing you to focus on logic and get twice the result with half the effort' | ||
11 | + }, | ||
12 | + nav: { | ||
13 | + components: 'Components', | ||
14 | + js: 'JS', | ||
15 | + template: 'Template' | ||
16 | + }, | ||
17 | + common: { | ||
18 | + intro: 'UI framework for rapid development of multiple platforms', | ||
19 | + title: 'uView UI', | ||
20 | + }, | ||
21 | +} |
common/locales/zh.js
0 → 100644
1 | +export default { | ||
2 | + // 可以以页面为单位来写,比如首页的内容,写在index字段,个人中心写在center,共同部分写在common部分 | ||
3 | + components: { | ||
4 | + desc: '众多组件覆盖开发过程的各个需求,组件功能丰富,多端兼容。让你快速集成,开箱即用' | ||
5 | + }, | ||
6 | + js: { | ||
7 | + desc: '众多的贴心小工具,是你开发过程中召之即来的利器,让你飞镖在手,百步穿杨' | ||
8 | + }, | ||
9 | + template: { | ||
10 | + desc: '收集众多的常用页面和布局,减少开发者的重复工作,让你专注逻辑,事半功倍' | ||
11 | + }, | ||
12 | + nav: { | ||
13 | + components: '组件', | ||
14 | + js: '工具', | ||
15 | + template: '模板' | ||
16 | + }, | ||
17 | + common: { | ||
18 | + intro: '多平台快速开发的UI框架', | ||
19 | + title: 'uView UI', | ||
20 | + }, | ||
21 | +} |
common/md5.js
0 → 100644
1 | +/* | ||
2 | + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message | ||
3 | + * Digest Algorithm, as defined in RFC 1321. | ||
4 | + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. | ||
5 | + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | ||
6 | + * Distributed under the BSD License | ||
7 | + * See http://pajhome.org.uk/crypt/md5 for more info. | ||
8 | + */ | ||
9 | + | ||
10 | +/* | ||
11 | + * Configurable variables. You may need to tweak these to be compatible with | ||
12 | + * the server-side, but the defaults work in most cases. | ||
13 | + */ | ||
14 | +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ | ||
15 | +var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ | ||
16 | +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ | ||
17 | + | ||
18 | +/* | ||
19 | + * These are the functions you'll usually want to call | ||
20 | + * They take string arguments and return either hex or base-64 encoded strings | ||
21 | + */ | ||
22 | +function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} | ||
23 | +function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} | ||
24 | +function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} | ||
25 | +function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } | ||
26 | +function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } | ||
27 | +function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } | ||
28 | + | ||
29 | +/* | ||
30 | + * Perform a simple self-test to see if the VM is working | ||
31 | + */ | ||
32 | +function md5_vm_test() | ||
33 | +{ | ||
34 | + return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; | ||
35 | +} | ||
36 | + | ||
37 | +/* | ||
38 | + * Calculate the MD5 of an array of little-endian words, and a bit length | ||
39 | + */ | ||
40 | +function core_md5(x, len) | ||
41 | +{ | ||
42 | + /* append padding */ | ||
43 | + x[len >> 5] |= 0x80 << ((len) % 32); | ||
44 | + x[(((len + 64) >>> 9) << 4) + 14] = len; | ||
45 | + | ||
46 | + var a = 1732584193; | ||
47 | + var b = -271733879; | ||
48 | + var c = -1732584194; | ||
49 | + var d = 271733878; | ||
50 | + | ||
51 | + for(var i = 0; i < x.length; i += 16) | ||
52 | + { | ||
53 | + var olda = a; | ||
54 | + var oldb = b; | ||
55 | + var oldc = c; | ||
56 | + var oldd = d; | ||
57 | + | ||
58 | + a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); | ||
59 | + d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); | ||
60 | + c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); | ||
61 | + b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); | ||
62 | + a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); | ||
63 | + d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); | ||
64 | + c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); | ||
65 | + b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); | ||
66 | + a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); | ||
67 | + d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); | ||
68 | + c = md5_ff(c, d, a, b, x[i+10], 17, -42063); | ||
69 | + b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); | ||
70 | + a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); | ||
71 | + d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); | ||
72 | + c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); | ||
73 | + b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); | ||
74 | + | ||
75 | + a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); | ||
76 | + d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); | ||
77 | + c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); | ||
78 | + b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); | ||
79 | + a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); | ||
80 | + d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); | ||
81 | + c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); | ||
82 | + b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); | ||
83 | + a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); | ||
84 | + d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); | ||
85 | + c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); | ||
86 | + b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); | ||
87 | + a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); | ||
88 | + d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); | ||
89 | + c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); | ||
90 | + b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); | ||
91 | + | ||
92 | + a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); | ||
93 | + d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); | ||
94 | + c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); | ||
95 | + b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); | ||
96 | + a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); | ||
97 | + d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); | ||
98 | + c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); | ||
99 | + b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); | ||
100 | + a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); | ||
101 | + d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); | ||
102 | + c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); | ||
103 | + b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); | ||
104 | + a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); | ||
105 | + d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); | ||
106 | + c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); | ||
107 | + b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); | ||
108 | + | ||
109 | + a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); | ||
110 | + d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); | ||
111 | + c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); | ||
112 | + b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); | ||
113 | + a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); | ||
114 | + d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); | ||
115 | + c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); | ||
116 | + b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); | ||
117 | + a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); | ||
118 | + d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); | ||
119 | + c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); | ||
120 | + b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); | ||
121 | + a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); | ||
122 | + d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); | ||
123 | + c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); | ||
124 | + b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); | ||
125 | + | ||
126 | + a = safe_add(a, olda); | ||
127 | + b = safe_add(b, oldb); | ||
128 | + c = safe_add(c, oldc); | ||
129 | + d = safe_add(d, oldd); | ||
130 | + } | ||
131 | + return Array(a, b, c, d); | ||
132 | + | ||
133 | +} | ||
134 | + | ||
135 | +/* | ||
136 | + * These functions implement the four basic operations the algorithm uses. | ||
137 | + */ | ||
138 | +function md5_cmn(q, a, b, x, s, t) | ||
139 | +{ | ||
140 | + return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); | ||
141 | +} | ||
142 | +function md5_ff(a, b, c, d, x, s, t) | ||
143 | +{ | ||
144 | + return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); | ||
145 | +} | ||
146 | +function md5_gg(a, b, c, d, x, s, t) | ||
147 | +{ | ||
148 | + return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); | ||
149 | +} | ||
150 | +function md5_hh(a, b, c, d, x, s, t) | ||
151 | +{ | ||
152 | + return md5_cmn(b ^ c ^ d, a, b, x, s, t); | ||
153 | +} | ||
154 | +function md5_ii(a, b, c, d, x, s, t) | ||
155 | +{ | ||
156 | + return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); | ||
157 | +} | ||
158 | + | ||
159 | +/* | ||
160 | + * Calculate the HMAC-MD5, of a key and some data | ||
161 | + */ | ||
162 | +function core_hmac_md5(key, data) | ||
163 | +{ | ||
164 | + var bkey = str2binl(key); | ||
165 | + if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); | ||
166 | + | ||
167 | + var ipad = Array(16), opad = Array(16); | ||
168 | + for(var i = 0; i < 16; i++) | ||
169 | + { | ||
170 | + ipad[i] = bkey[i] ^ 0x36363636; | ||
171 | + opad[i] = bkey[i] ^ 0x5C5C5C5C; | ||
172 | + } | ||
173 | + | ||
174 | + var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); | ||
175 | + return core_md5(opad.concat(hash), 512 + 128); | ||
176 | +} | ||
177 | + | ||
178 | +/* | ||
179 | + * Add integers, wrapping at 2^32. This uses 16-bit operations internally | ||
180 | + * to work around bugs in some JS interpreters. | ||
181 | + */ | ||
182 | +function safe_add(x, y) | ||
183 | +{ | ||
184 | + var lsw = (x & 0xFFFF) + (y & 0xFFFF); | ||
185 | + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | ||
186 | + return (msw << 16) | (lsw & 0xFFFF); | ||
187 | +} | ||
188 | + | ||
189 | +/* | ||
190 | + * Bitwise rotate a 32-bit number to the left. | ||
191 | + */ | ||
192 | +function bit_rol(num, cnt) | ||
193 | +{ | ||
194 | + return (num << cnt) | (num >>> (32 - cnt)); | ||
195 | +} | ||
196 | + | ||
197 | +/* | ||
198 | + * Convert a string to an array of little-endian words | ||
199 | + * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. | ||
200 | + */ | ||
201 | +function str2binl(str) | ||
202 | +{ | ||
203 | + var bin = Array(); | ||
204 | + var mask = (1 << chrsz) - 1; | ||
205 | + for(var i = 0; i < str.length * chrsz; i += chrsz) | ||
206 | + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); | ||
207 | + return bin; | ||
208 | +} | ||
209 | + | ||
210 | +/* | ||
211 | + * Convert an array of little-endian words to a string | ||
212 | + */ | ||
213 | +function binl2str(bin) | ||
214 | +{ | ||
215 | + var str = ""; | ||
216 | + var mask = (1 << chrsz) - 1; | ||
217 | + for(var i = 0; i < bin.length * 32; i += chrsz) | ||
218 | + str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); | ||
219 | + return str; | ||
220 | +} | ||
221 | + | ||
222 | +/* | ||
223 | + * Convert an array of little-endian words to a hex string. | ||
224 | + */ | ||
225 | +function binl2hex(binarray) | ||
226 | +{ | ||
227 | + var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; | ||
228 | + var str = ""; | ||
229 | + for(var i = 0; i < binarray.length * 4; i++) | ||
230 | + { | ||
231 | + str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + | ||
232 | + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); | ||
233 | + } | ||
234 | + return str; | ||
235 | +} | ||
236 | + | ||
237 | +/* | ||
238 | + * Convert an array of little-endian words to a base-64 string | ||
239 | + */ | ||
240 | +function binl2b64(binarray) | ||
241 | +{ | ||
242 | + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | ||
243 | + var str = ""; | ||
244 | + for(var i = 0; i < binarray.length * 4; i += 3) | ||
245 | + { | ||
246 | + var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) | ||
247 | + | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) | ||
248 | + | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); | ||
249 | + for(var j = 0; j < 4; j++) | ||
250 | + { | ||
251 | + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; | ||
252 | + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); | ||
253 | + } | ||
254 | + } | ||
255 | + return str; | ||
256 | +} | ||
257 | + | ||
258 | +module.exports = { | ||
259 | + hex_md5 | ||
260 | +} |
common/mixins/list-mixin.js
0 → 100644
1 | +/** | ||
2 | + * uni-app上拉加载和下拉刷新混合(支持搜索功能) | ||
3 | + * @author maybe | ||
4 | + */ | ||
5 | + | ||
6 | +export default { | ||
7 | + data() { | ||
8 | + return { | ||
9 | + loading: 'loadmore', // 是否加载数据 | ||
10 | + finished: false, // 是否加载完成 | ||
11 | + list: [], // 数据列表 | ||
12 | + page: 0, // 由于分页一般页面要+1,所以为了方便分页查询,这里初始设置页码为0 | ||
13 | + size: 5, // 每页显示的条数 | ||
14 | + total: 0, // 数据总条数 | ||
15 | + search: {}, // 搜索对象 | ||
16 | + tempSearch: {} // 提供给混合初始化搜索对象 | ||
17 | + }; | ||
18 | + }, | ||
19 | + async onLoad(option) { | ||
20 | + // 拷贝搜索初始化对象属性和数据 | ||
21 | + this.tempSearch = _deepClone(this.search); | ||
22 | + // 查询列表 | ||
23 | + // await this._getListFactory(); | ||
24 | + }, | ||
25 | + | ||
26 | + async onShow(option) { | ||
27 | + | ||
28 | + }, | ||
29 | + | ||
30 | + // 下拉刷新 | ||
31 | + async onPullDownRefresh() { | ||
32 | + console.log('下拉刷新'); | ||
33 | + this._initPageData(); | ||
34 | + this._resetSearch(); | ||
35 | + await this._getListFactory(); | ||
36 | + uni.stopPullDownRefresh(); | ||
37 | + }, | ||
38 | + // 上拉加载 | ||
39 | + async onReachBottom() { | ||
40 | + console.log('上拉加载'); | ||
41 | + this._getListFactory(); | ||
42 | + }, | ||
43 | + // 所有混合的方法均已'_'开头 | ||
44 | + methods: { | ||
45 | + async _searchData() { | ||
46 | + this._initPageData(); | ||
47 | + await this._getListFactory(); | ||
48 | + }, | ||
49 | + // 重置搜索 | ||
50 | + _resetSearch() { | ||
51 | + this.search = _deepClone(this.tempSearch) | ||
52 | + // console.log('重置搜索完成', this.search) | ||
53 | + }, | ||
54 | + // 初始化页面的数据 | ||
55 | + _initPageData(size) { | ||
56 | + this.finished = false; | ||
57 | + this.page = 0; | ||
58 | + this.list = []; | ||
59 | + this.size = size || 10; | ||
60 | + this.total = 0; | ||
61 | + }, | ||
62 | + async _getListFactory() { | ||
63 | + // 如果已经全部加载完成直接终止执行 | ||
64 | + if (this.finished) return; | ||
65 | + this.loading = 'loading'; | ||
66 | + this.page++; | ||
67 | + | ||
68 | + await this._getList(); | ||
69 | + | ||
70 | + | ||
71 | + // 判断是否全部加载完成 | ||
72 | + if (this.total == 0) { | ||
73 | + this.finished = true; | ||
74 | + this.loading = 'nomore'; | ||
75 | + } else { | ||
76 | + this.loading = 'loadmore'; | ||
77 | + } | ||
78 | + }, | ||
79 | + // 数据请求方法需要在页面内重写 | ||
80 | + async _getList() {} | ||
81 | + } | ||
82 | +} | ||
83 | +// 深拷贝 | ||
84 | +const _deepClone = (source) => { | ||
85 | + let target; | ||
86 | + if (typeof source === 'object') { | ||
87 | + target = Array.isArray(source) ? [] : {} | ||
88 | + for (let key in source) { | ||
89 | + if (source.hasOwnProperty(key)) { | ||
90 | + if (typeof source[key] !== 'object') { | ||
91 | + target[key] = source[key] | ||
92 | + } else { | ||
93 | + target[key] = _deepClone(source[key]) | ||
94 | + } | ||
95 | + } | ||
96 | + } | ||
97 | + } else { | ||
98 | + target = source | ||
99 | + } | ||
100 | + return target | ||
101 | +}; |
common/nation.js
0 → 100644
1 | +//民族 | ||
2 | +const nation = [{ | ||
3 | + label: '汉族', | ||
4 | + value: '汉族' | ||
5 | + }, | ||
6 | + { | ||
7 | + label: '回族', | ||
8 | + value: '回族' | ||
9 | + }, | ||
10 | + { | ||
11 | + label: '蒙古族', | ||
12 | + value: '蒙古族' | ||
13 | + }, | ||
14 | + { | ||
15 | + label: '藏族', | ||
16 | + value: '藏族' | ||
17 | + }, | ||
18 | + { | ||
19 | + label: '维吾尔族', | ||
20 | + value: '维吾尔族' | ||
21 | + }, | ||
22 | + { | ||
23 | + label: '苗族', | ||
24 | + value: '苗族' | ||
25 | + }, | ||
26 | + { | ||
27 | + label: '彝族', | ||
28 | + value: '彝族' | ||
29 | + }, | ||
30 | + { | ||
31 | + label: '壮族', | ||
32 | + value: '壮族' | ||
33 | + }, | ||
34 | + { | ||
35 | + label: '布依族', | ||
36 | + value: '布依族' | ||
37 | + }, | ||
38 | + { | ||
39 | + label: '朝鲜族', | ||
40 | + value: '朝鲜族' | ||
41 | + }, | ||
42 | + { | ||
43 | + label: '满族', | ||
44 | + value: '满族' | ||
45 | + }, | ||
46 | + { | ||
47 | + label: '侗族', | ||
48 | + value: '侗族' | ||
49 | + }, | ||
50 | + { | ||
51 | + label: '瑶族', | ||
52 | + value: '瑶族' | ||
53 | + }, | ||
54 | + { | ||
55 | + label: '白族', | ||
56 | + value: '白族' | ||
57 | + }, | ||
58 | + { | ||
59 | + label: '土家族', | ||
60 | + value: '土家族' | ||
61 | + }, | ||
62 | + { | ||
63 | + label: '哈尼族', | ||
64 | + value: '哈尼族' | ||
65 | + }, | ||
66 | + { | ||
67 | + label: '哈萨克族', | ||
68 | + value: '哈萨克族' | ||
69 | + }, | ||
70 | + { | ||
71 | + label: '傣族', | ||
72 | + value: '傣族' | ||
73 | + }, | ||
74 | + { | ||
75 | + label: '黎族', | ||
76 | + value: '黎族' | ||
77 | + }, | ||
78 | + { | ||
79 | + label: '傈僳族', | ||
80 | + value: '傈僳族' | ||
81 | + }, | ||
82 | + { | ||
83 | + label: '佤族', | ||
84 | + value: '佤族' | ||
85 | + }, | ||
86 | + { | ||
87 | + label: '畲族', | ||
88 | + value: '畲族' | ||
89 | + }, | ||
90 | + { | ||
91 | + label: '高山族', | ||
92 | + value: '高山族' | ||
93 | + }, | ||
94 | + { | ||
95 | + label: '拉祜族', | ||
96 | + value: '拉祜族' | ||
97 | + }, | ||
98 | + { | ||
99 | + label: '水族', | ||
100 | + value: '水族' | ||
101 | + }, | ||
102 | + { | ||
103 | + label: '东乡族', | ||
104 | + value: '东乡族' | ||
105 | + }, | ||
106 | + { | ||
107 | + label: '纳西族', | ||
108 | + value: '纳西族' | ||
109 | + }, | ||
110 | + { | ||
111 | + label: '景颇族', | ||
112 | + value: '景颇族' | ||
113 | + }, | ||
114 | + { | ||
115 | + label: '柯尔克孜族', | ||
116 | + value: '柯尔克孜族' | ||
117 | + }, | ||
118 | + { | ||
119 | + label: '土族', | ||
120 | + value: '土族' | ||
121 | + }, | ||
122 | + { | ||
123 | + label: '达斡尔族', | ||
124 | + value: '达斡尔族' | ||
125 | + }, | ||
126 | + { | ||
127 | + label: '仫佬族', | ||
128 | + value: '仫佬族' | ||
129 | + }, | ||
130 | + { | ||
131 | + label: '羌族', | ||
132 | + value: '羌族' | ||
133 | + }, | ||
134 | + { | ||
135 | + label: '布朗族', | ||
136 | + value: '布朗族' | ||
137 | + }, | ||
138 | + { | ||
139 | + label: '撒拉族', | ||
140 | + value: '撒拉族' | ||
141 | + }, | ||
142 | + { | ||
143 | + label: '毛南族', | ||
144 | + value: '毛南族' | ||
145 | + }, | ||
146 | + { | ||
147 | + label: '仡佬族', | ||
148 | + value: '仡佬族' | ||
149 | + }, | ||
150 | + { | ||
151 | + label: '锡伯族', | ||
152 | + value: '锡伯族' | ||
153 | + }, | ||
154 | + { | ||
155 | + label: '阿昌族', | ||
156 | + value: '阿昌族' | ||
157 | + }, | ||
158 | + { | ||
159 | + label: '普米族', | ||
160 | + value: '普米族' | ||
161 | + }, | ||
162 | + { | ||
163 | + label: '塔吉克族', | ||
164 | + value: '塔吉克族' | ||
165 | + }, | ||
166 | + { | ||
167 | + label: '怒族', | ||
168 | + value: '怒族' | ||
169 | + }, | ||
170 | + { | ||
171 | + label: '乌孜别克族', | ||
172 | + value: '乌孜别克族' | ||
173 | + }, | ||
174 | + { | ||
175 | + label: '俄罗斯族', | ||
176 | + value: '俄罗斯族' | ||
177 | + }, | ||
178 | + { | ||
179 | + label: '鄂温克族', | ||
180 | + value: '鄂温克族' | ||
181 | + }, | ||
182 | + { | ||
183 | + label: '德昂族', | ||
184 | + value: '德昂族' | ||
185 | + }, | ||
186 | + { | ||
187 | + label: '保安族', | ||
188 | + value: '保安族' | ||
189 | + }, | ||
190 | + { | ||
191 | + label: '裕固族', | ||
192 | + value: '裕固族' | ||
193 | + }, | ||
194 | + { | ||
195 | + label: '京族', | ||
196 | + value: '京族' | ||
197 | + }, | ||
198 | + { | ||
199 | + label: '塔塔尔族', | ||
200 | + value: '塔塔尔族' | ||
201 | + }, | ||
202 | + { | ||
203 | + label: '独龙族', | ||
204 | + value: '独龙族' | ||
205 | + }, | ||
206 | + { | ||
207 | + label: '鄂伦春族', | ||
208 | + value: '鄂伦春族' | ||
209 | + }, | ||
210 | + { | ||
211 | + label: '赫哲族', | ||
212 | + value: '赫哲族' | ||
213 | + }, | ||
214 | + { | ||
215 | + label: '门巴族', | ||
216 | + value: '门巴族' | ||
217 | + }, | ||
218 | + { | ||
219 | + label: '珞巴族', | ||
220 | + value: '珞巴族' | ||
221 | + }, | ||
222 | + { | ||
223 | + label: '基诺族', | ||
224 | + value: '基诺族' | ||
225 | + }, | ||
226 | +] | ||
227 | + | ||
228 | +export default nation; |
common/qqmap-wx-jssdk.js
0 → 100644
1 | +/** | ||
2 | + * 微信小程序JavaScriptSDK | ||
3 | + * | ||
4 | + * @version 1.2 | ||
5 | + * @date 2019-03-06 | ||
6 | + */ | ||
7 | + | ||
8 | +var ERROR_CONF = { | ||
9 | + KEY_ERR: 311, | ||
10 | + KEY_ERR_MSG: 'key格式错误', | ||
11 | + PARAM_ERR: 310, | ||
12 | + PARAM_ERR_MSG: '请求参数信息有误', | ||
13 | + SYSTEM_ERR: 600, | ||
14 | + SYSTEM_ERR_MSG: '系统错误', | ||
15 | + WX_ERR_CODE: 1000, | ||
16 | + WX_OK_CODE: 200 | ||
17 | +}; | ||
18 | +var BASE_URL = 'https://apis.map.qq.com/ws/'; | ||
19 | +var URL_SEARCH = BASE_URL + 'place/v1/search'; | ||
20 | +var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion'; | ||
21 | +var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/'; | ||
22 | +var URL_CITY_LIST = BASE_URL + 'district/v1/list'; | ||
23 | +var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren'; | ||
24 | +var URL_DISTANCE = BASE_URL + 'distance/v1/'; | ||
25 | +var URL_DIRECTION = BASE_URL + 'direction/v1/'; | ||
26 | +var MODE = { | ||
27 | + driving: 'driving', | ||
28 | + transit: 'transit' | ||
29 | +}; | ||
30 | +var EARTH_RADIUS = 6378136.49; | ||
31 | +var Utils = { | ||
32 | + /** | ||
33 | + * md5加密方法 | ||
34 | + * 版权所有©2011 Sebastian Tschan,https://blueimp.net | ||
35 | + */ | ||
36 | + safeAdd(x, y) { | ||
37 | + var lsw = (x & 0xffff) + (y & 0xffff); | ||
38 | + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | ||
39 | + return (msw << 16) | (lsw & 0xffff); | ||
40 | + }, | ||
41 | + bitRotateLeft(num, cnt) { | ||
42 | + return (num << cnt) | (num >>> (32 - cnt)); | ||
43 | + }, | ||
44 | + md5cmn(q, a, b, x, s, t) { | ||
45 | + return this.safeAdd(this.bitRotateLeft(this.safeAdd(this.safeAdd(a, q), this.safeAdd(x, t)), s), b); | ||
46 | + }, | ||
47 | + md5ff(a, b, c, d, x, s, t) { | ||
48 | + return this.md5cmn((b & c) | (~b & d), a, b, x, s, t); | ||
49 | + }, | ||
50 | + md5gg(a, b, c, d, x, s, t) { | ||
51 | + return this.md5cmn((b & d) | (c & ~d), a, b, x, s, t); | ||
52 | + }, | ||
53 | + md5hh(a, b, c, d, x, s, t) { | ||
54 | + return this.md5cmn(b ^ c ^ d, a, b, x, s, t); | ||
55 | + }, | ||
56 | + md5ii(a, b, c, d, x, s, t) { | ||
57 | + return this.md5cmn(c ^ (b | ~d), a, b, x, s, t); | ||
58 | + }, | ||
59 | + binlMD5(x, len) { | ||
60 | + /* append padding */ | ||
61 | + x[len >> 5] |= 0x80 << (len % 32); | ||
62 | + x[((len + 64) >>> 9 << 4) + 14] = len; | ||
63 | + | ||
64 | + var i; | ||
65 | + var olda; | ||
66 | + var oldb; | ||
67 | + var oldc; | ||
68 | + var oldd; | ||
69 | + var a = 1732584193; | ||
70 | + var b = -271733879; | ||
71 | + var c = -1732584194; | ||
72 | + var d = 271733878; | ||
73 | + | ||
74 | + for (i = 0; i < x.length; i += 16) { | ||
75 | + olda = a; | ||
76 | + oldb = b; | ||
77 | + oldc = c; | ||
78 | + oldd = d; | ||
79 | + | ||
80 | + a = this.md5ff(a, b, c, d, x[i], 7, -680876936); | ||
81 | + d = this.md5ff(d, a, b, c, x[i + 1], 12, -389564586); | ||
82 | + c = this.md5ff(c, d, a, b, x[i + 2], 17, 606105819); | ||
83 | + b = this.md5ff(b, c, d, a, x[i + 3], 22, -1044525330); | ||
84 | + a = this.md5ff(a, b, c, d, x[i + 4], 7, -176418897); | ||
85 | + d = this.md5ff(d, a, b, c, x[i + 5], 12, 1200080426); | ||
86 | + c = this.md5ff(c, d, a, b, x[i + 6], 17, -1473231341); | ||
87 | + b = this.md5ff(b, c, d, a, x[i + 7], 22, -45705983); | ||
88 | + a = this.md5ff(a, b, c, d, x[i + 8], 7, 1770035416); | ||
89 | + d = this.md5ff(d, a, b, c, x[i + 9], 12, -1958414417); | ||
90 | + c = this.md5ff(c, d, a, b, x[i + 10], 17, -42063); | ||
91 | + b = this.md5ff(b, c, d, a, x[i + 11], 22, -1990404162); | ||
92 | + a = this.md5ff(a, b, c, d, x[i + 12], 7, 1804603682); | ||
93 | + d = this.md5ff(d, a, b, c, x[i + 13], 12, -40341101); | ||
94 | + c = this.md5ff(c, d, a, b, x[i + 14], 17, -1502002290); | ||
95 | + b = this.md5ff(b, c, d, a, x[i + 15], 22, 1236535329); | ||
96 | + | ||
97 | + a = this.md5gg(a, b, c, d, x[i + 1], 5, -165796510); | ||
98 | + d = this.md5gg(d, a, b, c, x[i + 6], 9, -1069501632); | ||
99 | + c = this.md5gg(c, d, a, b, x[i + 11], 14, 643717713); | ||
100 | + b = this.md5gg(b, c, d, a, x[i], 20, -373897302); | ||
101 | + a = this.md5gg(a, b, c, d, x[i + 5], 5, -701558691); | ||
102 | + d = this.md5gg(d, a, b, c, x[i + 10], 9, 38016083); | ||
103 | + c = this.md5gg(c, d, a, b, x[i + 15], 14, -660478335); | ||
104 | + b = this.md5gg(b, c, d, a, x[i + 4], 20, -405537848); | ||
105 | + a = this.md5gg(a, b, c, d, x[i + 9], 5, 568446438); | ||
106 | + d = this.md5gg(d, a, b, c, x[i + 14], 9, -1019803690); | ||
107 | + c = this.md5gg(c, d, a, b, x[i + 3], 14, -187363961); | ||
108 | + b = this.md5gg(b, c, d, a, x[i + 8], 20, 1163531501); | ||
109 | + a = this.md5gg(a, b, c, d, x[i + 13], 5, -1444681467); | ||
110 | + d = this.md5gg(d, a, b, c, x[i + 2], 9, -51403784); | ||
111 | + c = this.md5gg(c, d, a, b, x[i + 7], 14, 1735328473); | ||
112 | + b = this.md5gg(b, c, d, a, x[i + 12], 20, -1926607734); | ||
113 | + | ||
114 | + a = this.md5hh(a, b, c, d, x[i + 5], 4, -378558); | ||
115 | + d = this.md5hh(d, a, b, c, x[i + 8], 11, -2022574463); | ||
116 | + c = this.md5hh(c, d, a, b, x[i + 11], 16, 1839030562); | ||
117 | + b = this.md5hh(b, c, d, a, x[i + 14], 23, -35309556); | ||
118 | + a = this.md5hh(a, b, c, d, x[i + 1], 4, -1530992060); | ||
119 | + d = this.md5hh(d, a, b, c, x[i + 4], 11, 1272893353); | ||
120 | + c = this.md5hh(c, d, a, b, x[i + 7], 16, -155497632); | ||
121 | + b = this.md5hh(b, c, d, a, x[i + 10], 23, -1094730640); | ||
122 | + a = this.md5hh(a, b, c, d, x[i + 13], 4, 681279174); | ||
123 | + d = this.md5hh(d, a, b, c, x[i], 11, -358537222); | ||
124 | + c = this.md5hh(c, d, a, b, x[i + 3], 16, -722521979); | ||
125 | + b = this.md5hh(b, c, d, a, x[i + 6], 23, 76029189); | ||
126 | + a = this.md5hh(a, b, c, d, x[i + 9], 4, -640364487); | ||
127 | + d = this.md5hh(d, a, b, c, x[i + 12], 11, -421815835); | ||
128 | + c = this.md5hh(c, d, a, b, x[i + 15], 16, 530742520); | ||
129 | + b = this.md5hh(b, c, d, a, x[i + 2], 23, -995338651); | ||
130 | + | ||
131 | + a = this.md5ii(a, b, c, d, x[i], 6, -198630844); | ||
132 | + d = this.md5ii(d, a, b, c, x[i + 7], 10, 1126891415); | ||
133 | + c = this.md5ii(c, d, a, b, x[i + 14], 15, -1416354905); | ||
134 | + b = this.md5ii(b, c, d, a, x[i + 5], 21, -57434055); | ||
135 | + a = this.md5ii(a, b, c, d, x[i + 12], 6, 1700485571); | ||
136 | + d = this.md5ii(d, a, b, c, x[i + 3], 10, -1894986606); | ||
137 | + c = this.md5ii(c, d, a, b, x[i + 10], 15, -1051523); | ||
138 | + b = this.md5ii(b, c, d, a, x[i + 1], 21, -2054922799); | ||
139 | + a = this.md5ii(a, b, c, d, x[i + 8], 6, 1873313359); | ||
140 | + d = this.md5ii(d, a, b, c, x[i + 15], 10, -30611744); | ||
141 | + c = this.md5ii(c, d, a, b, x[i + 6], 15, -1560198380); | ||
142 | + b = this.md5ii(b, c, d, a, x[i + 13], 21, 1309151649); | ||
143 | + a = this.md5ii(a, b, c, d, x[i + 4], 6, -145523070); | ||
144 | + d = this.md5ii(d, a, b, c, x[i + 11], 10, -1120210379); | ||
145 | + c = this.md5ii(c, d, a, b, x[i + 2], 15, 718787259); | ||
146 | + b = this.md5ii(b, c, d, a, x[i + 9], 21, -343485551); | ||
147 | + | ||
148 | + a = this.safeAdd(a, olda); | ||
149 | + b = this.safeAdd(b, oldb); | ||
150 | + c = this.safeAdd(c, oldc); | ||
151 | + d = this.safeAdd(d, oldd); | ||
152 | + } | ||
153 | + return [a, b, c, d]; | ||
154 | + }, | ||
155 | + binl2rstr(input) { | ||
156 | + var i; | ||
157 | + var output = ''; | ||
158 | + var length32 = input.length * 32; | ||
159 | + for (i = 0; i < length32; i += 8) { | ||
160 | + output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff); | ||
161 | + } | ||
162 | + return output; | ||
163 | + }, | ||
164 | + rstr2binl(input) { | ||
165 | + var i; | ||
166 | + var output = []; | ||
167 | + output[(input.length >> 2) - 1] = undefined; | ||
168 | + for (i = 0; i < output.length; i += 1) { | ||
169 | + output[i] = 0; | ||
170 | + } | ||
171 | + var length8 = input.length * 8; | ||
172 | + for (i = 0; i < length8; i += 8) { | ||
173 | + output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32); | ||
174 | + } | ||
175 | + return output; | ||
176 | + }, | ||
177 | + rstrMD5(s) { | ||
178 | + return this.binl2rstr(this.binlMD5(this.rstr2binl(s), s.length * 8)); | ||
179 | + }, | ||
180 | + rstrHMACMD5(key, data) { | ||
181 | + var i; | ||
182 | + var bkey = this.rstr2binl(key); | ||
183 | + var ipad = []; | ||
184 | + var opad = []; | ||
185 | + var hash; | ||
186 | + ipad[15] = opad[15] = undefined; | ||
187 | + if (bkey.length > 16) { | ||
188 | + bkey = this.binlMD5(bkey, key.length * 8); | ||
189 | + } | ||
190 | + for (i = 0; i < 16; i += 1) { | ||
191 | + ipad[i] = bkey[i] ^ 0x36363636; | ||
192 | + opad[i] = bkey[i] ^ 0x5c5c5c5c; | ||
193 | + } | ||
194 | + hash = this.binlMD5(ipad.concat(this.rstr2binl(data)), 512 + data.length * 8); | ||
195 | + return this.binl2rstr(this.binlMD5(opad.concat(hash), 512 + 128)); | ||
196 | + }, | ||
197 | + rstr2hex(input) { | ||
198 | + var hexTab = '0123456789abcdef'; | ||
199 | + var output = ''; | ||
200 | + var x; | ||
201 | + var i; | ||
202 | + for (i = 0; i < input.length; i += 1) { | ||
203 | + x = input.charCodeAt(i); | ||
204 | + output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f); | ||
205 | + } | ||
206 | + return output; | ||
207 | + }, | ||
208 | + str2rstrUTF8(input) { | ||
209 | + return unescape(encodeURIComponent(input)); | ||
210 | + }, | ||
211 | + rawMD5(s) { | ||
212 | + return this.rstrMD5(this.str2rstrUTF8(s)); | ||
213 | + }, | ||
214 | + hexMD5(s) { | ||
215 | + return this.rstr2hex(this.rawMD5(s)); | ||
216 | + }, | ||
217 | + rawHMACMD5(k, d) { | ||
218 | + return this.rstrHMACMD5(this.str2rstrUTF8(k), str2rstrUTF8(d)); | ||
219 | + }, | ||
220 | + hexHMACMD5(k, d) { | ||
221 | + return this.rstr2hex(this.rawHMACMD5(k, d)); | ||
222 | + }, | ||
223 | + | ||
224 | + md5(string, key, raw) { | ||
225 | + if (!key) { | ||
226 | + if (!raw) { | ||
227 | + return this.hexMD5(string); | ||
228 | + } | ||
229 | + return this.rawMD5(string); | ||
230 | + } | ||
231 | + if (!raw) { | ||
232 | + return this.hexHMACMD5(key, string); | ||
233 | + } | ||
234 | + return this.rawHMACMD5(key, string); | ||
235 | + }, | ||
236 | + /** | ||
237 | + * 得到md5加密后的sig参数 | ||
238 | + * @param {Object} requestParam 接口参数 | ||
239 | + * @param {String} sk签名字符串 | ||
240 | + * @param {String} featrue 方法名 | ||
241 | + * @return 返回加密后的sig参数 | ||
242 | + */ | ||
243 | + getSig(requestParam, sk, feature, mode) { | ||
244 | + var sig = null; | ||
245 | + var requestArr = []; | ||
246 | + Object.keys(requestParam).sort().forEach(function(key){ | ||
247 | + requestArr.push(key + '=' + requestParam[key]); | ||
248 | + }); | ||
249 | + if (feature == 'search') { | ||
250 | + sig = '/ws/place/v1/search?' + requestArr.join('&') + sk; | ||
251 | + } | ||
252 | + if (feature == 'suggest') { | ||
253 | + sig = '/ws/place/v1/suggestion?' + requestArr.join('&') + sk; | ||
254 | + } | ||
255 | + if (feature == 'reverseGeocoder') { | ||
256 | + sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk; | ||
257 | + } | ||
258 | + if (feature == 'geocoder') { | ||
259 | + sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk; | ||
260 | + } | ||
261 | + if (feature == 'getCityList') { | ||
262 | + sig = '/ws/district/v1/list?' + requestArr.join('&') + sk; | ||
263 | + } | ||
264 | + if (feature == 'getDistrictByCityId') { | ||
265 | + sig = '/ws/district/v1/getchildren?' + requestArr.join('&') + sk; | ||
266 | + } | ||
267 | + if (feature == 'calculateDistance') { | ||
268 | + sig = '/ws/distance/v1/?' + requestArr.join('&') + sk; | ||
269 | + } | ||
270 | + if (feature == 'direction') { | ||
271 | + sig = '/ws/direction/v1/' + mode + '?' + requestArr.join('&') + sk; | ||
272 | + } | ||
273 | + sig = this.md5(sig); | ||
274 | + return sig; | ||
275 | + }, | ||
276 | + /** | ||
277 | + * 得到终点query字符串 | ||
278 | + * @param {Array|String} 检索数据 | ||
279 | + */ | ||
280 | + location2query(data) { | ||
281 | + if (typeof data == 'string') { | ||
282 | + return data; | ||
283 | + } | ||
284 | + var query = ''; | ||
285 | + for (var i = 0; i < data.length; i++) { | ||
286 | + var d = data[i]; | ||
287 | + if (!!query) { | ||
288 | + query += ';'; | ||
289 | + } | ||
290 | + if (d.location) { | ||
291 | + query = query + d.location.lat + ',' + d.location.lng; | ||
292 | + } | ||
293 | + if (d.latitude && d.longitude) { | ||
294 | + query = query + d.latitude + ',' + d.longitude; | ||
295 | + } | ||
296 | + } | ||
297 | + return query; | ||
298 | + }, | ||
299 | + | ||
300 | + /** | ||
301 | + * 计算角度 | ||
302 | + */ | ||
303 | + rad(d) { | ||
304 | + return d * Math.PI / 180.0; | ||
305 | + }, | ||
306 | + /** | ||
307 | + * 处理终点location数组 | ||
308 | + * @return 返回终点数组 | ||
309 | + */ | ||
310 | + getEndLocation(location){ | ||
311 | + var to = location.split(';'); | ||
312 | + var endLocation = []; | ||
313 | + for (var i = 0; i < to.length; i++) { | ||
314 | + endLocation.push({ | ||
315 | + lat: parseFloat(to[i].split(',')[0]), | ||
316 | + lng: parseFloat(to[i].split(',')[1]) | ||
317 | + }) | ||
318 | + } | ||
319 | + return endLocation; | ||
320 | + }, | ||
321 | + | ||
322 | + /** | ||
323 | + * 计算两点间直线距离 | ||
324 | + * @param a 表示纬度差 | ||
325 | + * @param b 表示经度差 | ||
326 | + * @return 返回的是距离,单位m | ||
327 | + */ | ||
328 | + getDistance(latFrom, lngFrom, latTo, lngTo) { | ||
329 | + var radLatFrom = this.rad(latFrom); | ||
330 | + var radLatTo = this.rad(latTo); | ||
331 | + var a = radLatFrom - radLatTo; | ||
332 | + var b = this.rad(lngFrom) - this.rad(lngTo); | ||
333 | + var distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLatFrom) * Math.cos(radLatTo) * Math.pow(Math.sin(b / 2), 2))); | ||
334 | + distance = distance * EARTH_RADIUS; | ||
335 | + distance = Math.round(distance * 10000) / 10000; | ||
336 | + return parseFloat(distance.toFixed(0)); | ||
337 | + }, | ||
338 | + /** | ||
339 | + * 使用微信接口进行定位 | ||
340 | + */ | ||
341 | + getWXLocation(success, fail, complete) { | ||
342 | + wx.getLocation({ | ||
343 | + type: 'gcj02', | ||
344 | + success: success, | ||
345 | + fail: fail, | ||
346 | + complete: complete | ||
347 | + }); | ||
348 | + }, | ||
349 | + | ||
350 | + /** | ||
351 | + * 获取location参数 | ||
352 | + */ | ||
353 | + getLocationParam(location) { | ||
354 | + if (typeof location == 'string') { | ||
355 | + var locationArr = location.split(','); | ||
356 | + if (locationArr.length === 2) { | ||
357 | + location = { | ||
358 | + latitude: location.split(',')[0], | ||
359 | + longitude: location.split(',')[1] | ||
360 | + }; | ||
361 | + } else { | ||
362 | + location = {}; | ||
363 | + } | ||
364 | + } | ||
365 | + return location; | ||
366 | + }, | ||
367 | + | ||
368 | + /** | ||
369 | + * 回调函数默认处理 | ||
370 | + */ | ||
371 | + polyfillParam(param) { | ||
372 | + param.success = param.success || function () { }; | ||
373 | + param.fail = param.fail || function () { }; | ||
374 | + param.complete = param.complete || function () { }; | ||
375 | + }, | ||
376 | + | ||
377 | + /** | ||
378 | + * 验证param对应的key值是否为空 | ||
379 | + * | ||
380 | + * @param {Object} param 接口参数 | ||
381 | + * @param {String} key 对应参数的key | ||
382 | + */ | ||
383 | + checkParamKeyEmpty(param, key) { | ||
384 | + if (!param[key]) { | ||
385 | + var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key +'参数格式有误'); | ||
386 | + param.fail(errconf); | ||
387 | + param.complete(errconf); | ||
388 | + return true; | ||
389 | + } | ||
390 | + return false; | ||
391 | + }, | ||
392 | + | ||
393 | + /** | ||
394 | + * 验证参数中是否存在检索词keyword | ||
395 | + * | ||
396 | + * @param {Object} param 接口参数 | ||
397 | + */ | ||
398 | + checkKeyword(param){ | ||
399 | + return !this.checkParamKeyEmpty(param, 'keyword'); | ||
400 | + }, | ||
401 | + | ||
402 | + /** | ||
403 | + * 验证location值 | ||
404 | + * | ||
405 | + * @param {Object} param 接口参数 | ||
406 | + */ | ||
407 | + checkLocation(param) { | ||
408 | + var location = this.getLocationParam(param.location); | ||
409 | + if (!location || !location.latitude || !location.longitude) { | ||
410 | + var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误'); | ||
411 | + param.fail(errconf); | ||
412 | + param.complete(errconf); | ||
413 | + return false; | ||
414 | + } | ||
415 | + return true; | ||
416 | + }, | ||
417 | + | ||
418 | + /** | ||
419 | + * 构造错误数据结构 | ||
420 | + * @param {Number} errCode 错误码 | ||
421 | + * @param {Number} errMsg 错误描述 | ||
422 | + */ | ||
423 | + buildErrorConfig(errCode, errMsg) { | ||
424 | + return { | ||
425 | + status: errCode, | ||
426 | + message: errMsg | ||
427 | + }; | ||
428 | + }, | ||
429 | + | ||
430 | + /** | ||
431 | + * | ||
432 | + * 数据处理函数 | ||
433 | + * 根据传入参数不同处理不同数据 | ||
434 | + * @param {String} feature 功能名称 | ||
435 | + * search 地点搜索 | ||
436 | + * suggest关键词提示 | ||
437 | + * reverseGeocoder逆地址解析 | ||
438 | + * geocoder地址解析 | ||
439 | + * getCityList获取城市列表:父集 | ||
440 | + * getDistrictByCityId获取区县列表:子集 | ||
441 | + * calculateDistance距离计算 | ||
442 | + * @param {Object} param 接口参数 | ||
443 | + * @param {Object} data 数据 | ||
444 | + */ | ||
445 | + handleData(param,data,feature){ | ||
446 | + if (feature == 'search') { | ||
447 | + var searchResult = data.data; | ||
448 | + var searchSimplify = []; | ||
449 | + for (var i = 0; i < searchResult.length; i++) { | ||
450 | + searchSimplify.push({ | ||
451 | + id: searchResult[i].id || null, | ||
452 | + title: searchResult[i].title || null, | ||
453 | + latitude: searchResult[i].location && searchResult[i].location.lat || null, | ||
454 | + longitude: searchResult[i].location && searchResult[i].location.lng || null, | ||
455 | + address: searchResult[i].address || null, | ||
456 | + category: searchResult[i].category || null, | ||
457 | + tel: searchResult[i].tel || null, | ||
458 | + adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null, | ||
459 | + city: searchResult[i].ad_info && searchResult[i].ad_info.city || null, | ||
460 | + district: searchResult[i].ad_info && searchResult[i].ad_info.district || null, | ||
461 | + province: searchResult[i].ad_info && searchResult[i].ad_info.province || null | ||
462 | + }) | ||
463 | + } | ||
464 | + param.success(data, { | ||
465 | + searchResult: searchResult, | ||
466 | + searchSimplify: searchSimplify | ||
467 | + }) | ||
468 | + } else if (feature == 'suggest') { | ||
469 | + var suggestResult = data.data; | ||
470 | + var suggestSimplify = []; | ||
471 | + for (var i = 0; i < suggestResult.length; i++) { | ||
472 | + suggestSimplify.push({ | ||
473 | + adcode: suggestResult[i].adcode || null, | ||
474 | + address: suggestResult[i].address || null, | ||
475 | + category: suggestResult[i].category || null, | ||
476 | + city: suggestResult[i].city || null, | ||
477 | + district: suggestResult[i].district || null, | ||
478 | + id: suggestResult[i].id || null, | ||
479 | + latitude: suggestResult[i].location && suggestResult[i].location.lat || null, | ||
480 | + longitude: suggestResult[i].location && suggestResult[i].location.lng || null, | ||
481 | + province: suggestResult[i].province || null, | ||
482 | + title: suggestResult[i].title || null, | ||
483 | + type: suggestResult[i].type || null | ||
484 | + }) | ||
485 | + } | ||
486 | + param.success(data, { | ||
487 | + suggestResult: suggestResult, | ||
488 | + suggestSimplify: suggestSimplify | ||
489 | + }) | ||
490 | + } else if (feature == 'reverseGeocoder') { | ||
491 | + var reverseGeocoderResult = data.result; | ||
492 | + var reverseGeocoderSimplify = { | ||
493 | + address: reverseGeocoderResult.address || null, | ||
494 | + latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null, | ||
495 | + longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null, | ||
496 | + adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null, | ||
497 | + city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city || null, | ||
498 | + district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.district || null, | ||
499 | + nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.nation || null, | ||
500 | + province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.province || null, | ||
501 | + street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street || null, | ||
502 | + street_number: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street_number || null, | ||
503 | + recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.recommend || null, | ||
504 | + rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.rough || null | ||
505 | + }; | ||
506 | + if (reverseGeocoderResult.pois) {//判断是否返回周边poi | ||
507 | + var pois = reverseGeocoderResult.pois; | ||
508 | + var poisSimplify = []; | ||
509 | + for (var i = 0;i < pois.length;i++) { | ||
510 | + poisSimplify.push({ | ||
511 | + id: pois[i].id || null, | ||
512 | + title: pois[i].title || null, | ||
513 | + latitude: pois[i].location && pois[i].location.lat || null, | ||
514 | + longitude: pois[i].location && pois[i].location.lng || null, | ||
515 | + address: pois[i].address || null, | ||
516 | + category: pois[i].category || null, | ||
517 | + adcode: pois[i].ad_info && pois[i].ad_info.adcode || null, | ||
518 | + city: pois[i].ad_info && pois[i].ad_info.city || null, | ||
519 | + district: pois[i].ad_info && pois[i].ad_info.district || null, | ||
520 | + province: pois[i].ad_info && pois[i].ad_info.province || null | ||
521 | + }) | ||
522 | + } | ||
523 | + param.success(data,{ | ||
524 | + reverseGeocoderResult: reverseGeocoderResult, | ||
525 | + reverseGeocoderSimplify: reverseGeocoderSimplify, | ||
526 | + pois: pois, | ||
527 | + poisSimplify: poisSimplify | ||
528 | + }) | ||
529 | + } else { | ||
530 | + param.success(data, { | ||
531 | + reverseGeocoderResult: reverseGeocoderResult, | ||
532 | + reverseGeocoderSimplify: reverseGeocoderSimplify | ||
533 | + }) | ||
534 | + } | ||
535 | + } else if (feature == 'geocoder') { | ||
536 | + var geocoderResult = data.result; | ||
537 | + var geocoderSimplify = { | ||
538 | + title: geocoderResult.title || null, | ||
539 | + latitude: geocoderResult.location && geocoderResult.location.lat || null, | ||
540 | + longitude: geocoderResult.location && geocoderResult.location.lng || null, | ||
541 | + adcode: geocoderResult.ad_info && geocoderResult.ad_info.adcode || null, | ||
542 | + province: geocoderResult.address_components && geocoderResult.address_components.province || null, | ||
543 | + city: geocoderResult.address_components && geocoderResult.address_components.city || null, | ||
544 | + district: geocoderResult.address_components && geocoderResult.address_components.district || null, | ||
545 | + street: geocoderResult.address_components && geocoderResult.address_components.street || null, | ||
546 | + street_number: geocoderResult.address_components && geocoderResult.address_components.street_number || null, | ||
547 | + level: geocoderResult.level || null | ||
548 | + }; | ||
549 | + param.success(data,{ | ||
550 | + geocoderResult: geocoderResult, | ||
551 | + geocoderSimplify: geocoderSimplify | ||
552 | + }); | ||
553 | + } else if (feature == 'getCityList') { | ||
554 | + var provinceResult = data.result[0]; | ||
555 | + var cityResult = data.result[1]; | ||
556 | + var districtResult = data.result[2]; | ||
557 | + param.success(data,{ | ||
558 | + provinceResult: provinceResult, | ||
559 | + cityResult: cityResult, | ||
560 | + districtResult: districtResult | ||
561 | + }); | ||
562 | + } else if (feature == 'getDistrictByCityId') { | ||
563 | + var districtByCity = data.result[0]; | ||
564 | + param.success(data, districtByCity); | ||
565 | + } else if (feature == 'calculateDistance') { | ||
566 | + var calculateDistanceResult = data.result.elements; | ||
567 | + var distance = []; | ||
568 | + for (var i = 0; i < calculateDistanceResult.length; i++){ | ||
569 | + distance.push(calculateDistanceResult[i].distance); | ||
570 | + } | ||
571 | + param.success(data, { | ||
572 | + calculateDistanceResult: calculateDistanceResult, | ||
573 | + distance: distance | ||
574 | + }); | ||
575 | + } else if (feature == 'direction') { | ||
576 | + var direction = data.result.routes; | ||
577 | + param.success(data,direction); | ||
578 | + } else { | ||
579 | + param.success(data); | ||
580 | + } | ||
581 | + }, | ||
582 | + | ||
583 | + /** | ||
584 | + * 构造微信请求参数,公共属性处理 | ||
585 | + * | ||
586 | + * @param {Object} param 接口参数 | ||
587 | + * @param {Object} param 配置项 | ||
588 | + * @param {String} feature 方法名 | ||
589 | + */ | ||
590 | + buildWxRequestConfig(param, options, feature) { | ||
591 | + var that = this; | ||
592 | + options.header = { "content-type": "application/json" }; | ||
593 | + options.method = 'GET'; | ||
594 | + options.success = function (res) { | ||
595 | + var data = res.data; | ||
596 | + if (data.status === 0) { | ||
597 | + that.handleData(param, data, feature); | ||
598 | + } else { | ||
599 | + param.fail(data); | ||
600 | + } | ||
601 | + }; | ||
602 | + options.fail = function (res) { | ||
603 | + res.statusCode = ERROR_CONF.WX_ERR_CODE; | ||
604 | + param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); | ||
605 | + }; | ||
606 | + options.complete = function (res) { | ||
607 | + var statusCode = +res.statusCode; | ||
608 | + switch(statusCode) { | ||
609 | + case ERROR_CONF.WX_ERR_CODE: { | ||
610 | + param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); | ||
611 | + break; | ||
612 | + } | ||
613 | + case ERROR_CONF.WX_OK_CODE: { | ||
614 | + var data = res.data; | ||
615 | + if (data.status === 0) { | ||
616 | + param.complete(data); | ||
617 | + } else { | ||
618 | + param.complete(that.buildErrorConfig(data.status, data.message)); | ||
619 | + } | ||
620 | + break; | ||
621 | + } | ||
622 | + default:{ | ||
623 | + param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG)); | ||
624 | + } | ||
625 | + | ||
626 | + } | ||
627 | + }; | ||
628 | + return options; | ||
629 | + }, | ||
630 | + | ||
631 | + /** | ||
632 | + * 处理用户参数是否传入坐标进行不同的处理 | ||
633 | + */ | ||
634 | + locationProcess(param, locationsuccess, locationfail, locationcomplete) { | ||
635 | + var that = this; | ||
636 | + locationfail = locationfail || function (res) { | ||
637 | + res.statusCode = ERROR_CONF.WX_ERR_CODE; | ||
638 | + param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); | ||
639 | + }; | ||
640 | + locationcomplete = locationcomplete || function (res) { | ||
641 | + if (res.statusCode == ERROR_CONF.WX_ERR_CODE) { | ||
642 | + param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); | ||
643 | + } | ||
644 | + }; | ||
645 | + if (!param.location) { | ||
646 | + that.getWXLocation(locationsuccess, locationfail, locationcomplete); | ||
647 | + } else if (that.checkLocation(param)) { | ||
648 | + var location = Utils.getLocationParam(param.location); | ||
649 | + locationsuccess(location); | ||
650 | + } | ||
651 | + } | ||
652 | +}; | ||
653 | + | ||
654 | + | ||
655 | +class QQMapWX { | ||
656 | + | ||
657 | + /** | ||
658 | + * 构造函数 | ||
659 | + * | ||
660 | + * @param {Object} options 接口参数,key 为必选参数 | ||
661 | + */ | ||
662 | + constructor(options) { | ||
663 | + if (!options.key) { | ||
664 | + throw Error('key值不能为空'); | ||
665 | + } | ||
666 | + this.key = options.key; | ||
667 | + }; | ||
668 | + | ||
669 | + /** | ||
670 | + * POI周边检索 | ||
671 | + * | ||
672 | + * @param {Object} options 接口参数对象 | ||
673 | + * | ||
674 | + * 参数对象结构可以参考 | ||
675 | + * @see http://lbs.qq.com/webservice_v1/guide-search.html | ||
676 | + */ | ||
677 | + search(options) { | ||
678 | + var that = this; | ||
679 | + options = options || {}; | ||
680 | + | ||
681 | + Utils.polyfillParam(options); | ||
682 | + | ||
683 | + if (!Utils.checkKeyword(options)) { | ||
684 | + return; | ||
685 | + } | ||
686 | + | ||
687 | + var requestParam = { | ||
688 | + keyword: options.keyword, | ||
689 | + orderby: options.orderby || '_distance', | ||
690 | + page_size: options.page_size || 10, | ||
691 | + page_index: options.page_index || 1, | ||
692 | + output: 'json', | ||
693 | + key: that.key | ||
694 | + }; | ||
695 | + | ||
696 | + if (options.address_format) { | ||
697 | + requestParam.address_format = options.address_format; | ||
698 | + } | ||
699 | + | ||
700 | + if (options.filter) { | ||
701 | + requestParam.filter = options.filter; | ||
702 | + } | ||
703 | + | ||
704 | + var distance = options.distance || "1000"; | ||
705 | + var auto_extend = options.auto_extend || 1; | ||
706 | + var region = null; | ||
707 | + var rectangle = null; | ||
708 | + | ||
709 | + //判断城市限定参数 | ||
710 | + if (options.region) { | ||
711 | + region = options.region; | ||
712 | + } | ||
713 | + | ||
714 | + //矩形限定坐标(暂时只支持字符串格式) | ||
715 | + if (options.rectangle) { | ||
716 | + rectangle = options.rectangle; | ||
717 | + } | ||
718 | + | ||
719 | + var locationsuccess = function (result) { | ||
720 | + if (region && !rectangle) { | ||
721 | + //城市限定参数拼接 | ||
722 | + requestParam.boundary = "region(" + region + "," + auto_extend + "," + result.latitude + "," + result.longitude + ")"; | ||
723 | + if (options.sig) { | ||
724 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'search'); | ||
725 | + } | ||
726 | + } else if (rectangle && !region) { | ||
727 | + //矩形搜索 | ||
728 | + requestParam.boundary = "rectangle(" + rectangle + ")"; | ||
729 | + if (options.sig) { | ||
730 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'search'); | ||
731 | + } | ||
732 | + } else { | ||
733 | + requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend + ")"; | ||
734 | + if (options.sig) { | ||
735 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'search'); | ||
736 | + } | ||
737 | + } | ||
738 | + wx.request(Utils.buildWxRequestConfig(options, { | ||
739 | + url: URL_SEARCH, | ||
740 | + data: requestParam | ||
741 | + }, 'search')); | ||
742 | + }; | ||
743 | + Utils.locationProcess(options, locationsuccess); | ||
744 | + }; | ||
745 | + | ||
746 | + /** | ||
747 | + * sug模糊检索 | ||
748 | + * | ||
749 | + * @param {Object} options 接口参数对象 | ||
750 | + * | ||
751 | + * 参数对象结构可以参考 | ||
752 | + * http://lbs.qq.com/webservice_v1/guide-suggestion.html | ||
753 | + */ | ||
754 | + getSuggestion(options) { | ||
755 | + var that = this; | ||
756 | + options = options || {}; | ||
757 | + Utils.polyfillParam(options); | ||
758 | + | ||
759 | + if (!Utils.checkKeyword(options)) { | ||
760 | + return; | ||
761 | + } | ||
762 | + | ||
763 | + var requestParam = { | ||
764 | + keyword: options.keyword, | ||
765 | + region: options.region || '全国', | ||
766 | + region_fix: options.region_fix || 0, | ||
767 | + policy: options.policy || 0, | ||
768 | + page_size: options.page_size || 10,//控制显示条数 | ||
769 | + page_index: options.page_index || 1,//控制页数 | ||
770 | + get_subpois : options.get_subpois || 0,//返回子地点 | ||
771 | + output: 'json', | ||
772 | + key: that.key | ||
773 | + }; | ||
774 | + //长地址 | ||
775 | + if (options.address_format) { | ||
776 | + requestParam.address_format = options.address_format; | ||
777 | + } | ||
778 | + //过滤 | ||
779 | + if (options.filter) { | ||
780 | + requestParam.filter = options.filter; | ||
781 | + } | ||
782 | + //排序 | ||
783 | + if (options.location) { | ||
784 | + var locationsuccess = function (result) { | ||
785 | + requestParam.location = result.latitude + ',' + result.longitude; | ||
786 | + if (options.sig) { | ||
787 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest'); | ||
788 | + } | ||
789 | + wx.request(Utils.buildWxRequestConfig(options, { | ||
790 | + url: URL_SUGGESTION, | ||
791 | + data: requestParam | ||
792 | + }, "suggest")); | ||
793 | + }; | ||
794 | + Utils.locationProcess(options, locationsuccess); | ||
795 | + } else { | ||
796 | + if (options.sig) { | ||
797 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest'); | ||
798 | + } | ||
799 | + wx.request(Utils.buildWxRequestConfig(options, { | ||
800 | + url: URL_SUGGESTION, | ||
801 | + data: requestParam | ||
802 | + }, "suggest")); | ||
803 | + } | ||
804 | + }; | ||
805 | + | ||
806 | + /** | ||
807 | + * 逆地址解析 | ||
808 | + * | ||
809 | + * @param {Object} options 接口参数对象 | ||
810 | + * | ||
811 | + * 请求参数结构可以参考 | ||
812 | + * http://lbs.qq.com/webservice_v1/guide-gcoder.html | ||
813 | + */ | ||
814 | + reverseGeocoder(options) { | ||
815 | + var that = this; | ||
816 | + options = options || {}; | ||
817 | + Utils.polyfillParam(options); | ||
818 | + var requestParam = { | ||
819 | + coord_type: options.coord_type || 5, | ||
820 | + get_poi: options.get_poi || 0, | ||
821 | + output: 'json', | ||
822 | + key: that.key | ||
823 | + }; | ||
824 | + if (options.poi_options) { | ||
825 | + requestParam.poi_options = options.poi_options | ||
826 | + } | ||
827 | + | ||
828 | + var locationsuccess = function (result) { | ||
829 | + requestParam.location = result.latitude + ',' + result.longitude; | ||
830 | + if (options.sig) { | ||
831 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'reverseGeocoder'); | ||
832 | + } | ||
833 | + wx.request(Utils.buildWxRequestConfig(options, { | ||
834 | + url: URL_GET_GEOCODER, | ||
835 | + data: requestParam | ||
836 | + }, 'reverseGeocoder')); | ||
837 | + }; | ||
838 | + Utils.locationProcess(options, locationsuccess); | ||
839 | + }; | ||
840 | + | ||
841 | + /** | ||
842 | + * 地址解析 | ||
843 | + * | ||
844 | + * @param {Object} options 接口参数对象 | ||
845 | + * | ||
846 | + * 请求参数结构可以参考 | ||
847 | + * http://lbs.qq.com/webservice_v1/guide-geocoder.html | ||
848 | + */ | ||
849 | + geocoder(options) { | ||
850 | + var that = this; | ||
851 | + options = options || {}; | ||
852 | + Utils.polyfillParam(options); | ||
853 | + | ||
854 | + if (Utils.checkParamKeyEmpty(options, 'address')) { | ||
855 | + return; | ||
856 | + } | ||
857 | + | ||
858 | + var requestParam = { | ||
859 | + address: options.address, | ||
860 | + output: 'json', | ||
861 | + key: that.key | ||
862 | + }; | ||
863 | + | ||
864 | + //城市限定 | ||
865 | + if (options.region) { | ||
866 | + requestParam.region = options.region; | ||
867 | + } | ||
868 | + | ||
869 | + if (options.sig) { | ||
870 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'geocoder'); | ||
871 | + } | ||
872 | + | ||
873 | + wx.request(Utils.buildWxRequestConfig(options, { | ||
874 | + url: URL_GET_GEOCODER, | ||
875 | + data: requestParam | ||
876 | + },'geocoder')); | ||
877 | + }; | ||
878 | + | ||
879 | + | ||
880 | + /** | ||
881 | + * 获取城市列表 | ||
882 | + * | ||
883 | + * @param {Object} options 接口参数对象 | ||
884 | + * | ||
885 | + * 请求参数结构可以参考 | ||
886 | + * http://lbs.qq.com/webservice_v1/guide-region.html | ||
887 | + */ | ||
888 | + getCityList(options) { | ||
889 | + var that = this; | ||
890 | + options = options || {}; | ||
891 | + Utils.polyfillParam(options); | ||
892 | + var requestParam = { | ||
893 | + output: 'json', | ||
894 | + key: that.key | ||
895 | + }; | ||
896 | + | ||
897 | + if (options.sig) { | ||
898 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'getCityList'); | ||
899 | + } | ||
900 | + | ||
901 | + wx.request(Utils.buildWxRequestConfig(options, { | ||
902 | + url: URL_CITY_LIST, | ||
903 | + data: requestParam | ||
904 | + },'getCityList')); | ||
905 | + }; | ||
906 | + | ||
907 | + /** | ||
908 | + * 获取对应城市ID的区县列表 | ||
909 | + * | ||
910 | + * @param {Object} options 接口参数对象 | ||
911 | + * | ||
912 | + * 请求参数结构可以参考 | ||
913 | + * http://lbs.qq.com/webservice_v1/guide-region.html | ||
914 | + */ | ||
915 | + getDistrictByCityId(options) { | ||
916 | + var that = this; | ||
917 | + options = options || {}; | ||
918 | + Utils.polyfillParam(options); | ||
919 | + | ||
920 | + if (Utils.checkParamKeyEmpty(options, 'id')) { | ||
921 | + return; | ||
922 | + } | ||
923 | + | ||
924 | + var requestParam = { | ||
925 | + id: options.id || '', | ||
926 | + output: 'json', | ||
927 | + key: that.key | ||
928 | + }; | ||
929 | + | ||
930 | + if (options.sig) { | ||
931 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'getDistrictByCityId'); | ||
932 | + } | ||
933 | + | ||
934 | + wx.request(Utils.buildWxRequestConfig(options, { | ||
935 | + url: URL_AREA_LIST, | ||
936 | + data: requestParam | ||
937 | + },'getDistrictByCityId')); | ||
938 | + }; | ||
939 | + | ||
940 | + /** | ||
941 | + * 用于单起点到多终点的路线距离(非直线距离)计算: | ||
942 | + * 支持两种距离计算方式:步行和驾车。 | ||
943 | + * 起点到终点最大限制直线距离10公里。 | ||
944 | + * | ||
945 | + * 新增直线距离计算。 | ||
946 | + * | ||
947 | + * @param {Object} options 接口参数对象 | ||
948 | + * | ||
949 | + * 请求参数结构可以参考 | ||
950 | + * http://lbs.qq.com/webservice_v1/guide-distance.html | ||
951 | + */ | ||
952 | + calculateDistance(options) { | ||
953 | + var that = this; | ||
954 | + options = options || {}; | ||
955 | + Utils.polyfillParam(options); | ||
956 | + | ||
957 | + if (Utils.checkParamKeyEmpty(options, 'to')) { | ||
958 | + return; | ||
959 | + } | ||
960 | + | ||
961 | + var requestParam = { | ||
962 | + mode: options.mode || 'walking', | ||
963 | + to: Utils.location2query(options.to), | ||
964 | + output: 'json', | ||
965 | + key: that.key | ||
966 | + }; | ||
967 | + | ||
968 | + if (options.from) { | ||
969 | + options.location = options.from; | ||
970 | + } | ||
971 | + | ||
972 | + //计算直线距离 | ||
973 | + if(requestParam.mode == 'straight'){ | ||
974 | + var locationsuccess = function (result) { | ||
975 | + var locationTo = Utils.getEndLocation(requestParam.to);//处理终点坐标 | ||
976 | + var data = { | ||
977 | + message:"query ok", | ||
978 | + result:{ | ||
979 | + elements:[] | ||
980 | + }, | ||
981 | + status:0 | ||
982 | + }; | ||
983 | + for (var i = 0; i < locationTo.length; i++) { | ||
984 | + data.result.elements.push({//将坐标存入 | ||
985 | + distance: Utils.getDistance(result.latitude, result.longitude, locationTo[i].lat, locationTo[i].lng), | ||
986 | + duration:0, | ||
987 | + from:{ | ||
988 | + lat: result.latitude, | ||
989 | + lng:result.longitude | ||
990 | + }, | ||
991 | + to:{ | ||
992 | + lat: locationTo[i].lat, | ||
993 | + lng: locationTo[i].lng | ||
994 | + } | ||
995 | + }); | ||
996 | + } | ||
997 | + var calculateResult = data.result.elements; | ||
998 | + var distanceResult = []; | ||
999 | + for (var i = 0; i < calculateResult.length; i++) { | ||
1000 | + distanceResult.push(calculateResult[i].distance); | ||
1001 | + } | ||
1002 | + return options.success(data,{ | ||
1003 | + calculateResult: calculateResult, | ||
1004 | + distanceResult: distanceResult | ||
1005 | + }); | ||
1006 | + }; | ||
1007 | + | ||
1008 | + Utils.locationProcess(options, locationsuccess); | ||
1009 | + } else { | ||
1010 | + var locationsuccess = function (result) { | ||
1011 | + requestParam.from = result.latitude + ',' + result.longitude; | ||
1012 | + if (options.sig) { | ||
1013 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'calculateDistance'); | ||
1014 | + } | ||
1015 | + wx.request(Utils.buildWxRequestConfig(options, { | ||
1016 | + url: URL_DISTANCE, | ||
1017 | + data: requestParam | ||
1018 | + },'calculateDistance')); | ||
1019 | + }; | ||
1020 | + | ||
1021 | + Utils.locationProcess(options, locationsuccess); | ||
1022 | + } | ||
1023 | + }; | ||
1024 | + | ||
1025 | + /** | ||
1026 | + * 路线规划: | ||
1027 | + * | ||
1028 | + * @param {Object} options 接口参数对象 | ||
1029 | + * | ||
1030 | + * 请求参数结构可以参考 | ||
1031 | + * https://lbs.qq.com/webservice_v1/guide-road.html | ||
1032 | + */ | ||
1033 | + direction(options) { | ||
1034 | + var that = this; | ||
1035 | + options = options || {}; | ||
1036 | + Utils.polyfillParam(options); | ||
1037 | + | ||
1038 | + if (Utils.checkParamKeyEmpty(options, 'to')) { | ||
1039 | + return; | ||
1040 | + } | ||
1041 | + | ||
1042 | + var requestParam = { | ||
1043 | + output: 'json', | ||
1044 | + key: that.key | ||
1045 | + }; | ||
1046 | + | ||
1047 | + //to格式处理 | ||
1048 | + if (typeof options.to == 'string') { | ||
1049 | + requestParam.to = options.to; | ||
1050 | + } else { | ||
1051 | + requestParam.to = options.to.latitude + ',' + options.to.longitude; | ||
1052 | + } | ||
1053 | + //初始化局部请求域名 | ||
1054 | + var SET_URL_DIRECTION = null; | ||
1055 | + //设置默认mode属性 | ||
1056 | + options.mode = options.mode || MODE.driving; | ||
1057 | + | ||
1058 | + //设置请求域名 | ||
1059 | + SET_URL_DIRECTION = URL_DIRECTION + options.mode; | ||
1060 | + | ||
1061 | + if (options.from) { | ||
1062 | + options.location = options.from; | ||
1063 | + } | ||
1064 | + | ||
1065 | + if (options.mode == MODE.driving) { | ||
1066 | + if (options.from_poi) { | ||
1067 | + requestParam.from_poi = options.from_poi; | ||
1068 | + } | ||
1069 | + if (options.heading) { | ||
1070 | + requestParam.heading = options.heading; | ||
1071 | + } | ||
1072 | + if (options.speed) { | ||
1073 | + requestParam.speed = options.speed; | ||
1074 | + } | ||
1075 | + if (options.accuracy) { | ||
1076 | + requestParam.accuracy = options.accuracy; | ||
1077 | + } | ||
1078 | + if (options.road_type) { | ||
1079 | + requestParam.road_type = options.road_type; | ||
1080 | + } | ||
1081 | + if (options.to_poi) { | ||
1082 | + requestParam.to_poi = options.to_poi; | ||
1083 | + } | ||
1084 | + if (options.from_track) { | ||
1085 | + requestParam.from_track = options.from_track; | ||
1086 | + } | ||
1087 | + if (options.waypoints) { | ||
1088 | + requestParam.waypoints = options.waypoints; | ||
1089 | + } | ||
1090 | + if (options.policy) { | ||
1091 | + requestParam.policy = options.policy; | ||
1092 | + } | ||
1093 | + if (options.plate_number) { | ||
1094 | + requestParam.plate_number = options.plate_number; | ||
1095 | + } | ||
1096 | + } | ||
1097 | + | ||
1098 | + if (options.mode == MODE.transit) { | ||
1099 | + if (options.departure_time) { | ||
1100 | + requestParam.departure_time = options.departure_time; | ||
1101 | + } | ||
1102 | + if (options.policy) { | ||
1103 | + requestParam.policy = options.policy; | ||
1104 | + } | ||
1105 | + } | ||
1106 | + | ||
1107 | + var locationsuccess = function (result) { | ||
1108 | + requestParam.from = result.latitude + ',' + result.longitude; | ||
1109 | + if (options.sig) { | ||
1110 | + requestParam.sig = Utils.getSig(requestParam, options.sig, 'direction',options.mode); | ||
1111 | + } | ||
1112 | + wx.request(Utils.buildWxRequestConfig(options, { | ||
1113 | + url: SET_URL_DIRECTION, | ||
1114 | + data: requestParam | ||
1115 | + }, 'direction')); | ||
1116 | + }; | ||
1117 | + | ||
1118 | + Utils.locationProcess(options, locationsuccess); | ||
1119 | + } | ||
1120 | +}; | ||
1121 | + | ||
1122 | +module.exports = QQMapWX; |
common/util.js
0 → 100644
1 | +function formatLocation(longitude, latitude) { | ||
2 | + if (typeof longitude === 'string' && typeof latitude === 'string') { | ||
3 | + longitude = parseFloat(longitude) | ||
4 | + latitude = parseFloat(latitude) | ||
5 | + } | ||
6 | + | ||
7 | + longitude = longitude.toFixed(2) | ||
8 | + latitude = latitude.toFixed(2) | ||
9 | + | ||
10 | + return { | ||
11 | + longitude: longitude.toString().split('.'), | ||
12 | + latitude: latitude.toString().split('.') | ||
13 | + } | ||
14 | +} | ||
15 | + | ||
16 | +const formatPosition = function(res) { | ||
17 | + let postChildren = function(params) { | ||
18 | + | ||
19 | + if (params.length == 0) return []; | ||
20 | + | ||
21 | + let child = [] | ||
22 | + params.map((item, index) => { | ||
23 | + child.push({ | ||
24 | + label: item, | ||
25 | + value: item, | ||
26 | + }) | ||
27 | + }) | ||
28 | + return child | ||
29 | + } | ||
30 | + | ||
31 | + if (res && res.categories && res.categories.length > 0) { | ||
32 | + const { | ||
33 | + categories = [] | ||
34 | + } = res; | ||
35 | + | ||
36 | + let result = [] | ||
37 | + categories.map((item, index) => { | ||
38 | + result.push({ | ||
39 | + label: item.name, | ||
40 | + value: item.name, | ||
41 | + children: postChildren(item.sub_categories || []) | ||
42 | + }) | ||
43 | + }) | ||
44 | + | ||
45 | + return result | ||
46 | + | ||
47 | + } else { | ||
48 | + return [] | ||
49 | + } | ||
50 | +} | ||
51 | + | ||
52 | +const getLabel = function(options, initValue, i, result) { | ||
53 | + | ||
54 | + if (i > initValue.length - 1) { | ||
55 | + console.log(result) | ||
56 | + return result | ||
57 | + } | ||
58 | + | ||
59 | + if (initValue && initValue.length > 0) { | ||
60 | + let tempOption = options.filter(item => { | ||
61 | + return item.value == initValue[i] | ||
62 | + }) | ||
63 | + | ||
64 | + let tempObject = tempOption[0] | ||
65 | + result.push({ | ||
66 | + label: tempObject.label, | ||
67 | + value: tempObject.value, | ||
68 | + }) | ||
69 | + | ||
70 | + i++ | ||
71 | + return getLabel(tempObject.children, initValue, i, result) | ||
72 | + } | ||
73 | +} | ||
74 | + | ||
75 | +const genderOptions = [{ | ||
76 | + label: '男', | ||
77 | + value: "0", | ||
78 | + }, | ||
79 | + { | ||
80 | + label: '女', | ||
81 | + value: "1", | ||
82 | + } | ||
83 | +]; | ||
84 | + | ||
85 | +const commonOptions = [{ | ||
86 | + label: '是', | ||
87 | + value: "yes", | ||
88 | + }, | ||
89 | + { | ||
90 | + label: '否', | ||
91 | + value: "no", | ||
92 | + } | ||
93 | +]; | ||
94 | + | ||
95 | +const marriedOptions = [{ | ||
96 | + label: '已婚', | ||
97 | + value: "1", | ||
98 | + }, | ||
99 | + { | ||
100 | + label: '未婚', | ||
101 | + value: "2", | ||
102 | + }, | ||
103 | +]; | ||
104 | + | ||
105 | +const degreeOptions = [{ | ||
106 | + label: '不限', | ||
107 | + value: '1' | ||
108 | + }, | ||
109 | + { | ||
110 | + label: '初中', | ||
111 | + value: '2' | ||
112 | + }, | ||
113 | + { | ||
114 | + label: '高中', | ||
115 | + value: '3' | ||
116 | + }, | ||
117 | + { | ||
118 | + label: '中专/技校', | ||
119 | + value: '8' | ||
120 | + }, | ||
121 | + { | ||
122 | + label: '大专', | ||
123 | + value: '4' | ||
124 | + }, | ||
125 | + { | ||
126 | + label: '本科', | ||
127 | + value: '5' | ||
128 | + }, | ||
129 | + { | ||
130 | + label: '硕士', | ||
131 | + value: '6' | ||
132 | + }, | ||
133 | + { | ||
134 | + label: '博士', | ||
135 | + value: '7' | ||
136 | + }, | ||
137 | + { | ||
138 | + label: 'MBA/EMBA', | ||
139 | + value: '9' | ||
140 | + }, | ||
141 | +]; | ||
142 | + | ||
143 | +//岗位类别 | ||
144 | +const positionTypeOptions = [{ | ||
145 | + value: '', | ||
146 | + label: "全部", | ||
147 | + }, | ||
148 | + { | ||
149 | + value: 'manufacture', | ||
150 | + label: "智能制造", | ||
151 | + }, | ||
152 | + { | ||
153 | + value: 'preschool', | ||
154 | + label: "学前教育", | ||
155 | + }, { | ||
156 | + value: 'healthy', | ||
157 | + label: "智慧康养", | ||
158 | + }, { | ||
159 | + value: 'software', | ||
160 | + label: "大数据与软件", | ||
161 | + }, { | ||
162 | + value: 'other', | ||
163 | + label: "其他", | ||
164 | + }, | ||
165 | +]; | ||
166 | + | ||
167 | +//岗位性质 | ||
168 | +const positionPropOptions = [{ | ||
169 | + value: 'part_time', | ||
170 | + label: "兼职", | ||
171 | + }, | ||
172 | + { | ||
173 | + value: 'internship', | ||
174 | + label: "实习", | ||
175 | + }, { | ||
176 | + value: 'full_time', | ||
177 | + label: "全职", | ||
178 | + }, { | ||
179 | + value: 'other', | ||
180 | + label: "其他", | ||
181 | + }, | ||
182 | +]; | ||
183 | + | ||
184 | +//薪资类型 | ||
185 | +const salaryTypeOptions = [{ | ||
186 | + value: 'negotiable', | ||
187 | + label: "薪资面议", | ||
188 | +}, { | ||
189 | + // value: 'annual', | ||
190 | + // label: "年薪", | ||
191 | + // },{ | ||
192 | + value: 'monthly', | ||
193 | + label: "月薪", | ||
194 | +}, { | ||
195 | + value: 'daily', | ||
196 | + label: "日薪", | ||
197 | +}, { | ||
198 | + label: "时薪", | ||
199 | + value: 'hourly', | ||
200 | +}, ]; | ||
201 | + | ||
202 | +const schoolTypeOptions = [{ | ||
203 | + label: '高职(高专)院校', | ||
204 | + value: 'vocational' | ||
205 | +}, { | ||
206 | + label: '中等职业技术学院', | ||
207 | + value: "secondary_vocational", | ||
208 | +}, { | ||
209 | + label: '技工学校(技校)', | ||
210 | + value: "technical", | ||
211 | +}, { | ||
212 | + label: '全日制大学', | ||
213 | + value: "full_time", | ||
214 | +}, { | ||
215 | + label: '民办独立学院', | ||
216 | + value: "civilian_run", | ||
217 | +}, { | ||
218 | + label: '其他', | ||
219 | + value: "other", | ||
220 | +}] | ||
221 | + | ||
222 | +const unitOptions = [{ //计费单位 | ||
223 | + label: '时', | ||
224 | + value: "hourly", | ||
225 | + }, | ||
226 | + { | ||
227 | + label: '月', | ||
228 | + value: "monthly", | ||
229 | + }, | ||
230 | +]; | ||
231 | + | ||
232 | +const unitTypeOptions = [{ //委托招聘计费类型 | ||
233 | + label: '打包服务费', | ||
234 | + value: "packing", | ||
235 | + }, | ||
236 | + { | ||
237 | + label: '招聘服务费', | ||
238 | + value: "recruiting", | ||
239 | + }, | ||
240 | +]; | ||
241 | + | ||
242 | +const ageTypeOptions = [{ //年龄类型 | ||
243 | + label: '年满16周岁', | ||
244 | + value: "16years", | ||
245 | + }, | ||
246 | + { | ||
247 | + label: '年满18周岁', | ||
248 | + value: "18years", | ||
249 | + }, | ||
250 | +]; | ||
251 | + | ||
252 | + | ||
253 | +module.exports = { | ||
254 | + formatLocation, | ||
255 | + formatPosition, | ||
256 | + getLabel, | ||
257 | + genderOptions, | ||
258 | + marriedOptions, | ||
259 | + degreeOptions, | ||
260 | + positionTypeOptions, | ||
261 | + positionPropOptions, | ||
262 | + salaryTypeOptions, | ||
263 | + schoolTypeOptions, | ||
264 | + unitOptions, | ||
265 | + ageTypeOptions, | ||
266 | + commonOptions, | ||
267 | + unitTypeOptions | ||
268 | +} |
common/validate.js
0 → 100644
1 | +const install = (Vue, vm) => { | ||
2 | + | ||
3 | + const required = (message, trigger) => { | ||
4 | + return { | ||
5 | + // 自定义验证函数,见上说明 | ||
6 | + validator: (rule, value, callback) => { | ||
7 | + if (Array.isArray(value)) { | ||
8 | + return value.length > 0 ? true : false | ||
9 | + } else if (typeof(value) == 'string' && value && !value.trim()) { | ||
10 | + return value.trim() ? true : false; | ||
11 | + } else if (typeof(value) == 'object') { | ||
12 | + return JSON.stringify(value) != '{}' ? true : false; | ||
13 | + } else { | ||
14 | + return value != 0 && (typeof(value) == 'number' || value ? true : false); | ||
15 | + } | ||
16 | + }, | ||
17 | + message: message ? message : '必填项不能为空', | ||
18 | + // 触发器可以同时用blur和change | ||
19 | + trigger: trigger ? trigger : ['change', 'blur'], | ||
20 | + } | ||
21 | + } | ||
22 | + | ||
23 | + const digits = { | ||
24 | + // 自定义验证函数,见上说明 | ||
25 | + validator: (rule, value, callback) => { | ||
26 | + // 上面有说,返回true表示校验通过,返回false表示不通过 | ||
27 | + return value ? vm.$u.test.digits(value) : true; | ||
28 | + }, | ||
29 | + message: '请输入正整数', | ||
30 | + // 触发器可以同时用blur和change | ||
31 | + trigger: ['change', 'blur'], | ||
32 | + } | ||
33 | + | ||
34 | + //数字是否在某个范围内 | ||
35 | + const rangeNumber = function(params) { | ||
36 | + return { | ||
37 | + validator: (rule, value, callback) => { | ||
38 | + return value ? vm.$u.test.range(value, params) : true; | ||
39 | + }, | ||
40 | + message: `请输入${params[0]}~${params[1]}`, | ||
41 | + trigger: ['change', 'blur'], | ||
42 | + } | ||
43 | + } | ||
44 | + | ||
45 | + //字符串长度是否在某个范围内 | ||
46 | + const rangeLength = function(params) { | ||
47 | + return { | ||
48 | + validator: (rule, value, callback) => { | ||
49 | + return value ? vm.$u.test.rangeLength(value, params) : true; | ||
50 | + }, | ||
51 | + message: `长度在${params[0]}~${params[1]}个字符`, | ||
52 | + trigger: ['change', 'blur'], | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
56 | + //字符串最大长度 | ||
57 | + const maxLehgth = function(params) { | ||
58 | + return { | ||
59 | + max: params, | ||
60 | + message: `字符长度不超过${params}位`, | ||
61 | + trigger: ['change', 'blur'], | ||
62 | + } | ||
63 | + } | ||
64 | + | ||
65 | + //字母或数字 | ||
66 | + const LetterOrNumer = { | ||
67 | + pattern: /^[0-9a-zA-Z]*$/g, | ||
68 | + // 正则检验前先将值转为字符串 | ||
69 | + transform(value) { | ||
70 | + return String(value); | ||
71 | + }, | ||
72 | + message: '只能包含字母或数字' | ||
73 | + } | ||
74 | + | ||
75 | + const email = { | ||
76 | + // 自定义验证函数,见上说明 | ||
77 | + validator: (rule, value, callback) => { | ||
78 | + // 上面有说,返回true表示校验通过,返回false表示不通过 | ||
79 | + return value ? vm.$u.test.email(value) : true; | ||
80 | + }, | ||
81 | + message: '邮箱格式不正确', | ||
82 | + // 触发器可以同时用blur和change | ||
83 | + trigger: ['change', 'blur'], | ||
84 | + } | ||
85 | + | ||
86 | + const mobile = { | ||
87 | + validator: (rule, value, callback) => { | ||
88 | + return value ? vm.$u.test.mobile(value) : true; | ||
89 | + }, | ||
90 | + message: '手机号码不正确', | ||
91 | + trigger: ['change', 'blur'], | ||
92 | + } | ||
93 | + | ||
94 | + const name = { | ||
95 | + // 自定义验证函数,见上说明 | ||
96 | + validator: (rule, value, callback) => { | ||
97 | + // 上面有说,返回true表示校验通过,返回false表示不通过 | ||
98 | + return value ? vm.$u.test.chinese(value) : true; | ||
99 | + }, | ||
100 | + message: '姓名必须为中文', | ||
101 | + // 触发器可以同时用blur和change | ||
102 | + trigger: ['change', 'blur'], | ||
103 | + } | ||
104 | + | ||
105 | + | ||
106 | + | ||
107 | + //是否验证码 | ||
108 | + const verifyCode = function(params) { | ||
109 | + return { | ||
110 | + validator: (rule, value, callback) => { | ||
111 | + return vm.$u.test.code(value, params); | ||
112 | + }, | ||
113 | + message: `验证码不正确`, | ||
114 | + trigger: ['change', 'blur'], | ||
115 | + } | ||
116 | + } | ||
117 | + | ||
118 | + //身份证号 | ||
119 | + const idCard = { | ||
120 | + validator: (rule, value, callback) => { | ||
121 | + return value ? vm.$u.test.idCard(value) : true; | ||
122 | + }, | ||
123 | + message: '身份证号不正确', | ||
124 | + trigger: ['change', 'blur'], | ||
125 | + } | ||
126 | + | ||
127 | + //数值是否在某个范围内 | ||
128 | + const height = function(params) { | ||
129 | + return { | ||
130 | + validator: (rule, value, callback) => { | ||
131 | + return value ? vm.$u.test.range(value, params) : true; | ||
132 | + }, | ||
133 | + message: `身高在${params[0]}~${params[1]}cm`, | ||
134 | + trigger: ['change', 'blur'], | ||
135 | + } | ||
136 | + } | ||
137 | + | ||
138 | + //数值是否在某个范围内 | ||
139 | + const weight = function(params) { | ||
140 | + return { | ||
141 | + validator: (rule, value, callback) => { | ||
142 | + return value ? vm.$u.test.range(value, params) : true; | ||
143 | + }, | ||
144 | + message: `体重在${params[0]}~${params[1]}kg`, | ||
145 | + trigger: ['change', 'blur'], | ||
146 | + } | ||
147 | + } | ||
148 | + | ||
149 | + const qq = { | ||
150 | + pattern: /^[1-9][0-9]{4,14}$/gim, | ||
151 | + message: 'QQ号不正确', | ||
152 | + trigger: ['change', 'blur'], | ||
153 | + } | ||
154 | + | ||
155 | + const weixin = { | ||
156 | + pattern: /^[a-zA-Z][a-zA-Z\d_-]{5,19}$/, | ||
157 | + message: '微信号不正确', | ||
158 | + trigger: ['change', 'blur'], | ||
159 | + } | ||
160 | + | ||
161 | + | ||
162 | + | ||
163 | + // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 | ||
164 | + vm.$u.cusTest = { | ||
165 | + required, | ||
166 | + digits, | ||
167 | + rangeNumber, | ||
168 | + rangeLength, | ||
169 | + mobile, | ||
170 | + verifyCode, | ||
171 | + name, | ||
172 | + idCard, | ||
173 | + height, | ||
174 | + weight, | ||
175 | + maxLehgth, | ||
176 | + qq, | ||
177 | + weixin, | ||
178 | + email, | ||
179 | + }; | ||
180 | +} | ||
181 | + | ||
182 | +export default { | ||
183 | + install | ||
184 | +} |
common/vue-i18n.min.js
0 → 100644
1 | +/*! | ||
2 | + * vue-i18n v8.20.0 | ||
3 | + * (c) 2020 kazuya kawaguchi | ||
4 | + * Released under the MIT License. | ||
5 | + */ | ||
6 | +var t,e;t=this,e=function(){"use strict";var t=["style","currency","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","localeMatcher","formatMatcher","unit"];function e(t,e){"undefined"!=typeof console&&(console.warn("[vue-i18n] "+t),e&&console.warn(e.stack))}var n=Array.isArray;function r(t){return null!==t&&"object"==typeof t}function a(t){return"string"==typeof t}var i=Object.prototype.toString,o="[object Object]";function s(t){return i.call(t)===o}function l(t){return null==t}function c(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=null,a=null;return 1===t.length?r(t[0])||Array.isArray(t[0])?a=t[0]:"string"==typeof t[0]&&(n=t[0]):2===t.length&&("string"==typeof t[0]&&(n=t[0]),(r(t[1])||Array.isArray(t[1]))&&(a=t[1])),{locale:n,params:a}}function u(t){return JSON.parse(JSON.stringify(t))}function h(t,e){return!!~t.indexOf(e)}var f=Object.prototype.hasOwnProperty;function p(t,e){return f.call(t,e)}function m(t){for(var e=arguments,n=Object(t),a=1;a<arguments.length;a++){var i=e[a];if(null!=i){var o=void 0;for(o in i)p(i,o)&&(r(i[o])?n[o]=m(n[o],i[o]):n[o]=i[o])}}return n}function _(t,e){if(t===e)return!0;var n=r(t),a=r(e);if(!n||!a)return!n&&!a&&String(t)===String(e);try{var i=Array.isArray(t),o=Array.isArray(e);if(i&&o)return t.length===e.length&&t.every(function(t,n){return _(t,e[n])});if(i||o)return!1;var s=Object.keys(t),l=Object.keys(e);return s.length===l.length&&s.every(function(n){return _(t[n],e[n])})}catch(t){return!1}}var g={beforeCreate:function(){var t=this.$options;if(t.i18n=t.i18n||(t.__i18n?{}:null),t.i18n){if(t.i18n instanceof et){if(t.__i18n)try{var e={};t.__i18n.forEach(function(t){e=m(e,JSON.parse(t))}),Object.keys(e).forEach(function(n){t.i18n.mergeLocaleMessage(n,e[n])})}catch(t){}this._i18n=t.i18n,this._i18nWatcher=this._i18n.watchI18nData()}else if(s(t.i18n)){var n=this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof et?this.$root.$i18n:null;if(n&&(t.i18n.root=this.$root,t.i18n.formatter=n.formatter,t.i18n.fallbackLocale=n.fallbackLocale,t.i18n.formatFallbackMessages=n.formatFallbackMessages,t.i18n.silentTranslationWarn=n.silentTranslationWarn,t.i18n.silentFallbackWarn=n.silentFallbackWarn,t.i18n.pluralizationRules=n.pluralizationRules,t.i18n.preserveDirectiveContent=n.preserveDirectiveContent),t.__i18n)try{var r={};t.__i18n.forEach(function(t){r=m(r,JSON.parse(t))}),t.i18n.messages=r}catch(t){}var a=t.i18n.sharedMessages;a&&s(a)&&(t.i18n.messages=m(t.i18n.messages,a)),this._i18n=new et(t.i18n),this._i18nWatcher=this._i18n.watchI18nData(),(void 0===t.i18n.sync||t.i18n.sync)&&(this._localeWatcher=this.$i18n.watchLocale()),n&&n.onComponentInstanceCreated(this._i18n)}}else this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof et?this._i18n=this.$root.$i18n:t.parent&&t.parent.$i18n&&t.parent.$i18n instanceof et&&(this._i18n=t.parent.$i18n)},beforeMount:function(){var t=this.$options;t.i18n=t.i18n||(t.__i18n?{}:null),t.i18n?t.i18n instanceof et?(this._i18n.subscribeDataChanging(this),this._subscribing=!0):s(t.i18n)&&(this._i18n.subscribeDataChanging(this),this._subscribing=!0):this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof et?(this._i18n.subscribeDataChanging(this),this._subscribing=!0):t.parent&&t.parent.$i18n&&t.parent.$i18n instanceof et&&(this._i18n.subscribeDataChanging(this),this._subscribing=!0)},beforeDestroy:function(){if(this._i18n){var t=this;this.$nextTick(function(){t._subscribing&&(t._i18n.unsubscribeDataChanging(t),delete t._subscribing),t._i18nWatcher&&(t._i18nWatcher(),t._i18n.destroyVM(),delete t._i18nWatcher),t._localeWatcher&&(t._localeWatcher(),delete t._localeWatcher)})}}},v={name:"i18n",functional:!0,props:{tag:{type:[String,Boolean,Object],default:"span"},path:{type:String,required:!0},locale:{type:String},places:{type:[Array,Object]}},render:function(t,e){var n=e.data,r=e.parent,a=e.props,i=e.slots,o=r.$i18n;if(o){var s=a.path,l=a.locale,c=a.places,u=i(),h=o.i(s,l,function(t){var e;for(e in t)if("default"!==e)return!1;return Boolean(e)}(u)||c?function(t,e){var n=e?function(t){return Array.isArray(t)?t.reduce(d,{}):Object.assign({},t)}(e):{};if(!t)return n;var r=(t=t.filter(function(t){return t.tag||""!==t.text.trim()})).every(y);return t.reduce(r?b:d,n)}(u.default,c):u),f=a.tag&&!0!==a.tag||!1===a.tag?a.tag:"span";return f?t(f,n,h):h}}};function b(t,e){return e.data&&e.data.attrs&&e.data.attrs.place&&(t[e.data.attrs.place]=e),t}function d(t,e,n){return t[n]=e,t}function y(t){return Boolean(t.data&&t.data.attrs&&t.data.attrs.place)}var F,k={name:"i18n-n",functional:!0,props:{tag:{type:[String,Boolean,Object],default:"span"},value:{type:Number,required:!0},format:{type:[String,Object]},locale:{type:String}},render:function(e,n){var i=n.props,o=n.parent,s=n.data,l=o.$i18n;if(!l)return null;var c=null,u=null;a(i.format)?c=i.format:r(i.format)&&(i.format.key&&(c=i.format.key),u=Object.keys(i.format).reduce(function(e,n){var r;return h(t,n)?Object.assign({},e,((r={})[n]=i.format[n],r)):e},null));var f=i.locale||l.locale,p=l._ntp(i.value,f,c,u),m=p.map(function(t,e){var n,r=s.scopedSlots&&s.scopedSlots[t.type];return r?r(((n={})[t.type]=t.value,n.index=e,n.parts=p,n)):t.value}),_=i.tag&&!0!==i.tag||!1===i.tag?i.tag:"span";return _?e(_,{attrs:s.attrs,class:s.class,staticClass:s.staticClass},m):m}};function w(t,e,n){C(t,n)&&T(t,e,n)}function $(t,e,n,r){if(C(t,n)){var a=n.context.$i18n;(function(t,e){var n=e.context;return t._locale===n.$i18n.locale})(t,n)&&_(e.value,e.oldValue)&&_(t._localeMessage,a.getLocaleMessage(a.locale))||T(t,e,n)}}function M(t,n,r,a){if(r.context){var i=r.context.$i18n||{};n.modifiers.preserve||i.preserveDirectiveContent||(t.textContent=""),t._vt=void 0,delete t._vt,t._locale=void 0,delete t._locale,t._localeMessage=void 0,delete t._localeMessage}else e("Vue instance does not exists in VNode context")}function C(t,n){var r=n.context;return r?!!r.$i18n||(e("VueI18n instance does not exists in Vue instance"),!1):(e("Vue instance does not exists in VNode context"),!1)}function T(t,n,r){var i,o,l=function(t){var e,n,r,i;a(t)?e=t:s(t)&&(e=t.path,n=t.locale,r=t.args,i=t.choice);return{path:e,locale:n,args:r,choice:i}}(n.value),c=l.path,u=l.locale,h=l.args,f=l.choice;if(c||u||h)if(c){var p=r.context;t._vt=t.textContent=null!=f?(i=p.$i18n).tc.apply(i,[c,f].concat(L(u,h))):(o=p.$i18n).t.apply(o,[c].concat(L(u,h))),t._locale=p.$i18n.locale,t._localeMessage=p.$i18n.getLocaleMessage(p.$i18n.locale)}else e("`path` is required in v-t directive");else e("value type not supported")}function L(t,e){var n=[];return t&&n.push(t),e&&(Array.isArray(e)||s(e))&&n.push(e),n}function I(t){I.installed=!0;(F=t).version&&Number(F.version.split(".")[0]);!function(t){t.prototype.hasOwnProperty("$i18n")||Object.defineProperty(t.prototype,"$i18n",{get:function(){return this._i18n}}),t.prototype.$t=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];var r=this.$i18n;return r._t.apply(r,[t,r.locale,r._getMessages(),this].concat(e))},t.prototype.$tc=function(t,e){for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];var a=this.$i18n;return a._tc.apply(a,[t,a.locale,a._getMessages(),this,e].concat(n))},t.prototype.$te=function(t,e){var n=this.$i18n;return n._te(t,n.locale,n._getMessages(),e)},t.prototype.$d=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this.$i18n).d.apply(e,[t].concat(n))},t.prototype.$n=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this.$i18n).n.apply(e,[t].concat(n))}}(F),F.mixin(g),F.directive("t",{bind:w,update:$,unbind:M}),F.component(v.name,v),F.component(k.name,k),F.config.optionMergeStrategies.i18n=function(t,e){return void 0===e?t:e}}var D=function(){this._caches=Object.create(null)};D.prototype.interpolate=function(t,e){if(!e)return[t];var n=this._caches[t];return n||(n=function(t){var e=[],n=0,r="";for(;n<t.length;){var a=t[n++];if("{"===a){r&&e.push({type:"text",value:r}),r="";var i="";for(a=t[n++];void 0!==a&&"}"!==a;)i+=a,a=t[n++];var o="}"===a,s=O.test(i)?"list":o&&x.test(i)?"named":"unknown";e.push({value:i,type:s})}else"%"===a?"{"!==t[n]&&(r+=a):r+=a}return r&&e.push({type:"text",value:r}),e}(t),this._caches[t]=n),function(t,e){var n=[],a=0,i=Array.isArray(e)?"list":r(e)?"named":"unknown";if("unknown"===i)return n;for(;a<t.length;){var o=t[a];switch(o.type){case"text":n.push(o.value);break;case"list":n.push(e[parseInt(o.value,10)]);break;case"named":"named"===i&&n.push(e[o.value])}a++}return n}(n,e)};var O=/^(?:\d)+/,x=/^(?:\w)+/,W=0,j=1,N=2,A=3,S=0,R=4,H=5,P=6,V=7,E=8,z=[];z[S]={ws:[S],ident:[3,W],"[":[R],eof:[V]},z[1]={ws:[1],".":[2],"[":[R],eof:[V]},z[2]={ws:[2],ident:[3,W],0:[3,W],number:[3,W]},z[3]={ident:[3,W],0:[3,W],number:[3,W],ws:[1,j],".":[2,j],"[":[R,j],eof:[V,j]},z[R]={"'":[H,W],'"':[P,W],"[":[R,N],"]":[1,A],eof:E,else:[R,W]},z[H]={"'":[R,W],eof:E,else:[H,W]},z[P]={'"':[R,W],eof:E,else:[P,W]};var B=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function U(t){if(null==t)return"eof";switch(t.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return t;case 95:case 36:case 45:return"ident";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}return"ident"}function J(t){var e,n,r,a=t.trim();return("0"!==t.charAt(0)||!isNaN(t))&&(r=a,B.test(r)?(n=(e=a).charCodeAt(0))!==e.charCodeAt(e.length-1)||34!==n&&39!==n?e:e.slice(1,-1):"*"+a)}var q=function(){this._cache=Object.create(null)};q.prototype.parsePath=function(t){var e=this._cache[t];return e||(e=function(t){var e,n,r,a,i,o,s,l=[],c=-1,u=S,h=0,f=[];function p(){var e=t[c+1];if(u===H&&"'"===e||u===P&&'"'===e)return c++,r="\\"+e,f[W](),!0}for(f[j]=function(){void 0!==n&&(l.push(n),n=void 0)},f[W]=function(){void 0===n?n=r:n+=r},f[N]=function(){f[W](),h++},f[A]=function(){if(h>0)h--,u=R,f[W]();else{if(h=0,void 0===n)return!1;if(!1===(n=J(n)))return!1;f[j]()}};null!==u;)if("\\"!==(e=t[++c])||!p()){if(a=U(e),(i=(s=z[u])[a]||s.else||E)===E)return;if(u=i[0],(o=f[i[1]])&&(r=void 0===(r=i[2])?e:r,!1===o()))return;if(u===V)return l}}(t))&&(this._cache[t]=e),e||[]},q.prototype.getPathValue=function(t,e){if(!r(t))return null;var n=this.parsePath(e);if(0===n.length)return null;for(var a=n.length,i=t,o=0;o<a;){var s=i[n[o]];if(void 0===s)return null;i=s,o++}return i};var G,X=/<\/?[\w\s="/.':;#-\/]+>/,Z=/(?:@(?:\.[a-z]+)?:(?:[\w\-_|.]+|\([\w\-_|.]+\)))/g,K=/^@(?:\.([a-z]+))?:/,Q=/[()]/g,Y={upper:function(t){return t.toLocaleUpperCase()},lower:function(t){return t.toLocaleLowerCase()},capitalize:function(t){return""+t.charAt(0).toLocaleUpperCase()+t.substr(1)}},tt=new D,et=function(t){var e=this;void 0===t&&(t={}),!F&&"undefined"!=typeof window&&window.Vue&&I(window.Vue);var n=t.locale||"en-US",r=!1!==t.fallbackLocale&&(t.fallbackLocale||"en-US"),a=t.messages||{},i=t.dateTimeFormats||{},o=t.numberFormats||{};this._vm=null,this._formatter=t.formatter||tt,this._modifiers=t.modifiers||{},this._missing=t.missing||null,this._root=t.root||null,this._sync=void 0===t.sync||!!t.sync,this._fallbackRoot=void 0===t.fallbackRoot||!!t.fallbackRoot,this._formatFallbackMessages=void 0!==t.formatFallbackMessages&&!!t.formatFallbackMessages,this._silentTranslationWarn=void 0!==t.silentTranslationWarn&&t.silentTranslationWarn,this._silentFallbackWarn=void 0!==t.silentFallbackWarn&&!!t.silentFallbackWarn,this._dateTimeFormatters={},this._numberFormatters={},this._path=new q,this._dataListeners=[],this._componentInstanceCreatedListener=t.componentInstanceCreatedListener||null,this._preserveDirectiveContent=void 0!==t.preserveDirectiveContent&&!!t.preserveDirectiveContent,this.pluralizationRules=t.pluralizationRules||{},this._warnHtmlInMessage=t.warnHtmlInMessage||"off",this._postTranslation=t.postTranslation||null,this.getChoiceIndex=function(t,n){var r=Object.getPrototypeOf(e);if(r&&r.getChoiceIndex)return r.getChoiceIndex.call(e,t,n);var a,i;return e.locale in e.pluralizationRules?e.pluralizationRules[e.locale].apply(e,[t,n]):(a=t,i=n,a=Math.abs(a),2===i?a?a>1?1:0:1:a?Math.min(a,2):0)},this._exist=function(t,n){return!(!t||!n)&&(!l(e._path.getPathValue(t,n))||!!t[n])},"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||Object.keys(a).forEach(function(t){e._checkLocaleMessage(t,e._warnHtmlInMessage,a[t])}),this._initVM({locale:n,fallbackLocale:r,messages:a,dateTimeFormats:i,numberFormats:o})},nt={vm:{configurable:!0},messages:{configurable:!0},dateTimeFormats:{configurable:!0},numberFormats:{configurable:!0},availableLocales:{configurable:!0},locale:{configurable:!0},fallbackLocale:{configurable:!0},formatFallbackMessages:{configurable:!0},missing:{configurable:!0},formatter:{configurable:!0},silentTranslationWarn:{configurable:!0},silentFallbackWarn:{configurable:!0},preserveDirectiveContent:{configurable:!0},warnHtmlInMessage:{configurable:!0},postTranslation:{configurable:!0}};return et.prototype._checkLocaleMessage=function(t,n,r){var i=function(t,n,r,o){if(s(r))Object.keys(r).forEach(function(e){var a=r[e];s(a)?(o.push(e),o.push("."),i(t,n,a,o),o.pop(),o.pop()):(o.push(e),i(t,n,a,o),o.pop())});else if(Array.isArray(r))r.forEach(function(e,r){s(e)?(o.push("["+r+"]"),o.push("."),i(t,n,e,o),o.pop(),o.pop()):(o.push("["+r+"]"),i(t,n,e,o),o.pop())});else if(a(r)){if(X.test(r)){var l="Detected HTML in message '"+r+"' of keypath '"+o.join("")+"' at '"+n+"'. Consider component interpolation with '<i18n>' to avoid XSS. See https://bit.ly/2ZqJzkp";"warn"===t?e(l):"error"===t&&function(t,e){"undefined"!=typeof console&&(console.error("[vue-i18n] "+t),e&&console.error(e.stack))}(l)}}};i(n,t,r,[])},et.prototype._initVM=function(t){var e=F.config.silent;F.config.silent=!0,this._vm=new F({data:t}),F.config.silent=e},et.prototype.destroyVM=function(){this._vm.$destroy()},et.prototype.subscribeDataChanging=function(t){this._dataListeners.push(t)},et.prototype.unsubscribeDataChanging=function(t){!function(t,e){if(t.length){var n=t.indexOf(e);if(n>-1)t.splice(n,1)}}(this._dataListeners,t)},et.prototype.watchI18nData=function(){var t=this;return this._vm.$watch("$data",function(){for(var e=t._dataListeners.length;e--;)F.nextTick(function(){t._dataListeners[e]&&t._dataListeners[e].$forceUpdate()})},{deep:!0})},et.prototype.watchLocale=function(){if(!this._sync||!this._root)return null;var t=this._vm;return this._root.$i18n.vm.$watch("locale",function(e){t.$set(t,"locale",e),t.$forceUpdate()},{immediate:!0})},et.prototype.onComponentInstanceCreated=function(t){this._componentInstanceCreatedListener&&this._componentInstanceCreatedListener(t,this)},nt.vm.get=function(){return this._vm},nt.messages.get=function(){return u(this._getMessages())},nt.dateTimeFormats.get=function(){return u(this._getDateTimeFormats())},nt.numberFormats.get=function(){return u(this._getNumberFormats())},nt.availableLocales.get=function(){return Object.keys(this.messages).sort()},nt.locale.get=function(){return this._vm.locale},nt.locale.set=function(t){this._vm.$set(this._vm,"locale",t)},nt.fallbackLocale.get=function(){return this._vm.fallbackLocale},nt.fallbackLocale.set=function(t){this._localeChainCache={},this._vm.$set(this._vm,"fallbackLocale",t)},nt.formatFallbackMessages.get=function(){return this._formatFallbackMessages},nt.formatFallbackMessages.set=function(t){this._formatFallbackMessages=t},nt.missing.get=function(){return this._missing},nt.missing.set=function(t){this._missing=t},nt.formatter.get=function(){return this._formatter},nt.formatter.set=function(t){this._formatter=t},nt.silentTranslationWarn.get=function(){return this._silentTranslationWarn},nt.silentTranslationWarn.set=function(t){this._silentTranslationWarn=t},nt.silentFallbackWarn.get=function(){return this._silentFallbackWarn},nt.silentFallbackWarn.set=function(t){this._silentFallbackWarn=t},nt.preserveDirectiveContent.get=function(){return this._preserveDirectiveContent},nt.preserveDirectiveContent.set=function(t){this._preserveDirectiveContent=t},nt.warnHtmlInMessage.get=function(){return this._warnHtmlInMessage},nt.warnHtmlInMessage.set=function(t){var e=this,n=this._warnHtmlInMessage;if(this._warnHtmlInMessage=t,n!==t&&("warn"===t||"error"===t)){var r=this._getMessages();Object.keys(r).forEach(function(t){e._checkLocaleMessage(t,e._warnHtmlInMessage,r[t])})}},nt.postTranslation.get=function(){return this._postTranslation},nt.postTranslation.set=function(t){this._postTranslation=t},et.prototype._getMessages=function(){return this._vm.messages},et.prototype._getDateTimeFormats=function(){return this._vm.dateTimeFormats},et.prototype._getNumberFormats=function(){return this._vm.numberFormats},et.prototype._warnDefault=function(t,e,n,r,i,o){if(!l(n))return n;if(this._missing){var s=this._missing.apply(null,[t,e,r,i]);if(a(s))return s}if(this._formatFallbackMessages){var u=c.apply(void 0,i);return this._render(e,o,u.params,e)}return e},et.prototype._isFallbackRoot=function(t){return!t&&!l(this._root)&&this._fallbackRoot},et.prototype._isSilentFallbackWarn=function(t){return this._silentFallbackWarn instanceof RegExp?this._silentFallbackWarn.test(t):this._silentFallbackWarn},et.prototype._isSilentFallback=function(t,e){return this._isSilentFallbackWarn(e)&&(this._isFallbackRoot()||t!==this.fallbackLocale)},et.prototype._isSilentTranslationWarn=function(t){return this._silentTranslationWarn instanceof RegExp?this._silentTranslationWarn.test(t):this._silentTranslationWarn},et.prototype._interpolate=function(t,e,n,r,i,o,c){if(!e)return null;var u,h=this._path.getPathValue(e,n);if(Array.isArray(h)||s(h))return h;if(l(h)){if(!s(e))return null;if(!a(u=e[n]))return null}else{if(!a(h))return null;u=h}return(u.indexOf("@:")>=0||u.indexOf("@.")>=0)&&(u=this._link(t,e,u,r,"raw",o,c)),this._render(u,i,o,n)},et.prototype._link=function(t,e,n,r,a,i,o){var s=n,l=s.match(Z);for(var c in l)if(l.hasOwnProperty(c)){var u=l[c],f=u.match(K),p=f[0],m=f[1],_=u.replace(p,"").replace(Q,"");if(h(o,_))return s;o.push(_);var g=this._interpolate(t,e,_,r,"raw"===a?"string":a,"raw"===a?void 0:i,o);if(this._isFallbackRoot(g)){if(!this._root)throw Error("unexpected error");var v=this._root.$i18n;g=v._translate(v._getMessages(),v.locale,v.fallbackLocale,_,r,a,i)}g=this._warnDefault(t,_,g,r,Array.isArray(i)?i:[i],a),this._modifiers.hasOwnProperty(m)?g=this._modifiers[m](g):Y.hasOwnProperty(m)&&(g=Y[m](g)),o.pop(),s=g?s.replace(u,g):s}return s},et.prototype._render=function(t,e,n,r){var i=this._formatter.interpolate(t,n,r);return i||(i=tt.interpolate(t,n,r)),"string"!==e||a(i)?i:i.join("")},et.prototype._appendItemToChain=function(t,e,n){var r=!1;return h(t,e)||(r=!0,e&&(r="!"!==e[e.length-1],e=e.replace(/!/g,""),t.push(e),n&&n[e]&&(r=n[e]))),r},et.prototype._appendLocaleToChain=function(t,e,n){var r,a=e.split("-");do{var i=a.join("-");r=this._appendItemToChain(t,i,n),a.splice(-1,1)}while(a.length&&!0===r);return r},et.prototype._appendBlockToChain=function(t,e,n){for(var r=!0,i=0;i<e.length&&"boolean"==typeof r;i++){var o=e[i];a(o)&&(r=this._appendLocaleToChain(t,o,n))}return r},et.prototype._getLocaleChain=function(t,e){if(""===t)return[];this._localeChainCache||(this._localeChainCache={});var i=this._localeChainCache[t];if(!i){e||(e=this.fallbackLocale),i=[];for(var o,s=[t];n(s);)s=this._appendBlockToChain(i,s,e);(s=a(o=n(e)?e:r(e)?e.default?e.default:null:e)?[o]:o)&&this._appendBlockToChain(i,s,null),this._localeChainCache[t]=i}return i},et.prototype._translate=function(t,e,n,r,a,i,o){for(var s,c=this._getLocaleChain(e,n),u=0;u<c.length;u++){var h=c[u];if(!l(s=this._interpolate(h,t[h],r,a,i,o,[r])))return s}return null},et.prototype._t=function(t,e,n,r){for(var a,i=[],o=arguments.length-4;o-- >0;)i[o]=arguments[o+4];if(!t)return"";var s=c.apply(void 0,i),l=s.locale||e,u=this._translate(n,l,this.fallbackLocale,t,r,"string",s.params);if(this._isFallbackRoot(u)){if(!this._root)throw Error("unexpected error");return(a=this._root).$t.apply(a,[t].concat(i))}return u=this._warnDefault(l,t,u,r,i,"string"),this._postTranslation&&null!=u&&(u=this._postTranslation(u,t)),u},et.prototype.t=function(t){for(var e,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return(e=this)._t.apply(e,[t,this.locale,this._getMessages(),null].concat(n))},et.prototype._i=function(t,e,n,r,a){var i=this._translate(n,e,this.fallbackLocale,t,r,"raw",a);if(this._isFallbackRoot(i)){if(!this._root)throw Error("unexpected error");return this._root.$i18n.i(t,e,a)}return this._warnDefault(e,t,i,r,[a],"raw")},et.prototype.i=function(t,e,n){return t?(a(e)||(e=this.locale),this._i(t,e,this._getMessages(),null,n)):""},et.prototype._tc=function(t,e,n,r,a){for(var i,o=[],s=arguments.length-5;s-- >0;)o[s]=arguments[s+5];if(!t)return"";void 0===a&&(a=1);var l={count:a,n:a},u=c.apply(void 0,o);return u.params=Object.assign(l,u.params),o=null===u.locale?[u.params]:[u.locale,u.params],this.fetchChoice((i=this)._t.apply(i,[t,e,n,r].concat(o)),a)},et.prototype.fetchChoice=function(t,e){if(!t&&!a(t))return null;var n=t.split("|");return n[e=this.getChoiceIndex(e,n.length)]?n[e].trim():t},et.prototype.tc=function(t,e){for(var n,r=[],a=arguments.length-2;a-- >0;)r[a]=arguments[a+2];return(n=this)._tc.apply(n,[t,this.locale,this._getMessages(),null,e].concat(r))},et.prototype._te=function(t,e,n){for(var r=[],a=arguments.length-3;a-- >0;)r[a]=arguments[a+3];var i=c.apply(void 0,r).locale||e;return this._exist(n[i],t)},et.prototype.te=function(t,e){return this._te(t,this.locale,this._getMessages(),e)},et.prototype.getLocaleMessage=function(t){return u(this._vm.messages[t]||{})},et.prototype.setLocaleMessage=function(t,e){"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||this._checkLocaleMessage(t,this._warnHtmlInMessage,e),this._vm.$set(this._vm.messages,t,e)},et.prototype.mergeLocaleMessage=function(t,e){"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||this._checkLocaleMessage(t,this._warnHtmlInMessage,e),this._vm.$set(this._vm.messages,t,m({},this._vm.messages[t]||{},e))},et.prototype.getDateTimeFormat=function(t){return u(this._vm.dateTimeFormats[t]||{})},et.prototype.setDateTimeFormat=function(t,e){this._vm.$set(this._vm.dateTimeFormats,t,e),this._clearDateTimeFormat(t,e)},et.prototype.mergeDateTimeFormat=function(t,e){this._vm.$set(this._vm.dateTimeFormats,t,m(this._vm.dateTimeFormats[t]||{},e)),this._clearDateTimeFormat(t,e)},et.prototype._clearDateTimeFormat=function(t,e){for(var n in e){var r=t+"__"+n;this._dateTimeFormatters.hasOwnProperty(r)&&delete this._dateTimeFormatters[r]}},et.prototype._localizeDateTime=function(t,e,n,r,a){for(var i=e,o=r[i],s=this._getLocaleChain(e,n),c=0;c<s.length;c++){var u=s[c];if(i=u,!l(o=r[u])&&!l(o[a]))break}if(l(o)||l(o[a]))return null;var h=o[a],f=i+"__"+a,p=this._dateTimeFormatters[f];return p||(p=this._dateTimeFormatters[f]=new Intl.DateTimeFormat(i,h)),p.format(t)},et.prototype._d=function(t,e,n){if(!n)return new Intl.DateTimeFormat(e).format(t);var r=this._localizeDateTime(t,e,this.fallbackLocale,this._getDateTimeFormats(),n);if(this._isFallbackRoot(r)){if(!this._root)throw Error("unexpected error");return this._root.$i18n.d(t,n,e)}return r||""},et.prototype.d=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];var i=this.locale,o=null;return 1===e.length?a(e[0])?o=e[0]:r(e[0])&&(e[0].locale&&(i=e[0].locale),e[0].key&&(o=e[0].key)):2===e.length&&(a(e[0])&&(o=e[0]),a(e[1])&&(i=e[1])),this._d(t,i,o)},et.prototype.getNumberFormat=function(t){return u(this._vm.numberFormats[t]||{})},et.prototype.setNumberFormat=function(t,e){this._vm.$set(this._vm.numberFormats,t,e),this._clearNumberFormat(t,e)},et.prototype.mergeNumberFormat=function(t,e){this._vm.$set(this._vm.numberFormats,t,m(this._vm.numberFormats[t]||{},e)),this._clearNumberFormat(t,e)},et.prototype._clearNumberFormat=function(t,e){for(var n in e){var r=t+"__"+n;this._numberFormatters.hasOwnProperty(r)&&delete this._numberFormatters[r]}},et.prototype._getNumberFormatter=function(t,e,n,r,a,i){for(var o=e,s=r[o],c=this._getLocaleChain(e,n),u=0;u<c.length;u++){var h=c[u];if(o=h,!l(s=r[h])&&!l(s[a]))break}if(l(s)||l(s[a]))return null;var f,p=s[a];if(i)f=new Intl.NumberFormat(o,Object.assign({},p,i));else{var m=o+"__"+a;(f=this._numberFormatters[m])||(f=this._numberFormatters[m]=new Intl.NumberFormat(o,p))}return f},et.prototype._n=function(t,e,n,r){if(!et.availabilities.numberFormat)return"";if(!n)return(r?new Intl.NumberFormat(e,r):new Intl.NumberFormat(e)).format(t);var a=this._getNumberFormatter(t,e,this.fallbackLocale,this._getNumberFormats(),n,r),i=a&&a.format(t);if(this._isFallbackRoot(i)){if(!this._root)throw Error("unexpected error");return this._root.$i18n.n(t,Object.assign({},{key:n,locale:e},r))}return i||""},et.prototype.n=function(e){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];var o=this.locale,s=null,l=null;return 1===n.length?a(n[0])?s=n[0]:r(n[0])&&(n[0].locale&&(o=n[0].locale),n[0].key&&(s=n[0].key),l=Object.keys(n[0]).reduce(function(e,r){var a;return h(t,r)?Object.assign({},e,((a={})[r]=n[0][r],a)):e},null)):2===n.length&&(a(n[0])&&(s=n[0]),a(n[1])&&(o=n[1])),this._n(e,o,s,l)},et.prototype._ntp=function(t,e,n,r){if(!et.availabilities.numberFormat)return[];if(!n)return(r?new Intl.NumberFormat(e,r):new Intl.NumberFormat(e)).formatToParts(t);var a=this._getNumberFormatter(t,e,this.fallbackLocale,this._getNumberFormats(),n,r),i=a&&a.formatToParts(t);if(this._isFallbackRoot(i)){if(!this._root)throw Error("unexpected error");return this._root.$i18n._ntp(t,e,n,r)}return i||[]},Object.defineProperties(et.prototype,nt),Object.defineProperty(et,"availabilities",{get:function(){if(!G){var t="undefined"!=typeof Intl;G={dateTimeFormat:t&&void 0!==Intl.DateTimeFormat,numberFormat:t&&void 0!==Intl.NumberFormat}}return G}}),et.install=I,et.version="8.20.0",et},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueI18n=e(); |
components/c-button/c-button.vue
0 → 100644
1 | +<template> | ||
2 | + <view class="u-button"> | ||
3 | + <u-button type="primary" :shape="shape" :open-type="openType" @getphonenumber="getPhoneNumber" hover-class="none" :disabled="disabled" :custom-style="getCustomStyle" | ||
4 | + @click="click"> | ||
5 | + {{text}} | ||
6 | + </u-button> | ||
7 | + </view> | ||
8 | +</template> | ||
9 | + | ||
10 | +<script> | ||
11 | + export default { | ||
12 | + name: 'u-button', | ||
13 | + props: { | ||
14 | + text: { | ||
15 | + type: String, | ||
16 | + default: '' | ||
17 | + }, | ||
18 | + type: { | ||
19 | + type: String, | ||
20 | + default: 'confirm' | ||
21 | + }, | ||
22 | + openType: { | ||
23 | + type: String, | ||
24 | + default: '' | ||
25 | + }, | ||
26 | + shape: { | ||
27 | + type: String, | ||
28 | + default: 'square' | ||
29 | + }, | ||
30 | + disabled: { | ||
31 | + type: Boolean, | ||
32 | + default: false | ||
33 | + }, | ||
34 | + customStyle: { | ||
35 | + type: Object, | ||
36 | + default () { | ||
37 | + return {} | ||
38 | + } | ||
39 | + }, | ||
40 | + }, | ||
41 | + data() { | ||
42 | + return {} | ||
43 | + }, | ||
44 | + computed: { | ||
45 | + getCustomStyle() { | ||
46 | + | ||
47 | + const { | ||
48 | + type = '' | ||
49 | + } = this; | ||
50 | + | ||
51 | + let style = {}; | ||
52 | + | ||
53 | + switch (type) { | ||
54 | + case 'confirm': | ||
55 | + return Object.assign({}, { | ||
56 | + backgroundColor: '#FF001A', | ||
57 | + borderRadius: '8rpx', | ||
58 | + }, this.customStyle); | ||
59 | + break; | ||
60 | + | ||
61 | + case 'cancel': | ||
62 | + return Object.assign({}, { | ||
63 | + backgroundColor: "rgba(0,0,0,0.15)", | ||
64 | + borderRadius: '8rpx', | ||
65 | + }, this.customStyle); | ||
66 | + break; | ||
67 | + | ||
68 | + case 'custom': | ||
69 | + return Object.assign({}, this.customStyle); | ||
70 | + break; | ||
71 | + } | ||
72 | + } | ||
73 | + }, | ||
74 | + methods: { | ||
75 | + // 按钮点击 | ||
76 | + click(e) { | ||
77 | + this.$emit('click', e); | ||
78 | + }, | ||
79 | + | ||
80 | + getPhoneNumber(e) { | ||
81 | + this.$emit("getPhoneNumber", e) | ||
82 | + } | ||
83 | + } | ||
84 | + } | ||
85 | +</script> | ||
86 | + | ||
87 | +<style lang="scss"> | ||
88 | + | ||
89 | +</style> |
components/c-edit-item/c-edit-item.vue
0 → 100644
1 | +<template> | ||
2 | + <view class='c-edit-item' v-if="true"> | ||
3 | + <text v-if='isrequre' style='color:red;font-size: 30rpx;line-height: 100rpx;float:left;'>*</text> | ||
4 | + <text :style="isrequre?'' : 'padding-left:14rpx'" class='text_666_30 float_left'>{{label}}</text> | ||
5 | + | ||
6 | + <view v-if='showarrow' style="position: absolute;right: 0rpx;display: flex;height: 100rpx;"> | ||
7 | + <u-icon name="arrow-right" style="align-self: center;" color="#999999"></u-icon> | ||
8 | + </view> | ||
9 | + | ||
10 | + <view class="weui-cell__bd " > | ||
11 | + <view class="picker_view" > | ||
12 | + <input :disabled="disabled" class="text_black_30 float_right text-single center_vertical" style='text-align:right;max-width:650rpx ;' | ||
13 | + placeholder-class="text_999_30 float_right center_vertical" :placeholder="placeholder" :value="selected" @click="click"></input> | ||
14 | + </view> | ||
15 | + </view> | ||
16 | + </view> | ||
17 | +</template> | ||
18 | + | ||
19 | +<script> | ||
20 | + export default { | ||
21 | + name: 'c-edit-item', | ||
22 | + props: { | ||
23 | + label: { | ||
24 | + type: String, | ||
25 | + default: '' | ||
26 | + }, | ||
27 | + placeholder: { | ||
28 | + type: String, | ||
29 | + default: '请选择' | ||
30 | + }, | ||
31 | + selected: { | ||
32 | + type: String, | ||
33 | + default: '' | ||
34 | + }, | ||
35 | + showarrow: { | ||
36 | + type: Boolean, | ||
37 | + default: true | ||
38 | + }, | ||
39 | + isrequre: { | ||
40 | + type: Boolean, | ||
41 | + default: false | ||
42 | + }, | ||
43 | + disabled: { | ||
44 | + type: Boolean, | ||
45 | + default: false | ||
46 | + } | ||
47 | + }, | ||
48 | + data() { | ||
49 | + return { | ||
50 | + | ||
51 | + } | ||
52 | + }, | ||
53 | + computed: { | ||
54 | + | ||
55 | + }, | ||
56 | + methods: { | ||
57 | + click(){ | ||
58 | + this.$emit('click'); | ||
59 | + } | ||
60 | + } | ||
61 | + } | ||
62 | +</script> | ||
63 | + | ||
64 | +<style lang="scss" scoped> | ||
65 | + // @import "../../libs/css/style.components.scss"; | ||
66 | + | ||
67 | + .c-edit-item { | ||
68 | + width: 100%; | ||
69 | + height: 100rpx; | ||
70 | + display: flex; | ||
71 | + border-bottom: solid 2rpx #F2F2F2; | ||
72 | + position: relative; | ||
73 | + | ||
74 | + .weui-cell__bd { | ||
75 | + -webkit-box-flex: 1; | ||
76 | + -webkit-flex: 1; | ||
77 | + flex: 1; | ||
78 | + } | ||
79 | + | ||
80 | + .picker_view{ | ||
81 | + float: right; | ||
82 | + text-align: right; | ||
83 | + height: 100rpx; | ||
84 | + margin-right: 36rpx; | ||
85 | + display: flex; | ||
86 | + } | ||
87 | + | ||
88 | + .text_black_30 { | ||
89 | + font-family: PingFangSC-Regular; | ||
90 | + font-size: 30rpx; | ||
91 | + color: #333; | ||
92 | + line-height: 100rpx; | ||
93 | + } | ||
94 | + | ||
95 | + .text_666_30 { | ||
96 | + font-family: PingFangSC-Regular; | ||
97 | + font-size: 30rpx; | ||
98 | + color: #666; | ||
99 | + text-align: right; | ||
100 | + line-height: 100rpx; | ||
101 | + } | ||
102 | + | ||
103 | + .text_999_30 { | ||
104 | + font-family: PingFangSC-Regular; | ||
105 | + font-size: 30rpx; | ||
106 | + color: #999; | ||
107 | + line-height: 100rpx; | ||
108 | + } | ||
109 | + | ||
110 | + .center_vertical{ | ||
111 | + display: flex; | ||
112 | + height: auto; | ||
113 | + align-items: center; | ||
114 | + } | ||
115 | + } | ||
116 | +</style> |
components/c-input-item/c-input-item.vue
0 → 100644
1 | +<template> | ||
2 | + <view class="c-input-item"> | ||
3 | + <!-- 文本、数字框 --> | ||
4 | + <u-form-item v-if="type == 'text'" :label="label" :labelWidth="200" :label-position='"top"' | ||
5 | + :label-style="{whiteSpace:'nowrap',fontSize:'26rpx', color:'#121212'}" :required="required" | ||
6 | + :right-icon="rightIcon ? 'arrow-right' : ''" :prop="name"> | ||
7 | + <u-input v-model="getValues" :maxlength="maxlenth" input-align="left" :disabled="disabled" :border="border" | ||
8 | + :placeholder="placeholder ? placeholder : '请输入'" :placeholderStyle="placeholderStyle" | ||
9 | + :customStyle="{fontSize:'36rpx'}" :clearable="clearable" @focus="onFocus" | ||
10 | + @click="handelClick('text')" /> | ||
11 | + </u-form-item> | ||
12 | + <u-form-item v-if="type == 'number'" :label="label" :labelWidth="200" :label-position='"top"' | ||
13 | + :label-style="{whiteSpace:'nowrap',fontSize:'26rpx', color:'#121212'}" :required="required" | ||
14 | + :right-icon="rightIcon ? 'arrow-right' : ''" :prop="name"> | ||
15 | + <u-input v-model="getValues" :maxlength="maxlenth" type="number" input-align="left" :disabled="disabled" | ||
16 | + :border="border" :placeholder="placeholder ? placeholder : '请输入'" :placeholderStyle="placeholderStyle" | ||
17 | + :clearable="clearable" :customStyle="{fontSize:'36rpx'}" /> | ||
18 | + </u-form-item> | ||
19 | + <!-- 单选 --> | ||
20 | + <u-form-item v-if="type == 'radio'" :label="label" :labelWidth="200" :label-position='"top"' | ||
21 | + :label-style="{whiteSpace:'nowrap',fontSize:'26rpx', color:'#121212' }" :required="required" | ||
22 | + :right-icon="rightIcon ? 'arrow-right' : ''" :prop="name"> | ||
23 | + <u-radio-group v-model="getValues"> | ||
24 | + <u-radio v-for="(item, index) in options" :key="index" :name="item.value" :disabled="item.disabled" | ||
25 | + active-color="#54B4F5"> | ||
26 | + {{ item.label }} | ||
27 | + </u-radio> | ||
28 | + </u-radio-group> | ||
29 | + </u-form-item> | ||
30 | + <!-- 时间选择器 --> | ||
31 | + <u-form-item v-if="type == 'date'" :label="label" :labelWidth="200" :label-position='"top"' | ||
32 | + :label-style="{whiteSpace:'nowrap',fontSize:'26rpx', color:'#121212' }" :required="required" | ||
33 | + :right-icon="rightIcon ? 'arrow-right' : ''" :prop="name"> | ||
34 | + <u-input v-model="getValues" type="text" input-align="left" :disabled="true" :border="border" | ||
35 | + :clearable="clearable" :placeholder="placeholder ? placeholder : '请选择时间'" | ||
36 | + :placeholderStyle="placeholderStyle" @click="time_visible = true" :customStyle="{fontSize:'36rpx'}" /> | ||
37 | + <u-picker @confirm="onConfirmTime" mode="time" v-model="time_visible" :params="{ | ||
38 | + year: true, | ||
39 | + month: true, | ||
40 | + day: true,}"></u-picker> | ||
41 | + </u-form-item> | ||
42 | + <!-- 单列模式 --> | ||
43 | + <u-form-item v-if="type == 'select'" :label="label" :labelWidth="200" :label-position='"top"' | ||
44 | + :label-style="{whiteSpace:'nowrap',fontSize:'26rpx', color:'#121212' }" :required="required" | ||
45 | + :right-icon="rightIcon ? 'arrow-right' : ''" :prop="name"> | ||
46 | + <u-input v-model="getValues" :maxlength="100" input-align="left" :disabled="true" :border="border" | ||
47 | + :clearable="clearable" :placeholder="placeholder ? placeholder : '请选择'" | ||
48 | + :placeholderStyle="placeholderStyle" :customStyle="{fontSize:'36rpx'}" @click="handelClick('select')" /> | ||
49 | + <u-select @confirm="onConfirmSingle" v-model="select_visible" mode="single-column" :list="options" | ||
50 | + :default-value="defs"> | ||
51 | + </u-select> | ||
52 | + </u-form-item> | ||
53 | + <!-- 多列联动模式 --> | ||
54 | + <u-form-item v-if="type == 'cascader'" :label="label" :labelWidth="200" :label-position='"top"' | ||
55 | + :label-style="{whiteSpace:'nowrap',fontSize:'26rpx', color:'#121212' }" :required="required" | ||
56 | + :right-icon="rightIcon ? 'arrow-right' : ''" :prop="name"> | ||
57 | + <u-input v-model="getValues" input-align="left" :disabled="true" :border="border" :clearable="clearable" | ||
58 | + :placeholder="placeholder ? placeholder : '请选择'" :placeholderStyle="placeholderStyle" | ||
59 | + @click="select_visible = true" /> | ||
60 | + <u-select @confirm="onConfirmAutoMutil" v-model="select_visible" mode="mutil-column-auto" :list="options"> | ||
61 | + </u-select> | ||
62 | + </u-form-item> | ||
63 | + <!-- 省市区选择 --> | ||
64 | + <u-form-item v-if="type == 'area'" :label="label" :labelWidth="200" :label-position='"top"' | ||
65 | + :label-style="{whiteSpace:'nowrap',fontSize:'26rpx', color:'#121212' }" :required="required" | ||
66 | + :right-icon="rightIcon ? 'arrow-right' : ''" :prop="name"> | ||
67 | + <u-input v-model="getValues" input-align="left" :disabled="true" :border="border" :clearable="clearable" | ||
68 | + :placeholder="placeholder ? placeholder : '请选择'" :placeholderStyle="placeholderStyle" | ||
69 | + @click="select_visible = true" :customStyle="{fontSize:'36rpx'}" /> | ||
70 | + <u-select @confirm="onConfirmArea" v-model="select_visible" mode="mutil-column-auto" :list="options"> | ||
71 | + </u-select> | ||
72 | + </u-form-item> | ||
73 | + <!-- 文本输入框 --> | ||
74 | + <u-form-item v-if="type == 'textarea'" :label="label" :labelWidth="200" :label-position='"top"' | ||
75 | + :label-style="{whiteSpace:'nowrap',fontSize:'26rpx', color:'#121212'}" :border-bottom="borderBottom" :required="required" | ||
76 | + :right-icon="rightIcon ? 'arrow-right' : ''" :prop="name"> | ||
77 | + <u-input v-model="getValues" input-align="left" :disabled="disabled" :border="border" | ||
78 | + :placeholder="placeholder ? placeholder : '请输入'" :placeholderStyle="placeholderStyle" | ||
79 | + :clearable="clearable" :customStyle="{fontSize:'36rpx'}" /> | ||
80 | + </u-form-item> | ||
81 | + </view> | ||
82 | + | ||
83 | +</template> | ||
84 | + | ||
85 | +<script> | ||
86 | + // import miment from 'miment' | ||
87 | + import { | ||
88 | + getLabel | ||
89 | + } from '../../common/util.js' | ||
90 | + | ||
91 | + export default { | ||
92 | + name: 'u-input-item', | ||
93 | + props: { | ||
94 | + //title | ||
95 | + label: { | ||
96 | + type: String, | ||
97 | + default: '' | ||
98 | + }, | ||
99 | + type: { | ||
100 | + type: String, | ||
101 | + default: 'text' | ||
102 | + }, | ||
103 | + // 是否显示左边的必填星号,只作显示用,具体校验必填的逻辑,请在rules中配置 | ||
104 | + required: { | ||
105 | + type: Boolean, | ||
106 | + default: false | ||
107 | + }, | ||
108 | + rightIcon: { | ||
109 | + type: Boolean, | ||
110 | + default: true | ||
111 | + }, | ||
112 | + //表单提交时的key | ||
113 | + name: { | ||
114 | + type: String, | ||
115 | + default: '' | ||
116 | + }, | ||
117 | + value: { | ||
118 | + type: Object, | ||
119 | + default () { | ||
120 | + return {} | ||
121 | + } | ||
122 | + }, | ||
123 | + clearable: { | ||
124 | + type: Boolean, | ||
125 | + default: false | ||
126 | + }, | ||
127 | + disabled: { | ||
128 | + type: Boolean, | ||
129 | + default: false | ||
130 | + }, | ||
131 | + border: { | ||
132 | + type: Boolean, | ||
133 | + default: false | ||
134 | + }, | ||
135 | + borderBottom: { | ||
136 | + type: Boolean, | ||
137 | + default: true | ||
138 | + }, | ||
139 | + placeholder: { | ||
140 | + type: String, | ||
141 | + default: '' | ||
142 | + }, | ||
143 | + | ||
144 | + maxlenth: { | ||
145 | + type: String, | ||
146 | + default: '100' | ||
147 | + }, | ||
148 | + | ||
149 | + placeholderStyle: { | ||
150 | + type: String, | ||
151 | + default: 'font-size:34rpx;color:rgba(0,0,0,0.5);' | ||
152 | + }, | ||
153 | + customStyle: { | ||
154 | + type: Object, | ||
155 | + default () { | ||
156 | + return {}; | ||
157 | + } | ||
158 | + }, | ||
159 | + //单选框数据列表 | ||
160 | + options: { | ||
161 | + type: Array, | ||
162 | + default () { | ||
163 | + return [] | ||
164 | + } | ||
165 | + }, | ||
166 | + // | ||
167 | + defs: { | ||
168 | + type: Array, | ||
169 | + default () { | ||
170 | + return [0] | ||
171 | + } | ||
172 | + }, | ||
173 | + }, | ||
174 | + data() { | ||
175 | + return { | ||
176 | + time_visible: false, | ||
177 | + select_visible: false, | ||
178 | + currentValue: '', | ||
179 | + } | ||
180 | + }, | ||
181 | + | ||
182 | + watch: { | ||
183 | + | ||
184 | + }, | ||
185 | + computed: { | ||
186 | + getValues: { | ||
187 | + // getter | ||
188 | + get: function() { | ||
189 | + const defaultValue = this.$parent.model[this.name]; | ||
190 | + let finalValue = '' | ||
191 | + | ||
192 | + if (!defaultValue || defaultValue.length <= 0 || JSON.stringify(defaultValue) == '{}') { | ||
193 | + return '' | ||
194 | + } | ||
195 | + | ||
196 | + switch (this.type) { | ||
197 | + | ||
198 | + case 'date': | ||
199 | + return defaultValue > 0 ? this.$u.timeFormat(defaultValue) : '' | ||
200 | + break; | ||
201 | + | ||
202 | + case 'select': | ||
203 | + const selectValue = this.options.filter((item, index) => { | ||
204 | + return defaultValue == item.value | ||
205 | + }) | ||
206 | + return selectValue[0].label | ||
207 | + break; | ||
208 | + | ||
209 | + case 'cascader': | ||
210 | + const { | ||
211 | + options = [] | ||
212 | + } = this; | ||
213 | + | ||
214 | + return defaultValue | ||
215 | + break; | ||
216 | + | ||
217 | + case 'area': | ||
218 | + finalValue = defaultValue.province + '/' + defaultValue.city + '/' + defaultValue | ||
219 | + .district | ||
220 | + return finalValue | ||
221 | + break; | ||
222 | + | ||
223 | + default: | ||
224 | + return defaultValue | ||
225 | + break; | ||
226 | + | ||
227 | + } | ||
228 | + | ||
229 | + }, | ||
230 | + // setter | ||
231 | + set: function(newValue) { | ||
232 | + console.log(newValue) | ||
233 | + | ||
234 | + switch (this.type) { | ||
235 | + | ||
236 | + case 'number': | ||
237 | + this.$emit('input', newValue); | ||
238 | + return newValue | ||
239 | + break; | ||
240 | + | ||
241 | + case 'text': | ||
242 | + case 'textarea': | ||
243 | + case 'radio': | ||
244 | + this.$emit('input', newValue); | ||
245 | + return newValue | ||
246 | + break; | ||
247 | + | ||
248 | + case 'date': | ||
249 | + case 'select': | ||
250 | + case 'area': | ||
251 | + return this.currentValue | ||
252 | + break; | ||
253 | + | ||
254 | + } | ||
255 | + | ||
256 | + } | ||
257 | + } | ||
258 | + }, | ||
259 | + methods: { | ||
260 | + handelClick(type) { | ||
261 | + switch (type) { | ||
262 | + case 'text': | ||
263 | + this.$emit('click', ''); | ||
264 | + break; | ||
265 | + | ||
266 | + case 'select': | ||
267 | + this.select_visible = true; | ||
268 | + try { | ||
269 | + // 收起键盘 | ||
270 | + uni.hideKeyboard(); | ||
271 | + } catch (e) {} | ||
272 | + break; | ||
273 | + } | ||
274 | + }, | ||
275 | + | ||
276 | + onFocus(value) { | ||
277 | + this.$emit('focus', value); | ||
278 | + }, | ||
279 | + | ||
280 | + onConfirmTime(value) { | ||
281 | + const millisecond = new Date().setFullYear(value.year, Number(value.month) - 1, value.day); | ||
282 | + const timestamp = Math.floor(millisecond / 1000); | ||
283 | + | ||
284 | + let currentValue = this.$u.timeFormat(timestamp) | ||
285 | + | ||
286 | + console.log(timestamp, currentValue) | ||
287 | + | ||
288 | + this.currentValue = currentValue; | ||
289 | + this.$emit('input', timestamp); | ||
290 | + | ||
291 | + }, | ||
292 | + onConfirmSingle(value) { | ||
293 | + this.currentValue = value[0].label; | ||
294 | + this.$emit('input', value[0].value); | ||
295 | + | ||
296 | + }, | ||
297 | + | ||
298 | + onConfirmAutoMutil(value) { | ||
299 | + let currentValue = ''; | ||
300 | + let newValue = []; | ||
301 | + | ||
302 | + if (value && value.length > 0) { | ||
303 | + value.map((item, index, array) => { | ||
304 | + | ||
305 | + if (index == array.length - 1) { | ||
306 | + currentValue += item.label | ||
307 | + } else { | ||
308 | + currentValue += (item.label + '/') | ||
309 | + } | ||
310 | + newValue.push(item.label) | ||
311 | + }) | ||
312 | + } | ||
313 | + this.currentValue = currentValue; | ||
314 | + this.$emit('input', newValue); | ||
315 | + | ||
316 | + }, | ||
317 | + onConfirmArea(value) { | ||
318 | + console.log(value) | ||
319 | + let currentValue = ''; | ||
320 | + let newValue = {}; | ||
321 | + | ||
322 | + if (value && value.length > 0) { | ||
323 | + value.map((item, index, array) => { | ||
324 | + | ||
325 | + switch (index) { | ||
326 | + case 0: | ||
327 | + currentValue += (item.label + '/') | ||
328 | + newValue.province = item.label; | ||
329 | + newValue.province_code = item.value; | ||
330 | + break; | ||
331 | + case 1: | ||
332 | + currentValue += (item.label + '/') | ||
333 | + newValue.city = item.label; | ||
334 | + newValue.city_code = item.value; | ||
335 | + break; | ||
336 | + case 2: | ||
337 | + currentValue += (item.label) | ||
338 | + newValue.district = item.label; | ||
339 | + newValue.district_code = item.value; | ||
340 | + break; | ||
341 | + } | ||
342 | + }) | ||
343 | + } | ||
344 | + this.currentValue = currentValue; | ||
345 | + this.$emit('input', newValue); | ||
346 | + | ||
347 | + }, | ||
348 | + | ||
349 | + } | ||
350 | + } | ||
351 | +</script> | ||
352 | + | ||
353 | +<style lang="scss" scoped> | ||
354 | + .c-input-item { | ||
355 | + u-radio-group { | ||
356 | + text-align: right; | ||
357 | + display: flex; | ||
358 | + flex-direction: row-reverse; | ||
359 | + } | ||
360 | + } | ||
361 | +</style> |
components/c-loading/c-loading.vue
0 → 100644
1 | +<template> | ||
2 | + <view class="m-loading"> | ||
3 | + <u-loadmore :status="loading" :icon="icon" :loadText="loadText" bgColor="#F7F7F7" marginTop='12rpx' marginBottom='12rpx'></u-loadmore> | ||
4 | + </view> | ||
5 | +</template> | ||
6 | + | ||
7 | +<script> | ||
8 | + export default { | ||
9 | + props: { | ||
10 | + loading: { | ||
11 | + type: String, | ||
12 | + default: 'loadmore' | ||
13 | + }, | ||
14 | + icon: { | ||
15 | + type: Boolean, | ||
16 | + default: true | ||
17 | + }, | ||
18 | + loadText: { | ||
19 | + type: Object, | ||
20 | + default () { | ||
21 | + return { | ||
22 | + loadmore: '点击或上拉加载更多', | ||
23 | + loading: '正在加载', | ||
24 | + nomore: '没有更多了' | ||
25 | + } | ||
26 | + } | ||
27 | + } | ||
28 | + }, | ||
29 | + data() { | ||
30 | + return {}; | ||
31 | + } | ||
32 | + }; | ||
33 | +</script> | ||
34 | + | ||
35 | +<style lang="scss"> | ||
36 | + .m-loading { | ||
37 | + background-color: #F7F7F7; | ||
38 | + padding: 20rpx 0; | ||
39 | + } | ||
40 | + | ||
41 | +</style> |
components/c-no-data/c-no-data.vue
0 → 100644
1 | +<template> | ||
2 | + <view class="c-no-data" :style="[wrapStyle]" > | ||
3 | + <view class="image"> | ||
4 | + <u-image :src="vuex_baseImgUrl+'/nodata.png'" width="260rpx" height="200rpx"></u-image> | ||
5 | + </view> | ||
6 | + <view class="title">{{ title }}</view> | ||
7 | + </view> | ||
8 | +</template> | ||
9 | + | ||
10 | +<script> | ||
11 | + export default { | ||
12 | + name: 'c-no-data', | ||
13 | + props: { | ||
14 | + src: { | ||
15 | + type: String, | ||
16 | + default: '' | ||
17 | + }, | ||
18 | + // 标题 | ||
19 | + title: { | ||
20 | + type: String, | ||
21 | + default: '暂无数据' | ||
22 | + }, | ||
23 | + paddingTop: { | ||
24 | + type: String, | ||
25 | + default: "180rpx" | ||
26 | + }, | ||
27 | + }, | ||
28 | + data() { | ||
29 | + return { | ||
30 | + // vuex_baseImgUrl: this.vuex_baseImgUrl | ||
31 | + }; | ||
32 | + }, | ||
33 | + watch: { | ||
34 | + | ||
35 | + }, | ||
36 | + computed: { | ||
37 | + wrapStyle() { | ||
38 | + let style = {}; | ||
39 | + style.paddingTop = this.paddingTop | ||
40 | + return style; | ||
41 | + }, | ||
42 | + }, | ||
43 | + methods: { | ||
44 | + | ||
45 | + | ||
46 | + } | ||
47 | + }; | ||
48 | +</script> | ||
49 | + | ||
50 | +<style scoped lang="scss"> | ||
51 | + .c-no-data { | ||
52 | + width: 100%; | ||
53 | + | ||
54 | + .image { | ||
55 | + width: 260rpx; | ||
56 | + margin: 0 auto; | ||
57 | + } | ||
58 | + | ||
59 | + .title { | ||
60 | + margin: 48rpx 0 0 0; | ||
61 | + text-align: center; | ||
62 | + font-size: 28rpx; | ||
63 | + line-height: 40rpx; | ||
64 | + color: #000000; | ||
65 | + } | ||
66 | + } | ||
67 | +</style> |
请
注册
或
登录
后发表评论