diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..83f8a60 --- /dev/null +++ b/.gitignore @@ -0,0 +1,131 @@ +# ---> Node +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +**/.idea/ +**/target/ +*.iml +*.ipr +*.iws +*.log + +### VS Code ### +.vscode/ +.hbuilderx/ +unpackage/ \ No newline at end of file diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..37dc5ca --- /dev/null +++ b/App.vue @@ -0,0 +1,102 @@ + + + \ No newline at end of file diff --git a/common/Time.js b/common/Time.js new file mode 100644 index 0000000..d157ce8 --- /dev/null +++ b/common/Time.js @@ -0,0 +1,201 @@ +const timeText = (time, format) => { + + if (format == null) { + format = "yyyy-MM-dd HH:mm:ss" + } + + let timeStr = ""; + + let todayEndTime = getTodayEndTime(); + let todayStartTime = getTodayStartTime(); + let thisWeekStartTime = getThisWeekStartTime(); + + console.log("kaishi" + todayStartTime) + console.log("jieshu" + thisWeekStartTime) + + + // 今天23:59:59:999之后 + if (time > todayEndTime) { + // 显示年月日 + timeStr = timeFormat(time, format) + } else if (thisWeekStartTime > time) { + // 此周前(本周星期一之前) + + let i = format.indexOf(" "); + let formatStyle = format.substring(i + 1); + let formatNew = timeFormat(time, formatStyle); + + if (time > todayStartTime - 86399999 && time < todayStartTime) { + // 显示昨天 + timeStr = "昨天 " + formatNew; + } else { + timeStr = timeFormat(time, format) + } + + } else { + // 显示星期 时分 + let i = format.indexOf(" "); + let formatStyle = format.substring(i + 1); + let formatNew = timeFormat(time, formatStyle); + + if (todayStartTime - 86399999 > time) { + // 显示星期 + timeStr = getWeekStr(time) + " " + formatNew + } else if (time > todayStartTime - 86399999 && time < todayStartTime) { + // 显示昨天 + timeStr = "昨天 " + formatNew; + } else { + // 显示 + timeStr = formatNew; + } + } + + return timeStr +} + +/** + * 获取本周开始时间 + */ +const getThisWeekStartTime = () => { + + let todayEndTime = getTodayEndTime(); + + var date = new Date(); + var weekDays = date.getDay(); + var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); + var week = weeks[weekDays]; + + return todayEndTime + 1 - weekDays * 86400000; +} + +/** + * 获取今天是周几 + */ +const getWeekStr = (time) => { + + + if (time instanceof Date) { + + } else { + let temp = new Date(time); + time = temp; + } + + let todayEndTime = getTodayEndTime(); + + var weekDays = time.getDay(); + var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); + var week = weeks[weekDays]; + + return week; +} + +/** + * 获取今天开始时间 + */ +const getTodayStartTime = () => { + + let startTime = 0; + + let myDate = new Date(); + + let current = myDate.getTime(); + + try { + + let format = timeFormat(myDate); + let split = format.split(" "); + let time = split[1].split(":"); + + startTime = current - time[0] * 60 * 60 * 1000 - time[1] * 60 * 1000 - time[2] * 1000 - time[3] + + } catch (e) { + console.log(e) + } + + return startTime; +} + +/** + * 获取今天结束时间 + */ +const getTodayEndTime = () => { + + let endTime = 0; + + let myDate = new Date(); + + let current = myDate.getTime(); + + try { + + let format = timeFormat(myDate); + let split = format.split(" "); + let time = split[1].split(":"); + + let startTime = current - time[0] * 60 * 60 * 1000 - time[1] * 60 * 1000 - time[2] * 1000 - time[3] + endTime = startTime + 86399999; + + } catch (e) { + console.log(e) + } + + return endTime; +} + +/** + * 格式化时间 + * 支持时间戳 以及 date类型 + */ +const timeFormat = (date, formoat) => { + + if (date == undefined || date == null) { + return ""; + } + + if (date instanceof Date) { + console.log("正确") + } else { + let temp = new Date(Number(date)); + date = temp; + } + + let fmt = formoat; + + if (fmt == null) { + fmt = "yyyy-MM-dd HH:mm:ss:SSS" + } + + + let ret; + const opt = { + "y+": date.getFullYear().toString(), // 年 + "M+": (date.getMonth() + 1).toString(), // 月 + "d+": date.getDate().toString(), // 日 + "H+": date.getHours().toString(), // 时 + "m+": date.getMinutes().toString(), // 分 + "s+": date.getSeconds().toString(), // 秒 + "S+": date.getMilliseconds().toString() + + }; + for (let k in opt) { + ret = new RegExp("(" + k + ")").exec(fmt); + if (ret) { + fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) + }; + }; + return fmt; +} + +const currentMillions = () => { + let current = new Date().getTime(); + return current; +} + +export { + timeText, + timeFormat, + currentMillions, + getWeekStr, + getTodayEndTime +} diff --git a/common/app.scss b/common/app.scss new file mode 100644 index 0000000..415d752 --- /dev/null +++ b/common/app.scss @@ -0,0 +1,130 @@ +/** + * 这里是uni-app内置的常用样式变量 + * + * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 + * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App + * + */ + +/** + * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 + * + * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 + */ + +/* 颜色变量 */ + +/* 行为相关颜色 */ +$uni-color-primary: #007aff; +$uni-color-success: #4cd964; +$uni-color-warning: #f0ad4e; +$uni-color-error: #dd524d; + +/* 文字基本颜色 */ +$uni-text-color: #333; //基本色 +$uni-text-color-inverse: #fff; //反色 +$uni-text-color-grey: #999; //辅助灰色,如加载更多的提示信息 +$uni-text-color-placeholder: #808080; +$uni-text-color-disable: #c0c0c0; + +/* 背景颜色 */ +$uni-bg-color: #ffffff; +$uni-bg-color-grey: #f8f8f8; +$uni-bg-color-hover: #f1f1f1; //点击状态颜色 +$uni-bg-color-mask: rgba(0, 0, 0, 0.4); //遮罩颜色 + +/* 边框颜色 */ +$uni-border-color: #c8c7cc; + +/* 尺寸变量 */ + +/* 文字尺寸 */ +$uni-font-size-sm: 12px; +$uni-font-size-base: 14px; +$uni-font-size-lg: 16; + +/* 图片尺寸 */ +$uni-img-size-sm: 20px; +$uni-img-size-base: 26px; +$uni-img-size-lg: 40px; + +/* Border Radius */ +$uni-border-radius-sm: 2px; +$uni-border-radius-base: 3px; +$uni-border-radius-lg: 6px; +$uni-border-radius-circle: 50%; + +/* 水平间距 */ +$uni-spacing-row-sm: 5px; +$uni-spacing-row-base: 10px; +$uni-spacing-row-lg: 15px; + +/* 垂直间距 */ +$uni-spacing-col-sm: 4px; +$uni-spacing-col-base: 8px; +$uni-spacing-col-lg: 12px; + +/* 透明度 */ +$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 + +/* 文章场景相关 */ +$uni-color-title: #2c405a; // 文章标题颜色 +$uni-font-size-title: 20px; +$uni-color-subtitle: #555555; // 二级标题颜色 +$uni-font-size-subtitle: 26px; +$uni-color-paragraph: #3f536e; // 文章段落颜色 +$uni-font-size-paragraph: 15px; + +/** + * 下面为当前APP自己定义的公共样式 + */ +.app-container { + padding: 20px; + font-size: 14px; + line-height: 24px; +} + +.u-block { + padding: 14px; + &__section { + margin-bottom: 10px; + } + &__title { + margin-top: 10px; + font-size: 15px; + color: $u-content-color; + margin-bottom: 10px; + } + &__flex { + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + } +} + +// 使用了cell组件的icon图片样式 +.u-cell-icon { + width: 36rpx; + height: 36rpx; + margin-right: 8rpx; +} + +.u-page { + padding: 15px 15px 40px 15px; +} + +.u-demo-block { + flex: 1; + margin-bottom: 23px; + + &__content { + @include flex(column); + } + + &__title { + font-size: 14px; + color: rgb(143, 156, 162); + margin-bottom: 8px; + @include flex; + } +} diff --git a/common/bus.js b/common/bus.js new file mode 100644 index 0000000..cb21a52 --- /dev/null +++ b/common/bus.js @@ -0,0 +1,3 @@ +import Vue from 'vue' +const bus = new Vue() +export default bus \ No newline at end of file diff --git a/common/config.js b/common/config.js new file mode 100644 index 0000000..5ce3327 --- /dev/null +++ b/common/config.js @@ -0,0 +1,17 @@ +/** + * config 配置项说明 + * baseUrl = "", // 接口的根地址 + * tokenName = "Authorization", // 请求头中token的名字,与服务器端对应 + * loginTimeoutCode : "5000", // 登录超时或失效的情况下,服务器端返回的错误码 + * loginTimeoutPage = "/pages/login/index", // 登录超时或失效的情况下,跳转到的登录页面 + */ +module.exports = { + // baseUrl: 'http://uv32vz.natappfree.cc', // 本地 + // baseUrl: 'http://192.168.0.105:7211', // 本地 + // baseUrl: 'https://39.104.100.138/lpkapi', // 测试服务器 + // baseUrl: 'https://lpk.yyundong.com/mallapi', // 测试服务器 + baseUrl: 'https://supervise.yxtsoft.com/lpkapi', // 正式服务器 + // tokenName: "Authorization", // 请求头中token的名字,与服务器端对应 + loginTimeoutCode: "5001", // 登录超时或失效的情况下,服务器端返回的错误码 + loginTimeoutPage: "/pages/login/index", // 登录超时或失效的情况下,跳转到的登录页面 +} \ No newline at end of file diff --git a/common/empty.js b/common/empty.js new file mode 100644 index 0000000..f44d8fd --- /dev/null +++ b/common/empty.js @@ -0,0 +1,12 @@ +function stringIsEmpty(str) { + return str === undefined || str === null || str === '' +} + +function stringIsNotEmpty(str) { + return !stringIsEmpty(str) +} + +export { + stringIsEmpty, + stringIsNotEmpty +} diff --git a/common/getQuery.js b/common/getQuery.js new file mode 100644 index 0000000..ab91403 --- /dev/null +++ b/common/getQuery.js @@ -0,0 +1,22 @@ +/** + * getQueryString 二维码参数转换提取 + * 参数 + * url 二维码参数 + * name 需要提取的参数 + */ +function getQueryString(url, name) { + let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)",'i'); + var r = url.substr(1).match(reg) + + if (r != null) { + + return r[2] + + } + + return null; +} + +export { + getQueryString +} \ No newline at end of file diff --git a/common/mixin.js b/common/mixin.js new file mode 100644 index 0000000..b6a4eee --- /dev/null +++ b/common/mixin.js @@ -0,0 +1,7 @@ +export default { + data() { + return { + + } + } +} diff --git a/common/nav-calc-utils.js b/common/nav-calc-utils.js new file mode 100644 index 0000000..7cabae7 --- /dev/null +++ b/common/nav-calc-utils.js @@ -0,0 +1,84 @@ +function navParams() { + + let params = { + // 是否支持自定义导航栏(小程序 pc版 false) + supportCustomBar: true, + // 胶囊 + menuButton: { + width: 0, + height: 0 + }, + // 导航栏 + // 可自定义,wx小程序会强制更改 + navBar: { + height: 0, + // 导航栏字体大小 wx小程序 ios:13,Android:17 + fontSize: 0, + // 导航栏样式 wx小程序时:ios:center,Android:left + style: '', + // 导航栏可用宽度 wx小程序时 ios,Android:屏幕宽-胶囊 + enableWidth: 0, + // 导航栏不可用宽度 wx小程序时 ios,Android:胶囊+胶囊距离屏幕右侧边界的距离 + disableWidth: 0 + }, + window: { + width: 0, + height: 0 + }, + os: { + osName: '' + }, + // 导航栏+状态栏高度 + navStatusHeight: '0px', + // 状态栏高度 + statusBarHeight: 0, + unit: 'px' + } + + // 同步获取信息 + let info = uni.getSystemInfoSync(); + + // 状态栏高度 + params.statusBarHeight = info.statusBarHeight; + params.window.width = info.screenWidth + params.window.height = info.screenHeight + params.os.osName = info.osName + + // 获取胶囊相关内容 + // #ifdef MP-WEIXIN + let menuButton = uni.getMenuButtonBoundingClientRect(); + params.menuButton.width = menuButton.width; + params.menuButton.height = menuButton.height; + let paddingTop = menuButton.top - params.statusBarHeight; + let paddingBottom = 0; + if (params.os.osName === 'ios') { + paddingBottom = paddingTop * 2; + params.navBar.fontSize = 13; + params.navBar.style = 'center'; + } else if (params.os.osName === 'android') { + paddingBottom = paddingTop; + params.navBar.fontSize = 17; + params.navBar.style = 'left'; + } else if (params.os.osName === 'windows' || params.os.osName === 'mac') { + params.supportCustomBar = false; + } else { + // 未知系统按照Android处理 + paddingBottom = paddingTop; + params.navBar.fontSize = 17; + params.navBar.style = 'left'; + } + params.navBar.height = params.menuButton.height + paddingTop + paddingBottom; + // 导航栏可用宽度 屏幕左边界到胶囊左边界 + params.navBar.enableWidth = menuButton.left; + params.navBar.disableWidth = params.window.width - params.navBar.enableWidth; + // #endif + + params.navStatusHeight = params.statusBarHeight + params.navBar.height + + console.log(params); + return params +} + +export { + navParams +} \ No newline at end of file diff --git a/common/price.js b/common/price.js new file mode 100644 index 0000000..682fda4 --- /dev/null +++ b/common/price.js @@ -0,0 +1,15 @@ +// 10.00 10.60 +function convertPrice(str) { + if (str == undefined || str == null || str == '') + return '' + if (str.endsWith('.00')) { + return str.substring(0, str.length - 3) + } else if (str.endsWith('0') && str.includes('.')) { + return str.substring(0, str.length - 1) + } + + return str +} +export { + convertPrice +} \ No newline at end of file diff --git a/common/props.js b/common/props.js new file mode 100644 index 0000000..9c1ef07 --- /dev/null +++ b/common/props.js @@ -0,0 +1,2 @@ +uni.$u.props.gap.bgColor = '#f3f4f6' +uni.$u.props.gap.height = '10' diff --git a/common/req.js b/common/req.js new file mode 100644 index 0000000..4b02b48 --- /dev/null +++ b/common/req.js @@ -0,0 +1,16 @@ +const { + http +} = uni.$u + +export default { + login: (params, config = {}) => http.post('/login', params, { + custom: { + catchError: true, + showFailMessage: true + } + }), + sayhello: (params = {}) => http.get("/sayb", params), + + // 查看预警信息 + selectBusinessRiskInfo: (params = {}) => http.post("/v1/businessData/selectBusinessRiskInfo", params) +} diff --git a/common/request.api.js b/common/request.api.js new file mode 100644 index 0000000..db62d60 --- /dev/null +++ b/common/request.api.js @@ -0,0 +1,184 @@ +import request from '@/utils/requester.js' +import config from "@/common/config.js" + +export default { + login: (params = {}) => request.post("/wxmpapi/sysuser/login", params), + wxBindMobile: (params = {}) => request.post("/lpkcustomer/wxBindMobile", params), + // 不显示loading true + // 提货卡列表 + cardList: (params = {}) => request.post("/lpkgiftcard/gifCardByCustomerSid", params, {}, {}, true), + // 福礼卡列表 + gifcardList: (params = {}) => request.post("/empcardgift/gifCardByCustomerSid", params, {}, {}, true), + // 企业卡列表 + empcardList: (params = {}) => request.post("/empcard/getEmpCardByCustomerSid", params, {}, {}, true), + // 提货卡详情 + cardDetail: (params = {}) => request.get("/lpkgiftcard/getGifCardBySid/" + params, params, {}, {}, true), + // 福礼卡详情 + gifcardDetail: (params = {}) => request.get("/empcardgift/getGifCardBySid/" + params, params, {}, {}, true), + // 企业卡详情 + empCardDetail: (params = {}) => request.get("/empcard/getEmpCardBySid/" + params, params, {}, {}, true), + // 福礼卡分享 改变卡状态 + shareEmpCard: (params = {}) => request.get("/empcardgift/shareEmpCard/" + params, params, {}, {}, true), + // 提货日期 周六日的日期组合 + isSaturAndSun: (params = {}) => request.get("/lpkgiftcard/isSaturAndSun/" + params, params, {}, {}, true), + // 提货日期 周六日的日期组合 + isSaturAndSun2: (params = {}) => request.get("/empcardgift/isSaturAndSun/" + params, params, {}, {}, true), + // 提货日期 周六日的日期组合 + isSaturAndSun3: (params = {}) => request.get("/empcard/isSaturAndSun/" + params, params, {}, {}, true), + // 提货卡预约初始化 + cardBooking: (params = {}) => request.get("/lpkgiftcard/getReservationBySid/" + params, params, {}, {}, true), + // 提货卡预约保存 + cardBookingSave: (params = {}) => request.post("/lpksreservoorder/submission", params), + // 提货卡转赠保存 + generateEmpCard: (params = {}) => request.post("/empcardgift/generateEmpCard", params), + // 福礼卡预约保存 + gifcardBookingSave: (params = {}) => request.post("/empsreservoorder/submission", params), + // 福利卡转赠保存 + generateEmpCardGift: (params = {}) => request.post("/empcardgift/generateEmpCardGift", params), + // 企业卡生成福利卡 + empcardSave: (params = {}) => request.post("/empcardgift/generateCard", params), + // 企业卡预约保存 + empcardBookingSave: (params = {}) => request.post("/empsreservoorder/submissionEmp", params), + // 绑定提货卡 + cardBind: (params = {}) => request.post("/lpkgiftcard/bindCard", params), + // 绑定企业卡 + empcardBind: (params = {}) => request.post("/empcard/bindCard", params), + // 单一提货卡预约记录 + orderByCardSid: (params = {}) => request.get("/lpksreservoorder/orderByCardSid/" + params, params, {}, {}, true), + // 订单记录 + orderListByUserSid: (params = {}) => request.post("/lpksreservoorder/orderListByUserSid", params, {}, {}, true), + // 订单详情 + orderDetails: (params = {}) => request.get("/lpksreservoorder/orderDetails/" + params, params, {}, {}, true), + // 订单退款 + orderRetrun: (params = {}) => request.post("/refund/createOrder", params, {}, {}, true), + // 商品详情 + goodsDetail: (params = {}) => request.get("/lpkgoods/goodsDetails/" + params.sid + "/" + params + .customerSid, {}, {}, {}, true), + // 提货点 + address: (params = {}) => request.post("/lpkstore/getAllStoreByQuery", params, {}, {}, true), + + + // 2024-1-13 新需求接口 所有卡数据整合到一个页面 + // 新提货卡列表 + pickUpCardList: (params = {}) => request.post("/lpkgiftcard/gifCardsByCustomerSid", params, {}, {}, true), + // 新绑定提货卡 + pickUpCardBind: (params = {}) => request.post("/lpkgiftcard/bindAllCard", params), + + // 云菜窖列表 + appletGiftBagList: (params = {}) => request.get("/appletgiftbag/appletGiftBagList", params), + // 云菜窖列表 + getGiftBagBySid: (params = {}) => request.get("/appletgiftbag/getGiftBagBySid/" + params, params), + // 自选菜窖 商品信息 + getAllGiftBag: (params = {}) => request.get("/lpkgoods/getAllGiftBag", params), + // 結算商品 + createOrder: (params = {}) => request.post("/empsreservoorder/createOrder", params), + // 预约记录 + orderListByUserSid: (params = {}) => request.post("/lpksreservoorder/orderListByUserSid", params, {}, {}), + // 取消预约记录 + cancelReservation: (params = {}) => request.get("/lpksreservoorders/cancelReservation/" + params, params, {}, {}), + // 转赠记录 + transferRecordsList: (params = {}) => request.post("/transferrecords/transferRecordsList", params, {}, {}), + + + // 我的 + // 获取头像 昵称 + getUserInfo: (params = {}) => request.get("/lpkcustomer/customerInfo/" + params, params), + // 用户基本信息 + getBaseInfo: (params = {}) => request.get("/lpkcustomer/getCustomerInfo/" + params, params, {}, {}, true), + // 修改头像 + uploadHandImage: (params = {}) => request.post("/lpkcustomer/uploadAvatar", params), + // 获取默认提菜信息 + getStoreBySid: (params = {}) => request.get("/customerstore/getStoreBySid/" + params, params), + // 推荐有礼 + myRecommend: (params = {}) => request.get("/newcomerrecorecord/recordList/" + params, params), + // 基本信息修改头像 + headerUpload: config.baseUrl + '/lpkcustomer/modifyHeadImage', + // 修改昵称 + changeNick: (params = {}) => request.formpost("/lpkcustomer/modifyUserNickName", params), + // 获取手机号 + getPhone: (params = {}) => request.formpost("/lpkcustomer/getPhoneNumber", params), + // 获取实名 + getRealInfo: (params = {}) => request.get("/lpkcustomer/getRealInfo/" + params, params, {}, {}, true), + // 保存实名 + saveRealInfo: (params = {}) => request.post("/lpkcustomer/saveRealInfo", params), + // 查询推荐支行 + searchTuiJianZhiHang: (params = {}) => request.get("/LpkCustomerBank/getBankList", params), + // 保存支行 + saveTuiJianZhiHang: (params = {}) => request.formpost("/lpkcustomer/updateCustomerBank", params), + // 我的 预约记录 + myOrderListByUserSid: (params = {}) => request.post("/lpksreservoorders/orderListByUserSid", params, {}, {}), + // 我的 订单列表 + ordersList: (params = {}) => request.post("/empsreservoorder/ordersList", params, {}, {}), + // 我的 订单详情 + orderDetails: (params = {}) => request.get("/empsreservoorder/OrderDetails/" + params, params, {}, {}, true), + // 我的 订单详情 修改订单状态 + changePayState: (params = {}) => request.get("/empsreservoorder/changePayState/" + params, params, {}, {}, true), + // 订单发票获取授权页链接 + wxElectronicInvoice: (params = {}) => request.post("/empsreservoorder/wxElectronicInvoice", params, {}, {}), + // 我的 失效商品 + vegeCellarInvalidList: (params = {}) => request.post("/lpkgoods/vegeCellarInvalidList", params, {}, {}), + + // 查询发票列表 + getInvoiceList: (params = {}) => request.get("/customerinvoice/listInvoice/" + params, params), + // 新增发票 + saveOrUpdateInvoice: (params = {}) => request.post("/customerinvoice/saveOrUpdate", params, {}, {}), + // 提交申请发票 + submitInvoice: (params = {}) => request.post("/invoicerecords/save", params, {}, {}), + // 我的 推荐有礼 + recommendNewUsers: (params = {}) => request.post("/newcomerrecorecord/recommendNewUsers", params, {}, {}), + // 新人助力 + recommendedAssistance: (params = {}) => request.post("/newcomerrecorecord/recommendedAssistance", params, {}, {}), + + + // 2024-1-15 新需求 + // 获取轮播图 + bannerList: (params = {}) => request.get("/wxapi/banner/list", params), + // 获取分类和品牌 + getGoodsTypeAndBrand: (params = {}) => request.get("/lpkgoods/getGoodsTypeAndBrand", {}, {}, {}, true), + // 判断企业菜窖是否认证 + isEnterprise: (params = {}) => request.get("/lpkgoods/isEnterprise/" + params.customerSid + "/" + params.brandId, + + params, {}, {}, {}, true, true), + // 保存企业认证 + saveAuthentication: (params = {}) => request.post("/enterprisecertification/save", params), + // 获取补充菜窖 商品分类列表 + getAllGoodsType: (params = {}) => request.get("/lpkgiftcard/getAllGoodsType/" + params, params), + // 获取补充菜窖 商品分类列表 + getGoodsByType: (params = {}) => request.post("/lpkgoods/getGoodsByType", params, {}, {}, true), + // 获取当前购物车总价及总斤数 + getGoodsWeight: (params = {}) => request.post("/shoppingcart/getGoodsWeight", params, {}, {}, true), + // 加入购物车 + addShoppingCart: (params = {}) => request.post("/shoppingcart/addShoppingCart", params), + // 购物车列表 + shoppingCartList: (params = {}) => request.post("/shoppingcart/shoppingCartList", params, {}, {}, true), + // 结算 跳过支付 + saveGoods: (params = {}) => request.post("/vegetablecellar/saveGoods", params), + // 正式结算 支付 + createVegeOrder: (params = {}) => request.post("/empsreservoorder/createVegeOrder", params), + + + // 我的菜窖 通知公告 + getNotices: (params = {}) => request.get("/appletnotice/getNotice", params), + // 我的菜窖 新人礼包列表 + newUserQuota: (params = {}) => request.post("/appletgiftbag/newUserQuota", params), + // 结算新人礼包 支付 + createNewUserBagOrder: (params = {}) => request.post("/empsreservoorder/createNewUserBagOrder", params), + // 我的菜窖 类型列表 + vegeCellarTypeList: (params = {}) => request.post("/lpkgoods/vegeCellarTypeList", params), + // 我的菜窖 商品列表 + vegeCellarList: (params = {}) => request.post("/lpkgoods/vegeCellarList", params), + // 我的菜窖 转赠亲友 + transSubmission: (params = {}) => request.post("/transferrecords/submission", params), + // 我的菜窖 获取转赠内容 + getTransferByCode: (params = {}) => request.post("/transferrecords/getTransferByCode/" + params, params), + // 我的菜窖 领取/绑定转赠菜窖 + receiveTransferGoods: (params = {}) => request.post("/vegetablecellar/receiveTransferGoods", params), + // 我的菜窖 绑定之前发出的礼品卡 + bindAllCard: (params = {}) => request.post("/lpkgiftcard/bindAllCard", params), + // 我的菜窖 预约提菜 + getStoreBySid: (params = {}) => request.get("/customerstore/getStoreBySid/" + params, params), + // 我的菜窖 预约提菜 选择时间范围 + getExtractSaturAndSun: (params = {}) => request.get("/customerstore/isSaturAndSun", params), + // 我的菜窖 保存预约提菜 + submissionExtract: (params = {}) => request.post("/lpksreservoorders/submission", params, {}, {}, true), + +} \ No newline at end of file diff --git a/common/toast.js b/common/toast.js new file mode 100644 index 0000000..ddd24fd --- /dev/null +++ b/common/toast.js @@ -0,0 +1,20 @@ +function shortToast(str) { + uni.showToast({ + title: str, + icon: 'none', + duration: 2000 + }) +} + +function longToast(str) { + uni.showToast({ + title: str, + icon: 'none', + duration: 3500 + }) +} + +export { + shortToast, + longToast +} diff --git a/components/NavBar/NavBar.vue b/components/NavBar/NavBar.vue new file mode 100644 index 0000000..f476045 --- /dev/null +++ b/components/NavBar/NavBar.vue @@ -0,0 +1,240 @@ + + + + + \ No newline at end of file diff --git a/components/UserItem/UserItem.vue b/components/UserItem/UserItem.vue new file mode 100644 index 0000000..469b35c --- /dev/null +++ b/components/UserItem/UserItem.vue @@ -0,0 +1,101 @@ + + + + + \ No newline at end of file diff --git a/components/pick-regions/pick-regions.vue b/components/pick-regions/pick-regions.vue new file mode 100644 index 0000000..2b21017 --- /dev/null +++ b/components/pick-regions/pick-regions.vue @@ -0,0 +1,135 @@ + + + diff --git a/components/pick-regions/regions.json b/components/pick-regions/regions.json new file mode 100644 index 0000000..23dfc35 --- /dev/null +++ b/components/pick-regions/regions.json @@ -0,0 +1,10330 @@ +[{ + "code": "11", + "name": "北京市", + "childs": [{ + "code": "1101", + "name": "市辖区", + "childs": [{ + "code": "110101", + "name": "东城区" + }, { + "code": "110102", + "name": "西城区" + }, { + "code": "110105", + "name": "朝阳区" + }, { + "code": "110106", + "name": "丰台区" + }, { + "code": "110107", + "name": "石景山区" + }, { + "code": "110108", + "name": "海淀区" + }, { + "code": "110109", + "name": "门头沟区" + }, { + "code": "110111", + "name": "房山区" + }, { + "code": "110112", + "name": "通州区" + }, { + "code": "110113", + "name": "顺义区" + }, { + "code": "110114", + "name": "昌平区" + }, { + "code": "110115", + "name": "大兴区" + }, { + "code": "110116", + "name": "怀柔区" + }, { + "code": "110117", + "name": "平谷区" + }, { + "code": "110118", + "name": "密云区" + }, { + "code": "110119", + "name": "延庆区" + }] + }] +}, { + "code": "12", + "name": "天津市", + "childs": [{ + "code": "1201", + "name": "市辖区", + "childs": [{ + "code": "120101", + "name": "和平区" + }, { + "code": "120102", + "name": "河东区" + }, { + "code": "120103", + "name": "河西区" + }, { + "code": "120104", + "name": "南开区" + }, { + "code": "120105", + "name": "河北区" + }, { + "code": "120106", + "name": "红桥区" + }, { + "code": "120110", + "name": "东丽区" + }, { + "code": "120111", + "name": "西青区" + }, { + "code": "120112", + "name": "津南区" + }, { + "code": "120113", + "name": "北辰区" + }, { + "code": "120114", + "name": "武清区" + }, { + "code": "120115", + "name": "宝坻区" + }, { + "code": "120116", + "name": "滨海新区" + }, { + "code": "120117", + "name": "宁河区" + }, { + "code": "120118", + "name": "静海区" + }, { + "code": "120119", + "name": "蓟州区" + }] + }] +}, { + "code": "13", + "name": "河北省", + "childs": [{ + "code": "1301", + "name": "石家庄市", + "childs": [{ + "code": "130102", + "name": "长安区" + }, { + "code": "130104", + "name": "桥西区" + }, { + "code": "130105", + "name": "新华区" + }, { + "code": "130107", + "name": "井陉矿区" + }, { + "code": "130108", + "name": "裕华区" + }, { + "code": "130109", + "name": "藁城区" + }, { + "code": "130110", + "name": "鹿泉区" + }, { + "code": "130111", + "name": "栾城区" + }, { + "code": "130121", + "name": "井陉县" + }, { + "code": "130123", + "name": "正定县" + }, { + "code": "130125", + "name": "行唐县" + }, { + "code": "130126", + "name": "灵寿县" + }, { + "code": "130127", + "name": "高邑县" + }, { + "code": "130128", + "name": "深泽县" + }, { + "code": "130129", + "name": "赞皇县" + }, { + "code": "130130", + "name": "无极县" + }, { + "code": "130131", + "name": "平山县" + }, { + "code": "130132", + "name": "元氏县" + }, { + "code": "130133", + "name": "赵县" + }, { + "code": "130183", + "name": "晋州市" + }, { + "code": "130184", + "name": "新乐市" + }] + }, { + "code": "1302", + "name": "唐山市", + "childs": [{ + "code": "130202", + "name": "路南区" + }, { + "code": "130203", + "name": "路北区" + }, { + "code": "130204", + "name": "古冶区" + }, { + "code": "130205", + "name": "开平区" + }, { + "code": "130207", + "name": "丰南区" + }, { + "code": "130208", + "name": "丰润区" + }, { + "code": "130209", + "name": "曹妃甸区" + }, { + "code": "130223", + "name": "滦县" + }, { + "code": "130224", + "name": "滦南县" + }, { + "code": "130225", + "name": "乐亭县" + }, { + "code": "130227", + "name": "迁西县" + }, { + "code": "130229", + "name": "玉田县" + }, { + "code": "130281", + "name": "遵化市" + }, { + "code": "130283", + "name": "迁安市" + }] + }, { + "code": "1303", + "name": "秦皇岛市", + "childs": [{ + "code": "130302", + "name": "海港区" + }, { + "code": "130303", + "name": "山海关区" + }, { + "code": "130304", + "name": "北戴河区" + }, { + "code": "130306", + "name": "抚宁区" + }, { + "code": "130321", + "name": "青龙满族自治县" + }, { + "code": "130322", + "name": "昌黎县" + }, { + "code": "130324", + "name": "卢龙县" + }] + }, { + "code": "1304", + "name": "邯郸市", + "childs": [{ + "code": "130402", + "name": "邯山区" + }, { + "code": "130403", + "name": "丛台区" + }, { + "code": "130404", + "name": "复兴区" + }, { + "code": "130406", + "name": "峰峰矿区" + }, { + "code": "130421", + "name": "邯郸县" + }, { + "code": "130423", + "name": "临漳县" + }, { + "code": "130424", + "name": "成安县" + }, { + "code": "130425", + "name": "大名县" + }, { + "code": "130426", + "name": "涉县" + }, { + "code": "130427", + "name": "磁县" + }, { + "code": "130428", + "name": "肥乡县" + }, { + "code": "130429", + "name": "永年县" + }, { + "code": "130430", + "name": "邱县" + }, { + "code": "130431", + "name": "鸡泽县" + }, { + "code": "130432", + "name": "广平县" + }, { + "code": "130433", + "name": "馆陶县" + }, { + "code": "130434", + "name": "魏县" + }, { + "code": "130435", + "name": "曲周县" + }, { + "code": "130481", + "name": "武安市" + }] + }, { + "code": "1305", + "name": "邢台市", + "childs": [{ + "code": "130502", + "name": "桥东区" + }, { + "code": "130503", + "name": "桥西区" + }, { + "code": "130521", + "name": "邢台县" + }, { + "code": "130522", + "name": "临城县" + }, { + "code": "130523", + "name": "内丘县" + }, { + "code": "130524", + "name": "柏乡县" + }, { + "code": "130525", + "name": "隆尧县" + }, { + "code": "130526", + "name": "任县" + }, { + "code": "130527", + "name": "南和县" + }, { + "code": "130528", + "name": "宁晋县" + }, { + "code": "130529", + "name": "巨鹿县" + }, { + "code": "130530", + "name": "新河县" + }, { + "code": "130531", + "name": "广宗县" + }, { + "code": "130532", + "name": "平乡县" + }, { + "code": "130533", + "name": "威县" + }, { + "code": "130534", + "name": "清河县" + }, { + "code": "130535", + "name": "临西县" + }, { + "code": "130581", + "name": "南宫市" + }, { + "code": "130582", + "name": "沙河市" + }] + }, { + "code": "1306", + "name": "保定市", + "childs": [{ + "code": "130602", + "name": "竞秀区" + }, { + "code": "130606", + "name": "莲池区" + }, { + "code": "130607", + "name": "满城区" + }, { + "code": "130608", + "name": "清苑区" + }, { + "code": "130609", + "name": "徐水区" + }, { + "code": "130623", + "name": "涞水县" + }, { + "code": "130624", + "name": "阜平县" + }, { + "code": "130626", + "name": "定兴县" + }, { + "code": "130627", + "name": "唐县" + }, { + "code": "130628", + "name": "高阳县" + }, { + "code": "130629", + "name": "容城县" + }, { + "code": "130630", + "name": "涞源县" + }, { + "code": "130631", + "name": "望都县" + }, { + "code": "130632", + "name": "安新县" + }, { + "code": "130633", + "name": "易县" + }, { + "code": "130634", + "name": "曲阳县" + }, { + "code": "130635", + "name": "蠡县" + }, { + "code": "130636", + "name": "顺平县" + }, { + "code": "130637", + "name": "博野县" + }, { + "code": "130638", + "name": "雄县" + }, { + "code": "130681", + "name": "涿州市" + }, { + "code": "130683", + "name": "安国市" + }, { + "code": "130684", + "name": "高碑店市" + }] + }, { + "code": "1307", + "name": "张家口市", + "childs": [{ + "code": "130702", + "name": "桥东区" + }, { + "code": "130703", + "name": "桥西区" + }, { + "code": "130705", + "name": "宣化区" + }, { + "code": "130706", + "name": "下花园区" + }, { + "code": "130708", + "name": "万全区" + }, { + "code": "130709", + "name": "崇礼区" + }, { + "code": "130722", + "name": "张北县" + }, { + "code": "130723", + "name": "康保县" + }, { + "code": "130724", + "name": "沽源县" + }, { + "code": "130725", + "name": "尚义县" + }, { + "code": "130726", + "name": "蔚县" + }, { + "code": "130727", + "name": "阳原县" + }, { + "code": "130728", + "name": "怀安县" + }, { + "code": "130730", + "name": "怀来县" + }, { + "code": "130731", + "name": "涿鹿县" + }, { + "code": "130732", + "name": "赤城县" + }] + }, { + "code": "1308", + "name": "承德市", + "childs": [{ + "code": "130802", + "name": "双桥区" + }, { + "code": "130803", + "name": "双滦区" + }, { + "code": "130804", + "name": "鹰手营子矿区" + }, { + "code": "130821", + "name": "承德县" + }, { + "code": "130822", + "name": "兴隆县" + }, { + "code": "130823", + "name": "平泉县" + }, { + "code": "130824", + "name": "滦平县" + }, { + "code": "130825", + "name": "隆化县" + }, { + "code": "130826", + "name": "丰宁满族自治县" + }, { + "code": "130827", + "name": "宽城满族自治县" + }, { + "code": "130828", + "name": "围场满族蒙古族自治县" + }] + }, { + "code": "1309", + "name": "沧州市", + "childs": [{ + "code": "130902", + "name": "新华区" + }, { + "code": "130903", + "name": "运河区" + }, { + "code": "130921", + "name": "沧县" + }, { + "code": "130922", + "name": "青县" + }, { + "code": "130923", + "name": "东光县" + }, { + "code": "130924", + "name": "海兴县" + }, { + "code": "130925", + "name": "盐山县" + }, { + "code": "130926", + "name": "肃宁县" + }, { + "code": "130927", + "name": "南皮县" + }, { + "code": "130928", + "name": "吴桥县" + }, { + "code": "130929", + "name": "献县" + }, { + "code": "130930", + "name": "孟村回族自治县" + }, { + "code": "130981", + "name": "泊头市" + }, { + "code": "130982", + "name": "任丘市" + }, { + "code": "130983", + "name": "黄骅市" + }, { + "code": "130984", + "name": "河间市" + }] + }, { + "code": "1310", + "name": "廊坊市", + "childs": [{ + "code": "131002", + "name": "安次区" + }, { + "code": "131003", + "name": "广阳区" + }, { + "code": "131022", + "name": "固安县" + }, { + "code": "131023", + "name": "永清县" + }, { + "code": "131024", + "name": "香河县" + }, { + "code": "131025", + "name": "大城县" + }, { + "code": "131026", + "name": "文安县" + }, { + "code": "131028", + "name": "大厂回族自治县" + }, { + "code": "131081", + "name": "霸州市" + }, { + "code": "131082", + "name": "三河市" + }] + }, { + "code": "1311", + "name": "衡水市", + "childs": [{ + "code": "131102", + "name": "桃城区" + }, { + "code": "131103", + "name": "冀州区" + }, { + "code": "131121", + "name": "枣强县" + }, { + "code": "131122", + "name": "武邑县" + }, { + "code": "131123", + "name": "武强县" + }, { + "code": "131124", + "name": "饶阳县" + }, { + "code": "131125", + "name": "安平县" + }, { + "code": "131126", + "name": "故城县" + }, { + "code": "131127", + "name": "景县" + }, { + "code": "131128", + "name": "阜城县" + }, { + "code": "131182", + "name": "深州市" + }] + }, { + "code": "1390", + "name": "省直辖县级行政区划", + "childs": [{ + "code": "139001", + "name": "定州市" + }, { + "code": "139002", + "name": "辛集市" + }] + }] +}, { + "code": "14", + "name": "山西省", + "childs": [{ + "code": "1401", + "name": "太原市", + "childs": [{ + "code": "140105", + "name": "小店区" + }, { + "code": "140106", + "name": "迎泽区" + }, { + "code": "140107", + "name": "杏花岭区" + }, { + "code": "140108", + "name": "尖草坪区" + }, { + "code": "140109", + "name": "万柏林区" + }, { + "code": "140110", + "name": "晋源区" + }, { + "code": "140121", + "name": "清徐县" + }, { + "code": "140122", + "name": "阳曲县" + }, { + "code": "140123", + "name": "娄烦县" + }, { + "code": "140181", + "name": "古交市" + }] + }, { + "code": "1402", + "name": "大同市", + "childs": [{ + "code": "140202", + "name": "城区" + }, { + "code": "140203", + "name": "矿区" + }, { + "code": "140211", + "name": "南郊区" + }, { + "code": "140212", + "name": "新荣区" + }, { + "code": "140221", + "name": "阳高县" + }, { + "code": "140222", + "name": "天镇县" + }, { + "code": "140223", + "name": "广灵县" + }, { + "code": "140224", + "name": "灵丘县" + }, { + "code": "140225", + "name": "浑源县" + }, { + "code": "140226", + "name": "左云县" + }, { + "code": "140227", + "name": "大同县" + }] + }, { + "code": "1403", + "name": "阳泉市", + "childs": [{ + "code": "140302", + "name": "城区" + }, { + "code": "140303", + "name": "矿区" + }, { + "code": "140311", + "name": "郊区" + }, { + "code": "140321", + "name": "平定县" + }, { + "code": "140322", + "name": "盂县" + }] + }, { + "code": "1404", + "name": "长治市", + "childs": [{ + "code": "140402", + "name": "城区" + }, { + "code": "140411", + "name": "郊区" + }, { + "code": "140421", + "name": "长治县" + }, { + "code": "140423", + "name": "襄垣县" + }, { + "code": "140424", + "name": "屯留县" + }, { + "code": "140425", + "name": "平顺县" + }, { + "code": "140426", + "name": "黎城县" + }, { + "code": "140427", + "name": "壶关县" + }, { + "code": "140428", + "name": "长子县" + }, { + "code": "140429", + "name": "武乡县" + }, { + "code": "140430", + "name": "沁县" + }, { + "code": "140431", + "name": "沁源县" + }, { + "code": "140481", + "name": "潞城市" + }] + }, { + "code": "1405", + "name": "晋城市", + "childs": [{ + "code": "140502", + "name": "城区" + }, { + "code": "140521", + "name": "沁水县" + }, { + "code": "140522", + "name": "阳城县" + }, { + "code": "140524", + "name": "陵川县" + }, { + "code": "140525", + "name": "泽州县" + }, { + "code": "140581", + "name": "高平市" + }] + }, { + "code": "1406", + "name": "朔州市", + "childs": [{ + "code": "140602", + "name": "朔城区" + }, { + "code": "140603", + "name": "平鲁区" + }, { + "code": "140621", + "name": "山阴县" + }, { + "code": "140622", + "name": "应县" + }, { + "code": "140623", + "name": "右玉县" + }, { + "code": "140624", + "name": "怀仁县" + }] + }, { + "code": "1407", + "name": "晋中市", + "childs": [{ + "code": "140702", + "name": "榆次区" + }, { + "code": "140721", + "name": "榆社县" + }, { + "code": "140722", + "name": "左权县" + }, { + "code": "140723", + "name": "和顺县" + }, { + "code": "140724", + "name": "昔阳县" + }, { + "code": "140725", + "name": "寿阳县" + }, { + "code": "140726", + "name": "太谷县" + }, { + "code": "140727", + "name": "祁县" + }, { + "code": "140728", + "name": "平遥县" + }, { + "code": "140729", + "name": "灵石县" + }, { + "code": "140781", + "name": "介休市" + }] + }, { + "code": "1408", + "name": "运城市", + "childs": [{ + "code": "140802", + "name": "盐湖区" + }, { + "code": "140821", + "name": "临猗县" + }, { + "code": "140822", + "name": "万荣县" + }, { + "code": "140823", + "name": "闻喜县" + }, { + "code": "140824", + "name": "稷山县" + }, { + "code": "140825", + "name": "新绛县" + }, { + "code": "140826", + "name": "绛县" + }, { + "code": "140827", + "name": "垣曲县" + }, { + "code": "140828", + "name": "夏县" + }, { + "code": "140829", + "name": "平陆县" + }, { + "code": "140830", + "name": "芮城县" + }, { + "code": "140881", + "name": "永济市" + }, { + "code": "140882", + "name": "河津市" + }] + }, { + "code": "1409", + "name": "忻州市", + "childs": [{ + "code": "140902", + "name": "忻府区" + }, { + "code": "140921", + "name": "定襄县" + }, { + "code": "140922", + "name": "五台县" + }, { + "code": "140923", + "name": "代县" + }, { + "code": "140924", + "name": "繁峙县" + }, { + "code": "140925", + "name": "宁武县" + }, { + "code": "140926", + "name": "静乐县" + }, { + "code": "140927", + "name": "神池县" + }, { + "code": "140928", + "name": "五寨县" + }, { + "code": "140929", + "name": "岢岚县" + }, { + "code": "140930", + "name": "河曲县" + }, { + "code": "140931", + "name": "保德县" + }, { + "code": "140932", + "name": "偏关县" + }, { + "code": "140981", + "name": "原平市" + }] + }, { + "code": "1410", + "name": "临汾市", + "childs": [{ + "code": "141002", + "name": "尧都区" + }, { + "code": "141021", + "name": "曲沃县" + }, { + "code": "141022", + "name": "翼城县" + }, { + "code": "141023", + "name": "襄汾县" + }, { + "code": "141024", + "name": "洪洞县" + }, { + "code": "141025", + "name": "古县" + }, { + "code": "141026", + "name": "安泽县" + }, { + "code": "141027", + "name": "浮山县" + }, { + "code": "141028", + "name": "吉县" + }, { + "code": "141029", + "name": "乡宁县" + }, { + "code": "141030", + "name": "大宁县" + }, { + "code": "141031", + "name": "隰县" + }, { + "code": "141032", + "name": "永和县" + }, { + "code": "141033", + "name": "蒲县" + }, { + "code": "141034", + "name": "汾西县" + }, { + "code": "141081", + "name": "侯马市" + }, { + "code": "141082", + "name": "霍州市" + }] + }, { + "code": "1411", + "name": "吕梁市", + "childs": [{ + "code": "141102", + "name": "离石区" + }, { + "code": "141121", + "name": "文水县" + }, { + "code": "141122", + "name": "交城县" + }, { + "code": "141123", + "name": "兴县" + }, { + "code": "141124", + "name": "临县" + }, { + "code": "141125", + "name": "柳林县" + }, { + "code": "141126", + "name": "石楼县" + }, { + "code": "141127", + "name": "岚县" + }, { + "code": "141128", + "name": "方山县" + }, { + "code": "141129", + "name": "中阳县" + }, { + "code": "141130", + "name": "交口县" + }, { + "code": "141181", + "name": "孝义市" + }, { + "code": "141182", + "name": "汾阳市" + }] + }] +}, { + "code": "15", + "name": "内蒙古自治区", + "childs": [{ + "code": "1501", + "name": "呼和浩特市", + "childs": [{ + "code": "150102", + "name": "新城区" + }, { + "code": "150103", + "name": "回民区" + }, { + "code": "150104", + "name": "玉泉区" + }, { + "code": "150105", + "name": "赛罕区" + }, { + "code": "150121", + "name": "土默特左旗" + }, { + "code": "150122", + "name": "托克托县" + }, { + "code": "150123", + "name": "和林格尔县" + }, { + "code": "150124", + "name": "清水河县" + }, { + "code": "150125", + "name": "武川县" + }] + }, { + "code": "1502", + "name": "包头市", + "childs": [{ + "code": "150202", + "name": "东河区" + }, { + "code": "150203", + "name": "昆都仑区" + }, { + "code": "150204", + "name": "青山区" + }, { + "code": "150205", + "name": "石拐区" + }, { + "code": "150206", + "name": "白云鄂博矿区" + }, { + "code": "150207", + "name": "九原区" + }, { + "code": "150221", + "name": "土默特右旗" + }, { + "code": "150222", + "name": "固阳县" + }, { + "code": "150223", + "name": "达尔罕茂明安联合旗" + }] + }, { + "code": "1503", + "name": "乌海市", + "childs": [{ + "code": "150302", + "name": "海勃湾区" + }, { + "code": "150303", + "name": "海南区" + }, { + "code": "150304", + "name": "乌达区" + }] + }, { + "code": "1504", + "name": "赤峰市", + "childs": [{ + "code": "150402", + "name": "红山区" + }, { + "code": "150403", + "name": "元宝山区" + }, { + "code": "150404", + "name": "松山区" + }, { + "code": "150421", + "name": "阿鲁科尔沁旗" + }, { + "code": "150422", + "name": "巴林左旗" + }, { + "code": "150423", + "name": "巴林右旗" + }, { + "code": "150424", + "name": "林西县" + }, { + "code": "150425", + "name": "克什克腾旗" + }, { + "code": "150426", + "name": "翁牛特旗" + }, { + "code": "150428", + "name": "喀喇沁旗" + }, { + "code": "150429", + "name": "宁城县" + }, { + "code": "150430", + "name": "敖汉旗" + }] + }, { + "code": "1505", + "name": "通辽市", + "childs": [{ + "code": "150502", + "name": "科尔沁区" + }, { + "code": "150521", + "name": "科尔沁左翼中旗" + }, { + "code": "150522", + "name": "科尔沁左翼后旗" + }, { + "code": "150523", + "name": "开鲁县" + }, { + "code": "150524", + "name": "库伦旗" + }, { + "code": "150525", + "name": "奈曼旗" + }, { + "code": "150526", + "name": "扎鲁特旗" + }, { + "code": "150581", + "name": "霍林郭勒市" + }] + }, { + "code": "1506", + "name": "鄂尔多斯市", + "childs": [{ + "code": "150602", + "name": "东胜区" + }, { + "code": "150603", + "name": "康巴什区" + }, { + "code": "150621", + "name": "达拉特旗" + }, { + "code": "150622", + "name": "准格尔旗" + }, { + "code": "150623", + "name": "鄂托克前旗" + }, { + "code": "150624", + "name": "鄂托克旗" + }, { + "code": "150625", + "name": "杭锦旗" + }, { + "code": "150626", + "name": "乌审旗" + }, { + "code": "150627", + "name": "伊金霍洛旗" + }] + }, { + "code": "1507", + "name": "呼伦贝尔市", + "childs": [{ + "code": "150702", + "name": "海拉尔区" + }, { + "code": "150703", + "name": "扎赉诺尔区" + }, { + "code": "150721", + "name": "阿荣旗" + }, { + "code": "150722", + "name": "莫力达瓦达斡尔族自治旗" + }, { + "code": "150723", + "name": "鄂伦春自治旗" + }, { + "code": "150724", + "name": "鄂温克族自治旗" + }, { + "code": "150725", + "name": "陈巴尔虎旗" + }, { + "code": "150726", + "name": "新巴尔虎左旗" + }, { + "code": "150727", + "name": "新巴尔虎右旗" + }, { + "code": "150781", + "name": "满洲里市" + }, { + "code": "150782", + "name": "牙克石市" + }, { + "code": "150783", + "name": "扎兰屯市" + }, { + "code": "150784", + "name": "额尔古纳市" + }, { + "code": "150785", + "name": "根河市" + }] + }, { + "code": "1508", + "name": "巴彦淖尔市", + "childs": [{ + "code": "150802", + "name": "临河区" + }, { + "code": "150821", + "name": "五原县" + }, { + "code": "150822", + "name": "磴口县" + }, { + "code": "150823", + "name": "乌拉特前旗" + }, { + "code": "150824", + "name": "乌拉特中旗" + }, { + "code": "150825", + "name": "乌拉特后旗" + }, { + "code": "150826", + "name": "杭锦后旗" + }] + }, { + "code": "1509", + "name": "乌兰察布市", + "childs": [{ + "code": "150902", + "name": "集宁区" + }, { + "code": "150921", + "name": "卓资县" + }, { + "code": "150922", + "name": "化德县" + }, { + "code": "150923", + "name": "商都县" + }, { + "code": "150924", + "name": "兴和县" + }, { + "code": "150925", + "name": "凉城县" + }, { + "code": "150926", + "name": "察哈尔右翼前旗" + }, { + "code": "150927", + "name": "察哈尔右翼中旗" + }, { + "code": "150928", + "name": "察哈尔右翼后旗" + }, { + "code": "150929", + "name": "四子王旗" + }, { + "code": "150981", + "name": "丰镇市" + }] + }, { + "code": "1522", + "name": "兴安盟", + "childs": [{ + "code": "152201", + "name": "乌兰浩特市" + }, { + "code": "152202", + "name": "阿尔山市" + }, { + "code": "152221", + "name": "科尔沁右翼前旗" + }, { + "code": "152222", + "name": "科尔沁右翼中旗" + }, { + "code": "152223", + "name": "扎赉特旗" + }, { + "code": "152224", + "name": "突泉县" + }] + }, { + "code": "1525", + "name": "锡林郭勒盟", + "childs": [{ + "code": "152501", + "name": "二连浩特市" + }, { + "code": "152502", + "name": "锡林浩特市" + }, { + "code": "152522", + "name": "阿巴嘎旗" + }, { + "code": "152523", + "name": "苏尼特左旗" + }, { + "code": "152524", + "name": "苏尼特右旗" + }, { + "code": "152525", + "name": "东乌珠穆沁旗" + }, { + "code": "152526", + "name": "西乌珠穆沁旗" + }, { + "code": "152527", + "name": "太仆寺旗" + }, { + "code": "152528", + "name": "镶黄旗" + }, { + "code": "152529", + "name": "正镶白旗" + }, { + "code": "152530", + "name": "正蓝旗" + }, { + "code": "152531", + "name": "多伦县" + }] + }, { + "code": "1529", + "name": "阿拉善盟", + "childs": [{ + "code": "152921", + "name": "阿拉善左旗" + }, { + "code": "152922", + "name": "阿拉善右旗" + }, { + "code": "152923", + "name": "额济纳旗" + }] + }] +}, { + "code": "21", + "name": "辽宁省", + "childs": [{ + "code": "2101", + "name": "沈阳市", + "childs": [{ + "code": "210102", + "name": "和平区" + }, { + "code": "210103", + "name": "沈河区" + }, { + "code": "210104", + "name": "大东区" + }, { + "code": "210105", + "name": "皇姑区" + }, { + "code": "210106", + "name": "铁西区" + }, { + "code": "210111", + "name": "苏家屯区" + }, { + "code": "210112", + "name": "浑南区" + }, { + "code": "210113", + "name": "沈北新区" + }, { + "code": "210114", + "name": "于洪区" + }, { + "code": "210115", + "name": "辽中区" + }, { + "code": "210123", + "name": "康平县" + }, { + "code": "210124", + "name": "法库县" + }, { + "code": "210181", + "name": "新民市" + }] + }, { + "code": "2102", + "name": "大连市", + "childs": [{ + "code": "210202", + "name": "中山区" + }, { + "code": "210203", + "name": "西岗区" + }, { + "code": "210204", + "name": "沙河口区" + }, { + "code": "210211", + "name": "甘井子区" + }, { + "code": "210212", + "name": "旅顺口区" + }, { + "code": "210213", + "name": "金州区" + }, { + "code": "210214", + "name": "普兰店区" + }, { + "code": "210224", + "name": "长海县" + }, { + "code": "210281", + "name": "瓦房店市" + }, { + "code": "210283", + "name": "庄河市" + }] + }, { + "code": "2103", + "name": "鞍山市", + "childs": [{ + "code": "210302", + "name": "铁东区" + }, { + "code": "210303", + "name": "铁西区" + }, { + "code": "210304", + "name": "立山区" + }, { + "code": "210311", + "name": "千山区" + }, { + "code": "210321", + "name": "台安县" + }, { + "code": "210323", + "name": "岫岩满族自治县" + }, { + "code": "210381", + "name": "海城市" + }] + }, { + "code": "2104", + "name": "抚顺市", + "childs": [{ + "code": "210402", + "name": "新抚区" + }, { + "code": "210403", + "name": "东洲区" + }, { + "code": "210404", + "name": "望花区" + }, { + "code": "210411", + "name": "顺城区" + }, { + "code": "210421", + "name": "抚顺县" + }, { + "code": "210422", + "name": "新宾满族自治县" + }, { + "code": "210423", + "name": "清原满族自治县" + }] + }, { + "code": "2105", + "name": "本溪市", + "childs": [{ + "code": "210502", + "name": "平山区" + }, { + "code": "210503", + "name": "溪湖区" + }, { + "code": "210504", + "name": "明山区" + }, { + "code": "210505", + "name": "南芬区" + }, { + "code": "210521", + "name": "本溪满族自治县" + }, { + "code": "210522", + "name": "桓仁满族自治县" + }] + }, { + "code": "2106", + "name": "丹东市", + "childs": [{ + "code": "210602", + "name": "元宝区" + }, { + "code": "210603", + "name": "振兴区" + }, { + "code": "210604", + "name": "振安区" + }, { + "code": "210624", + "name": "宽甸满族自治县" + }, { + "code": "210681", + "name": "东港市" + }, { + "code": "210682", + "name": "凤城市" + }] + }, { + "code": "2107", + "name": "锦州市", + "childs": [{ + "code": "210702", + "name": "古塔区" + }, { + "code": "210703", + "name": "凌河区" + }, { + "code": "210711", + "name": "太和区" + }, { + "code": "210726", + "name": "黑山县" + }, { + "code": "210727", + "name": "义县" + }, { + "code": "210781", + "name": "凌海市" + }, { + "code": "210782", + "name": "北镇市" + }] + }, { + "code": "2108", + "name": "营口市", + "childs": [{ + "code": "210802", + "name": "站前区" + }, { + "code": "210803", + "name": "西市区" + }, { + "code": "210804", + "name": "鲅鱼圈区" + }, { + "code": "210811", + "name": "老边区" + }, { + "code": "210881", + "name": "盖州市" + }, { + "code": "210882", + "name": "大石桥市" + }] + }, { + "code": "2109", + "name": "阜新市", + "childs": [{ + "code": "210902", + "name": "海州区" + }, { + "code": "210903", + "name": "新邱区" + }, { + "code": "210904", + "name": "太平区" + }, { + "code": "210905", + "name": "清河门区" + }, { + "code": "210911", + "name": "细河区" + }, { + "code": "210921", + "name": "阜新蒙古族自治县" + }, { + "code": "210922", + "name": "彰武县" + }] + }, { + "code": "2110", + "name": "辽阳市", + "childs": [{ + "code": "211002", + "name": "白塔区" + }, { + "code": "211003", + "name": "文圣区" + }, { + "code": "211004", + "name": "宏伟区" + }, { + "code": "211005", + "name": "弓长岭区" + }, { + "code": "211011", + "name": "太子河区" + }, { + "code": "211021", + "name": "辽阳县" + }, { + "code": "211081", + "name": "灯塔市" + }] + }, { + "code": "2111", + "name": "盘锦市", + "childs": [{ + "code": "211102", + "name": "双台子区" + }, { + "code": "211103", + "name": "兴隆台区" + }, { + "code": "211104", + "name": "大洼区" + }, { + "code": "211122", + "name": "盘山县" + }] + }, { + "code": "2112", + "name": "铁岭市", + "childs": [{ + "code": "211202", + "name": "银州区" + }, { + "code": "211204", + "name": "清河区" + }, { + "code": "211221", + "name": "铁岭县" + }, { + "code": "211223", + "name": "西丰县" + }, { + "code": "211224", + "name": "昌图县" + }, { + "code": "211281", + "name": "调兵山市" + }, { + "code": "211282", + "name": "开原市" + }] + }, { + "code": "2113", + "name": "朝阳市", + "childs": [{ + "code": "211302", + "name": "双塔区" + }, { + "code": "211303", + "name": "龙城区" + }, { + "code": "211321", + "name": "朝阳县" + }, { + "code": "211322", + "name": "建平县" + }, { + "code": "211324", + "name": "喀喇沁左翼蒙古族自治县" + }, { + "code": "211381", + "name": "北票市" + }, { + "code": "211382", + "name": "凌源市" + }] + }, { + "code": "2114", + "name": "葫芦岛市", + "childs": [{ + "code": "211402", + "name": "连山区" + }, { + "code": "211403", + "name": "龙港区" + }, { + "code": "211404", + "name": "南票区" + }, { + "code": "211421", + "name": "绥中县" + }, { + "code": "211422", + "name": "建昌县" + }, { + "code": "211481", + "name": "兴城市" + }] + }] +}, { + "code": "22", + "name": "吉林省", + "childs": [{ + "code": "2201", + "name": "长春市", + "childs": [{ + "code": "220102", + "name": "南关区" + }, { + "code": "220103", + "name": "宽城区" + }, { + "code": "220104", + "name": "朝阳区" + }, { + "code": "220105", + "name": "二道区" + }, { + "code": "220106", + "name": "绿园区" + }, { + "code": "220112", + "name": "双阳区" + }, { + "code": "220113", + "name": "九台区" + }, { + "code": "220122", + "name": "农安县" + }, { + "code": "220182", + "name": "榆树市" + }, { + "code": "220183", + "name": "德惠市" + }] + }, { + "code": "2202", + "name": "吉林市", + "childs": [{ + "code": "220202", + "name": "昌邑区" + }, { + "code": "220203", + "name": "龙潭区" + }, { + "code": "220204", + "name": "船营区" + }, { + "code": "220211", + "name": "丰满区" + }, { + "code": "220221", + "name": "永吉县" + }, { + "code": "220281", + "name": "蛟河市" + }, { + "code": "220282", + "name": "桦甸市" + }, { + "code": "220283", + "name": "舒兰市" + }, { + "code": "220284", + "name": "磐石市" + }] + }, { + "code": "2203", + "name": "四平市", + "childs": [{ + "code": "220302", + "name": "铁西区" + }, { + "code": "220303", + "name": "铁东区" + }, { + "code": "220322", + "name": "梨树县" + }, { + "code": "220323", + "name": "伊通满族自治县" + }, { + "code": "220381", + "name": "公主岭市" + }, { + "code": "220382", + "name": "双辽市" + }] + }, { + "code": "2204", + "name": "辽源市", + "childs": [{ + "code": "220402", + "name": "龙山区" + }, { + "code": "220403", + "name": "西安区" + }, { + "code": "220421", + "name": "东丰县" + }, { + "code": "220422", + "name": "东辽县" + }] + }, { + "code": "2205", + "name": "通化市", + "childs": [{ + "code": "220502", + "name": "东昌区" + }, { + "code": "220503", + "name": "二道江区" + }, { + "code": "220521", + "name": "通化县" + }, { + "code": "220523", + "name": "辉南县" + }, { + "code": "220524", + "name": "柳河县" + }, { + "code": "220581", + "name": "梅河口市" + }, { + "code": "220582", + "name": "集安市" + }] + }, { + "code": "2206", + "name": "白山市", + "childs": [{ + "code": "220602", + "name": "浑江区" + }, { + "code": "220605", + "name": "江源区" + }, { + "code": "220621", + "name": "抚松县" + }, { + "code": "220622", + "name": "靖宇县" + }, { + "code": "220623", + "name": "长白朝鲜族自治县" + }, { + "code": "220681", + "name": "临江市" + }] + }, { + "code": "2207", + "name": "松原市", + "childs": [{ + "code": "220702", + "name": "宁江区" + }, { + "code": "220721", + "name": "前郭尔罗斯蒙古族自治县" + }, { + "code": "220722", + "name": "长岭县" + }, { + "code": "220723", + "name": "乾安县" + }, { + "code": "220781", + "name": "扶余市" + }] + }, { + "code": "2208", + "name": "白城市", + "childs": [{ + "code": "220802", + "name": "洮北区" + }, { + "code": "220821", + "name": "镇赉县" + }, { + "code": "220822", + "name": "通榆县" + }, { + "code": "220881", + "name": "洮南市" + }, { + "code": "220882", + "name": "大安市" + }] + }, { + "code": "2224", + "name": "延边朝鲜族自治州", + "childs": [{ + "code": "222401", + "name": "延吉市" + }, { + "code": "222402", + "name": "图们市" + }, { + "code": "222403", + "name": "敦化市" + }, { + "code": "222404", + "name": "珲春市" + }, { + "code": "222405", + "name": "龙井市" + }, { + "code": "222406", + "name": "和龙市" + }, { + "code": "222424", + "name": "汪清县" + }, { + "code": "222426", + "name": "安图县" + }] + }] +}, { + "code": "23", + "name": "黑龙江省", + "childs": [{ + "code": "2301", + "name": "哈尔滨市", + "childs": [{ + "code": "230102", + "name": "道里区" + }, { + "code": "230103", + "name": "南岗区" + }, { + "code": "230104", + "name": "道外区" + }, { + "code": "230108", + "name": "平房区" + }, { + "code": "230109", + "name": "松北区" + }, { + "code": "230110", + "name": "香坊区" + }, { + "code": "230111", + "name": "呼兰区" + }, { + "code": "230112", + "name": "阿城区" + }, { + "code": "230113", + "name": "双城区" + }, { + "code": "230123", + "name": "依兰县" + }, { + "code": "230124", + "name": "方正县" + }, { + "code": "230125", + "name": "宾县" + }, { + "code": "230126", + "name": "巴彦县" + }, { + "code": "230127", + "name": "木兰县" + }, { + "code": "230128", + "name": "通河县" + }, { + "code": "230129", + "name": "延寿县" + }, { + "code": "230183", + "name": "尚志市" + }, { + "code": "230184", + "name": "五常市" + }] + }, { + "code": "2302", + "name": "齐齐哈尔市", + "childs": [{ + "code": "230202", + "name": "龙沙区" + }, { + "code": "230203", + "name": "建华区" + }, { + "code": "230204", + "name": "铁锋区" + }, { + "code": "230205", + "name": "昂昂溪区" + }, { + "code": "230206", + "name": "富拉尔基区" + }, { + "code": "230207", + "name": "碾子山区" + }, { + "code": "230208", + "name": "梅里斯达斡尔族区" + }, { + "code": "230221", + "name": "龙江县" + }, { + "code": "230223", + "name": "依安县" + }, { + "code": "230224", + "name": "泰来县" + }, { + "code": "230225", + "name": "甘南县" + }, { + "code": "230227", + "name": "富裕县" + }, { + "code": "230229", + "name": "克山县" + }, { + "code": "230230", + "name": "克东县" + }, { + "code": "230231", + "name": "拜泉县" + }, { + "code": "230281", + "name": "讷河市" + }] + }, { + "code": "2303", + "name": "鸡西市", + "childs": [{ + "code": "230302", + "name": "鸡冠区" + }, { + "code": "230303", + "name": "恒山区" + }, { + "code": "230304", + "name": "滴道区" + }, { + "code": "230305", + "name": "梨树区" + }, { + "code": "230306", + "name": "城子河区" + }, { + "code": "230307", + "name": "麻山区" + }, { + "code": "230321", + "name": "鸡东县" + }, { + "code": "230381", + "name": "虎林市" + }, { + "code": "230382", + "name": "密山市" + }] + }, { + "code": "2304", + "name": "鹤岗市", + "childs": [{ + "code": "230402", + "name": "向阳区" + }, { + "code": "230403", + "name": "工农区" + }, { + "code": "230404", + "name": "南山区" + }, { + "code": "230405", + "name": "兴安区" + }, { + "code": "230406", + "name": "东山区" + }, { + "code": "230407", + "name": "兴山区" + }, { + "code": "230421", + "name": "萝北县" + }, { + "code": "230422", + "name": "绥滨县" + }] + }, { + "code": "2305", + "name": "双鸭山市", + "childs": [{ + "code": "230502", + "name": "尖山区" + }, { + "code": "230503", + "name": "岭东区" + }, { + "code": "230505", + "name": "四方台区" + }, { + "code": "230506", + "name": "宝山区" + }, { + "code": "230521", + "name": "集贤县" + }, { + "code": "230522", + "name": "友谊县" + }, { + "code": "230523", + "name": "宝清县" + }, { + "code": "230524", + "name": "饶河县" + }] + }, { + "code": "2306", + "name": "大庆市", + "childs": [{ + "code": "230602", + "name": "萨尔图区" + }, { + "code": "230603", + "name": "龙凤区" + }, { + "code": "230604", + "name": "让胡路区" + }, { + "code": "230605", + "name": "红岗区" + }, { + "code": "230606", + "name": "大同区" + }, { + "code": "230621", + "name": "肇州县" + }, { + "code": "230622", + "name": "肇源县" + }, { + "code": "230623", + "name": "林甸县" + }, { + "code": "230624", + "name": "杜尔伯特蒙古族自治县" + }] + }, { + "code": "2307", + "name": "伊春市", + "childs": [{ + "code": "230702", + "name": "伊春区" + }, { + "code": "230703", + "name": "南岔区" + }, { + "code": "230704", + "name": "友好区" + }, { + "code": "230705", + "name": "西林区" + }, { + "code": "230706", + "name": "翠峦区" + }, { + "code": "230707", + "name": "新青区" + }, { + "code": "230708", + "name": "美溪区" + }, { + "code": "230709", + "name": "金山屯区" + }, { + "code": "230710", + "name": "五营区" + }, { + "code": "230711", + "name": "乌马河区" + }, { + "code": "230712", + "name": "汤旺河区" + }, { + "code": "230713", + "name": "带岭区" + }, { + "code": "230714", + "name": "乌伊岭区" + }, { + "code": "230715", + "name": "红星区" + }, { + "code": "230716", + "name": "上甘岭区" + }, { + "code": "230722", + "name": "嘉荫县" + }, { + "code": "230781", + "name": "铁力市" + }] + }, { + "code": "2308", + "name": "佳木斯市", + "childs": [{ + "code": "230803", + "name": "向阳区" + }, { + "code": "230804", + "name": "前进区" + }, { + "code": "230805", + "name": "东风区" + }, { + "code": "230811", + "name": "郊区" + }, { + "code": "230822", + "name": "桦南县" + }, { + "code": "230826", + "name": "桦川县" + }, { + "code": "230828", + "name": "汤原县" + }, { + "code": "230881", + "name": "同江市" + }, { + "code": "230882", + "name": "富锦市" + }, { + "code": "230883", + "name": "抚远市" + }] + }, { + "code": "2309", + "name": "七台河市", + "childs": [{ + "code": "230902", + "name": "新兴区" + }, { + "code": "230903", + "name": "桃山区" + }, { + "code": "230904", + "name": "茄子河区" + }, { + "code": "230921", + "name": "勃利县" + }] + }, { + "code": "2310", + "name": "牡丹江市", + "childs": [{ + "code": "231002", + "name": "东安区" + }, { + "code": "231003", + "name": "阳明区" + }, { + "code": "231004", + "name": "爱民区" + }, { + "code": "231005", + "name": "西安区" + }, { + "code": "231025", + "name": "林口县" + }, { + "code": "231081", + "name": "绥芬河市" + }, { + "code": "231083", + "name": "海林市" + }, { + "code": "231084", + "name": "宁安市" + }, { + "code": "231085", + "name": "穆棱市" + }, { + "code": "231086", + "name": "东宁市" + }] + }, { + "code": "2311", + "name": "黑河市", + "childs": [{ + "code": "231102", + "name": "爱辉区" + }, { + "code": "231121", + "name": "嫩江县" + }, { + "code": "231123", + "name": "逊克县" + }, { + "code": "231124", + "name": "孙吴县" + }, { + "code": "231181", + "name": "北安市" + }, { + "code": "231182", + "name": "五大连池市" + }] + }, { + "code": "2312", + "name": "绥化市", + "childs": [{ + "code": "231202", + "name": "北林区" + }, { + "code": "231221", + "name": "望奎县" + }, { + "code": "231222", + "name": "兰西县" + }, { + "code": "231223", + "name": "青冈县" + }, { + "code": "231224", + "name": "庆安县" + }, { + "code": "231225", + "name": "明水县" + }, { + "code": "231226", + "name": "绥棱县" + }, { + "code": "231281", + "name": "安达市" + }, { + "code": "231282", + "name": "肇东市" + }, { + "code": "231283", + "name": "海伦市" + }] + }, { + "code": "2327", + "name": "大兴安岭地区", + "childs": [{ + "code": "232721", + "name": "呼玛县" + }, { + "code": "232722", + "name": "塔河县" + }, { + "code": "232723", + "name": "漠河县" + }] + }] +}, { + "code": "31", + "name": "上海市", + "childs": [{ + "code": "3101", + "name": "市辖区", + "childs": [{ + "code": "310101", + "name": "黄浦区" + }, { + "code": "310104", + "name": "徐汇区" + }, { + "code": "310105", + "name": "长宁区" + }, { + "code": "310106", + "name": "静安区" + }, { + "code": "310107", + "name": "普陀区" + }, { + "code": "310109", + "name": "虹口区" + }, { + "code": "310110", + "name": "杨浦区" + }, { + "code": "310112", + "name": "闵行区" + }, { + "code": "310113", + "name": "宝山区" + }, { + "code": "310114", + "name": "嘉定区" + }, { + "code": "310115", + "name": "浦东新区" + }, { + "code": "310116", + "name": "金山区" + }, { + "code": "310117", + "name": "松江区" + }, { + "code": "310118", + "name": "青浦区" + }, { + "code": "310120", + "name": "奉贤区" + }, { + "code": "310151", + "name": "崇明区" + }] + }] +}, { + "code": "32", + "name": "江苏省", + "childs": [{ + "code": "3201", + "name": "南京市", + "childs": [{ + "code": "320102", + "name": "玄武区" + }, { + "code": "320104", + "name": "秦淮区" + }, { + "code": "320105", + "name": "建邺区" + }, { + "code": "320106", + "name": "鼓楼区" + }, { + "code": "320111", + "name": "浦口区" + }, { + "code": "320113", + "name": "栖霞区" + }, { + "code": "320114", + "name": "雨花台区" + }, { + "code": "320115", + "name": "江宁区" + }, { + "code": "320116", + "name": "六合区" + }, { + "code": "320117", + "name": "溧水区" + }, { + "code": "320118", + "name": "高淳区" + }] + }, { + "code": "3202", + "name": "无锡市", + "childs": [{ + "code": "320205", + "name": "锡山区" + }, { + "code": "320206", + "name": "惠山区" + }, { + "code": "320211", + "name": "滨湖区" + }, { + "code": "320213", + "name": "梁溪区" + }, { + "code": "320214", + "name": "新吴区" + }, { + "code": "320281", + "name": "江阴市" + }, { + "code": "320282", + "name": "宜兴市" + }] + }, { + "code": "3203", + "name": "徐州市", + "childs": [{ + "code": "320302", + "name": "鼓楼区" + }, { + "code": "320303", + "name": "云龙区" + }, { + "code": "320305", + "name": "贾汪区" + }, { + "code": "320311", + "name": "泉山区" + }, { + "code": "320312", + "name": "铜山区" + }, { + "code": "320321", + "name": "丰县" + }, { + "code": "320322", + "name": "沛县" + }, { + "code": "320324", + "name": "睢宁县" + }, { + "code": "320381", + "name": "新沂市" + }, { + "code": "320382", + "name": "邳州市" + }] + }, { + "code": "3204", + "name": "常州市", + "childs": [{ + "code": "320402", + "name": "天宁区" + }, { + "code": "320404", + "name": "钟楼区" + }, { + "code": "320411", + "name": "新北区" + }, { + "code": "320412", + "name": "武进区" + }, { + "code": "320413", + "name": "金坛区" + }, { + "code": "320481", + "name": "溧阳市" + }] + }, { + "code": "3205", + "name": "苏州市", + "childs": [{ + "code": "320505", + "name": "虎丘区" + }, { + "code": "320506", + "name": "吴中区" + }, { + "code": "320507", + "name": "相城区" + }, { + "code": "320508", + "name": "姑苏区" + }, { + "code": "320509", + "name": "吴江区" + }, { + "code": "320581", + "name": "常熟市" + }, { + "code": "320582", + "name": "张家港市" + }, { + "code": "320583", + "name": "昆山市" + }, { + "code": "320585", + "name": "太仓市" + }] + }, { + "code": "3206", + "name": "南通市", + "childs": [{ + "code": "320602", + "name": "崇川区" + }, { + "code": "320611", + "name": "港闸区" + }, { + "code": "320612", + "name": "通州区" + }, { + "code": "320621", + "name": "海安县" + }, { + "code": "320623", + "name": "如东县" + }, { + "code": "320681", + "name": "启东市" + }, { + "code": "320682", + "name": "如皋市" + }, { + "code": "320684", + "name": "海门市" + }] + }, { + "code": "3207", + "name": "连云港市", + "childs": [{ + "code": "320703", + "name": "连云区" + }, { + "code": "320706", + "name": "海州区" + }, { + "code": "320707", + "name": "赣榆区" + }, { + "code": "320722", + "name": "东海县" + }, { + "code": "320723", + "name": "灌云县" + }, { + "code": "320724", + "name": "灌南县" + }] + }, { + "code": "3208", + "name": "淮安市", + "childs": [{ + "code": "320803", + "name": "淮安区" + }, { + "code": "320804", + "name": "淮阴区" + }, { + "code": "320812", + "name": "清江浦区" + }, { + "code": "320813", + "name": "洪泽区" + }, { + "code": "320826", + "name": "涟水县" + }, { + "code": "320830", + "name": "盱眙县" + }, { + "code": "320831", + "name": "金湖县" + }] + }, { + "code": "3209", + "name": "盐城市", + "childs": [{ + "code": "320902", + "name": "亭湖区" + }, { + "code": "320903", + "name": "盐都区" + }, { + "code": "320904", + "name": "大丰区" + }, { + "code": "320921", + "name": "响水县" + }, { + "code": "320922", + "name": "滨海县" + }, { + "code": "320923", + "name": "阜宁县" + }, { + "code": "320924", + "name": "射阳县" + }, { + "code": "320925", + "name": "建湖县" + }, { + "code": "320981", + "name": "东台市" + }] + }, { + "code": "3210", + "name": "扬州市", + "childs": [{ + "code": "321002", + "name": "广陵区" + }, { + "code": "321003", + "name": "邗江区" + }, { + "code": "321012", + "name": "江都区" + }, { + "code": "321023", + "name": "宝应县" + }, { + "code": "321081", + "name": "仪征市" + }, { + "code": "321084", + "name": "高邮市" + }] + }, { + "code": "3211", + "name": "镇江市", + "childs": [{ + "code": "321102", + "name": "京口区" + }, { + "code": "321111", + "name": "润州区" + }, { + "code": "321112", + "name": "丹徒区" + }, { + "code": "321181", + "name": "丹阳市" + }, { + "code": "321182", + "name": "扬中市" + }, { + "code": "321183", + "name": "句容市" + }] + }, { + "code": "3212", + "name": "泰州市", + "childs": [{ + "code": "321202", + "name": "海陵区" + }, { + "code": "321203", + "name": "高港区" + }, { + "code": "321204", + "name": "姜堰区" + }, { + "code": "321281", + "name": "兴化市" + }, { + "code": "321282", + "name": "靖江市" + }, { + "code": "321283", + "name": "泰兴市" + }] + }, { + "code": "3213", + "name": "宿迁市", + "childs": [{ + "code": "321302", + "name": "宿城区" + }, { + "code": "321311", + "name": "宿豫区" + }, { + "code": "321322", + "name": "沭阳县" + }, { + "code": "321323", + "name": "泗阳县" + }, { + "code": "321324", + "name": "泗洪县" + }] + }] +}, { + "code": "33", + "name": "浙江省", + "childs": [{ + "code": "3301", + "name": "杭州市", + "childs": [{ + "code": "330102", + "name": "上城区" + }, { + "code": "330103", + "name": "下城区" + }, { + "code": "330104", + "name": "江干区" + }, { + "code": "330105", + "name": "拱墅区" + }, { + "code": "330106", + "name": "西湖区" + }, { + "code": "330108", + "name": "滨江区" + }, { + "code": "330109", + "name": "萧山区" + }, { + "code": "330110", + "name": "余杭区" + }, { + "code": "330111", + "name": "富阳区" + }, { + "code": "330122", + "name": "桐庐县" + }, { + "code": "330127", + "name": "淳安县" + }, { + "code": "330182", + "name": "建德市" + }, { + "code": "330185", + "name": "临安市" + }] + }, { + "code": "3302", + "name": "宁波市", + "childs": [{ + "code": "330203", + "name": "海曙区" + }, { + "code": "330204", + "name": "江东区" + }, { + "code": "330205", + "name": "江北区" + }, { + "code": "330206", + "name": "北仑区" + }, { + "code": "330211", + "name": "镇海区" + }, { + "code": "330212", + "name": "鄞州区" + }, { + "code": "330225", + "name": "象山县" + }, { + "code": "330226", + "name": "宁海县" + }, { + "code": "330281", + "name": "余姚市" + }, { + "code": "330282", + "name": "慈溪市" + }, { + "code": "330283", + "name": "奉化市" + }] + }, { + "code": "3303", + "name": "温州市", + "childs": [{ + "code": "330302", + "name": "鹿城区" + }, { + "code": "330303", + "name": "龙湾区" + }, { + "code": "330304", + "name": "瓯海区" + }, { + "code": "330305", + "name": "洞头区" + }, { + "code": "330324", + "name": "永嘉县" + }, { + "code": "330326", + "name": "平阳县" + }, { + "code": "330327", + "name": "苍南县" + }, { + "code": "330328", + "name": "文成县" + }, { + "code": "330329", + "name": "泰顺县" + }, { + "code": "330381", + "name": "瑞安市" + }, { + "code": "330382", + "name": "乐清市" + }] + }, { + "code": "3304", + "name": "嘉兴市", + "childs": [{ + "code": "330402", + "name": "南湖区" + }, { + "code": "330411", + "name": "秀洲区" + }, { + "code": "330421", + "name": "嘉善县" + }, { + "code": "330424", + "name": "海盐县" + }, { + "code": "330481", + "name": "海宁市" + }, { + "code": "330482", + "name": "平湖市" + }, { + "code": "330483", + "name": "桐乡市" + }] + }, { + "code": "3305", + "name": "湖州市", + "childs": [{ + "code": "330502", + "name": "吴兴区" + }, { + "code": "330503", + "name": "南浔区" + }, { + "code": "330521", + "name": "德清县" + }, { + "code": "330522", + "name": "长兴县" + }, { + "code": "330523", + "name": "安吉县" + }] + }, { + "code": "3306", + "name": "绍兴市", + "childs": [{ + "code": "330602", + "name": "越城区" + }, { + "code": "330603", + "name": "柯桥区" + }, { + "code": "330604", + "name": "上虞区" + }, { + "code": "330624", + "name": "新昌县" + }, { + "code": "330681", + "name": "诸暨市" + }, { + "code": "330683", + "name": "嵊州市" + }] + }, { + "code": "3307", + "name": "金华市", + "childs": [{ + "code": "330702", + "name": "婺城区" + }, { + "code": "330703", + "name": "金东区" + }, { + "code": "330723", + "name": "武义县" + }, { + "code": "330726", + "name": "浦江县" + }, { + "code": "330727", + "name": "磐安县" + }, { + "code": "330781", + "name": "兰溪市" + }, { + "code": "330782", + "name": "义乌市" + }, { + "code": "330783", + "name": "东阳市" + }, { + "code": "330784", + "name": "永康市" + }] + }, { + "code": "3308", + "name": "衢州市", + "childs": [{ + "code": "330802", + "name": "柯城区" + }, { + "code": "330803", + "name": "衢江区" + }, { + "code": "330822", + "name": "常山县" + }, { + "code": "330824", + "name": "开化县" + }, { + "code": "330825", + "name": "龙游县" + }, { + "code": "330881", + "name": "江山市" + }] + }, { + "code": "3309", + "name": "舟山市", + "childs": [{ + "code": "330902", + "name": "定海区" + }, { + "code": "330903", + "name": "普陀区" + }, { + "code": "330921", + "name": "岱山县" + }, { + "code": "330922", + "name": "嵊泗县" + }] + }, { + "code": "3310", + "name": "台州市", + "childs": [{ + "code": "331002", + "name": "椒江区" + }, { + "code": "331003", + "name": "黄岩区" + }, { + "code": "331004", + "name": "路桥区" + }, { + "code": "331021", + "name": "玉环县" + }, { + "code": "331022", + "name": "三门县" + }, { + "code": "331023", + "name": "天台县" + }, { + "code": "331024", + "name": "仙居县" + }, { + "code": "331081", + "name": "温岭市" + }, { + "code": "331082", + "name": "临海市" + }] + }, { + "code": "3311", + "name": "丽水市", + "childs": [{ + "code": "331102", + "name": "莲都区" + }, { + "code": "331121", + "name": "青田县" + }, { + "code": "331122", + "name": "缙云县" + }, { + "code": "331123", + "name": "遂昌县" + }, { + "code": "331124", + "name": "松阳县" + }, { + "code": "331125", + "name": "云和县" + }, { + "code": "331126", + "name": "庆元县" + }, { + "code": "331127", + "name": "景宁畲族自治县" + }, { + "code": "331181", + "name": "龙泉市" + }] + }] +}, { + "code": "34", + "name": "安徽省", + "childs": [{ + "code": "3401", + "name": "合肥市", + "childs": [{ + "code": "340102", + "name": "瑶海区" + }, { + "code": "340103", + "name": "庐阳区" + }, { + "code": "340104", + "name": "蜀山区" + }, { + "code": "340111", + "name": "包河区" + }, { + "code": "340121", + "name": "长丰县" + }, { + "code": "340122", + "name": "肥东县" + }, { + "code": "340123", + "name": "肥西县" + }, { + "code": "340124", + "name": "庐江县" + }, { + "code": "340181", + "name": "巢湖市" + }] + }, { + "code": "3402", + "name": "芜湖市", + "childs": [{ + "code": "340202", + "name": "镜湖区" + }, { + "code": "340203", + "name": "弋江区" + }, { + "code": "340207", + "name": "鸠江区" + }, { + "code": "340208", + "name": "三山区" + }, { + "code": "340221", + "name": "芜湖县" + }, { + "code": "340222", + "name": "繁昌县" + }, { + "code": "340223", + "name": "南陵县" + }, { + "code": "340225", + "name": "无为县" + }] + }, { + "code": "3403", + "name": "蚌埠市", + "childs": [{ + "code": "340302", + "name": "龙子湖区" + }, { + "code": "340303", + "name": "蚌山区" + }, { + "code": "340304", + "name": "禹会区" + }, { + "code": "340311", + "name": "淮上区" + }, { + "code": "340321", + "name": "怀远县" + }, { + "code": "340322", + "name": "五河县" + }, { + "code": "340323", + "name": "固镇县" + }] + }, { + "code": "3404", + "name": "淮南市", + "childs": [{ + "code": "340402", + "name": "大通区" + }, { + "code": "340403", + "name": "田家庵区" + }, { + "code": "340404", + "name": "谢家集区" + }, { + "code": "340405", + "name": "八公山区" + }, { + "code": "340406", + "name": "潘集区" + }, { + "code": "340421", + "name": "凤台县" + }, { + "code": "340422", + "name": "寿县" + }] + }, { + "code": "3405", + "name": "马鞍山市", + "childs": [{ + "code": "340503", + "name": "花山区" + }, { + "code": "340504", + "name": "雨山区" + }, { + "code": "340506", + "name": "博望区" + }, { + "code": "340521", + "name": "当涂县" + }, { + "code": "340522", + "name": "含山县" + }, { + "code": "340523", + "name": "和县" + }] + }, { + "code": "3406", + "name": "淮北市", + "childs": [{ + "code": "340602", + "name": "杜集区" + }, { + "code": "340603", + "name": "相山区" + }, { + "code": "340604", + "name": "烈山区" + }, { + "code": "340621", + "name": "濉溪县" + }] + }, { + "code": "3407", + "name": "铜陵市", + "childs": [{ + "code": "340705", + "name": "铜官区" + }, { + "code": "340706", + "name": "义安区" + }, { + "code": "340711", + "name": "郊区" + }, { + "code": "340722", + "name": "枞阳县" + }] + }, { + "code": "3408", + "name": "安庆市", + "childs": [{ + "code": "340802", + "name": "迎江区" + }, { + "code": "340803", + "name": "大观区" + }, { + "code": "340811", + "name": "宜秀区" + }, { + "code": "340822", + "name": "怀宁县" + }, { + "code": "340824", + "name": "潜山县" + }, { + "code": "340825", + "name": "太湖县" + }, { + "code": "340826", + "name": "宿松县" + }, { + "code": "340827", + "name": "望江县" + }, { + "code": "340828", + "name": "岳西县" + }, { + "code": "340881", + "name": "桐城市" + }] + }, { + "code": "3410", + "name": "黄山市", + "childs": [{ + "code": "341002", + "name": "屯溪区" + }, { + "code": "341003", + "name": "黄山区" + }, { + "code": "341004", + "name": "徽州区" + }, { + "code": "341021", + "name": "歙县" + }, { + "code": "341022", + "name": "休宁县" + }, { + "code": "341023", + "name": "黟县" + }, { + "code": "341024", + "name": "祁门县" + }] + }, { + "code": "3411", + "name": "滁州市", + "childs": [{ + "code": "341102", + "name": "琅琊区" + }, { + "code": "341103", + "name": "南谯区" + }, { + "code": "341122", + "name": "来安县" + }, { + "code": "341124", + "name": "全椒县" + }, { + "code": "341125", + "name": "定远县" + }, { + "code": "341126", + "name": "凤阳县" + }, { + "code": "341181", + "name": "天长市" + }, { + "code": "341182", + "name": "明光市" + }] + }, { + "code": "3412", + "name": "阜阳市", + "childs": [{ + "code": "341202", + "name": "颍州区" + }, { + "code": "341203", + "name": "颍东区" + }, { + "code": "341204", + "name": "颍泉区" + }, { + "code": "341221", + "name": "临泉县" + }, { + "code": "341222", + "name": "太和县" + }, { + "code": "341225", + "name": "阜南县" + }, { + "code": "341226", + "name": "颍上县" + }, { + "code": "341282", + "name": "界首市" + }] + }, { + "code": "3413", + "name": "宿州市", + "childs": [{ + "code": "341302", + "name": "埇桥区" + }, { + "code": "341321", + "name": "砀山县" + }, { + "code": "341322", + "name": "萧县" + }, { + "code": "341323", + "name": "灵璧县" + }, { + "code": "341324", + "name": "泗县" + }] + }, { + "code": "3415", + "name": "六安市", + "childs": [{ + "code": "341502", + "name": "金安区" + }, { + "code": "341503", + "name": "裕安区" + }, { + "code": "341504", + "name": "叶集区" + }, { + "code": "341522", + "name": "霍邱县" + }, { + "code": "341523", + "name": "舒城县" + }, { + "code": "341524", + "name": "金寨县" + }, { + "code": "341525", + "name": "霍山县" + }] + }, { + "code": "3416", + "name": "亳州市", + "childs": [{ + "code": "341602", + "name": "谯城区" + }, { + "code": "341621", + "name": "涡阳县" + }, { + "code": "341622", + "name": "蒙城县" + }, { + "code": "341623", + "name": "利辛县" + }] + }, { + "code": "3417", + "name": "池州市", + "childs": [{ + "code": "341702", + "name": "贵池区" + }, { + "code": "341721", + "name": "东至县" + }, { + "code": "341722", + "name": "石台县" + }, { + "code": "341723", + "name": "青阳县" + }] + }, { + "code": "3418", + "name": "宣城市", + "childs": [{ + "code": "341802", + "name": "宣州区" + }, { + "code": "341821", + "name": "郎溪县" + }, { + "code": "341822", + "name": "广德县" + }, { + "code": "341823", + "name": "泾县" + }, { + "code": "341824", + "name": "绩溪县" + }, { + "code": "341825", + "name": "旌德县" + }, { + "code": "341881", + "name": "宁国市" + }] + }] +}, { + "code": "35", + "name": "福建省", + "childs": [{ + "code": "3501", + "name": "福州市", + "childs": [{ + "code": "350102", + "name": "鼓楼区" + }, { + "code": "350103", + "name": "台江区" + }, { + "code": "350104", + "name": "仓山区" + }, { + "code": "350105", + "name": "马尾区" + }, { + "code": "350111", + "name": "晋安区" + }, { + "code": "350121", + "name": "闽侯县" + }, { + "code": "350122", + "name": "连江县" + }, { + "code": "350123", + "name": "罗源县" + }, { + "code": "350124", + "name": "闽清县" + }, { + "code": "350125", + "name": "永泰县" + }, { + "code": "350128", + "name": "平潭县" + }, { + "code": "350181", + "name": "福清市" + }, { + "code": "350182", + "name": "长乐市" + }] + }, { + "code": "3502", + "name": "厦门市", + "childs": [{ + "code": "350203", + "name": "思明区" + }, { + "code": "350205", + "name": "海沧区" + }, { + "code": "350206", + "name": "湖里区" + }, { + "code": "350211", + "name": "集美区" + }, { + "code": "350212", + "name": "同安区" + }, { + "code": "350213", + "name": "翔安区" + }] + }, { + "code": "3503", + "name": "莆田市", + "childs": [{ + "code": "350302", + "name": "城厢区" + }, { + "code": "350303", + "name": "涵江区" + }, { + "code": "350304", + "name": "荔城区" + }, { + "code": "350305", + "name": "秀屿区" + }, { + "code": "350322", + "name": "仙游县" + }] + }, { + "code": "3504", + "name": "三明市", + "childs": [{ + "code": "350402", + "name": "梅列区" + }, { + "code": "350403", + "name": "三元区" + }, { + "code": "350421", + "name": "明溪县" + }, { + "code": "350423", + "name": "清流县" + }, { + "code": "350424", + "name": "宁化县" + }, { + "code": "350425", + "name": "大田县" + }, { + "code": "350426", + "name": "尤溪县" + }, { + "code": "350427", + "name": "沙县" + }, { + "code": "350428", + "name": "将乐县" + }, { + "code": "350429", + "name": "泰宁县" + }, { + "code": "350430", + "name": "建宁县" + }, { + "code": "350481", + "name": "永安市" + }] + }, { + "code": "3505", + "name": "泉州市", + "childs": [{ + "code": "350502", + "name": "鲤城区" + }, { + "code": "350503", + "name": "丰泽区" + }, { + "code": "350504", + "name": "洛江区" + }, { + "code": "350505", + "name": "泉港区" + }, { + "code": "350521", + "name": "惠安县" + }, { + "code": "350524", + "name": "安溪县" + }, { + "code": "350525", + "name": "永春县" + }, { + "code": "350526", + "name": "德化县" + }, { + "code": "350527", + "name": "金门县" + }, { + "code": "350581", + "name": "石狮市" + }, { + "code": "350582", + "name": "晋江市" + }, { + "code": "350583", + "name": "南安市" + }] + }, { + "code": "3506", + "name": "漳州市", + "childs": [{ + "code": "350602", + "name": "芗城区" + }, { + "code": "350603", + "name": "龙文区" + }, { + "code": "350622", + "name": "云霄县" + }, { + "code": "350623", + "name": "漳浦县" + }, { + "code": "350624", + "name": "诏安县" + }, { + "code": "350625", + "name": "长泰县" + }, { + "code": "350626", + "name": "东山县" + }, { + "code": "350627", + "name": "南靖县" + }, { + "code": "350628", + "name": "平和县" + }, { + "code": "350629", + "name": "华安县" + }, { + "code": "350681", + "name": "龙海市" + }] + }, { + "code": "3507", + "name": "南平市", + "childs": [{ + "code": "350702", + "name": "延平区" + }, { + "code": "350703", + "name": "建阳区" + }, { + "code": "350721", + "name": "顺昌县" + }, { + "code": "350722", + "name": "浦城县" + }, { + "code": "350723", + "name": "光泽县" + }, { + "code": "350724", + "name": "松溪县" + }, { + "code": "350725", + "name": "政和县" + }, { + "code": "350781", + "name": "邵武市" + }, { + "code": "350782", + "name": "武夷山市" + }, { + "code": "350783", + "name": "建瓯市" + }] + }, { + "code": "3508", + "name": "龙岩市", + "childs": [{ + "code": "350802", + "name": "新罗区" + }, { + "code": "350803", + "name": "永定区" + }, { + "code": "350821", + "name": "长汀县" + }, { + "code": "350823", + "name": "上杭县" + }, { + "code": "350824", + "name": "武平县" + }, { + "code": "350825", + "name": "连城县" + }, { + "code": "350881", + "name": "漳平市" + }] + }, { + "code": "3509", + "name": "宁德市", + "childs": [{ + "code": "350902", + "name": "蕉城区" + }, { + "code": "350921", + "name": "霞浦县" + }, { + "code": "350922", + "name": "古田县" + }, { + "code": "350923", + "name": "屏南县" + }, { + "code": "350924", + "name": "寿宁县" + }, { + "code": "350925", + "name": "周宁县" + }, { + "code": "350926", + "name": "柘荣县" + }, { + "code": "350981", + "name": "福安市" + }, { + "code": "350982", + "name": "福鼎市" + }] + }] +}, { + "code": "36", + "name": "江西省", + "childs": [{ + "code": "3601", + "name": "南昌市", + "childs": [{ + "code": "360102", + "name": "东湖区" + }, { + "code": "360103", + "name": "西湖区" + }, { + "code": "360104", + "name": "青云谱区" + }, { + "code": "360105", + "name": "湾里区" + }, { + "code": "360111", + "name": "青山湖区" + }, { + "code": "360112", + "name": "新建区" + }, { + "code": "360121", + "name": "南昌县" + }, { + "code": "360123", + "name": "安义县" + }, { + "code": "360124", + "name": "进贤县" + }] + }, { + "code": "3602", + "name": "景德镇市", + "childs": [{ + "code": "360202", + "name": "昌江区" + }, { + "code": "360203", + "name": "珠山区" + }, { + "code": "360222", + "name": "浮梁县" + }, { + "code": "360281", + "name": "乐平市" + }] + }, { + "code": "3603", + "name": "萍乡市", + "childs": [{ + "code": "360302", + "name": "安源区" + }, { + "code": "360313", + "name": "湘东区" + }, { + "code": "360321", + "name": "莲花县" + }, { + "code": "360322", + "name": "上栗县" + }, { + "code": "360323", + "name": "芦溪县" + }] + }, { + "code": "3604", + "name": "九江市", + "childs": [{ + "code": "360402", + "name": "濂溪区" + }, { + "code": "360403", + "name": "浔阳区" + }, { + "code": "360421", + "name": "九江县" + }, { + "code": "360423", + "name": "武宁县" + }, { + "code": "360424", + "name": "修水县" + }, { + "code": "360425", + "name": "永修县" + }, { + "code": "360426", + "name": "德安县" + }, { + "code": "360428", + "name": "都昌县" + }, { + "code": "360429", + "name": "湖口县" + }, { + "code": "360430", + "name": "彭泽县" + }, { + "code": "360481", + "name": "瑞昌市" + }, { + "code": "360482", + "name": "共青城市" + }, { + "code": "360483", + "name": "庐山市" + }] + }, { + "code": "3605", + "name": "新余市", + "childs": [{ + "code": "360502", + "name": "渝水区" + }, { + "code": "360521", + "name": "分宜县" + }] + }, { + "code": "3606", + "name": "鹰潭市", + "childs": [{ + "code": "360602", + "name": "月湖区" + }, { + "code": "360622", + "name": "余江县" + }, { + "code": "360681", + "name": "贵溪市" + }] + }, { + "code": "3607", + "name": "赣州市", + "childs": [{ + "code": "360702", + "name": "章贡区" + }, { + "code": "360703", + "name": "南康区" + }, { + "code": "360721", + "name": "赣县" + }, { + "code": "360722", + "name": "信丰县" + }, { + "code": "360723", + "name": "大余县" + }, { + "code": "360724", + "name": "上犹县" + }, { + "code": "360725", + "name": "崇义县" + }, { + "code": "360726", + "name": "安远县" + }, { + "code": "360727", + "name": "龙南县" + }, { + "code": "360728", + "name": "定南县" + }, { + "code": "360729", + "name": "全南县" + }, { + "code": "360730", + "name": "宁都县" + }, { + "code": "360731", + "name": "于都县" + }, { + "code": "360732", + "name": "兴国县" + }, { + "code": "360733", + "name": "会昌县" + }, { + "code": "360734", + "name": "寻乌县" + }, { + "code": "360735", + "name": "石城县" + }, { + "code": "360781", + "name": "瑞金市" + }] + }, { + "code": "3608", + "name": "吉安市", + "childs": [{ + "code": "360802", + "name": "吉州区" + }, { + "code": "360803", + "name": "青原区" + }, { + "code": "360821", + "name": "吉安县" + }, { + "code": "360822", + "name": "吉水县" + }, { + "code": "360823", + "name": "峡江县" + }, { + "code": "360824", + "name": "新干县" + }, { + "code": "360825", + "name": "永丰县" + }, { + "code": "360826", + "name": "泰和县" + }, { + "code": "360827", + "name": "遂川县" + }, { + "code": "360828", + "name": "万安县" + }, { + "code": "360829", + "name": "安福县" + }, { + "code": "360830", + "name": "永新县" + }, { + "code": "360881", + "name": "井冈山市" + }] + }, { + "code": "3609", + "name": "宜春市", + "childs": [{ + "code": "360902", + "name": "袁州区" + }, { + "code": "360921", + "name": "奉新县" + }, { + "code": "360922", + "name": "万载县" + }, { + "code": "360923", + "name": "上高县" + }, { + "code": "360924", + "name": "宜丰县" + }, { + "code": "360925", + "name": "靖安县" + }, { + "code": "360926", + "name": "铜鼓县" + }, { + "code": "360981", + "name": "丰城市" + }, { + "code": "360982", + "name": "樟树市" + }, { + "code": "360983", + "name": "高安市" + }] + }, { + "code": "3610", + "name": "抚州市", + "childs": [{ + "code": "361002", + "name": "临川区" + }, { + "code": "361021", + "name": "南城县" + }, { + "code": "361022", + "name": "黎川县" + }, { + "code": "361023", + "name": "南丰县" + }, { + "code": "361024", + "name": "崇仁县" + }, { + "code": "361025", + "name": "乐安县" + }, { + "code": "361026", + "name": "宜黄县" + }, { + "code": "361027", + "name": "金溪县" + }, { + "code": "361028", + "name": "资溪县" + }, { + "code": "361029", + "name": "东乡县" + }, { + "code": "361030", + "name": "广昌县" + }] + }, { + "code": "3611", + "name": "上饶市", + "childs": [{ + "code": "361102", + "name": "信州区" + }, { + "code": "361103", + "name": "广丰区" + }, { + "code": "361121", + "name": "上饶县" + }, { + "code": "361123", + "name": "玉山县" + }, { + "code": "361124", + "name": "铅山县" + }, { + "code": "361125", + "name": "横峰县" + }, { + "code": "361126", + "name": "弋阳县" + }, { + "code": "361127", + "name": "余干县" + }, { + "code": "361128", + "name": "鄱阳县" + }, { + "code": "361129", + "name": "万年县" + }, { + "code": "361130", + "name": "婺源县" + }, { + "code": "361181", + "name": "德兴市" + }] + }] +}, { + "code": "37", + "name": "山东省", + "childs": [{ + "code": "3701", + "name": "济南市", + "childs": [{ + "code": "370102", + "name": "历下区" + }, { + "code": "370103", + "name": "市中区" + }, { + "code": "370104", + "name": "槐荫区" + }, { + "code": "370105", + "name": "天桥区" + }, { + "code": "370112", + "name": "历城区" + }, { + "code": "370113", + "name": "长清区" + }, { + "code": "370124", + "name": "平阴县" + }, { + "code": "370125", + "name": "济阳县" + }, { + "code": "370126", + "name": "商河县" + }, { + "code": "370181", + "name": "章丘市" + }] + }, { + "code": "3702", + "name": "青岛市", + "childs": [{ + "code": "370202", + "name": "市南区" + }, { + "code": "370203", + "name": "市北区" + }, { + "code": "370211", + "name": "黄岛区" + }, { + "code": "370212", + "name": "崂山区" + }, { + "code": "370213", + "name": "李沧区" + }, { + "code": "370214", + "name": "城阳区" + }, { + "code": "370281", + "name": "胶州市" + }, { + "code": "370282", + "name": "即墨市" + }, { + "code": "370283", + "name": "平度市" + }, { + "code": "370285", + "name": "莱西市" + }] + }, { + "code": "3703", + "name": "淄博市", + "childs": [{ + "code": "370302", + "name": "淄川区" + }, { + "code": "370303", + "name": "张店区" + }, { + "code": "370304", + "name": "博山区" + }, { + "code": "370305", + "name": "临淄区" + }, { + "code": "370306", + "name": "周村区" + }, { + "code": "370321", + "name": "桓台县" + }, { + "code": "370322", + "name": "高青县" + }, { + "code": "370323", + "name": "沂源县" + }] + }, { + "code": "3704", + "name": "枣庄市", + "childs": [{ + "code": "370402", + "name": "市中区" + }, { + "code": "370403", + "name": "薛城区" + }, { + "code": "370404", + "name": "峄城区" + }, { + "code": "370405", + "name": "台儿庄区" + }, { + "code": "370406", + "name": "山亭区" + }, { + "code": "370481", + "name": "滕州市" + }] + }, { + "code": "3705", + "name": "东营市", + "childs": [{ + "code": "370502", + "name": "东营区" + }, { + "code": "370503", + "name": "河口区" + }, { + "code": "370505", + "name": "垦利区" + }, { + "code": "370522", + "name": "利津县" + }, { + "code": "370523", + "name": "广饶县" + }] + }, { + "code": "3706", + "name": "烟台市", + "childs": [{ + "code": "370602", + "name": "芝罘区" + }, { + "code": "370611", + "name": "福山区" + }, { + "code": "370612", + "name": "牟平区" + }, { + "code": "370613", + "name": "莱山区" + }, { + "code": "370634", + "name": "长岛县" + }, { + "code": "370681", + "name": "龙口市" + }, { + "code": "370682", + "name": "莱阳市" + }, { + "code": "370683", + "name": "莱州市" + }, { + "code": "370684", + "name": "蓬莱市" + }, { + "code": "370685", + "name": "招远市" + }, { + "code": "370686", + "name": "栖霞市" + }, { + "code": "370687", + "name": "海阳市" + }] + }, { + "code": "3707", + "name": "潍坊市", + "childs": [{ + "code": "370702", + "name": "潍城区" + }, { + "code": "370703", + "name": "寒亭区" + }, { + "code": "370704", + "name": "坊子区" + }, { + "code": "370705", + "name": "奎文区" + }, { + "code": "370724", + "name": "临朐县" + }, { + "code": "370725", + "name": "昌乐县" + }, { + "code": "370781", + "name": "青州市" + }, { + "code": "370782", + "name": "诸城市" + }, { + "code": "370783", + "name": "寿光市" + }, { + "code": "370784", + "name": "安丘市" + }, { + "code": "370785", + "name": "高密市" + }, { + "code": "370786", + "name": "昌邑市" + }] + }, { + "code": "3708", + "name": "济宁市", + "childs": [{ + "code": "370811", + "name": "任城区" + }, { + "code": "370812", + "name": "兖州区" + }, { + "code": "370826", + "name": "微山县" + }, { + "code": "370827", + "name": "鱼台县" + }, { + "code": "370828", + "name": "金乡县" + }, { + "code": "370829", + "name": "嘉祥县" + }, { + "code": "370830", + "name": "汶上县" + }, { + "code": "370831", + "name": "泗水县" + }, { + "code": "370832", + "name": "梁山县" + }, { + "code": "370881", + "name": "曲阜市" + }, { + "code": "370883", + "name": "邹城市" + }] + }, { + "code": "3709", + "name": "泰安市", + "childs": [{ + "code": "370902", + "name": "泰山区" + }, { + "code": "370911", + "name": "岱岳区" + }, { + "code": "370921", + "name": "宁阳县" + }, { + "code": "370923", + "name": "东平县" + }, { + "code": "370982", + "name": "新泰市" + }, { + "code": "370983", + "name": "肥城市" + }] + }, { + "code": "3710", + "name": "威海市", + "childs": [{ + "code": "371002", + "name": "环翠区" + }, { + "code": "371003", + "name": "文登区" + }, { + "code": "371082", + "name": "荣成市" + }, { + "code": "371083", + "name": "乳山市" + }] + }, { + "code": "3711", + "name": "日照市", + "childs": [{ + "code": "371102", + "name": "东港区" + }, { + "code": "371103", + "name": "岚山区" + }, { + "code": "371121", + "name": "五莲县" + }, { + "code": "371122", + "name": "莒县" + }] + }, { + "code": "3712", + "name": "莱芜市", + "childs": [{ + "code": "371202", + "name": "莱城区" + }, { + "code": "371203", + "name": "钢城区" + }] + }, { + "code": "3713", + "name": "临沂市", + "childs": [{ + "code": "371302", + "name": "兰山区" + }, { + "code": "371311", + "name": "罗庄区" + }, { + "code": "371312", + "name": "河东区" + }, { + "code": "371321", + "name": "沂南县" + }, { + "code": "371322", + "name": "郯城县" + }, { + "code": "371323", + "name": "沂水县" + }, { + "code": "371324", + "name": "兰陵县" + }, { + "code": "371325", + "name": "费县" + }, { + "code": "371326", + "name": "平邑县" + }, { + "code": "371327", + "name": "莒南县" + }, { + "code": "371328", + "name": "蒙阴县" + }, { + "code": "371329", + "name": "临沭县" + }] + }, { + "code": "3714", + "name": "德州市", + "childs": [{ + "code": "371402", + "name": "德城区" + }, { + "code": "371403", + "name": "陵城区" + }, { + "code": "371422", + "name": "宁津县" + }, { + "code": "371423", + "name": "庆云县" + }, { + "code": "371424", + "name": "临邑县" + }, { + "code": "371425", + "name": "齐河县" + }, { + "code": "371426", + "name": "平原县" + }, { + "code": "371427", + "name": "夏津县" + }, { + "code": "371428", + "name": "武城县" + }, { + "code": "371481", + "name": "乐陵市" + }, { + "code": "371482", + "name": "禹城市" + }] + }, { + "code": "3715", + "name": "聊城市", + "childs": [{ + "code": "371502", + "name": "东昌府区" + }, { + "code": "371521", + "name": "阳谷县" + }, { + "code": "371522", + "name": "莘县" + }, { + "code": "371523", + "name": "茌平县" + }, { + "code": "371524", + "name": "东阿县" + }, { + "code": "371525", + "name": "冠县" + }, { + "code": "371526", + "name": "高唐县" + }, { + "code": "371581", + "name": "临清市" + }] + }, { + "code": "3716", + "name": "滨州市", + "childs": [{ + "code": "371602", + "name": "滨城区" + }, { + "code": "371603", + "name": "沾化区" + }, { + "code": "371621", + "name": "惠民县" + }, { + "code": "371622", + "name": "阳信县" + }, { + "code": "371623", + "name": "无棣县" + }, { + "code": "371625", + "name": "博兴县" + }, { + "code": "371626", + "name": "邹平县" + }] + }, { + "code": "3717", + "name": "菏泽市", + "childs": [{ + "code": "371702", + "name": "牡丹区" + }, { + "code": "371703", + "name": "定陶区" + }, { + "code": "371721", + "name": "曹县" + }, { + "code": "371722", + "name": "单县" + }, { + "code": "371723", + "name": "成武县" + }, { + "code": "371724", + "name": "巨野县" + }, { + "code": "371725", + "name": "郓城县" + }, { + "code": "371726", + "name": "鄄城县" + }, { + "code": "371728", + "name": "东明县" + }] + }] +}, { + "code": "41", + "name": "河南省", + "childs": [{ + "code": "4101", + "name": "郑州市", + "childs": [{ + "code": "410102", + "name": "中原区" + }, { + "code": "410103", + "name": "二七区" + }, { + "code": "410104", + "name": "管城回族区" + }, { + "code": "410105", + "name": "金水区" + }, { + "code": "410106", + "name": "上街区" + }, { + "code": "410108", + "name": "惠济区" + }, { + "code": "410122", + "name": "中牟县" + }, { + "code": "410181", + "name": "巩义市" + }, { + "code": "410182", + "name": "荥阳市" + }, { + "code": "410183", + "name": "新密市" + }, { + "code": "410184", + "name": "新郑市" + }, { + "code": "410185", + "name": "登封市" + }] + }, { + "code": "4102", + "name": "开封市", + "childs": [{ + "code": "410202", + "name": "龙亭区" + }, { + "code": "410203", + "name": "顺河回族区" + }, { + "code": "410204", + "name": "鼓楼区" + }, { + "code": "410205", + "name": "禹王台区" + }, { + "code": "410211", + "name": "金明区" + }, { + "code": "410212", + "name": "祥符区" + }, { + "code": "410221", + "name": "杞县" + }, { + "code": "410222", + "name": "通许县" + }, { + "code": "410223", + "name": "尉氏县" + }, { + "code": "410225", + "name": "兰考县" + }] + }, { + "code": "4103", + "name": "洛阳市", + "childs": [{ + "code": "410302", + "name": "老城区" + }, { + "code": "410303", + "name": "西工区" + }, { + "code": "410304", + "name": "瀍河回族区" + }, { + "code": "410305", + "name": "涧西区" + }, { + "code": "410306", + "name": "吉利区" + }, { + "code": "410311", + "name": "洛龙区" + }, { + "code": "410322", + "name": "孟津县" + }, { + "code": "410323", + "name": "新安县" + }, { + "code": "410324", + "name": "栾川县" + }, { + "code": "410325", + "name": "嵩县" + }, { + "code": "410326", + "name": "汝阳县" + }, { + "code": "410327", + "name": "宜阳县" + }, { + "code": "410328", + "name": "洛宁县" + }, { + "code": "410329", + "name": "伊川县" + }, { + "code": "410381", + "name": "偃师市" + }] + }, { + "code": "4104", + "name": "平顶山市", + "childs": [{ + "code": "410402", + "name": "新华区" + }, { + "code": "410403", + "name": "卫东区" + }, { + "code": "410404", + "name": "石龙区" + }, { + "code": "410411", + "name": "湛河区" + }, { + "code": "410421", + "name": "宝丰县" + }, { + "code": "410422", + "name": "叶县" + }, { + "code": "410423", + "name": "鲁山县" + }, { + "code": "410425", + "name": "郏县" + }, { + "code": "410481", + "name": "舞钢市" + }, { + "code": "410482", + "name": "汝州市" + }] + }, { + "code": "4105", + "name": "安阳市", + "childs": [{ + "code": "410502", + "name": "文峰区" + }, { + "code": "410503", + "name": "北关区" + }, { + "code": "410505", + "name": "殷都区" + }, { + "code": "410506", + "name": "龙安区" + }, { + "code": "410522", + "name": "安阳县" + }, { + "code": "410523", + "name": "汤阴县" + }, { + "code": "410526", + "name": "滑县" + }, { + "code": "410527", + "name": "内黄县" + }, { + "code": "410581", + "name": "林州市" + }] + }, { + "code": "4106", + "name": "鹤壁市", + "childs": [{ + "code": "410602", + "name": "鹤山区" + }, { + "code": "410603", + "name": "山城区" + }, { + "code": "410611", + "name": "淇滨区" + }, { + "code": "410621", + "name": "浚县" + }, { + "code": "410622", + "name": "淇县" + }] + }, { + "code": "4107", + "name": "新乡市", + "childs": [{ + "code": "410702", + "name": "红旗区" + }, { + "code": "410703", + "name": "卫滨区" + }, { + "code": "410704", + "name": "凤泉区" + }, { + "code": "410711", + "name": "牧野区" + }, { + "code": "410721", + "name": "新乡县" + }, { + "code": "410724", + "name": "获嘉县" + }, { + "code": "410725", + "name": "原阳县" + }, { + "code": "410726", + "name": "延津县" + }, { + "code": "410727", + "name": "封丘县" + }, { + "code": "410728", + "name": "长垣县" + }, { + "code": "410781", + "name": "卫辉市" + }, { + "code": "410782", + "name": "辉县市" + }] + }, { + "code": "4108", + "name": "焦作市", + "childs": [{ + "code": "410802", + "name": "解放区" + }, { + "code": "410803", + "name": "中站区" + }, { + "code": "410804", + "name": "马村区" + }, { + "code": "410811", + "name": "山阳区" + }, { + "code": "410821", + "name": "修武县" + }, { + "code": "410822", + "name": "博爱县" + }, { + "code": "410823", + "name": "武陟县" + }, { + "code": "410825", + "name": "温县" + }, { + "code": "410882", + "name": "沁阳市" + }, { + "code": "410883", + "name": "孟州市" + }] + }, { + "code": "4109", + "name": "濮阳市", + "childs": [{ + "code": "410902", + "name": "华龙区" + }, { + "code": "410922", + "name": "清丰县" + }, { + "code": "410923", + "name": "南乐县" + }, { + "code": "410926", + "name": "范县" + }, { + "code": "410927", + "name": "台前县" + }, { + "code": "410928", + "name": "濮阳县" + }] + }, { + "code": "4110", + "name": "许昌市", + "childs": [{ + "code": "411002", + "name": "魏都区" + }, { + "code": "411023", + "name": "许昌县" + }, { + "code": "411024", + "name": "鄢陵县" + }, { + "code": "411025", + "name": "襄城县" + }, { + "code": "411081", + "name": "禹州市" + }, { + "code": "411082", + "name": "长葛市" + }] + }, { + "code": "4111", + "name": "漯河市", + "childs": [{ + "code": "411102", + "name": "源汇区" + }, { + "code": "411103", + "name": "郾城区" + }, { + "code": "411104", + "name": "召陵区" + }, { + "code": "411121", + "name": "舞阳县" + }, { + "code": "411122", + "name": "临颍县" + }] + }, { + "code": "4112", + "name": "三门峡市", + "childs": [{ + "code": "411202", + "name": "湖滨区" + }, { + "code": "411203", + "name": "陕州区" + }, { + "code": "411221", + "name": "渑池县" + }, { + "code": "411224", + "name": "卢氏县" + }, { + "code": "411281", + "name": "义马市" + }, { + "code": "411282", + "name": "灵宝市" + }] + }, { + "code": "4113", + "name": "南阳市", + "childs": [{ + "code": "411302", + "name": "宛城区" + }, { + "code": "411303", + "name": "卧龙区" + }, { + "code": "411321", + "name": "南召县" + }, { + "code": "411322", + "name": "方城县" + }, { + "code": "411323", + "name": "西峡县" + }, { + "code": "411324", + "name": "镇平县" + }, { + "code": "411325", + "name": "内乡县" + }, { + "code": "411326", + "name": "淅川县" + }, { + "code": "411327", + "name": "社旗县" + }, { + "code": "411328", + "name": "唐河县" + }, { + "code": "411329", + "name": "新野县" + }, { + "code": "411330", + "name": "桐柏县" + }, { + "code": "411381", + "name": "邓州市" + }] + }, { + "code": "4114", + "name": "商丘市", + "childs": [{ + "code": "411402", + "name": "梁园区" + }, { + "code": "411403", + "name": "睢阳区" + }, { + "code": "411421", + "name": "民权县" + }, { + "code": "411422", + "name": "睢县" + }, { + "code": "411423", + "name": "宁陵县" + }, { + "code": "411424", + "name": "柘城县" + }, { + "code": "411425", + "name": "虞城县" + }, { + "code": "411426", + "name": "夏邑县" + }, { + "code": "411481", + "name": "永城市" + }] + }, { + "code": "4115", + "name": "信阳市", + "childs": [{ + "code": "411502", + "name": "浉河区" + }, { + "code": "411503", + "name": "平桥区" + }, { + "code": "411521", + "name": "罗山县" + }, { + "code": "411522", + "name": "光山县" + }, { + "code": "411523", + "name": "新县" + }, { + "code": "411524", + "name": "商城县" + }, { + "code": "411525", + "name": "固始县" + }, { + "code": "411526", + "name": "潢川县" + }, { + "code": "411527", + "name": "淮滨县" + }, { + "code": "411528", + "name": "息县" + }] + }, { + "code": "4116", + "name": "周口市", + "childs": [{ + "code": "411602", + "name": "川汇区" + }, { + "code": "411621", + "name": "扶沟县" + }, { + "code": "411622", + "name": "西华县" + }, { + "code": "411623", + "name": "商水县" + }, { + "code": "411624", + "name": "沈丘县" + }, { + "code": "411625", + "name": "郸城县" + }, { + "code": "411626", + "name": "淮阳县" + }, { + "code": "411627", + "name": "太康县" + }, { + "code": "411628", + "name": "鹿邑县" + }, { + "code": "411681", + "name": "项城市" + }] + }, { + "code": "4117", + "name": "驻马店市", + "childs": [{ + "code": "411702", + "name": "驿城区" + }, { + "code": "411721", + "name": "西平县" + }, { + "code": "411722", + "name": "上蔡县" + }, { + "code": "411723", + "name": "平舆县" + }, { + "code": "411724", + "name": "正阳县" + }, { + "code": "411725", + "name": "确山县" + }, { + "code": "411726", + "name": "泌阳县" + }, { + "code": "411727", + "name": "汝南县" + }, { + "code": "411728", + "name": "遂平县" + }, { + "code": "411729", + "name": "新蔡县" + }] + }, { + "code": "4190", + "name": "省直辖县级行政区划", + "childs": [{ + "code": "419001", + "name": "济源市" + }] + }] +}, { + "code": "42", + "name": "湖北省", + "childs": [{ + "code": "4201", + "name": "武汉市", + "childs": [{ + "code": "420102", + "name": "江岸区" + }, { + "code": "420103", + "name": "江汉区" + }, { + "code": "420104", + "name": "硚口区" + }, { + "code": "420105", + "name": "汉阳区" + }, { + "code": "420106", + "name": "武昌区" + }, { + "code": "420107", + "name": "青山区" + }, { + "code": "420111", + "name": "洪山区" + }, { + "code": "420112", + "name": "东西湖区" + }, { + "code": "420113", + "name": "汉南区" + }, { + "code": "420114", + "name": "蔡甸区" + }, { + "code": "420115", + "name": "江夏区" + }, { + "code": "420116", + "name": "黄陂区" + }, { + "code": "420117", + "name": "新洲区" + }] + }, { + "code": "4202", + "name": "黄石市", + "childs": [{ + "code": "420202", + "name": "黄石港区" + }, { + "code": "420203", + "name": "西塞山区" + }, { + "code": "420204", + "name": "下陆区" + }, { + "code": "420205", + "name": "铁山区" + }, { + "code": "420222", + "name": "阳新县" + }, { + "code": "420281", + "name": "大冶市" + }] + }, { + "code": "4203", + "name": "十堰市", + "childs": [{ + "code": "420302", + "name": "茅箭区" + }, { + "code": "420303", + "name": "张湾区" + }, { + "code": "420304", + "name": "郧阳区" + }, { + "code": "420322", + "name": "郧西县" + }, { + "code": "420323", + "name": "竹山县" + }, { + "code": "420324", + "name": "竹溪县" + }, { + "code": "420325", + "name": "房县" + }, { + "code": "420381", + "name": "丹江口市" + }] + }, { + "code": "4205", + "name": "宜昌市", + "childs": [{ + "code": "420502", + "name": "西陵区" + }, { + "code": "420503", + "name": "伍家岗区" + }, { + "code": "420504", + "name": "点军区" + }, { + "code": "420505", + "name": "猇亭区" + }, { + "code": "420506", + "name": "夷陵区" + }, { + "code": "420525", + "name": "远安县" + }, { + "code": "420526", + "name": "兴山县" + }, { + "code": "420527", + "name": "秭归县" + }, { + "code": "420528", + "name": "长阳土家族自治县" + }, { + "code": "420529", + "name": "五峰土家族自治县" + }, { + "code": "420581", + "name": "宜都市" + }, { + "code": "420582", + "name": "当阳市" + }, { + "code": "420583", + "name": "枝江市" + }] + }, { + "code": "4206", + "name": "襄阳市", + "childs": [{ + "code": "420602", + "name": "襄城区" + }, { + "code": "420606", + "name": "樊城区" + }, { + "code": "420607", + "name": "襄州区" + }, { + "code": "420624", + "name": "南漳县" + }, { + "code": "420625", + "name": "谷城县" + }, { + "code": "420626", + "name": "保康县" + }, { + "code": "420682", + "name": "老河口市" + }, { + "code": "420683", + "name": "枣阳市" + }, { + "code": "420684", + "name": "宜城市" + }] + }, { + "code": "4207", + "name": "鄂州市", + "childs": [{ + "code": "420702", + "name": "梁子湖区" + }, { + "code": "420703", + "name": "华容区" + }, { + "code": "420704", + "name": "鄂城区" + }] + }, { + "code": "4208", + "name": "荆门市", + "childs": [{ + "code": "420802", + "name": "东宝区" + }, { + "code": "420804", + "name": "掇刀区" + }, { + "code": "420821", + "name": "京山县" + }, { + "code": "420822", + "name": "沙洋县" + }, { + "code": "420881", + "name": "钟祥市" + }] + }, { + "code": "4209", + "name": "孝感市", + "childs": [{ + "code": "420902", + "name": "孝南区" + }, { + "code": "420921", + "name": "孝昌县" + }, { + "code": "420922", + "name": "大悟县" + }, { + "code": "420923", + "name": "云梦县" + }, { + "code": "420981", + "name": "应城市" + }, { + "code": "420982", + "name": "安陆市" + }, { + "code": "420984", + "name": "汉川市" + }] + }, { + "code": "4210", + "name": "荆州市", + "childs": [{ + "code": "421002", + "name": "沙市区" + }, { + "code": "421003", + "name": "荆州区" + }, { + "code": "421022", + "name": "公安县" + }, { + "code": "421023", + "name": "监利县" + }, { + "code": "421024", + "name": "江陵县" + }, { + "code": "421081", + "name": "石首市" + }, { + "code": "421083", + "name": "洪湖市" + }, { + "code": "421087", + "name": "松滋市" + }] + }, { + "code": "4211", + "name": "黄冈市", + "childs": [{ + "code": "421102", + "name": "黄州区" + }, { + "code": "421121", + "name": "团风县" + }, { + "code": "421122", + "name": "红安县" + }, { + "code": "421123", + "name": "罗田县" + }, { + "code": "421124", + "name": "英山县" + }, { + "code": "421125", + "name": "浠水县" + }, { + "code": "421126", + "name": "蕲春县" + }, { + "code": "421127", + "name": "黄梅县" + }, { + "code": "421181", + "name": "麻城市" + }, { + "code": "421182", + "name": "武穴市" + }] + }, { + "code": "4212", + "name": "咸宁市", + "childs": [{ + "code": "421202", + "name": "咸安区" + }, { + "code": "421221", + "name": "嘉鱼县" + }, { + "code": "421222", + "name": "通城县" + }, { + "code": "421223", + "name": "崇阳县" + }, { + "code": "421224", + "name": "通山县" + }, { + "code": "421281", + "name": "赤壁市" + }] + }, { + "code": "4213", + "name": "随州市", + "childs": [{ + "code": "421303", + "name": "曾都区" + }, { + "code": "421321", + "name": "随县" + }, { + "code": "421381", + "name": "广水市" + }] + }, { + "code": "4228", + "name": "恩施土家族苗族自治州", + "childs": [{ + "code": "422801", + "name": "恩施市" + }, { + "code": "422802", + "name": "利川市" + }, { + "code": "422822", + "name": "建始县" + }, { + "code": "422823", + "name": "巴东县" + }, { + "code": "422825", + "name": "宣恩县" + }, { + "code": "422826", + "name": "咸丰县" + }, { + "code": "422827", + "name": "来凤县" + }, { + "code": "422828", + "name": "鹤峰县" + }] + }, { + "code": "4290", + "name": "省直辖县级行政区划", + "childs": [{ + "code": "429004", + "name": "仙桃市" + }, { + "code": "429005", + "name": "潜江市" + }, { + "code": "429006", + "name": "天门市" + }, { + "code": "429021", + "name": "神农架林区" + }] + }] +}, { + "code": "43", + "name": "湖南省", + "childs": [{ + "code": "4301", + "name": "长沙市", + "childs": [{ + "code": "430102", + "name": "芙蓉区" + }, { + "code": "430103", + "name": "天心区" + }, { + "code": "430104", + "name": "岳麓区" + }, { + "code": "430105", + "name": "开福区" + }, { + "code": "430111", + "name": "雨花区" + }, { + "code": "430112", + "name": "望城区" + }, { + "code": "430121", + "name": "长沙县" + }, { + "code": "430124", + "name": "宁乡县" + }, { + "code": "430181", + "name": "浏阳市" + }] + }, { + "code": "4302", + "name": "株洲市", + "childs": [{ + "code": "430202", + "name": "荷塘区" + }, { + "code": "430203", + "name": "芦淞区" + }, { + "code": "430204", + "name": "石峰区" + }, { + "code": "430211", + "name": "天元区" + }, { + "code": "430221", + "name": "株洲县" + }, { + "code": "430223", + "name": "攸县" + }, { + "code": "430224", + "name": "茶陵县" + }, { + "code": "430225", + "name": "炎陵县" + }, { + "code": "430281", + "name": "醴陵市" + }] + }, { + "code": "4303", + "name": "湘潭市", + "childs": [{ + "code": "430302", + "name": "雨湖区" + }, { + "code": "430304", + "name": "岳塘区" + }, { + "code": "430321", + "name": "湘潭县" + }, { + "code": "430381", + "name": "湘乡市" + }, { + "code": "430382", + "name": "韶山市" + }] + }, { + "code": "4304", + "name": "衡阳市", + "childs": [{ + "code": "430405", + "name": "珠晖区" + }, { + "code": "430406", + "name": "雁峰区" + }, { + "code": "430407", + "name": "石鼓区" + }, { + "code": "430408", + "name": "蒸湘区" + }, { + "code": "430412", + "name": "南岳区" + }, { + "code": "430421", + "name": "衡阳县" + }, { + "code": "430422", + "name": "衡南县" + }, { + "code": "430423", + "name": "衡山县" + }, { + "code": "430424", + "name": "衡东县" + }, { + "code": "430426", + "name": "祁东县" + }, { + "code": "430481", + "name": "耒阳市" + }, { + "code": "430482", + "name": "常宁市" + }] + }, { + "code": "4305", + "name": "邵阳市", + "childs": [{ + "code": "430502", + "name": "双清区" + }, { + "code": "430503", + "name": "大祥区" + }, { + "code": "430511", + "name": "北塔区" + }, { + "code": "430521", + "name": "邵东县" + }, { + "code": "430522", + "name": "新邵县" + }, { + "code": "430523", + "name": "邵阳县" + }, { + "code": "430524", + "name": "隆回县" + }, { + "code": "430525", + "name": "洞口县" + }, { + "code": "430527", + "name": "绥宁县" + }, { + "code": "430528", + "name": "新宁县" + }, { + "code": "430529", + "name": "城步苗族自治县" + }, { + "code": "430581", + "name": "武冈市" + }] + }, { + "code": "4306", + "name": "岳阳市", + "childs": [{ + "code": "430602", + "name": "岳阳楼区" + }, { + "code": "430603", + "name": "云溪区" + }, { + "code": "430611", + "name": "君山区" + }, { + "code": "430621", + "name": "岳阳县" + }, { + "code": "430623", + "name": "华容县" + }, { + "code": "430624", + "name": "湘阴县" + }, { + "code": "430626", + "name": "平江县" + }, { + "code": "430681", + "name": "汨罗市" + }, { + "code": "430682", + "name": "临湘市" + }] + }, { + "code": "4307", + "name": "常德市", + "childs": [{ + "code": "430702", + "name": "武陵区" + }, { + "code": "430703", + "name": "鼎城区" + }, { + "code": "430721", + "name": "安乡县" + }, { + "code": "430722", + "name": "汉寿县" + }, { + "code": "430723", + "name": "澧县" + }, { + "code": "430724", + "name": "临澧县" + }, { + "code": "430725", + "name": "桃源县" + }, { + "code": "430726", + "name": "石门县" + }, { + "code": "430781", + "name": "津市市" + }] + }, { + "code": "4308", + "name": "张家界市", + "childs": [{ + "code": "430802", + "name": "永定区" + }, { + "code": "430811", + "name": "武陵源区" + }, { + "code": "430821", + "name": "慈利县" + }, { + "code": "430822", + "name": "桑植县" + }] + }, { + "code": "4309", + "name": "益阳市", + "childs": [{ + "code": "430902", + "name": "资阳区" + }, { + "code": "430903", + "name": "赫山区" + }, { + "code": "430921", + "name": "南县" + }, { + "code": "430922", + "name": "桃江县" + }, { + "code": "430923", + "name": "安化县" + }, { + "code": "430981", + "name": "沅江市" + }] + }, { + "code": "4310", + "name": "郴州市", + "childs": [{ + "code": "431002", + "name": "北湖区" + }, { + "code": "431003", + "name": "苏仙区" + }, { + "code": "431021", + "name": "桂阳县" + }, { + "code": "431022", + "name": "宜章县" + }, { + "code": "431023", + "name": "永兴县" + }, { + "code": "431024", + "name": "嘉禾县" + }, { + "code": "431025", + "name": "临武县" + }, { + "code": "431026", + "name": "汝城县" + }, { + "code": "431027", + "name": "桂东县" + }, { + "code": "431028", + "name": "安仁县" + }, { + "code": "431081", + "name": "资兴市" + }] + }, { + "code": "4311", + "name": "永州市", + "childs": [{ + "code": "431102", + "name": "零陵区" + }, { + "code": "431103", + "name": "冷水滩区" + }, { + "code": "431121", + "name": "祁阳县" + }, { + "code": "431122", + "name": "东安县" + }, { + "code": "431123", + "name": "双牌县" + }, { + "code": "431124", + "name": "道县" + }, { + "code": "431125", + "name": "江永县" + }, { + "code": "431126", + "name": "宁远县" + }, { + "code": "431127", + "name": "蓝山县" + }, { + "code": "431128", + "name": "新田县" + }, { + "code": "431129", + "name": "江华瑶族自治县" + }] + }, { + "code": "4312", + "name": "怀化市", + "childs": [{ + "code": "431202", + "name": "鹤城区" + }, { + "code": "431221", + "name": "中方县" + }, { + "code": "431222", + "name": "沅陵县" + }, { + "code": "431223", + "name": "辰溪县" + }, { + "code": "431224", + "name": "溆浦县" + }, { + "code": "431225", + "name": "会同县" + }, { + "code": "431226", + "name": "麻阳苗族自治县" + }, { + "code": "431227", + "name": "新晃侗族自治县" + }, { + "code": "431228", + "name": "芷江侗族自治县" + }, { + "code": "431229", + "name": "靖州苗族侗族自治县" + }, { + "code": "431230", + "name": "通道侗族自治县" + }, { + "code": "431281", + "name": "洪江市" + }] + }, { + "code": "4313", + "name": "娄底市", + "childs": [{ + "code": "431302", + "name": "娄星区" + }, { + "code": "431321", + "name": "双峰县" + }, { + "code": "431322", + "name": "新化县" + }, { + "code": "431381", + "name": "冷水江市" + }, { + "code": "431382", + "name": "涟源市" + }] + }, { + "code": "4331", + "name": "湘西土家族苗族自治州", + "childs": [{ + "code": "433101", + "name": "吉首市" + }, { + "code": "433122", + "name": "泸溪县" + }, { + "code": "433123", + "name": "凤凰县" + }, { + "code": "433124", + "name": "花垣县" + }, { + "code": "433125", + "name": "保靖县" + }, { + "code": "433126", + "name": "古丈县" + }, { + "code": "433127", + "name": "永顺县" + }, { + "code": "433130", + "name": "龙山县" + }] + }] +}, { + "code": "44", + "name": "广东省", + "childs": [{ + "code": "4401", + "name": "广州市", + "childs": [{ + "code": "440103", + "name": "荔湾区" + }, { + "code": "440104", + "name": "越秀区" + }, { + "code": "440105", + "name": "海珠区" + }, { + "code": "440106", + "name": "天河区" + }, { + "code": "440111", + "name": "白云区" + }, { + "code": "440112", + "name": "黄埔区" + }, { + "code": "440113", + "name": "番禺区" + }, { + "code": "440114", + "name": "花都区" + }, { + "code": "440115", + "name": "南沙区" + }, { + "code": "440117", + "name": "从化区" + }, { + "code": "440118", + "name": "增城区" + }] + }, { + "code": "4402", + "name": "韶关市", + "childs": [{ + "code": "440203", + "name": "武江区" + }, { + "code": "440204", + "name": "浈江区" + }, { + "code": "440205", + "name": "曲江区" + }, { + "code": "440222", + "name": "始兴县" + }, { + "code": "440224", + "name": "仁化县" + }, { + "code": "440229", + "name": "翁源县" + }, { + "code": "440232", + "name": "乳源瑶族自治县" + }, { + "code": "440233", + "name": "新丰县" + }, { + "code": "440281", + "name": "乐昌市" + }, { + "code": "440282", + "name": "南雄市" + }] + }, { + "code": "4403", + "name": "深圳市", + "childs": [{ + "code": "440303", + "name": "罗湖区" + }, { + "code": "440304", + "name": "福田区" + }, { + "code": "440305", + "name": "南山区" + }, { + "code": "440306", + "name": "宝安区" + }, { + "code": "440307", + "name": "龙岗区" + }, { + "code": "440308", + "name": "盐田区" + }] + }, { + "code": "4404", + "name": "珠海市", + "childs": [{ + "code": "440402", + "name": "香洲区" + }, { + "code": "440403", + "name": "斗门区" + }, { + "code": "440404", + "name": "金湾区" + }] + }, { + "code": "4405", + "name": "汕头市", + "childs": [{ + "code": "440507", + "name": "龙湖区" + }, { + "code": "440511", + "name": "金平区" + }, { + "code": "440512", + "name": "濠江区" + }, { + "code": "440513", + "name": "潮阳区" + }, { + "code": "440514", + "name": "潮南区" + }, { + "code": "440515", + "name": "澄海区" + }, { + "code": "440523", + "name": "南澳县" + }] + }, { + "code": "4406", + "name": "佛山市", + "childs": [{ + "code": "440604", + "name": "禅城区" + }, { + "code": "440605", + "name": "南海区" + }, { + "code": "440606", + "name": "顺德区" + }, { + "code": "440607", + "name": "三水区" + }, { + "code": "440608", + "name": "高明区" + }] + }, { + "code": "4407", + "name": "江门市", + "childs": [{ + "code": "440703", + "name": "蓬江区" + }, { + "code": "440704", + "name": "江海区" + }, { + "code": "440705", + "name": "新会区" + }, { + "code": "440781", + "name": "台山市" + }, { + "code": "440783", + "name": "开平市" + }, { + "code": "440784", + "name": "鹤山市" + }, { + "code": "440785", + "name": "恩平市" + }] + }, { + "code": "4408", + "name": "湛江市", + "childs": [{ + "code": "440802", + "name": "赤坎区" + }, { + "code": "440803", + "name": "霞山区" + }, { + "code": "440804", + "name": "坡头区" + }, { + "code": "440811", + "name": "麻章区" + }, { + "code": "440823", + "name": "遂溪县" + }, { + "code": "440825", + "name": "徐闻县" + }, { + "code": "440881", + "name": "廉江市" + }, { + "code": "440882", + "name": "雷州市" + }, { + "code": "440883", + "name": "吴川市" + }] + }, { + "code": "4409", + "name": "茂名市", + "childs": [{ + "code": "440902", + "name": "茂南区" + }, { + "code": "440904", + "name": "电白区" + }, { + "code": "440981", + "name": "高州市" + }, { + "code": "440982", + "name": "化州市" + }, { + "code": "440983", + "name": "信宜市" + }] + }, { + "code": "4412", + "name": "肇庆市", + "childs": [{ + "code": "441202", + "name": "端州区" + }, { + "code": "441203", + "name": "鼎湖区" + }, { + "code": "441204", + "name": "高要区" + }, { + "code": "441223", + "name": "广宁县" + }, { + "code": "441224", + "name": "怀集县" + }, { + "code": "441225", + "name": "封开县" + }, { + "code": "441226", + "name": "德庆县" + }, { + "code": "441284", + "name": "四会市" + }] + }, { + "code": "4413", + "name": "惠州市", + "childs": [{ + "code": "441302", + "name": "惠城区" + }, { + "code": "441303", + "name": "惠阳区" + }, { + "code": "441322", + "name": "博罗县" + }, { + "code": "441323", + "name": "惠东县" + }, { + "code": "441324", + "name": "龙门县" + }] + }, { + "code": "4414", + "name": "梅州市", + "childs": [{ + "code": "441402", + "name": "梅江区" + }, { + "code": "441403", + "name": "梅县区" + }, { + "code": "441422", + "name": "大埔县" + }, { + "code": "441423", + "name": "丰顺县" + }, { + "code": "441424", + "name": "五华县" + }, { + "code": "441426", + "name": "平远县" + }, { + "code": "441427", + "name": "蕉岭县" + }, { + "code": "441481", + "name": "兴宁市" + }] + }, { + "code": "4415", + "name": "汕尾市", + "childs": [{ + "code": "441502", + "name": "城区" + }, { + "code": "441521", + "name": "海丰县" + }, { + "code": "441523", + "name": "陆河县" + }, { + "code": "441581", + "name": "陆丰市" + }] + }, { + "code": "4416", + "name": "河源市", + "childs": [{ + "code": "441602", + "name": "源城区" + }, { + "code": "441621", + "name": "紫金县" + }, { + "code": "441622", + "name": "龙川县" + }, { + "code": "441623", + "name": "连平县" + }, { + "code": "441624", + "name": "和平县" + }, { + "code": "441625", + "name": "东源县" + }] + }, { + "code": "4417", + "name": "阳江市", + "childs": [{ + "code": "441702", + "name": "江城区" + }, { + "code": "441704", + "name": "阳东区" + }, { + "code": "441721", + "name": "阳西县" + }, { + "code": "441781", + "name": "阳春市" + }] + }, { + "code": "4418", + "name": "清远市", + "childs": [{ + "code": "441802", + "name": "清城区" + }, { + "code": "441803", + "name": "清新区" + }, { + "code": "441821", + "name": "佛冈县" + }, { + "code": "441823", + "name": "阳山县" + }, { + "code": "441825", + "name": "连山壮族瑶族自治县" + }, { + "code": "441826", + "name": "连南瑶族自治县" + }, { + "code": "441881", + "name": "英德市" + }, { + "code": "441882", + "name": "连州市" + }] + }, { + "code": "441900", + "name": "东莞市", + "childs": [{ + "code": "441900003", + "name": "东城街道办事处" + }, { + "code": "441900004", + "name": "南城街道办事处" + }, { + "code": "441900005", + "name": "万江街道办事处" + }, { + "code": "441900006", + "name": "莞城街道办事处" + }, { + "code": "441900101", + "name": "石碣镇" + }, { + "code": "441900102", + "name": "石龙镇" + }, { + "code": "441900103", + "name": "茶山镇" + }, { + "code": "441900104", + "name": "石排镇" + }, { + "code": "441900105", + "name": "企石镇" + }, { + "code": "441900106", + "name": "横沥镇" + }, { + "code": "441900107", + "name": "桥头镇" + }, { + "code": "441900108", + "name": "谢岗镇" + }, { + "code": "441900109", + "name": "东坑镇" + }, { + "code": "441900110", + "name": "常平镇" + }, { + "code": "441900111", + "name": "寮步镇" + }, { + "code": "441900112", + "name": "樟木头镇" + }, { + "code": "441900113", + "name": "大朗镇" + }, { + "code": "441900114", + "name": "黄江镇" + }, { + "code": "441900115", + "name": "清溪镇" + }, { + "code": "441900116", + "name": "塘厦镇" + }, { + "code": "441900117", + "name": "凤岗镇" + }, { + "code": "441900118", + "name": "大岭山镇" + }, { + "code": "441900119", + "name": "长安镇" + }, { + "code": "441900121", + "name": "虎门镇" + }, { + "code": "441900122", + "name": "厚街镇" + }, { + "code": "441900123", + "name": "沙田镇" + }, { + "code": "441900124", + "name": "道滘镇" + }, { + "code": "441900125", + "name": "洪梅镇" + }, { + "code": "441900126", + "name": "麻涌镇" + }, { + "code": "441900127", + "name": "望牛墩镇" + }, { + "code": "441900128", + "name": "中堂镇" + }, { + "code": "441900129", + "name": "高埗镇" + }, { + "code": "441900401", + "name": "松山湖管委会" + }, { + "code": "441900402", + "name": "虎门港管委会" + }, { + "code": "441900403", + "name": "东莞生态园" + }] + }, { + "code": "442000", + "name": "中山市", + "childs": [{ + "code": "442000001", + "name": "石岐区街道办事处" + }, { + "code": "442000002", + "name": "东区街道办事处" + }, { + "code": "442000003", + "name": "火炬开发区街道办事处" + }, { + "code": "442000004", + "name": "西区街道办事处" + }, { + "code": "442000005", + "name": "南区街道办事处" + }, { + "code": "442000006", + "name": "五桂山街道办事处" + }, { + "code": "442000100", + "name": "小榄镇" + }, { + "code": "442000101", + "name": "黄圃镇" + }, { + "code": "442000102", + "name": "民众镇" + }, { + "code": "442000103", + "name": "东凤镇" + }, { + "code": "442000104", + "name": "东升镇" + }, { + "code": "442000105", + "name": "古镇镇" + }, { + "code": "442000106", + "name": "沙溪镇" + }, { + "code": "442000107", + "name": "坦洲镇" + }, { + "code": "442000108", + "name": "港口镇" + }, { + "code": "442000109", + "name": "三角镇" + }, { + "code": "442000110", + "name": "横栏镇" + }, { + "code": "442000111", + "name": "南头镇" + }, { + "code": "442000112", + "name": "阜沙镇" + }, { + "code": "442000113", + "name": "南朗镇" + }, { + "code": "442000114", + "name": "三乡镇" + }, { + "code": "442000115", + "name": "板芙镇" + }, { + "code": "442000116", + "name": "大涌镇" + }, { + "code": "442000117", + "name": "神湾镇" + }] + }, { + "code": "4451", + "name": "潮州市", + "childs": [{ + "code": "445102", + "name": "湘桥区" + }, { + "code": "445103", + "name": "潮安区" + }, { + "code": "445122", + "name": "饶平县" + }] + }, { + "code": "4452", + "name": "揭阳市", + "childs": [{ + "code": "445202", + "name": "榕城区" + }, { + "code": "445203", + "name": "揭东区" + }, { + "code": "445222", + "name": "揭西县" + }, { + "code": "445224", + "name": "惠来县" + }, { + "code": "445281", + "name": "普宁市" + }] + }, { + "code": "4453", + "name": "云浮市", + "childs": [{ + "code": "445302", + "name": "云城区" + }, { + "code": "445303", + "name": "云安区" + }, { + "code": "445321", + "name": "新兴县" + }, { + "code": "445322", + "name": "郁南县" + }, { + "code": "445381", + "name": "罗定市" + }] + }] +}, { + "code": "45", + "name": "广西壮族自治区", + "childs": [{ + "code": "4501", + "name": "南宁市", + "childs": [{ + "code": "450102", + "name": "兴宁区" + }, { + "code": "450103", + "name": "青秀区" + }, { + "code": "450105", + "name": "江南区" + }, { + "code": "450107", + "name": "西乡塘区" + }, { + "code": "450108", + "name": "良庆区" + }, { + "code": "450109", + "name": "邕宁区" + }, { + "code": "450110", + "name": "武鸣区" + }, { + "code": "450123", + "name": "隆安县" + }, { + "code": "450124", + "name": "马山县" + }, { + "code": "450125", + "name": "上林县" + }, { + "code": "450126", + "name": "宾阳县" + }, { + "code": "450127", + "name": "横县" + }] + }, { + "code": "4502", + "name": "柳州市", + "childs": [{ + "code": "450202", + "name": "城中区" + }, { + "code": "450203", + "name": "鱼峰区" + }, { + "code": "450204", + "name": "柳南区" + }, { + "code": "450205", + "name": "柳北区" + }, { + "code": "450206", + "name": "柳江区" + }, { + "code": "450222", + "name": "柳城县" + }, { + "code": "450223", + "name": "鹿寨县" + }, { + "code": "450224", + "name": "融安县" + }, { + "code": "450225", + "name": "融水苗族自治县" + }, { + "code": "450226", + "name": "三江侗族自治县" + }] + }, { + "code": "4503", + "name": "桂林市", + "childs": [{ + "code": "450302", + "name": "秀峰区" + }, { + "code": "450303", + "name": "叠彩区" + }, { + "code": "450304", + "name": "象山区" + }, { + "code": "450305", + "name": "七星区" + }, { + "code": "450311", + "name": "雁山区" + }, { + "code": "450312", + "name": "临桂区" + }, { + "code": "450321", + "name": "阳朔县" + }, { + "code": "450323", + "name": "灵川县" + }, { + "code": "450324", + "name": "全州县" + }, { + "code": "450325", + "name": "兴安县" + }, { + "code": "450326", + "name": "永福县" + }, { + "code": "450327", + "name": "灌阳县" + }, { + "code": "450328", + "name": "龙胜各族自治县" + }, { + "code": "450329", + "name": "资源县" + }, { + "code": "450330", + "name": "平乐县" + }, { + "code": "450331", + "name": "荔浦县" + }, { + "code": "450332", + "name": "恭城瑶族自治县" + }] + }, { + "code": "4504", + "name": "梧州市", + "childs": [{ + "code": "450403", + "name": "万秀区" + }, { + "code": "450405", + "name": "长洲区" + }, { + "code": "450406", + "name": "龙圩区" + }, { + "code": "450421", + "name": "苍梧县" + }, { + "code": "450422", + "name": "藤县" + }, { + "code": "450423", + "name": "蒙山县" + }, { + "code": "450481", + "name": "岑溪市" + }] + }, { + "code": "4505", + "name": "北海市", + "childs": [{ + "code": "450502", + "name": "海城区" + }, { + "code": "450503", + "name": "银海区" + }, { + "code": "450512", + "name": "铁山港区" + }, { + "code": "450521", + "name": "合浦县" + }] + }, { + "code": "4506", + "name": "防城港市", + "childs": [{ + "code": "450602", + "name": "港口区" + }, { + "code": "450603", + "name": "防城区" + }, { + "code": "450621", + "name": "上思县" + }, { + "code": "450681", + "name": "东兴市" + }] + }, { + "code": "4507", + "name": "钦州市", + "childs": [{ + "code": "450702", + "name": "钦南区" + }, { + "code": "450703", + "name": "钦北区" + }, { + "code": "450721", + "name": "灵山县" + }, { + "code": "450722", + "name": "浦北县" + }] + }, { + "code": "4508", + "name": "贵港市", + "childs": [{ + "code": "450802", + "name": "港北区" + }, { + "code": "450803", + "name": "港南区" + }, { + "code": "450804", + "name": "覃塘区" + }, { + "code": "450821", + "name": "平南县" + }, { + "code": "450881", + "name": "桂平市" + }] + }, { + "code": "4509", + "name": "玉林市", + "childs": [{ + "code": "450902", + "name": "玉州区" + }, { + "code": "450903", + "name": "福绵区" + }, { + "code": "450921", + "name": "容县" + }, { + "code": "450922", + "name": "陆川县" + }, { + "code": "450923", + "name": "博白县" + }, { + "code": "450924", + "name": "兴业县" + }, { + "code": "450981", + "name": "北流市" + }] + }, { + "code": "4510", + "name": "百色市", + "childs": [{ + "code": "451002", + "name": "右江区" + }, { + "code": "451021", + "name": "田阳县" + }, { + "code": "451022", + "name": "田东县" + }, { + "code": "451023", + "name": "平果县" + }, { + "code": "451024", + "name": "德保县" + }, { + "code": "451026", + "name": "那坡县" + }, { + "code": "451027", + "name": "凌云县" + }, { + "code": "451028", + "name": "乐业县" + }, { + "code": "451029", + "name": "田林县" + }, { + "code": "451030", + "name": "西林县" + }, { + "code": "451031", + "name": "隆林各族自治县" + }, { + "code": "451081", + "name": "靖西市" + }] + }, { + "code": "4511", + "name": "贺州市", + "childs": [{ + "code": "451102", + "name": "八步区" + }, { + "code": "451103", + "name": "平桂区" + }, { + "code": "451121", + "name": "昭平县" + }, { + "code": "451122", + "name": "钟山县" + }, { + "code": "451123", + "name": "富川瑶族自治县" + }] + }, { + "code": "4512", + "name": "河池市", + "childs": [{ + "code": "451202", + "name": "金城江区" + }, { + "code": "451221", + "name": "南丹县" + }, { + "code": "451222", + "name": "天峨县" + }, { + "code": "451223", + "name": "凤山县" + }, { + "code": "451224", + "name": "东兰县" + }, { + "code": "451225", + "name": "罗城仫佬族自治县" + }, { + "code": "451226", + "name": "环江毛南族自治县" + }, { + "code": "451227", + "name": "巴马瑶族自治县" + }, { + "code": "451228", + "name": "都安瑶族自治县" + }, { + "code": "451229", + "name": "大化瑶族自治县" + }, { + "code": "451281", + "name": "宜州市" + }] + }, { + "code": "4513", + "name": "来宾市", + "childs": [{ + "code": "451302", + "name": "兴宾区" + }, { + "code": "451321", + "name": "忻城县" + }, { + "code": "451322", + "name": "象州县" + }, { + "code": "451323", + "name": "武宣县" + }, { + "code": "451324", + "name": "金秀瑶族自治县" + }, { + "code": "451381", + "name": "合山市" + }] + }, { + "code": "4514", + "name": "崇左市", + "childs": [{ + "code": "451402", + "name": "江州区" + }, { + "code": "451421", + "name": "扶绥县" + }, { + "code": "451422", + "name": "宁明县" + }, { + "code": "451423", + "name": "龙州县" + }, { + "code": "451424", + "name": "大新县" + }, { + "code": "451425", + "name": "天等县" + }, { + "code": "451481", + "name": "凭祥市" + }] + }] +}, { + "code": "46", + "name": "海南省", + "childs": [{ + "code": "4601", + "name": "海口市", + "childs": [{ + "code": "460105", + "name": "秀英区" + }, { + "code": "460106", + "name": "龙华区" + }, { + "code": "460107", + "name": "琼山区" + }, { + "code": "460108", + "name": "美兰区" + }] + }, { + "code": "4602", + "name": "三亚市", + "childs": [{ + "code": "460202", + "name": "海棠区" + }, { + "code": "460203", + "name": "吉阳区" + }, { + "code": "460204", + "name": "天涯区" + }, { + "code": "460205", + "name": "崖州区" + }] + }, { + "code": "4603", + "name": "三沙市", + "childs": [{ + "code": "460321", + "name": "西沙群岛" + }, { + "code": "460322", + "name": "南沙群岛" + }, { + "code": "460323", + "name": "中沙群岛的岛礁及其海域" + }] + }, { + "code": "460400", + "name": "儋州市", + "childs": [{ + "code": "460400100", + "name": "那大镇" + }, { + "code": "460400101", + "name": "和庆镇" + }, { + "code": "460400102", + "name": "南丰镇" + }, { + "code": "460400103", + "name": "大成镇" + }, { + "code": "460400104", + "name": "雅星镇" + }, { + "code": "460400105", + "name": "兰洋镇" + }, { + "code": "460400106", + "name": "光村镇" + }, { + "code": "460400107", + "name": "木棠镇" + }, { + "code": "460400108", + "name": "海头镇" + }, { + "code": "460400109", + "name": "峨蔓镇" + }, { + "code": "460400110", + "name": "三都镇" + }, { + "code": "460400111", + "name": "王五镇" + }, { + "code": "460400112", + "name": "白马井镇" + }, { + "code": "460400113", + "name": "中和镇" + }, { + "code": "460400114", + "name": "排浦镇" + }, { + "code": "460400115", + "name": "东成镇" + }, { + "code": "460400116", + "name": "新州镇" + }, { + "code": "460400400", + "name": "国营西培农场" + }, { + "code": "460400404", + "name": "国营西联农场" + }, { + "code": "460400405", + "name": "国营蓝洋农场" + }, { + "code": "460400407", + "name": "国营八一农场" + }, { + "code": "460400499", + "name": "洋浦经济开发区" + }, { + "code": "460400500", + "name": "华南热作学院" + }] + }, { + "code": "4690", + "name": "省直辖县级行政区划", + "childs": [{ + "code": "469001", + "name": "五指山市" + }, { + "code": "469002", + "name": "琼海市" + }, { + "code": "469005", + "name": "文昌市" + }, { + "code": "469006", + "name": "万宁市" + }, { + "code": "469007", + "name": "东方市" + }, { + "code": "469021", + "name": "定安县" + }, { + "code": "469022", + "name": "屯昌县" + }, { + "code": "469023", + "name": "澄迈县" + }, { + "code": "469024", + "name": "临高县" + }, { + "code": "469025", + "name": "白沙黎族自治县" + }, { + "code": "469026", + "name": "昌江黎族自治县" + }, { + "code": "469027", + "name": "乐东黎族自治县" + }, { + "code": "469028", + "name": "陵水黎族自治县" + }, { + "code": "469029", + "name": "保亭黎族苗族自治县" + }, { + "code": "469030", + "name": "琼中黎族苗族自治县" + }] + }] +}, { + "code": "50", + "name": "重庆市", + "childs": [{ + "code": "5001", + "name": "市辖区", + "childs": [{ + "code": "500101", + "name": "万州区" + }, { + "code": "500102", + "name": "涪陵区" + }, { + "code": "500103", + "name": "渝中区" + }, { + "code": "500104", + "name": "大渡口区" + }, { + "code": "500105", + "name": "江北区" + }, { + "code": "500106", + "name": "沙坪坝区" + }, { + "code": "500107", + "name": "九龙坡区" + }, { + "code": "500108", + "name": "南岸区" + }, { + "code": "500109", + "name": "北碚区" + }, { + "code": "500110", + "name": "綦江区" + }, { + "code": "500111", + "name": "大足区" + }, { + "code": "500112", + "name": "渝北区" + }, { + "code": "500113", + "name": "巴南区" + }, { + "code": "500114", + "name": "黔江区" + }, { + "code": "500115", + "name": "长寿区" + }, { + "code": "500116", + "name": "江津区" + }, { + "code": "500117", + "name": "合川区" + }, { + "code": "500118", + "name": "永川区" + }, { + "code": "500119", + "name": "南川区" + }, { + "code": "500120", + "name": "璧山区" + }, { + "code": "500151", + "name": "铜梁区" + }, { + "code": "500152", + "name": "潼南区" + }, { + "code": "500153", + "name": "荣昌区" + }, { + "code": "500154", + "name": "开州区" + }] + }, { + "code": "5002", + "name": "县", + "childs": [{ + "code": "500228", + "name": "梁平县" + }, { + "code": "500229", + "name": "城口县" + }, { + "code": "500230", + "name": "丰都县" + }, { + "code": "500231", + "name": "垫江县" + }, { + "code": "500232", + "name": "武隆县" + }, { + "code": "500233", + "name": "忠县" + }, { + "code": "500235", + "name": "云阳县" + }, { + "code": "500236", + "name": "奉节县" + }, { + "code": "500237", + "name": "巫山县" + }, { + "code": "500238", + "name": "巫溪县" + }, { + "code": "500240", + "name": "石柱土家族自治县" + }, { + "code": "500241", + "name": "秀山土家族苗族自治县" + }, { + "code": "500242", + "name": "酉阳土家族苗族自治县" + }, { + "code": "500243", + "name": "彭水苗族土家族自治县" + }] + }] +}, { + "code": "51", + "name": "四川省", + "childs": [{ + "code": "5101", + "name": "成都市", + "childs": [{ + "code": "510104", + "name": "锦江区" + }, { + "code": "510105", + "name": "青羊区" + }, { + "code": "510106", + "name": "金牛区" + }, { + "code": "510107", + "name": "武侯区" + }, { + "code": "510108", + "name": "成华区" + }, { + "code": "510112", + "name": "龙泉驿区" + }, { + "code": "510113", + "name": "青白江区" + }, { + "code": "510114", + "name": "新都区" + }, { + "code": "510115", + "name": "温江区" + }, { + "code": "510116", + "name": "双流区" + }, { + "code": "510121", + "name": "金堂县" + }, { + "code": "510124", + "name": "郫县" + }, { + "code": "510129", + "name": "大邑县" + }, { + "code": "510131", + "name": "蒲江县" + }, { + "code": "510132", + "name": "新津县" + }, { + "code": "510181", + "name": "都江堰市" + }, { + "code": "510182", + "name": "彭州市" + }, { + "code": "510183", + "name": "邛崃市" + }, { + "code": "510184", + "name": "崇州市" + }, { + "code": "510185", + "name": "简阳市" + }] + }, { + "code": "5103", + "name": "自贡市", + "childs": [{ + "code": "510302", + "name": "自流井区" + }, { + "code": "510303", + "name": "贡井区" + }, { + "code": "510304", + "name": "大安区" + }, { + "code": "510311", + "name": "沿滩区" + }, { + "code": "510321", + "name": "荣县" + }, { + "code": "510322", + "name": "富顺县" + }] + }, { + "code": "5104", + "name": "攀枝花市", + "childs": [{ + "code": "510402", + "name": "东区" + }, { + "code": "510403", + "name": "西区" + }, { + "code": "510411", + "name": "仁和区" + }, { + "code": "510421", + "name": "米易县" + }, { + "code": "510422", + "name": "盐边县" + }] + }, { + "code": "5105", + "name": "泸州市", + "childs": [{ + "code": "510502", + "name": "江阳区" + }, { + "code": "510503", + "name": "纳溪区" + }, { + "code": "510504", + "name": "龙马潭区" + }, { + "code": "510521", + "name": "泸县" + }, { + "code": "510522", + "name": "合江县" + }, { + "code": "510524", + "name": "叙永县" + }, { + "code": "510525", + "name": "古蔺县" + }] + }, { + "code": "5106", + "name": "德阳市", + "childs": [{ + "code": "510603", + "name": "旌阳区" + }, { + "code": "510623", + "name": "中江县" + }, { + "code": "510626", + "name": "罗江县" + }, { + "code": "510681", + "name": "广汉市" + }, { + "code": "510682", + "name": "什邡市" + }, { + "code": "510683", + "name": "绵竹市" + }] + }, { + "code": "5107", + "name": "绵阳市", + "childs": [{ + "code": "510703", + "name": "涪城区" + }, { + "code": "510704", + "name": "游仙区" + }, { + "code": "510705", + "name": "安州区" + }, { + "code": "510722", + "name": "三台县" + }, { + "code": "510723", + "name": "盐亭县" + }, { + "code": "510725", + "name": "梓潼县" + }, { + "code": "510726", + "name": "北川羌族自治县" + }, { + "code": "510727", + "name": "平武县" + }, { + "code": "510781", + "name": "江油市" + }] + }, { + "code": "5108", + "name": "广元市", + "childs": [{ + "code": "510802", + "name": "利州区" + }, { + "code": "510811", + "name": "昭化区" + }, { + "code": "510812", + "name": "朝天区" + }, { + "code": "510821", + "name": "旺苍县" + }, { + "code": "510822", + "name": "青川县" + }, { + "code": "510823", + "name": "剑阁县" + }, { + "code": "510824", + "name": "苍溪县" + }] + }, { + "code": "5109", + "name": "遂宁市", + "childs": [{ + "code": "510903", + "name": "船山区" + }, { + "code": "510904", + "name": "安居区" + }, { + "code": "510921", + "name": "蓬溪县" + }, { + "code": "510922", + "name": "射洪县" + }, { + "code": "510923", + "name": "大英县" + }] + }, { + "code": "5110", + "name": "内江市", + "childs": [{ + "code": "511002", + "name": "市中区" + }, { + "code": "511011", + "name": "东兴区" + }, { + "code": "511024", + "name": "威远县" + }, { + "code": "511025", + "name": "资中县" + }, { + "code": "511028", + "name": "隆昌县" + }] + }, { + "code": "5111", + "name": "乐山市", + "childs": [{ + "code": "511102", + "name": "市中区" + }, { + "code": "511111", + "name": "沙湾区" + }, { + "code": "511112", + "name": "五通桥区" + }, { + "code": "511113", + "name": "金口河区" + }, { + "code": "511123", + "name": "犍为县" + }, { + "code": "511124", + "name": "井研县" + }, { + "code": "511126", + "name": "夹江县" + }, { + "code": "511129", + "name": "沐川县" + }, { + "code": "511132", + "name": "峨边彝族自治县" + }, { + "code": "511133", + "name": "马边彝族自治县" + }, { + "code": "511181", + "name": "峨眉山市" + }] + }, { + "code": "5113", + "name": "南充市", + "childs": [{ + "code": "511302", + "name": "顺庆区" + }, { + "code": "511303", + "name": "高坪区" + }, { + "code": "511304", + "name": "嘉陵区" + }, { + "code": "511321", + "name": "南部县" + }, { + "code": "511322", + "name": "营山县" + }, { + "code": "511323", + "name": "蓬安县" + }, { + "code": "511324", + "name": "仪陇县" + }, { + "code": "511325", + "name": "西充县" + }, { + "code": "511381", + "name": "阆中市" + }] + }, { + "code": "5114", + "name": "眉山市", + "childs": [{ + "code": "511402", + "name": "东坡区" + }, { + "code": "511403", + "name": "彭山区" + }, { + "code": "511421", + "name": "仁寿县" + }, { + "code": "511423", + "name": "洪雅县" + }, { + "code": "511424", + "name": "丹棱县" + }, { + "code": "511425", + "name": "青神县" + }] + }, { + "code": "5115", + "name": "宜宾市", + "childs": [{ + "code": "511502", + "name": "翠屏区" + }, { + "code": "511503", + "name": "南溪区" + }, { + "code": "511521", + "name": "宜宾县" + }, { + "code": "511523", + "name": "江安县" + }, { + "code": "511524", + "name": "长宁县" + }, { + "code": "511525", + "name": "高县" + }, { + "code": "511526", + "name": "珙县" + }, { + "code": "511527", + "name": "筠连县" + }, { + "code": "511528", + "name": "兴文县" + }, { + "code": "511529", + "name": "屏山县" + }] + }, { + "code": "5116", + "name": "广安市", + "childs": [{ + "code": "511602", + "name": "广安区" + }, { + "code": "511603", + "name": "前锋区" + }, { + "code": "511621", + "name": "岳池县" + }, { + "code": "511622", + "name": "武胜县" + }, { + "code": "511623", + "name": "邻水县" + }, { + "code": "511681", + "name": "华蓥市" + }] + }, { + "code": "5117", + "name": "达州市", + "childs": [{ + "code": "511702", + "name": "通川区" + }, { + "code": "511703", + "name": "达川区" + }, { + "code": "511722", + "name": "宣汉县" + }, { + "code": "511723", + "name": "开江县" + }, { + "code": "511724", + "name": "大竹县" + }, { + "code": "511725", + "name": "渠县" + }, { + "code": "511781", + "name": "万源市" + }] + }, { + "code": "5118", + "name": "雅安市", + "childs": [{ + "code": "511802", + "name": "雨城区" + }, { + "code": "511803", + "name": "名山区" + }, { + "code": "511822", + "name": "荥经县" + }, { + "code": "511823", + "name": "汉源县" + }, { + "code": "511824", + "name": "石棉县" + }, { + "code": "511825", + "name": "天全县" + }, { + "code": "511826", + "name": "芦山县" + }, { + "code": "511827", + "name": "宝兴县" + }] + }, { + "code": "5119", + "name": "巴中市", + "childs": [{ + "code": "511902", + "name": "巴州区" + }, { + "code": "511903", + "name": "恩阳区" + }, { + "code": "511921", + "name": "通江县" + }, { + "code": "511922", + "name": "南江县" + }, { + "code": "511923", + "name": "平昌县" + }] + }, { + "code": "5120", + "name": "资阳市", + "childs": [{ + "code": "512002", + "name": "雁江区" + }, { + "code": "512021", + "name": "安岳县" + }, { + "code": "512022", + "name": "乐至县" + }] + }, { + "code": "5132", + "name": "阿坝藏族羌族自治州", + "childs": [{ + "code": "513201", + "name": "马尔康市" + }, { + "code": "513221", + "name": "汶川县" + }, { + "code": "513222", + "name": "理县" + }, { + "code": "513223", + "name": "茂县" + }, { + "code": "513224", + "name": "松潘县" + }, { + "code": "513225", + "name": "九寨沟县" + }, { + "code": "513226", + "name": "金川县" + }, { + "code": "513227", + "name": "小金县" + }, { + "code": "513228", + "name": "黑水县" + }, { + "code": "513230", + "name": "壤塘县" + }, { + "code": "513231", + "name": "阿坝县" + }, { + "code": "513232", + "name": "若尔盖县" + }, { + "code": "513233", + "name": "红原县" + }] + }, { + "code": "5133", + "name": "甘孜藏族自治州", + "childs": [{ + "code": "513301", + "name": "康定市" + }, { + "code": "513322", + "name": "泸定县" + }, { + "code": "513323", + "name": "丹巴县" + }, { + "code": "513324", + "name": "九龙县" + }, { + "code": "513325", + "name": "雅江县" + }, { + "code": "513326", + "name": "道孚县" + }, { + "code": "513327", + "name": "炉霍县" + }, { + "code": "513328", + "name": "甘孜县" + }, { + "code": "513329", + "name": "新龙县" + }, { + "code": "513330", + "name": "德格县" + }, { + "code": "513331", + "name": "白玉县" + }, { + "code": "513332", + "name": "石渠县" + }, { + "code": "513333", + "name": "色达县" + }, { + "code": "513334", + "name": "理塘县" + }, { + "code": "513335", + "name": "巴塘县" + }, { + "code": "513336", + "name": "乡城县" + }, { + "code": "513337", + "name": "稻城县" + }, { + "code": "513338", + "name": "得荣县" + }] + }, { + "code": "5134", + "name": "凉山彝族自治州", + "childs": [{ + "code": "513401", + "name": "西昌市" + }, { + "code": "513422", + "name": "木里藏族自治县" + }, { + "code": "513423", + "name": "盐源县" + }, { + "code": "513424", + "name": "德昌县" + }, { + "code": "513425", + "name": "会理县" + }, { + "code": "513426", + "name": "会东县" + }, { + "code": "513427", + "name": "宁南县" + }, { + "code": "513428", + "name": "普格县" + }, { + "code": "513429", + "name": "布拖县" + }, { + "code": "513430", + "name": "金阳县" + }, { + "code": "513431", + "name": "昭觉县" + }, { + "code": "513432", + "name": "喜德县" + }, { + "code": "513433", + "name": "冕宁县" + }, { + "code": "513434", + "name": "越西县" + }, { + "code": "513435", + "name": "甘洛县" + }, { + "code": "513436", + "name": "美姑县" + }, { + "code": "513437", + "name": "雷波县" + }] + }] +}, { + "code": "52", + "name": "贵州省", + "childs": [{ + "code": "5201", + "name": "贵阳市", + "childs": [{ + "code": "520102", + "name": "南明区" + }, { + "code": "520103", + "name": "云岩区" + }, { + "code": "520111", + "name": "花溪区" + }, { + "code": "520112", + "name": "乌当区" + }, { + "code": "520113", + "name": "白云区" + }, { + "code": "520115", + "name": "观山湖区" + }, { + "code": "520121", + "name": "开阳县" + }, { + "code": "520122", + "name": "息烽县" + }, { + "code": "520123", + "name": "修文县" + }, { + "code": "520181", + "name": "清镇市" + }] + }, { + "code": "5202", + "name": "六盘水市", + "childs": [{ + "code": "520201", + "name": "钟山区" + }, { + "code": "520203", + "name": "六枝特区" + }, { + "code": "520221", + "name": "水城县" + }, { + "code": "520222", + "name": "盘县" + }] + }, { + "code": "5203", + "name": "遵义市", + "childs": [{ + "code": "520302", + "name": "红花岗区" + }, { + "code": "520303", + "name": "汇川区" + }, { + "code": "520304", + "name": "播州区" + }, { + "code": "520322", + "name": "桐梓县" + }, { + "code": "520323", + "name": "绥阳县" + }, { + "code": "520324", + "name": "正安县" + }, { + "code": "520325", + "name": "道真仡佬族苗族自治县" + }, { + "code": "520326", + "name": "务川仡佬族苗族自治县" + }, { + "code": "520327", + "name": "凤冈县" + }, { + "code": "520328", + "name": "湄潭县" + }, { + "code": "520329", + "name": "余庆县" + }, { + "code": "520330", + "name": "习水县" + }, { + "code": "520381", + "name": "赤水市" + }, { + "code": "520382", + "name": "仁怀市" + }] + }, { + "code": "5204", + "name": "安顺市", + "childs": [{ + "code": "520402", + "name": "西秀区" + }, { + "code": "520403", + "name": "平坝区" + }, { + "code": "520422", + "name": "普定县" + }, { + "code": "520423", + "name": "镇宁布依族苗族自治县" + }, { + "code": "520424", + "name": "关岭布依族苗族自治县" + }, { + "code": "520425", + "name": "紫云苗族布依族自治县" + }] + }, { + "code": "5205", + "name": "毕节市", + "childs": [{ + "code": "520502", + "name": "七星关区" + }, { + "code": "520521", + "name": "大方县" + }, { + "code": "520522", + "name": "黔西县" + }, { + "code": "520523", + "name": "金沙县" + }, { + "code": "520524", + "name": "织金县" + }, { + "code": "520525", + "name": "纳雍县" + }, { + "code": "520526", + "name": "威宁彝族回族苗族自治县" + }, { + "code": "520527", + "name": "赫章县" + }] + }, { + "code": "5206", + "name": "铜仁市", + "childs": [{ + "code": "520602", + "name": "碧江区" + }, { + "code": "520603", + "name": "万山区" + }, { + "code": "520621", + "name": "江口县" + }, { + "code": "520622", + "name": "玉屏侗族自治县" + }, { + "code": "520623", + "name": "石阡县" + }, { + "code": "520624", + "name": "思南县" + }, { + "code": "520625", + "name": "印江土家族苗族自治县" + }, { + "code": "520626", + "name": "德江县" + }, { + "code": "520627", + "name": "沿河土家族自治县" + }, { + "code": "520628", + "name": "松桃苗族自治县" + }] + }, { + "code": "5223", + "name": "黔西南布依族苗族自治州", + "childs": [{ + "code": "522301", + "name": "兴义市" + }, { + "code": "522322", + "name": "兴仁县" + }, { + "code": "522323", + "name": "普安县" + }, { + "code": "522324", + "name": "晴隆县" + }, { + "code": "522325", + "name": "贞丰县" + }, { + "code": "522326", + "name": "望谟县" + }, { + "code": "522327", + "name": "册亨县" + }, { + "code": "522328", + "name": "安龙县" + }] + }, { + "code": "5226", + "name": "黔东南苗族侗族自治州", + "childs": [{ + "code": "522601", + "name": "凯里市" + }, { + "code": "522622", + "name": "黄平县" + }, { + "code": "522623", + "name": "施秉县" + }, { + "code": "522624", + "name": "三穗县" + }, { + "code": "522625", + "name": "镇远县" + }, { + "code": "522626", + "name": "岑巩县" + }, { + "code": "522627", + "name": "天柱县" + }, { + "code": "522628", + "name": "锦屏县" + }, { + "code": "522629", + "name": "剑河县" + }, { + "code": "522630", + "name": "台江县" + }, { + "code": "522631", + "name": "黎平县" + }, { + "code": "522632", + "name": "榕江县" + }, { + "code": "522633", + "name": "从江县" + }, { + "code": "522634", + "name": "雷山县" + }, { + "code": "522635", + "name": "麻江县" + }, { + "code": "522636", + "name": "丹寨县" + }] + }, { + "code": "5227", + "name": "黔南布依族苗族自治州", + "childs": [{ + "code": "522701", + "name": "都匀市" + }, { + "code": "522702", + "name": "福泉市" + }, { + "code": "522722", + "name": "荔波县" + }, { + "code": "522723", + "name": "贵定县" + }, { + "code": "522725", + "name": "瓮安县" + }, { + "code": "522726", + "name": "独山县" + }, { + "code": "522727", + "name": "平塘县" + }, { + "code": "522728", + "name": "罗甸县" + }, { + "code": "522729", + "name": "长顺县" + }, { + "code": "522730", + "name": "龙里县" + }, { + "code": "522731", + "name": "惠水县" + }, { + "code": "522732", + "name": "三都水族自治县" + }] + }] +}, { + "code": "53", + "name": "云南省", + "childs": [{ + "code": "5301", + "name": "昆明市", + "childs": [{ + "code": "530102", + "name": "五华区" + }, { + "code": "530103", + "name": "盘龙区" + }, { + "code": "530111", + "name": "官渡区" + }, { + "code": "530112", + "name": "西山区" + }, { + "code": "530113", + "name": "东川区" + }, { + "code": "530114", + "name": "呈贡区" + }, { + "code": "530122", + "name": "晋宁县" + }, { + "code": "530124", + "name": "富民县" + }, { + "code": "530125", + "name": "宜良县" + }, { + "code": "530126", + "name": "石林彝族自治县" + }, { + "code": "530127", + "name": "嵩明县" + }, { + "code": "530128", + "name": "禄劝彝族苗族自治县" + }, { + "code": "530129", + "name": "寻甸回族彝族自治县" + }, { + "code": "530181", + "name": "安宁市" + }] + }, { + "code": "5303", + "name": "曲靖市", + "childs": [{ + "code": "530302", + "name": "麒麟区" + }, { + "code": "530303", + "name": "沾益区" + }, { + "code": "530321", + "name": "马龙县" + }, { + "code": "530322", + "name": "陆良县" + }, { + "code": "530323", + "name": "师宗县" + }, { + "code": "530324", + "name": "罗平县" + }, { + "code": "530325", + "name": "富源县" + }, { + "code": "530326", + "name": "会泽县" + }, { + "code": "530381", + "name": "宣威市" + }] + }, { + "code": "5304", + "name": "玉溪市", + "childs": [{ + "code": "530402", + "name": "红塔区" + }, { + "code": "530403", + "name": "江川区" + }, { + "code": "530422", + "name": "澄江县" + }, { + "code": "530423", + "name": "通海县" + }, { + "code": "530424", + "name": "华宁县" + }, { + "code": "530425", + "name": "易门县" + }, { + "code": "530426", + "name": "峨山彝族自治县" + }, { + "code": "530427", + "name": "新平彝族傣族自治县" + }, { + "code": "530428", + "name": "元江哈尼族彝族傣族自治县" + }] + }, { + "code": "5305", + "name": "保山市", + "childs": [{ + "code": "530502", + "name": "隆阳区" + }, { + "code": "530521", + "name": "施甸县" + }, { + "code": "530523", + "name": "龙陵县" + }, { + "code": "530524", + "name": "昌宁县" + }, { + "code": "530581", + "name": "腾冲市" + }] + }, { + "code": "5306", + "name": "昭通市", + "childs": [{ + "code": "530602", + "name": "昭阳区" + }, { + "code": "530621", + "name": "鲁甸县" + }, { + "code": "530622", + "name": "巧家县" + }, { + "code": "530623", + "name": "盐津县" + }, { + "code": "530624", + "name": "大关县" + }, { + "code": "530625", + "name": "永善县" + }, { + "code": "530626", + "name": "绥江县" + }, { + "code": "530627", + "name": "镇雄县" + }, { + "code": "530628", + "name": "彝良县" + }, { + "code": "530629", + "name": "威信县" + }, { + "code": "530630", + "name": "水富县" + }] + }, { + "code": "5307", + "name": "丽江市", + "childs": [{ + "code": "530702", + "name": "古城区" + }, { + "code": "530721", + "name": "玉龙纳西族自治县" + }, { + "code": "530722", + "name": "永胜县" + }, { + "code": "530723", + "name": "华坪县" + }, { + "code": "530724", + "name": "宁蒗彝族自治县" + }] + }, { + "code": "5308", + "name": "普洱市", + "childs": [{ + "code": "530802", + "name": "思茅区" + }, { + "code": "530821", + "name": "宁洱哈尼族彝族自治县" + }, { + "code": "530822", + "name": "墨江哈尼族自治县" + }, { + "code": "530823", + "name": "景东彝族自治县" + }, { + "code": "530824", + "name": "景谷傣族彝族自治县" + }, { + "code": "530825", + "name": "镇沅彝族哈尼族拉祜族自治县" + }, { + "code": "530826", + "name": "江城哈尼族彝族自治县" + }, { + "code": "530827", + "name": "孟连傣族拉祜族佤族自治县" + }, { + "code": "530828", + "name": "澜沧拉祜族自治县" + }, { + "code": "530829", + "name": "西盟佤族自治县" + }] + }, { + "code": "5309", + "name": "临沧市", + "childs": [{ + "code": "530902", + "name": "临翔区" + }, { + "code": "530921", + "name": "凤庆县" + }, { + "code": "530922", + "name": "云县" + }, { + "code": "530923", + "name": "永德县" + }, { + "code": "530924", + "name": "镇康县" + }, { + "code": "530925", + "name": "双江拉祜族佤族布朗族傣族自治县" + }, { + "code": "530926", + "name": "耿马傣族佤族自治县" + }, { + "code": "530927", + "name": "沧源佤族自治县" + }] + }, { + "code": "5323", + "name": "楚雄彝族自治州", + "childs": [{ + "code": "532301", + "name": "楚雄市" + }, { + "code": "532322", + "name": "双柏县" + }, { + "code": "532323", + "name": "牟定县" + }, { + "code": "532324", + "name": "南华县" + }, { + "code": "532325", + "name": "姚安县" + }, { + "code": "532326", + "name": "大姚县" + }, { + "code": "532327", + "name": "永仁县" + }, { + "code": "532328", + "name": "元谋县" + }, { + "code": "532329", + "name": "武定县" + }, { + "code": "532331", + "name": "禄丰县" + }] + }, { + "code": "5325", + "name": "红河哈尼族彝族自治州", + "childs": [{ + "code": "532501", + "name": "个旧市" + }, { + "code": "532502", + "name": "开远市" + }, { + "code": "532503", + "name": "蒙自市" + }, { + "code": "532504", + "name": "弥勒市" + }, { + "code": "532523", + "name": "屏边苗族自治县" + }, { + "code": "532524", + "name": "建水县" + }, { + "code": "532525", + "name": "石屏县" + }, { + "code": "532527", + "name": "泸西县" + }, { + "code": "532528", + "name": "元阳县" + }, { + "code": "532529", + "name": "红河县" + }, { + "code": "532530", + "name": "金平苗族瑶族傣族自治县" + }, { + "code": "532531", + "name": "绿春县" + }, { + "code": "532532", + "name": "河口瑶族自治县" + }] + }, { + "code": "5326", + "name": "文山壮族苗族自治州", + "childs": [{ + "code": "532601", + "name": "文山市" + }, { + "code": "532622", + "name": "砚山县" + }, { + "code": "532623", + "name": "西畴县" + }, { + "code": "532624", + "name": "麻栗坡县" + }, { + "code": "532625", + "name": "马关县" + }, { + "code": "532626", + "name": "丘北县" + }, { + "code": "532627", + "name": "广南县" + }, { + "code": "532628", + "name": "富宁县" + }] + }, { + "code": "5328", + "name": "西双版纳傣族自治州", + "childs": [{ + "code": "532801", + "name": "景洪市" + }, { + "code": "532822", + "name": "勐海县" + }, { + "code": "532823", + "name": "勐腊县" + }] + }, { + "code": "5329", + "name": "大理白族自治州", + "childs": [{ + "code": "532901", + "name": "大理市" + }, { + "code": "532922", + "name": "漾濞彝族自治县" + }, { + "code": "532923", + "name": "祥云县" + }, { + "code": "532924", + "name": "宾川县" + }, { + "code": "532925", + "name": "弥渡县" + }, { + "code": "532926", + "name": "南涧彝族自治县" + }, { + "code": "532927", + "name": "巍山彝族回族自治县" + }, { + "code": "532928", + "name": "永平县" + }, { + "code": "532929", + "name": "云龙县" + }, { + "code": "532930", + "name": "洱源县" + }, { + "code": "532931", + "name": "剑川县" + }, { + "code": "532932", + "name": "鹤庆县" + }] + }, { + "code": "5331", + "name": "德宏傣族景颇族自治州", + "childs": [{ + "code": "533102", + "name": "瑞丽市" + }, { + "code": "533103", + "name": "芒市" + }, { + "code": "533122", + "name": "梁河县" + }, { + "code": "533123", + "name": "盈江县" + }, { + "code": "533124", + "name": "陇川县" + }] + }, { + "code": "5333", + "name": "怒江傈僳族自治州", + "childs": [{ + "code": "533301", + "name": "泸水市" + }, { + "code": "533323", + "name": "福贡县" + }, { + "code": "533324", + "name": "贡山独龙族怒族自治县" + }, { + "code": "533325", + "name": "兰坪白族普米族自治县" + }] + }, { + "code": "5334", + "name": "迪庆藏族自治州", + "childs": [{ + "code": "533401", + "name": "香格里拉市" + }, { + "code": "533422", + "name": "德钦县" + }, { + "code": "533423", + "name": "维西傈僳族自治县" + }] + }] +}, { + "code": "54", + "name": "西藏自治区", + "childs": [{ + "code": "5401", + "name": "拉萨市", + "childs": [{ + "code": "540102", + "name": "城关区" + }, { + "code": "540103", + "name": "堆龙德庆区" + }, { + "code": "540121", + "name": "林周县" + }, { + "code": "540122", + "name": "当雄县" + }, { + "code": "540123", + "name": "尼木县" + }, { + "code": "540124", + "name": "曲水县" + }, { + "code": "540126", + "name": "达孜县" + }, { + "code": "540127", + "name": "墨竹工卡县" + }] + }, { + "code": "5402", + "name": "日喀则市", + "childs": [{ + "code": "540202", + "name": "桑珠孜区" + }, { + "code": "540221", + "name": "南木林县" + }, { + "code": "540222", + "name": "江孜县" + }, { + "code": "540223", + "name": "定日县" + }, { + "code": "540224", + "name": "萨迦县" + }, { + "code": "540225", + "name": "拉孜县" + }, { + "code": "540226", + "name": "昂仁县" + }, { + "code": "540227", + "name": "谢通门县" + }, { + "code": "540228", + "name": "白朗县" + }, { + "code": "540229", + "name": "仁布县" + }, { + "code": "540230", + "name": "康马县" + }, { + "code": "540231", + "name": "定结县" + }, { + "code": "540232", + "name": "仲巴县" + }, { + "code": "540233", + "name": "亚东县" + }, { + "code": "540234", + "name": "吉隆县" + }, { + "code": "540235", + "name": "聂拉木县" + }, { + "code": "540236", + "name": "萨嘎县" + }, { + "code": "540237", + "name": "岗巴县" + }] + }, { + "code": "5403", + "name": "昌都市", + "childs": [{ + "code": "540302", + "name": "卡若区" + }, { + "code": "540321", + "name": "江达县" + }, { + "code": "540322", + "name": "贡觉县" + }, { + "code": "540323", + "name": "类乌齐县" + }, { + "code": "540324", + "name": "丁青县" + }, { + "code": "540325", + "name": "察雅县" + }, { + "code": "540326", + "name": "八宿县" + }, { + "code": "540327", + "name": "左贡县" + }, { + "code": "540328", + "name": "芒康县" + }, { + "code": "540329", + "name": "洛隆县" + }, { + "code": "540330", + "name": "边坝县" + }] + }, { + "code": "5404", + "name": "林芝市", + "childs": [{ + "code": "540402", + "name": "巴宜区" + }, { + "code": "540421", + "name": "工布江达县" + }, { + "code": "540422", + "name": "米林县" + }, { + "code": "540423", + "name": "墨脱县" + }, { + "code": "540424", + "name": "波密县" + }, { + "code": "540425", + "name": "察隅县" + }, { + "code": "540426", + "name": "朗县" + }] + }, { + "code": "5405", + "name": "山南市", + "childs": [{ + "code": "540502", + "name": "乃东区" + }, { + "code": "540521", + "name": "扎囊县" + }, { + "code": "540522", + "name": "贡嘎县" + }, { + "code": "540523", + "name": "桑日县" + }, { + "code": "540524", + "name": "琼结县" + }, { + "code": "540525", + "name": "曲松县" + }, { + "code": "540526", + "name": "措美县" + }, { + "code": "540527", + "name": "洛扎县" + }, { + "code": "540528", + "name": "加查县" + }, { + "code": "540529", + "name": "隆子县" + }, { + "code": "540530", + "name": "错那县" + }, { + "code": "540531", + "name": "浪卡子县" + }] + }, { + "code": "5424", + "name": "那曲地区", + "childs": [{ + "code": "542421", + "name": "那曲县" + }, { + "code": "542422", + "name": "嘉黎县" + }, { + "code": "542423", + "name": "比如县" + }, { + "code": "542424", + "name": "聂荣县" + }, { + "code": "542425", + "name": "安多县" + }, { + "code": "542426", + "name": "申扎县" + }, { + "code": "542427", + "name": "索县" + }, { + "code": "542428", + "name": "班戈县" + }, { + "code": "542429", + "name": "巴青县" + }, { + "code": "542430", + "name": "尼玛县" + }, { + "code": "542431", + "name": "双湖县" + }] + }, { + "code": "5425", + "name": "阿里地区", + "childs": [{ + "code": "542521", + "name": "普兰县" + }, { + "code": "542522", + "name": "札达县" + }, { + "code": "542523", + "name": "噶尔县" + }, { + "code": "542524", + "name": "日土县" + }, { + "code": "542525", + "name": "革吉县" + }, { + "code": "542526", + "name": "改则县" + }, { + "code": "542527", + "name": "措勤县" + }] + }] +}, { + "code": "61", + "name": "陕西省", + "childs": [{ + "code": "6101", + "name": "西安市", + "childs": [{ + "code": "610102", + "name": "新城区" + }, { + "code": "610103", + "name": "碑林区" + }, { + "code": "610104", + "name": "莲湖区" + }, { + "code": "610111", + "name": "灞桥区" + }, { + "code": "610112", + "name": "未央区" + }, { + "code": "610113", + "name": "雁塔区" + }, { + "code": "610114", + "name": "阎良区" + }, { + "code": "610115", + "name": "临潼区" + }, { + "code": "610116", + "name": "长安区" + }, { + "code": "610117", + "name": "高陵区" + }, { + "code": "610122", + "name": "蓝田县" + }, { + "code": "610124", + "name": "周至县" + }, { + "code": "610125", + "name": "户县" + }] + }, { + "code": "6102", + "name": "铜川市", + "childs": [{ + "code": "610202", + "name": "王益区" + }, { + "code": "610203", + "name": "印台区" + }, { + "code": "610204", + "name": "耀州区" + }, { + "code": "610222", + "name": "宜君县" + }] + }, { + "code": "6103", + "name": "宝鸡市", + "childs": [{ + "code": "610302", + "name": "渭滨区" + }, { + "code": "610303", + "name": "金台区" + }, { + "code": "610304", + "name": "陈仓区" + }, { + "code": "610322", + "name": "凤翔县" + }, { + "code": "610323", + "name": "岐山县" + }, { + "code": "610324", + "name": "扶风县" + }, { + "code": "610326", + "name": "眉县" + }, { + "code": "610327", + "name": "陇县" + }, { + "code": "610328", + "name": "千阳县" + }, { + "code": "610329", + "name": "麟游县" + }, { + "code": "610330", + "name": "凤县" + }, { + "code": "610331", + "name": "太白县" + }] + }, { + "code": "6104", + "name": "咸阳市", + "childs": [{ + "code": "610402", + "name": "秦都区" + }, { + "code": "610403", + "name": "杨陵区" + }, { + "code": "610404", + "name": "渭城区" + }, { + "code": "610422", + "name": "三原县" + }, { + "code": "610423", + "name": "泾阳县" + }, { + "code": "610424", + "name": "乾县" + }, { + "code": "610425", + "name": "礼泉县" + }, { + "code": "610426", + "name": "永寿县" + }, { + "code": "610427", + "name": "彬县" + }, { + "code": "610428", + "name": "长武县" + }, { + "code": "610429", + "name": "旬邑县" + }, { + "code": "610430", + "name": "淳化县" + }, { + "code": "610431", + "name": "武功县" + }, { + "code": "610481", + "name": "兴平市" + }] + }, { + "code": "6105", + "name": "渭南市", + "childs": [{ + "code": "610502", + "name": "临渭区" + }, { + "code": "610503", + "name": "华州区" + }, { + "code": "610522", + "name": "潼关县" + }, { + "code": "610523", + "name": "大荔县" + }, { + "code": "610524", + "name": "合阳县" + }, { + "code": "610525", + "name": "澄城县" + }, { + "code": "610526", + "name": "蒲城县" + }, { + "code": "610527", + "name": "白水县" + }, { + "code": "610528", + "name": "富平县" + }, { + "code": "610581", + "name": "韩城市" + }, { + "code": "610582", + "name": "华阴市" + }] + }, { + "code": "6106", + "name": "延安市", + "childs": [{ + "code": "610602", + "name": "宝塔区" + }, { + "code": "610603", + "name": "安塞区" + }, { + "code": "610621", + "name": "延长县" + }, { + "code": "610622", + "name": "延川县" + }, { + "code": "610623", + "name": "子长县" + }, { + "code": "610625", + "name": "志丹县" + }, { + "code": "610626", + "name": "吴起县" + }, { + "code": "610627", + "name": "甘泉县" + }, { + "code": "610628", + "name": "富县" + }, { + "code": "610629", + "name": "洛川县" + }, { + "code": "610630", + "name": "宜川县" + }, { + "code": "610631", + "name": "黄龙县" + }, { + "code": "610632", + "name": "黄陵县" + }] + }, { + "code": "6107", + "name": "汉中市", + "childs": [{ + "code": "610702", + "name": "汉台区" + }, { + "code": "610721", + "name": "南郑县" + }, { + "code": "610722", + "name": "城固县" + }, { + "code": "610723", + "name": "洋县" + }, { + "code": "610724", + "name": "西乡县" + }, { + "code": "610725", + "name": "勉县" + }, { + "code": "610726", + "name": "宁强县" + }, { + "code": "610727", + "name": "略阳县" + }, { + "code": "610728", + "name": "镇巴县" + }, { + "code": "610729", + "name": "留坝县" + }, { + "code": "610730", + "name": "佛坪县" + }] + }, { + "code": "6108", + "name": "榆林市", + "childs": [{ + "code": "610802", + "name": "榆阳区" + }, { + "code": "610803", + "name": "横山区" + }, { + "code": "610821", + "name": "神木县" + }, { + "code": "610822", + "name": "府谷县" + }, { + "code": "610824", + "name": "靖边县" + }, { + "code": "610825", + "name": "定边县" + }, { + "code": "610826", + "name": "绥德县" + }, { + "code": "610827", + "name": "米脂县" + }, { + "code": "610828", + "name": "佳县" + }, { + "code": "610829", + "name": "吴堡县" + }, { + "code": "610830", + "name": "清涧县" + }, { + "code": "610831", + "name": "子洲县" + }] + }, { + "code": "6109", + "name": "安康市", + "childs": [{ + "code": "610902", + "name": "汉滨区" + }, { + "code": "610921", + "name": "汉阴县" + }, { + "code": "610922", + "name": "石泉县" + }, { + "code": "610923", + "name": "宁陕县" + }, { + "code": "610924", + "name": "紫阳县" + }, { + "code": "610925", + "name": "岚皋县" + }, { + "code": "610926", + "name": "平利县" + }, { + "code": "610927", + "name": "镇坪县" + }, { + "code": "610928", + "name": "旬阳县" + }, { + "code": "610929", + "name": "白河县" + }] + }, { + "code": "6110", + "name": "商洛市", + "childs": [{ + "code": "611002", + "name": "商州区" + }, { + "code": "611021", + "name": "洛南县" + }, { + "code": "611022", + "name": "丹凤县" + }, { + "code": "611023", + "name": "商南县" + }, { + "code": "611024", + "name": "山阳县" + }, { + "code": "611025", + "name": "镇安县" + }, { + "code": "611026", + "name": "柞水县" + }] + }] +}, { + "code": "62", + "name": "甘肃省", + "childs": [{ + "code": "6201", + "name": "兰州市", + "childs": [{ + "code": "620102", + "name": "城关区" + }, { + "code": "620103", + "name": "七里河区" + }, { + "code": "620104", + "name": "西固区" + }, { + "code": "620105", + "name": "安宁区" + }, { + "code": "620111", + "name": "红古区" + }, { + "code": "620121", + "name": "永登县" + }, { + "code": "620122", + "name": "皋兰县" + }, { + "code": "620123", + "name": "榆中县" + }] + }, { + "code": "620201", + "name": "嘉峪关市", + "childs": [{ + "code": "620201100", + "name": "新城镇" + }, { + "code": "620201101", + "name": "峪泉镇" + }, { + "code": "620201102", + "name": "文殊镇" + }, { + "code": "620201401", + "name": "雄关区" + }, { + "code": "620201402", + "name": "镜铁区" + }, { + "code": "620201403", + "name": "长城区" + }] + }, { + "code": "6203", + "name": "金昌市", + "childs": [{ + "code": "620302", + "name": "金川区" + }, { + "code": "620321", + "name": "永昌县" + }] + }, { + "code": "6204", + "name": "白银市", + "childs": [{ + "code": "620402", + "name": "白银区" + }, { + "code": "620403", + "name": "平川区" + }, { + "code": "620421", + "name": "靖远县" + }, { + "code": "620422", + "name": "会宁县" + }, { + "code": "620423", + "name": "景泰县" + }] + }, { + "code": "6205", + "name": "天水市", + "childs": [{ + "code": "620502", + "name": "秦州区" + }, { + "code": "620503", + "name": "麦积区" + }, { + "code": "620521", + "name": "清水县" + }, { + "code": "620522", + "name": "秦安县" + }, { + "code": "620523", + "name": "甘谷县" + }, { + "code": "620524", + "name": "武山县" + }, { + "code": "620525", + "name": "张家川回族自治县" + }] + }, { + "code": "6206", + "name": "武威市", + "childs": [{ + "code": "620602", + "name": "凉州区" + }, { + "code": "620621", + "name": "民勤县" + }, { + "code": "620622", + "name": "古浪县" + }, { + "code": "620623", + "name": "天祝藏族自治县" + }] + }, { + "code": "6207", + "name": "张掖市", + "childs": [{ + "code": "620702", + "name": "甘州区" + }, { + "code": "620721", + "name": "肃南裕固族自治县" + }, { + "code": "620722", + "name": "民乐县" + }, { + "code": "620723", + "name": "临泽县" + }, { + "code": "620724", + "name": "高台县" + }, { + "code": "620725", + "name": "山丹县" + }] + }, { + "code": "6208", + "name": "平凉市", + "childs": [{ + "code": "620802", + "name": "崆峒区" + }, { + "code": "620821", + "name": "泾川县" + }, { + "code": "620822", + "name": "灵台县" + }, { + "code": "620823", + "name": "崇信县" + }, { + "code": "620824", + "name": "华亭县" + }, { + "code": "620825", + "name": "庄浪县" + }, { + "code": "620826", + "name": "静宁县" + }] + }, { + "code": "6209", + "name": "酒泉市", + "childs": [{ + "code": "620902", + "name": "肃州区" + }, { + "code": "620921", + "name": "金塔县" + }, { + "code": "620922", + "name": "瓜州县" + }, { + "code": "620923", + "name": "肃北蒙古族自治县" + }, { + "code": "620924", + "name": "阿克塞哈萨克族自治县" + }, { + "code": "620981", + "name": "玉门市" + }, { + "code": "620982", + "name": "敦煌市" + }] + }, { + "code": "6210", + "name": "庆阳市", + "childs": [{ + "code": "621002", + "name": "西峰区" + }, { + "code": "621021", + "name": "庆城县" + }, { + "code": "621022", + "name": "环县" + }, { + "code": "621023", + "name": "华池县" + }, { + "code": "621024", + "name": "合水县" + }, { + "code": "621025", + "name": "正宁县" + }, { + "code": "621026", + "name": "宁县" + }, { + "code": "621027", + "name": "镇原县" + }] + }, { + "code": "6211", + "name": "定西市", + "childs": [{ + "code": "621102", + "name": "安定区" + }, { + "code": "621121", + "name": "通渭县" + }, { + "code": "621122", + "name": "陇西县" + }, { + "code": "621123", + "name": "渭源县" + }, { + "code": "621124", + "name": "临洮县" + }, { + "code": "621125", + "name": "漳县" + }, { + "code": "621126", + "name": "岷县" + }] + }, { + "code": "6212", + "name": "陇南市", + "childs": [{ + "code": "621202", + "name": "武都区" + }, { + "code": "621221", + "name": "成县" + }, { + "code": "621222", + "name": "文县" + }, { + "code": "621223", + "name": "宕昌县" + }, { + "code": "621224", + "name": "康县" + }, { + "code": "621225", + "name": "西和县" + }, { + "code": "621226", + "name": "礼县" + }, { + "code": "621227", + "name": "徽县" + }, { + "code": "621228", + "name": "两当县" + }] + }, { + "code": "6229", + "name": "临夏回族自治州", + "childs": [{ + "code": "622901", + "name": "临夏市" + }, { + "code": "622921", + "name": "临夏县" + }, { + "code": "622922", + "name": "康乐县" + }, { + "code": "622923", + "name": "永靖县" + }, { + "code": "622924", + "name": "广河县" + }, { + "code": "622925", + "name": "和政县" + }, { + "code": "622926", + "name": "东乡族自治县" + }, { + "code": "622927", + "name": "积石山保安族东乡族撒拉族自治县" + }] + }, { + "code": "6230", + "name": "甘南藏族自治州", + "childs": [{ + "code": "623001", + "name": "合作市" + }, { + "code": "623021", + "name": "临潭县" + }, { + "code": "623022", + "name": "卓尼县" + }, { + "code": "623023", + "name": "舟曲县" + }, { + "code": "623024", + "name": "迭部县" + }, { + "code": "623025", + "name": "玛曲县" + }, { + "code": "623026", + "name": "碌曲县" + }, { + "code": "623027", + "name": "夏河县" + }] + }] +}, { + "code": "63", + "name": "青海省", + "childs": [{ + "code": "6301", + "name": "西宁市", + "childs": [{ + "code": "630102", + "name": "城东区" + }, { + "code": "630103", + "name": "城中区" + }, { + "code": "630104", + "name": "城西区" + }, { + "code": "630105", + "name": "城北区" + }, { + "code": "630121", + "name": "大通回族土族自治县" + }, { + "code": "630122", + "name": "湟中县" + }, { + "code": "630123", + "name": "湟源县" + }] + }, { + "code": "6302", + "name": "海东市", + "childs": [{ + "code": "630202", + "name": "乐都区" + }, { + "code": "630203", + "name": "平安区" + }, { + "code": "630222", + "name": "民和回族土族自治县" + }, { + "code": "630223", + "name": "互助土族自治县" + }, { + "code": "630224", + "name": "化隆回族自治县" + }, { + "code": "630225", + "name": "循化撒拉族自治县" + }] + }, { + "code": "6322", + "name": "海北藏族自治州", + "childs": [{ + "code": "632221", + "name": "门源回族自治县" + }, { + "code": "632222", + "name": "祁连县" + }, { + "code": "632223", + "name": "海晏县" + }, { + "code": "632224", + "name": "刚察县" + }] + }, { + "code": "6323", + "name": "黄南藏族自治州", + "childs": [{ + "code": "632321", + "name": "同仁县" + }, { + "code": "632322", + "name": "尖扎县" + }, { + "code": "632323", + "name": "泽库县" + }, { + "code": "632324", + "name": "河南蒙古族自治县" + }] + }, { + "code": "6325", + "name": "海南藏族自治州", + "childs": [{ + "code": "632521", + "name": "共和县" + }, { + "code": "632522", + "name": "同德县" + }, { + "code": "632523", + "name": "贵德县" + }, { + "code": "632524", + "name": "兴海县" + }, { + "code": "632525", + "name": "贵南县" + }] + }, { + "code": "6326", + "name": "果洛藏族自治州", + "childs": [{ + "code": "632621", + "name": "玛沁县" + }, { + "code": "632622", + "name": "班玛县" + }, { + "code": "632623", + "name": "甘德县" + }, { + "code": "632624", + "name": "达日县" + }, { + "code": "632625", + "name": "久治县" + }, { + "code": "632626", + "name": "玛多县" + }] + }, { + "code": "6327", + "name": "玉树藏族自治州", + "childs": [{ + "code": "632701", + "name": "玉树市" + }, { + "code": "632722", + "name": "杂多县" + }, { + "code": "632723", + "name": "称多县" + }, { + "code": "632724", + "name": "治多县" + }, { + "code": "632725", + "name": "囊谦县" + }, { + "code": "632726", + "name": "曲麻莱县" + }] + }, { + "code": "6328", + "name": "海西蒙古族藏族自治州", + "childs": [{ + "code": "632801", + "name": "格尔木市" + }, { + "code": "632802", + "name": "德令哈市" + }, { + "code": "632821", + "name": "乌兰县" + }, { + "code": "632822", + "name": "都兰县" + }, { + "code": "632823", + "name": "天峻县" + }] + }] +}, { + "code": "64", + "name": "宁夏回族自治区", + "childs": [{ + "code": "6401", + "name": "银川市", + "childs": [{ + "code": "640104", + "name": "兴庆区" + }, { + "code": "640105", + "name": "西夏区" + }, { + "code": "640106", + "name": "金凤区" + }, { + "code": "640121", + "name": "永宁县" + }, { + "code": "640122", + "name": "贺兰县" + }, { + "code": "640181", + "name": "灵武市" + }] + }, { + "code": "6402", + "name": "石嘴山市", + "childs": [{ + "code": "640202", + "name": "大武口区" + }, { + "code": "640205", + "name": "惠农区" + }, { + "code": "640221", + "name": "平罗县" + }] + }, { + "code": "6403", + "name": "吴忠市", + "childs": [{ + "code": "640302", + "name": "利通区" + }, { + "code": "640303", + "name": "红寺堡区" + }, { + "code": "640323", + "name": "盐池县" + }, { + "code": "640324", + "name": "同心县" + }, { + "code": "640381", + "name": "青铜峡市" + }] + }, { + "code": "6404", + "name": "固原市", + "childs": [{ + "code": "640402", + "name": "原州区" + }, { + "code": "640422", + "name": "西吉县" + }, { + "code": "640423", + "name": "隆德县" + }, { + "code": "640424", + "name": "泾源县" + }, { + "code": "640425", + "name": "彭阳县" + }] + }, { + "code": "6405", + "name": "中卫市", + "childs": [{ + "code": "640502", + "name": "沙坡头区" + }, { + "code": "640521", + "name": "中宁县" + }, { + "code": "640522", + "name": "海原县" + }] + }] +}, { + "code": "65", + "name": "新疆维吾尔自治区", + "childs": [{ + "code": "6501", + "name": "乌鲁木齐市", + "childs": [{ + "code": "650102", + "name": "天山区" + }, { + "code": "650103", + "name": "沙依巴克区" + }, { + "code": "650104", + "name": "新市区" + }, { + "code": "650105", + "name": "水磨沟区" + }, { + "code": "650106", + "name": "头屯河区" + }, { + "code": "650107", + "name": "达坂城区" + }, { + "code": "650109", + "name": "米东区" + }, { + "code": "650121", + "name": "乌鲁木齐县" + }] + }, { + "code": "6502", + "name": "克拉玛依市", + "childs": [{ + "code": "650202", + "name": "独山子区" + }, { + "code": "650203", + "name": "克拉玛依区" + }, { + "code": "650204", + "name": "白碱滩区" + }, { + "code": "650205", + "name": "乌尔禾区" + }] + }, { + "code": "6504", + "name": "吐鲁番市", + "childs": [{ + "code": "650402", + "name": "高昌区" + }, { + "code": "650421", + "name": "鄯善县" + }, { + "code": "650422", + "name": "托克逊县" + }] + }, { + "code": "6505", + "name": "哈密市", + "childs": [{ + "code": "650502", + "name": "伊州区" + }, { + "code": "650521", + "name": "巴里坤哈萨克自治县" + }, { + "code": "650522", + "name": "伊吾县" + }] + }, { + "code": "6523", + "name": "昌吉回族自治州", + "childs": [{ + "code": "652301", + "name": "昌吉市" + }, { + "code": "652302", + "name": "阜康市" + }, { + "code": "652323", + "name": "呼图壁县" + }, { + "code": "652324", + "name": "玛纳斯县" + }, { + "code": "652325", + "name": "奇台县" + }, { + "code": "652327", + "name": "吉木萨尔县" + }, { + "code": "652328", + "name": "木垒哈萨克自治县" + }] + }, { + "code": "6527", + "name": "博尔塔拉蒙古自治州", + "childs": [{ + "code": "652701", + "name": "博乐市" + }, { + "code": "652702", + "name": "阿拉山口市" + }, { + "code": "652722", + "name": "精河县" + }, { + "code": "652723", + "name": "温泉县" + }] + }, { + "code": "6528", + "name": "巴音郭楞蒙古自治州", + "childs": [{ + "code": "652801", + "name": "库尔勒市" + }, { + "code": "652822", + "name": "轮台县" + }, { + "code": "652823", + "name": "尉犁县" + }, { + "code": "652824", + "name": "若羌县" + }, { + "code": "652825", + "name": "且末县" + }, { + "code": "652826", + "name": "焉耆回族自治县" + }, { + "code": "652827", + "name": "和静县" + }, { + "code": "652828", + "name": "和硕县" + }, { + "code": "652829", + "name": "博湖县" + }] + }, { + "code": "6529", + "name": "阿克苏地区", + "childs": [{ + "code": "652901", + "name": "阿克苏市" + }, { + "code": "652922", + "name": "温宿县" + }, { + "code": "652923", + "name": "库车县" + }, { + "code": "652924", + "name": "沙雅县" + }, { + "code": "652925", + "name": "新和县" + }, { + "code": "652926", + "name": "拜城县" + }, { + "code": "652927", + "name": "乌什县" + }, { + "code": "652928", + "name": "阿瓦提县" + }, { + "code": "652929", + "name": "柯坪县" + }] + }, { + "code": "6530", + "name": "克孜勒苏柯尔克孜自治州", + "childs": [{ + "code": "653001", + "name": "阿图什市" + }, { + "code": "653022", + "name": "阿克陶县" + }, { + "code": "653023", + "name": "阿合奇县" + }, { + "code": "653024", + "name": "乌恰县" + }] + }, { + "code": "6531", + "name": "喀什地区", + "childs": [{ + "code": "653101", + "name": "喀什市" + }, { + "code": "653121", + "name": "疏附县" + }, { + "code": "653122", + "name": "疏勒县" + }, { + "code": "653123", + "name": "英吉沙县" + }, { + "code": "653124", + "name": "泽普县" + }, { + "code": "653125", + "name": "莎车县" + }, { + "code": "653126", + "name": "叶城县" + }, { + "code": "653127", + "name": "麦盖提县" + }, { + "code": "653128", + "name": "岳普湖县" + }, { + "code": "653129", + "name": "伽师县" + }, { + "code": "653130", + "name": "巴楚县" + }, { + "code": "653131", + "name": "塔什库尔干塔吉克自治县" + }] + }, { + "code": "6532", + "name": "和田地区", + "childs": [{ + "code": "653201", + "name": "和田市" + }, { + "code": "653221", + "name": "和田县" + }, { + "code": "653222", + "name": "墨玉县" + }, { + "code": "653223", + "name": "皮山县" + }, { + "code": "653224", + "name": "洛浦县" + }, { + "code": "653225", + "name": "策勒县" + }, { + "code": "653226", + "name": "于田县" + }, { + "code": "653227", + "name": "民丰县" + }] + }, { + "code": "6540", + "name": "伊犁哈萨克自治州", + "childs": [{ + "code": "654002", + "name": "伊宁市" + }, { + "code": "654003", + "name": "奎屯市" + }, { + "code": "654004", + "name": "霍尔果斯市" + }, { + "code": "654021", + "name": "伊宁县" + }, { + "code": "654022", + "name": "察布查尔锡伯自治县" + }, { + "code": "654023", + "name": "霍城县" + }, { + "code": "654024", + "name": "巩留县" + }, { + "code": "654025", + "name": "新源县" + }, { + "code": "654026", + "name": "昭苏县" + }, { + "code": "654027", + "name": "特克斯县" + }, { + "code": "654028", + "name": "尼勒克县" + }] + }, { + "code": "6542", + "name": "塔城地区", + "childs": [{ + "code": "654201", + "name": "塔城市" + }, { + "code": "654202", + "name": "乌苏市" + }, { + "code": "654221", + "name": "额敏县" + }, { + "code": "654223", + "name": "沙湾县" + }, { + "code": "654224", + "name": "托里县" + }, { + "code": "654225", + "name": "裕民县" + }, { + "code": "654226", + "name": "和布克赛尔蒙古自治县" + }] + }, { + "code": "6543", + "name": "阿勒泰地区", + "childs": [{ + "code": "654301", + "name": "阿勒泰市" + }, { + "code": "654321", + "name": "布尔津县" + }, { + "code": "654322", + "name": "富蕴县" + }, { + "code": "654323", + "name": "福海县" + }, { + "code": "654324", + "name": "哈巴河县" + }, { + "code": "654325", + "name": "青河县" + }, { + "code": "654326", + "name": "吉木乃县" + }] + }, { + "code": "6590", + "name": "自治区直辖县级行政区划", + "childs": [{ + "code": "659001", + "name": "石河子市" + }, { + "code": "659002", + "name": "阿拉尔市" + }, { + "code": "659003", + "name": "图木舒克市" + }, { + "code": "659004", + "name": "五家渠市" + }, { + "code": "659006", + "name": "铁门关市" + }] + }] +}, { + "code": "71", + "name": "台湾省", + "childs": [] +}, { + "code": "81", + "name": "香港特别行政区", + "childs": [] +}, { + "code": "82", + "name": "澳门特别行政区", + "childs": [] +}] diff --git a/components/zqs-select/right_icon.png b/components/zqs-select/right_icon.png new file mode 100644 index 0000000..7a5f4eb Binary files /dev/null and b/components/zqs-select/right_icon.png differ diff --git a/components/zqs-select/zqs-select.vue b/components/zqs-select/zqs-select.vue new file mode 100644 index 0000000..4c0a49f --- /dev/null +++ b/components/zqs-select/zqs-select.vue @@ -0,0 +1,505 @@ + + + + + \ No newline at end of file diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js new file mode 100644 index 0000000..9a55df6 --- /dev/null +++ b/custom-tab-bar/index.js @@ -0,0 +1,64 @@ +Component({ + data: { + selected: 0, + "color": "#FFEEE1", + "selectedColor": "#FFFFFF", + "backgroundColor": "#F69448", + list: [ + // { + // "pagePath": "/pages/home/cloudCard", + // "text": "补充菜窖", + // "iconPath": "/static/bomicon/bom_notCloudCard.png", + // "selectedIconPath": "/static/bomicon/bom_cloudCard.png" + // }, + { + "pagePath": "/pages/home/cloudCard2", + "text": "产品分类", + "iconPath": "/static/bomicon/bom_notCloudCard.png", + "selectedIconPath": "/static/bomicon/bom_cloudCard.png" + }, + // { + // "pagePath": "/pages/home/pickUpCard", + // "text": "选菜窖", + // "iconPath": "/static/bomicon/bom_notPickUp.png", + // "selectedIconPath": "/static/bomicon/bom_pickUp.png" + // }, + { + "pagePath": "/pages/home/myCellar", + "text": "我的订单", + "iconPath": "/static/bomicon/bom_notPickUp.png", + "selectedIconPath": "/static/bomicon/bom_pickUp.png" + }, + + // { + // "pagePath": "/pages/home/recordList2", + // "text": "预约记录", + // "iconPath": "/static/bomicon/bom_notRecordNew.png", + // "selectedIconPath": "/static/bomicon/bom_recordNew.png" + // } + // , + + { + "pagePath": "/pages/home/myHome", + "text": "记录查询", + "iconPath": "/static/bomicon/bom_NotMy.png", + "selectedIconPath": "/static/bomicon/bom_my.png" + } + + ] + }, + attached() {}, + methods: { + switchTab(e) { + const data = e.currentTarget.dataset + const url = data.path + // console.log("ssss0",data); + wx.switchTab({ + url + }) + // this.setData({ + // selected: data.index + // }) + } + } +}) \ No newline at end of file diff --git a/custom-tab-bar/index.json b/custom-tab-bar/index.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/custom-tab-bar/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml new file mode 100644 index 0000000..87d7205 --- /dev/null +++ b/custom-tab-bar/index.wxml @@ -0,0 +1,7 @@ + + + + + {{item.text}} + + \ No newline at end of file diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss new file mode 100644 index 0000000..7cb7fac --- /dev/null +++ b/custom-tab-bar/index.wxss @@ -0,0 +1,46 @@ +.tab-bar { + pointer-events: auto; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 50px; + /* background: #F69448; */ + display: flex; + padding-top: 5px; + padding-bottom: 5px; + /* 加载背景图 */ + background-image: url(https://supervise.yxtsoft.com/lpk/image/bom_navigation.png); + /* 让背景图基于容器大小伸缩 */ + background-size: 100% 100%; + /* padding-bottom: env(safe-area-inset-bottom); */ +} + +.tab-bar-border { + background-color: rgba(246, 148, 72, 0.3); + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 1px; + transform: scaleY(0.5); +} + +.tab-bar-item { + flex: 1; + text-align: center; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.tab-bar-item cover-image { + width: 27px; + height: 27px; +} + +.tab-bar-item cover-view { + margin-top: 3px; + font-size: 10px; +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..c3ff205 --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ + + + + + + + + + + +
+ + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..f3b41e8 --- /dev/null +++ b/main.js @@ -0,0 +1,65 @@ +import App from './App' +import Vue from 'vue' + +// vuex +import store from './store' + +import api from '@/common/request.api.js' +Vue.prototype.$api = api + +Vue.config.productionTip = false +App.mpType = 'app' + +import { + stringIsEmpty, + stringIsNotEmpty +} from "@/common/empty.js" +Vue.prototype.stringIsEmpty = stringIsEmpty +Vue.prototype.stringIsNotEmpty = stringIsNotEmpty + +import { + getQueryString, +} from "@/common/getQuery.js" +Vue.prototype.getQueryString = getQueryString + +import { + shortToast, + longToast +} from "@/common/toast.js" +Vue.prototype.shortToast = shortToast +Vue.prototype.longToast = longToast + +import { + timeText, + timeFormat, + currentMillions, + getWeekStr, + getTodayEndTime +} from "./common/Time.js" +Vue.prototype.TimeText = timeText +Vue.prototype.TimeFormat = timeFormat +Vue.prototype.GetWeekStr = getWeekStr +Vue.prototype.CurrentMillions = currentMillions +Vue.prototype.GetTodayEndTime = getTodayEndTime + + +import bus from './common/bus.js'; + +//挂载到this上 +Vue.prototype.$bus = bus; + + +import {pay} from './uni_modules/common-pay/utils/pay.js' +//挂载到this上 +Vue.prototype.$pay = pay; + + +import {convertPrice} from './common/price.js' +//挂载到this上 +Vue.prototype.convertPrice = convertPrice; + +const app = new Vue({ + store, + ...App +}) +app.$mount() \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..c5bd04f --- /dev/null +++ b/manifest.json @@ -0,0 +1,75 @@ +{ + "name" : "yxt-yyth", + "appid" : "__UNI__1500881", + "description" : "", + "versionName" : "1.0.1", + "versionCode" : 101, + "transformPx" : false, + /* 5+App特有相关 */ + "app-plus" : { + "usingComponents" : true, + "nvueStyleCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + /* 模块配置 */ + "modules" : {}, + /* 应用发布信息 */ + "distribute" : { + /* android打包配置 */ + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios" : {}, + /* SDK配置 */ + "sdkConfigs" : {} + } + }, + /* 快应用特有相关 */ + "quickapp" : {}, + /* 小程序特有相关 */ + "mp-weixin" : { + "appid" : "wx4724e3a3c27f36b5", + "setting" : { + "urlCheck" : false, + "postcss" : true, + "minified" : true + }, + "usingComponents" : true, + "lazyCodeLoading" : "requiredComponents" + }, + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false + }, + "vueVersion" : "2" +} diff --git a/pages.json b/pages.json new file mode 100644 index 0000000..a1c3289 --- /dev/null +++ b/pages.json @@ -0,0 +1,488 @@ +{ + "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/home/cloudCard", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/home/cloudCard2", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/card/card_detail", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/card/card_detail2", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/home/personCard", + "style": { + "navigationStyle": "custom" + + + } + }, + { + "path": "pages/home/giftCard", + "style": { + "navigationStyle": "custom" + + + } + }, + { + "path": "pages/home/pickUpCard", + "style": { + "navigationStyle": "custom" + + + } + }, + + + + + { + "path": "pages/bind/bind_pickUpCard", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/bind/bind_pickUpCard2", + "style": { + "navigationStyle": "custom" + } + }, + + { + "path": "pages/bind/bind_personCard", + "style": { + "navigationStyle": "custom" + } + }, + + // 扫码进入 + { + "path": "pages/bind/bind_personCard2", + "style": { + "navigationStyle": "custom" + } + }, + + + { + "path": "pages/bind/bind_giftCard", + "style": { + "navigationStyle": "custom" + } + }, + + // 扫码进入 + { + "path": "pages/bind/bind_giftCard2", + "style": { + "navigationStyle": "custom" + } + }, + + { + "path": "pages/bind/bind_enterpriseCard", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/bind/bind_enterpriseCard2", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/index/BindPhone", + "style": { + "navigationBarTitleText": "绑定账号", + "navigationStyle": "custom", + "app-plus": { + "scrollIndicator": false //禁用原生导航栏, + } + } + }, + + + { + "path": "pages/home/recordList", + "style": { + "navigationBarTitleText": "预约记录" + } + }, + { + "path": "pages/home/recordList2", + "style": { + "navigationBarTitleText": "预约记录" + } + }, + { + "path": "pages/good/goodsDetail", + "style": { + "navigationBarTitleText": "产品详情", + "enablePullDownRefresh": false + + } + }, + { + "path": "pages/good/goodsDetail2", + "style": { + "navigationBarTitleText": "产品详情", + "enablePullDownRefresh": false + + } + }, + { + "path": "pages/SelectAddressActivity", + "style": { + "navigationBarTitleText": "提货点列表", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/home/corporateCard", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/enterprise/corporate_card_detail", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/enterprise/corporate_card_detail2", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/enterprise/welfare_card_detail", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/enterprise/welfare_card_detail2", + "style": { + "navigationStyle": "custom" + } + }, + + + { + "path": "pages/detail/detail_affeection", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/detail/detail_affeection2", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/detail/detail_family", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/detail/detail_family2", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/detail/detail_enterprise", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/detail/detail_enterprise2", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/cloud/detail_cloudCard", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/cloud/optionalCard", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "uni_modules/common-pay/pages/pay/pay", + "style": { + "navigationBarTitleText": "支付订单", + "backgroundColor": "#F8F8F8" + } + }, + + { + "path": "uni_modules/common-pay/pages/success/success", + "style": { + "navigationBarTitleText": "支付完成", + "backgroundColor": "#F8F8F8" + } + }, + + { + "path": "pages/home/myHome", + "style": { + "navigationStyle": "custom", + "disableScroll": true + } + }, + { + "path": "pages/good/shoppCart", + "style": { + "navigationBarTitleText": "购菜车", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/home/myCellar", + "style": { + "navigationStyle": "custom" + } + }, { + "path": "pages/me/base_info", + "style": { + "navigationStyle": "custom", + "disableScroll": true + } + }, { + "path": "pages/me/RealInfo", + "style": { + "navigationStyle": "custom", + "disableScroll": true + } + }, + { + "path": "pages/good/reservation", + "style": { + "navigationStyle": "custom", + "disableScroll": true + } + }, + { + "path": "pages/good/changePersonnel", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/records/reservationRecords", + "style": { + "navigationBarTitleText": "预约记录", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/records/transferRecords", + "style": { + "navigationBarTitleText": "转赠记录", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/records/transferRecords2", + "style": { + "navigationBarTitleText": "转赠记录", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/records/reservationRecords2", + "style": { + "navigationBarTitleText": "预约记录", + "enablePullDownRefresh": false + } + }, + { + + "path": "pages/records/reservationRecords3", + "style": { + "navigationBarTitleText": "预约记录", + "enablePullDownRefresh": false + } + }, + { + + "path": "pages/records/reservationRecords4", + "style": { + "navigationBarTitleText": "预约记录", + "enablePullDownRefresh": false + } + }, + + { + "path": "pages/bind/bind_cloudCard", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/records/orderRecords", + "style": { + "navigationBarTitleText": "我的订单", + "disableScroll": true + } + }, + { + "path": "pages/records/orderDetail", + "style": { + "navigationBarTitleText": "订单详情" + } + }, + { + "path": "pages/good/transfer", + "style": { + "navigationBarTitleText": "转赠亲友", + "disableScroll": true + } + }, + { + "path": "pages/home/newUserPlay", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/records/recommendRecords", + "style": { + "navigationStyle": "custom", + "disableScroll": true + } + }, + { + "path": "pages/me/authentication", + "style": { + "navigationStyle": "custom", + "disableScroll": true + } + }, { + "path": "pages/me/makeInvoice", + "style": { + "navigationBarTitleText": "开具发票", + "disableScroll": true + } + }, + { + "path": "pages/me/addInvoice", + "style": { + "navigationBarTitleText": "新增发票", + "disableScroll": true + } + }, + { + "path": "pages/me/applyRefund", + "style": { + "navigationBarTitleText": "申请退款", + "disableScroll": true + } + }, + { + "path": "pages/me/refundDetail", + "style": { + "navigationBarTitleText": "退款详情", + "disableScroll": true + } + }, + { + "path": "pages/records/invalidGoods", + "style": { + "navigationBarTitleText": "失效商品", + "enablePullDownRefresh": false + } + } + + + ], + "globalStyle": { + "navigationBarTextStyle": "white", + "navigationBarTitleText": "惠享云菜窖", + "navigationBarBackgroundColor": "#FE9039", + "backgroundColor": "#FE9039" + }, + "tabBar": { + "custom": true, //自定义tabBar + "color": "#FFEEE1", + "selectedColor": "#191919", + "borderStyle": "white", + "backgroundColor": "#F69448", + "list": [ + // { + // "pagePath": "pages/home/cloudCard", + // "text": "补充菜窖", + // "iconPath": "static/bomicon/bom_notCloudCard.png", + // "selectedIconPath": "static/bomicon/bom_cloudCard.png" + // }, + { + "pagePath": "pages/home/cloudCard2", + "text": "补充菜窖", + "iconPath": "static/bomicon/bom_notCloudCard.png", + "selectedIconPath": "static/bomicon/bom_cloudCard.png" + }, + // { + // "pagePath": "pages/home/pickUpCard", + // "text": "选菜窖", + // "iconPath": "static/bomicon/bom_notPickUp.png", + // "selectedIconPath": "static/bomicon/bom_pickUp.png" + // }, + { + "pagePath": "pages/home/myCellar", + "text": "我的菜窖", + "iconPath": "static/bomicon/bom_notPickUp.png", + "selectedIconPath": "static/bomicon/bom_pickUp.png" + }, + // { + // "pagePath": "pages/home/recordList2", + // "text": "预约记录", + // "iconPath": "static/bomicon/bom_notRecordNew.png", + // "selectedIconPath": "static/bomicon/bom_recordNew.png" + // } + { + "pagePath": "pages/home/myHome", + "text": "我的", + "iconPath": "static/bomicon/bom_NotMy.png", + "selectedIconPath": "static/bomicon/bom_my.png" + } + + ] + }, + "uniIdRouter": {} +} \ No newline at end of file diff --git a/pages/SelectAddressActivity.vue b/pages/SelectAddressActivity.vue new file mode 100644 index 0000000..aed6dd5 --- /dev/null +++ b/pages/SelectAddressActivity.vue @@ -0,0 +1,244 @@ + + + + + + \ No newline at end of file diff --git a/pages/bind/bind_cloudCard.vue b/pages/bind/bind_cloudCard.vue new file mode 100644 index 0000000..288d14b --- /dev/null +++ b/pages/bind/bind_cloudCard.vue @@ -0,0 +1,280 @@ + + + + + \ No newline at end of file diff --git a/pages/bind/bind_enterpriseCard.vue b/pages/bind/bind_enterpriseCard.vue new file mode 100644 index 0000000..b400e2e --- /dev/null +++ b/pages/bind/bind_enterpriseCard.vue @@ -0,0 +1,142 @@ + + + + + \ No newline at end of file diff --git a/pages/bind/bind_enterpriseCard2.vue b/pages/bind/bind_enterpriseCard2.vue new file mode 100644 index 0000000..86071e1 --- /dev/null +++ b/pages/bind/bind_enterpriseCard2.vue @@ -0,0 +1,205 @@ + + + + + \ No newline at end of file diff --git a/pages/bind/bind_giftCard.vue b/pages/bind/bind_giftCard.vue new file mode 100644 index 0000000..ebde0c4 --- /dev/null +++ b/pages/bind/bind_giftCard.vue @@ -0,0 +1,157 @@ + + + + + \ No newline at end of file diff --git a/pages/bind/bind_giftCard2.vue b/pages/bind/bind_giftCard2.vue new file mode 100644 index 0000000..39c6345 --- /dev/null +++ b/pages/bind/bind_giftCard2.vue @@ -0,0 +1,202 @@ + + + + + \ No newline at end of file diff --git a/pages/bind/bind_personCard.vue b/pages/bind/bind_personCard.vue new file mode 100644 index 0000000..b83c26b --- /dev/null +++ b/pages/bind/bind_personCard.vue @@ -0,0 +1,160 @@ + + + + + \ No newline at end of file diff --git a/pages/bind/bind_personCard2.vue b/pages/bind/bind_personCard2.vue new file mode 100644 index 0000000..3a17208 --- /dev/null +++ b/pages/bind/bind_personCard2.vue @@ -0,0 +1,202 @@ + + + + + \ No newline at end of file diff --git a/pages/bind/bind_pickUpCard.vue b/pages/bind/bind_pickUpCard.vue new file mode 100644 index 0000000..c578d25 --- /dev/null +++ b/pages/bind/bind_pickUpCard.vue @@ -0,0 +1,160 @@ + + + + + \ No newline at end of file diff --git a/pages/bind/bind_pickUpCard2.vue b/pages/bind/bind_pickUpCard2.vue new file mode 100644 index 0000000..574a230 --- /dev/null +++ b/pages/bind/bind_pickUpCard2.vue @@ -0,0 +1,208 @@ + + + + + \ No newline at end of file diff --git a/pages/card/card-2023-12-13.vue b/pages/card/card-2023-12-13.vue new file mode 100644 index 0000000..a425f7a --- /dev/null +++ b/pages/card/card-2023-12-13.vue @@ -0,0 +1,241 @@ + + + + + \ No newline at end of file diff --git a/pages/card/card_detail.vue b/pages/card/card_detail.vue new file mode 100644 index 0000000..df820ed --- /dev/null +++ b/pages/card/card_detail.vue @@ -0,0 +1,673 @@ + + + + + diff --git a/uni_modules/uni-easyinput/package.json b/uni_modules/uni-easyinput/package.json new file mode 100644 index 0000000..bd128e1 --- /dev/null +++ b/uni_modules/uni-easyinput/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-easyinput", + "displayName": "uni-easyinput 增强输入框", + "version": "1.1.9", + "description": "Easyinput 组件是对原生input组件的增强", + "keywords": [ + "uni-ui", + "uniui", + "input", + "uni-easyinput", + "输入框" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-easyinput/readme.md b/uni_modules/uni-easyinput/readme.md new file mode 100644 index 0000000..f1faf8f --- /dev/null +++ b/uni_modules/uni-easyinput/readme.md @@ -0,0 +1,11 @@ + + +### Easyinput 增强输入框 +> **组件名:uni-easyinput** +> 代码块: `uEasyinput` + + +easyinput 组件是对原生input组件的增强 ,是专门为配合表单组件[uni-forms](https://ext.dcloud.net.cn/plugin?id=2773)而设计的,easyinput 内置了边框,图标等,同时包含 input 所有功能 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-easyinput) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-fab/changelog.md b/uni_modules/uni-fab/changelog.md new file mode 100644 index 0000000..9bd4729 --- /dev/null +++ b/uni_modules/uni-fab/changelog.md @@ -0,0 +1,23 @@ +## 1.2.5(2023-03-29) +- 新增 pattern.icon 属性,可自定义图标 +## 1.2.4(2022-09-07) +小程序端由于 style 使用了对象导致报错,[详情](https://ask.dcloud.net.cn/question/152790?item_id=211778&rf=false) +## 1.2.3(2022-09-05) +- 修复 nvue 环境下,具有 tabBar 时,fab 组件下部位置无法正常获取 --window-bottom 的bug,详见:[https://ask.dcloud.net.cn/question/110638?notification_id=826310](https://ask.dcloud.net.cn/question/110638?notification_id=826310) +## 1.2.2(2021-12-29) +- 更新 组件依赖 +## 1.2.1(2021-11-19) +- 修复 阴影颜色不正确的bug +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-fab](https://uniapp.dcloud.io/component/uniui/uni-fab) +## 1.1.1(2021-11-09) +- 新增 提供组件设计资源,组件样式调整 +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.7(2021-05-12) +- 新增 组件示例地址 +## 1.0.6(2021-02-05) +- 调整为uni_modules目录规范 +- 优化 按钮背景色调整 +- 优化 兼容pc端 diff --git a/uni_modules/uni-fab/components/uni-fab/uni-fab.vue b/uni_modules/uni-fab/components/uni-fab/uni-fab.vue new file mode 100644 index 0000000..dfa65c1 --- /dev/null +++ b/uni_modules/uni-fab/components/uni-fab/uni-fab.vue @@ -0,0 +1,491 @@ + + + + + diff --git a/uni_modules/uni-fab/package.json b/uni_modules/uni-fab/package.json new file mode 100644 index 0000000..18c0810 --- /dev/null +++ b/uni_modules/uni-fab/package.json @@ -0,0 +1,84 @@ +{ + "id": "uni-fab", + "displayName": "uni-fab 悬浮按钮", + "version": "1.2.5", + "description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。", + "keywords": [ + "uni-ui", + "uniui", + "按钮", + "悬浮按钮", + "fab" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss","uni-icons"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-fab/readme.md b/uni_modules/uni-fab/readme.md new file mode 100644 index 0000000..9a444e8 --- /dev/null +++ b/uni_modules/uni-fab/readme.md @@ -0,0 +1,9 @@ +## Fab 悬浮按钮 +> **组件名:uni-fab** +> 代码块: `uFab` + + +点击可展开一个图形按钮菜单 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-fab) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-fav/changelog.md b/uni_modules/uni-fav/changelog.md new file mode 100644 index 0000000..d8a08d4 --- /dev/null +++ b/uni_modules/uni-fav/changelog.md @@ -0,0 +1,19 @@ +## 1.2.1(2022-05-30) +- 新增 stat 属性 ,是否开启uni统计功能 +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-fav](https://uniapp.dcloud.io/component/uniui/uni-fav) +## 1.1.1(2021-08-24) +- 新增 支持国际化 +## 1.1.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.6(2021-05-12) +- 新增 组件示例地址 +## 1.0.5(2021-04-21) +- 优化 添加依赖 uni-icons, 导入后自动下载依赖 +## 1.0.4(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 +## 1.0.3(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 +## 1.0.2(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-fav/components/uni-fav/i18n/en.json b/uni_modules/uni-fav/components/uni-fav/i18n/en.json new file mode 100644 index 0000000..9a0759e --- /dev/null +++ b/uni_modules/uni-fav/components/uni-fav/i18n/en.json @@ -0,0 +1,4 @@ +{ + "uni-fav.collect": "collect", + "uni-fav.collected": "collected" +} diff --git a/uni_modules/uni-fav/components/uni-fav/i18n/index.js b/uni_modules/uni-fav/components/uni-fav/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-fav/components/uni-fav/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-fav/components/uni-fav/i18n/zh-Hans.json b/uni_modules/uni-fav/components/uni-fav/i18n/zh-Hans.json new file mode 100644 index 0000000..67c89bf --- /dev/null +++ b/uni_modules/uni-fav/components/uni-fav/i18n/zh-Hans.json @@ -0,0 +1,4 @@ +{ + "uni-fav.collect": "收藏", + "uni-fav.collected": "已收藏" +} diff --git a/uni_modules/uni-fav/components/uni-fav/i18n/zh-Hant.json b/uni_modules/uni-fav/components/uni-fav/i18n/zh-Hant.json new file mode 100644 index 0000000..67c89bf --- /dev/null +++ b/uni_modules/uni-fav/components/uni-fav/i18n/zh-Hant.json @@ -0,0 +1,4 @@ +{ + "uni-fav.collect": "收藏", + "uni-fav.collected": "已收藏" +} diff --git a/uni_modules/uni-fav/components/uni-fav/uni-fav.vue b/uni_modules/uni-fav/components/uni-fav/uni-fav.vue new file mode 100644 index 0000000..d2c58df --- /dev/null +++ b/uni_modules/uni-fav/components/uni-fav/uni-fav.vue @@ -0,0 +1,161 @@ + + + + + diff --git a/uni_modules/uni-fav/package.json b/uni_modules/uni-fav/package.json new file mode 100644 index 0000000..cc14697 --- /dev/null +++ b/uni_modules/uni-fav/package.json @@ -0,0 +1,89 @@ +{ + "id": "uni-fav", + "displayName": "uni-fav 收藏按钮", + "version": "1.2.1", + "description": " Fav 收藏组件,可自定义颜色、大小。", + "keywords": [ + "fav", + "uni-ui", + "uniui", + "收藏" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-fav/readme.md b/uni_modules/uni-fav/readme.md new file mode 100644 index 0000000..4de125d --- /dev/null +++ b/uni_modules/uni-fav/readme.md @@ -0,0 +1,10 @@ + + +## Fav 收藏按钮 +> **组件名:uni-fav** +> 代码块: `uFav` + +用于收藏功能,可点击切换选中、不选中的状态。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-fav) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-file-picker/changelog.md b/uni_modules/uni-file-picker/changelog.md new file mode 100644 index 0000000..b8230e9 --- /dev/null +++ b/uni_modules/uni-file-picker/changelog.md @@ -0,0 +1,67 @@ +## 1.0.4(2023-03-29) +- 修复 手动上传删除一个文件后不能再上传的bug +## 1.0.3(2022-12-19) +- 新增 sourceType 属性, 可以自定义图片和视频选择的来源 +## 1.0.2(2022-07-04) +- 修复 在uni-forms下样式不生效的bug +## 1.0.1(2021-11-23) +- 修复 参数为对象的情况下,url在某些情况显示错误的bug +## 1.0.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-file-picker](https://uniapp.dcloud.io/component/uniui/uni-file-picker) +## 0.2.16(2021-11-08) +- 修复 传入空对象 ,显示错误的Bug +## 0.2.15(2021-08-30) +- 修复 return-type="object" 时且存在v-model时,无法删除文件的Bug +## 0.2.14(2021-08-23) +- 新增 参数中返回 fileID 字段 +## 0.2.13(2021-08-23) +- 修复 腾讯云传入fileID 不能回显的bug +- 修复 选择图片后,不能放大的问题 +## 0.2.12(2021-08-17) +- 修复 由于 0.2.11 版本引起的不能回显图片的Bug +## 0.2.11(2021-08-16) +- 新增 clearFiles(index) 方法,可以手动删除指定文件 +- 修复 v-model 值设为 null 报错的Bug +## 0.2.10(2021-08-13) +- 修复 return-type="object" 时,无法删除文件的Bug +## 0.2.9(2021-08-03) +- 修复 auto-upload 属性失效的Bug +## 0.2.8(2021-07-31) +- 修复 fileExtname属性不指定值报错的Bug +## 0.2.7(2021-07-31) +- 修复 在某种场景下图片不回显的Bug +## 0.2.6(2021-07-30) +- 修复 return-type为object下,返回值不正确的Bug +## 0.2.5(2021-07-30) +- 修复(重要) H5 平台下如果和uni-forms组件一同使用导致页面卡死的问题 +## 0.2.3(2021-07-28) +- 优化 调整示例代码 +## 0.2.2(2021-07-27) +- 修复 vue3 下赋值错误的Bug +- 优化 h5平台下上传文件导致页面卡死的问题 +## 0.2.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 0.1.1(2021-07-02) +- 修复 sourceType 缺少默认值导致 ios 无法选择文件 +## 0.1.0(2021-06-30) +- 优化 解耦与uniCloud的强绑定关系 ,如不绑定服务空间,默认autoUpload为false且不可更改 +## 0.0.11(2021-06-30) +- 修复 由 0.0.10 版本引发的 returnType 属性失效的问题 +## 0.0.10(2021-06-29) +- 优化 文件上传后进度条消失时机 +## 0.0.9(2021-06-29) +- 修复 在uni-forms 中,删除文件 ,获取的值不对的Bug +## 0.0.8(2021-06-15) +- 修复 删除文件时无法触发 v-model 的Bug +## 0.0.7(2021-05-12) +- 新增 组件示例地址 +## 0.0.6(2021-04-09) +- 修复 选择的文件非 file-extname 字段指定的扩展名报错的Bug +## 0.0.5(2021-04-09) +- 优化 更新组件示例 +## 0.0.4(2021-04-09) +- 优化 file-extname 字段支持字符串写法,多个扩展名需要用逗号分隔 +## 0.0.3(2021-02-05) +- 调整为uni_modules目录规范 +- 修复 微信小程序不指定 fileExtname 属性选择失败的Bug diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js b/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js new file mode 100644 index 0000000..aff0864 --- /dev/null +++ b/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js @@ -0,0 +1,224 @@ +'use strict'; + +const ERR_MSG_OK = 'chooseAndUploadFile:ok'; +const ERR_MSG_FAIL = 'chooseAndUploadFile:fail'; + +function chooseImage(opts) { + const { + count, + sizeType = ['original', 'compressed'], + sourceType, + extension + } = opts + return new Promise((resolve, reject) => { + uni.chooseImage({ + count, + sizeType, + sourceType, + extension, + success(res) { + resolve(normalizeChooseAndUploadFileRes(res, 'image')); + }, + fail(res) { + reject({ + errMsg: res.errMsg.replace('chooseImage:fail', ERR_MSG_FAIL), + }); + }, + }); + }); +} + +function chooseVideo(opts) { + const { + camera, + compressed, + maxDuration, + sourceType, + extension + } = opts; + return new Promise((resolve, reject) => { + uni.chooseVideo({ + camera, + compressed, + maxDuration, + sourceType, + extension, + success(res) { + const { + tempFilePath, + duration, + size, + height, + width + } = res; + resolve(normalizeChooseAndUploadFileRes({ + errMsg: 'chooseVideo:ok', + tempFilePaths: [tempFilePath], + tempFiles: [ + { + name: (res.tempFile && res.tempFile.name) || '', + path: tempFilePath, + size, + type: (res.tempFile && res.tempFile.type) || '', + width, + height, + duration, + fileType: 'video', + cloudPath: '', + }, ], + }, 'video')); + }, + fail(res) { + reject({ + errMsg: res.errMsg.replace('chooseVideo:fail', ERR_MSG_FAIL), + }); + }, + }); + }); +} + +function chooseAll(opts) { + const { + count, + extension + } = opts; + return new Promise((resolve, reject) => { + let chooseFile = uni.chooseFile; + if (typeof wx !== 'undefined' && + typeof wx.chooseMessageFile === 'function') { + chooseFile = wx.chooseMessageFile; + } + if (typeof chooseFile !== 'function') { + return reject({ + errMsg: ERR_MSG_FAIL + ' 请指定 type 类型,该平台仅支持选择 image 或 video。', + }); + } + chooseFile({ + type: 'all', + count, + extension, + success(res) { + resolve(normalizeChooseAndUploadFileRes(res)); + }, + fail(res) { + reject({ + errMsg: res.errMsg.replace('chooseFile:fail', ERR_MSG_FAIL), + }); + }, + }); + }); +} + +function normalizeChooseAndUploadFileRes(res, fileType) { + res.tempFiles.forEach((item, index) => { + if (!item.name) { + item.name = item.path.substring(item.path.lastIndexOf('/') + 1); + } + if (fileType) { + item.fileType = fileType; + } + item.cloudPath = + Date.now() + '_' + index + item.name.substring(item.name.lastIndexOf('.')); + }); + if (!res.tempFilePaths) { + res.tempFilePaths = res.tempFiles.map((file) => file.path); + } + return res; +} + +function uploadCloudFiles(files, max = 5, onUploadProgress) { + files = JSON.parse(JSON.stringify(files)) + const len = files.length + let count = 0 + let self = this + return new Promise(resolve => { + while (count < max) { + next() + } + + function next() { + let cur = count++ + if (cur >= len) { + !files.find(item => !item.url && !item.errMsg) && resolve(files) + return + } + const fileItem = files[cur] + const index = self.files.findIndex(v => v.uuid === fileItem.uuid) + fileItem.url = '' + delete fileItem.errMsg + + uniCloud + .uploadFile({ + filePath: fileItem.path, + cloudPath: fileItem.cloudPath, + fileType: fileItem.fileType, + onUploadProgress: res => { + res.index = index + onUploadProgress && onUploadProgress(res) + } + }) + .then(res => { + fileItem.url = res.fileID + fileItem.index = index + if (cur < len) { + next() + } + }) + .catch(res => { + fileItem.errMsg = res.errMsg || res.message + fileItem.index = index + if (cur < len) { + next() + } + }) + } + }) +} + + + + + +function uploadFiles(choosePromise, { + onChooseFile, + onUploadProgress +}) { + return choosePromise + .then((res) => { + if (onChooseFile) { + const customChooseRes = onChooseFile(res); + if (typeof customChooseRes !== 'undefined') { + return Promise.resolve(customChooseRes).then((chooseRes) => typeof chooseRes === 'undefined' ? + res : chooseRes); + } + } + return res; + }) + .then((res) => { + if (res === false) { + return { + errMsg: ERR_MSG_OK, + tempFilePaths: [], + tempFiles: [], + }; + } + return res + }) +} + +function chooseAndUploadFile(opts = { + type: 'all' +}) { + if (opts.type === 'image') { + return uploadFiles(chooseImage(opts), opts); + } + else if (opts.type === 'video') { + return uploadFiles(chooseVideo(opts), opts); + } + return uploadFiles(chooseAll(opts), opts); +} + +export { + chooseAndUploadFile, + uploadCloudFiles +}; diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue b/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue new file mode 100644 index 0000000..370441d --- /dev/null +++ b/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue @@ -0,0 +1,667 @@ + + + + + diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue b/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue new file mode 100644 index 0000000..625d92e --- /dev/null +++ b/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue @@ -0,0 +1,325 @@ + + + + + diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue b/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue new file mode 100644 index 0000000..2a29bc2 --- /dev/null +++ b/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue @@ -0,0 +1,292 @@ + + + + + diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/utils.js b/uni_modules/uni-file-picker/components/uni-file-picker/utils.js new file mode 100644 index 0000000..60aaa3e --- /dev/null +++ b/uni_modules/uni-file-picker/components/uni-file-picker/utils.js @@ -0,0 +1,109 @@ +/** + * 获取文件名和后缀 + * @param {String} name + */ +export const get_file_ext = (name) => { + const last_len = name.lastIndexOf('.') + const len = name.length + return { + name: name.substring(0, last_len), + ext: name.substring(last_len + 1, len) + } +} + +/** + * 获取扩展名 + * @param {Array} fileExtname + */ +export const get_extname = (fileExtname) => { + if (!Array.isArray(fileExtname)) { + let extname = fileExtname.replace(/(\[|\])/g, '') + return extname.split(',') + } else { + return fileExtname + } + return [] +} + +/** + * 获取文件和检测是否可选 + */ +export const get_files_and_is_max = (res, _extname) => { + let filePaths = [] + let files = [] + if(!_extname || _extname.length === 0){ + return { + filePaths, + files + } + } + res.tempFiles.forEach(v => { + let fileFullName = get_file_ext(v.name) + const extname = fileFullName.ext.toLowerCase() + if (_extname.indexOf(extname) !== -1) { + files.push(v) + filePaths.push(v.path) + } + }) + if (files.length !== res.tempFiles.length) { + uni.showToast({ + title: `当前选择了${res.tempFiles.length}个文件 ,${res.tempFiles.length - files.length} 个文件格式不正确`, + icon: 'none', + duration: 5000 + }) + } + + return { + filePaths, + files + } +} + + +/** + * 获取图片信息 + * @param {Object} filepath + */ +export const get_file_info = (filepath) => { + return new Promise((resolve, reject) => { + uni.getImageInfo({ + src: filepath, + success(res) { + resolve(res) + }, + fail(err) { + reject(err) + } + }) + }) +} +/** + * 获取封装数据 + */ +export const get_file_data = async (files, type = 'image') => { + // 最终需要上传数据库的数据 + let fileFullName = get_file_ext(files.name) + const extname = fileFullName.ext.toLowerCase() + let filedata = { + name: files.name, + uuid: files.uuid, + extname: extname || '', + cloudPath: files.cloudPath, + fileType: files.fileType, + url: files.path || files.path, + size: files.size, //单位是字节 + image: {}, + path: files.path, + video: {} + } + if (type === 'image') { + const imageinfo = await get_file_info(files.path) + delete filedata.video + filedata.image.width = imageinfo.width + filedata.image.height = imageinfo.height + filedata.image.location = imageinfo.path + } else { + delete filedata.image + } + return filedata +} diff --git a/uni_modules/uni-file-picker/package.json b/uni_modules/uni-file-picker/package.json new file mode 100644 index 0000000..35c926c --- /dev/null +++ b/uni_modules/uni-file-picker/package.json @@ -0,0 +1,83 @@ +{ + "id": "uni-file-picker", + "displayName": "uni-file-picker 文件选择上传", + "version": "1.0.4", + "description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间", + "keywords": [ + "uni-ui", + "uniui", + "图片上传", + "文件上传" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "n" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-file-picker/readme.md b/uni_modules/uni-file-picker/readme.md new file mode 100644 index 0000000..c8399a5 --- /dev/null +++ b/uni_modules/uni-file-picker/readme.md @@ -0,0 +1,11 @@ + +## FilePicker 文件选择上传 + +> **组件名:uni-file-picker** +> 代码块: `uFilePicker` + + +文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-file-picker) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-forms/changelog.md b/uni_modules/uni-forms/changelog.md new file mode 100644 index 0000000..8218df5 --- /dev/null +++ b/uni_modules/uni-forms/changelog.md @@ -0,0 +1,92 @@ +## 1.4.9(2023-02-10) +- 修复 required 参数无法动态绑定 +## 1.4.8(2022-08-23) +- 优化 根据 rules 自动添加 required 的问题 +## 1.4.7(2022-08-22) +- 修复 item 未设置 require 属性,rules 设置 require 后,星号也显示的 bug,详见:[https://ask.dcloud.net.cn/question/151540](https://ask.dcloud.net.cn/question/151540) +## 1.4.6(2022-07-13) +- 修复 model 需要校验的值没有声明对应字段时,导致第一次不触发校验的bug +## 1.4.5(2022-07-05) +- 新增 更多表单示例 +- 优化 子表单组件过期提示的问题 +- 优化 子表单组件uni-datetime-picker、uni-data-select、uni-data-picker的显示样式 +## 1.4.4(2022-07-04) +- 更新 删除组件日志 +## 1.4.3(2022-07-04) +- 修复 由 1.4.0 引发的 label 插槽不生效的bug +## 1.4.2(2022-07-04) +- 修复 子组件找不到 setValue 报错的bug +## 1.4.1(2022-07-04) +- 修复 uni-data-picker 在 uni-forms-item 中报错的bug +- 修复 uni-data-picker 在 uni-forms-item 中宽度不正确的bug +## 1.4.0(2022-06-30) +- 【重要】组件逻辑重构,部分用法用旧版本不兼容,请注意兼容问题 +- 【重要】组件使用 Provide/Inject 方式注入依赖,提供了自定义表单组件调用 uni-forms 校验表单的能力 +- 新增 model 属性,等同于原 value/modelValue 属性,旧属性即将废弃 +- 新增 validateTrigger 属性的 blur 值,仅 uni-easyinput 生效 +- 新增 onFieldChange 方法,可以对子表单进行校验,可替代binddata方法 +- 新增 子表单的 setRules 方法,配合自定义校验函数使用 +- 新增 uni-forms-item 的 setRules 方法,配置动态表单使用可动态更新校验规则 +- 优化 动态表单校验方式,废弃拼接name的方式 +## 1.3.3(2022-06-22) +- 修复 表单校验顺序无序问题 +## 1.3.2(2021-12-09) +- +## 1.3.1(2021-11-19) +- 修复 label 插槽不生效的bug +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-forms](https://uniapp.dcloud.io/component/uniui/uni-forms) +## 1.2.7(2021-08-13) +- 修复 没有添加校验规则的字段依然报错的Bug +## 1.2.6(2021-08-11) +- 修复 重置表单错误信息无法清除的问题 +## 1.2.5(2021-08-11) +- 优化 组件文档 +## 1.2.4(2021-08-11) +- 修复 表单验证只生效一次的问题 +## 1.2.3(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.2.2(2021-07-26) +- 修复 vue2 下条件编译导致destroyed生命周期失效的Bug +- 修复 1.2.1 引起的示例在小程序平台报错的Bug +## 1.2.1(2021-07-22) +- 修复 动态校验表单,默认值为空的情况下校验失效的Bug +- 修复 不指定name属性时,运行报错的Bug +- 优化 label默认宽度从65调整至70,使required为true且四字时不换行 +- 优化 组件示例,新增动态校验示例代码 +- 优化 组件文档,使用方式更清晰 +## 1.2.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.2(2021-06-25) +- 修复 pattern 属性在微信小程序平台无效的问题 +## 1.1.1(2021-06-22) +- 修复 validate-trigger属性为submit且err-show-type属性为toast时不能弹出的Bug +## 1.1.0(2021-06-22) +- 修复 只写setRules方法而导致校验不生效的Bug +- 修复 由上个办法引发的错误提示文字错位的Bug +## 1.0.48(2021-06-21) +- 修复 不设置 label 属性 ,无法设置label插槽的问题 +## 1.0.47(2021-06-21) +- 修复 不设置label属性,label-width属性不生效的bug +- 修复 setRules 方法与rules属性冲突的问题 +## 1.0.46(2021-06-04) +- 修复 动态删减数据导致报错的问题 +## 1.0.45(2021-06-04) +- 新增 modelValue 属性 ,value 即将废弃 +## 1.0.44(2021-06-02) +- 新增 uni-forms-item 可以设置单独的 rules +- 新增 validate 事件增加 keepitem 参数,可以选择那些字段不过滤 +- 优化 submit 事件重命名为 validate +## 1.0.43(2021-05-12) +- 新增 组件示例地址 +## 1.0.42(2021-04-30) +- 修复 自定义检验器失效的问题 +## 1.0.41(2021-03-05) +- 更新 校验器 +- 修复 表单规则设置类型为 number 的情况下,值为0校验失败的Bug +## 1.0.40(2021-03-04) +- 修复 动态显示uni-forms-item的情况下,submit 方法获取值错误的Bug +## 1.0.39(2021-02-05) +- 调整为uni_modules目录规范 +- 修复 校验器传入 int 等类型 ,返回String类型的Bug diff --git a/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue b/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue new file mode 100644 index 0000000..91fe351 --- /dev/null +++ b/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue @@ -0,0 +1,627 @@ + + + + + diff --git a/uni_modules/uni-forms/components/uni-forms/uni-forms.vue b/uni_modules/uni-forms/components/uni-forms/uni-forms.vue new file mode 100644 index 0000000..ed2f6d9 --- /dev/null +++ b/uni_modules/uni-forms/components/uni-forms/uni-forms.vue @@ -0,0 +1,397 @@ + + + + + diff --git a/uni_modules/uni-forms/components/uni-forms/utils.js b/uni_modules/uni-forms/components/uni-forms/utils.js new file mode 100644 index 0000000..6da2421 --- /dev/null +++ b/uni_modules/uni-forms/components/uni-forms/utils.js @@ -0,0 +1,293 @@ +/** + * 简单处理对象拷贝 + * @param {Obejct} 被拷贝对象 + * @@return {Object} 拷贝对象 + */ +export const deepCopy = (val) => { + return JSON.parse(JSON.stringify(val)) +} +/** + * 过滤数字类型 + * @param {String} format 数字类型 + * @@return {Boolean} 返回是否为数字类型 + */ +export const typeFilter = (format) => { + return format === 'int' || format === 'double' || format === 'number' || format === 'timestamp'; +} + +/** + * 把 value 转换成指定的类型,用于处理初始值,原因是初始值需要入库不能为 undefined + * @param {String} key 字段名 + * @param {any} value 字段值 + * @param {Object} rules 表单校验规则 + */ +export const getValue = (key, value, rules) => { + const isRuleNumType = rules.find(val => val.format && typeFilter(val.format)); + const isRuleBoolType = rules.find(val => (val.format && val.format === 'boolean') || val.format === 'bool'); + // 输入类型为 number + if (!!isRuleNumType) { + if (!value && value !== 0) { + value = null + } else { + value = isNumber(Number(value)) ? Number(value) : value + } + } + + // 输入类型为 boolean + if (!!isRuleBoolType) { + value = isBoolean(value) ? value : false + } + + return value; +} + +/** + * 获取表单数据 + * @param {String|Array} name 真实名称,需要使用 realName 获取 + * @param {Object} data 原始数据 + * @param {any} value 需要设置的值 + */ +export const setDataValue = (field, formdata, value) => { + formdata[field] = value + return value || '' +} + +/** + * 获取表单数据 + * @param {String|Array} field 真实名称,需要使用 realName 获取 + * @param {Object} data 原始数据 + */ +export const getDataValue = (field, data) => { + return objGet(data, field) +} + +/** + * 获取表单类型 + * @param {String|Array} field 真实名称,需要使用 realName 获取 + */ +export const getDataValueType = (field, data) => { + const value = getDataValue(field, data) + return { + type: type(value), + value + } +} + +/** + * 获取表单可用的真实name + * @param {String|Array} name 表单name + * @@return {String} 表单可用的真实name + */ +export const realName = (name, data = {}) => { + const base_name = _basePath(name) + if (typeof base_name === 'object' && Array.isArray(base_name) && base_name.length > 1) { + const realname = base_name.reduce((a, b) => a += `#${b}`, '_formdata_') + return realname + } + return base_name[0] || name +} + +/** + * 判断是否表单可用的真实name + * @param {String|Array} name 表单name + * @@return {String} 表单可用的真实name + */ +export const isRealName = (name) => { + const reg = /^_formdata_#*/ + return reg.test(name) +} + +/** + * 获取表单数据的原始格式 + * @@return {Object|Array} object 需要解析的数据 + */ +export const rawData = (object = {}, name) => { + let newData = JSON.parse(JSON.stringify(object)) + let formData = {} + for(let i in newData){ + let path = name2arr(i) + objSet(formData,path,newData[i]) + } + return formData +} + +/** + * 真实name还原为 array + * @param {*} name + */ +export const name2arr = (name) => { + let field = name.replace('_formdata_#', '') + field = field.split('#').map(v => (isNumber(v) ? Number(v) : v)) + return field +} + +/** + * 对象中设置值 + * @param {Object|Array} object 源数据 + * @param {String| Array} path 'a.b.c' 或 ['a',0,'b','c'] + * @param {String} value 需要设置的值 + */ +export const objSet = (object, path, value) => { + if (typeof object !== 'object') return object; + _basePath(path).reduce((o, k, i, _) => { + if (i === _.length - 1) { + // 若遍历结束直接赋值 + o[k] = value + return null + } else if (k in o) { + // 若存在对应路径,则返回找到的对象,进行下一次遍历 + return o[k] + } else { + // 若不存在对应路径,则创建对应对象,若下一路径是数字,新对象赋值为空数组,否则赋值为空对象 + o[k] = /^[0-9]{1,}$/.test(_[i + 1]) ? [] : {} + return o[k] + } + }, object) + // 返回object + return object; +} + +// 处理 path, path有三种形式:'a[0].b.c'、'a.0.b.c' 和 ['a','0','b','c'],需要统一处理成数组,便于后续使用 +function _basePath(path) { + // 若是数组,则直接返回 + if (Array.isArray(path)) return path + // 若有 '[',']',则替换成将 '[' 替换成 '.',去掉 ']' + return path.replace(/\[/g, '.').replace(/\]/g, '').split('.') +} + +/** + * 从对象中获取值 + * @param {Object|Array} object 源数据 + * @param {String| Array} path 'a.b.c' 或 ['a',0,'b','c'] + * @param {String} defaultVal 如果无法从调用链中获取值的默认值 + */ +export const objGet = (object, path, defaultVal = 'undefined') => { + // 先将path处理成统一格式 + let newPath = _basePath(path) + // 递归处理,返回最后结果 + let val = newPath.reduce((o, k) => { + return (o || {})[k] + }, object); + return !val || val !== undefined ? val : defaultVal +} + + +/** + * 是否为 number 类型 + * @param {any} num 需要判断的值 + * @return {Boolean} 是否为 number + */ +export const isNumber = (num) => { + return !isNaN(Number(num)) +} + +/** + * 是否为 boolean 类型 + * @param {any} bool 需要判断的值 + * @return {Boolean} 是否为 boolean + */ +export const isBoolean = (bool) => { + return (typeof bool === 'boolean') +} +/** + * 是否有必填字段 + * @param {Object} rules 规则 + * @return {Boolean} 是否有必填字段 + */ +export const isRequiredField = (rules) => { + let isNoField = false; + for (let i = 0; i < rules.length; i++) { + const ruleData = rules[i]; + if (ruleData.required) { + isNoField = true; + break; + } + } + return isNoField; +} + + +/** + * 获取数据类型 + * @param {Any} obj 需要获取数据类型的值 + */ +export const type = (obj) => { + var class2type = {}; + + // 生成class2type映射 + "Boolean Number String Function Array Date RegExp Object Error".split(" ").map(function(item, index) { + class2type["[object " + item + "]"] = item.toLowerCase(); + }) + if (obj == null) { + return obj + ""; + } + return typeof obj === "object" || typeof obj === "function" ? + class2type[Object.prototype.toString.call(obj)] || "object" : + typeof obj; +} + +/** + * 判断两个值是否相等 + * @param {any} a 值 + * @param {any} b 值 + * @return {Boolean} 是否相等 + */ +export const isEqual = (a, b) => { + //如果a和b本来就全等 + if (a === b) { + //判断是否为0和-0 + return a !== 0 || 1 / a === 1 / b; + } + //判断是否为null和undefined + if (a == null || b == null) { + return a === b; + } + //接下来判断a和b的数据类型 + var classNameA = toString.call(a), + classNameB = toString.call(b); + //如果数据类型不相等,则返回false + if (classNameA !== classNameB) { + return false; + } + //如果数据类型相等,再根据不同数据类型分别判断 + switch (classNameA) { + case '[object RegExp]': + case '[object String]': + //进行字符串转换比较 + return '' + a === '' + b; + case '[object Number]': + //进行数字转换比较,判断是否为NaN + if (+a !== +a) { + return +b !== +b; + } + //判断是否为0或-0 + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case '[object Date]': + case '[object Boolean]': + return +a === +b; + } + //如果是对象类型 + if (classNameA == '[object Object]') { + //获取a和b的属性长度 + var propsA = Object.getOwnPropertyNames(a), + propsB = Object.getOwnPropertyNames(b); + if (propsA.length != propsB.length) { + return false; + } + for (var i = 0; i < propsA.length; i++) { + var propName = propsA[i]; + //如果对应属性对应值不相等,则返回false + if (a[propName] !== b[propName]) { + return false; + } + } + return true; + } + //如果是数组类型 + if (classNameA == '[object Array]') { + if (a.toString() == b.toString()) { + return true; + } + return false; + } +} diff --git a/uni_modules/uni-forms/components/uni-forms/validate.js b/uni_modules/uni-forms/components/uni-forms/validate.js new file mode 100644 index 0000000..1834c6c --- /dev/null +++ b/uni_modules/uni-forms/components/uni-forms/validate.js @@ -0,0 +1,486 @@ +var pattern = { + email: /^\S+?@\S+?\.\S+?$/, + idcard: /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/, + url: new RegExp( + "^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", + 'i') +}; + +const FORMAT_MAPPING = { + "int": 'integer', + "bool": 'boolean', + "double": 'number', + "long": 'number', + "password": 'string' + // "fileurls": 'array' +} + +function formatMessage(args, resources = '') { + var defaultMessage = ['label'] + defaultMessage.forEach((item) => { + if (args[item] === undefined) { + args[item] = '' + } + }) + + let str = resources + for (let key in args) { + let reg = new RegExp('{' + key + '}') + str = str.replace(reg, args[key]) + } + return str +} + +function isEmptyValue(value, type) { + if (value === undefined || value === null) { + return true; + } + + if (typeof value === 'string' && !value) { + return true; + } + + if (Array.isArray(value) && !value.length) { + return true; + } + + if (type === 'object' && !Object.keys(value).length) { + return true; + } + + return false; +} + +const types = { + integer(value) { + return types.number(value) && parseInt(value, 10) === value; + }, + string(value) { + return typeof value === 'string'; + }, + number(value) { + if (isNaN(value)) { + return false; + } + return typeof value === 'number'; + }, + "boolean": function(value) { + return typeof value === 'boolean'; + }, + "float": function(value) { + return types.number(value) && !types.integer(value); + }, + array(value) { + return Array.isArray(value); + }, + object(value) { + return typeof value === 'object' && !types.array(value); + }, + date(value) { + return value instanceof Date; + }, + timestamp(value) { + if (!this.integer(value) || Math.abs(value).toString().length > 16) { + return false + } + return true; + }, + file(value) { + return typeof value.url === 'string'; + }, + email(value) { + return typeof value === 'string' && !!value.match(pattern.email) && value.length < 255; + }, + url(value) { + return typeof value === 'string' && !!value.match(pattern.url); + }, + pattern(reg, value) { + try { + return new RegExp(reg).test(value); + } catch (e) { + return false; + } + }, + method(value) { + return typeof value === 'function'; + }, + idcard(value) { + return typeof value === 'string' && !!value.match(pattern.idcard); + }, + 'url-https'(value) { + return this.url(value) && value.startsWith('https://'); + }, + 'url-scheme'(value) { + return value.startsWith('://'); + }, + 'url-web'(value) { + return false; + } +} + +class RuleValidator { + + constructor(message) { + this._message = message + } + + async validateRule(fieldKey, fieldValue, value, data, allData) { + var result = null + + let rules = fieldValue.rules + + let hasRequired = rules.findIndex((item) => { + return item.required + }) + if (hasRequired < 0) { + if (value === null || value === undefined) { + return result + } + if (typeof value === 'string' && !value.length) { + return result + } + } + + var message = this._message + + if (rules === undefined) { + return message['default'] + } + + for (var i = 0; i < rules.length; i++) { + let rule = rules[i] + let vt = this._getValidateType(rule) + + Object.assign(rule, { + label: fieldValue.label || `["${fieldKey}"]` + }) + + if (RuleValidatorHelper[vt]) { + result = RuleValidatorHelper[vt](rule, value, message) + if (result != null) { + break + } + } + + if (rule.validateExpr) { + let now = Date.now() + let resultExpr = rule.validateExpr(value, allData, now) + if (resultExpr === false) { + result = this._getMessage(rule, rule.errorMessage || this._message['default']) + break + } + } + + if (rule.validateFunction) { + result = await this.validateFunction(rule, value, data, allData, vt) + if (result !== null) { + break + } + } + } + + if (result !== null) { + result = message.TAG + result + } + + return result + } + + async validateFunction(rule, value, data, allData, vt) { + let result = null + try { + let callbackMessage = null + const res = await rule.validateFunction(rule, value, allData || data, (message) => { + callbackMessage = message + }) + if (callbackMessage || (typeof res === 'string' && res) || res === false) { + result = this._getMessage(rule, callbackMessage || res, vt) + } + } catch (e) { + result = this._getMessage(rule, e.message, vt) + } + return result + } + + _getMessage(rule, message, vt) { + return formatMessage(rule, message || rule.errorMessage || this._message[vt] || message['default']) + } + + _getValidateType(rule) { + var result = '' + if (rule.required) { + result = 'required' + } else if (rule.format) { + result = 'format' + } else if (rule.arrayType) { + result = 'arrayTypeFormat' + } else if (rule.range) { + result = 'range' + } else if (rule.maximum !== undefined || rule.minimum !== undefined) { + result = 'rangeNumber' + } else if (rule.maxLength !== undefined || rule.minLength !== undefined) { + result = 'rangeLength' + } else if (rule.pattern) { + result = 'pattern' + } else if (rule.validateFunction) { + result = 'validateFunction' + } + return result + } +} + +const RuleValidatorHelper = { + required(rule, value, message) { + if (rule.required && isEmptyValue(value, rule.format || typeof value)) { + return formatMessage(rule, rule.errorMessage || message.required); + } + + return null + }, + + range(rule, value, message) { + const { + range, + errorMessage + } = rule; + + let list = new Array(range.length); + for (let i = 0; i < range.length; i++) { + const item = range[i]; + if (types.object(item) && item.value !== undefined) { + list[i] = item.value; + } else { + list[i] = item; + } + } + + let result = false + if (Array.isArray(value)) { + result = (new Set(value.concat(list)).size === list.length); + } else { + if (list.indexOf(value) > -1) { + result = true; + } + } + + if (!result) { + return formatMessage(rule, errorMessage || message['enum']); + } + + return null + }, + + rangeNumber(rule, value, message) { + if (!types.number(value)) { + return formatMessage(rule, rule.errorMessage || message.pattern.mismatch); + } + + let { + minimum, + maximum, + exclusiveMinimum, + exclusiveMaximum + } = rule; + let min = exclusiveMinimum ? value <= minimum : value < minimum; + let max = exclusiveMaximum ? value >= maximum : value > maximum; + + if (minimum !== undefined && min) { + return formatMessage(rule, rule.errorMessage || message['number'][exclusiveMinimum ? + 'exclusiveMinimum' : 'minimum' + ]) + } else if (maximum !== undefined && max) { + return formatMessage(rule, rule.errorMessage || message['number'][exclusiveMaximum ? + 'exclusiveMaximum' : 'maximum' + ]) + } else if (minimum !== undefined && maximum !== undefined && (min || max)) { + return formatMessage(rule, rule.errorMessage || message['number'].range) + } + + return null + }, + + rangeLength(rule, value, message) { + if (!types.string(value) && !types.array(value)) { + return formatMessage(rule, rule.errorMessage || message.pattern.mismatch); + } + + let min = rule.minLength; + let max = rule.maxLength; + let val = value.length; + + if (min !== undefined && val < min) { + return formatMessage(rule, rule.errorMessage || message['length'].minLength) + } else if (max !== undefined && val > max) { + return formatMessage(rule, rule.errorMessage || message['length'].maxLength) + } else if (min !== undefined && max !== undefined && (val < min || val > max)) { + return formatMessage(rule, rule.errorMessage || message['length'].range) + } + + return null + }, + + pattern(rule, value, message) { + if (!types['pattern'](rule.pattern, value)) { + return formatMessage(rule, rule.errorMessage || message.pattern.mismatch); + } + + return null + }, + + format(rule, value, message) { + var customTypes = Object.keys(types); + var format = FORMAT_MAPPING[rule.format] ? FORMAT_MAPPING[rule.format] : (rule.format || rule.arrayType); + + if (customTypes.indexOf(format) > -1) { + if (!types[format](value)) { + return formatMessage(rule, rule.errorMessage || message.typeError); + } + } + + return null + }, + + arrayTypeFormat(rule, value, message) { + if (!Array.isArray(value)) { + return formatMessage(rule, rule.errorMessage || message.typeError); + } + + for (let i = 0; i < value.length; i++) { + const element = value[i]; + let formatResult = this.format(rule, element, message) + if (formatResult !== null) { + return formatResult + } + } + + return null + } +} + +class SchemaValidator extends RuleValidator { + + constructor(schema, options) { + super(SchemaValidator.message); + + this._schema = schema + this._options = options || null + } + + updateSchema(schema) { + this._schema = schema + } + + async validate(data, allData) { + let result = this._checkFieldInSchema(data) + if (!result) { + result = await this.invokeValidate(data, false, allData) + } + return result.length ? result[0] : null + } + + async validateAll(data, allData) { + let result = this._checkFieldInSchema(data) + if (!result) { + result = await this.invokeValidate(data, true, allData) + } + return result + } + + async validateUpdate(data, allData) { + let result = this._checkFieldInSchema(data) + if (!result) { + result = await this.invokeValidateUpdate(data, false, allData) + } + return result.length ? result[0] : null + } + + async invokeValidate(data, all, allData) { + let result = [] + let schema = this._schema + for (let key in schema) { + let value = schema[key] + let errorMessage = await this.validateRule(key, value, data[key], data, allData) + if (errorMessage != null) { + result.push({ + key, + errorMessage + }) + if (!all) break + } + } + return result + } + + async invokeValidateUpdate(data, all, allData) { + let result = [] + for (let key in data) { + let errorMessage = await this.validateRule(key, this._schema[key], data[key], data, allData) + if (errorMessage != null) { + result.push({ + key, + errorMessage + }) + if (!all) break + } + } + return result + } + + _checkFieldInSchema(data) { + var keys = Object.keys(data) + var keys2 = Object.keys(this._schema) + if (new Set(keys.concat(keys2)).size === keys2.length) { + return '' + } + + var noExistFields = keys.filter((key) => { + return keys2.indexOf(key) < 0; + }) + var errorMessage = formatMessage({ + field: JSON.stringify(noExistFields) + }, SchemaValidator.message.TAG + SchemaValidator.message['defaultInvalid']) + return [{ + key: 'invalid', + errorMessage + }] + } +} + +function Message() { + return { + TAG: "", + default: '验证错误', + defaultInvalid: '提交的字段{field}在数据库中并不存在', + validateFunction: '验证无效', + required: '{label}必填', + 'enum': '{label}超出范围', + timestamp: '{label}格式无效', + whitespace: '{label}不能为空', + typeError: '{label}类型无效', + date: { + format: '{label}日期{value}格式无效', + parse: '{label}日期无法解析,{value}无效', + invalid: '{label}日期{value}无效' + }, + length: { + minLength: '{label}长度不能少于{minLength}', + maxLength: '{label}长度不能超过{maxLength}', + range: '{label}必须介于{minLength}和{maxLength}之间' + }, + number: { + minimum: '{label}不能小于{minimum}', + maximum: '{label}不能大于{maximum}', + exclusiveMinimum: '{label}不能小于等于{minimum}', + exclusiveMaximum: '{label}不能大于等于{maximum}', + range: '{label}必须介于{minimum}and{maximum}之间' + }, + pattern: { + mismatch: '{label}格式不匹配' + } + }; +} + + +SchemaValidator.message = new Message(); + +export default SchemaValidator diff --git a/uni_modules/uni-forms/package.json b/uni_modules/uni-forms/package.json new file mode 100644 index 0000000..1925611 --- /dev/null +++ b/uni_modules/uni-forms/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-forms", + "displayName": "uni-forms 表单", + "version": "1.4.9", + "description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据", + "keywords": [ + "uni-ui", + "表单", + "校验", + "表单校验", + "表单验证" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-forms/readme.md b/uni_modules/uni-forms/readme.md new file mode 100644 index 0000000..63d5a04 --- /dev/null +++ b/uni_modules/uni-forms/readme.md @@ -0,0 +1,23 @@ + + +## Forms 表单 + +> **组件名:uni-forms** +> 代码块: `uForms`、`uni-forms-item` +> 关联组件:`uni-forms-item`、`uni-easyinput`、`uni-data-checkbox`、`uni-group`。 + + +uni-app的内置组件已经有了 `
`组件,用于提交表单内容。 + +然而几乎每个表单都需要做表单验证,为了方便做表单验证,减少重复开发,`uni ui` 又基于 ``组件封装了 ``组件,内置了表单验证功能。 + +`` 提供了 `rules`属性来描述校验规则、``子组件来包裹具体的表单项,以及给原生或三方组件提供了 `binddata()` 来设置表单值。 + +每个要校验的表单项,不管input还是checkbox,都必须放在``组件中,且一个``组件只能放置一个表单项。 + +``组件内部预留了显示error message的区域,默认是在表单项的底部。 + +另外,``组件下面的各个表单项,可以通过``包裹为不同的分组。同一``下的不同表单项目将聚拢在一起,同其他group保持垂直间距。``仅影响视觉效果。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-forms) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-goods-nav/changelog.md b/uni_modules/uni-goods-nav/changelog.md new file mode 100644 index 0000000..c6264c6 --- /dev/null +++ b/uni_modules/uni-goods-nav/changelog.md @@ -0,0 +1,18 @@ +## 1.2.1(2022-05-30) +- 新增 stat属性,是否开启uni统计功能 +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-goods-nav](https://uniapp.dcloud.io/component/uniui/uni-goods-nav) +## 1.1.1(2021-08-24) +- 新增 支持国际化 +## 1.1.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.7(2021-05-12) +- 新增 组件示例地址 +## 1.0.6(2021-04-21) +- 优化 添加依赖 uni-icons, 导入后自动下载依赖 +## 1.0.5(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.4(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/en.json b/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/en.json new file mode 100644 index 0000000..dcdba41 --- /dev/null +++ b/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/en.json @@ -0,0 +1,6 @@ +{ + "uni-goods-nav.options.shop": "shop", + "uni-goods-nav.options.cart": "cart", + "uni-goods-nav.buttonGroup.addToCart": "add to cart", + "uni-goods-nav.buttonGroup.buyNow": "buy now" +} diff --git a/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/index.js b/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/zh-Hans.json b/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/zh-Hans.json new file mode 100644 index 0000000..48ee344 --- /dev/null +++ b/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/zh-Hans.json @@ -0,0 +1,6 @@ +{ + "uni-goods-nav.options.shop": "店铺", + "uni-goods-nav.options.cart": "购物车", + "uni-goods-nav.buttonGroup.addToCart": "加入购物车", + "uni-goods-nav.buttonGroup.buyNow": "立即购买" +} diff --git a/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/zh-Hant.json b/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/zh-Hant.json new file mode 100644 index 0000000..d0a0255 --- /dev/null +++ b/uni_modules/uni-goods-nav/components/uni-goods-nav/i18n/zh-Hant.json @@ -0,0 +1,6 @@ +{ + "uni-goods-nav.options.shop": "店鋪", + "uni-goods-nav.options.cart": "購物車", + "uni-goods-nav.buttonGroup.addToCart": "加入購物車", + "uni-goods-nav.buttonGroup.buyNow": "立即購買" +} diff --git a/uni_modules/uni-goods-nav/components/uni-goods-nav/uni-goods-nav.vue b/uni_modules/uni-goods-nav/components/uni-goods-nav/uni-goods-nav.vue new file mode 100644 index 0000000..8a16b17 --- /dev/null +++ b/uni_modules/uni-goods-nav/components/uni-goods-nav/uni-goods-nav.vue @@ -0,0 +1,229 @@ + + + + + diff --git a/uni_modules/uni-goods-nav/package.json b/uni_modules/uni-goods-nav/package.json new file mode 100644 index 0000000..636e45e --- /dev/null +++ b/uni_modules/uni-goods-nav/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-goods-nav", + "displayName": "uni-goods-nav 商品导航", + "version": "1.2.1", + "description": "商品导航组件主要用于电商类应用底部导航,可自定义加入购物车,购买等操作", + "keywords": [ + "uni-ui", + "uniui", + "商品导航" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-goods-nav/readme.md b/uni_modules/uni-goods-nav/readme.md new file mode 100644 index 0000000..07df93f --- /dev/null +++ b/uni_modules/uni-goods-nav/readme.md @@ -0,0 +1,10 @@ + + +## GoodsNav 商品导航 +> **组件名:uni-goods-nav** +> 代码块: `uGoodsNav` + +商品加入购物车,立即购买等。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-goods-nav) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-grid/changelog.md b/uni_modules/uni-grid/changelog.md new file mode 100644 index 0000000..d301166 --- /dev/null +++ b/uni_modules/uni-grid/changelog.md @@ -0,0 +1,13 @@ +## 1.4.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-grid](https://uniapp.dcloud.io/component/uniui/uni-grid) +## 1.3.2(2021-11-09) +- 新增 提供组件设计资源,组件样式调整 +## 1.3.1(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.3.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.2.4(2021-05-12) +- 新增 组件示例地址 +## 1.2.3(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.vue b/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.vue new file mode 100644 index 0000000..19c08d7 --- /dev/null +++ b/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/uni_modules/uni-grid/components/uni-grid/uni-grid.vue b/uni_modules/uni-grid/components/uni-grid/uni-grid.vue new file mode 100644 index 0000000..0edc7ff --- /dev/null +++ b/uni_modules/uni-grid/components/uni-grid/uni-grid.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/uni_modules/uni-grid/package.json b/uni_modules/uni-grid/package.json new file mode 100644 index 0000000..ccb2c91 --- /dev/null +++ b/uni_modules/uni-grid/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-grid", + "displayName": "uni-grid 宫格", + "version": "1.4.0", + "description": "Grid 宫格组件,提供移动端常见的宫格布局,如九宫格。", + "keywords": [ + "uni-ui", + "uniui", + "九宫格", + "表格" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss","uni-icons"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-grid/readme.md b/uni_modules/uni-grid/readme.md new file mode 100644 index 0000000..0aa44cc --- /dev/null +++ b/uni_modules/uni-grid/readme.md @@ -0,0 +1,11 @@ + + +## Grid 宫格 +> **组件名:uni-grid** +> 代码块: `uGrid` + + +宫格组件。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-grid) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-group/changelog.md b/uni_modules/uni-group/changelog.md new file mode 100644 index 0000000..a7024fd --- /dev/null +++ b/uni_modules/uni-group/changelog.md @@ -0,0 +1,16 @@ +## 1.2.2(2022-05-30) +- 新增 stat属性,是否开启uni统计功能 +## 1.2.1(2021-11-22) +- 修复 vue3中某些scss变量无法找到的问题 +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-group](https://uniapp.dcloud.io/component/uniui/uni-group) +## 1.1.7(2021-11-08) +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +- 优化 组件文档 +## 1.0.3(2021-05-12) +- 新增 组件示例地址 +## 1.0.2(2021-02-05) +- 调整为uni_modules目录规范 +- 优化 兼容 nvue 页面 diff --git a/uni_modules/uni-group/components/uni-group/uni-group.vue b/uni_modules/uni-group/components/uni-group/uni-group.vue new file mode 100644 index 0000000..3425ecd --- /dev/null +++ b/uni_modules/uni-group/components/uni-group/uni-group.vue @@ -0,0 +1,134 @@ + + + + diff --git a/uni_modules/uni-group/package.json b/uni_modules/uni-group/package.json new file mode 100644 index 0000000..ea00a08 --- /dev/null +++ b/uni_modules/uni-group/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-group", + "displayName": "uni-group 分组", + "version": "1.2.2", + "description": "分组组件可用于将组件用于分组,添加间隔,以产生明显的区块", + "keywords": [ + "uni-ui", + "uniui", + "group", + "分组", + "" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-group/readme.md b/uni_modules/uni-group/readme.md new file mode 100644 index 0000000..bae67f4 --- /dev/null +++ b/uni_modules/uni-group/readme.md @@ -0,0 +1,9 @@ + +## Group 分组 +> **组件名:uni-group** +> 代码块: `uGroup` + +分组组件可用于将组件分组,添加间隔,以产生明显的区块。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-group) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-icons/changelog.md b/uni_modules/uni-icons/changelog.md new file mode 100644 index 0000000..6449885 --- /dev/null +++ b/uni_modules/uni-icons/changelog.md @@ -0,0 +1,22 @@ +## 1.3.5(2022-01-24) +- 优化 size 属性可以传入不带单位的字符串数值 +## 1.3.4(2022-01-24) +- 优化 size 支持其他单位 +## 1.3.3(2022-01-17) +- 修复 nvue 有些图标不显示的bug,兼容老版本图标 +## 1.3.2(2021-12-01) +- 优化 示例可复制图标名称 +## 1.3.1(2021-11-23) +- 优化 兼容旧组件 type 值 +## 1.3.0(2021-11-19) +- 新增 更多图标 +- 优化 自定义图标使用方式 +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-icons](https://uniapp.dcloud.io/component/uniui/uni-icons) +## 1.1.7(2021-11-08) +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.5(2021-05-12) +- 新增 组件示例地址 +## 1.1.4(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-icons/components/uni-icons/icons.js b/uni_modules/uni-icons/components/uni-icons/icons.js new file mode 100644 index 0000000..7889936 --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/icons.js @@ -0,0 +1,1169 @@ +export default { + "id": "2852637", + "name": "uniui图标库", + "font_family": "uniicons", + "css_prefix_text": "uniui-", + "description": "", + "glyphs": [ + { + "icon_id": "25027049", + "name": "yanse", + "font_class": "color", + "unicode": "e6cf", + "unicode_decimal": 59087 + }, + { + "icon_id": "25027048", + "name": "wallet", + "font_class": "wallet", + "unicode": "e6b1", + "unicode_decimal": 59057 + }, + { + "icon_id": "25015720", + "name": "settings-filled", + "font_class": "settings-filled", + "unicode": "e6ce", + "unicode_decimal": 59086 + }, + { + "icon_id": "25015434", + "name": "shimingrenzheng-filled", + "font_class": "auth-filled", + "unicode": "e6cc", + "unicode_decimal": 59084 + }, + { + "icon_id": "24934246", + "name": "shop-filled", + "font_class": "shop-filled", + "unicode": "e6cd", + "unicode_decimal": 59085 + }, + { + "icon_id": "24934159", + "name": "staff-filled-01", + "font_class": "staff-filled", + "unicode": "e6cb", + "unicode_decimal": 59083 + }, + { + "icon_id": "24932461", + "name": "VIP-filled", + "font_class": "vip-filled", + "unicode": "e6c6", + "unicode_decimal": 59078 + }, + { + "icon_id": "24932462", + "name": "plus_circle_fill", + "font_class": "plus-filled", + "unicode": "e6c7", + "unicode_decimal": 59079 + }, + { + "icon_id": "24932463", + "name": "folder_add-filled", + "font_class": "folder-add-filled", + "unicode": "e6c8", + "unicode_decimal": 59080 + }, + { + "icon_id": "24932464", + "name": "yanse-filled", + "font_class": "color-filled", + "unicode": "e6c9", + "unicode_decimal": 59081 + }, + { + "icon_id": "24932465", + "name": "tune-filled", + "font_class": "tune-filled", + "unicode": "e6ca", + "unicode_decimal": 59082 + }, + { + "icon_id": "24932455", + "name": "a-rilidaka-filled", + "font_class": "calendar-filled", + "unicode": "e6c0", + "unicode_decimal": 59072 + }, + { + "icon_id": "24932456", + "name": "notification-filled", + "font_class": "notification-filled", + "unicode": "e6c1", + "unicode_decimal": 59073 + }, + { + "icon_id": "24932457", + "name": "wallet-filled", + "font_class": "wallet-filled", + "unicode": "e6c2", + "unicode_decimal": 59074 + }, + { + "icon_id": "24932458", + "name": "paihangbang-filled", + "font_class": "medal-filled", + "unicode": "e6c3", + "unicode_decimal": 59075 + }, + { + "icon_id": "24932459", + "name": "gift-filled", + "font_class": "gift-filled", + "unicode": "e6c4", + "unicode_decimal": 59076 + }, + { + "icon_id": "24932460", + "name": "fire-filled", + "font_class": "fire-filled", + "unicode": "e6c5", + "unicode_decimal": 59077 + }, + { + "icon_id": "24928001", + "name": "refreshempty", + "font_class": "refreshempty", + "unicode": "e6bf", + "unicode_decimal": 59071 + }, + { + "icon_id": "24926853", + "name": "location-ellipse", + "font_class": "location-filled", + "unicode": "e6af", + "unicode_decimal": 59055 + }, + { + "icon_id": "24926735", + "name": "person-filled", + "font_class": "person-filled", + "unicode": "e69d", + "unicode_decimal": 59037 + }, + { + "icon_id": "24926703", + "name": "personadd-filled", + "font_class": "personadd-filled", + "unicode": "e698", + "unicode_decimal": 59032 + }, + { + "icon_id": "24923351", + "name": "back", + "font_class": "back", + "unicode": "e6b9", + "unicode_decimal": 59065 + }, + { + "icon_id": "24923352", + "name": "forward", + "font_class": "forward", + "unicode": "e6ba", + "unicode_decimal": 59066 + }, + { + "icon_id": "24923353", + "name": "arrowthinright", + "font_class": "arrow-right", + "unicode": "e6bb", + "unicode_decimal": 59067 + }, + { + "icon_id": "24923353", + "name": "arrowthinright", + "font_class": "arrowthinright", + "unicode": "e6bb", + "unicode_decimal": 59067 + }, + { + "icon_id": "24923354", + "name": "arrowthinleft", + "font_class": "arrow-left", + "unicode": "e6bc", + "unicode_decimal": 59068 + }, + { + "icon_id": "24923354", + "name": "arrowthinleft", + "font_class": "arrowthinleft", + "unicode": "e6bc", + "unicode_decimal": 59068 + }, + { + "icon_id": "24923355", + "name": "arrowthinup", + "font_class": "arrow-up", + "unicode": "e6bd", + "unicode_decimal": 59069 + }, + { + "icon_id": "24923355", + "name": "arrowthinup", + "font_class": "arrowthinup", + "unicode": "e6bd", + "unicode_decimal": 59069 + }, + { + "icon_id": "24923356", + "name": "arrowthindown", + "font_class": "arrow-down", + "unicode": "e6be", + "unicode_decimal": 59070 + },{ + "icon_id": "24923356", + "name": "arrowthindown", + "font_class": "arrowthindown", + "unicode": "e6be", + "unicode_decimal": 59070 + }, + { + "icon_id": "24923349", + "name": "arrowdown", + "font_class": "bottom", + "unicode": "e6b8", + "unicode_decimal": 59064 + },{ + "icon_id": "24923349", + "name": "arrowdown", + "font_class": "arrowdown", + "unicode": "e6b8", + "unicode_decimal": 59064 + }, + { + "icon_id": "24923346", + "name": "arrowright", + "font_class": "right", + "unicode": "e6b5", + "unicode_decimal": 59061 + }, + { + "icon_id": "24923346", + "name": "arrowright", + "font_class": "arrowright", + "unicode": "e6b5", + "unicode_decimal": 59061 + }, + { + "icon_id": "24923347", + "name": "arrowup", + "font_class": "top", + "unicode": "e6b6", + "unicode_decimal": 59062 + }, + { + "icon_id": "24923347", + "name": "arrowup", + "font_class": "arrowup", + "unicode": "e6b6", + "unicode_decimal": 59062 + }, + { + "icon_id": "24923348", + "name": "arrowleft", + "font_class": "left", + "unicode": "e6b7", + "unicode_decimal": 59063 + }, + { + "icon_id": "24923348", + "name": "arrowleft", + "font_class": "arrowleft", + "unicode": "e6b7", + "unicode_decimal": 59063 + }, + { + "icon_id": "24923334", + "name": "eye", + "font_class": "eye", + "unicode": "e651", + "unicode_decimal": 58961 + }, + { + "icon_id": "24923335", + "name": "eye-filled", + "font_class": "eye-filled", + "unicode": "e66a", + "unicode_decimal": 58986 + }, + { + "icon_id": "24923336", + "name": "eye-slash", + "font_class": "eye-slash", + "unicode": "e6b3", + "unicode_decimal": 59059 + }, + { + "icon_id": "24923337", + "name": "eye-slash-filled", + "font_class": "eye-slash-filled", + "unicode": "e6b4", + "unicode_decimal": 59060 + }, + { + "icon_id": "24923305", + "name": "info-filled", + "font_class": "info-filled", + "unicode": "e649", + "unicode_decimal": 58953 + }, + { + "icon_id": "24923299", + "name": "reload-01", + "font_class": "reload", + "unicode": "e6b2", + "unicode_decimal": 59058 + }, + { + "icon_id": "24923195", + "name": "mic_slash_fill", + "font_class": "micoff-filled", + "unicode": "e6b0", + "unicode_decimal": 59056 + }, + { + "icon_id": "24923165", + "name": "map-pin-ellipse", + "font_class": "map-pin-ellipse", + "unicode": "e6ac", + "unicode_decimal": 59052 + }, + { + "icon_id": "24923166", + "name": "map-pin", + "font_class": "map-pin", + "unicode": "e6ad", + "unicode_decimal": 59053 + }, + { + "icon_id": "24923167", + "name": "location", + "font_class": "location", + "unicode": "e6ae", + "unicode_decimal": 59054 + }, + { + "icon_id": "24923064", + "name": "starhalf", + "font_class": "starhalf", + "unicode": "e683", + "unicode_decimal": 59011 + }, + { + "icon_id": "24923065", + "name": "star", + "font_class": "star", + "unicode": "e688", + "unicode_decimal": 59016 + }, + { + "icon_id": "24923066", + "name": "star-filled", + "font_class": "star-filled", + "unicode": "e68f", + "unicode_decimal": 59023 + }, + { + "icon_id": "24899646", + "name": "a-rilidaka", + "font_class": "calendar", + "unicode": "e6a0", + "unicode_decimal": 59040 + }, + { + "icon_id": "24899647", + "name": "fire", + "font_class": "fire", + "unicode": "e6a1", + "unicode_decimal": 59041 + }, + { + "icon_id": "24899648", + "name": "paihangbang", + "font_class": "medal", + "unicode": "e6a2", + "unicode_decimal": 59042 + }, + { + "icon_id": "24899649", + "name": "font", + "font_class": "font", + "unicode": "e6a3", + "unicode_decimal": 59043 + }, + { + "icon_id": "24899650", + "name": "gift", + "font_class": "gift", + "unicode": "e6a4", + "unicode_decimal": 59044 + }, + { + "icon_id": "24899651", + "name": "link", + "font_class": "link", + "unicode": "e6a5", + "unicode_decimal": 59045 + }, + { + "icon_id": "24899652", + "name": "notification", + "font_class": "notification", + "unicode": "e6a6", + "unicode_decimal": 59046 + }, + { + "icon_id": "24899653", + "name": "staff", + "font_class": "staff", + "unicode": "e6a7", + "unicode_decimal": 59047 + }, + { + "icon_id": "24899654", + "name": "VIP", + "font_class": "vip", + "unicode": "e6a8", + "unicode_decimal": 59048 + }, + { + "icon_id": "24899655", + "name": "folder_add", + "font_class": "folder-add", + "unicode": "e6a9", + "unicode_decimal": 59049 + }, + { + "icon_id": "24899656", + "name": "tune", + "font_class": "tune", + "unicode": "e6aa", + "unicode_decimal": 59050 + }, + { + "icon_id": "24899657", + "name": "shimingrenzheng", + "font_class": "auth", + "unicode": "e6ab", + "unicode_decimal": 59051 + }, + { + "icon_id": "24899565", + "name": "person", + "font_class": "person", + "unicode": "e699", + "unicode_decimal": 59033 + }, + { + "icon_id": "24899566", + "name": "email-filled", + "font_class": "email-filled", + "unicode": "e69a", + "unicode_decimal": 59034 + }, + { + "icon_id": "24899567", + "name": "phone-filled", + "font_class": "phone-filled", + "unicode": "e69b", + "unicode_decimal": 59035 + }, + { + "icon_id": "24899568", + "name": "phone", + "font_class": "phone", + "unicode": "e69c", + "unicode_decimal": 59036 + }, + { + "icon_id": "24899570", + "name": "email", + "font_class": "email", + "unicode": "e69e", + "unicode_decimal": 59038 + }, + { + "icon_id": "24899571", + "name": "personadd", + "font_class": "personadd", + "unicode": "e69f", + "unicode_decimal": 59039 + }, + { + "icon_id": "24899558", + "name": "chatboxes-filled", + "font_class": "chatboxes-filled", + "unicode": "e692", + "unicode_decimal": 59026 + }, + { + "icon_id": "24899559", + "name": "contact", + "font_class": "contact", + "unicode": "e693", + "unicode_decimal": 59027 + }, + { + "icon_id": "24899560", + "name": "chatbubble-filled", + "font_class": "chatbubble-filled", + "unicode": "e694", + "unicode_decimal": 59028 + }, + { + "icon_id": "24899561", + "name": "contact-filled", + "font_class": "contact-filled", + "unicode": "e695", + "unicode_decimal": 59029 + }, + { + "icon_id": "24899562", + "name": "chatboxes", + "font_class": "chatboxes", + "unicode": "e696", + "unicode_decimal": 59030 + }, + { + "icon_id": "24899563", + "name": "chatbubble", + "font_class": "chatbubble", + "unicode": "e697", + "unicode_decimal": 59031 + }, + { + "icon_id": "24881290", + "name": "upload-filled", + "font_class": "upload-filled", + "unicode": "e68e", + "unicode_decimal": 59022 + }, + { + "icon_id": "24881292", + "name": "upload", + "font_class": "upload", + "unicode": "e690", + "unicode_decimal": 59024 + }, + { + "icon_id": "24881293", + "name": "weixin", + "font_class": "weixin", + "unicode": "e691", + "unicode_decimal": 59025 + }, + { + "icon_id": "24881274", + "name": "compose", + "font_class": "compose", + "unicode": "e67f", + "unicode_decimal": 59007 + }, + { + "icon_id": "24881275", + "name": "qq", + "font_class": "qq", + "unicode": "e680", + "unicode_decimal": 59008 + }, + { + "icon_id": "24881276", + "name": "download-filled", + "font_class": "download-filled", + "unicode": "e681", + "unicode_decimal": 59009 + }, + { + "icon_id": "24881277", + "name": "pengyouquan", + "font_class": "pyq", + "unicode": "e682", + "unicode_decimal": 59010 + }, + { + "icon_id": "24881279", + "name": "sound", + "font_class": "sound", + "unicode": "e684", + "unicode_decimal": 59012 + }, + { + "icon_id": "24881280", + "name": "trash-filled", + "font_class": "trash-filled", + "unicode": "e685", + "unicode_decimal": 59013 + }, + { + "icon_id": "24881281", + "name": "sound-filled", + "font_class": "sound-filled", + "unicode": "e686", + "unicode_decimal": 59014 + }, + { + "icon_id": "24881282", + "name": "trash", + "font_class": "trash", + "unicode": "e687", + "unicode_decimal": 59015 + }, + { + "icon_id": "24881284", + "name": "videocam-filled", + "font_class": "videocam-filled", + "unicode": "e689", + "unicode_decimal": 59017 + }, + { + "icon_id": "24881285", + "name": "spinner-cycle", + "font_class": "spinner-cycle", + "unicode": "e68a", + "unicode_decimal": 59018 + }, + { + "icon_id": "24881286", + "name": "weibo", + "font_class": "weibo", + "unicode": "e68b", + "unicode_decimal": 59019 + }, + { + "icon_id": "24881288", + "name": "videocam", + "font_class": "videocam", + "unicode": "e68c", + "unicode_decimal": 59020 + }, + { + "icon_id": "24881289", + "name": "download", + "font_class": "download", + "unicode": "e68d", + "unicode_decimal": 59021 + }, + { + "icon_id": "24879601", + "name": "help", + "font_class": "help", + "unicode": "e679", + "unicode_decimal": 59001 + }, + { + "icon_id": "24879602", + "name": "navigate-filled", + "font_class": "navigate-filled", + "unicode": "e67a", + "unicode_decimal": 59002 + }, + { + "icon_id": "24879603", + "name": "plusempty", + "font_class": "plusempty", + "unicode": "e67b", + "unicode_decimal": 59003 + }, + { + "icon_id": "24879604", + "name": "smallcircle", + "font_class": "smallcircle", + "unicode": "e67c", + "unicode_decimal": 59004 + }, + { + "icon_id": "24879605", + "name": "minus-filled", + "font_class": "minus-filled", + "unicode": "e67d", + "unicode_decimal": 59005 + }, + { + "icon_id": "24879606", + "name": "micoff", + "font_class": "micoff", + "unicode": "e67e", + "unicode_decimal": 59006 + }, + { + "icon_id": "24879588", + "name": "closeempty", + "font_class": "closeempty", + "unicode": "e66c", + "unicode_decimal": 58988 + }, + { + "icon_id": "24879589", + "name": "clear", + "font_class": "clear", + "unicode": "e66d", + "unicode_decimal": 58989 + }, + { + "icon_id": "24879590", + "name": "navigate", + "font_class": "navigate", + "unicode": "e66e", + "unicode_decimal": 58990 + }, + { + "icon_id": "24879591", + "name": "minus", + "font_class": "minus", + "unicode": "e66f", + "unicode_decimal": 58991 + }, + { + "icon_id": "24879592", + "name": "image", + "font_class": "image", + "unicode": "e670", + "unicode_decimal": 58992 + }, + { + "icon_id": "24879593", + "name": "mic", + "font_class": "mic", + "unicode": "e671", + "unicode_decimal": 58993 + }, + { + "icon_id": "24879594", + "name": "paperplane", + "font_class": "paperplane", + "unicode": "e672", + "unicode_decimal": 58994 + }, + { + "icon_id": "24879595", + "name": "close", + "font_class": "close", + "unicode": "e673", + "unicode_decimal": 58995 + }, + { + "icon_id": "24879596", + "name": "help-filled", + "font_class": "help-filled", + "unicode": "e674", + "unicode_decimal": 58996 + }, + { + "icon_id": "24879597", + "name": "plus-filled", + "font_class": "paperplane-filled", + "unicode": "e675", + "unicode_decimal": 58997 + }, + { + "icon_id": "24879598", + "name": "plus", + "font_class": "plus", + "unicode": "e676", + "unicode_decimal": 58998 + }, + { + "icon_id": "24879599", + "name": "mic-filled", + "font_class": "mic-filled", + "unicode": "e677", + "unicode_decimal": 58999 + }, + { + "icon_id": "24879600", + "name": "image-filled", + "font_class": "image-filled", + "unicode": "e678", + "unicode_decimal": 59000 + }, + { + "icon_id": "24855900", + "name": "locked-filled", + "font_class": "locked-filled", + "unicode": "e668", + "unicode_decimal": 58984 + }, + { + "icon_id": "24855901", + "name": "info", + "font_class": "info", + "unicode": "e669", + "unicode_decimal": 58985 + }, + { + "icon_id": "24855903", + "name": "locked", + "font_class": "locked", + "unicode": "e66b", + "unicode_decimal": 58987 + }, + { + "icon_id": "24855884", + "name": "camera-filled", + "font_class": "camera-filled", + "unicode": "e658", + "unicode_decimal": 58968 + }, + { + "icon_id": "24855885", + "name": "chat-filled", + "font_class": "chat-filled", + "unicode": "e659", + "unicode_decimal": 58969 + }, + { + "icon_id": "24855886", + "name": "camera", + "font_class": "camera", + "unicode": "e65a", + "unicode_decimal": 58970 + }, + { + "icon_id": "24855887", + "name": "circle", + "font_class": "circle", + "unicode": "e65b", + "unicode_decimal": 58971 + }, + { + "icon_id": "24855888", + "name": "checkmarkempty", + "font_class": "checkmarkempty", + "unicode": "e65c", + "unicode_decimal": 58972 + }, + { + "icon_id": "24855889", + "name": "chat", + "font_class": "chat", + "unicode": "e65d", + "unicode_decimal": 58973 + }, + { + "icon_id": "24855890", + "name": "circle-filled", + "font_class": "circle-filled", + "unicode": "e65e", + "unicode_decimal": 58974 + }, + { + "icon_id": "24855891", + "name": "flag", + "font_class": "flag", + "unicode": "e65f", + "unicode_decimal": 58975 + }, + { + "icon_id": "24855892", + "name": "flag-filled", + "font_class": "flag-filled", + "unicode": "e660", + "unicode_decimal": 58976 + }, + { + "icon_id": "24855893", + "name": "gear-filled", + "font_class": "gear-filled", + "unicode": "e661", + "unicode_decimal": 58977 + }, + { + "icon_id": "24855894", + "name": "home", + "font_class": "home", + "unicode": "e662", + "unicode_decimal": 58978 + }, + { + "icon_id": "24855895", + "name": "home-filled", + "font_class": "home-filled", + "unicode": "e663", + "unicode_decimal": 58979 + }, + { + "icon_id": "24855896", + "name": "gear", + "font_class": "gear", + "unicode": "e664", + "unicode_decimal": 58980 + }, + { + "icon_id": "24855897", + "name": "smallcircle-filled", + "font_class": "smallcircle-filled", + "unicode": "e665", + "unicode_decimal": 58981 + }, + { + "icon_id": "24855898", + "name": "map-filled", + "font_class": "map-filled", + "unicode": "e666", + "unicode_decimal": 58982 + }, + { + "icon_id": "24855899", + "name": "map", + "font_class": "map", + "unicode": "e667", + "unicode_decimal": 58983 + }, + { + "icon_id": "24855825", + "name": "refresh-filled", + "font_class": "refresh-filled", + "unicode": "e656", + "unicode_decimal": 58966 + }, + { + "icon_id": "24855826", + "name": "refresh", + "font_class": "refresh", + "unicode": "e657", + "unicode_decimal": 58967 + }, + { + "icon_id": "24855808", + "name": "cloud-upload", + "font_class": "cloud-upload", + "unicode": "e645", + "unicode_decimal": 58949 + }, + { + "icon_id": "24855809", + "name": "cloud-download-filled", + "font_class": "cloud-download-filled", + "unicode": "e646", + "unicode_decimal": 58950 + }, + { + "icon_id": "24855810", + "name": "cloud-download", + "font_class": "cloud-download", + "unicode": "e647", + "unicode_decimal": 58951 + }, + { + "icon_id": "24855811", + "name": "cloud-upload-filled", + "font_class": "cloud-upload-filled", + "unicode": "e648", + "unicode_decimal": 58952 + }, + { + "icon_id": "24855813", + "name": "redo", + "font_class": "redo", + "unicode": "e64a", + "unicode_decimal": 58954 + }, + { + "icon_id": "24855814", + "name": "images-filled", + "font_class": "images-filled", + "unicode": "e64b", + "unicode_decimal": 58955 + }, + { + "icon_id": "24855815", + "name": "undo-filled", + "font_class": "undo-filled", + "unicode": "e64c", + "unicode_decimal": 58956 + }, + { + "icon_id": "24855816", + "name": "more", + "font_class": "more", + "unicode": "e64d", + "unicode_decimal": 58957 + }, + { + "icon_id": "24855817", + "name": "more-filled", + "font_class": "more-filled", + "unicode": "e64e", + "unicode_decimal": 58958 + }, + { + "icon_id": "24855818", + "name": "undo", + "font_class": "undo", + "unicode": "e64f", + "unicode_decimal": 58959 + }, + { + "icon_id": "24855819", + "name": "images", + "font_class": "images", + "unicode": "e650", + "unicode_decimal": 58960 + }, + { + "icon_id": "24855821", + "name": "paperclip", + "font_class": "paperclip", + "unicode": "e652", + "unicode_decimal": 58962 + }, + { + "icon_id": "24855822", + "name": "settings", + "font_class": "settings", + "unicode": "e653", + "unicode_decimal": 58963 + }, + { + "icon_id": "24855823", + "name": "search", + "font_class": "search", + "unicode": "e654", + "unicode_decimal": 58964 + }, + { + "icon_id": "24855824", + "name": "redo-filled", + "font_class": "redo-filled", + "unicode": "e655", + "unicode_decimal": 58965 + }, + { + "icon_id": "24841702", + "name": "list", + "font_class": "list", + "unicode": "e644", + "unicode_decimal": 58948 + }, + { + "icon_id": "24841489", + "name": "mail-open-filled", + "font_class": "mail-open-filled", + "unicode": "e63a", + "unicode_decimal": 58938 + }, + { + "icon_id": "24841491", + "name": "hand-thumbsdown-filled", + "font_class": "hand-down-filled", + "unicode": "e63c", + "unicode_decimal": 58940 + }, + { + "icon_id": "24841492", + "name": "hand-thumbsdown", + "font_class": "hand-down", + "unicode": "e63d", + "unicode_decimal": 58941 + }, + { + "icon_id": "24841493", + "name": "hand-thumbsup-filled", + "font_class": "hand-up-filled", + "unicode": "e63e", + "unicode_decimal": 58942 + }, + { + "icon_id": "24841494", + "name": "hand-thumbsup", + "font_class": "hand-up", + "unicode": "e63f", + "unicode_decimal": 58943 + }, + { + "icon_id": "24841496", + "name": "heart-filled", + "font_class": "heart-filled", + "unicode": "e641", + "unicode_decimal": 58945 + }, + { + "icon_id": "24841498", + "name": "mail-open", + "font_class": "mail-open", + "unicode": "e643", + "unicode_decimal": 58947 + }, + { + "icon_id": "24841488", + "name": "heart", + "font_class": "heart", + "unicode": "e639", + "unicode_decimal": 58937 + }, + { + "icon_id": "24839963", + "name": "loop", + "font_class": "loop", + "unicode": "e633", + "unicode_decimal": 58931 + }, + { + "icon_id": "24839866", + "name": "pulldown", + "font_class": "pulldown", + "unicode": "e632", + "unicode_decimal": 58930 + }, + { + "icon_id": "24813798", + "name": "scan", + "font_class": "scan", + "unicode": "e62a", + "unicode_decimal": 58922 + }, + { + "icon_id": "24813786", + "name": "bars", + "font_class": "bars", + "unicode": "e627", + "unicode_decimal": 58919 + }, + { + "icon_id": "24813788", + "name": "cart-filled", + "font_class": "cart-filled", + "unicode": "e629", + "unicode_decimal": 58921 + }, + { + "icon_id": "24813790", + "name": "checkbox", + "font_class": "checkbox", + "unicode": "e62b", + "unicode_decimal": 58923 + }, + { + "icon_id": "24813791", + "name": "checkbox-filled", + "font_class": "checkbox-filled", + "unicode": "e62c", + "unicode_decimal": 58924 + }, + { + "icon_id": "24813794", + "name": "shop", + "font_class": "shop", + "unicode": "e62f", + "unicode_decimal": 58927 + }, + { + "icon_id": "24813795", + "name": "headphones", + "font_class": "headphones", + "unicode": "e630", + "unicode_decimal": 58928 + }, + { + "icon_id": "24813796", + "name": "cart", + "font_class": "cart", + "unicode": "e631", + "unicode_decimal": 58929 + } + ] +} diff --git a/uni_modules/uni-icons/components/uni-icons/uni-icons.vue b/uni_modules/uni-icons/components/uni-icons/uni-icons.vue new file mode 100644 index 0000000..86e7444 --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/uni-icons.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/uni_modules/uni-icons/components/uni-icons/uniicons.css b/uni_modules/uni-icons/components/uni-icons/uniicons.css new file mode 100644 index 0000000..2f56eab --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/uniicons.css @@ -0,0 +1,663 @@ +.uniui-color:before { + content: "\e6cf"; +} + +.uniui-wallet:before { + content: "\e6b1"; +} + +.uniui-settings-filled:before { + content: "\e6ce"; +} + +.uniui-auth-filled:before { + content: "\e6cc"; +} + +.uniui-shop-filled:before { + content: "\e6cd"; +} + +.uniui-staff-filled:before { + content: "\e6cb"; +} + +.uniui-vip-filled:before { + content: "\e6c6"; +} + +.uniui-plus-filled:before { + content: "\e6c7"; +} + +.uniui-folder-add-filled:before { + content: "\e6c8"; +} + +.uniui-color-filled:before { + content: "\e6c9"; +} + +.uniui-tune-filled:before { + content: "\e6ca"; +} + +.uniui-calendar-filled:before { + content: "\e6c0"; +} + +.uniui-notification-filled:before { + content: "\e6c1"; +} + +.uniui-wallet-filled:before { + content: "\e6c2"; +} + +.uniui-medal-filled:before { + content: "\e6c3"; +} + +.uniui-gift-filled:before { + content: "\e6c4"; +} + +.uniui-fire-filled:before { + content: "\e6c5"; +} + +.uniui-refreshempty:before { + content: "\e6bf"; +} + +.uniui-location-filled:before { + content: "\e6af"; +} + +.uniui-person-filled:before { + content: "\e69d"; +} + +.uniui-personadd-filled:before { + content: "\e698"; +} + +.uniui-back:before { + content: "\e6b9"; +} + +.uniui-forward:before { + content: "\e6ba"; +} + +.uniui-arrow-right:before { + content: "\e6bb"; +} + +.uniui-arrowthinright:before { + content: "\e6bb"; +} + +.uniui-arrow-left:before { + content: "\e6bc"; +} + +.uniui-arrowthinleft:before { + content: "\e6bc"; +} + +.uniui-arrow-up:before { + content: "\e6bd"; +} + +.uniui-arrowthinup:before { + content: "\e6bd"; +} + +.uniui-arrow-down:before { + content: "\e6be"; +} + +.uniui-arrowthindown:before { + content: "\e6be"; +} + +.uniui-bottom:before { + content: "\e6b8"; +} + +.uniui-arrowdown:before { + content: "\e6b8"; +} + +.uniui-right:before { + content: "\e6b5"; +} + +.uniui-arrowright:before { + content: "\e6b5"; +} + +.uniui-top:before { + content: "\e6b6"; +} + +.uniui-arrowup:before { + content: "\e6b6"; +} + +.uniui-left:before { + content: "\e6b7"; +} + +.uniui-arrowleft:before { + content: "\e6b7"; +} + +.uniui-eye:before { + content: "\e651"; +} + +.uniui-eye-filled:before { + content: "\e66a"; +} + +.uniui-eye-slash:before { + content: "\e6b3"; +} + +.uniui-eye-slash-filled:before { + content: "\e6b4"; +} + +.uniui-info-filled:before { + content: "\e649"; +} + +.uniui-reload:before { + content: "\e6b2"; +} + +.uniui-micoff-filled:before { + content: "\e6b0"; +} + +.uniui-map-pin-ellipse:before { + content: "\e6ac"; +} + +.uniui-map-pin:before { + content: "\e6ad"; +} + +.uniui-location:before { + content: "\e6ae"; +} + +.uniui-starhalf:before { + content: "\e683"; +} + +.uniui-star:before { + content: "\e688"; +} + +.uniui-star-filled:before { + content: "\e68f"; +} + +.uniui-calendar:before { + content: "\e6a0"; +} + +.uniui-fire:before { + content: "\e6a1"; +} + +.uniui-medal:before { + content: "\e6a2"; +} + +.uniui-font:before { + content: "\e6a3"; +} + +.uniui-gift:before { + content: "\e6a4"; +} + +.uniui-link:before { + content: "\e6a5"; +} + +.uniui-notification:before { + content: "\e6a6"; +} + +.uniui-staff:before { + content: "\e6a7"; +} + +.uniui-vip:before { + content: "\e6a8"; +} + +.uniui-folder-add:before { + content: "\e6a9"; +} + +.uniui-tune:before { + content: "\e6aa"; +} + +.uniui-auth:before { + content: "\e6ab"; +} + +.uniui-person:before { + content: "\e699"; +} + +.uniui-email-filled:before { + content: "\e69a"; +} + +.uniui-phone-filled:before { + content: "\e69b"; +} + +.uniui-phone:before { + content: "\e69c"; +} + +.uniui-email:before { + content: "\e69e"; +} + +.uniui-personadd:before { + content: "\e69f"; +} + +.uniui-chatboxes-filled:before { + content: "\e692"; +} + +.uniui-contact:before { + content: "\e693"; +} + +.uniui-chatbubble-filled:before { + content: "\e694"; +} + +.uniui-contact-filled:before { + content: "\e695"; +} + +.uniui-chatboxes:before { + content: "\e696"; +} + +.uniui-chatbubble:before { + content: "\e697"; +} + +.uniui-upload-filled:before { + content: "\e68e"; +} + +.uniui-upload:before { + content: "\e690"; +} + +.uniui-weixin:before { + content: "\e691"; +} + +.uniui-compose:before { + content: "\e67f"; +} + +.uniui-qq:before { + content: "\e680"; +} + +.uniui-download-filled:before { + content: "\e681"; +} + +.uniui-pyq:before { + content: "\e682"; +} + +.uniui-sound:before { + content: "\e684"; +} + +.uniui-trash-filled:before { + content: "\e685"; +} + +.uniui-sound-filled:before { + content: "\e686"; +} + +.uniui-trash:before { + content: "\e687"; +} + +.uniui-videocam-filled:before { + content: "\e689"; +} + +.uniui-spinner-cycle:before { + content: "\e68a"; +} + +.uniui-weibo:before { + content: "\e68b"; +} + +.uniui-videocam:before { + content: "\e68c"; +} + +.uniui-download:before { + content: "\e68d"; +} + +.uniui-help:before { + content: "\e679"; +} + +.uniui-navigate-filled:before { + content: "\e67a"; +} + +.uniui-plusempty:before { + content: "\e67b"; +} + +.uniui-smallcircle:before { + content: "\e67c"; +} + +.uniui-minus-filled:before { + content: "\e67d"; +} + +.uniui-micoff:before { + content: "\e67e"; +} + +.uniui-closeempty:before { + content: "\e66c"; +} + +.uniui-clear:before { + content: "\e66d"; +} + +.uniui-navigate:before { + content: "\e66e"; +} + +.uniui-minus:before { + content: "\e66f"; +} + +.uniui-image:before { + content: "\e670"; +} + +.uniui-mic:before { + content: "\e671"; +} + +.uniui-paperplane:before { + content: "\e672"; +} + +.uniui-close:before { + content: "\e673"; +} + +.uniui-help-filled:before { + content: "\e674"; +} + +.uniui-paperplane-filled:before { + content: "\e675"; +} + +.uniui-plus:before { + content: "\e676"; +} + +.uniui-mic-filled:before { + content: "\e677"; +} + +.uniui-image-filled:before { + content: "\e678"; +} + +.uniui-locked-filled:before { + content: "\e668"; +} + +.uniui-info:before { + content: "\e669"; +} + +.uniui-locked:before { + content: "\e66b"; +} + +.uniui-camera-filled:before { + content: "\e658"; +} + +.uniui-chat-filled:before { + content: "\e659"; +} + +.uniui-camera:before { + content: "\e65a"; +} + +.uniui-circle:before { + content: "\e65b"; +} + +.uniui-checkmarkempty:before { + content: "\e65c"; +} + +.uniui-chat:before { + content: "\e65d"; +} + +.uniui-circle-filled:before { + content: "\e65e"; +} + +.uniui-flag:before { + content: "\e65f"; +} + +.uniui-flag-filled:before { + content: "\e660"; +} + +.uniui-gear-filled:before { + content: "\e661"; +} + +.uniui-home:before { + content: "\e662"; +} + +.uniui-home-filled:before { + content: "\e663"; +} + +.uniui-gear:before { + content: "\e664"; +} + +.uniui-smallcircle-filled:before { + content: "\e665"; +} + +.uniui-map-filled:before { + content: "\e666"; +} + +.uniui-map:before { + content: "\e667"; +} + +.uniui-refresh-filled:before { + content: "\e656"; +} + +.uniui-refresh:before { + content: "\e657"; +} + +.uniui-cloud-upload:before { + content: "\e645"; +} + +.uniui-cloud-download-filled:before { + content: "\e646"; +} + +.uniui-cloud-download:before { + content: "\e647"; +} + +.uniui-cloud-upload-filled:before { + content: "\e648"; +} + +.uniui-redo:before { + content: "\e64a"; +} + +.uniui-images-filled:before { + content: "\e64b"; +} + +.uniui-undo-filled:before { + content: "\e64c"; +} + +.uniui-more:before { + content: "\e64d"; +} + +.uniui-more-filled:before { + content: "\e64e"; +} + +.uniui-undo:before { + content: "\e64f"; +} + +.uniui-images:before { + content: "\e650"; +} + +.uniui-paperclip:before { + content: "\e652"; +} + +.uniui-settings:before { + content: "\e653"; +} + +.uniui-search:before { + content: "\e654"; +} + +.uniui-redo-filled:before { + content: "\e655"; +} + +.uniui-list:before { + content: "\e644"; +} + +.uniui-mail-open-filled:before { + content: "\e63a"; +} + +.uniui-hand-down-filled:before { + content: "\e63c"; +} + +.uniui-hand-down:before { + content: "\e63d"; +} + +.uniui-hand-up-filled:before { + content: "\e63e"; +} + +.uniui-hand-up:before { + content: "\e63f"; +} + +.uniui-heart-filled:before { + content: "\e641"; +} + +.uniui-mail-open:before { + content: "\e643"; +} + +.uniui-heart:before { + content: "\e639"; +} + +.uniui-loop:before { + content: "\e633"; +} + +.uniui-pulldown:before { + content: "\e632"; +} + +.uniui-scan:before { + content: "\e62a"; +} + +.uniui-bars:before { + content: "\e627"; +} + +.uniui-cart-filled:before { + content: "\e629"; +} + +.uniui-checkbox:before { + content: "\e62b"; +} + +.uniui-checkbox-filled:before { + content: "\e62c"; +} + +.uniui-shop:before { + content: "\e62f"; +} + +.uniui-headphones:before { + content: "\e630"; +} + +.uniui-cart:before { + content: "\e631"; +} diff --git a/uni_modules/uni-icons/components/uni-icons/uniicons.ttf b/uni_modules/uni-icons/components/uni-icons/uniicons.ttf new file mode 100644 index 0000000..835f33b Binary files /dev/null and b/uni_modules/uni-icons/components/uni-icons/uniicons.ttf differ diff --git a/uni_modules/uni-icons/package.json b/uni_modules/uni-icons/package.json new file mode 100644 index 0000000..d1c4e77 --- /dev/null +++ b/uni_modules/uni-icons/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-icons", + "displayName": "uni-icons 图标", + "version": "1.3.5", + "description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。", + "keywords": [ + "uni-ui", + "uniui", + "icon", + "图标" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.2.14" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-icons/readme.md b/uni_modules/uni-icons/readme.md new file mode 100644 index 0000000..86234ba --- /dev/null +++ b/uni_modules/uni-icons/readme.md @@ -0,0 +1,8 @@ +## Icons 图标 +> **组件名:uni-icons** +> 代码块: `uIcons` + +用于展示 icons 图标 。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-icons) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 diff --git a/uni_modules/uni-indexed-list/changelog.md b/uni_modules/uni-indexed-list/changelog.md new file mode 100644 index 0000000..08fa71c --- /dev/null +++ b/uni_modules/uni-indexed-list/changelog.md @@ -0,0 +1,17 @@ +## 1.2.1(2021-11-22) +- 修复 vue3中某些scss变量无法找到的问题 +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-indexed-list](https://uniapp.dcloud.io/component/uniui/uni-indexed-list) +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.11(2021-05-12) +- 新增 组件示例地址 +## 1.0.10(2021-04-21) +- 优化 添加依赖 uni-icons, 导入后自动下载依赖 +## 1.0.9(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.8(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 支持 PC 端 diff --git a/uni_modules/uni-indexed-list/components/uni-indexed-list/uni-indexed-list-item.vue b/uni_modules/uni-indexed-list/components/uni-indexed-list/uni-indexed-list-item.vue new file mode 100644 index 0000000..19284bd --- /dev/null +++ b/uni_modules/uni-indexed-list/components/uni-indexed-list/uni-indexed-list-item.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/uni_modules/uni-indexed-list/components/uni-indexed-list/uni-indexed-list.vue b/uni_modules/uni-indexed-list/components/uni-indexed-list/uni-indexed-list.vue new file mode 100644 index 0000000..ee3a7ec --- /dev/null +++ b/uni_modules/uni-indexed-list/components/uni-indexed-list/uni-indexed-list.vue @@ -0,0 +1,367 @@ + + + diff --git a/uni_modules/uni-indexed-list/package.json b/uni_modules/uni-indexed-list/package.json new file mode 100644 index 0000000..125c0e7 --- /dev/null +++ b/uni_modules/uni-indexed-list/package.json @@ -0,0 +1,89 @@ +{ + "id": "uni-indexed-list", + "displayName": "uni-indexed-list 索引列表", + "version": "1.2.1", + "description": "索引列表组件,右侧带索引的列表,方便快速定位到具体内容,通常用于城市/机场选择等场景", + "keywords": [ + "uni-ui", + "索引列表", + "索引", + "列表" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-indexed-list/readme.md b/uni_modules/uni-indexed-list/readme.md new file mode 100644 index 0000000..44ad84b --- /dev/null +++ b/uni_modules/uni-indexed-list/readme.md @@ -0,0 +1,11 @@ + + +## IndexedList 索引列表 +> **组件名:uni-indexed-list** +> 代码块: `uIndexedList` + + +用于展示索引列表。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-indexed-list) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 diff --git a/uni_modules/uni-link/changelog.md b/uni_modules/uni-link/changelog.md new file mode 100644 index 0000000..2cfbf59 --- /dev/null +++ b/uni_modules/uni-link/changelog.md @@ -0,0 +1,17 @@ +## 1.0.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-link](https://uniapp.dcloud.io/component/uniui/uni-link) +## 1.1.7(2021-11-08) +## 0.0.7(2021-09-03) +- 修复 在 nvue 下不显示的 bug +## 0.0.6(2021-07-30) +- 新增 支持自定义插槽 +## 0.0.5(2021-06-21) +- 新增 download 属性,H5平台下载文件名 +## 0.0.4(2021-05-12) +- 新增 组件示例地址 +## 0.0.3(2021-03-09) +- 新增 href 属性支持 tel:|mailto: + +## 0.0.2(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-link/components/uni-link/uni-link.vue b/uni_modules/uni-link/components/uni-link/uni-link.vue new file mode 100644 index 0000000..27c5468 --- /dev/null +++ b/uni_modules/uni-link/components/uni-link/uni-link.vue @@ -0,0 +1,128 @@ + + + + + diff --git a/uni_modules/uni-link/package.json b/uni_modules/uni-link/package.json new file mode 100644 index 0000000..77b1986 --- /dev/null +++ b/uni_modules/uni-link/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-link", + "displayName": "uni-link 超链接", + "version": "1.0.0", + "description": "uni-link是一个外部网页超链接组件,在小程序内复制url,在app内打开外部浏览器,在h5端打", + "keywords": [ + "uni-ui", + "uniui", + "link", + "超链接", + "" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-link/readme.md b/uni_modules/uni-link/readme.md new file mode 100644 index 0000000..7f09e94 --- /dev/null +++ b/uni_modules/uni-link/readme.md @@ -0,0 +1,11 @@ + + +## Link 链接 +> **组件名:uni-link** +> 代码块: `uLink` + + +uni-link是一个外部网页超链接组件,在小程序内复制url,在app内打开外部浏览器,在h5端打开新网页。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-link) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-list/changelog.md b/uni_modules/uni-list/changelog.md new file mode 100644 index 0000000..8254a18 --- /dev/null +++ b/uni_modules/uni-list/changelog.md @@ -0,0 +1,46 @@ +## 1.2.14(2023-04-14) +- 优化 uni-list-chat 具名插槽`header` 非app端套一层元素,方便使用时通过外层元素定位实现样式修改 +## 1.2.13(2023-03-03) +- uni-list-chat 新增 支持具名插槽`header` +## 1.2.12(2023-02-01) +- 新增 列表图标新增 customPrefix 属性 ,用法 [详见](https://uniapp.dcloud.net.cn/component/uniui/uni-icons.html#icons-props) +## 1.2.11(2023-01-31) +- 修复 无反馈效果呈现的bug +## 1.2.9(2022-11-22) +- 修复 uni-list-chat 在vue3下跳转报错的bug +## 1.2.8(2022-11-21) +- 修复 uni-list-chat avatar属性 值为本地路径时错误的问题 +## 1.2.7(2022-11-21) +- 修复 uni-list-chat avatar属性 在腾讯云版uniCloud下错误的问题 +## 1.2.6(2022-11-18) +- 修复 uni-list-chat note属性 支持:“草稿”字样功能 文本少1位的问题 +## 1.2.5(2022-11-15) +- 修复 uni-list-item 的 customStyle 属性 padding值在 H5端 无效的bug +## 1.2.4(2022-11-15) +- 修复 uni-list-item 的 customStyle 属性 padding值在nvue(vue2)下无效的bug +## 1.2.3(2022-11-14) +- uni-list-chat 新增 avatar 支持 fileId +## 1.2.2(2022-11-11) +- uni-list 新增属性 render-reverse 详情参考:[https://uniapp.dcloud.net.cn/component/list.html](https://uniapp.dcloud.net.cn/component/list.html) +- uni-list-chat note属性 支持:“草稿”字样 加红显示 详情参考uni-im:[https://ext.dcloud.net.cn/plugin?name=uni-im](https://ext.dcloud.net.cn/plugin?name=uni-im) +- uni-list-item 新增属性 customStyle 支持设置padding、backgroundColor +## 1.2.1(2022-03-30) +- 删除无用文件 +## 1.2.0(2021-11-23) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-list](https://uniapp.dcloud.io/component/uniui/uni-list) +## 1.1.3(2021-08-30) +- 修复 在vue3中to属性在发行应用的时候报错的bug +## 1.1.2(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.1.1(2021-07-21) +- 修复 与其他组件嵌套使用时,点击失效的Bug +## 1.1.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.17(2021-05-12) +- 新增 组件示例地址 +## 1.0.16(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 +## 1.0.15(2021-02-05) +- 调整为uni_modules目录规范 +- 修复 uni-list-chat 角标显示不正常的问题 diff --git a/uni_modules/uni-list/components/uni-list-ad/uni-list-ad.vue b/uni_modules/uni-list/components/uni-list-ad/uni-list-ad.vue new file mode 100644 index 0000000..b9349c2 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list-ad/uni-list-ad.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.scss b/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.scss new file mode 100644 index 0000000..311f8d9 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.scss @@ -0,0 +1,58 @@ +/** + * 这里是 uni-list 组件内置的常用样式变量 + * 如果需要覆盖样式,这里提供了基本的组件样式变量,您可以尝试修改这里的变量,去完成样式替换,而不用去修改源码 + * + */ + +// 背景色 +$background-color : #fff; +// 分割线颜色 +$divide-line-color : #e5e5e5; + +// 默认头像大小,如需要修改此值,注意同步修改 js 中的值 const avatarWidth = xx ,目前只支持方形头像 +// nvue 页面不支持修改头像大小 +$avatar-width : 45px ; + +// 头像边框 +$avatar-border-radius: 5px; +$avatar-border-color: #eee; +$avatar-border-width: 1px; + +// 标题文字样式 +$title-size : 16px; +$title-color : #3b4144; +$title-weight : normal; + +// 描述文字样式 +$note-size : 12px; +$note-color : #999; +$note-weight : normal; + +// 右侧额外内容默认样式 +$right-text-size : 12px; +$right-text-color : #999; +$right-text-weight : normal; + +// 角标样式 +// nvue 页面不支持修改圆点位置以及大小 +// 角标在左侧时,角标的位置,默认为 0 ,负数左/下移动,正数右/上移动 +$badge-left: 0px; +$badge-top: 0px; + +// 显示圆点时,圆点大小 +$dot-width: 10px; +$dot-height: 10px; + +// 显示角标时,角标大小和字体大小 +$badge-size : 18px; +$badge-font : 12px; +// 显示角标时,角标前景色 +$badge-color : #fff; +// 显示角标时,角标背景色 +$badge-background-color : #ff5a5f; +// 显示角标时,角标左右间距 +$badge-space : 6px; + +// 状态样式 +// 选中颜色 +$hover : #f5f5f5; diff --git a/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.vue b/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.vue new file mode 100644 index 0000000..d49fd7c --- /dev/null +++ b/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.vue @@ -0,0 +1,593 @@ + + + + + diff --git a/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue b/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue new file mode 100644 index 0000000..a274ac8 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue @@ -0,0 +1,534 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/uni-list/components/uni-list/uni-list.vue b/uni_modules/uni-list/components/uni-list/uni-list.vue new file mode 100644 index 0000000..6ef5972 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list/uni-list.vue @@ -0,0 +1,123 @@ + + + + diff --git a/uni_modules/uni-list/components/uni-list/uni-refresh.vue b/uni_modules/uni-list/components/uni-list/uni-refresh.vue new file mode 100644 index 0000000..3b4c5a2 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list/uni-refresh.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/uni_modules/uni-list/components/uni-list/uni-refresh.wxs b/uni_modules/uni-list/components/uni-list/uni-refresh.wxs new file mode 100644 index 0000000..818a6b7 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list/uni-refresh.wxs @@ -0,0 +1,87 @@ +var pullDown = { + threshold: 95, + maxHeight: 200, + callRefresh: 'onrefresh', + callPullingDown: 'onpullingdown', + refreshSelector: '.uni-refresh' +}; + +function ready(newValue, oldValue, ownerInstance, instance) { + var state = instance.getState() + state.canPullDown = newValue; + // console.log(newValue); +} + +function touchStart(e, instance) { + var state = instance.getState(); + state.refreshInstance = instance.selectComponent(pullDown.refreshSelector); + state.canPullDown = (state.refreshInstance != null && state.refreshInstance != undefined); + if (!state.canPullDown) { + return + } + + // console.log("touchStart"); + + state.height = 0; + state.touchStartY = e.touches[0].pageY || e.changedTouches[0].pageY; + state.refreshInstance.setStyle({ + 'height': 0 + }); + state.refreshInstance.callMethod("onchange", true); +} + +function touchMove(e, ownerInstance) { + var instance = e.instance; + var state = instance.getState(); + if (!state.canPullDown) { + return + } + + var oldHeight = state.height; + var endY = e.touches[0].pageY || e.changedTouches[0].pageY; + var height = endY - state.touchStartY; + if (height > pullDown.maxHeight) { + return; + } + + var refreshInstance = state.refreshInstance; + refreshInstance.setStyle({ + 'height': height + 'px' + }); + + height = height < pullDown.maxHeight ? height : pullDown.maxHeight; + state.height = height; + refreshInstance.callMethod(pullDown.callPullingDown, { + height: height + }); +} + +function touchEnd(e, ownerInstance) { + var state = e.instance.getState(); + if (!state.canPullDown) { + return + } + + state.refreshInstance.callMethod("onchange", false); + + var refreshInstance = state.refreshInstance; + if (state.height > pullDown.threshold) { + refreshInstance.callMethod(pullDown.callRefresh); + return; + } + + refreshInstance.setStyle({ + 'height': 0 + }); +} + +function propObserver(newValue, oldValue, instance) { + pullDown = newValue; +} + +module.exports = { + touchmove: touchMove, + touchstart: touchStart, + touchend: touchEnd, + propObserver: propObserver +} diff --git a/uni_modules/uni-list/package.json b/uni_modules/uni-list/package.json new file mode 100644 index 0000000..8350efc --- /dev/null +++ b/uni_modules/uni-list/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-list", + "displayName": "uni-list 列表", + "version": "1.2.14", + "description": "List 组件 ,帮助使用者快速构建列表。", + "keywords": [ + "", + "uni-ui", + "uniui", + "列表", + "", + "list" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-badge", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-list/readme.md b/uni_modules/uni-list/readme.md new file mode 100644 index 0000000..32c2865 --- /dev/null +++ b/uni_modules/uni-list/readme.md @@ -0,0 +1,346 @@ +## List 列表 +> **组件名:uni-list** +> 代码块: `uList`、`uListItem` +> 关联组件:`uni-list-item`、`uni-badge`、`uni-icons`、`uni-list-chat`、`uni-list-ad` + + +List 列表组件,包含基本列表样式、可扩展插槽机制、长列表性能优化、多端兼容。 + +在vue页面里,它默认使用页面级滚动。在app-nvue页面里,它默认使用原生list组件滚动。这样的长列表,在滚动出屏幕外后,系统会回收不可见区域的渲染内存资源,不会造成滚动越长手机越卡的问题。 + +uni-list组件是父容器,里面的核心是uni-list-item子组件,它代表列表中的一个可重复行,子组件可以无限循环。 + +uni-list-item有很多风格,uni-list-item组件通过内置的属性,满足一些常用的场景。当内置属性不满足需求时,可以通过扩展插槽来自定义列表内容。 + +内置属性可以覆盖的场景包括:导航列表、设置列表、小图标列表、通信录列表、聊天记录列表。 + +涉及很多大图或丰富内容的列表,比如类今日头条的新闻列表、类淘宝的电商列表,需要通过扩展插槽实现。 + +下文均有样例给出。 + +uni-list不包含下拉刷新和上拉翻页。上拉翻页另见组件:[uni-load-more](https://ext.dcloud.net.cn/plugin?id=29) + + +### 安装方式 + +本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。 + +如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55) + +> **注意事项** +> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。 +> - 组件需要依赖 `sass` 插件 ,请自行手动安装 +> - 组件内部依赖 `'uni-icons'` 、`uni-badge` 组件 +> - `uni-list` 和 `uni-list-item` 需要配套使用,暂不支持单独使用 `uni-list-item` +> - 只有开启点击反馈后,会有点击选中效果 +> - 使用插槽时,可以完全自定义内容 +> - note 、rightText 属性暂时没做限制,不支持文字溢出隐藏,使用时应该控制长度显示或通过默认插槽自行扩展 +> - 支付宝小程序平台需要在支付宝小程序开发者工具里开启 component2 编译模式,开启方式: 详情 --> 项目配置 --> 启用 component2 编译 +> - 如果需要修改 `switch`、`badge` 样式,请使用插槽自定义 +> - 在 `HBuilderX` 低版本中,可能会出现组件显示 `undefined` 的问题,请升级最新的 `HBuilderX` 或者 `cli` +> - 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + +### 基本用法 + +- 设置 `title` 属性,可以显示列表标题 +- 设置 `disabled` 属性,可以禁用当前项 + +```html + + + + + +``` + +### 多行内容显示 + +- 设置 `note` 属性 ,可以在第二行显示描述文本信息 + +```html + + + + + +``` + +### 右侧显示角标、switch + +- 设置 `show-badge` 属性 ,可以显示角标内容 +- 设置 `show-switch` 属性,可以显示 switch 开关 + +```html + + + + + +``` + +### 左侧显示略缩图、图标 + +- 设置 `thumb` 属性 ,可以在列表左侧显示略缩图 +- 设置 `show-extra-icon` 属性,并指定 `extra-icon` 可以在左侧显示图标 + +```html + + + + +``` + +### 开启点击反馈和右侧箭头 +- 设置 `clickable` 为 `true` ,则表示这是一个可点击的列表,会默认给一个点击效果,并可以监听 `click` 事件 +- 设置 `link` 属性,会自动开启点击反馈,并给列表右侧添加一个箭头 +- 设置 `to` 属性,可以跳转页面,`link` 的值表示跳转方式,如果不指定,默认为 `navigateTo` + +```html + + + + + + + +``` + + +### 聊天列表示例 +- 设置 `clickable` 为 `true` ,则表示这是一个可点击的列表,会默认给一个点击效果,并可以监听 `click` 事件 +- 设置 `link` 属性,会自动开启点击反馈,`link` 的值表示跳转方式,如果不指定,默认为 `navigateTo` +- 设置 `to` 属性,可以跳转页面 +- `time` 属性,通常会设置成时间显示,但是这个属性不仅仅可以设置时间,你可以传入任何文本,注意文本长度可能会影响显示 +- `avatar` 和 `avatarList` 属性同时只会有一个生效,同时设置的话,`avatarList` 属性的长度大于1 ,`avatar` 属性将失效 +- 可以通过默认插槽自定义列表右侧内容 + +```html + + + + + + + + + + + + + + + + + 刚刚 + + + + + + + +``` + +```javascript + +export default { + components: {}, + data() { + return { + avatarList: [{ + url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png' + }, { + url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png' + }, { + url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png' + }] + } + } +} + +``` + + +```css + +.chat-custom-right { + flex: 1; + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex-direction: column; + justify-content: space-between; + align-items: flex-end; +} + +.chat-custom-text { + font-size: 12px; + color: #999; +} + +``` + +## API + +### List Props + +属性名 |类型 |默认值 | 说明 +:-: |:-: |:-: | :-: +border |Boolean |true | 是否显示边框 + + +### ListItem Props + +属性名 |类型 |默认值 | 说明 +:-: |:-: |:-: | :-: +title |String |- | 标题 +note |String |- | 描述 +ellipsis |Number |0 | title 是否溢出隐藏,可选值,0:默认; 1:显示一行; 2:显示两行;【nvue 暂不支持】 +thumb |String |- | 左侧缩略图,若thumb有值,则不会显示扩展图标 +thumbSize |String |medium | 略缩图尺寸,可选值,lg:大图; medium:一般; sm:小图; +showBadge |Boolean |false | 是否显示数字角标 +badgeText |String |- | 数字角标内容 +badgeType |String |- | 数字角标类型,参考[uni-icons](https://ext.dcloud.net.cn/plugin?id=21) +badgeStyle |Object |- | 数字角标样式,使用uni-badge的custom-style参数 +rightText |String |- | 右侧文字内容 +disabled |Boolean |false | 是否禁用 +showArrow |Boolean |true | 是否显示箭头图标 +link |String |navigateTo | 新页面跳转方式,可选值见下表 +to |String |- | 新页面跳转地址,如填写此属性,click 会返回页面是否跳转成功 +clickable |Boolean |false | 是否开启点击反馈 +showSwitch |Boolean |false | 是否显示Switch +switchChecked |Boolean |false | Switch是否被选中 +showExtraIcon |Boolean |false | 左侧是否显示扩展图标 +extraIcon |Object |- | 扩展图标参数,格式为 ``{color: '#4cd964',size: '22',type: 'spinner'}``,参考 [uni-icons](https://ext.dcloud.net.cn/plugin?id=28) +direction | String |row | 排版方向,可选值,row:水平排列; column:垂直排列; 3个插槽是水平排还是垂直排,也受此属性控制 + + +#### Link Options + +属性名 | 说明 +:-: | :-: +navigateTo | 同 uni.navigateTo() +redirectTo | 同 uni.reLaunch() +reLaunch | 同 uni.reLaunch() +switchTab | 同 uni.switchTab() + +### ListItem Events + +事件称名 |说明 |返回参数 +:-: |:-: |:-: +click |点击 uniListItem 触发事件,需开启点击反馈 |- +switchChange |点击切换 Switch 时触发,需显示 switch |e={value:checked} + + + +### ListItem Slots + +名称 | 说明 +:-: | :-: +header | 左/上内容插槽,可完全自定义默认显示 +body | 中间内容插槽,可完全自定义中间内容 +footer | 右/下内容插槽,可完全自定义右侧内容 + + +> **通过插槽扩展** +> 需要注意的是当使用插槽时,内置样式将会失效,只保留排版样式,此时的样式需要开发者自己实现 +> 如果 `uni-list-item` 组件内置属性样式无法满足需求,可以使用插槽来自定义uni-list-item里的内容。 +> uni-list-item提供了3个可扩展的插槽:`header`、`body`、`footer` +> - 当 `direction` 属性为 `row` 时表示水平排列,此时 `header` 表示列表的左边部分,`body` 表示列表的中间部分,`footer` 表示列表的右边部分 +> - 当 `direction` 属性为 `column` 时表示垂直排列,此时 `header` 表示列表的上边部分,`body` 表示列表的中间部分,`footer` 表示列表的下边部分 +> 开发者可以只用1个插槽,也可以3个一起使用。在插槽中可自主编写view标签,实现自己所需的效果。 + + +**示例** + +```html + + + + + + + + + 自定义插槽 + + + + +``` + + + + + +### ListItemChat Props + +属性名 |类型 |默认值 | 说明 +:-: |:-: |:-: | :-: +title |String |- | 标题 +note |String |- | 描述 +clickable |Boolean |false | 是否开启点击反馈 +badgeText |String |- | 数字角标内容,设置为 `dot` 将显示圆点 +badgePositon |String |right | 角标位置 +link |String |navigateTo | 是否展示右侧箭头并开启点击反馈,可选值见下表 +clickable |Boolean |false | 是否开启点击反馈 +to |String |- | 跳转页面地址,如填写此属性,click 会返回页面是否跳转成功 +time |String |- | 右侧时间显示 +avatarCircle |Boolean |false | 是否显示圆形头像 +avatar |String |- | 头像地址,avatarCircle 不填时生效 +avatarList |Array |- | 头像组,格式为 [{url:''}] + +#### Link Options + +属性名 | 说明 +:-: | :-: +navigateTo | 同 uni.navigateTo() +redirectTo | 同 uni.reLaunch() +reLaunch | 同 uni.reLaunch() +switchTab | 同 uni.switchTab() + +### ListItemChat Slots + +名称 | 说明 +:- | :- +default | 自定义列表右侧内容(包括时间和角标显示) + +### ListItemChat Events +事件称名 | 说明 | 返回参数 +:-: | :-: | :-: +@click | 点击 uniListChat 触发事件 | {data:{}} ,如有 to 属性,会返回页面跳转信息 + + + + + + +## 基于uni-list扩展的页面模板 + +通过扩展插槽,可实现多种常见样式的列表 + +**新闻列表类** + +1. 云端一体混合布局:[https://ext.dcloud.net.cn/plugin?id=2546](https://ext.dcloud.net.cn/plugin?id=2546) +2. 云端一体垂直布局,大图模式:[https://ext.dcloud.net.cn/plugin?id=2583](https://ext.dcloud.net.cn/plugin?id=2583) +3. 云端一体垂直布局,多行图文混排:[https://ext.dcloud.net.cn/plugin?id=2584](https://ext.dcloud.net.cn/plugin?id=2584) +4. 云端一体垂直布局,多图模式:[https://ext.dcloud.net.cn/plugin?id=2585](https://ext.dcloud.net.cn/plugin?id=2585) +5. 云端一体水平布局,左图右文:[https://ext.dcloud.net.cn/plugin?id=2586](https://ext.dcloud.net.cn/plugin?id=2586) +6. 云端一体水平布局,左文右图:[https://ext.dcloud.net.cn/plugin?id=2587](https://ext.dcloud.net.cn/plugin?id=2587) +7. 云端一体垂直布局,无图模式,主标题+副标题:[https://ext.dcloud.net.cn/plugin?id=2588](https://ext.dcloud.net.cn/plugin?id=2588) + +**商品列表类** + +1. 云端一体列表/宫格视图互切:[https://ext.dcloud.net.cn/plugin?id=2651](https://ext.dcloud.net.cn/plugin?id=2651) +2. 云端一体列表(宫格模式):[https://ext.dcloud.net.cn/plugin?id=2671](https://ext.dcloud.net.cn/plugin?id=2671) +3. 云端一体列表(列表模式):[https://ext.dcloud.net.cn/plugin?id=2672](https://ext.dcloud.net.cn/plugin?id=2672) + +## 组件示例 + +点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/list/list](https://hellouniapp.dcloud.net.cn/pages/extUI/list/list) \ No newline at end of file diff --git a/uni_modules/uni-load-more/changelog.md b/uni_modules/uni-load-more/changelog.md new file mode 100644 index 0000000..8f03f1d --- /dev/null +++ b/uni_modules/uni-load-more/changelog.md @@ -0,0 +1,19 @@ +## 1.3.3(2022-01-20) +- 新增 showText属性 ,是否显示文本 +## 1.3.2(2022-01-19) +- 修复 nvue 平台下不显示文本的bug +## 1.3.1(2022-01-19) +- 修复 微信小程序平台样式选择器报警告的问题 +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-load-more](https://uniapp.dcloud.io/component/uniui/uni-load-more) +## 1.2.1(2021-08-24) +- 新增 支持国际化 +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.8(2021-05-12) +- 新增 组件示例地址 +## 1.1.7(2021-03-30) +- 修复 uni-load-more 在首页使用时,h5 平台报 'uni is not defined' 的 bug +## 1.1.6(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json new file mode 100644 index 0000000..a4f14a5 --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "Pull up to show more", + "uni-load-more.contentrefresh": "loading...", + "uni-load-more.contentnomore": "No more data" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js b/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json new file mode 100644 index 0000000..f15d510 --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "上拉显示更多", + "uni-load-more.contentrefresh": "正在加载...", + "uni-load-more.contentnomore": "没有更多数据了" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json new file mode 100644 index 0000000..a255c6d --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "上拉顯示更多", + "uni-load-more.contentrefresh": "正在加載...", + "uni-load-more.contentnomore": "沒有更多數據了" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue b/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue new file mode 100644 index 0000000..e5eff4d --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue @@ -0,0 +1,399 @@ + + + + + diff --git a/uni_modules/uni-load-more/package.json b/uni_modules/uni-load-more/package.json new file mode 100644 index 0000000..2fa6f04 --- /dev/null +++ b/uni_modules/uni-load-more/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-load-more", + "displayName": "uni-load-more 加载更多", + "version": "1.3.3", + "description": "LoadMore 组件,常用在列表里面,做滚动加载使用。", + "keywords": [ + "uni-ui", + "uniui", + "加载更多", + "load-more" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-load-more/readme.md b/uni_modules/uni-load-more/readme.md new file mode 100644 index 0000000..54dc1fa --- /dev/null +++ b/uni_modules/uni-load-more/readme.md @@ -0,0 +1,14 @@ + + +### LoadMore 加载更多 +> **组件名:uni-load-more** +> 代码块: `uLoadMore` + + +用于列表中,做滚动加载使用,展示 loading 的各种状态。 + + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-load-more) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-nav-bar/changelog.md b/uni_modules/uni-nav-bar/changelog.md new file mode 100644 index 0000000..0f9a2f1 --- /dev/null +++ b/uni_modules/uni-nav-bar/changelog.md @@ -0,0 +1,51 @@ +## 1.3.11(2023-03-29) +- 修复 自定义状态栏高度闪动BUG +## 1.3.10(2023-03-29) +- 修复 暗黑模式下边线颜色错误的bug +## 1.3.9(2022-10-13) +- 修复 条件编译错误的bug +## 1.3.8(2022-10-12) +- 修复 nvue 环境 fixed 为 true 的情况下,无法置顶的 bug +## 1.3.7(2022-08-11) +- 修复 nvue 环境下 fixed 为 true 的情况下,无法置顶的 bug +## 1.3.6(2022-06-30) +- 修复 组件示例中插槽用法无法显示内容的bug +## 1.3.5(2022-05-24) +- 新增 stat 属性 ,可开启统计title 上报 ,仅使用了title 属性且项目开启了uni统计生效 +## 1.3.4(2022-01-24) +- 更新 组件示例 +## 1.3.3(2022-01-24) +- 新增 left-width/right-width属性 ,可修改左右两侧的宽度 +## 1.3.2(2022-01-18) +- 修复 在vue下,标题不垂直居中的bug +## 1.3.1(2022-01-18) +- 修复 height 属性类型错误 +## 1.3.0(2022-01-18) +- 新增 height 属性,可修改组件高度 +- 新增 dark 属性可可开启暗黑模式 +- 优化 标题字数过多显示省略号 +- 优化 插槽,插入内容可完全覆盖 +## 1.2.1(2022-01-10) +- 修复 color 属性不生效的bug +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-nav-bar](https://uniapp.dcloud.io/component/uniui/uni-nav-bar) +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.11(2021-05-12) +- 新增 组件示例地址 +## 1.0.10(2021-04-30) +- 修复 在nvue下fixed为true,宽度不能撑满的Bug +## 1.0.9(2021-04-21) +- 优化 添加依赖 uni-icons, 导入后自动下载依赖 +## 1.0.8(2021-04-14) +- uni-ui 修复 uni-nav-bar 当 fixed 属性为 true 时铺不满屏幕的 bug + +## 1.0.7(2021-02-25) +- 修复 easycom 下,找不到 uni-status-bar 的bug + +## 1.0.6(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.5(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue b/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue new file mode 100644 index 0000000..c890860 --- /dev/null +++ b/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue @@ -0,0 +1,357 @@ + + + + + diff --git a/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar.vue b/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar.vue new file mode 100644 index 0000000..4ac73ae --- /dev/null +++ b/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/uni_modules/uni-nav-bar/package.json b/uni_modules/uni-nav-bar/package.json new file mode 100644 index 0000000..240ae95 --- /dev/null +++ b/uni_modules/uni-nav-bar/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-nav-bar", + "displayName": "uni-nav-bar 自定义导航栏", + "version": "1.3.11", + "description": "自定义导航栏组件,主要用于头部导航。", + "keywords": [ + "uni-ui", + "导航", + "导航栏", + "自定义导航栏" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-nav-bar/readme.md b/uni_modules/uni-nav-bar/readme.md new file mode 100644 index 0000000..3934b32 --- /dev/null +++ b/uni_modules/uni-nav-bar/readme.md @@ -0,0 +1,15 @@ + + +## NavBar 导航栏 +> **组件名:uni-nav-bar** +> 代码块: `uNavBar` + +导航栏组件,主要用于头部导航。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-nav-bar) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + + + + diff --git a/uni_modules/uni-notice-bar/changelog.md b/uni_modules/uni-notice-bar/changelog.md new file mode 100644 index 0000000..d526811 --- /dev/null +++ b/uni_modules/uni-notice-bar/changelog.md @@ -0,0 +1,18 @@ +## 1.2.1(2022-09-05) +- 新增 属性 fontSize,可修改文字大小。 +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-notice-bar](https://uniapp.dcloud.io/component/uniui/uni-notice-bar) +## 1.1.1(2021-11-09) +- 新增 提供组件设计资源,组件样式调整 +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.9(2021-05-12) +- 新增 组件示例地址 +## 1.0.8(2021-04-21) +- 优化 添加依赖 uni-icons, 导入后自动下载依赖 +## 1.0.7(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.6(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-notice-bar/components/uni-notice-bar/uni-notice-bar.vue b/uni_modules/uni-notice-bar/components/uni-notice-bar/uni-notice-bar.vue new file mode 100644 index 0000000..98d4720 --- /dev/null +++ b/uni_modules/uni-notice-bar/components/uni-notice-bar/uni-notice-bar.vue @@ -0,0 +1,426 @@ + + + + + diff --git a/uni_modules/uni-notice-bar/package.json b/uni_modules/uni-notice-bar/package.json new file mode 100644 index 0000000..8d9b13c --- /dev/null +++ b/uni_modules/uni-notice-bar/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-notice-bar", + "displayName": "uni-notice-bar 通告栏", + "version": "1.2.1", + "description": "NoticeBar 通告栏组件,常用于展示公告信息,可设为滚动公告", + "keywords": [ + "uni-ui", + "uniui", + "通告栏", + "公告", + "跑马灯" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-notice-bar/readme.md b/uni_modules/uni-notice-bar/readme.md new file mode 100644 index 0000000..fb2ede2 --- /dev/null +++ b/uni_modules/uni-notice-bar/readme.md @@ -0,0 +1,13 @@ + + +## NoticeBar 通告栏 +> **组件名:uni-notice-bar** +> 代码块: `uNoticeBar` + + +通告栏组件 。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-notice-bar) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-number-box/changelog.md b/uni_modules/uni-number-box/changelog.md new file mode 100644 index 0000000..aab060d --- /dev/null +++ b/uni_modules/uni-number-box/changelog.md @@ -0,0 +1,29 @@ +## 1.2.3(2023-05-23) +更新示例工程 +## 1.2.2(2023-05-08) +- 修复 change 事件执行顺序错误的问题 +## 1.2.1(2021-11-22) +- 修复 vue3中某些scss变量无法找到的问题 +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-number-box](https://uniapp.dcloud.io/component/uniui/uni-number-box) +## 1.1.2(2021-11-09) +- 新增 提供组件设计资源,组件样式调整 +## 1.1.1(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.1.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.7(2021-05-12) +- 新增 组件示例地址 +## 1.0.6(2021-04-20) +- 修复 uni-number-box 浮点数运算不精确的 bug +- 修复 uni-number-box change 事件触发不正确的 bug +- 新增 uni-number-box v-model 双向绑定 +## 1.0.5(2021-02-05) +- 调整为uni_modules目录规范 + +## 1.0.7(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 支持 v-model +- 新增 支持 focus、blur 事件 +- 新增 支持 PC 端 diff --git a/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue b/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue new file mode 100644 index 0000000..9a8d098 --- /dev/null +++ b/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue @@ -0,0 +1,230 @@ + + + \ No newline at end of file diff --git a/uni_modules/uni-number-box/package.json b/uni_modules/uni-number-box/package.json new file mode 100644 index 0000000..743d2e4 --- /dev/null +++ b/uni_modules/uni-number-box/package.json @@ -0,0 +1,82 @@ +{ + "id": "uni-number-box", + "displayName": "uni-number-box 数字输入框", + "version": "1.2.3", + "description": "NumberBox 带加减按钮的数字输入框组件,用户可以控制每次点击增加的数值,支持小数。", + "keywords": [ + "uni-ui", + "uniui", + "数字输入框" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-number-box/readme.md b/uni_modules/uni-number-box/readme.md new file mode 100644 index 0000000..affc56f --- /dev/null +++ b/uni_modules/uni-number-box/readme.md @@ -0,0 +1,13 @@ + + +## NumberBox 数字输入框 +> **组件名:uni-number-box** +> 代码块: `uNumberBox` + + +带加减按钮的数字输入框。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-number-box) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-pagination/changelog.md b/uni_modules/uni-pagination/changelog.md new file mode 100644 index 0000000..2e94adc --- /dev/null +++ b/uni_modules/uni-pagination/changelog.md @@ -0,0 +1,27 @@ +## 1.2.4(2022-09-19) +- 修复,未对主题色设置默认色,导致未引入 uni-scss 变量文件报错。 +- 修复,未对移动端当前页文字做主题色适配。 +## 1.2.3(2022-09-15) +- 修复未使用 uni-scss 主题色的 bug。 +## 1.2.2(2022-07-06) +- 修复 es 语言 i18n 错误 +## 1.2.1(2021-11-22) +- 修复 vue3中某些scss变量无法找到的问题 +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-pagination](https://uniapp.dcloud.io/component/uniui/uni-pagination) +## 1.1.2(2021-10-08) +- 修复 current 、value 属性未监听,导致高亮样式失效的 bug +## 1.1.1(2021-08-20) +- 新增 支持国际化 +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.7(2021-05-12) +- 新增 组件示例地址 +## 1.0.6(2021-04-12) +- 新增 PC 和 移动端适配不同的 ui +## 1.0.5(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.4(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-pagination/components/uni-pagination/i18n/en.json b/uni_modules/uni-pagination/components/uni-pagination/i18n/en.json new file mode 100644 index 0000000..d6e2897 --- /dev/null +++ b/uni_modules/uni-pagination/components/uni-pagination/i18n/en.json @@ -0,0 +1,5 @@ +{ + "uni-pagination.prevText": "prev", + "uni-pagination.nextText": "next", + "uni-pagination.piecePerPage": "piece/page" +} diff --git a/uni_modules/uni-pagination/components/uni-pagination/i18n/es.json b/uni_modules/uni-pagination/components/uni-pagination/i18n/es.json new file mode 100644 index 0000000..604a113 --- /dev/null +++ b/uni_modules/uni-pagination/components/uni-pagination/i18n/es.json @@ -0,0 +1,5 @@ +{ + "uni-pagination.prevText": "anterior", + "uni-pagination.nextText": "prxima", + "uni-pagination.piecePerPage": "Artculo/Pgina" +} diff --git a/uni_modules/uni-pagination/components/uni-pagination/i18n/fr.json b/uni_modules/uni-pagination/components/uni-pagination/i18n/fr.json new file mode 100644 index 0000000..a7a0c77 --- /dev/null +++ b/uni_modules/uni-pagination/components/uni-pagination/i18n/fr.json @@ -0,0 +1,5 @@ +{ + "uni-pagination.prevText": "précédente", + "uni-pagination.nextText": "suivante", + "uni-pagination.piecePerPage": "Articles/Pages" +} diff --git a/uni_modules/uni-pagination/components/uni-pagination/i18n/index.js b/uni_modules/uni-pagination/components/uni-pagination/i18n/index.js new file mode 100644 index 0000000..2469dd0 --- /dev/null +++ b/uni_modules/uni-pagination/components/uni-pagination/i18n/index.js @@ -0,0 +1,12 @@ +import en from './en.json' +import es from './es.json' +import fr from './fr.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + es, + fr, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-pagination/components/uni-pagination/i18n/zh-Hans.json b/uni_modules/uni-pagination/components/uni-pagination/i18n/zh-Hans.json new file mode 100644 index 0000000..782bbe4 --- /dev/null +++ b/uni_modules/uni-pagination/components/uni-pagination/i18n/zh-Hans.json @@ -0,0 +1,5 @@ +{ + "uni-pagination.prevText": "上一页", + "uni-pagination.nextText": "下一页", + "uni-pagination.piecePerPage": "条/页" +} diff --git a/uni_modules/uni-pagination/components/uni-pagination/i18n/zh-Hant.json b/uni_modules/uni-pagination/components/uni-pagination/i18n/zh-Hant.json new file mode 100644 index 0000000..180fddb --- /dev/null +++ b/uni_modules/uni-pagination/components/uni-pagination/i18n/zh-Hant.json @@ -0,0 +1,5 @@ +{ + "uni-pagination.prevText": "上一頁", + "uni-pagination.nextText": "下一頁", + "uni-pagination.piecePerPage": "條/頁" +} diff --git a/uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue b/uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue new file mode 100644 index 0000000..5305b5f --- /dev/null +++ b/uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue @@ -0,0 +1,465 @@ + + + + + diff --git a/uni_modules/uni-pagination/package.json b/uni_modules/uni-pagination/package.json new file mode 100644 index 0000000..862d5ab --- /dev/null +++ b/uni_modules/uni-pagination/package.json @@ -0,0 +1,83 @@ +{ + "id": "uni-pagination", + "displayName": "uni-pagination 分页器", + "version": "1.2.4", + "description": "Pagination 分页器组件,用于展示页码、请求数据等。", + "keywords": [ + "uni-ui", + "uniui", + "分页器", + "页码" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss","uni-icons"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-pagination/readme.md b/uni_modules/uni-pagination/readme.md new file mode 100644 index 0000000..97ea1d6 --- /dev/null +++ b/uni_modules/uni-pagination/readme.md @@ -0,0 +1,11 @@ + + +## Pagination 分页器 +> **组件名:uni-pagination** +> 代码块: `uPagination` + + +分页器组件,用于展示页码、请求数据等。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-pagination) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 diff --git a/uni_modules/uni-popup/changelog.md b/uni_modules/uni-popup/changelog.md new file mode 100644 index 0000000..bc59f07 --- /dev/null +++ b/uni_modules/uni-popup/changelog.md @@ -0,0 +1,68 @@ +## 1.8.3(2023-04-17) +- 修复 uni-popup 重复打开时的 bug +## 1.8.2(2023-02-02) +- uni-popup-dialog 组件新增 inputType 属性 +## 1.8.1(2022-12-01) +- 修复 nvue 下 v-show 报错 +## 1.8.0(2022-11-29) +- 优化 主题样式 +## 1.7.9(2022-04-02) +- 修复 弹出层内部无法滚动的bug +## 1.7.8(2022-03-28) +- 修复 小程序中高度错误的bug +## 1.7.7(2022-03-17) +- 修复 快速调用open出现问题的Bug +## 1.7.6(2022-02-14) +- 修复 safeArea 属性不能设置为false的bug +## 1.7.5(2022-01-19) +- 修复 isMaskClick 失效的bug +## 1.7.4(2022-01-19) +- 新增 cancelText \ confirmText 属性 ,可自定义文本 +- 新增 maskBackgroundColor 属性 ,可以修改蒙版颜色 +- 优化 maskClick属性 更新为 isMaskClick ,解决微信小程序警告的问题 +## 1.7.3(2022-01-13) +- 修复 设置 safeArea 属性不生效的bug +## 1.7.2(2021-11-26) +- 优化 组件示例 +## 1.7.1(2021-11-26) +- 修复 vuedoc 文字错误 +## 1.7.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-popup](https://uniapp.dcloud.io/component/uniui/uni-popup) +## 1.6.2(2021-08-24) +- 新增 支持国际化 +## 1.6.1(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.6.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.5.0(2021-06-23) +- 新增 mask-click 遮罩层点击事件 +## 1.4.5(2021-06-22) +- 修复 nvue 平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug +## 1.4.4(2021-06-18) +- 修复 H5平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug +## 1.4.3(2021-06-08) +- 修复 错误的 watch 字段 +- 修复 safeArea 属性不生效的问题 +- 修复 点击内容,再点击遮罩无法关闭的Bug +## 1.4.2(2021-05-12) +- 新增 组件示例地址 +## 1.4.1(2021-04-29) +- 修复 组件内放置 input 、textarea 组件,无法聚焦的问题 +## 1.4.0 (2021-04-29) +- 新增 type 属性的 left\right 值,支持左右弹出 +- 新增 open(String:type) 方法参数 ,可以省略 type 属性 ,直接传入类型打开指定弹窗 +- 新增 backgroundColor 属性,可定义主窗口背景色,默认不显示背景色 +- 新增 safeArea 属性,是否适配底部安全区 +- 修复 App\h5\微信小程序底部安全区占位不对的Bug +- 修复 App 端弹出等待的Bug +- 优化 提升低配设备性能,优化动画卡顿问题 +- 优化 更简单的组件自定义方式 +## 1.2.9(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 +## 1.2.8(2021-02-05) +- 调整为uni_modules目录规范 +## 1.2.7(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 支持 PC 端 +- 新增 uni-popup-message 、uni-popup-dialog扩展组件支持 PC 端 diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js new file mode 100644 index 0000000..6ef26a2 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + this.$once('hook:beforeDestroy', () => { + document.removeEventListener('keyup', listener) + }) + }, + render: () => {} +} +// #endif diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue new file mode 100644 index 0000000..47352f5 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue @@ -0,0 +1,336 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue new file mode 100644 index 0000000..91370a8 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue @@ -0,0 +1,143 @@ + + + + diff --git a/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue new file mode 100644 index 0000000..5be7624 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue @@ -0,0 +1,187 @@ + + + + diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/en.json b/uni_modules/uni-popup/components/uni-popup/i18n/en.json new file mode 100644 index 0000000..7f1bd06 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/en.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "cancel", + "uni-popup.ok": "ok", + "uni-popup.placeholder": "pleace enter", + "uni-popup.title": "Hint", + "uni-popup.shareTitle": "Share to" +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/index.js b/uni_modules/uni-popup/components/uni-popup/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json new file mode 100644 index 0000000..5e3003c --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "取消", + "uni-popup.ok": "确定", + "uni-popup.placeholder": "请输入", + "uni-popup.title": "提示", + "uni-popup.shareTitle": "分享到" +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json new file mode 100644 index 0000000..13e39eb --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "取消", + "uni-popup.ok": "確定", + "uni-popup.placeholder": "請輸入", + "uni-popup.title": "提示", + "uni-popup.shareTitle": "分享到" +} diff --git a/uni_modules/uni-popup/components/uni-popup/keypress.js b/uni_modules/uni-popup/components/uni-popup/keypress.js new file mode 100644 index 0000000..62dda46 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + // this.$once('hook:beforeDestroy', () => { + // document.removeEventListener('keyup', listener) + // }) + }, + render: () => {} +} +// #endif diff --git a/uni_modules/uni-popup/components/uni-popup/popup.js b/uni_modules/uni-popup/components/uni-popup/popup.js new file mode 100644 index 0000000..c4e5781 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/popup.js @@ -0,0 +1,26 @@ + +export default { + data() { + return { + + } + }, + created(){ + this.popup = this.getParent() + }, + methods:{ + /** + * 获取父元素实例 + */ + getParent(name = 'uniPopup') { + let parent = this.$parent; + let parentName = parent.$options.name; + while (parentName !== name) { + parent = parent.$parent; + if (!parent) return false + parentName = parent.$options.name; + } + return parent; + }, + } +} diff --git a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue new file mode 100644 index 0000000..54afee2 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue @@ -0,0 +1,473 @@ + + + + diff --git a/uni_modules/uni-popup/package.json b/uni_modules/uni-popup/package.json new file mode 100644 index 0000000..f40556b --- /dev/null +++ b/uni_modules/uni-popup/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-popup", + "displayName": "uni-popup 弹出层", + "version": "1.8.3", + "description": " Popup 组件,提供常用的弹层", + "keywords": [ + "uni-ui", + "弹出层", + "弹窗", + "popup", + "弹框" + ], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-transition" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-popup/readme.md b/uni_modules/uni-popup/readme.md new file mode 100644 index 0000000..fdad4b3 --- /dev/null +++ b/uni_modules/uni-popup/readme.md @@ -0,0 +1,17 @@ + + +## Popup 弹出层 +> **组件名:uni-popup** +> 代码块: `uPopup` +> 关联组件:`uni-transition` + + +弹出层组件,在应用中弹出一个消息提示窗口、提示框等 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-popup) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + + + + diff --git a/uni_modules/uni-rate/changelog.md b/uni_modules/uni-rate/changelog.md new file mode 100644 index 0000000..8a98a61 --- /dev/null +++ b/uni_modules/uni-rate/changelog.md @@ -0,0 +1,25 @@ +## 1.3.1(2022-02-25) +- 修复 条件判断 `NaN` 错误的 bug +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-rate](https://uniapp.dcloud.io/component/uniui/uni-rate) +## 1.2.2(2021-09-10) +- 优化 默认值修改为 0 颗星 +## 1.2.1(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.2.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.2(2021-05-12) +- 新增 组件示例地址 +## 1.1.1(2021-04-21) +- 修复 布局变化后 uni-rate 星星计算不准确的 bug +- 优化 添加依赖 uni-icons, 导入 uni-rate 自动下载依赖 +## 1.1.0(2021-04-16) +- 修复 uni-rate 属性 margin 值为 string 组件失效的 bug + +## 1.0.9(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.8(2021-02-05) +- 调整为uni_modules目录规范 +- 支持 pc 端 diff --git a/uni_modules/uni-rate/components/uni-rate/uni-rate.vue b/uni_modules/uni-rate/components/uni-rate/uni-rate.vue new file mode 100644 index 0000000..857f5f9 --- /dev/null +++ b/uni_modules/uni-rate/components/uni-rate/uni-rate.vue @@ -0,0 +1,361 @@ + + + + + diff --git a/uni_modules/uni-rate/package.json b/uni_modules/uni-rate/package.json new file mode 100644 index 0000000..64e8e33 --- /dev/null +++ b/uni_modules/uni-rate/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-rate", + "displayName": "uni-rate 评分", + "version": "1.3.1", + "description": "Rate 评分组件,可自定义评分星星图标的大小、间隔、评分数。", + "keywords": [ + "uni-ui", + "uniui", + "评分" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-rate/readme.md b/uni_modules/uni-rate/readme.md new file mode 100644 index 0000000..eae7b5c --- /dev/null +++ b/uni_modules/uni-rate/readme.md @@ -0,0 +1,12 @@ + + +## Rate 评分 +> **组件名:uni-rate** +> 代码块: `uRate` +> 关联组件:`uni-icons` + + +评分组件,多用于购买商品后,对商品进行评价等场景 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-rate) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-row/changelog.md b/uni_modules/uni-row/changelog.md new file mode 100644 index 0000000..5b465bc --- /dev/null +++ b/uni_modules/uni-row/changelog.md @@ -0,0 +1,10 @@ +## 1.0.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-row](https://uniapp.dcloud.io/component/uniui/uni-row) +## 0.1.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 0.0.4(2021-05-12) +- 新增 组件示例地址 +## 0.0.3(2021-02-05) +- 调整为uni_modules目录规范 +- 新增uni-row组件 diff --git a/uni_modules/uni-row/components/uni-col/uni-col.vue b/uni_modules/uni-row/components/uni-col/uni-col.vue new file mode 100644 index 0000000..84e2deb --- /dev/null +++ b/uni_modules/uni-row/components/uni-col/uni-col.vue @@ -0,0 +1,317 @@ + + + + + diff --git a/uni_modules/uni-row/components/uni-row/uni-row.vue b/uni_modules/uni-row/components/uni-row/uni-row.vue new file mode 100644 index 0000000..f8e8542 --- /dev/null +++ b/uni_modules/uni-row/components/uni-row/uni-row.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/uni_modules/uni-row/package.json b/uni_modules/uni-row/package.json new file mode 100644 index 0000000..3f52fa6 --- /dev/null +++ b/uni_modules/uni-row/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-row", + "displayName": "uni-row 布局-行", + "version": "1.0.0", + "description": "流式栅格系统,随着屏幕或视口分为 24 份,可以迅速简便地创建布局。", + "keywords": [ + "uni-ui", + "uniui", + "栅格", + "布局", + "layout" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "u" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-row/readme.md b/uni_modules/uni-row/readme.md new file mode 100644 index 0000000..3c9c8b9 --- /dev/null +++ b/uni_modules/uni-row/readme.md @@ -0,0 +1,10 @@ +## Layout 布局 + +> **组件名 uni-row、uni-col** +> 代码块: `uRow`、`uCol` + + +流式栅格系统,随着屏幕或视口分为 24 份,可以迅速简便地创建布局。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-row) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-scss/changelog.md b/uni_modules/uni-scss/changelog.md new file mode 100644 index 0000000..b863bb0 --- /dev/null +++ b/uni_modules/uni-scss/changelog.md @@ -0,0 +1,8 @@ +## 1.0.3(2022-01-21) +- 优化 组件示例 +## 1.0.2(2021-11-22) +- 修复 / 符号在 vue 不同版本兼容问题引起的报错问题 +## 1.0.1(2021-11-22) +- 修复 vue3中scss语法兼容问题 +## 1.0.0(2021-11-18) +- init diff --git a/uni_modules/uni-scss/index.scss b/uni_modules/uni-scss/index.scss new file mode 100644 index 0000000..1744a5f --- /dev/null +++ b/uni_modules/uni-scss/index.scss @@ -0,0 +1 @@ +@import './styles/index.scss'; diff --git a/uni_modules/uni-scss/package.json b/uni_modules/uni-scss/package.json new file mode 100644 index 0000000..7cc0ccb --- /dev/null +++ b/uni_modules/uni-scss/package.json @@ -0,0 +1,82 @@ +{ + "id": "uni-scss", + "displayName": "uni-scss 辅助样式", + "version": "1.0.3", + "description": "uni-sass是uni-ui提供的一套全局样式 ,通过一些简单的类名和sass变量,实现简单的页面布局操作,比如颜色、边距、圆角等。", + "keywords": [ + "uni-scss", + "uni-ui", + "辅助样式" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "category": [ + "JS SDK", + "通用 SDK" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "n", + "联盟": "n" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-scss/readme.md b/uni_modules/uni-scss/readme.md new file mode 100644 index 0000000..b7d1c25 --- /dev/null +++ b/uni_modules/uni-scss/readme.md @@ -0,0 +1,4 @@ +`uni-sass` 是 `uni-ui`提供的一套全局样式 ,通过一些简单的类名和`sass`变量,实现简单的页面布局操作,比如颜色、边距、圆角等。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-sass) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/index.scss b/uni_modules/uni-scss/styles/index.scss new file mode 100644 index 0000000..ffac4fe --- /dev/null +++ b/uni_modules/uni-scss/styles/index.scss @@ -0,0 +1,7 @@ +@import './setting/_variables.scss'; +@import './setting/_border.scss'; +@import './setting/_color.scss'; +@import './setting/_space.scss'; +@import './setting/_radius.scss'; +@import './setting/_text.scss'; +@import './setting/_styles.scss'; diff --git a/uni_modules/uni-scss/styles/setting/_border.scss b/uni_modules/uni-scss/styles/setting/_border.scss new file mode 100644 index 0000000..12a11c3 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_border.scss @@ -0,0 +1,3 @@ +.uni-border { + border: 1px $uni-border-1 solid; +} \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/setting/_color.scss b/uni_modules/uni-scss/styles/setting/_color.scss new file mode 100644 index 0000000..1ededd9 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_color.scss @@ -0,0 +1,66 @@ + +// TODO 暂时不需要 class ,需要用户使用变量实现 ,如果使用类名其实并不推荐 +// @mixin get-styles($k,$c) { +// @if $k == size or $k == weight{ +// font-#{$k}:#{$c} +// }@else{ +// #{$k}:#{$c} +// } +// } +$uni-ui-color:( + // 主色 + primary: $uni-primary, + primary-disable: $uni-primary-disable, + primary-light: $uni-primary-light, + // 辅助色 + success: $uni-success, + success-disable: $uni-success-disable, + success-light: $uni-success-light, + warning: $uni-warning, + warning-disable: $uni-warning-disable, + warning-light: $uni-warning-light, + error: $uni-error, + error-disable: $uni-error-disable, + error-light: $uni-error-light, + info: $uni-info, + info-disable: $uni-info-disable, + info-light: $uni-info-light, + // 中性色 + main-color: $uni-main-color, + base-color: $uni-base-color, + secondary-color: $uni-secondary-color, + extra-color: $uni-extra-color, + // 背景色 + bg-color: $uni-bg-color, + // 边框颜色 + border-1: $uni-border-1, + border-2: $uni-border-2, + border-3: $uni-border-3, + border-4: $uni-border-4, + // 黑色 + black:$uni-black, + // 白色 + white:$uni-white, + // 透明 + transparent:$uni-transparent +) !default; +@each $key, $child in $uni-ui-color { + .uni-#{"" + $key} { + color: $child; + } + .uni-#{"" + $key}-bg { + background-color: $child; + } +} +.uni-shadow-sm { + box-shadow: $uni-shadow-sm; +} +.uni-shadow-base { + box-shadow: $uni-shadow-base; +} +.uni-shadow-lg { + box-shadow: $uni-shadow-lg; +} +.uni-mask { + background-color:$uni-mask; +} diff --git a/uni_modules/uni-scss/styles/setting/_radius.scss b/uni_modules/uni-scss/styles/setting/_radius.scss new file mode 100644 index 0000000..9a0428b --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_radius.scss @@ -0,0 +1,55 @@ +@mixin radius($r,$d:null ,$important: false){ + $radius-value:map-get($uni-radius, $r) if($important, !important, null); + // Key exists within the $uni-radius variable + @if (map-has-key($uni-radius, $r) and $d){ + @if $d == t { + border-top-left-radius:$radius-value; + border-top-right-radius:$radius-value; + }@else if $d == r { + border-top-right-radius:$radius-value; + border-bottom-right-radius:$radius-value; + }@else if $d == b { + border-bottom-left-radius:$radius-value; + border-bottom-right-radius:$radius-value; + }@else if $d == l { + border-top-left-radius:$radius-value; + border-bottom-left-radius:$radius-value; + }@else if $d == tl { + border-top-left-radius:$radius-value; + }@else if $d == tr { + border-top-right-radius:$radius-value; + }@else if $d == br { + border-bottom-right-radius:$radius-value; + }@else if $d == bl { + border-bottom-left-radius:$radius-value; + } + }@else{ + border-radius:$radius-value; + } +} + +@each $key, $child in $uni-radius { + @if($key){ + .uni-radius-#{"" + $key} { + @include radius($key) + } + }@else{ + .uni-radius { + @include radius($key) + } + } +} + +@each $direction in t, r, b, l,tl, tr, br, bl { + @each $key, $child in $uni-radius { + @if($key){ + .uni-radius-#{"" + $direction}-#{"" + $key} { + @include radius($key,$direction,false) + } + }@else{ + .uni-radius-#{$direction} { + @include radius($key,$direction,false) + } + } + } +} diff --git a/uni_modules/uni-scss/styles/setting/_space.scss b/uni_modules/uni-scss/styles/setting/_space.scss new file mode 100644 index 0000000..3c89528 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_space.scss @@ -0,0 +1,56 @@ + +@mixin fn($space,$direction,$size,$n) { + @if $n { + #{$space}-#{$direction}: #{$size*$uni-space-root}px + } @else { + #{$space}-#{$direction}: #{-$size*$uni-space-root}px + } +} +@mixin get-styles($direction,$i,$space,$n){ + @if $direction == t { + @include fn($space, top,$i,$n); + } + @if $direction == r { + @include fn($space, right,$i,$n); + } + @if $direction == b { + @include fn($space, bottom,$i,$n); + } + @if $direction == l { + @include fn($space, left,$i,$n); + } + @if $direction == x { + @include fn($space, left,$i,$n); + @include fn($space, right,$i,$n); + } + @if $direction == y { + @include fn($space, top,$i,$n); + @include fn($space, bottom,$i,$n); + } + @if $direction == a { + @if $n { + #{$space}:#{$i*$uni-space-root}px; + } @else { + #{$space}:#{-$i*$uni-space-root}px; + } + } +} + +@each $orientation in m,p { + $space: margin; + @if $orientation == m { + $space: margin; + } @else { + $space: padding; + } + @for $i from 0 through 16 { + @each $direction in t, r, b, l, x, y, a { + .uni-#{$orientation}#{$direction}-#{$i} { + @include get-styles($direction,$i,$space,true); + } + .uni-#{$orientation}#{$direction}-n#{$i} { + @include get-styles($direction,$i,$space,false); + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/setting/_styles.scss b/uni_modules/uni-scss/styles/setting/_styles.scss new file mode 100644 index 0000000..689afec --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_styles.scss @@ -0,0 +1,167 @@ +/* #ifndef APP-NVUE */ + +$-color-white:#fff; +$-color-black:#000; +@mixin base-style($color) { + color: #fff; + background-color: $color; + border-color: mix($-color-black, $color, 8%); + &:not([hover-class]):active { + background: mix($-color-black, $color, 10%); + border-color: mix($-color-black, $color, 20%); + color: $-color-white; + outline: none; + } +} +@mixin is-color($color) { + @include base-style($color); + &[loading] { + @include base-style($color); + &::before { + margin-right:5px; + } + } + &[disabled] { + &, + &[loading], + &:not([hover-class]):active { + color: $-color-white; + border-color: mix(darken($color,10%), $-color-white); + background-color: mix($color, $-color-white); + } + } + +} +@mixin base-plain-style($color) { + color:$color; + background-color: mix($-color-white, $color, 90%); + border-color: mix($-color-white, $color, 70%); + &:not([hover-class]):active { + background: mix($-color-white, $color, 80%); + color: $color; + outline: none; + border-color: mix($-color-white, $color, 50%); + } +} +@mixin is-plain($color){ + &[plain] { + @include base-plain-style($color); + &[loading] { + @include base-plain-style($color); + &::before { + margin-right:5px; + } + } + &[disabled] { + &, + &:active { + color: mix($-color-white, $color, 40%); + background-color: mix($-color-white, $color, 90%); + border-color: mix($-color-white, $color, 80%); + } + } + } +} + + +.uni-btn { + margin: 5px; + color: #393939; + border:1px solid #ccc; + font-size: 16px; + font-weight: 200; + background-color: #F9F9F9; + // TODO 暂时处理边框隐藏一边的问题 + overflow: visible; + &::after{ + border: none; + } + + &:not([type]),&[type=default] { + color: #999; + &[loading] { + background: none; + &::before { + margin-right:5px; + } + } + + + + &[disabled]{ + color: mix($-color-white, #999, 60%); + &, + &[loading], + &:active { + color: mix($-color-white, #999, 60%); + background-color: mix($-color-white,$-color-black , 98%); + border-color: mix($-color-white, #999, 85%); + } + } + + &[plain] { + color: #999; + background: none; + border-color: $uni-border-1; + &:not([hover-class]):active { + background: none; + color: mix($-color-white, $-color-black, 80%); + border-color: mix($-color-white, $-color-black, 90%); + outline: none; + } + &[disabled]{ + &, + &[loading], + &:active { + background: none; + color: mix($-color-white, #999, 60%); + border-color: mix($-color-white, #999, 85%); + } + } + } + } + + &:not([hover-class]):active { + color: mix($-color-white, $-color-black, 50%); + } + + &[size=mini] { + font-size: 16px; + font-weight: 200; + border-radius: 8px; + } + + + + &.uni-btn-small { + font-size: 14px; + } + &.uni-btn-mini { + font-size: 12px; + } + + &.uni-btn-radius { + border-radius: 999px; + } + &[type=primary] { + @include is-color($uni-primary); + @include is-plain($uni-primary) + } + &[type=success] { + @include is-color($uni-success); + @include is-plain($uni-success) + } + &[type=error] { + @include is-color($uni-error); + @include is-plain($uni-error) + } + &[type=warning] { + @include is-color($uni-warning); + @include is-plain($uni-warning) + } + &[type=info] { + @include is-color($uni-info); + @include is-plain($uni-info) + } +} +/* #endif */ diff --git a/uni_modules/uni-scss/styles/setting/_text.scss b/uni_modules/uni-scss/styles/setting/_text.scss new file mode 100644 index 0000000..a34d08f --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_text.scss @@ -0,0 +1,24 @@ +@mixin get-styles($k,$c) { + @if $k == size or $k == weight{ + font-#{$k}:#{$c} + }@else{ + #{$k}:#{$c} + } +} + +@each $key, $child in $uni-headings { + /* #ifndef APP-NVUE */ + .uni-#{$key} { + @each $k, $c in $child { + @include get-styles($k,$c) + } + } + /* #endif */ + /* #ifdef APP-NVUE */ + .container .uni-#{$key} { + @each $k, $c in $child { + @include get-styles($k,$c) + } + } + /* #endif */ +} diff --git a/uni_modules/uni-scss/styles/setting/_variables.scss b/uni_modules/uni-scss/styles/setting/_variables.scss new file mode 100644 index 0000000..557d3d7 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_variables.scss @@ -0,0 +1,146 @@ +// @use "sass:math"; +@import '../tools/functions.scss'; +// 间距基础倍数 +$uni-space-root: 2 !default; +// 边框半径默认值 +$uni-radius-root:5px !default; +$uni-radius: () !default; +// 边框半径断点 +$uni-radius: map-deep-merge( + ( + 0: 0, + // TODO 当前版本暂时不支持 sm 属性 + // 'sm': math.div($uni-radius-root, 2), + null: $uni-radius-root, + 'lg': $uni-radius-root * 2, + 'xl': $uni-radius-root * 6, + 'pill': 9999px, + 'circle': 50% + ), + $uni-radius +); +// 字体家族 +$body-font-family: 'Roboto', sans-serif !default; +// 文本 +$heading-font-family: $body-font-family !default; +$uni-headings: () !default; +$letterSpacing: -0.01562em; +$uni-headings: map-deep-merge( + ( + 'h1': ( + size: 32px, + weight: 300, + line-height: 50px, + // letter-spacing:-0.01562em + ), + 'h2': ( + size: 28px, + weight: 300, + line-height: 40px, + // letter-spacing: -0.00833em + ), + 'h3': ( + size: 24px, + weight: 400, + line-height: 32px, + // letter-spacing: normal + ), + 'h4': ( + size: 20px, + weight: 400, + line-height: 30px, + // letter-spacing: 0.00735em + ), + 'h5': ( + size: 16px, + weight: 400, + line-height: 24px, + // letter-spacing: normal + ), + 'h6': ( + size: 14px, + weight: 500, + line-height: 18px, + // letter-spacing: 0.0125em + ), + 'subtitle': ( + size: 12px, + weight: 400, + line-height: 20px, + // letter-spacing: 0.00937em + ), + 'body': ( + font-size: 14px, + font-weight: 400, + line-height: 22px, + // letter-spacing: 0.03125em + ), + 'caption': ( + 'size': 12px, + 'weight': 400, + 'line-height': 20px, + // 'letter-spacing': 0.03333em, + // 'text-transform': false + ) + ), + $uni-headings +); + + + +// 主色 +$uni-primary: #2979ff !default; +$uni-primary-disable:lighten($uni-primary,20%) !default; +$uni-primary-light: lighten($uni-primary,25%) !default; + +// 辅助色 +// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 +$uni-success: #18bc37 !default; +$uni-success-disable:lighten($uni-success,20%) !default; +$uni-success-light: lighten($uni-success,25%) !default; + +$uni-warning: #f3a73f !default; +$uni-warning-disable:lighten($uni-warning,20%) !default; +$uni-warning-light: lighten($uni-warning,25%) !default; + +$uni-error: #e43d33 !default; +$uni-error-disable:lighten($uni-error,20%) !default; +$uni-error-light: lighten($uni-error,25%) !default; + +$uni-info: #8f939c !default; +$uni-info-disable:lighten($uni-info,20%) !default; +$uni-info-light: lighten($uni-info,25%) !default; + +// 中性色 +// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 +$uni-main-color: #3a3a3a !default; // 主要文字 +$uni-base-color: #6a6a6a !default; // 常规文字 +$uni-secondary-color: #909399 !default; // 次要文字 +$uni-extra-color: #c7c7c7 !default; // 辅助说明 + +// 边框颜色 +$uni-border-1: #F0F0F0 !default; +$uni-border-2: #EDEDED !default; +$uni-border-3: #DCDCDC !default; +$uni-border-4: #B9B9B9 !default; + +// 常规色 +$uni-black: #000000 !default; +$uni-white: #ffffff !default; +$uni-transparent: rgba($color: #000000, $alpha: 0) !default; + +// 背景色 +$uni-bg-color: #f7f7f7 !default; + +/* 水平间距 */ +$uni-spacing-sm: 8px !default; +$uni-spacing-base: 15px !default; +$uni-spacing-lg: 30px !default; + +// 阴影 +$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5) !default; +$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2) !default; +$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5) !default; + +// 蒙版 +$uni-mask: rgba($color: #000000, $alpha: 0.4) !default; diff --git a/uni_modules/uni-scss/styles/tools/functions.scss b/uni_modules/uni-scss/styles/tools/functions.scss new file mode 100644 index 0000000..ac6f63e --- /dev/null +++ b/uni_modules/uni-scss/styles/tools/functions.scss @@ -0,0 +1,19 @@ +// 合并 map +@function map-deep-merge($parent-map, $child-map){ + $result: $parent-map; + @each $key, $child in $child-map { + $parent-has-key: map-has-key($result, $key); + $parent-value: map-get($result, $key); + $parent-type: type-of($parent-value); + $child-type: type-of($child); + $parent-is-map: $parent-type == map; + $child-is-map: $child-type == map; + + @if (not $parent-has-key) or ($parent-type != $child-type) or (not ($parent-is-map and $child-is-map)){ + $result: map-merge($result, ( $key: $child )); + }@else { + $result: map-merge($result, ( $key: map-deep-merge($parent-value, $child) )); + } + } + @return $result; +}; diff --git a/uni_modules/uni-scss/theme.scss b/uni_modules/uni-scss/theme.scss new file mode 100644 index 0000000..80ee62f --- /dev/null +++ b/uni_modules/uni-scss/theme.scss @@ -0,0 +1,31 @@ +// 间距基础倍数 +$uni-space-root: 2; +// 边框半径默认值 +$uni-radius-root:5px; +// 主色 +$uni-primary: #2979ff; +// 辅助色 +$uni-success: #4cd964; +// 警告色 +$uni-warning: #f0ad4e; +// 错误色 +$uni-error: #dd524d; +// 描述色 +$uni-info: #909399; +// 中性色 +$uni-main-color: #303133; +$uni-base-color: #606266; +$uni-secondary-color: #909399; +$uni-extra-color: #C0C4CC; +// 背景色 +$uni-bg-color: #f5f5f5; +// 边框颜色 +$uni-border-1: #DCDFE6; +$uni-border-2: #E4E7ED; +$uni-border-3: #EBEEF5; +$uni-border-4: #F2F6FC; + +// 常规色 +$uni-black: #000000; +$uni-white: #ffffff; +$uni-transparent: rgba($color: #000000, $alpha: 0); diff --git a/uni_modules/uni-scss/variables.scss b/uni_modules/uni-scss/variables.scss new file mode 100644 index 0000000..1c062d4 --- /dev/null +++ b/uni_modules/uni-scss/variables.scss @@ -0,0 +1,62 @@ +@import './styles/setting/_variables.scss'; +// 间距基础倍数 +$uni-space-root: 2; +// 边框半径默认值 +$uni-radius-root:5px; + +// 主色 +$uni-primary: #2979ff; +$uni-primary-disable:mix(#fff,$uni-primary,50%); +$uni-primary-light: mix(#fff,$uni-primary,80%); + +// 辅助色 +// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 +$uni-success: #18bc37; +$uni-success-disable:mix(#fff,$uni-success,50%); +$uni-success-light: mix(#fff,$uni-success,80%); + +$uni-warning: #f3a73f; +$uni-warning-disable:mix(#fff,$uni-warning,50%); +$uni-warning-light: mix(#fff,$uni-warning,80%); + +$uni-error: #e43d33; +$uni-error-disable:mix(#fff,$uni-error,50%); +$uni-error-light: mix(#fff,$uni-error,80%); + +$uni-info: #8f939c; +$uni-info-disable:mix(#fff,$uni-info,50%); +$uni-info-light: mix(#fff,$uni-info,80%); + +// 中性色 +// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 +$uni-main-color: #3a3a3a; // 主要文字 +$uni-base-color: #6a6a6a; // 常规文字 +$uni-secondary-color: #909399; // 次要文字 +$uni-extra-color: #c7c7c7; // 辅助说明 + +// 边框颜色 +$uni-border-1: #F0F0F0; +$uni-border-2: #EDEDED; +$uni-border-3: #DCDCDC; +$uni-border-4: #B9B9B9; + +// 常规色 +$uni-black: #000000; +$uni-white: #ffffff; +$uni-transparent: rgba($color: #000000, $alpha: 0); + +// 背景色 +$uni-bg-color: #f7f7f7; + +/* 水平间距 */ +$uni-spacing-sm: 8px; +$uni-spacing-base: 15px; +$uni-spacing-lg: 30px; + +// 阴影 +$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5); +$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2); +$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5); + +// 蒙版 +$uni-mask: rgba($color: #000000, $alpha: 0.4); diff --git a/uni_modules/uni-search-bar/changelog.md b/uni_modules/uni-search-bar/changelog.md new file mode 100644 index 0000000..a01fcf2 --- /dev/null +++ b/uni_modules/uni-search-bar/changelog.md @@ -0,0 +1,35 @@ +## 1.2.4(2023-05-09) +- 修复 i18n 国际化不正确的 Bug +## 1.2.3(2022-05-24) +- 新增 readonly 属性,组件只读 +## 1.2.2(2022-05-06) +- 修复 vue3 input 事件不生效的bug +## 1.2.1(2022-05-06) +- 修复 多余代码导致的bug +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-search-bar](https://uniapp.dcloud.io/component/uniui/uni-search-bar) +## 1.1.2(2021-08-30) +- 修复 value 属性与 modelValue 属性不兼容的Bug +## 1.1.1(2021-08-24) +- 新增 支持国际化 +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.9(2021-05-12) +- 新增 项目示例地址 +## 1.0.8(2021-04-21) +- 优化 添加依赖 uni-icons, 导入后自动下载依赖 +## 1.0.7(2021-04-15) +- uni-ui 新增 uni-search-bar 的 focus 事件 + +## 1.0.6(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.5(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 支持双向绑定 +- 更改 input 事件的返回值,e={value:Number} --> e=value +- 新增 支持图标插槽 +- 新增 支持 clear、blur 事件 +- 新增 支持 focus 属性 +- 去掉组件背景色 diff --git a/uni_modules/uni-search-bar/components/uni-search-bar/i18n/en.json b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/en.json new file mode 100644 index 0000000..dd083a5 --- /dev/null +++ b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/en.json @@ -0,0 +1,4 @@ +{ + "uni-search-bar.cancel": "cancel", + "uni-search-bar.placeholder": "Search enter content" +} \ No newline at end of file diff --git a/uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hans.json b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hans.json new file mode 100644 index 0000000..d2a1ced --- /dev/null +++ b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hans.json @@ -0,0 +1,4 @@ +{ + "uni-search-bar.cancel": "取消", + "uni-search-bar.placeholder": "请输入搜索内容" +} diff --git a/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hant.json b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hant.json new file mode 100644 index 0000000..f1c96bc --- /dev/null +++ b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hant.json @@ -0,0 +1,4 @@ +{ + "uni-search-bar.cancel": "取消", + "uni-search-bar.placeholder": "請輸入搜索內容" +} diff --git a/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue b/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue new file mode 100644 index 0000000..e0a7372 --- /dev/null +++ b/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue @@ -0,0 +1,298 @@ + + + + + diff --git a/uni_modules/uni-search-bar/package.json b/uni_modules/uni-search-bar/package.json new file mode 100644 index 0000000..ede02ef --- /dev/null +++ b/uni_modules/uni-search-bar/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-search-bar", + "displayName": "uni-search-bar 搜索栏", + "version": "1.2.4", + "description": "搜索栏组件,通常用于搜索商品、文章等", + "keywords": [ + "uni-ui", + "uniui", + "搜索框", + "搜索栏" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-search-bar/readme.md b/uni_modules/uni-search-bar/readme.md new file mode 100644 index 0000000..253092f --- /dev/null +++ b/uni_modules/uni-search-bar/readme.md @@ -0,0 +1,14 @@ + + +## SearchBar 搜索栏 + +> **组件名:uni-search-bar** +> 代码块: `uSearchBar` + + +搜索栏组件 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-search-bar) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-section/changelog.md b/uni_modules/uni-section/changelog.md new file mode 100644 index 0000000..738f2b3 --- /dev/null +++ b/uni_modules/uni-section/changelog.md @@ -0,0 +1,2 @@ +## 0.0.1(2022-07-22) +- 初始化 diff --git a/uni_modules/uni-section/components/uni-section/uni-section.vue b/uni_modules/uni-section/components/uni-section/uni-section.vue new file mode 100644 index 0000000..9a52e0b --- /dev/null +++ b/uni_modules/uni-section/components/uni-section/uni-section.vue @@ -0,0 +1,167 @@ + + + + diff --git a/uni_modules/uni-section/package.json b/uni_modules/uni-section/package.json new file mode 100644 index 0000000..0a31fb5 --- /dev/null +++ b/uni_modules/uni-section/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-section", + "displayName": "uni-section 标题栏", + "version": "0.0.1", + "description": "标题栏组件", + "keywords": [ + "uni-ui", + "uniui", + "标题栏" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-section/readme.md b/uni_modules/uni-section/readme.md new file mode 100644 index 0000000..d47faab --- /dev/null +++ b/uni_modules/uni-section/readme.md @@ -0,0 +1,8 @@ +## Section 标题栏 +> **组件名:uni-section** +> 代码块: `uSection` + +uni-section 组件主要用于文章、列表详情等标题展示 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-section) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 diff --git a/uni_modules/uni-segmented-control/changelog.md b/uni_modules/uni-segmented-control/changelog.md new file mode 100644 index 0000000..a44385d --- /dev/null +++ b/uni_modules/uni-segmented-control/changelog.md @@ -0,0 +1,9 @@ +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-segmented-control](https://uniapp.dcloud.io/component/uniui/uni-segmented-control) +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.5(2021-05-12) +- 新增 项目示例地址 +## 1.0.4(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.vue b/uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.vue new file mode 100644 index 0000000..044a495 --- /dev/null +++ b/uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/uni_modules/uni-segmented-control/package.json b/uni_modules/uni-segmented-control/package.json new file mode 100644 index 0000000..6cae41d --- /dev/null +++ b/uni_modules/uni-segmented-control/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-segmented-control", + "displayName": "uni-segmented-control 分段器", + "version": "1.2.0", + "description": "分段器由至少 2 个分段控件组成,用作不同视图的显示", + "keywords": [ + "uni-ui", + "uniui", + "分段器", + "segement", + "顶部选择" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-segmented-control/readme.md b/uni_modules/uni-segmented-control/readme.md new file mode 100644 index 0000000..3527b03 --- /dev/null +++ b/uni_modules/uni-segmented-control/readme.md @@ -0,0 +1,13 @@ + + +## SegmentedControl 分段器 +> **组件名:uni-segmented-control** +> 代码块: `uSegmentedControl` + + +用作不同视图的显示 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-segmented-control) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-steps/changelog.md b/uni_modules/uni-steps/changelog.md new file mode 100644 index 0000000..cb9d367 --- /dev/null +++ b/uni_modules/uni-steps/changelog.md @@ -0,0 +1,16 @@ +## 1.1.1(2021-11-22) +- 修复 vue3中某些scss变量无法找到的问题 +## 1.1.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-steps](https://uniapp.dcloud.io/component/uniui/uni-steps) +## 1.0.8(2021-05-12) +- 新增 项目示例地址 +## 1.0.7(2021-05-06) +- 修复 uni-steps 横向布局时,多行文字高度不合理的 bug +## 1.0.6(2021-04-21) +- 优化 添加依赖 uni-icons, 导入后自动下载依赖 +## 1.0.5(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.4(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-steps/components/uni-steps/uni-steps.vue b/uni_modules/uni-steps/components/uni-steps/uni-steps.vue new file mode 100644 index 0000000..a6c8f28 --- /dev/null +++ b/uni_modules/uni-steps/components/uni-steps/uni-steps.vue @@ -0,0 +1,269 @@ + + + + + diff --git a/uni_modules/uni-steps/package.json b/uni_modules/uni-steps/package.json new file mode 100644 index 0000000..c687b40 --- /dev/null +++ b/uni_modules/uni-steps/package.json @@ -0,0 +1,89 @@ +{ + "id": "uni-steps", + "displayName": "uni-steps 步骤条", + "version": "1.1.1", + "description": "步骤条组件,提供横向和纵向两种布局格式。", + "keywords": [ + "uni-ui", + "uniui", + "步骤条", + "时间轴" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-steps/readme.md b/uni_modules/uni-steps/readme.md new file mode 100644 index 0000000..da7a4bf --- /dev/null +++ b/uni_modules/uni-steps/readme.md @@ -0,0 +1,13 @@ + + +## Steps 步骤条 +> **组件名:uni-steps** +> 代码块: `uSteps` + + +步骤条,常用于显示进度 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-steps) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-swipe-action/changelog.md b/uni_modules/uni-swipe-action/changelog.md new file mode 100644 index 0000000..c916427 --- /dev/null +++ b/uni_modules/uni-swipe-action/changelog.md @@ -0,0 +1,43 @@ +## 1.3.8(2023-04-13) +- 修复`uni-swipe-action`和`uni-swipe-action-item`不同时使用导致 closeOther 方法报错的 bug +## 1.3.7(2022-06-06) +- 修复 vue3 下使用组件不能正常运行的Bug +## 1.3.6(2022-05-31) +- 修复 h5端点击click触发两次的Bug +## 1.3.5(2022-05-23) +- 修复 isPC 找不到的Bug +## 1.3.4(2022-05-19) +- 修复 在 nvue 下 disabled 失效的bug +## 1.3.3(2022-03-31) +- 修复 按钮字体大小不能设置的bug +## 1.3.2(2022-03-16) +- 修复 h5和app端下报el错误的bug +## 1.3.1(2022-03-07) +- 修复 HBuilderX 1.4.X 版本中,h5和app端下报错的bug +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-swipe-action](https://uniapp.dcloud.io/component/uniui/uni-swipe-action) +## 1.2.4(2021-08-20) +- 优化 close-all 方法 +## 1.2.3(2021-08-20) +- 新增 close-all 方法,关闭所有已打开的组件 +## 1.2.2(2021-08-17) +- 新增 resize() 方法,在非微信小程序、h5、app-vue端出现不能滑动的问题的时候,重置组件 +- 修复 app 端偶尔出现类似 Page[x][-x,xx;-x,xx,x,x-x] 的问题 +- 优化 微信小程序、h5、app-vue 滑动逻辑,避免出现动态新增组件后不能滑动的问题 +## 1.2.1(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +- 修复 跨页面修改组件数据 ,导致不能滑动的问题 +## 1.1.10(2021-06-17) +- 修复 按钮点击执行两次的bug +## 1.1.9(2021-05-12) +- 新增 项目示例地址 +## 1.1.8(2021-03-26) +- 修复 微信小程序 nv_navigator is not defined 报错的bug +## 1.1.7(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 左侧滑动 +- 新增 插槽使用方式 +- 新增 threshold 属性,可以控制滑动缺省值 +- 优化 长列表滚动性能 +- 修复 滚动页面时触发组件滑动的Bug diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/bindingx.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/bindingx.js new file mode 100644 index 0000000..707e432 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/bindingx.js @@ -0,0 +1,302 @@ +let bindIngXMixins = {} + +// #ifdef APP-NVUE +const BindingX = uni.requireNativePlugin('bindingx'); +const dom = uni.requireNativePlugin('dom'); +const animation = uni.requireNativePlugin('animation'); + +bindIngXMixins = { + data() { + return {} + }, + + watch: { + show(newVal) { + if (this.autoClose) return + if (this.stop) return + this.stop = true + if (newVal) { + this.open(newVal) + } else { + this.close() + } + }, + leftOptions() { + this.getSelectorQuery() + this.init() + }, + rightOptions(newVal) { + this.init() + } + }, + created() { + this.swipeaction = this.getSwipeAction() + if (this.swipeaction && Array.isArray(this.swipeaction.children)) { + this.swipeaction.children.push(this) + } + }, + mounted() { + this.box = this.getEl(this.$refs['selector-box--hock']) + this.selector = this.getEl(this.$refs['selector-content--hock']); + this.leftButton = this.getEl(this.$refs['selector-left-button--hock']); + this.rightButton = this.getEl(this.$refs['selector-right-button--hock']); + this.init() + }, + // beforeDestroy() { + // this.swipeaction.children.forEach((item, index) => { + // if (item === this) { + // this.swipeaction.children.splice(index, 1) + // } + // }) + // }, + methods: { + init() { + this.$nextTick(() => { + this.x = 0 + this.button = { + show: false + } + setTimeout(() => { + this.getSelectorQuery() + }, 200) + }) + }, + onClick(index, item, position) { + this.$emit('click', { + content: item, + index, + position + }) + }, + touchstart(e) { + // fix by mehaotian 禁止滑动 + if (this.disabled) return + // 每次只触发一次,避免多次监听造成闪烁 + if (this.stop) return + this.stop = true + if (this.autoClose && this.swipeaction) { + this.swipeaction.closeOther(this) + } + + const leftWidth = this.button.left.width + const rightWidth = this.button.right.width + let expression = this.range(this.x, -rightWidth, leftWidth) + let leftExpression = this.range(this.x - leftWidth, -leftWidth, 0) + let rightExpression = this.range(this.x + rightWidth, 0, rightWidth) + + this.eventpan = BindingX.bind({ + anchor: this.box, + eventType: 'pan', + props: [{ + element: this.selector, + property: 'transform.translateX', + expression + }, { + element: this.leftButton, + property: 'transform.translateX', + expression: leftExpression + }, { + element: this.rightButton, + property: 'transform.translateX', + expression: rightExpression + }, ] + }, (e) => { + // nope + if (e.state === 'end') { + this.x = e.deltaX + this.x; + this.isclick = true + this.bindTiming(e.deltaX) + } + }); + }, + touchend(e) { + if (this.isopen !== 'none' && !this.isclick) { + this.open('none') + } + }, + bindTiming(x) { + const left = this.x + const leftWidth = this.button.left.width + const rightWidth = this.button.right.width + const threshold = this.threshold + if (!this.isopen || this.isopen === 'none') { + if (left > threshold) { + this.open('left') + } else if (left < -threshold) { + this.open('right') + } else { + this.open('none') + } + } else { + if ((x > -leftWidth && x < 0) || x > rightWidth) { + if ((x > -threshold && x < 0) || (x - rightWidth > threshold)) { + this.open('left') + } else { + this.open('none') + } + } else { + if ((x < threshold && x > 0) || (x + leftWidth < -threshold)) { + this.open('right') + } else { + this.open('none') + } + } + } + }, + + /** + * 移动范围 + * @param {Object} num + * @param {Object} mix + * @param {Object} max + */ + range(num, mix, max) { + return `min(max(x+${num}, ${mix}), ${max})` + }, + + /** + * 开启swipe + */ + open(type) { + this.animation(type) + }, + + /** + * 关闭swipe + */ + close() { + this.animation('none') + }, + + /** + * 开启关闭动画 + * @param {Object} type + */ + animation(type) { + const time = 300 + const leftWidth = this.button.left.width + const rightWidth = this.button.right.width + if (this.eventpan && this.eventpan.token) { + BindingX.unbind({ + token: this.eventpan.token, + eventType: 'pan' + }) + } + + switch (type) { + case 'left': + Promise.all([ + this.move(this.selector, leftWidth), + this.move(this.leftButton, 0), + this.move(this.rightButton, rightWidth * 2) + ]).then(() => { + this.setEmit(leftWidth, type) + }) + break + case 'right': + Promise.all([ + this.move(this.selector, -rightWidth), + this.move(this.leftButton, -leftWidth * 2), + this.move(this.rightButton, 0) + ]).then(() => { + this.setEmit(-rightWidth, type) + }) + break + default: + Promise.all([ + this.move(this.selector, 0), + this.move(this.leftButton, -leftWidth), + this.move(this.rightButton, rightWidth) + ]).then(() => { + this.setEmit(0, type) + }) + + } + }, + setEmit(x, type) { + const leftWidth = this.button.left.width + const rightWidth = this.button.right.width + this.isopen = this.isopen || 'none' + this.stop = false + this.isclick = false + // 只有状态不一致才会返回结果 + if (this.isopen !== type && this.x !== x) { + if (type === 'left' && leftWidth > 0) { + this.$emit('change', 'left') + } + if (type === 'right' && rightWidth > 0) { + this.$emit('change', 'right') + } + if (type === 'none') { + this.$emit('change', 'none') + } + } + this.x = x + this.isopen = type + }, + move(ref, value) { + return new Promise((resolve, reject) => { + animation.transition(ref, { + styles: { + transform: `translateX(${value})`, + }, + duration: 150, //ms + timingFunction: 'linear', + needLayout: false, + delay: 0 //ms + }, function(res) { + resolve(res) + }) + }) + + }, + + /** + * 获取ref + * @param {Object} el + */ + getEl(el) { + return el.ref + }, + /** + * 获取节点信息 + */ + getSelectorQuery() { + Promise.all([ + this.getDom('left'), + this.getDom('right'), + ]).then((data) => { + let show = 'none' + if (this.autoClose) { + show = 'none' + } else { + show = this.show + } + + if (show === 'none') { + // this.close() + } else { + this.open(show) + } + + }) + + }, + getDom(str) { + return new Promise((resolve, reject) => { + dom.getComponentRect(this.$refs[`selector-${str}-button--hock`], (data) => { + if (data) { + this.button[str] = data.size + resolve(data) + } else { + reject() + } + }) + }) + } + } +} + +// #endif + +export default bindIngXMixins diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/isPC.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/isPC.js new file mode 100644 index 0000000..917cb48 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/isPC.js @@ -0,0 +1,12 @@ +export function isPC() { + var userAgentInfo = navigator.userAgent; + var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; + var flag = true; + for (let v = 0; v < Agents.length - 1; v++) { + if (userAgentInfo.indexOf(Agents[v]) > 0) { + flag = false; + break; + } + } + return flag; +} diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpalipay.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpalipay.js new file mode 100644 index 0000000..35c796b --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpalipay.js @@ -0,0 +1,195 @@ +export default { + data() { + return { + x: 0, + transition: false, + width: 0, + viewWidth: 0, + swipeShow: 0 + } + }, + watch: { + show(newVal) { + if (this.autoClose) return + if (newVal && newVal !== 'none') { + this.transition = true + this.open(newVal) + } else { + this.close() + } + } + }, + created() { + this.swipeaction = this.getSwipeAction() + if (this.swipeaction && Array.isArray(this.swipeaction.children)) { + this.swipeaction.children.push(this) + } + }, + mounted() { + this.isopen = false + setTimeout(() => { + this.getQuerySelect() + }, 50) + }, + methods: { + appTouchStart(e) { + const { + clientX + } = e.changedTouches[0] + this.clientX = clientX + this.timestamp = new Date().getTime() + }, + appTouchEnd(e, index, item, position) { + const { + clientX + } = e.changedTouches[0] + // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 + let diff = Math.abs(this.clientX - clientX) + let time = (new Date().getTime()) - this.timestamp + if (diff < 40 && time < 300) { + this.$emit('click', { + content: item, + index, + position + }) + } + }, + /** + * 移动触发 + * @param {Object} e + */ + onChange(e) { + this.moveX = e.detail.x + this.isclose = false + }, + touchstart(e) { + this.transition = false + this.isclose = true + if (this.autoClose && this.swipeaction) { + this.swipeaction.closeOther(this) + } + }, + touchmove(e) {}, + touchend(e) { + // 0的位置什么都不执行 + if (this.isclose && this.isopen === 'none') return + if (this.isclose && this.isopen !== 'none') { + this.transition = true + this.close() + } else { + this.move(this.moveX + this.leftWidth) + } + }, + + /** + * 移动 + * @param {Object} moveX + */ + move(moveX) { + // 打开关闭的处理逻辑不太一样 + this.transition = true + // 未打开状态 + if (!this.isopen || this.isopen === 'none') { + if (moveX > this.threshold) { + this.open('left') + } else if (moveX < -this.threshold) { + this.open('right') + } else { + this.close() + } + } else { + if (moveX < 0 && moveX < this.rightWidth) { + const rightX = this.rightWidth + moveX + if (rightX < this.threshold) { + this.open('right') + } else { + this.close() + } + } else if (moveX > 0 && moveX < this.leftWidth) { + const leftX = this.leftWidth - moveX + if (leftX < this.threshold) { + this.open('left') + } else { + this.close() + } + } + + } + + }, + + /** + * 打开 + */ + open(type) { + this.x = this.moveX + this.animation(type) + }, + + /** + * 关闭 + */ + close() { + this.x = this.moveX + // TODO 解决 x 值不更新的问题,所以会多触发一次 nextTick ,待优化 + this.$nextTick(() => { + this.x = -this.leftWidth + if (this.isopen !== 'none') { + this.$emit('change', 'none') + } + this.isopen = 'none' + }) + }, + + /** + * 执行结束动画 + * @param {Object} type + */ + animation(type) { + this.$nextTick(() => { + if (type === 'left') { + this.x = 0 + } else { + this.x = -this.rightWidth - this.leftWidth + } + + if (this.isopen !== type) { + this.$emit('change', type) + } + this.isopen = type + }) + + }, + getSlide(x) {}, + getQuerySelect() { + const query = uni.createSelectorQuery().in(this); + query.selectAll('.movable-view--hock').boundingClientRect(data => { + this.leftWidth = data[1].width + this.rightWidth = data[2].width + this.width = data[0].width + this.viewWidth = this.width + this.rightWidth + this.leftWidth + if (this.leftWidth === 0) { + // TODO 疑似bug ,初始化的时候如果x 是0,会导致移动位置错误,所以让元素超出一点 + this.x = -0.1 + } else { + this.x = -this.leftWidth + } + this.moveX = this.x + this.$nextTick(() => { + this.swipeShow = 1 + }) + + if (!this.buttonWidth) { + this.disabledView = true + } + + if (this.autoClose) return + if (this.show !== 'none') { + this.transition = true + this.open(this.shows) + } + }).exec(); + + } + } +} diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpother.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpother.js new file mode 100644 index 0000000..d389bce --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpother.js @@ -0,0 +1,260 @@ +let otherMixins = {} + +// #ifndef APP-PLUS|| MP-WEIXIN || H5 +const MIN_DISTANCE = 10; +otherMixins = { + data() { + // TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug + const elClass = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}` + return { + uniShow: false, + left: 0, + buttonShow: 'none', + ani: false, + moveLeft: '', + elClass + } + }, + watch: { + show(newVal) { + if (this.autoClose) return + this.openState(newVal) + }, + left() { + this.moveLeft = `translateX(${this.left}px)` + }, + buttonShow(newVal) { + if (this.autoClose) return + this.openState(newVal) + }, + leftOptions() { + this.init() + }, + rightOptions() { + this.init() + } + }, + mounted() { + this.swipeaction = this.getSwipeAction() + if (this.swipeaction && Array.isArray(this.swipeaction.children)) { + this.swipeaction.children.push(this) + } + this.init() + }, + methods: { + init() { + clearTimeout(this.timer) + this.timer = setTimeout(() => { + this.getSelectorQuery() + }, 100) + // 移动距离 + this.left = 0 + this.x = 0 + }, + + closeSwipe(e) { + if (this.autoClose && this.swipeaction) { + this.swipeaction.closeOther(this) + } + }, + appTouchStart(e) { + const { + clientX + } = e.changedTouches[0] + this.clientX = clientX + this.timestamp = new Date().getTime() + }, + appTouchEnd(e, index, item, position) { + const { + clientX + } = e.changedTouches[0] + // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 + let diff = Math.abs(this.clientX - clientX) + let time = (new Date().getTime()) - this.timestamp + if (diff < 40 && time < 300) { + this.$emit('click', { + content: item, + index, + position + }) + } + }, + touchstart(e) { + if (this.disabled) return + this.ani = false + this.x = this.left || 0 + this.stopTouchStart(e) + this.autoClose && this.closeSwipe() + }, + touchmove(e) { + if (this.disabled) return + // 是否可以滑动页面 + this.stopTouchMove(e); + if (this.direction !== 'horizontal') { + return; + } + this.move(this.x + this.deltaX) + return false + }, + touchend() { + if (this.disabled) return + this.moveDirection(this.left) + }, + /** + * 设置移动距离 + * @param {Object} value + */ + move(value) { + value = value || 0 + const leftWidth = this.leftWidth + const rightWidth = this.rightWidth + // 获取可滑动范围 + this.left = this.range(value, -rightWidth, leftWidth); + }, + + /** + * 获取范围 + * @param {Object} num + * @param {Object} min + * @param {Object} max + */ + range(num, min, max) { + return Math.min(Math.max(num, min), max); + }, + /** + * 移动方向判断 + * @param {Object} left + * @param {Object} value + */ + moveDirection(left) { + const threshold = this.threshold + const isopen = this.isopen || 'none' + const leftWidth = this.leftWidth + const rightWidth = this.rightWidth + if (this.deltaX === 0) { + this.openState('none') + return + } + if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > + 0 && rightWidth + + left < threshold)) { + // right + this.openState('right') + } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > + 0 && + leftWidth - left < threshold)) { + // left + this.openState('left') + } else { + // default + this.openState('none') + } + }, + + /** + * 开启状态 + * @param {Boolean} type + */ + openState(type) { + const leftWidth = this.leftWidth + const rightWidth = this.rightWidth + let left = '' + this.isopen = this.isopen ? this.isopen : 'none' + switch (type) { + case "left": + left = leftWidth + break + case "right": + left = -rightWidth + break + default: + left = 0 + } + + + if (this.isopen !== type) { + this.throttle = true + this.$emit('change', type) + } + + this.isopen = type + // 添加动画类 + this.ani = true + this.$nextTick(() => { + this.move(left) + }) + // 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的 + }, + close() { + this.openState('none') + }, + getDirection(x, y) { + if (x > y && x > MIN_DISTANCE) { + return 'horizontal'; + } + if (y > x && y > MIN_DISTANCE) { + return 'vertical'; + } + return ''; + }, + + /** + * 重置滑动状态 + * @param {Object} event + */ + resetTouchStatus() { + this.direction = ''; + this.deltaX = 0; + this.deltaY = 0; + this.offsetX = 0; + this.offsetY = 0; + }, + + /** + * 设置滑动开始位置 + * @param {Object} event + */ + stopTouchStart(event) { + this.resetTouchStatus(); + const touch = event.touches[0]; + this.startX = touch.clientX; + this.startY = touch.clientY; + }, + + /** + * 滑动中,是否禁止打开 + * @param {Object} event + */ + stopTouchMove(event) { + const touch = event.touches[0]; + this.deltaX = touch.clientX - this.startX; + this.deltaY = touch.clientY - this.startY; + this.offsetX = Math.abs(this.deltaX); + this.offsetY = Math.abs(this.deltaY); + this.direction = this.direction || this.getDirection(this.offsetX, this.offsetY); + }, + + getSelectorQuery() { + const views = uni.createSelectorQuery().in(this) + views + .selectAll('.' + this.elClass) + .boundingClientRect(data => { + if (data.length === 0) return + let show = 'none' + if (this.autoClose) { + show = 'none' + } else { + show = this.show + } + this.leftWidth = data[0].width || 0 + this.rightWidth = data[1].width || 0 + this.buttonShow = show + }) + .exec() + } + } +} + +// #endif + +export default otherMixins diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpwxs.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpwxs.js new file mode 100644 index 0000000..08de1c9 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpwxs.js @@ -0,0 +1,84 @@ +let mpMixins = {} +let is_pc = null +// #ifdef H5 +import { + isPC +} from "./isPC" +is_pc = isPC() +// #endif +// #ifdef APP-VUE|| MP-WEIXIN || H5 + +mpMixins = { + data() { + return { + is_show: 'none' + } + }, + watch: { + show(newVal) { + this.is_show = this.show + } + }, + created() { + this.swipeaction = this.getSwipeAction() + if (this.swipeaction && Array.isArray(this.swipeaction.children)) { + this.swipeaction.children.push(this) + } + }, + mounted() { + this.is_show = this.show + }, + methods: { + // wxs 中调用 + closeSwipe(e) { + if (this.autoClose && this.swipeaction) { + this.swipeaction.closeOther(this) + } + }, + + change(e) { + this.$emit('change', e.open) + if (this.is_show !== e.open) { + this.is_show = e.open + } + }, + + appTouchStart(e) { + if (is_pc) return + const { + clientX + } = e.changedTouches[0] + this.clientX = clientX + this.timestamp = new Date().getTime() + }, + appTouchEnd(e, index, item, position) { + if (is_pc) return + const { + clientX + } = e.changedTouches[0] + // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 + let diff = Math.abs(this.clientX - clientX) + let time = (new Date().getTime()) - this.timestamp + if (diff < 40 && time < 300) { + this.$emit('click', { + content: item, + index, + position + }) + } + }, + onClickForPC(index, item, position) { + if (!is_pc) return + // #ifdef H5 + this.$emit('click', { + content: item, + index, + position + }) + // #endif + } + } +} + +// #endif +export default mpMixins diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js new file mode 100644 index 0000000..78f0ec6 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js @@ -0,0 +1,270 @@ +const MIN_DISTANCE = 10; +export default { + showWatch(newVal, oldVal, ownerInstance, instance, self) { + var state = self.state + var $el = ownerInstance.$el || ownerInstance.$vm && ownerInstance.$vm.$el + if (!$el) return + this.getDom(instance, ownerInstance, self) + if (newVal && newVal !== 'none') { + this.openState(newVal, instance, ownerInstance, self) + return + } + + if (state.left) { + this.openState('none', instance, ownerInstance, self) + } + this.resetTouchStatus(instance, self) + }, + + /** + * 开始触摸操作 + * @param {Object} e + * @param {Object} ins + */ + touchstart(e, ownerInstance, self) { + let instance = e.instance; + let disabled = instance.getDataset().disabled + let state = self.state; + this.getDom(instance, ownerInstance, self) + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = this.getDisabledType(disabled) + if (disabled) return + // 开始触摸时移除动画类 + instance.requestAnimationFrame(function() { + instance.removeClass('ani'); + ownerInstance.callMethod('closeSwipe'); + }) + + // 记录上次的位置 + state.x = state.left || 0 + // 计算滑动开始位置 + this.stopTouchStart(e, ownerInstance, self) + }, + + /** + * 开始滑动操作 + * @param {Object} e + * @param {Object} ownerInstance + */ + touchmove(e, ownerInstance, self) { + let instance = e.instance; + // 删除之后已经那不到实例了 + if (!instance) return; + let disabled = instance.getDataset().disabled + let state = self.state + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = this.getDisabledType(disabled) + if (disabled) return + // 是否可以滑动页面 + this.stopTouchMove(e, self); + if (state.direction !== 'horizontal') { + return; + } + if (e.preventDefault) { + // 阻止页面滚动 + e.preventDefault() + } + let x = state.x + state.deltaX + this.move(x, instance, ownerInstance, self) + }, + + /** + * 结束触摸操作 + * @param {Object} e + * @param {Object} ownerInstance + */ + touchend(e, ownerInstance, self) { + let instance = e.instance; + let disabled = instance.getDataset().disabled + let state = self.state + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = this.getDisabledType(disabled) + + if (disabled) return + // 滑动过程中触摸结束,通过阙值判断是开启还是关闭 + // fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13 + this.moveDirection(state.left, instance, ownerInstance, self) + + }, + + /** + * 设置移动距离 + * @param {Object} value + * @param {Object} instance + * @param {Object} ownerInstance + */ + move(value, instance, ownerInstance, self) { + value = value || 0 + let state = self.state + let leftWidth = state.leftWidth + let rightWidth = state.rightWidth + // 获取可滑动范围 + state.left = this.range(value, -rightWidth, leftWidth); + instance.requestAnimationFrame(function() { + instance.setStyle({ + transform: 'translateX(' + state.left + 'px)', + '-webkit-transform': 'translateX(' + state.left + 'px)' + }) + }) + + }, + + /** + * 获取元素信息 + * @param {Object} instance + * @param {Object} ownerInstance + */ + getDom(instance, ownerInstance, self) { + var state = self.state + var $el = ownerInstance.$el || ownerInstance.$vm && ownerInstance.$vm.$el + var leftDom = $el.querySelector('.button-group--left') + var rightDom = $el.querySelector('.button-group--right') + + state.leftWidth = leftDom.offsetWidth || 0 + state.rightWidth = rightDom.offsetWidth || 0 + state.threshold = instance.getDataset().threshold + }, + + getDisabledType(value) { + return (typeof(value) === 'string' ? JSON.parse(value) : value) || false; + }, + + /** + * 获取范围 + * @param {Object} num + * @param {Object} min + * @param {Object} max + */ + range(num, min, max) { + return Math.min(Math.max(num, min), max); + }, + + + /** + * 移动方向判断 + * @param {Object} left + * @param {Object} value + * @param {Object} ownerInstance + * @param {Object} ins + */ + moveDirection(left, ins, ownerInstance, self) { + var state = self.state + var threshold = state.threshold + var position = state.position + var isopen = state.isopen || 'none' + var leftWidth = state.leftWidth + var rightWidth = state.rightWidth + if (state.deltaX === 0) { + this.openState('none', ins, ownerInstance, self) + return + } + if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && + rightWidth + + left < threshold)) { + // right + this.openState('right', ins, ownerInstance, self) + } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 && + leftWidth - left < threshold)) { + // left + this.openState('left', ins, ownerInstance, self) + } else { + // default + this.openState('none', ins, ownerInstance, self) + } + }, + + + /** + * 开启状态 + * @param {Boolean} type + * @param {Object} ins + * @param {Object} ownerInstance + */ + openState(type, ins, ownerInstance, self) { + let state = self.state + let leftWidth = state.leftWidth + let rightWidth = state.rightWidth + let left = '' + state.isopen = state.isopen ? state.isopen : 'none' + switch (type) { + case "left": + left = leftWidth + break + case "right": + left = -rightWidth + break + default: + left = 0 + } + + // && !state.throttle + + if (state.isopen !== type) { + state.throttle = true + ownerInstance.callMethod('change', { + open: type + }) + + } + + state.isopen = type + // 添加动画类 + ins.requestAnimationFrame(() => { + ins.addClass('ani'); + this.move(left, ins, ownerInstance, self) + }) + }, + + + getDirection(x, y) { + if (x > y && x > MIN_DISTANCE) { + return 'horizontal'; + } + if (y > x && y > MIN_DISTANCE) { + return 'vertical'; + } + return ''; + }, + + /** + * 重置滑动状态 + * @param {Object} event + */ + resetTouchStatus(instance, self) { + let state = self.state; + state.direction = ''; + state.deltaX = 0; + state.deltaY = 0; + state.offsetX = 0; + state.offsetY = 0; + }, + + /** + * 设置滑动开始位置 + * @param {Object} event + */ + stopTouchStart(event, ownerInstance, self) { + let instance = event.instance; + let state = self.state + this.resetTouchStatus(instance, self); + var touch = event.touches[0]; + state.startX = touch.clientX; + state.startY = touch.clientY; + }, + + /** + * 滑动中,是否禁止打开 + * @param {Object} event + */ + stopTouchMove(event, self) { + let instance = event.instance; + let state = self.state; + let touch = event.touches[0]; + + state.deltaX = touch.clientX - state.startX; + state.deltaY = touch.clientY - state.startY; + state.offsetY = Math.abs(state.deltaY); + state.offsetX = Math.abs(state.deltaX); + state.direction = state.direction || this.getDirection(state.offsetX, state.offsetY); + } +} diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue new file mode 100644 index 0000000..d79c297 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue @@ -0,0 +1,347 @@ + + + + + + diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/wx.wxs b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/wx.wxs new file mode 100644 index 0000000..b394244 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/wx.wxs @@ -0,0 +1,341 @@ +var MIN_DISTANCE = 10; + +/** + * 判断当前是否为H5、app-vue + */ +var IS_HTML5 = false +if (typeof window === 'object') IS_HTML5 = true + +/** + * 监听页面内值的变化,主要用于动态开关swipe-action + * @param {Object} newValue + * @param {Object} oldValue + * @param {Object} ownerInstance + * @param {Object} instance + */ +function showWatch(newVal, oldVal, ownerInstance, instance) { + var state = instance.getState() + getDom(instance, ownerInstance) + if (newVal && newVal !== 'none') { + openState(newVal, instance, ownerInstance) + return + } + + if (state.left) { + openState('none', instance, ownerInstance) + } + resetTouchStatus(instance) +} + +/** + * 开始触摸操作 + * @param {Object} e + * @param {Object} ins + */ +function touchstart(e, ownerInstance) { + var instance = e.instance; + var disabled = instance.getDataset().disabled + var state = instance.getState(); + getDom(instance, ownerInstance) + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false; + if (disabled) return + // 开始触摸时移除动画类 + instance.requestAnimationFrame(function() { + instance.removeClass('ani'); + ownerInstance.callMethod('closeSwipe'); + }) + + // 记录上次的位置 + state.x = state.left || 0 + // 计算滑动开始位置 + stopTouchStart(e, ownerInstance) +} + +/** + * 开始滑动操作 + * @param {Object} e + * @param {Object} ownerInstance + */ +function touchmove(e, ownerInstance) { + var instance = e.instance; + var disabled = instance.getDataset().disabled + var state = instance.getState() + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false; + if (disabled) return + // 是否可以滑动页面 + stopTouchMove(e); + if (state.direction !== 'horizontal') { + return; + } + + if (e.preventDefault) { + // 阻止页面滚动 + e.preventDefault() + } + + move(state.x + state.deltaX, instance, ownerInstance) +} + +/** + * 结束触摸操作 + * @param {Object} e + * @param {Object} ownerInstance + */ +function touchend(e, ownerInstance) { + var instance = e.instance; + var disabled = instance.getDataset().disabled + var state = instance.getState() + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false; + + if (disabled) return + // 滑动过程中触摸结束,通过阙值判断是开启还是关闭 + // fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13 + moveDirection(state.left, instance, ownerInstance) + +} + +/** + * 设置移动距离 + * @param {Object} value + * @param {Object} instance + * @param {Object} ownerInstance + */ +function move(value, instance, ownerInstance) { + value = value || 0 + var state = instance.getState() + var leftWidth = state.leftWidth + var rightWidth = state.rightWidth + // 获取可滑动范围 + state.left = range(value, -rightWidth, leftWidth); + instance.requestAnimationFrame(function() { + instance.setStyle({ + transform: 'translateX(' + state.left + 'px)', + '-webkit-transform': 'translateX(' + state.left + 'px)' + }) + }) + +} + +/** + * 获取元素信息 + * @param {Object} instance + * @param {Object} ownerInstance + */ +function getDom(instance, ownerInstance) { + var state = instance.getState() + var leftDom = ownerInstance.selectComponent('.button-group--left') + var rightDom = ownerInstance.selectComponent('.button-group--right') + var leftStyles = { + width: 0 + } + var rightStyles = { + width: 0 + } + leftStyles = leftDom.getBoundingClientRect() + rightStyles = rightDom.getBoundingClientRect() + + state.leftWidth = leftStyles.width || 0 + state.rightWidth = rightStyles.width || 0 + state.threshold = instance.getDataset().threshold +} + +/** + * 获取范围 + * @param {Object} num + * @param {Object} min + * @param {Object} max + */ +function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} + + +/** + * 移动方向判断 + * @param {Object} left + * @param {Object} value + * @param {Object} ownerInstance + * @param {Object} ins + */ +function moveDirection(left, ins, ownerInstance) { + var state = ins.getState() + var threshold = state.threshold + var position = state.position + var isopen = state.isopen || 'none' + var leftWidth = state.leftWidth + var rightWidth = state.rightWidth + if (state.deltaX === 0) { + openState('none', ins, ownerInstance) + return + } + if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && + rightWidth + + left < threshold)) { + // right + openState('right', ins, ownerInstance) + } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 && + leftWidth - left < threshold)) { + // left + openState('left', ins, ownerInstance) + } else { + // default + openState('none', ins, ownerInstance) + } +} + + +/** + * 开启状态 + * @param {Boolean} type + * @param {Object} ins + * @param {Object} ownerInstance + */ +function openState(type, ins, ownerInstance) { + var state = ins.getState() + var leftWidth = state.leftWidth + var rightWidth = state.rightWidth + var left = '' + state.isopen = state.isopen ? state.isopen : 'none' + switch (type) { + case "left": + left = leftWidth + break + case "right": + left = -rightWidth + break + default: + left = 0 + } + + // && !state.throttle + + if (state.isopen !== type) { + state.throttle = true + ownerInstance.callMethod('change', { + open: type + }) + + } + + state.isopen = type + // 添加动画类 + ins.requestAnimationFrame(function() { + ins.addClass('ani'); + move(left, ins, ownerInstance) + }) + // 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的 +} + + +function getDirection(x, y) { + if (x > y && x > MIN_DISTANCE) { + return 'horizontal'; + } + if (y > x && y > MIN_DISTANCE) { + return 'vertical'; + } + return ''; +} + +/** + * 重置滑动状态 + * @param {Object} event + */ +function resetTouchStatus(instance) { + var state = instance.getState(); + state.direction = ''; + state.deltaX = 0; + state.deltaY = 0; + state.offsetX = 0; + state.offsetY = 0; +} + +/** + * 设置滑动开始位置 + * @param {Object} event + */ +function stopTouchStart(event) { + var instance = event.instance; + var state = instance.getState(); + resetTouchStatus(instance); + var touch = event.touches[0]; + if (IS_HTML5 && isPC()) { + touch = event; + } + state.startX = touch.clientX; + state.startY = touch.clientY; +} + +/** + * 滑动中,是否禁止打开 + * @param {Object} event + */ +function stopTouchMove(event) { + var instance = event.instance; + var state = instance.getState(); + var touch = event.touches[0]; + if (IS_HTML5 && isPC()) { + touch = event; + } + state.deltaX = touch.clientX - state.startX; + state.deltaY = touch.clientY - state.startY; + state.offsetY = Math.abs(state.deltaY); + state.offsetX = Math.abs(state.deltaX); + state.direction = state.direction || getDirection(state.offsetX, state.offsetY); +} + +function isPC() { + var userAgentInfo = navigator.userAgent; + var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; + var flag = true; + for (var v = 0; v < Agents.length - 1; v++) { + if (userAgentInfo.indexOf(Agents[v]) > 0) { + flag = false; + break; + } + } + return flag; +} + +var movable = false + +function mousedown(e, ins) { + if (!IS_HTML5) return + if (!isPC()) return + touchstart(e, ins) + movable = true +} + +function mousemove(e, ins) { + if (!IS_HTML5) return + if (!isPC()) return + if (!movable) return + touchmove(e, ins) +} + +function mouseup(e, ins) { + if (!IS_HTML5) return + if (!isPC()) return + touchend(e, ins) + movable = false +} + +function mouseleave(e, ins) { + if (!IS_HTML5) return + if (!isPC()) return + movable = false +} + +module.exports = { + showWatch: showWatch, + touchstart: touchstart, + touchmove: touchmove, + touchend: touchend, + mousedown: mousedown, + mousemove: mousemove, + mouseup: mouseup, + mouseleave: mouseleave +} diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue b/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue new file mode 100644 index 0000000..4971782 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/uni_modules/uni-swipe-action/package.json b/uni_modules/uni-swipe-action/package.json new file mode 100644 index 0000000..69135de --- /dev/null +++ b/uni_modules/uni-swipe-action/package.json @@ -0,0 +1,84 @@ +{ + "id": "uni-swipe-action", + "displayName": "uni-swipe-action 滑动操作", + "version": "1.3.8", + "description": "SwipeAction 滑动操作操作组件", + "keywords": [ + "", + "uni-ui", + "uniui", + "滑动删除", + "侧滑删除" + ], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "y", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-swipe-action/readme.md b/uni_modules/uni-swipe-action/readme.md new file mode 100644 index 0000000..93a5cac --- /dev/null +++ b/uni_modules/uni-swipe-action/readme.md @@ -0,0 +1,11 @@ + + +## SwipeAction 滑动操作 +> **组件名:uni-swipe-action** +> 代码块: `uSwipeAction`、`uSwipeActionItem` + + +通过滑动触发选项的容器 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-swipe-action) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-swiper-dot/changelog.md b/uni_modules/uni-swiper-dot/changelog.md new file mode 100644 index 0000000..85cf54d --- /dev/null +++ b/uni_modules/uni-swiper-dot/changelog.md @@ -0,0 +1,12 @@ +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-swiper-dot](https://uniapp.dcloud.io/component/uniui/uni-swiper-dot) +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.6(2021-05-12) +- 新增 示例地址 +- 修复 示例项目缺少组件的Bug +## 1.0.5(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 clickItem 事件,支持指示点控制轮播 +- 新增 支持 pc 可用 diff --git a/uni_modules/uni-swiper-dot/components/uni-swiper-dot/uni-swiper-dot.vue b/uni_modules/uni-swiper-dot/components/uni-swiper-dot/uni-swiper-dot.vue new file mode 100644 index 0000000..e66b6c7 --- /dev/null +++ b/uni_modules/uni-swiper-dot/components/uni-swiper-dot/uni-swiper-dot.vue @@ -0,0 +1,218 @@ + + + + + diff --git a/uni_modules/uni-swiper-dot/package.json b/uni_modules/uni-swiper-dot/package.json new file mode 100644 index 0000000..f2dd8d2 --- /dev/null +++ b/uni_modules/uni-swiper-dot/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-swiper-dot", + "displayName": "uni-swiper-dot 轮播图指示点", + "version": "1.2.0", + "description": "自定义轮播图指示点组件", + "keywords": [ + "uni-ui", + "uniui", + "轮播图指示点", + "dot", + "swiper" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-swiper-dot/readme.md b/uni_modules/uni-swiper-dot/readme.md new file mode 100644 index 0000000..7d397e2 --- /dev/null +++ b/uni_modules/uni-swiper-dot/readme.md @@ -0,0 +1,11 @@ + + +## SwiperDot 轮播图指示点 +> **组件名:uni-swiper-dot** +> 代码块: `uSwiperDot` + + +自定义轮播图指示点 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-swiper-dot) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-table/changelog.md b/uni_modules/uni-table/changelog.md new file mode 100644 index 0000000..9f87c67 --- /dev/null +++ b/uni_modules/uni-table/changelog.md @@ -0,0 +1,27 @@ +## 1.2.3(2023-03-28) +- 修复 在vue3模式下可能会出现错误的问题 +## 1.2.2(2022-11-29) +- 优化 主题样式 +## 1.2.1(2022-06-06) +- 修复 微信小程序存在无使用组件的问题 +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-table](https://uniapp.dcloud.io/component/uniui/uni-table) +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.7(2021-07-08) +- 新增 uni-th 支持 date 日期筛选范围 +## 1.0.6(2021-07-05) +- 新增 uni-th 支持 range 筛选范围 +## 1.0.5(2021-06-28) +- 新增 uni-th 筛选功能 +## 1.0.4(2021-05-12) +- 新增 示例地址 +- 修复 示例项目缺少组件的Bug +## 1.0.3(2021-04-16) +- 新增 sortable 属性,是否开启单列排序 +- 优化 表格多选逻辑 +## 1.0.2(2021-03-22) +- uni-tr 添加 disabled 属性,用于 type=selection 时,设置某行是否可由全选按钮控制 +## 1.0.1(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-table/components/uni-table/uni-table.vue b/uni_modules/uni-table/components/uni-table/uni-table.vue new file mode 100644 index 0000000..21d9527 --- /dev/null +++ b/uni_modules/uni-table/components/uni-table/uni-table.vue @@ -0,0 +1,455 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-tbody/uni-tbody.vue b/uni_modules/uni-table/components/uni-tbody/uni-tbody.vue new file mode 100644 index 0000000..fbe1bdc --- /dev/null +++ b/uni_modules/uni-table/components/uni-tbody/uni-tbody.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-td/uni-td.vue b/uni_modules/uni-table/components/uni-td/uni-td.vue new file mode 100644 index 0000000..9ce93e9 --- /dev/null +++ b/uni_modules/uni-table/components/uni-td/uni-td.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-th/filter-dropdown.vue b/uni_modules/uni-table/components/uni-th/filter-dropdown.vue new file mode 100644 index 0000000..df22a71 --- /dev/null +++ b/uni_modules/uni-table/components/uni-th/filter-dropdown.vue @@ -0,0 +1,511 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-th/uni-th.vue b/uni_modules/uni-table/components/uni-th/uni-th.vue new file mode 100644 index 0000000..14889dd --- /dev/null +++ b/uni_modules/uni-table/components/uni-th/uni-th.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-thead/uni-thead.vue b/uni_modules/uni-table/components/uni-thead/uni-thead.vue new file mode 100644 index 0000000..0dd18cd --- /dev/null +++ b/uni_modules/uni-table/components/uni-thead/uni-thead.vue @@ -0,0 +1,129 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-tr/table-checkbox.vue b/uni_modules/uni-table/components/uni-tr/table-checkbox.vue new file mode 100644 index 0000000..1089187 --- /dev/null +++ b/uni_modules/uni-table/components/uni-tr/table-checkbox.vue @@ -0,0 +1,179 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-tr/uni-tr.vue b/uni_modules/uni-table/components/uni-tr/uni-tr.vue new file mode 100644 index 0000000..f9b9671 --- /dev/null +++ b/uni_modules/uni-table/components/uni-tr/uni-tr.vue @@ -0,0 +1,171 @@ + + + + + diff --git a/uni_modules/uni-table/i18n/en.json b/uni_modules/uni-table/i18n/en.json new file mode 100644 index 0000000..e32023c --- /dev/null +++ b/uni_modules/uni-table/i18n/en.json @@ -0,0 +1,9 @@ +{ + "filter-dropdown.reset": "Reset", + "filter-dropdown.search": "Search", + "filter-dropdown.submit": "Submit", + "filter-dropdown.filter": "Filter", + "filter-dropdown.gt": "Greater or equal to", + "filter-dropdown.lt": "Less than or equal to", + "filter-dropdown.date": "Date" +} diff --git a/uni_modules/uni-table/i18n/es.json b/uni_modules/uni-table/i18n/es.json new file mode 100644 index 0000000..9afd04b --- /dev/null +++ b/uni_modules/uni-table/i18n/es.json @@ -0,0 +1,9 @@ +{ + "filter-dropdown.reset": "Reiniciar", + "filter-dropdown.search": "Búsqueda", + "filter-dropdown.submit": "Entregar", + "filter-dropdown.filter": "Filtrar", + "filter-dropdown.gt": "Mayor o igual a", + "filter-dropdown.lt": "Menos que o igual a", + "filter-dropdown.date": "Fecha" +} diff --git a/uni_modules/uni-table/i18n/fr.json b/uni_modules/uni-table/i18n/fr.json new file mode 100644 index 0000000..b006237 --- /dev/null +++ b/uni_modules/uni-table/i18n/fr.json @@ -0,0 +1,9 @@ +{ + "filter-dropdown.reset": "Réinitialiser", + "filter-dropdown.search": "Chercher", + "filter-dropdown.submit": "Soumettre", + "filter-dropdown.filter": "Filtre", + "filter-dropdown.gt": "Supérieur ou égal à", + "filter-dropdown.lt": "Inférieur ou égal à", + "filter-dropdown.date": "Date" +} diff --git a/uni_modules/uni-table/i18n/index.js b/uni_modules/uni-table/i18n/index.js new file mode 100644 index 0000000..2469dd0 --- /dev/null +++ b/uni_modules/uni-table/i18n/index.js @@ -0,0 +1,12 @@ +import en from './en.json' +import es from './es.json' +import fr from './fr.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + es, + fr, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-table/i18n/zh-Hans.json b/uni_modules/uni-table/i18n/zh-Hans.json new file mode 100644 index 0000000..862af17 --- /dev/null +++ b/uni_modules/uni-table/i18n/zh-Hans.json @@ -0,0 +1,9 @@ +{ + "filter-dropdown.reset": "重置", + "filter-dropdown.search": "搜索", + "filter-dropdown.submit": "确定", + "filter-dropdown.filter": "筛选", + "filter-dropdown.gt": "大于等于", + "filter-dropdown.lt": "小于等于", + "filter-dropdown.date": "日期范围" +} diff --git a/uni_modules/uni-table/i18n/zh-Hant.json b/uni_modules/uni-table/i18n/zh-Hant.json new file mode 100644 index 0000000..64f8061 --- /dev/null +++ b/uni_modules/uni-table/i18n/zh-Hant.json @@ -0,0 +1,9 @@ +{ + "filter-dropdown.reset": "重置", + "filter-dropdown.search": "搜索", + "filter-dropdown.submit": "確定", + "filter-dropdown.filter": "篩選", + "filter-dropdown.gt": "大於等於", + "filter-dropdown.lt": "小於等於", + "filter-dropdown.date": "日期範圍" +} diff --git a/uni_modules/uni-table/package.json b/uni_modules/uni-table/package.json new file mode 100644 index 0000000..7c2f91c --- /dev/null +++ b/uni_modules/uni-table/package.json @@ -0,0 +1,83 @@ +{ + "id": "uni-table", + "displayName": "uni-table 表格", + "version": "1.2.3", + "description": "表格组件,多用于展示多条结构类似的数据,如", + "keywords": [ + "uni-ui", + "uniui", + "table", + "表格" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss","uni-datetime-picker"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "n" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "n", + "QQ": "y" + }, + "快应用": { + "华为": "n", + "联盟": "n" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-table/readme.md b/uni_modules/uni-table/readme.md new file mode 100644 index 0000000..bb08c79 --- /dev/null +++ b/uni_modules/uni-table/readme.md @@ -0,0 +1,13 @@ + + +## Table 表单 +> 组件名:``uni-table``,代码块: `uTable`。 + +用于展示多条结构类似的数据 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-table) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + + + diff --git a/uni_modules/uni-tag/changelog.md b/uni_modules/uni-tag/changelog.md new file mode 100644 index 0000000..c0c5839 --- /dev/null +++ b/uni_modules/uni-tag/changelog.md @@ -0,0 +1,21 @@ +## 2.1.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-tag](https://uniapp.dcloud.io/component/uniui/uni-tag) +## 2.0.0(2021-11-09) +- 新增 提供组件设计资源,组件样式调整 +- 移除 插槽 +- 移除 type 属性的 royal 选项 +## 1.1.1(2021-08-11) +- type 不是 default 时,size 为 small 字体大小显示不正确 +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.7(2021-06-18) +- 修复 uni-tag 在字节跳动小程序上 css 类名编译错误的 bug +## 1.0.6(2021-06-04) +- 修复 未定义 sass 变量 "$uni-color-royal" 的bug +## 1.0.5(2021-05-10) +- 修复 royal 类型无效的bug +- 修复 uni-tag 宽度不自适应的bug +- 新增 uni-tag 支持属性 custom-style 自定义样式 +## 1.0.4(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-tag/components/uni-tag/uni-tag.vue b/uni_modules/uni-tag/components/uni-tag/uni-tag.vue new file mode 100644 index 0000000..418c955 --- /dev/null +++ b/uni_modules/uni-tag/components/uni-tag/uni-tag.vue @@ -0,0 +1,252 @@ + + + + + diff --git a/uni_modules/uni-tag/package.json b/uni_modules/uni-tag/package.json new file mode 100644 index 0000000..1878088 --- /dev/null +++ b/uni_modules/uni-tag/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-tag", + "displayName": "uni-tag 标签", + "version": "2.1.0", + "description": "Tag 组件,用于展示1个或多个文字标签,可点击切换选中、不选中的状态。", + "keywords": [ + "uni-ui", + "uniui", + "", + "tag", + "标签" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-tag/readme.md b/uni_modules/uni-tag/readme.md new file mode 100644 index 0000000..6e78ff5 --- /dev/null +++ b/uni_modules/uni-tag/readme.md @@ -0,0 +1,13 @@ + + +## Tag 标签 +> **组件名:uni-tag** +> 代码块: `uTag` + + +用于展示1个或多个文字标签,可点击切换选中、不选中的状态 。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-tag) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-title/changelog.md b/uni_modules/uni-title/changelog.md new file mode 100644 index 0000000..7626216 --- /dev/null +++ b/uni_modules/uni-title/changelog.md @@ -0,0 +1,10 @@ +## 1.1.1(2022-05-19) +- 修改组件描述 +## 1.1.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-title](https://uniapp.dcloud.io/component/uniui/uni-title) +## 1.0.2(2021-05-12) +- 新增 示例地址 +- 修复 示例项目缺少组件的Bug +## 1.0.1(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-title/components/uni-title/uni-title.vue b/uni_modules/uni-title/components/uni-title/uni-title.vue new file mode 100644 index 0000000..bf4f926 --- /dev/null +++ b/uni_modules/uni-title/components/uni-title/uni-title.vue @@ -0,0 +1,171 @@ + + + + + diff --git a/uni_modules/uni-title/package.json b/uni_modules/uni-title/package.json new file mode 100644 index 0000000..2249f5a --- /dev/null +++ b/uni_modules/uni-title/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-title", + "displayName": "uni-title 章节标题", + "version": "1.1.1", + "description": "章节标题,通常用于记录页面标题,使用当前组件,uni-app 如果开启统计,将会自动统计页面标题", + "keywords": [ + "uni-ui", + "uniui", + "标题", + "章节", + "章节标题", + "" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-title/readme.md b/uni_modules/uni-title/readme.md new file mode 100644 index 0000000..0e60b1b --- /dev/null +++ b/uni_modules/uni-title/readme.md @@ -0,0 +1,14 @@ + + +## Title 标题 +> **组件名:uni-title** +> 代码块: `uTitle` + + +章节标题,通常用于记录页面标题,使用当前组件,uni-app 如果开启统计,将会自动统计页面标题 。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-title) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + + diff --git a/uni_modules/uni-tooltip/changelog.md b/uni_modules/uni-tooltip/changelog.md new file mode 100644 index 0000000..00f1572 --- /dev/null +++ b/uni_modules/uni-tooltip/changelog.md @@ -0,0 +1,10 @@ +## 0.2.1(2022-05-09) +- 修复 content 为空时仍然弹出的bug +## 0.2.0(2022-05-07) +**注意:破坏性更新** +- 更新 text 属性变更为 content +- 更新 移除 width 属性 +## 0.1.1(2022-04-27) +- 修复 组件根 text 嵌套组件 warning +## 0.1.0(2022-04-21) +- 初始化 diff --git a/uni_modules/uni-tooltip/components/uni-tooltip/uni-tooltip.vue b/uni_modules/uni-tooltip/components/uni-tooltip/uni-tooltip.vue new file mode 100644 index 0000000..ffbb6fa --- /dev/null +++ b/uni_modules/uni-tooltip/components/uni-tooltip/uni-tooltip.vue @@ -0,0 +1,68 @@ + + + + + + diff --git a/uni_modules/uni-tooltip/package.json b/uni_modules/uni-tooltip/package.json new file mode 100644 index 0000000..b626efb --- /dev/null +++ b/uni_modules/uni-tooltip/package.json @@ -0,0 +1,83 @@ +{ + "id": "uni-tooltip", + "displayName": "uni-tooltip", + "version": "0.2.1", + "description": "Tooltip 提示文字", + "keywords": [ + "uni-tooltip", + "uni-ui", + "tooltip", + "tip", + "文字提示" +], + "repository": "", +"engines": { + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无 ", + "data": "无", + "permissions": "无" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-vue": "y", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-tooltip/readme.md b/uni_modules/uni-tooltip/readme.md new file mode 100644 index 0000000..faafa2e --- /dev/null +++ b/uni_modules/uni-tooltip/readme.md @@ -0,0 +1,8 @@ +## Badge 数字角标 +> **组件名:uni-tooltip** +> 代码块: `uTooltip` + +数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景, + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-tooltip) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 diff --git a/uni_modules/uni-transition/changelog.md b/uni_modules/uni-transition/changelog.md new file mode 100644 index 0000000..70c1cd4 --- /dev/null +++ b/uni_modules/uni-transition/changelog.md @@ -0,0 +1,22 @@ +## 1.3.2(2023-05-04) +- 修复 NVUE 平台报错的问题 +## 1.3.1(2021-11-23) +- 修复 init 方法初始化问题 +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-transition](https://uniapp.dcloud.io/component/uniui/uni-transition) +## 1.2.1(2021-09-27) +- 修复 init 方法不生效的 Bug +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.1(2021-05-12) +- 新增 示例地址 +- 修复 示例项目缺少组件的 Bug +## 1.1.0(2021-04-22) +- 新增 通过方法自定义动画 +- 新增 custom-class 非 NVUE 平台支持自定义 class 定制样式 +- 优化 动画触发逻辑,使动画更流畅 +- 优化 支持单独的动画类型 +- 优化 文档示例 +## 1.0.2(2021-02-05) +- 调整为 uni_modules 目录规范 diff --git a/uni_modules/uni-transition/components/uni-transition/createAnimation.js b/uni_modules/uni-transition/components/uni-transition/createAnimation.js new file mode 100644 index 0000000..8f89b18 --- /dev/null +++ b/uni_modules/uni-transition/components/uni-transition/createAnimation.js @@ -0,0 +1,131 @@ +// const defaultOption = { +// duration: 300, +// timingFunction: 'linear', +// delay: 0, +// transformOrigin: '50% 50% 0' +// } +// #ifdef APP-NVUE +const nvueAnimation = uni.requireNativePlugin('animation') +// #endif +class MPAnimation { + constructor(options, _this) { + this.options = options + // 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误 + this.animation = uni.createAnimation({ + ...options + }) + this.currentStepAnimates = {} + this.next = 0 + this.$ = _this + + } + + _nvuePushAnimates(type, args) { + let aniObj = this.currentStepAnimates[this.next] + let styles = {} + if (!aniObj) { + styles = { + styles: {}, + config: {} + } + } else { + styles = aniObj + } + if (animateTypes1.includes(type)) { + if (!styles.styles.transform) { + styles.styles.transform = '' + } + let unit = '' + if(type === 'rotate'){ + unit = 'deg' + } + styles.styles.transform += `${type}(${args+unit}) ` + } else { + styles.styles[type] = `${args}` + } + this.currentStepAnimates[this.next] = styles + } + _animateRun(styles = {}, config = {}) { + let ref = this.$.$refs['ani'].ref + if (!ref) return + return new Promise((resolve, reject) => { + nvueAnimation.transition(ref, { + styles, + ...config + }, res => { + resolve() + }) + }) + } + + _nvueNextAnimate(animates, step = 0, fn) { + let obj = animates[step] + if (obj) { + let { + styles, + config + } = obj + this._animateRun(styles, config).then(() => { + step += 1 + this._nvueNextAnimate(animates, step, fn) + }) + } else { + this.currentStepAnimates = {} + typeof fn === 'function' && fn() + this.isEnd = true + } + } + + step(config = {}) { + // #ifndef APP-NVUE + this.animation.step(config) + // #endif + // #ifdef APP-NVUE + this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config) + this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin + this.next++ + // #endif + return this + } + + run(fn) { + // #ifndef APP-NVUE + this.$.animationData = this.animation.export() + this.$.timer = setTimeout(() => { + typeof fn === 'function' && fn() + }, this.$.durationTime) + // #endif + // #ifdef APP-NVUE + this.isEnd = false + let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref + if(!ref) return + this._nvueNextAnimate(this.currentStepAnimates, 0, fn) + this.next = 0 + // #endif + } +} + + +const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', + 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', + 'translateZ' +] +const animateTypes2 = ['opacity', 'backgroundColor'] +const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom'] +animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => { + MPAnimation.prototype[type] = function(...args) { + // #ifndef APP-NVUE + this.animation[type](...args) + // #endif + // #ifdef APP-NVUE + this._nvuePushAnimates(type, args) + // #endif + return this + } +}) + +export function createAnimation(option, _this) { + if(!_this) return + clearTimeout(_this.timer) + return new MPAnimation(option, _this) +} diff --git a/uni_modules/uni-transition/components/uni-transition/uni-transition.vue b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue new file mode 100644 index 0000000..bfbba93 --- /dev/null +++ b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue @@ -0,0 +1,286 @@ + + + + + diff --git a/uni_modules/uni-transition/package.json b/uni_modules/uni-transition/package.json new file mode 100644 index 0000000..ea995a2 --- /dev/null +++ b/uni_modules/uni-transition/package.json @@ -0,0 +1,84 @@ +{ + "id": "uni-transition", + "displayName": "uni-transition 过渡动画", + "version": "1.3.2", + "description": "元素的简单过渡动画", + "keywords": [ + "uni-ui", + "uniui", + "动画", + "过渡", + "过渡动画" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-transition/readme.md b/uni_modules/uni-transition/readme.md new file mode 100644 index 0000000..2f8a77e --- /dev/null +++ b/uni_modules/uni-transition/readme.md @@ -0,0 +1,11 @@ + + +## Transition 过渡动画 +> **组件名:uni-transition** +> 代码块: `uTransition` + + +元素过渡动画 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-transition) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-ui/changelog.md b/uni_modules/uni-ui/changelog.md new file mode 100644 index 0000000..61b26d0 --- /dev/null +++ b/uni_modules/uni-ui/changelog.md @@ -0,0 +1,541 @@ +## 1.4.27(2023-04-23) +- uni-calendar 修复 某些情况 monthSwitch 未触发的Bug +- uni-calendar 修复 某些情况切换月份错误的Bug +- uni-data-picker 修复 更改 modelValue 报错的 bug +- uni-data-picker 修复 v-for 未使用 key 值控制台 warning +- uni-data-picker 修复代码合并时引发 value 属性为空时不渲染数据的问题 +- uni-data-picker 修复 localdata 不支持动态更新的bug +- uni-data-select 修复 微信小程序点击时会改变背景颜色的 bug +- uni-data-select 修复 禁用时会显示清空按钮 +- uni-data-select 优化 查询条件短期内多次变更只查询最后一次变更后的结果 +- uni-data-select 调整 内部缓存键名调整为 uni-data-select-lastSelectedValue +- uni-datetime-picker 修复 日历 picker 修改年月后,自动选中当月1日 [详情](https://ask.dcloud.net.cn/question/165937) +- uni-datetime-picker 修复 小程序端 低版本 ios NaN [详情](https://ask.dcloud.net.cn/question/162979) +- uni-datetime-picker 修复 firefox 浏览器显示区域点击无法拉起日历弹框的Bug [详情](https://ask.dcloud.net.cn/question/163362) +- uni-datetime-picker 优化 值为空依然选中当天问题 +- uni-datetime-picker 优化 提供 default-value 属性支持配置选择器打开时默认显示的时间 +- uni-datetime-picker 优化 非范围选择未选择日期时间,点击确认按钮选中当前日期时间 +- uni-datetime-picker 优化 字节小程序日期时间范围选择,底部日期换行问题 +- uni-datetime-picker 修复 2.2.18 引起范围选择配置 end 选择无效的Bug [详情](https://github.com/dcloudio/uni-ui/issues/686) +- uni-datetime-picker 修复 移动端范围选择change事件触发异常的Bug [详情](https://github.com/dcloudio/uni-ui/issues/684) +- uni-datetime-picker 优化 PC端输入日期格式错误时返回当前日期时间 +- uni-datetime-picker 优化 PC端输入日期时间超出 start、end 限制的Bug +- uni-datetime-picker 优化 移动端日期时间范围用法时间展示不完整问题 +- uni-datetime-picker 修复 小程序端绑定 Date 类型报错的Bug [详情](https://github.com/dcloudio/uni-ui/issues/679) +- uni-datetime-picker 修复 vue3 time-picker 无法显示绑定时分秒的Bug +- uni-datetime-picker 修复 字节小程序报错的Bug +- uni-datetime-picker 修复 某些情况切换月份错误的Bug +- uni-easyinput 修复 vue3 下 keyboardheightchange 事件报错的bug +- uni-easyinput 优化 trim 属性默认值 +- uni-easyinput 新增 cursor-spacing 属性 +- uni-fab 新增 pattern.icon 属性,可自定义图标 +- uni-file-picker 修复 手动上传删除一个文件后不能再上传的bug +- uni-forms 修复 required 参数无法动态绑定 +- uni-list 优化 uni-list-chat 具名插槽`header` 非app端套一层元素,方便使用时通过外层元素定位实现样式修改 +- uni-list uni-list-chat 新增 支持具名插槽`header` +- uni-list 新增 列表图标新增 customPrefix 属性 ,用法 [详见](https://uniapp.dcloud.net.cn/component/uniui/uni-icons.html#icons-props) +- uni-nav-bar 修复 自定义状态栏高度闪动BUG +- uni-nav-bar 修复 暗黑模式下边线颜色错误的bug +- uni-popup 修复 uni-popup 重复打开时的 bug +- uni-popup uni-popup-dialog 组件新增 inputType 属性 +- uni-swipe-action 修复`uni-swipe-action`和`uni-swipe-action-item`不同时使用导致 closeOther 方法报错的 bug +- uni-table 修复 在vue3模式下可能会出现错误的问题 +## 1.4.26(2023-01-31) +- uni-badge 修复 运行/打包 控制台警告问题 +- uni-calendar 修复 某些情况切换月份错误问题 +- uni-data-select 修复 不关联服务空间报错的问题 +- uni-data-select 新增 属性 `format` 可用于格式化显示选项内容 +- uni-datetime-picker 修复 某些情况切换月份错误问题 +- uni-easyinput 新增 keyboardheightchange 事件,可监听键盘高度变化 +- uni-list 修复 无反馈效果呈现的bug +## 1.4.25(2023-01-11) +- uni-file-picker 新增 sourceType 属性, 可以自定义图片和视频选择的来源 +## 1.4.24(2023-01-11) +- uni-data-select 修复 当where变化时,数据不会自动更新的问题 +- uni-datetime-picker 修复 多次加载组件造成内存占用的 bug +- uni-datetime-picker 修复 vue3 下 i18n 国际化初始值不正确的 bug +- uni-easyinput 修复 props 中背景颜色无默认值的bug +- uni-list 修复 uni-list-chat 在vue3下跳转报错的bug +- uni-list 修复 uni-list-chat avatar属性 值为本地路径时错误的问题 +- uni-list 修复 uni-list-chat avatar属性 在腾讯云版uniCloud下错误的问题 +- uni-list 修复 uni-list-chat note属性 支持:“草稿”字样功能 文本少1位的问题 +- uni-list 修复 uni-list-item 的 customStyle 属性 padding值在 H5端 无效的bug +- uni-list 修复 uni-list-item 的 customStyle 属性 padding值在nvue(vue2)下无效的bug +- uni-list uni-list-chat 新增 avatar 支持 fileId +- uni-list uni-list 新增属性 render-reverse 详情参考:[https://uniapp.dcloud.net.cn/component/list.html](https://uniapp.dcloud.net.cn/component/list.html) +- uni-list uni-list-chat note属性 支持:“草稿”字样 加红显示 详情参考uni-im:[https://ext.dcloud.net.cn/plugin?name=uni-im](https://ext.dcloud.net.cn/plugin?name=uni-im) +- uni-list uni-list-item 新增属性 customStyle 支持设置padding、backgroundColor +- uni-popup 修复 nvue 下 v-show 报错 +## 1.4.23(2022-10-25) +- uni-datetime-picker 修复,支付宝小程序样式错乱,[详情](https://github.com/dcloudio/uni-app/issues/3861) + +- uni-nav-bar 修复 条件编译错误的bug +- uni-nav-bar 修复 nvue 环境 fixed 为 true 的情况下,无法置顶的 bug +## 1.4.22(2022-09-19) +- 优化 部分组件适配 uni-scss 主题色 +- uni-badge 修复 当 text 超过 max-num 时,badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473) +- uni-calendar 修复 表头年月切换,导致改变当前日期为选择月1号,且未触发change事件 +- uni-data-select 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框 +- uni-data-select 修复 点击的位置不准确 +- uni-data-select 新增 支持 disabled 属性 +- uni-datetime-picker 修复,反向选择日期范围,日期显示异常,[详情](https://ask.dcloud.net.cn/question/153401?item_id=212892&rf=false) +- uni-datetime-picker 修复 close事件无效的 bug +- uni-datetime-picker 修复 移动端 maskClick 无效的 bug,详见:[https://ask.dcloud.net.cn/question/140824?item_id=209458&rf=false](https://ask.dcloud.net.cn/question/140824?item_id=209458&rf=false) +- uni-fab 修复 小程序端由于 style 使用了对象导致报错,[详情](https://ask.dcloud.net.cn/question/152790?item_id=211778&rf=false) +- uni-fab 修复 nvue 环境下,具有 tabBar 时,fab 组件下部位置无法正常获取 --window-bottom 的bug,详见:[https://ask.dcloud.net.cn/question/110638?notification_id=826310](https://ask.dcloud.net.cn/question/110638?notification_id=826310) +- uni-forms 优化 根据 rules 自动添加 required 的问题 +- uni-forms 修复 item 未设置 require 属性,rules 设置 require 后,星号也显示的 bug,详见:[https://ask.dcloud.net.cn/question/151540](https://ask.dcloud.net.cn/question/151540) +- uni-nav-bar 修复 nvue 环境下 fixed 为 true 的情况下,无法置顶的 bug +- uni-notice-bar 新增 属性 fontSize,可修改文字大小。 +- uni-pagination 修复,未对主题色设置默认色,导致未引入 uni-scss 变量文件报错。 +- uni-pagination 修复,未对移动端当前页文字做主题色适配。 +- uni-pagination 修复 es 语言 i18n 错误 +## 1.4.21(2022-09-19) +- 修复,安装时未导入 uni-data-select 和 uni-tooltip 的问题。 +## 1.4.20(2022-07-25) +- uni-section 新增组件 +- uni-forms 修复 model 需要校验的值没有声明对应字段时,导致第一次不触发校验的bug + +## 1.4.19(2022-07-07) +- uni-data-picker 优化 pc端图标位置不正确的问题 +- uni-data-select 修复 pc端宽度异常的bug +## 1.4.18(2022-07-06) +- uni-forms 【重要】组件逻辑重构,部分用法旧版本不兼容,请注意兼容问题 +- uni-forms 【重要】组件使用 Provide/Inject 方式注入依赖,提供了自定义表单组件调用 uni-forms 校验表单的能力 +- uni-forms 新增 更多表单示例 +- uni-forms 新增 model 属性,等同于原 value/modelValue 属性,旧属性即将废弃 +- uni-forms 新增 validateTrigger 属性的 blur 值,仅 uni-easyinput 生效 +- uni-forms 新增 onFieldChange 方法,可以对子表单进行校验,可替代binddata方法 +- uni-forms 新增 子表单的 setRules 方法,配合自定义校验函数使用 +- uni-forms 新增 uni-forms-item 的 setRules 方法,配置动态表单使用可动态更新校验规则 +- uni-forms 修复 由 1.4.0 引发的 label 插槽不生效的bug +- uni-forms 修复 子组件找不到 setValue 报错的bug +- uni-forms 修复 uni-data-picker 在 uni-forms-item 中报错的bug +- uni-forms 修复 uni-data-picker 在 uni-forms-item 中宽度不正确的bug +- uni-forms 修复 表单校验顺序无序问题 +- uni-forms 优化 子表单组件uni-datetime-picker、uni-data-select、uni-data-picker的显示样式 +- uni-forms 优化 动态表单校验方式,废弃拼接name的方式 +- uni-breadcrumb 修复 微信小程序 separator 不显示问题 +- uni-data-checkbox 优化 在 uni-forms 中的依赖注入方式 +- uni-data-picker 修复 uni-data-picker 在 uni-forms-item 中宽度不正确的bug +- uni-data-picker 优化 显示样式 +- uni-data-select 优化 显示样式 +- uni-datetime-picker 修复 日历顶部年月及底部确认未国际化 bug +- uni-datetime-picker 优化 组件样式,调整了组件图标大小、高度、颜色等,与uni-ui风格保持一致 +- uni-easyinput 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容 +- uni-easyinput 新增 clear 事件,点击右侧叉号图标触发 +- uni-easyinput 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发 +- uni-easyinput 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等 +- uni-easyinput 优化 clearable 显示策略 +- uni-file-picker 修复 在uni-forms下样式不生效的bug +- uni-nav-bar 修复 组件示例中插槽用法无法显示内容的bug +- uni-swipe-action 修复 vue3 下使用组件不能正常运行的Bug +- uni-swipe-action 修复 h5端点击click触发两次的Bug +- uni-table 修复 微信小程序存在无使用组件的问题 +## 1.4.17(2022-06-30) +- 支持 ios 安全区 +## 1.4.16(2022-06-06) +- uni-breadcrumb 新增 支持 uni.scss 修改颜色 +- uni-data-select 修复 localdata 赋值不生效的 bug +- uni-data-select 新增 支持选项禁用(数据选项设置 disabled: true 即禁用) +- uni-data-select 修复 当 value 为 0 时选择不生效的 bug +- uni-easyinput 修复 关闭图标某些情况下无法取消的bug +- uni-fav 新增 stat 属性 ,是否开启uni统计功能 +- uni-goods-nav 新增 stat属性,是否开启uni统计功能 +- uni-group 新增 stat属性,是否开启uni统计功能 +- uni-nav-bar 新增 stat 属性 ,可开启统计 title 上报 ,仅使用了title 属性且项目开启了uni统计生效 +- uni-search-bar 新增 readonly 属性,组件只读 +- uni-swipe-action 修复 isPC 找不到的Bug +- uni-swipe-action 修复 在 nvue 下 disabled 失效的bug +- uni-tooltip 修复 content 为空时仍然弹出的bug +## 1.4.15(2022-05-07) +- uni-data-picker 修复 字节小程序 本地数据无法选择下一级的Bug +- uni-data-select 新增 记住上次的选项(仅 collection 存在时有效) +- uni-search-bar 修复 vue3 input 事件不生效的bug +- uni-search-bar 修复 多余代码导致的bug +- uni-tooltip 更新 text 属性变更为 content +- uni-tooltip 更新 移除 width 属性 +- uni-tooltip 修复 组件根 text 嵌套组件 warning +## 1.4.14(2022-04-18) +- uni-datetime-picker 修复 Vue3 下动态赋值,单选类型未响应的 bug +- uni-easyinput 修复 默认值不生效的bug +## 1.4.13(2022-04-02) +- uni-calendar 修复 条件编译 nvue 不支持的 css 样式 +- uni-calendar 修复 startDate、 endDate 属性失效的 bug +- uni-data-picker 修复 nvue 不支持的 v-show 的 bug +- uni-data-picker 修复 条件编译 nvue 不支持的 css 样式 +- uni-datetime-picker 修复 Vue3 下动态赋值未响应的 bug +- uni-easyinput 修复 value不能为0的bug +- uni-popup 修复 弹出层内部无法滚动的bug +- uni-popup 修复 小程序中高度错误的bug +- uni-popup 修复 快速调用open出现问题的Bug +- uni-rate 修复 条件判断 `NaN` 错误的 bug +- uni-swipe-action 修复 按钮字体大小不能设置的bug +- uni-swipe-action 修复 h5和app端下报el错误的bug +- uni-swipe-action 修复 HBuilderX 1.4.X 版本中,h5和app端下报错的bug +## 1.4.12(2022-02-19) +- uni-collapse 修复 初始化的时候 ,open 属性失效的bug +- uni-data-checkbox 修复 multiple 为 true 时,v-model 的值为 null 报错的 bug +- uni-icons 优化 size 属性可以传入不带单位的字符串数值 +- uni-icons 优化 size 支持其他单位 +- uni-nav-bar 新增 left-width/right-width属性 ,可修改左右两侧的宽度 +- uni-popup 修复 safeArea 属性不能设置为false的bug +## 1.4.11(2022-01-21) +- uni-collapse 修复 微信小程序resize后组件收起的bug +- uni-countdown 修复 在微信小程序中样式不生效的bug +- uni-countdown 新增 update 方法 ,在动态更新时间后,刷新组件 +- uni-load-more 新增 showText属性 ,是否显示文本 +- uni-load-more 修复 nvue 平台下不显示文本的bug +- uni-load-more 修复 微信小程序平台样式选择器报警告的问题 +- uni-nav-bar 修复 在vue下,标题不垂直居中的bug +- uni-nav-bar 修复 height 属性类型错误 +- uni-nav-bar 新增 height 属性,可修改组件高度 +- uni-nav-bar 新增 dark 属性可可开启暗黑模式 +- uni-nav-bar 优化 标题字数过多显示省略号 +- uni-nav-bar 优化 插槽,插入内容可完全覆盖 +- uni-popup 修复 isMaskClick 失效的bug +- uni-popup 新增 cancelText \ confirmText 属性 ,可自定义文本 +- uni-popup 新增 maskBackgroundColor 属性 ,可以修改蒙版颜色 +- uni-popup 优化 maskClick属性 更新为 isMaskClick ,解决微信小程序警告的问题 + +## 1.4.10(2022-01-17) +- uni-card 修复 在vue页面下略缩图显示不正常的bug +- uni-datetime-picker 修复 clear-icon 属性在小程序平台不生效的 bug +- uni-datetime-picker 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的 bug +- uni-fab 更新 组件依赖 +- +- uni-icons 修复 nvue 有些图标不显示的bug,兼容老版本图标 +- uni-icons 优化 示例可复制图标名称 +- uni-nav-bar 修复 color 属性不生效的bug +- uni-popup 修复 设置 safeArea 属性不生效的bug +- uni-popup 优化 组件示例 +- uni-popup 修复 vuedoc 文字错误 +## 1.4.9(2021-11-23) +- uni-ui 修复 vue3中某些scss变量无法找到的问题 +- uni-combox 优化 label、label-width 属性 +- uni-data-picker 修复 由上个版本引发的map、v-model等属性不生效的bug +- uni-file-picker 修复 参数为对象的情况下,url在某些情况显示错误的bug +- uni-icons 优化 兼容旧组件 type 值 +- uni-list 修复 在vue3中to属性在发行应用的时候报错的bug +- uni-scss 修复 vue3中scss语法兼容问题 +- uni-transition 修复 init 方法初始化问题 +## 1.4.8(2021-11-19) +- uni-fab 修复 阴影颜色不正确的bug +## 1.4.7(2021-11-19) +- uni-ui 新增 支持国际化 +- uni-ui 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- uni-ui 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-ui](https://uniapp.dcloud.io/component/uniui/uni-ui) +- uni-badge 修改 size 属性默认值调整为 small +- uni-badge 修改 type 属性,默认值调整为 error,info 替换 default +- uni-badge 修复 在字节小程序上样式不生效的 bug +- uni-calendar 修复 弹出层被 tabbar 遮盖 bug +- uni-card 重构插槽的用法 ,header 替换为 title +- uni-card 新增 actions 插槽 +- uni-card 新增 cover 封面图属性和插槽 +- uni-card 新增 padding 内容默认内边距离 +- uni-card 新增 margin 卡片默认外边距离 +- uni-card 新增 spacing 卡片默认内边距 +- uni-card 新增 shadow 卡片阴影属性 +- uni-card 取消 mode 属性,可使用组合插槽代替 +- uni-card 取消 note 属性 ,使用actions插槽代替 +- uni-collapse 优化 show-arrow 属性默认为true +- uni-collapse 新增 show-arrow 属性,控制是否显示右侧箭头 +- uni-countdown 新增 font-size 支持自定义字体大小 +- uni-data-checkbox 修复 在uni-forms中 modelValue 中不存在当前字段,当前字段必填写也不参与校验的问题 +- uni-data-checkbox 修复 单选 list 模式下 ,icon 为 left 时,选中图标不显示的问题 +- uni-data-checkbox 修复 在 uni-forms 中重置表单,错误信息无法清除的问题 +- uni-dateformat 优化 默认时间不再是当前时间,而是显示'-'字符 +- uni-datetime-picker 修复 hide-second 在移动端的 bug +- uni-datetime-picker 修复 单选赋默认值时,赋值日期未高亮的 bug +- uni-datetime-picker 修复 赋默认值时,移动端未正确显示时间的 bug +- uni-datetime-picker 新增 hide-second 属性,支持只使用时分,隐藏秒 +- uni-datetime-picker 优化 取消选中时(范围选)直接开始下一次选择, 避免多点一次 +- uni-datetime-picker 优化 移动端支持清除按钮,同时支持通过 ref 调用组件的 clear 方法 +- uni-datetime-picker 优化 调整字号大小,美化日历界面 +- uni-datetime-picker 优化 范围选择器在 pc 端过宽的问题 +- uni-datetime-picker 新增 支持作为 uni-forms 子组件相关功能 +- uni-datetime-picker 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的 bug +- uni-datetime-picker 修复 type 属性动态赋值无效的 bug +- uni-datetime-picker 修复 ‘确认’按钮被 tabbar 遮盖 bug +- uni-datetime-picker 修复 组件未赋值时范围选左、右日历相同的 bug +- uni-datetime-picker 修复 范围选未正确显示当前值的 bug +- uni-datetime-picker 修复 h5 平台(移动端)报错 'cale' of undefined 的 bug +- uni-easyinput 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug +- uni-easyinput 修复 在 uni-forms 中重置表单,错误信息无法清除的问题 +- uni-file-picker 新增 参数中返回 fileID 字段 +- uni-file-picker 修复 腾讯云传入fileID 不能回显的bug +- uni-file-picker 修复 选择图片后,不能放大的问题 +- uni-file-picker 修复 由于 0.2.11 版本引起的不能回显图片的Bug +- uni-file-picker 新增 clearFiles(index) 方法,可以手动删除指定文件 +- uni-file-picker 修复 v-model 值设为 null 报错的Bug +- uni-file-picker 修复 return-type="object" 时,无法删除文件的Bug +- uni-file-picker 修复 auto-upload 属性失效的Bug +- uni-forms 修复 label 插槽不生效的bug +- uni-forms 修复 没有添加校验规则的字段依然报错的Bug +- uni-forms 修复 重置表单错误信息无法清除的问题 +- uni-forms 修复 表单验证只生效一次的问题 +- uni-icons 新增 更多图标 +- uni-icons 优化 自定义图标使用方式 +- uni-link 修复 在 nvue 下不显示的 bug +- uni-pagination 修复 current 、value 属性未监听,导致高亮样式失效的 bug +- uni-rate 优化 默认值修改为 0 颗星 +- uni-search-bar 修复 value 属性与 modelValue 属性不兼容的Bug +- uni-swipe-action 新增 close-all 方法,关闭所有已打开的组件 +- uni-swipe-action 新增 resize() 方法,在非微信小程序、h5、app-vue端出现不能滑动的问题的时候,重置组件 +- uni-swipe-action 修复 app 端偶尔出现类似 Page[x][-x,xx;-x,xx,x,x-x] 的问题 +- uni-swipe-action 优化 微信小程序、h5、app-vue 滑动逻辑,避免出现动态新增组件后不能滑动的问题 +- uni-tag 新增 提供组件设计资源,组件样式调整 +- uni-tag 移除 插槽 +- uni-tag 移除 type 属性的 royal 选项 +- uni-tag type 不是 default 时,size 为 small 字体大小显示不正确 +## 1.4.2(2021-08-20) +- 新增 uni-ui 组件支持国际化 i18n +- uni-collapse 优化 show-arrow 属性默认为true +- uni-collapse 新增 show-arrow 属性,控制是否显示右侧箭头 +- uni-data-checkbox 修复 单选 list 模式下 ,icon 为 left 时,选中图标不显示的问题 +- uni-easyinput 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug +- uni-file-picker 修复 由于 0.2.11 版本引起的不能回显图片的Bug +- uni-file-picker 新增 clearFiles(index) 方法,可以手动删除指定文件 +- uni-file-picker 修复 v-model 值设为 null 报错的Bug +- uni-swipe-action 新增 close-all 方法,关闭所有已打开的组件 +- uni-swipe-action 新增 resize() 方法,在非微信小程序、h5、app-vue端出现不能滑动的问题的时候,重置组件 +- uni-swipe-action 修复 app 端偶尔出现类似 Page[x][-x,xx;-x,xx,x,x-x] 的问题 +- uni-swipe-action 优化 微信小程序、h5、app-vue 滑动逻辑,避免出现动态新增组件后不能滑动的问题 +## 1.4.0(2021-08-13) +- uni-calendar 修复 弹出层被 tabbar 遮盖 bug +- uni-data-checkbox 修复 在 uni-forms 中重置表单,错误信息无法清除的问题 +- uni-dateformat 调整 默认时间不再是当前时间,而是显示'-'字符 +- uni-datetime-picker 新增 适配 vue3 +- uni-datetime-picker 新增 支持作为 uni-forms 子组件相关功能 +- uni-datetime-picker 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的 bug +- uni-datetime-picker 修复 type 属性动态赋值无效的 bug +- uni-datetime-picker 修复 ‘确认’按钮被 tabbar 遮盖 bug +- uni-datetime-picker 修复 组件未赋值时范围选左、右日历相同的 bug +- uni-datetime-picker 修复 范围选未正确显示当前值的 bug +- uni-datetime-picker 修复 h5 平台(移动端)报错 'cale' of undefined 的 bug +- uni-easyinput 修复 在 uni-forms 中重置表单,错误信息无法清除的问题 +- uni-file-picker 修复 return-type="object" 时,无法删除文件的Bug +- uni-file-picker 修复 auto-upload 属性失效的Bug +- uni-forms 修复 没有添加校验规则的字段依然报错的Bug +- uni-forms 修复 重置表单错误信息无法清除的问题 +- uni-forms 优化 组件文档 +- uni-forms 修复 表单验证只生效一次的问题 +- uni-tag type 不是 default 时,size 为 small 字体大小显示不正确 +## 1.3.9(2021-08-02) +- uni-datetime-picker 新增 return-type 属性支持返回 date 日期对象 +- uni-file-picker 修复 fileExtname属性不指定值报错的Bug +- uni-file-picker 修复 在某种场景下图片不回显的Bug +- uni-link 支持自定义插槽 +## 1.3.8(2021-07-31) +- uni-ui 组件兼容 vue3 +- uni-collapse 修复 由1.2.0版本引起的 change 事件返回 undefined 的Bug +- uni-collapse 优化 组件示例 +- uni-collapse 新增 组件折叠动画 +- uni-collapse 新增 value\v-model 属性 ,动态修改面板折叠状态 +- uni-collapse 新增 title 插槽 ,可定义面板标题 +- uni-collapse 新增 border 属性 ,显示隐藏面板内容分隔线 +- uni-collapse 新增 title-border 属性 ,显示隐藏面板标题分隔线 +- uni-collapse 修复 resize 方法失效的Bug +- uni-collapse 修复 change 事件返回参数不正确的Bug +- uni-collapse 优化 H5、App 平台自动更具内容更新高度,无需调用 reszie() 方法 +- uni-data-checkbox 优化 在uni-forms组件,与label不对齐的问题 +- uni-data-checkbox 修复 单选默认值为0不能选中的Bug +- uni-easyinput 优化 errorMessage 属性支持 Boolean 类型 +- uni-file-picker 修复 return-type为object下,返回值不正确的Bug +- uni-file-picker 修复(重要) H5 平台下如果和uni-forms组件一同使用导致页面卡死的问题 +- uni-file-picker 优化 h5平台下上传文件导致页面卡死的问题 +- uni-forms 修复 vue2 下条件编译导致destroyed生命周期失效的Bug +- uni-forms 修复 1.2.1 引起的示例在小程序平台报错的Bug +- uni-forms 修复 动态校验表单,默认值为空的情况下校验失效的Bug +- uni-forms 修复 不指定name属性时,运行报错的Bug +- uni-forms 优化 label默认宽度从65调整至70,使required为true且四字时不换行 +- uni-forms 优化 组件示例,新增动态校验示例代码 +- uni-forms 优化 组件文档,使用方式更清晰 +- uni-list 修复 与其他组件嵌套使用时,点击失效的Bug +- uni-swipe-action 修复 跨页面修改组件数据 ,导致不能滑动的问题 +## 1.3.7(2021-07-16) +- uni-ui 兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +- uni-datetime-picker 修复 单选日期类型,初始赋值后不在当前日历的 bug +- uni-datetime-picker 新增 clearIcon 属性,显示框的清空按钮可配置显示隐藏(仅 pc 有效) +- uni-datetime-picker 优化 移动端移除显示框的清空按钮,无实际用途 +- uni-datetime-picker 修复 组件赋值为空,界面未更新的 bug +- uni-datetime-picker 修复 start 和 end 不能动态赋值的 bug +- uni-datetime-picker 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的 bug +## 1.3.6(2021-07-09) +- uni-data-checkbox 优化 删除无用日志 +- uni-data-checkbox 修复 由 0.1.9 引起的非 nvue 端图标不显示的问题 +- uni-data-checkbox 修复 nvue 黑框样式问题 +- uni-datetime-picker 修复 范围选择不能动态赋值的 bug +- uni-datetime-picker 修复 范围选择的初始时间在一个月内时,造成无法选择的bug +- uni-datetime-picker 优化 弹出层在超出视窗边缘定位不准确的问题 +- uni-datetime-picker 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的 bug +- uni-datetime-picker 优化 弹出层在超出视窗边缘被遮盖的问题 +- uni-datetime-picker 新增 maskClick 事件 +- uni-datetime-picker 修复 特殊情况日历 rpx 布局错误的 bug,rpx -> px +- uni-datetime-picker 修复 范围选择时清空返回值不合理的bug,['', ''] -> [] +- uni-datetime-picker 新增 日期时间显示框支持插槽 +- uni-file-picker 修复 sourceType 缺少默认值导致 ios 无法选择文件 +- uni-file-picker 优化 解耦与uniCloud的强绑定关系 ,如不绑定服务空间,默认autoUpload为false且不可更改 +- uni-table 新增 uni-th 支持 date 日期筛选范围 +- uni-table 新增 uni-th 支持 range 筛选范围 +- uni-table 新增 uni-th 筛选功能 +## 1.3.5(2021-07-02) +- uni-card 优化 图文卡片无图片加载时,提供占位图标 +- uni-card 新增 header 插槽,自定义卡片头部( 图文卡片 mode="style" 时,不支持) +- uni-card 修复 thumbnail 不存在仍然占位的 bug +- uni-data-checkbox 修复 selectedTextColor 属性不生效的Bug +- uni-datetime-picker 优化 添加 uni-icons 依赖 +- uni-easyinput 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug +- uni-file-picker 修复 由 0.0.10 版本引发的 returnType 属性失效的问题 +- uni-file-picker 优化 文件上传后进度条消失时机 +- uni-file-picker 修复 在uni-forms 中,删除文件 ,获取的值不对的Bug +- uni-forms 修复 pattern 属性在微信小程序平台无效的问题 +## 1.3.4(2021-06-25) +- uni-badge 优化 示例项目 +- uni-countdown 修复 uni-countdown 重复赋值跳两秒的 bug +- uni-easyinput 修复 passwordIcon 属性拼写错误的 bug +- uni-forms 修复 validate-trigger属性为submit且err-show-type属性为toast时不能弹出的Bug +- uni-forms 修复 只写setRules方法而导致校验不生效的Bug +- uni-forms 修复 由上个办法引发的错误提示文字错位的Bug +- uni-forms 修复 不设置 label 属性 ,无法设置label插槽的问题 +- uni-forms 修复 不设置label属性,label-width属性不生效的bug +- uni-forms 修复 setRules 方法与rules属性冲突的问题 +- uni-link 新增 download 属性,H5平台下载文件名 +- uni-popup 新增 mask-click 遮罩层点击事件 +- uni-popup 修复 nvue 平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug +- uni-tag 修复 uni-tag 在字节跳动小程序上 css 类名编译错误的 bug +## 1.3.3(2021-06-18) +- uni-easyinput 新增 passwordIcon 属性,当type=password时是否显示小眼睛图标 +- uni-easyinput 修复 confirmType 属性不生效的问题 +- uni-easyinput 修复 disabled 状态可清出内容的 bug +- uni-file-picker 修复 删除文件时无法触发 v-model 的Bug +- uni-popup 修复 H5平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug +- uni-popup 修复 错误的 watch 字段 +- uni-popup 修复 safeArea 属性不生效的问题 +- uni-popup 修复 点击内容,再点击遮罩无法关闭的Bug +## 1.3.2(2021-06-04) +- uni-data-checkbox 新增 map 属性,可以方便映射text/value属性 +- uni-data-checkbox 修复 不关联服务空间的情况下组件报错的Bug +- uni-data-picker 修复 上个版本引出的本地数据无法选择带有children的2级节点 +- uni-forms 修复 动态删减数据导致报错的问题 +- uni-forms 新增 modelValue 属性 ,value 即将废弃 +- uni-forms 新增 uni-forms-item 可以设置单独的 rules +- uni-forms 新增 validate 事件增加 keepitem 参数,可以选择那些字段不过滤 +- uni-forms 优化 submit 事件重命名为 validate +- uni-data-picker 修复 无法加载云端数据的问题 +- uni-data-picker 修复 v-model无效问题 +- uni-data-picker 修复 loaddata 为空数据组时加载时间过长问题 +- uni-datetime-picker 修复 图标在小程序上不显示的 bug +- uni-datetime-picker 优化 重命名引用组件,避免潜在组件命名冲突 +- uni-datetime-picker 优化 代码目录扁平化 +- uni-tag 修复 未定义 sass 变量 "$uni-color-royal" 的bug +## 1.3.1(2021-05-14) +- uni-badge 新增 uni-badge 的 absolute 属性,支持定位 +- uni-badge 新增 uni-badge 的 offset 属性,支持定位偏移 +- uni-badge 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点 +- uni-badge 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+ +- uni-badge 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式 +- uni-badge 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug +- uni-badge 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug +- uni-badge 新增 uni-badge 属性 custom-style, 支持自定义样式 +- uni-datetime-picker 修复 ios 下不识别 '-' 日期格式的 bug +- uni-datetime-picker 优化 pc 下弹出层添加边框和阴影 +- uni-datetime-picker 修复 在 admin 中获取弹出层定位错误的bug +- uni-datetime-picker 修复 type 属性向下兼容,默认值从 date 变更为 datetime +- uni-datetime-picker 支持日历形式的日期+时间的范围选择 +- uni-steps 修复 uni-steps 横向布局时,多行文字高度不合理的 bug +- uni-countdown 修复 uni-countdown 不能控制倒计时的 bug +- uni-tag 修复 royal 类型无效的bug +- uni-tag 修复 uni-tag 宽度不自适应的bug +- uni-tag 新增 uni-tag 支持属性 custom-style 自定义样式 +- uni-link 新增 href 属性支持 tel:|mailto: +- uni-popup 修复 组件内放置 input 、textarea 组件,无法聚焦的问题 +- uni-popup 新增 type 属性的 left\right 值,支持左右弹出 +- uni-popup 新增 open(String:type) 方法参数 ,可以省略 type 属性 ,直接传入类型打开指定弹窗 +- uni-popup 新增 backgroundColor 属性,可定义主窗口背景色,默认不显示背景色 +- uni-popup 新增 safeArea 属性,是否适配底部安全区 +- uni-popup 修复 App\h5\微信小程序底部安全区占位不对的Bug +- uni-popup 修复 App 端弹出等待的Bug +- uni-popup 优化 提升低配设备性能,优化动画卡顿问题 +- uni-popup 优化 更简单的组件自定义方式 +- uni-table 修复 示例项目缺少组件的Bug +- uni-forms 修复 自定义检验器失效的问题 +- uni-title 修复 示例项目缺少组件的Bug +- uni-transition 修复 示例项目缺少组件的Bug +- uni-swiper-dot 修复 示例项目缺少组件的Bug +- uni-ui 新增 组件示例地址 +## 1.3.0(2021-04-23) +- uni-combox 优化 添加依赖 uni-icons, 导入后自动下载依赖 +- uni-data-picker 修复 非树形数据有 where 属性查询报错的问题 +- uni-fav 优化 添加依赖 uni-icons, 导入后自动下载依赖 +- uni-goods-nav 优化 添加依赖 uni-icons, 导入后自动下载依赖 +- uni-nav-bar 优化 添加依赖 uni-icons, 导入后自动下载依赖 +- uni-notice-bar 优化 添加依赖 uni-icons, 导入后自动下载依赖 +- uni-number-box 修复 uni-number-box 浮点数运算不精确的 bug +- uni-number-box 修复 uni-number-box change 事件触发不正确的 bug +- uni-number-box 新增 uni-number-box v-model 双向绑定 +- uni-rate 修复 布局变化后 uni-rate 星星计算不准确的 bug +- uni-rate 优化 添加依赖 uni-icons, 导入 uni-rate 自动下载依赖 +- uni-search-bar 优化 添加依赖 uni-icons, 导入后自动下载依赖 +- uni-steps 优化 添加依赖 uni-icons, 导入后自动下载依赖 +- uni-transition 新增 通过方法自定义动画 +- uni-transition 新增 custom-class 非 NVUE 平台支持自定义 class 定制样式 +- uni-transition 优化 动画触发逻辑,使动画更流畅 +- uni-transition 优化 支持单独的动画类型 +- uni-transition 优化 文档示例 +## 1.2.13(2021-04-16) +- uni-ui 新增 uni-data-picker 支持云端非树形表结构数据 +- uni-ui 修复 uni-data-checkbox nvue 下无法选中的问题 +- uni-ui 修复 uni-data-picker 根节点 parent_field 字段等于null时选择界面错乱问题 +- uni-ui 修复 uni-file-picker 选择的文件非 file-extname 字段指定的扩展名报错的Bug +- uni-ui 修复 uni-swipe-action 报错 nv_navigator is not defined 的bug +- uni-ui 修复 uni-load-more 在首页使用时,h5 平台报 'uni is not defined' 的 bug +- uni-ui 优化 uni-file-picker file-extname 字段支持字符串写法,多个扩展名需要用逗号分隔 +- uni-ui 优化 uni-pagination PC 和 移动端适配不同的 ui +- uni-ui 更新 uni-file-picker 组件示例 +- uni-ui 修复 uni-nav-bar 当 fixed 属性为 true 时铺不满屏幕的 bug +- uni-ui 新增 uni-search-bar 的 focus 事件 +- uni-ui 修复 uni-rate 属性 margin 值为 string 组件失效的 bug +- uni-data-picker 修复 本地数据概率无法回显时问题 +- uni-table 新增 sortable 属性,是否开启单列排序 +- uni-table 优化 表格多选逻辑 +## 1.2.12(2021-03-23) +- uni-ui 新增 uni-datetime-picker 的 hide-second 属性、border 属性; +- uni-ui 修复 uni-datetime-picker 选择跟显示的日期不一样的 bug, +- uni-ui 修复 uni-datetime-picker change事件触发2次的 bug +- uni-ui 修复 uni-datetime-picker 分、秒 end 范围错误的 bug +- uni-ui 新增 uni-tr selectable 属性,用于 type=selection 时,设置某行是否可由全选按钮控制 +- uni-ui 新增 uni-data-checkbox 新增 disabled属性,支持nvue +- uni-ui 优化 uni-data-checkbox 无选项时提示“暂无数据” +- uni-ui 优化 uni-data-checkbox 默认颜色显示 +- uni-ui 新增 uni-link href 属性支持 tel:|mailto: +- uni-ui 新增 uni-table 示例demo +- uni-ui 修复 uni-data-picker 微信小程序某些情况下无法选择的问题,事件无法触发的问题 +- uni-ui 修复 uni-nav-bar easycom 下,找不到 uni-status-bar 的bug +- uni-ui 修复 uni-easyinput 示例在 qq 小程序上的bug +- uni-ui 修复 uni-forms 动态显示uni-forms-item的情况下,submit 方法获取值错误的Bug +- uni-ui 调整 cli 项目 建议使用 easycom 方式引用组件,如使用按需引用,需手动维护组件内部引用 + +## 1.2.11(2021-02-24) +- 调整为uni_modules目录规范 +- uni-data-picker 新增 数据驱动的picker选择器 +- uni-file-picker 新增 文件选择上传 +- uni-row 新增 栅格系统 +- uni-data-checkbox 优化 支持 nvue +- uni-forms 修复 偶发性获取表单值错误的Bug +- uni-forms 修复 校验 uni-data-picker value 为 0 时,返回值错误的Bug +- uni-forms 修复 uni-forms-item 组件隐藏时依然触发校验的bug +- uni-forms 优化 实时校验 +- uni-forms 优化 兼容nvue页面 +- uni-easyinput 优化 兼容nvue页面 +- uni-group 优化 兼容nvue页面 +- uni-popup 优化 组件适配 PC +- uni-fab 优化 适配 PC +- uni-swiper-dot 优化 适配 PC +- uni-rate 优化 适配 PC +- uni-notice-bar 优化 适配 PC +- uni-indexed-list 优化 适配 PC +- uni-combox 优化 适配 PC +- uni-transition 优化 适配 PC +- uni-nav-bar 优化 适配 PC +- uni-swipe-action 优化 适配 PC diff --git a/uni_modules/uni-ui/components/uni-ui/uni-ui.vue b/uni_modules/uni-ui/components/uni-ui/uni-ui.vue new file mode 100644 index 0000000..0970892 --- /dev/null +++ b/uni_modules/uni-ui/components/uni-ui/uni-ui.vue @@ -0,0 +1,7 @@ + + + diff --git a/uni_modules/uni-ui/package.json b/uni_modules/uni-ui/package.json new file mode 100644 index 0000000..857ed51 --- /dev/null +++ b/uni_modules/uni-ui/package.json @@ -0,0 +1,129 @@ +{ + "id": "uni-ui", + "displayName": "uni-ui", + "version": "1.4.27", + "description": "uni-ui 是基于uni-app的、全端兼容的、高性能UI框架", + "keywords": [ + "uni-ui", + "uniui", + "UI组件库", + "ui框架", + "ui库" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.2.10" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-badge", + "uni-calendar", + "uni-card", + "uni-collapse", + "uni-combox", + "uni-countdown", + "uni-data-checkbox", + "uni-data-picker", + "uni-data-select", + "uni-dateformat", + "uni-datetime-picker", + "uni-drawer", + "uni-easyinput", + "uni-fab", + "uni-fav", + "uni-file-picker", + "uni-forms", + "uni-goods-nav", + "uni-grid", + "uni-group", + "uni-icons", + "uni-indexed-list", + "uni-link", + "uni-list", + "uni-load-more", + "uni-nav-bar", + "uni-notice-bar", + "uni-number-box", + "uni-pagination", + "uni-popup", + "uni-rate", + "uni-row", + "uni-search-bar", + "uni-section", + "uni-segmented-control", + "uni-steps", + "uni-swipe-action", + "uni-swiper-dot", + "uni-table", + "uni-tag", + "uni-title", + "uni-tooltip", + "uni-transition" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-ui/readme.md b/uni_modules/uni-ui/readme.md new file mode 100644 index 0000000..23f8456 --- /dev/null +++ b/uni_modules/uni-ui/readme.md @@ -0,0 +1,247 @@ +> 当前插件不包含示例页面 ,如需示例请在 HBuiderX 中新建 `hello uni-app > 扩展组件` 中查看 +> +> 代码示例地址 :[https://ext.dcloud.net.cn/plugin?id=4941](https://ext.dcloud.net.cn/plugin?id=4941) +> +> 组件演示地址:[https://hellouniapp.dcloud.net.cn](https://hellouniapp.dcloud.net.cn/pages/extUI/badge/badge) +> +> 组件文档地址:[https://uniapp.dcloud.io/component/uniui/uni-ui](https://uniapp.dcloud.io/component/uniui/uni-ui) + +# uni-ui 介绍 + +## uni-ui产品特点 + +### 1. 高性能 + +目前为止,在小程序和混合app领域,暂时还没有比 `uni-ui` 更高性能的框架。 +- 自动差量更新数据 + +虽然uni-app支持小程序自定义组件,所有小程序的ui库都可以用。但小程序自定义组件的ui库都需要使用setData手动更新数据,在大数据量时、或高频更新数据时,很容易产生性能问题。 + +而 `uni-ui` 属于vue组件,uni-app引擎底层自动diff更新数据。当然其实插件市场里众多vue组件都具备这个特点。 +- 优化逻辑层和视图层通讯折损 + +非H5,不管是小程序还是App,不管是app的webview渲染还是原生渲染,全都是逻辑层和视图层分离的。这里就有一个逻辑层和视图层通讯的折损问题。 +比如在视图层拖动一个可跟手的组件,由于通讯的损耗,用js监听很难做到实时跟手。 + +这时就需要使用css动画以及平台底层提供的wxs、bindingx等技术。不过这些技术都比较复杂,所以 `uni-ui` 里做了封装,在需要跟手式操作的ui组件,比如swiperaction列表项左滑菜单,就在底层使用了这些技术,实现了高性能的交互体验 +- 背景停止 + +很多ui组件是会一直动的,比如轮播图、跑马灯。即便这个窗体被新窗体挡住,它在背景层仍然在消耗着硬件资源。在Android的webview版本为chrome66以上,背景操作ui会引发很严重的性能问题,造成前台界面明显卡顿。 + +而 `uni-ui` 的组件,会自动判断自己的显示状态,在组件不再可见时,不会再消耗硬件资源。 + +### 2. 全端 + + `uni-ui` 的组件都是多端自适应的,底层会抹平很多小程序平台的差异或bug。 + +比如导航栏navbar组件,会自动处理不同端的状态栏。 +比如swiperaction组件,在app和微信小程序上会使用交互体验更好的wxs技术,但在不支持wxs的其他小程序端会使用js模拟类似效果。 + + `uni-ui` 还支持nvue原生渲染,[详见](https://github.com/dcloudio/uni-ui/tree/nvue-uni-ui) + +未来 `uni-ui` 还会支持pc等大屏设备。 + +### 3. 与uni统计自动集成实现免打点 + +uni统计是优秀的多端统计平台,见[tongji.dcloud.net.cn](https://tongji.dcloud.net.cn)。 + +除了一张报表看全端,它的另一个重要特点是免打点。 +比如使用 `uni-ui` 的navbar标题栏、收藏、购物车等组件,均可实现自动打点,统计页面标题等各种行为数据。 +当然你也可以关闭uni统计,这不是强制的。 + +### 4. 主题扩展 + + `uni-ui` 支持[uni.scss](https://uniapp.dcloud.io/collocation/uni-scss),可以方便的切换App的风格。 + +ui是一种需求非常发散的产品,DCloud官方也无意用 `uni-ui` 压制第三方ui插件的空间,但官方有义务在性能和多端方面提供一个开源的标杆给大家。 + +我们欢迎更多优秀的ui组件出现,也欢迎更多人贡献 `uni-ui` 的主题风格,满足更多用户的需求。 + + +## 快速开始 + +uni-ui支持 HBuilderX直接新建项目模板、npm安装和单独导入个别组件等多种使用方式 + +### 在HBuilderX 新建uni-app项目的模板中,选择uni-ui模板 +![HBuilderX内创建uni-ui项目](https://img.cdn.aliyun.dcloud.net.cn/uni-app/doc/create-uni-ui-project.jpg) + +由于uni-app独特的[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)技术,可以免引用、注册,直接使用各种符合规则的vue组件。 + +在代码区键入`u`,拉出各种内置或uni-ui的组件列表,选择其中一个,即可使用该组件。 + +光标放在组件名称上,按F1,可以查阅组件的文档。 + +![uni-ui代码块](https://img.cdn.aliyun.dcloud.net.cn/uni-app/doc/uni-ui-snippet.jpg) + +### 通过 uni_modules 单独安装组件 +如果你没有创建uni-ui项目模板,也可以在你的工程里,通过 uni_modules 单独安装需要的某个组件。下表为uni-ui的扩展组件清单,点击每个组件在详情页面可以导入组件到项目下,导入后直接使用即可,无需import和注册。 + +|组件名|组件说明| +|---|---| +|uni-badge|[数字角标](https://ext.dcloud.net.cn/plugin?name=uni-badge)| +|uni-calendar|[日历](https://ext.dcloud.net.cn/plugin?name=uni-calendar)| +|uni-card|[卡片](https://ext.dcloud.net.cn/plugin?name=uni-card)| +|uni-collapse|[折叠面板](https://ext.dcloud.net.cn/plugin?name=uni-collapse)| +|uni-combox|[组合框](https://ext.dcloud.net.cn/plugin?name=uni-combox)| +|uni-countdown|[倒计时](https://ext.dcloud.net.cn/plugin?name=uni-countdown)| +|uni-data-checkbox|[数据选择器](https://ext.dcloud.net.cn/plugin?name=uni-data-checkbox)| +|uni-data-picker|[数据驱动的picker选择器](https://ext.dcloud.net.cn/plugin?name=uni-data-picker)| +|uni-dateformat|[日期格式化](https://ext.dcloud.net.cn/plugin?name=uni-dateformat)| +|uni-datetime-picker|[日期选择器](https://ext.dcloud.net.cn/plugin?name=uni-datetime-picker)| +|uni-drawer|[抽屉](https://ext.dcloud.net.cn/plugin?name=uni-drawer)| +|uni-easyinput|[增强输入框](https://ext.dcloud.net.cn/plugin?name=uni-easyinput)| +|uni-fab|[悬浮按钮](https://ext.dcloud.net.cn/plugin?name=uni-fab)| +|uni-fav|[收藏按钮](https://ext.dcloud.net.cn/plugin?name=uni-fav)| +|uni-file-picker|[文件选择上传](https://ext.dcloud.net.cn/plugin?name=uni-file-picker)| +|uni-forms|[表单](https://ext.dcloud.net.cn/plugin?name=uni-forms)| +|uni-goods-nav|[商品导航](https://ext.dcloud.net.cn/plugin?name=uni-goods-nav)| +|uni-grid|[宫格](https://ext.dcloud.net.cn/plugin?name=uni-grid)| +|uni-group|[分组](https://ext.dcloud.net.cn/plugin?name=uni-group)| +|uni-icons|[图标](https://ext.dcloud.net.cn/plugin?name=uni-icons)| +|uni-indexed-list|[索引列表](https://ext.dcloud.net.cn/plugin?name=uni-indexed-list)| +|uni-link|[超链接](https://ext.dcloud.net.cn/plugin?name=uni-link)| +|uni-list|[列表](https://ext.dcloud.net.cn/plugin?name=uni-list)| +|uni-load-more|[加载更多](https://ext.dcloud.net.cn/plugin?name=uni-load-more)| +|uni-nav-bar|[自定义导航栏](https://ext.dcloud.net.cn/plugin?name=uni-nav-bar)| +|uni-notice-bar|[通告栏](https://ext.dcloud.net.cn/plugin?name=uni-notice-bar)| +|uni-number-box|[数字输入框](https://ext.dcloud.net.cn/plugin?name=uni-number-box)| +|uni-pagination|[分页器](https://ext.dcloud.net.cn/plugin?name=uni-pagination)| +|uni-popup|[弹出层](https://ext.dcloud.net.cn/plugin?name=uni-popup)| +|uni-rate|[评分](https://ext.dcloud.net.cn/plugin?name=uni-rate)| +|uni-row|[布局-行](https://ext.dcloud.net.cn/plugin?name=uni-row)| +|uni-search-bar|[搜索栏](https://ext.dcloud.net.cn/plugin?name=uni-search-bar)| +|uni-segmented-control|[分段器](https://ext.dcloud.net.cn/plugin?name=uni-segmented-control)| +|uni-steps|[步骤条](https://ext.dcloud.net.cn/plugin?name=uni-steps)| +|uni-swipe-action|[滑动操作](https://ext.dcloud.net.cn/plugin?name=uni-swipe-action)| +|uni-swiper-dot|[轮播图指示点](https://ext.dcloud.net.cn/plugin?name=uni-swiper-dot)| +|uni-table|[表格](https://ext.dcloud.net.cn/plugin?name=uni-table)| +|uni-tag|[标签](https://ext.dcloud.net.cn/plugin?name=uni-tag)| +|uni-title|[章节标题](https://ext.dcloud.net.cn/plugin?name=uni-title)| +|uni-transition|[过渡动画](https://ext.dcloud.net.cn/plugin?name=uni-transition)| + + +使用 `uni_modules` 方式安装组件库,可以直接通过插件市场导入,通过右键菜单快速更新组件,不需要引用、注册,直接在页面中使用 `uni-ui` 组件。[点击安装 uni-ui 组件库](https://ext.dcloud.net.cn/plugin?id=55) + +**注意:下载最新的组件目前仅支持 uni_modules ,非 uni_modules 版本最高支持到组件的1.2.10版本** + +如不能升级到 `uni_modules` 版本,可以使用 `uni_modules` 安装好对应组件,将组件拷贝到对应目录。 + +例如需更新 `uni-list`和`uni-badge` ,将 `uni_modules>uni-list>components`和`uni_modules>uni-badege>components`下所有目录拷贝到如下目录即可: + + +**目录示例** + +```json +┌─components 组件目录 +│ ├─uni-list list 列表目录 +│ │ └─uni-list.vue list 组件文件 +│ ├─uni-list-item list-item 列表目录 +│ │ └─uni-list-item.vue list 组件文件 +│ ├─uni-badge badge 角标目录 +│ │ └─uni-badge.vue badge 组件文件 +│ └─ //.... 更多组件文件 +├─pages 业务页面文件存放的目录 +│ ├─index +│ │ └─index.vue index示例页面 +├─main.js Vue初始化入口文件 +├─App.vue 应用配置,用来配置App全局样式以及监听 应用生命周期 +├─manifest.json 配置应用名称、appid、logo、版本等打包信息,详见 +└─pages.json 配置页 + +``` + +### 通过 `uni_modules` 导入全部组件 +如果想一次把所有uni-ui组件导入到项目中,只需要导入一个 `uni-ui` 组件即可 [点击去导入](https://ext.dcloud.net.cn/plugin?id=55)。 + +如果没有自动导入其他组件,可以在 uni-ui 组件目录上右键选择 `安装三方插件依赖` 即可。 + + + +### npm安装 +在 `vue-cli` 项目中可以使用 `npm` 安装 `uni-ui` 库 ,或者直接在 `HBuilderX` 项目中使用 `npm` 。 + +> **注意** +> cli 项目默认是不编译 `node_modules` 下的组件的,导致条件编译等功能失效 ,导致组件异常 +> 需要在根目录创建 `vue.config.js` 文件 ,增加 `@dcloudio/uni-ui` 包的编译即可正常 +> ```javascript +> // vue.config.js +> module.exports = { +> transpileDependencies:['@dcloudio/uni-ui'] +> } +> ``` + + + +**准备 sass** + +`vue-cli` 项目请先安装 sass 及 sass-loader,如在 HBuliderX 中使用,可跳过此步。 + +- 安装 sass +``` + npm i sass -D 或 yarn add sass -D +``` + +- 安装 sass-loader +``` +npm i sass-loader@10.1.1 -D 或 yarn add sass-loader@10.1.1 -D +``` + +> 如果 `node` 版本小于 16 ,sass-loader 请使用低于 @11.0.0 的版本,[sass-loader@11.0.0 不支持 vue@2.6.12 ](https://stackoverflow.com/questions/66082397/typeerror-this-getoptions-is-not-a-function) +> 如果 `node` 版本大于 16 , `sass-loader` 建议使用 `v8.x` 版本 + +**安装 uni-ui** + +``` +npm i @dcloudio/uni-ui 或 yarn add @dcloudio/uni-ui +``` + + + +**配置easycom** + +使用 `npm` 安装好 `uni-ui` 之后,需要配置 `easycom` 规则,让 `npm` 安装的组件支持 `easycom` + +打开项目根目录下的 `pages.json` 并添加 `easycom` 节点: + +```javascript +// pages.json +{ + "easycom": { + "autoscan": true, + "custom": { + // uni-ui 规则如下配置 + "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue" + } + }, + + // 其他内容 + pages:[ + // ... + ] +} + +``` + +在 ``template`` 中使用组件: + +```html + + + +``` + + **注意** + - uni-ui 现在只推荐使用 `easycom` ,如自己引用组件,可能会出现组件找不到的问题 + - 使用 npm 安装的组件,默认情况下 babel-loader 会忽略所有 node_modules 中的文件 ,导致条件编译失效,需要通过配置 `vue.config.js` 解决: + ```javascript + // 在根目录创建 vue.config.js 文件,并配置如下 + module.exports = { + transpileDependencies: ['@dcloudio/uni-ui'] + } + ``` + - uni-ui 是uni-app内置组件的扩展。注意与web开发不同,uni-ui不包括基础组件,它是基础组件的补充。web开发中有的开发者习惯用一个ui库完成所有开发,但在uni-app体系中,推荐开发者首先使用性能更高的基础组件,然后按需引入必要的扩展组件。 + - `uni-ui` 不支持使用 `Vue.use()` 的方式安装 + + +### 贡献代码 +在使用 `uni-ui` 中,如遇到无法解决的问题,请提 [Issues](https://github.com/dcloudio/uni-ui/issues) 给我们,假如您有更好的点子或更好的实现方式,也欢迎给我们提交 [PR](https://github.com/dcloudio/uni-ui/pulls) \ No newline at end of file diff --git a/uni_modules/z-paging/changelog.md b/uni_modules/z-paging/changelog.md new file mode 100644 index 0000000..197e9a7 --- /dev/null +++ b/uni_modules/z-paging/changelog.md @@ -0,0 +1,16 @@ +## 2.6.2(2023-10-31) +1.`修复` 在源码中有异常字符导致的在vue3中编译报错的问题。 +2.`修复` 在微信小程序中`z-paging-refresh`的height无效的问题(by xiaohe0601)。 +近期更新: +============================= +1.`新增` 手动更新自定义下拉刷新view高度方法。 +2.`新增` 点击返回顶部按钮添加事件监听&支持拦截。 +3.`新增` 是否开启下拉刷新状态栏占位,适用于隐藏导航栏时,下拉刷新需要避开状态栏高度的情况。 +4.`新增` 支持配置网络请求失败触发`reject`。 +5.`修复` 显示空数据图时,滚动到底部依然可以加载更多的问题。 +6.`修复` 在vue2中底部加载更多相关`slot`使用`template`插入无效的问题。 +7.`修复` `complete`的`Promise`可能无效的问题。 +8.`优化` `hooks`判断`z-paging`为空则不调用。 + + + diff --git a/uni_modules/z-paging/components/z-paging-cell/z-paging-cell.vue b/uni_modules/z-paging/components/z-paging-cell/z-paging-cell.vue new file mode 100644 index 0000000..e9aca70 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging-cell/z-paging-cell.vue @@ -0,0 +1,34 @@ + + + + + + + + + + diff --git a/uni_modules/z-paging/components/z-paging-empty-view/z-paging-empty-view.vue b/uni_modules/z-paging/components/z-paging-empty-view/z-paging-empty-view.vue new file mode 100644 index 0000000..18ee4ee --- /dev/null +++ b/uni_modules/z-paging/components/z-paging-empty-view/z-paging-empty-view.vue @@ -0,0 +1,162 @@ + + + + + + + + + + + diff --git a/uni_modules/z-paging/components/z-paging-swiper-item/z-paging-swiper-item.vue b/uni_modules/z-paging/components/z-paging-swiper-item/z-paging-swiper-item.vue new file mode 100644 index 0000000..0501457 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging-swiper-item/z-paging-swiper-item.vue @@ -0,0 +1,143 @@ + + + + + + + + + + + diff --git a/uni_modules/z-paging/components/z-paging-swiper/z-paging-swiper.vue b/uni_modules/z-paging/components/z-paging-swiper/z-paging-swiper.vue new file mode 100644 index 0000000..27cdb8e --- /dev/null +++ b/uni_modules/z-paging/components/z-paging-swiper/z-paging-swiper.vue @@ -0,0 +1,170 @@ + + + + + + + + + + + diff --git a/uni_modules/z-paging/components/z-paging/components/z-paging-load-more.vue b/uni_modules/z-paging/components/z-paging/components/z-paging-load-more.vue new file mode 100644 index 0000000..f3ef931 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/components/z-paging-load-more.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/uni_modules/z-paging/components/z-paging/components/z-paging-refresh.vue b/uni_modules/z-paging/components/z-paging/components/z-paging-refresh.vue new file mode 100644 index 0000000..12ac9db --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/components/z-paging-refresh.vue @@ -0,0 +1,182 @@ + + + + + diff --git a/uni_modules/z-paging/components/z-paging/config/index.js b/uni_modules/z-paging/components/z-paging/config/index.js new file mode 100644 index 0000000..15a37e2 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/config/index.js @@ -0,0 +1,3 @@ +// z-paging全局配置文件,注意避免更新时此文件被覆盖,若被覆盖,可在此文件中右键->点击本地历史记录,找回覆盖前的配置 + +export default {} \ No newline at end of file diff --git a/uni_modules/z-paging/components/z-paging/css/z-paging-main.css b/uni_modules/z-paging/components/z-paging/css/z-paging-main.css new file mode 100644 index 0000000..5d48e57 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/css/z-paging-main.css @@ -0,0 +1,225 @@ +/* [z-paging]公共css*/ + +.z-paging-content { + position: relative; + /* #ifndef APP-NVUE */ + display: flex; + width: 100%; + height: 100%; + overflow: hidden; + /* #endif */ + flex-direction: column; +} + +.z-paging-content-fixed, .zp-loading-fixed { + position: fixed; + /* #ifndef APP-NVUE */ + height: auto; + width: auto; + /* #endif */ + top: 0; + left: 0; + bottom: 0; + right: 0; +} + +.zp-page-top,.zp-page-bottom { + /* #ifndef APP-NVUE */ + width: auto; + /* #endif */ + position: fixed; + left: 0; + right: 0; + z-index: 999; +} + +.zp-page-left,.zp-page-right{ + /* #ifndef APP-NVUE */ + height: 100%; + /* #endif */ +} + +.zp-scroll-view-super { + flex: 1; + overflow: hidden; + position: relative; +} + +.zp-view-super{ + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex-direction: row; +} + +.zp-scroll-view-container,.zp-scroll-view { + position: relative; + /* #ifndef APP-NVUE */ + height: 100%; + width: 100%; + /* #endif */ +} + +.zp-absoulte{ + /* #ifndef APP-NVUE */ + position: absolute; + top: 0; + width: auto; + /* #endif */ +} + +.zp-right{ + right: 0; +} + +.zp-scroll-view-absolute { + position: absolute; + top: 0; + left: 0; +} + +/* #ifndef APP-NVUE */ +.zp-scroll-view-hide-scrollbar ::-webkit-scrollbar { + display: none; + -webkit-appearance: none; + width: 0 !important; + height: 0 !important; + background: transparent; +} +/* #endif */ + +.zp-paging-touch-view { + width: 100%; + height: 100%; + position: relative; +} + +.zp-fixed-bac-view { + position: absolute; + width: 100%; + top: 0; + left: 0; + height: 200px; +} + +.zp-paging-main { + height: 100%; + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex-direction: column; +} + +.zp-paging-container { + flex: 1; + position: relative; + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex-direction: column; +} + +.zp-chat-record-loading-container { + /* #ifndef APP-NVUE */ + display: flex; + width: 100%; + /* #endif */ + /* #ifdef APP-NVUE */ + width: 750rpx; + /* #endif */ + align-items: center; + justify-content: center; + height: 60rpx; + font-size: 26rpx; +} + +.zp-chat-record-loading-custom-image { + width: 35rpx; + height: 35rpx; + /* #ifndef APP-NVUE */ + animation: loading-flower 1s linear infinite; + /* #endif */ +} + +.zp-custom-refresher-container { + overflow: hidden; +} + +.zp-custom-refresher-refresh { + /* #ifndef APP-NVUE */ + display: block; + /* #endif */ +} + +.zp-back-to-top { + width: 76rpx; + height: 76rpx; + z-index: 999; + position: absolute; + bottom: 0rpx; + right: 25rpx; + transition-duration: .3s; + transition-property: opacity; +} + +.zp-back-to-top-show { + opacity: 1; +} + +.zp-back-to-top-hide { + opacity: 0; +} + +.zp-back-to-top-img { + /* #ifndef APP-NVUE */ + width: 100%; + height: 100%; + /* #endif */ + /* #ifdef APP-NVUE */ + flex: 1; + /* #endif */ + z-index: 999; +} + +.zp-empty-view { + /* #ifdef APP-NVUE */ + height: 100%; + /* #endif */ + flex: 1; +} + +.zp-empty-view-center { + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex-direction: column; + align-items: center; + justify-content: center; +} + +.zp-loading-fixed { + z-index: 9999; +} + +.zp-safe-area-inset-bottom { + position: absolute; + /* #ifndef APP-PLUS */ + height: env(safe-area-inset-bottom); + /* #endif */ +} + +.zp-n-refresh-container { + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + justify-content: center; + width: 750rpx; +} + +.zp-n-list-container{ + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex-direction: row; + flex: 1; +} diff --git a/uni_modules/z-paging/components/z-paging/css/z-paging-static.css b/uni_modules/z-paging/components/z-paging/css/z-paging-static.css new file mode 100644 index 0000000..eaad977 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/css/z-paging-static.css @@ -0,0 +1,35 @@ +/* [z-paging]公用的静态css资源 */ + +.zp-line-loading-image { + margin-right: 8rpx; + width: 28rpx; + height: 28rpx; + /* #ifndef APP-NVUE */ + animation: loading-flower 1s steps(12) infinite; + /* #endif */ + color: #666666; +} + +.zp-loading-image-ios{ + width: 20px; + height: 20px; +} + +.zp-loading-image-android{ + width: 32rpx; + height: 32rpx; +} + +/* #ifndef APP-NVUE */ +@keyframes loading-flower { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + to { + -webkit-transform: rotate(1turn); + transform: rotate(1turn); + } +} +/* #endif */ + diff --git a/uni_modules/z-paging/components/z-paging/i18n/en.json b/uni_modules/z-paging/components/z-paging/i18n/en.json new file mode 100644 index 0000000..d93430f --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/i18n/en.json @@ -0,0 +1,22 @@ +{ + "zp.refresher.default": "Pull down to refresh", + "zp.refresher.pulling": "Release to refresh", + "zp.refresher.refreshing": "Refreshing...", + "zp.refresher.complete": "Refresh succeeded", + + "zp.loadingMore.default": "Click to load more", + "zp.loadingMore.loading": "Loading...", + "zp.loadingMore.noMore": "No more data", + "zp.loadingMore.fail": "Load failed,click to reload", + + "zp.emptyView.title": "No data", + "zp.emptyView.reload": "Reload", + "zp.emptyView.error": "Sorry,load failed", + + "zp.refresherUpdateTime.title": "Last update: ", + "zp.refresherUpdateTime.none": "None", + "zp.refresherUpdateTime.today": "Today", + "zp.refresherUpdateTime.yesterday": "Yesterday", + + "zp.systemLoading.title": "Loading..." +} diff --git a/uni_modules/z-paging/components/z-paging/i18n/index.js b/uni_modules/z-paging/components/z-paging/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/z-paging/components/z-paging/i18n/zh-Hans.json b/uni_modules/z-paging/components/z-paging/i18n/zh-Hans.json new file mode 100644 index 0000000..f2cc3c8 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/i18n/zh-Hans.json @@ -0,0 +1,22 @@ +{ + "zp.refresher.default": "继续下拉刷新", + "zp.refresher.pulling": "松开立即刷新", + "zp.refresher.refreshing": "正在刷新...", + "zp.refresher.complete": "刷新成功", + + "zp.loadingMore.default": "点击加载更多", + "zp.loadingMore.loading": "正在加载...", + "zp.loadingMore.noMore": "没有更多了", + "zp.loadingMore.fail": "加载失败,点击重新加载", + + "zp.emptyView.title": "没有数据哦~", + "zp.emptyView.reload": "重新加载", + "zp.emptyView.error": "很抱歉,加载失败", + + "zp.refresherUpdateTime.title": "最后更新:", + "zp.refresherUpdateTime.none": "无", + "zp.refresherUpdateTime.today": "今天", + "zp.refresherUpdateTime.yesterday": "昨天", + + "zp.systemLoading.title": "加载中..." +} diff --git a/uni_modules/z-paging/components/z-paging/i18n/zh-Hant.json b/uni_modules/z-paging/components/z-paging/i18n/zh-Hant.json new file mode 100644 index 0000000..e9c80cf --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/i18n/zh-Hant.json @@ -0,0 +1,22 @@ +{ + "zp.refresher.default": "繼續下拉重繪", + "zp.refresher.pulling": "鬆開立即重繪", + "zp.refresher.refreshing": "正在重繪...", + "zp.refresher.complete": "重繪成功", + + "zp.loadingMore.default": "點擊加載更多", + "zp.loadingMore.loading": "正在加載...", + "zp.loadingMore.noMore": "沒有更多了", + "zp.loadingMore.fail": "加載失敗,點擊重新加載", + + "zp.emptyView.title": "沒有數據哦~", + "zp.emptyView.reload": "重新加載", + "zp.emptyView.error": "很抱歉,加載失敗", + + "zp.refresherUpdateTime.title": "最後更新:", + "zp.refresherUpdateTime.none": "無", + "zp.refresherUpdateTime.today": "今天", + "zp.refresherUpdateTime.yesterday": "昨天", + + "zp.systemLoading.title": "加載中..." +} diff --git a/uni_modules/z-paging/components/z-paging/js/hooks/useZPaging.js b/uni_modules/z-paging/components/z-paging/js/hooks/useZPaging.js new file mode 100644 index 0000000..adb6e1b --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/hooks/useZPaging.js @@ -0,0 +1,25 @@ +// [z-paging]useZPaging hooks + +import { onPageScroll, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'; + +function useZPaging(paging) { + const cPaging = !!paging ? paging.value || paging : null; + + onPullDownRefresh(() => { + if (!cPaging || !cPaging.value) return; + cPaging.value.reload().catch(() => {}); + }) + + onPageScroll(e => { + if (!cPaging || !cPaging.value) return; + cPaging.value.updatePageScrollTop(e.scrollTop); + e.scrollTop < 10 && cPaging.value.doChatRecordLoadMore(); + }) + + onReachBottom(() => { + if (!cPaging || !cPaging.value) return; + cPaging.value.pageReachBottom(); + }) +} + +export default useZPaging \ No newline at end of file diff --git a/uni_modules/z-paging/components/z-paging/js/hooks/useZPagingComp.js b/uni_modules/z-paging/components/z-paging/js/hooks/useZPagingComp.js new file mode 100644 index 0000000..f9bc5ab --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/hooks/useZPagingComp.js @@ -0,0 +1,25 @@ +// [z-paging]useZPagingComp hooks + +function useZPagingComp(paging) { + const cPaging = !!paging ? paging.value || paging : null; + + const reload = () => { + if (!cPaging || !cPaging.value) return; + cPaging.value.reload().catch(() => {}); + } + const updatePageScrollTop = scrollTop => { + if (!cPaging || !cPaging.value) return; + cPaging.value.updatePageScrollTop(scrollTop); + } + const doChatRecordLoadMore = () => { + if (!cPaging || !cPaging.value) return; + cPaging.value.doChatRecordLoadMore(); + } + const pageReachBottom = () => { + if (!cPaging || !cPaging.value) return; + cPaging.value.pageReachBottom(); + } + return { reload, updatePageScrollTop, doChatRecordLoadMore, pageReachBottom }; +} + +export default useZPagingComp \ No newline at end of file diff --git a/uni_modules/z-paging/components/z-paging/js/modules/back-to-top.js b/uni_modules/z-paging/components/z-paging/js/modules/back-to-top.js new file mode 100644 index 0000000..7cfd298 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/back-to-top.js @@ -0,0 +1,111 @@ +// [z-paging]点击返回顶部view模块 +import u from '.././z-paging-utils' + +export default { + props: { + //自动显示点击返回顶部按钮,默认为否 + autoShowBackToTop: { + type: Boolean, + default: u.gc('autoShowBackToTop', false) + }, + //点击返回顶部按钮显示/隐藏的阈值(滚动距离),单位为px,默认为400rpx + backToTopThreshold: { + type: [Number, String], + default: u.gc('backToTopThreshold', '400rpx') + }, + //点击返回顶部按钮的自定义图片地址,默认使用z-paging内置的图片 + backToTopImg: { + type: String, + default: u.gc('backToTopImg', '') + }, + //点击返回顶部按钮返回到顶部时是否展示过渡动画,默认为是 + backToTopWithAnimate: { + type: Boolean, + default: u.gc('backToTopWithAnimate', true) + }, + //点击返回顶部按钮与底部的距离,注意添加单位px或rpx,默认为160rpx + backToTopBottom: { + type: [Number, String], + default: u.gc('backToTopBottom', '160rpx') + }, + //点击返回顶部按钮的自定义样式 + backToTopStyle: { + type: Object, + default: function() { + return u.gc('backToTopStyle', {}); + }, + }, + //iOS点击顶部状态栏、安卓双击标题栏时,滚动条返回顶部,只支持竖向,默认为是 + enableBackToTop: { + type: Boolean, + default: u.gc('enableBackToTop', true) + }, + }, + data() { + return { + backToTopClass: 'zp-back-to-top zp-back-to-top-hide', + lastBackToTopShowTime: 0, + showBackToTopClass: false, + } + }, + computed: { + finalEnableBackToTop() { + return this.usePageScroll ? false : this.enableBackToTop; + }, + finalBackToTopThreshold() { + return u.convertToPx(this.backToTopThreshold); + }, + finalBackToTopStyle() { + const backToTopStyle = this.backToTopStyle; + if (!backToTopStyle.bottom) { + backToTopStyle.bottom = this.windowBottom + u.convertToPx(this.backToTopBottom) + 'px'; + } + if(!backToTopStyle.position){ + backToTopStyle.position = this.usePageScroll ? 'fixed': 'absolute'; + } + return backToTopStyle; + }, + }, + methods: { + //点击返回顶部 + _backToTopClick() { + let callbacked = false; + this.$emit('backToTopClick', toTop => { + (toTop === undefined || toTop === true) && this._handleToTop(); + callbacked = true; + }); + this.$nextTick(() => { + !callbacked && this._handleToTop(); + }) + }, + //处理滚动到顶部 + _handleToTop() { + !this.backToTopWithAnimate && this._checkShouldShowBackToTop(0); + this.scrollToTop(this.backToTopWithAnimate); + }, + //判断是否要显示返回顶部按钮 + _checkShouldShowBackToTop(scrollTop) { + if (!this.autoShowBackToTop) { + this.showBackToTopClass = false; + return; + } + if (scrollTop > this.finalBackToTopThreshold) { + if (!this.showBackToTopClass) { + this.showBackToTopClass = true; + this.lastBackToTopShowTime = new Date().getTime(); + u.delay(() => { + this.backToTopClass = 'zp-back-to-top zp-back-to-top-show'; + }, 300) + } + } else { + if (this.showBackToTopClass) { + this.backToTopClass = 'zp-back-to-top zp-back-to-top-hide'; + u.delay(() => { + this.showBackToTopClass = false; + }, new Date().getTime() - this.lastBackToTopShowTime < 500 ? 0 : 300) + } + } + }, + } +} + diff --git a/uni_modules/z-paging/components/z-paging/js/modules/common-layout.js b/uni_modules/z-paging/components/z-paging/js/modules/common-layout.js new file mode 100644 index 0000000..249d7aa --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/common-layout.js @@ -0,0 +1,116 @@ +// [z-paging]通用布局相关模块 + +// #ifdef APP-NVUE +const weexDom = weex.requireModule('dom'); +// #endif + +export default { + data() { + return { + systemInfo: null, + cssSafeAreaInsetBottom: -1, + } + }, + computed: { + windowTop() { + if (!this.systemInfo) return 0; + //暂时修复vue3中隐藏系统导航栏后windowTop获取不正确的问题,具体bug详见https://ask.dcloud.net.cn/question/141634 + //感谢litangyu!!https://github.com/SmileZXLee/uni-z-paging/issues/25 + // #ifdef VUE3 && H5 + const pageHeadNode = document.getElementsByTagName("uni-page-head"); + if (!pageHeadNode.length) return 0; + // #endif + return this.systemInfo.windowTop || 0; + }, + safeAreaBottom() { + if (!this.systemInfo) return 0; + let safeAreaBottom = 0; + // #ifdef APP-PLUS + safeAreaBottom = this.systemInfo.safeAreaInsets.bottom || 0 ; + // #endif + // #ifndef APP-PLUS + safeAreaBottom = Math.max(this.cssSafeAreaInsetBottom, 0); + // #endif + return safeAreaBottom; + }, + isOldWebView() { + // #ifndef APP-NVUE || MP-KUAISHOU + try { + const systemInfos = uni.getSystemInfoSync().system.split(' '); + const deviceType = systemInfos[0]; + const version = parseInt(systemInfos[1]); + if ((deviceType === 'iOS' && version <= 10) || (deviceType === 'Android' && version <= 6)) { + return true; + } + } catch(e) { + return false; + } + // #endif + return false; + }, + zSlots() { + // #ifdef VUE2 + + // #ifdef MP-ALIPAY + return this.$slots; + // #endif + + return this.$scopedSlots || this.$slots; + // #endif + + return this.$slots; + } + }, + methods: { + //获取节点尺寸 + _getNodeClientRect(select, inDom = true, scrollOffset = false) { + // #ifdef APP-NVUE + select = select.replace(/[.|#]/g, ''); + const ref = this.$refs[select]; + return new Promise((resolve, reject) => { + if (ref) { + weexDom.getComponentRect(ref, option => { + resolve(option && option.result ? [option.size] : false); + }) + } else { + resolve(false); + } + }); + return; + // #endif + //#ifdef MP-ALIPAY + inDom = false; + //#endif + let res = !!inDom ? uni.createSelectorQuery().in(inDom === true ? this : inDom) : uni.createSelectorQuery(); + scrollOffset ? res.select(select).scrollOffset() : res.select(select).boundingClientRect(); + return new Promise((resolve, reject) => { + res.exec(data => { + resolve((data && data != '' && data != undefined && data.length) ? data : false); + }); + }); + }, + //获取slot="left"和slot="right"宽度并且更新布局 + _updateLeftAndRightWidth(targetStyle, parentNodePrefix) { + this.$nextTick(() => { + let delayTime = 0; + // #ifdef MP-BAIDU + delayTime = 10; + // #endif + setTimeout(() => { + ['left','right'].map(position => { + this._getNodeClientRect(`.${parentNodePrefix}-${position}`).then(res => { + this.$set(targetStyle, position, res ? res[0].width + 'px' : '0px'); + }); + }) + }, delayTime) + }) + }, + //通过获取css设置的底部安全区域占位view高度设置bottom距离 + _getCssSafeAreaInsetBottom(success) { + this._getNodeClientRect('.zp-safe-area-inset-bottom').then(res => { + this.cssSafeAreaInsetBottom = res ? res[0].height : -1; + res && success && success(); + }); + } + } +} diff --git a/uni_modules/z-paging/components/z-paging/js/modules/data-handle.js b/uni_modules/z-paging/components/z-paging/js/modules/data-handle.js new file mode 100644 index 0000000..0e64605 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/data-handle.js @@ -0,0 +1,746 @@ +// [z-paging]数据处理模块 +import u from '.././z-paging-utils' +import c from '.././z-paging-constant' +import Enum from '.././z-paging-enum' +import interceptor from '../z-paging-interceptor' + +export default { + props: { + //自定义初始的pageNo,默认为1 + defaultPageNo: { + type: [Number, String], + default: u.gc('defaultPageNo', 1), + observer: function(newVal) { + this.pageNo = newVal; + }, + }, + //自定义pageSize,默认为10 + defaultPageSize: { + type: [Number, String], + default: u.gc('defaultPageSize', 10), + validator: (value) => { + if (value <= 0) u.consoleErr('default-page-size必须大于0!'); + return value > 0; + } + }, + //为保证数据一致,设置当前tab切换时的标识key,并在complete中传递相同key,若二者不一致,则complete将不会生效 + dataKey: { + type: [Number, String, Object], + default: function() { + return u.gc('dataKey', null); + }, + }, + //使用缓存,若开启将自动缓存第一页的数据,默认为否。请注意,因考虑到切换tab时不同tab数据不同的情况,默认仅会缓存组件首次加载时第一次请求到的数据,后续的下拉刷新操作不会更新缓存。 + useCache: { + type: Boolean, + default: u.gc('useCache', false) + }, + //使用缓存时缓存的key,用于区分不同列表的缓存数据,useCache为true时必须设置,否则缓存无效 + cacheKey: { + type: String, + default: u.gc('cacheKey', null) + }, + //缓存模式,默认仅会缓存组件首次加载时第一次请求到的数据,可设置为always,即代表总是缓存,每次列表刷新(下拉刷新、调用reload等)都会更新缓存 + cacheMode: { + type: String, + default: u.gc('cacheMode', Enum.CacheMode.Default) + }, + //自动注入的list名,可自动修改父view(包含ref="paging")中对应name的list值 + autowireListName: { + type: String, + default: u.gc('autowireListName', '') + }, + //自动注入的query名,可自动调用父view(包含ref="paging")中的query方法 + autowireQueryName: { + type: String, + default: u.gc('autowireQueryName', '') + }, + //z-paging mounted后自动调用reload方法(mounted后自动调用接口),默认为是 + auto: { + type: Boolean, + default: u.gc('auto', true) + }, + //用户下拉刷新时是否触发reload方法,默认为是 + reloadWhenRefresh: { + type: Boolean, + default: u.gc('reloadWhenRefresh', true) + }, + //reload时自动滚动到顶部,默认为是 + autoScrollToTopWhenReload: { + type: Boolean, + default: u.gc('autoScrollToTopWhenReload', true) + }, + //reload时立即自动清空原list,默认为是,若立即自动清空,则在reload之后、请求回调之前页面是空白的 + autoCleanListWhenReload: { + type: Boolean, + default: u.gc('autoCleanListWhenReload', true) + }, + //列表刷新时自动显示下拉刷新view,默认为否 + showRefresherWhenReload: { + type: Boolean, + default: u.gc('showRefresherWhenReload', false) + }, + //列表刷新时自动显示加载更多view,且为加载中状态,默认为否 + showLoadingMoreWhenReload: { + type: Boolean, + default: u.gc('showLoadingMoreWhenReload', false) + }, + //组件created时立即触发reload(可解决一些情况下先看到页面再看到loading的问题),auto为true时有效。为否时将在mounted+nextTick后触发reload,默认为否 + createdReload: { + type: Boolean, + default: u.gc('createdReload', false) + }, + //本地分页时上拉加载更多延迟时间,单位为毫秒,默认200毫秒 + localPagingLoadingTime: { + type: [Number, String], + default: u.gc('localPagingLoadingTime', 200) + }, + //使用聊天记录模式,默认为否 + useChatRecordMode: { + type: Boolean, + default: u.gc('useChatRecordMode', false) + }, + //使用聊天记录模式时是否自动隐藏键盘:在用户触摸列表时候自动隐藏键盘,默认为是 + autoHideKeyboardWhenChat: { + type: Boolean, + default: u.gc('autoHideKeyboardWhenChat', true) + }, + //自动拼接complete中传过来的数组(使用聊天记录模式时无效) + concat: { + type: Boolean, + default: u.gc('concat', true) + }, + //请求失败是否触发reject,默认为是 + callNetworkReject: { + type: Boolean, + default: u.gc('callNetworkReject', true) + }, + //父组件v-model所绑定的list的值 + value: { + type: Array, + default: function() { + return []; + } + }, + // #ifdef VUE3 + modelValue: { + type: Array, + default: function() { + return []; + } + } + // #endif + }, + data (){ + return { + currentData: [], + totalData: [], + realTotalData: [], + totalLocalPagingList: [], + dataPromiseResultMap: { + reload: null, + complete: null, + localPaging: null + }, + isSettingCacheList: false, + pageNo: 1, + currentRefreshPageSize: 0, + isLocalPaging: false, + isAddedData: false, + isTotalChangeFromAddData: false, + privateConcat: true, + myParentQuery: -1, + firstPageLoaded: false, + pagingLoaded: false, + loaded: false, + isUserReload: true, + fromEmptyViewReload: false, + queryFrom: '', + listRendering: false, + isHandlingRefreshToPage: false + } + }, + computed: { + pageSize() { + return this.defaultPageSize; + }, + finalConcat() { + return this.concat && this.privateConcat; + }, + finalUseCache() { + if (this.useCache && !this.cacheKey) { + u.consoleErr('use-cache为true时,必须设置cache-key,否则缓存无效!'); + } + return this.useCache && !!this.cacheKey; + }, + finalCacheKey() { + return this.cacheKey ? `${c.cachePrefixKey}-${this.cacheKey}` : null; + }, + isFirstPage() { + return this.pageNo === this.defaultPageNo; + } + }, + watch: { + totalData(newVal, oldVal) { + this._totalDataChange(newVal, oldVal); + }, + currentData(newVal, oldVal) { + this._currentDataChange(newVal, oldVal); + }, + useChatRecordMode(newVal, oldVal) { + if (newVal) { + this.nLoadingMoreFixedHeight = false; + } + }, + value: { + handler(newVal) { + this.realTotalData = newVal; + }, + immediate: true + }, + // #ifdef VUE3 + modelValue: { + handler(newVal) { + this.realTotalData = newVal; + }, + immediate: true + } + // #endif + }, + methods: { + //请求结束(成功或者失败)调用此方法,将请求的结果传递给z-paging处理,第一个参数为请求结果数组,第二个参数为是否成功(默认是是) + complete(data, success = true) { + this.customNoMore = -1; + return this.addData(data, success); + }, + //【保证数据一致】请求结束(成功或者失败)调用此方法,将请求的结果传递给z-paging处理,第一个参数为请求结果数组,第二个参数为dataKey,需与:data-key绑定的一致,第三个参数为是否成功(默认为是) + completeByKey(data, dataKey = null, success = true) { + if (dataKey !== null && this.dataKey !== null && dataKey !== this.dataKey) { + this.isFirstPage && this.endRefresh(); + return new Promise(resolve => resolve()); + } + this.customNoMore = -1; + return this.addData(data, success); + }, + //【通过total判断是否有更多数据】请求结束(成功或者失败)调用此方法,将请求的结果传递给z-paging处理,第一个参数为请求结果数组,第二个参数为total(列表总数),第三个参数为是否成功(默认为是) + completeByTotal(data, total, success = true) { + if (total == 'undefined') { + this.customNoMore = -1; + } else { + const dataTypeRes = this._checkDataType(data, success, false); + data = dataTypeRes.data; + success = dataTypeRes.success; + if (total >= 0 && success) { + return new Promise((resolve, reject) => { + this.$nextTick(() => { + let nomore = false; + const realTotalDataCount = this.pageNo == this.defaultPageNo ? 0 : this.realTotalData.length; + const dataLength = this.privateConcat ? data.length : 0; + let exceedCount = realTotalDataCount + dataLength - total; + if (exceedCount >= 0) { + nomore = true; + exceedCount = this.defaultPageSize - exceedCount; + if (this.privateConcat && exceedCount > 0 && exceedCount < data.length) { + data = data.splice(0, exceedCount); + } + } + this.completeByNoMore(data, nomore, success).then(res => resolve(res)).catch(() => reject()); + }) + }); + } + } + return this.addData(data, success); + }, + //【自行判断是否有更多数据】请求结束(成功或者失败)调用此方法,将请求的结果传递给z-paging处理,第一个参数为请求结果数组,第二个参数为是否有更多数据,第三个参数为是否成功(默认是是) + completeByNoMore(data, nomore, success = true) { + if (nomore != 'undefined') { + this.customNoMore = nomore == true ? 1 : 0; + } + return this.addData(data, success); + }, + //与上方complete方法功能一致,新版本中设置服务端回调数组请使用complete方法 + addData(data, success = true) { + if (!this.fromCompleteEmit) { + this.disabledCompleteEmit = true; + this.fromCompleteEmit = false; + } + const currentTimeStamp = u.getTime(); + const disTime = currentTimeStamp - this.requestTimeStamp; + let minDelay = this.minDelay; + if (this.isFirstPage && this.finalShowRefresherWhenReload) { + minDelay = Math.max(400, minDelay); + } + const addDataDalay = (this.requestTimeStamp > 0 && disTime < minDelay) ? minDelay - disTime : 0; + this.$nextTick(() => { + u.delay(() => { + this._addData(data, success, false); + }, this.delay > 0 ? this.delay : addDataDalay) + }) + + return new Promise((resolve, reject) => { + this.dataPromiseResultMap.complete = { resolve, reject }; + }); + }, + //从顶部添加数据,不会影响分页的pageNo和pageSize + addDataFromTop(data, toTop = true, toTopWithAnimate = true) { + data = Object.prototype.toString.call(data) !== '[object Array]' ? [data] : data.reverse(); + // #ifndef APP-NVUE + this.finalUseVirtualList && this._setCellIndex(data, 'top') + // #endif + this.totalData = [...data, ...this.totalData]; + if (toTop) { + u.delay(() => this._scrollToTop(toTopWithAnimate)); + } + }, + //重新设置列表数据,调用此方法不会影响pageNo和pageSize,也不会触发请求。适用场景:当需要删除列表中某一项时,将删除对应项后的数组通过此方法传递给z-paging。(当出现类似的需要修改列表数组的场景时,请使用此方法,请勿直接修改page中:list.sync绑定的数组) + resetTotalData(data) { + this.isTotalChangeFromAddData = true; + data = Object.prototype.toString.call(data) !== '[object Array]' ? [data] : data; + this.totalData = data; + }, + //添加聊天记录 + addChatRecordData(data, toBottom = true, toBottomWithAnimate = true) { + data = Object.prototype.toString.call(data) !== '[object Array]' ? [data] : data; + if (!this.useChatRecordMode) return; + this.isTotalChangeFromAddData = true; + //#ifndef APP-NVUE + this.totalData = [...this.totalData, ...data]; + //#endif + //#ifdef APP-NVUE + this.totalData = this.nIsFirstPageAndNoMore ? [...this.totalData, ...data] : [...data, ...this.totalData]; + //#endif + if (toBottom) { + u.delay(() => { + //#ifndef APP-NVUE + this._scrollToBottom(toBottomWithAnimate); + //#endif + //#ifdef APP-NVUE + this.nIsFirstPageAndNoMore ? this._scrollToBottom(toBottomWithAnimate) : this._scrollToTop(toBottomWithAnimate); + //#endif + }) + } + }, + //设置本地分页数据,请求结束(成功或者失败)调用此方法,将请求的结果传递给z-paging作分页处理(若调用了此方法,则上拉加载更多时内部会自动分页,不会触发@query所绑定的事件) + setLocalPaging(data, success = true) { + this.isLocalPaging = true; + this.$nextTick(() => { + this._addData(data, success, true); + }) + return new Promise((resolve, reject) => { + this.dataPromiseResultMap.localPaging = { resolve, reject }; + }); + }, + //重新加载分页数据,pageNo会恢复为默认值,相当于下拉刷新的效果(animate为true时会展示下拉刷新动画,默认为false) + reload(animate = this.showRefresherWhenReload) { + if (animate) { + this.privateShowRefresherWhenReload = animate; + this.isUserPullDown = true; + } + if (!this.showLoadingMoreWhenReload) { + this.listRendering = true; + } + this.$nextTick(() => { + this._preReload(animate, false); + }) + return new Promise((resolve, reject) => { + this.dataPromiseResultMap.reload = { resolve, reject }; + }); + }, + //刷新列表数据,pageNo和pageSize不会重置,列表数据会重新从服务端获取。必须保证@query绑定的方法中的pageNo和pageSize和传给服务端的一致 + refresh() { + return this._handleRefreshWithDisPageNo(this.pageNo - this.defaultPageNo + 1); + }, + //刷新列表数据至指定页,例如pageNo=5时则代表刷新列表至第5页,此时pageNo会变为5,列表会展示前5页的数据。必须保证@query绑定的方法中的pageNo和pageSize和传给服务端的一致 + refreshToPage(pageNo) { + this.isHandlingRefreshToPage = true; + return this._handleRefreshWithDisPageNo(pageNo + this.defaultPageNo - 1); + }, + //手动更新列表缓存数据,将自动截取v-model绑定的list中的前pageSize条覆盖缓存,请确保在list数据更新到预期结果后再调用此方法 + updateCache() { + if (this.finalUseCache && this.totalData.length) { + this._saveLocalCache(this.totalData.slice(0, Math.min(this.totalData.length, this.pageSize))); + } + }, + //清空分页数据 + clean() { + this._reload(true); + this._addData([], true, false); + }, + //清空分页数据 + clear() { + this.clean(); + }, + //手动触发滚动到顶部加载更多,聊天记录模式时有效 + doChatRecordLoadMore() { + this.useChatRecordMode && this._onLoadingMore('click'); + }, + //reload之前的一些处理 + _preReload(animate = this.showRefresherWhenReload, isFromMounted = true) { + const showRefresher = this.finalRefresherEnabled && this.useCustomRefresher; + // #ifndef APP-NVUE + if (this.customRefresherHeight === -1 && showRefresher) { + u.delay(() => this._preReload(animate, isFromMounted), c.delayTime / 2); + return; + } + // #endif + this.isUserReload = true; + this.loadingType = Enum.LoadingType.Refresher; + if (animate) { + this.privateShowRefresherWhenReload = animate; + // #ifndef APP-NVUE + if (this.useCustomRefresher) { + this._doRefresherRefreshAnimate(); + } else { + this.refresherTriggered = true; + } + // #endif + // #ifdef APP-NVUE + this.refresherStatus = Enum.Refresher.Loading; + this.refresherRevealStackCount ++; + u.delay(() => { + this._getNodeClientRect('zp-n-refresh-container', false).then((node) => { + if (node) { + let nodeHeight = node[0].height; + this.nShowRefresherReveal = true; + this.nShowRefresherRevealHeight = nodeHeight; + u.delay(() => { + this._nDoRefresherEndAnimation(0, -nodeHeight, false, false); + u.delay(() => { + this._nDoRefresherEndAnimation(nodeHeight, 0); + }, 10) + }, 10) + } + this._reload(false, isFromMounted); + this._doRefresherLoad(false); + }); + }, this.pagingLoaded ? 10 : 100) + return; + // #endif + } else { + this._refresherEnd(false, false, false, false); + } + this._reload(false, isFromMounted); + }, + //重新加载分页数据 + _reload(isClean = false, isFromMounted = false, isUserPullDown = false) { + this.isAddedData = false; + this.insideOfPaging = -1; + this.cacheScrollNodeHeight = -1; + this.pageNo = this.defaultPageNo; + this._cleanRefresherEndTimeout(); + !this.privateShowRefresherWhenReload && !isClean && this._startLoading(true); + this.firstPageLoaded = true; + this.isTotalChangeFromAddData = false; + if (!this.isSettingCacheList) { + this.totalData = []; + } + if (!isClean) { + this._emitQuery(this.pageNo, this.defaultPageSize, isUserPullDown ? Enum.QueryFrom.UserPullDown : Enum.QueryFrom.Reload); + let delay = 0; + // #ifdef MP-TOUTIAO + delay = 5; + // #endif + u.delay(this._callMyParentQuery, delay); + if (!isFromMounted && this.autoScrollToTopWhenReload) { + let checkedNRefresherLoading = true; + // #ifdef APP-NVUE + checkedNRefresherLoading = !this.nRefresherLoading; + // #endif + checkedNRefresherLoading && this._scrollToTop(false); + } + } + // #ifdef APP-NVUE + this.$nextTick(() => { + this.nShowBottom = this.realTotalData.length > 0; + }) + // #endif + }, + //处理服务端返回的数组 + _addData(data, success, isLocal) { + this.isAddedData = true; + this.fromEmptyViewReload = false; + this.isTotalChangeFromAddData = true; + this.refresherTriggered = false; + this._endSystemLoadingAndRefresh(); + const tempIsUserPullDown = this.isUserPullDown; + if (this.showRefresherUpdateTime && this.isFirstPage) { + u.setRefesrherTime(u.getTime(), this.refresherUpdateTimeKey); + this.$refs.refresh && this.$refs.refresh.updateTime(); + } + if (!isLocal && tempIsUserPullDown && this.isFirstPage) { + this.isUserPullDown = false; + } + if (!this.isFirstPage) { + this.listRendering = true; + this.$nextTick(() => { + u.delay(() => this.listRendering = false); + }) + } else { + this.listRendering = false; + } + let dataTypeRes = this._checkDataType(data, success, isLocal); + data = dataTypeRes.data; + success = dataTypeRes.success; + let delayTime = c.delayTime; + // #ifdef APP-NVUE + if (this.useChatRecordMode) delayTime = 0; + // #endif + this.loadingForNow = false; + u.delay(() => { + this.pagingLoaded = true; + this.$nextTick(()=>{ + !isLocal && this._refresherEnd(delayTime > 0, true, tempIsUserPullDown); + }) + }) + if (this.isFirstPage) { + this.isLoadFailed = !success; + this.$emit('isLoadFailedChange', this.isLoadFailed); + if (this.finalUseCache && success && (this.cacheMode === Enum.CacheMode.Always ? true : this.isSettingCacheList)) { + this._saveLocalCache(data); + } + } + this.isSettingCacheList = false; + if (success) { + if (!(this.privateConcat === false && this.loadingStatus === Enum.More.NoMore)) { + this.loadingStatus = Enum.More.Default; + } + if (isLocal) { + this.totalLocalPagingList = data; + const localPageNo = this.defaultPageNo; + const localPageSize = this.queryFrom !== Enum.QueryFrom.Refresh ? this.defaultPageSize : this.currentRefreshPageSize; + this._localPagingQueryList(localPageNo, localPageSize, 0, res => { + this.completeByTotal(res, this.totalLocalPagingList.length); + }) + } else { + let dataChangeDelayTime = 0; + // #ifdef APP-NVUE + if (this.privateShowRefresherWhenReload && this.finalNvueListIs === 'waterfall') { + dataChangeDelayTime = 150; + } + // #endif + u.delay(() => { + this._currentDataChange(data, this.currentData); + this._callDataPromise(true, this.totalData); + }, dataChangeDelayTime) + } + if (this.isHandlingRefreshToPage) { + this.isHandlingRefreshToPage = false; + this.pageNo = this.defaultPageNo + Math.ceil(data.length / this.pageSize) - 1; + if (data.length % this.pageSize !== 0) { + this.customNoMore = 1; + } + } + } else { + this._currentDataChange(data, this.currentData); + this._callDataPromise(false); + this.loadingStatus = Enum.More.Fail; + this.isHandlingRefreshToPage = false; + if (this.loadingType === Enum.LoadingType.LoadingMore) { + this.pageNo --; + } + } + }, + //所有数据改变时调用 + _totalDataChange(newVal, oldVal, eventThrow=true) { + if ((!this.isUserReload || !this.autoCleanListWhenReload) && this.firstPageLoaded && !newVal.length && oldVal.length) { + return; + } + this._doCheckScrollViewShouldFullHeight(newVal); + if(!this.realTotalData.length && !newVal.length){ + eventThrow = false; + } + this.realTotalData = newVal; + if (eventThrow) { + this.$emit('input', newVal); + // #ifdef VUE3 + this.$emit('update:modelValue', newVal); + // #endif + this.$emit('update:list', newVal); + this.$emit('listChange', newVal); + this._callMyParentList(newVal); + } + this.firstPageLoaded = false; + this.isTotalChangeFromAddData = false; + this.$nextTick(() => { + u.delay(()=>{ + this._getNodeClientRect('.zp-paging-container-content').then(res => { + res && this.$emit('contentHeightChanged', res[0].height); + }); + }, c.delayTime * (this.isIos ? 1 : 3)) + // #ifdef APP-NVUE + if (this.useChatRecordMode && this.nIsFirstPageAndNoMore && this.isFirstPage && !this.nFirstPageAndNoMoreChecked) { + this.nFirstPageAndNoMoreChecked = true; + this._scrollToBottom(false); + } + u.delay(() => { + this.nShowBottom = true; + }, c.delayTime * 6, 'nShowBottomDelay'); + // #endif + }) + }, + //当前数据改变时调用 + _currentDataChange(newVal, oldVal) { + newVal = [...newVal]; + // #ifndef APP-NVUE + this.finalUseVirtualList && this._setCellIndex(newVal, 'bottom'); + this.useChatRecordMode && newVal.reverse(); + // #endif + if (this.isFirstPage && this.finalConcat) { + this.totalData = []; + } + if (this.customNoMore !== -1) { + if (this.customNoMore === 1 || !newVal.length) { + this.loadingStatus = Enum.More.NoMore; + } + } else { + if (!newVal.length || (newVal.length && newVal.length < this.defaultPageSize)) { + this.loadingStatus = Enum.More.NoMore; + } + } + if (!this.totalData.length) { + if (this.finalConcat) { + // #ifdef APP-NVUE + if (this.useChatRecordMode && this.isFirstPage && this.loadingStatus === Enum.More.NoMore) { + newVal.reverse(); + } + // #endif + this.totalData = newVal; + } + if (this.useChatRecordMode) { + // #ifndef APP-NVUE + this.$nextTick(() => { + this._scrollToBottom(false); + }) + // #endif + } + } else { + if (this.useChatRecordMode) { + // #ifdef APP-NVUE + this.totalData = [...this.totalData, ...newVal]; + // #endif + //#ifndef APP-NVUE + const idIndex = newVal.length; + let idIndexStr = `z-paging-${idIndex}`; + this.totalData = [...newVal, ...this.totalData]; + if (this.pageNo !== this.defaultPageNo) { + this.privateScrollWithAnimation = 0; + this.$emit('update:chatIndex', idIndex); + this.$nextTick(() => { + this._scrollIntoView(idIndexStr, 30 + Math.max(0, this.cacheTopHeight), false, () => { + this.$emit('update:chatIndex', 0); + }); + }) + } else { + this.$nextTick(() => { + this._scrollToBottom(false); + }) + } + //#endif + + } else { + if (this.finalConcat) { + const currentScrollTop = this.oldScrollTop; + this.totalData = [...this.totalData, ...newVal]; + // #ifdef MP-WEIXIN + if (!this.isIos && !this.refresherOnly && !this.usePageScroll && newVal.length) { + this.loadingMoreTimeStamp = u.getTime(); + this.$nextTick(() => { + this.scrollToY(currentScrollTop); + }) + } + // #endif + } else { + this.totalData = newVal; + } + } + } + this.privateConcat = true; + }, + //根据pageNo处理refresh操作 + _handleRefreshWithDisPageNo(pageNo) { + if (!this.realTotalData.length) return this.reload(); + if (pageNo >= 1) { + this.loading = true; + this.privateConcat = false; + const totalPageSize = pageNo * this.pageSize; + this.currentRefreshPageSize = totalPageSize; + this._emitQuery(this.defaultPageNo, totalPageSize, Enum.QueryFrom.Refresh); + this._callMyParentQuery(this.defaultPageNo, totalPageSize); + } + return new Promise((resolve, reject) => { + this.dataPromiseResultMap.reload = { resolve, reject }; + }); + }, + //本地分页请求 + _localPagingQueryList(pageNo, pageSize, localPagingLoadingTime, callback) { + pageNo = Math.max(1, pageNo); + pageSize = Math.max(1, pageSize); + const totalPagingList = [...this.totalLocalPagingList]; + const pageNoIndex = (pageNo - 1) * pageSize; + const finalPageNoIndex = Math.min(totalPagingList.length, pageNoIndex + pageSize); + const resultPagingList = totalPagingList.splice(pageNoIndex, finalPageNoIndex - pageNoIndex); + u.delay(() => callback(resultPagingList), localPagingLoadingTime) + }, + //存储列表缓存数据 + _saveLocalCache(data) { + uni.setStorageSync(this.finalCacheKey, data); + }, + //通过缓存数据填充列表数据 + _setListByLocalCache() { + this.totalData = uni.getStorageSync(this.finalCacheKey) || []; + this.isSettingCacheList = true; + }, + //修改父view的list + _callMyParentList(newVal) { + if (this.autowireListName.length) { + const myParent = u.getParent(this.$parent); + if (myParent && myParent[this.autowireListName]) { + myParent[this.autowireListName] = newVal; + } + } + }, + //调用父view的query + _callMyParentQuery(customPageNo = 0, customPageSize = 0) { + if (this.autowireQueryName) { + if (this.myParentQuery === -1) { + const myParent = u.getParent(this.$parent); + if (myParent && myParent[this.autowireQueryName]) { + this.myParentQuery = myParent[this.autowireQueryName]; + } + } + if (this.myParentQuery !== -1) { + customPageSize > 0 ? this.myParentQuery(customPageNo, customPageSize) : this.myParentQuery(this.pageNo, this.defaultPageSize); + } + } + }, + //emit query事件 + _emitQuery(pageNo, pageSize, from){ + this.queryFrom = from; + this.requestTimeStamp = u.getTime(); + const [lastItem] = this.realTotalData.slice(-1); + this.$emit('query', ...interceptor._handleQuery(pageNo, pageSize, from, lastItem || null)); + }, + //触发数据改变promise + _callDataPromise(success, totalList) { + for (const key in this.dataPromiseResultMap) { + const obj = this.dataPromiseResultMap[key]; + if (!obj) continue; + success ? obj.resolve({ totalList, noMore: this.loadingStatus === Enum.More.NoMore }) : this.callNetworkReject && obj.reject(`z-paging-${key}-error`); + } + }, + //检查complete data的类型 + _checkDataType(data, success, isLocal) { + const dataType = Object.prototype.toString.call(data); + if (dataType === '[object Boolean]') { + success = data; + data = []; + } else if (dataType !== '[object Array]') { + data = []; + if (dataType !== '[object Undefined]' && dataType !== '[object Null]') { + u.consoleErr(`${isLocal ? 'setLocalPaging' : 'complete'}参数类型不正确,第一个参数类型必须为Array!`); + } + } + return { data, success }; + }, + } +} diff --git a/uni_modules/z-paging/components/z-paging/js/modules/empty.js b/uni_modules/z-paging/components/z-paging/js/modules/empty.js new file mode 100644 index 0000000..fdf7be0 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/empty.js @@ -0,0 +1,147 @@ +// [z-paging]空数据图view模块 +import u from '.././z-paging-utils' + +export default { + props: { + //是否强制隐藏空数据图,默认为否 + hideEmptyView: { + type: Boolean, + default: u.gc('hideEmptyView', false) + }, + //空数据图描述文字,默认为“没有数据哦~” + emptyViewText: { + type: [String, Object], + default: u.gc('emptyViewText', null) + }, + //是否显示空数据图重新加载按钮(无数据时),默认为否 + showEmptyViewReload: { + type: Boolean, + default: u.gc('showEmptyViewReload', false) + }, + //加载失败时是否显示空数据图重新加载按钮,默认为是 + showEmptyViewReloadWhenError: { + type: Boolean, + default: u.gc('showEmptyViewReloadWhenError', true) + }, + //空数据图点击重新加载文字,默认为“重新加载” + emptyViewReloadText: { + type: [String, Object], + default: u.gc('emptyViewReloadText', null) + }, + //空数据图图片,默认使用z-paging内置的图片 + emptyViewImg: { + type: String, + default: u.gc('emptyViewImg', '') + }, + //空数据图“加载失败”描述文字,默认为“很抱歉,加载失败” + emptyViewErrorText: { + type: [String, Object], + default: u.gc('emptyViewErrorText', null) + }, + //空数据图“加载失败”图片,默认使用z-paging内置的图片 + emptyViewErrorImg: { + type: String, + default: u.gc('emptyViewErrorImg', '') + }, + //空数据图样式 + emptyViewStyle: { + type: Object, + default: function() { + return u.gc('emptyViewStyle', {}); + } + }, + //空数据图容器样式 + emptyViewSuperStyle: { + type: Object, + default: function() { + return u.gc('emptyViewSuperStyle', {}); + } + }, + //空数据图img样式 + emptyViewImgStyle: { + type: Object, + default: function() { + return u.gc('emptyViewImgStyle', {}); + } + }, + //空数据图描述文字样式 + emptyViewTitleStyle: { + type: Object, + default: function() { + return u.gc('emptyViewTitleStyle', {}); + } + }, + //空数据图重新加载按钮样式 + emptyViewReloadStyle: { + type: Object, + default: function() { + return u.gc('emptyViewReloadStyle', {}); + } + }, + //空数据图片是否铺满z-paging,默认为否,即填充满z-paging内列表(滚动区域)部分。若设置为否,则为填铺满整个z-paging + emptyViewFixed: { + type: Boolean, + default: u.gc('emptyViewFixed', false) + }, + //空数据图片是否垂直居中,默认为是,若设置为否即为从空数据容器顶部开始显示。emptyViewFixed为false时有效 + emptyViewCenter: { + type: Boolean, + default: u.gc('emptyViewCenter', true) + }, + //加载中时是否自动隐藏空数据图,默认为是 + autoHideEmptyViewWhenLoading: { + type: Boolean, + default: u.gc('autoHideEmptyViewWhenLoading', true) + }, + //用户下拉列表触发下拉刷新加载中时是否自动隐藏空数据图,默认为是 + autoHideEmptyViewWhenPull: { + type: Boolean, + default: u.gc('autoHideEmptyViewWhenPull', true) + }, + //空数据view的z-index,默认为9 + emptyViewZIndex: { + type: Number, + default: u.gc('emptyViewZIndex', 9) + }, + }, + computed: { + finalEmptyViewImg() { + return this.isLoadFailed ? this.emptyViewErrorImg : this.emptyViewImg; + }, + finalShowEmptyViewReload() { + return this.isLoadFailed ? this.showEmptyViewReloadWhenError : this.showEmptyViewReload; + }, + showEmpty() { + if (this.refresherOnly || this.hideEmptyView || this.realTotalData.length) return false; + if (this.autoHideEmptyViewWhenLoading) { + if (this.isAddedData && !this.firstPageLoaded && !this.loading) return true; + } else { + return true; + } + return !this.autoHideEmptyViewWhenPull && !this.isUserReload; + }, + }, + methods: { + //点击了空数据view重新加载按钮 + _emptyViewReload() { + let callbacked = false; + this.$emit('emptyViewReload', reload => { + if (reload === undefined || reload === true) { + this.fromEmptyViewReload = true; + this.reload().catch(() => {}); + } + callbacked = true; + }); + this.$nextTick(() => { + if (!callbacked) { + this.fromEmptyViewReload = true; + this.reload().catch(() => {}); + } + }) + }, + //点击了空数据view + _emptyViewClick() { + this.$emit('emptyViewClick'); + }, + } +} \ No newline at end of file diff --git a/uni_modules/z-paging/components/z-paging/js/modules/i18n.js b/uni_modules/z-paging/components/z-paging/js/modules/i18n.js new file mode 100644 index 0000000..6502df9 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/i18n.js @@ -0,0 +1,101 @@ +// [z-paging]i18n模块 +import { initVueI18n } from '@dcloudio/uni-i18n' +import messages from '../../i18n/index.js' +const { t } = initVueI18n(messages) + +import u from '.././z-paging-utils' +import c from '.././z-paging-constant' +import interceptor from '../z-paging-interceptor' + +const language = uni.getSystemInfoSync().language; +export default { + data() { + return { + language + } + }, + computed: { + finalLanguage() { + try { + const local = uni.getLocale(); + const language = this.language; + return local === 'auto' ? interceptor._handleLanguage2Local(language, this._language2Local(language)) : local; + } catch (e) { + return 'zh-Hans'; + } + }, + finalRefresherDefaultText() { + return this._getI18nText('zp.refresher.default', this.refresherDefaultText); + }, + finalRefresherPullingText() { + return this._getI18nText('zp.refresher.pulling', this.refresherPullingText); + }, + finalRefresherRefreshingText() { + return this._getI18nText('zp.refresher.refreshing', this.refresherRefreshingText); + }, + finalRefresherCompleteText() { + return this._getI18nText('zp.refresher.complete', this.refresherCompleteText); + }, + finalRefresherUpdateTimeTextMap() { + return { + title: t('zp.refresherUpdateTime.title'), + none: t('zp.refresherUpdateTime.none'), + today: t('zp.refresherUpdateTime.today'), + yesterday: t('zp.refresherUpdateTime.yesterday') + }; + }, + finalLoadingMoreDefaultText() { + return this._getI18nText('zp.loadingMore.default', this.loadingMoreDefaultText); + }, + finalLoadingMoreLoadingText() { + return this._getI18nText('zp.loadingMore.loading', this.loadingMoreLoadingText); + }, + finalLoadingMoreNoMoreText() { + return this._getI18nText('zp.loadingMore.noMore', this.loadingMoreNoMoreText); + }, + finalLoadingMoreFailText() { + return this._getI18nText('zp.loadingMore.fail', this.loadingMoreFailText); + }, + finalEmptyViewText() { + return this.isLoadFailed ? this.finalEmptyViewErrorText : this._getI18nText('zp.emptyView.title', this.emptyViewText); + }, + finalEmptyViewReloadText() { + return this._getI18nText('zp.emptyView.reload', this.emptyViewReloadText); + }, + finalEmptyViewErrorText() { + return this._getI18nText('zp.emptyView.error', this.emptyViewErrorText); + }, + finalSystemLoadingText() { + return this._getI18nText('zp.systemLoading.title', this.systemLoadingText); + }, + }, + methods: { + //获取当前z-paging的语言 + getLanguage() { + return this.finalLanguage; + }, + //获取国际化转换后的文本 + _getI18nText(key, value) { + const dataType = Object.prototype.toString.call(value); + if (dataType === '[object Object]') { + const nextValue = value[this.finalLanguage]; + if (nextValue) return nextValue; + } else if (dataType === '[object String]') { + return value; + } + return t(key); + }, + //系统language转i18n local + _language2Local(language) { + const formatedLanguage = language.toLowerCase().replace(new RegExp('_', ''), '-'); + if (formatedLanguage.indexOf('zh') !== -1) { + if (formatedLanguage === 'zh' || formatedLanguage === 'zh-cn' || formatedLanguage.indexOf('zh-hans') !== -1) { + return 'zh-Hans'; + } + return 'zh-Hant'; + } + if (formatedLanguage.indexOf('en') !== -1) return 'en'; + return language; + } + } +} diff --git a/uni_modules/z-paging/components/z-paging/js/modules/load-more.js b/uni_modules/z-paging/components/z-paging/js/modules/load-more.js new file mode 100644 index 0000000..c47be08 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/load-more.js @@ -0,0 +1,315 @@ +// [z-paging]滚动到底部加载更多模块 +import u from '.././z-paging-utils' +import Enum from '.././z-paging-enum' + +export default { + props: { + //自定义底部加载更多样式 + loadingMoreCustomStyle: { + type: Object, + default: function() { + return u.gc('loadingMoreCustomStyle', {}); + } + }, + //自定义底部加载更多文字样式 + loadingMoreTitleCustomStyle: { + type: Object, + default: function() { + return u.gc('loadingMoreTitleCustomStyle', {}); + } + }, + //自定义底部加载更多加载中动画样式 + loadingMoreLoadingIconCustomStyle: { + type: Object, + default: function() { + return u.gc('loadingMoreLoadingIconCustomStyle', {}); + } + }, + //自定义底部加载更多加载中动画图标类型,可选flower或circle,默认为flower + loadingMoreLoadingIconType: { + type: String, + default: u.gc('loadingMoreLoadingIconType', 'flower') + }, + //自定义底部加载更多加载中动画图标图片 + loadingMoreLoadingIconCustomImage: { + type: String, + default: u.gc('loadingMoreLoadingIconCustomImage', '') + }, + //底部加载更多加载中view是否展示旋转动画,默认为是 + loadingMoreLoadingAnimated: { + type: Boolean, + default: u.gc('loadingMoreLoadingAnimated', true) + }, + //是否启用加载更多数据(含滑动到底部加载更多数据和点击加载更多数据),默认为是 + loadingMoreEnabled: { + type: Boolean, + default: u.gc('loadingMoreEnabled', true) + }, + //是否启用滑动到底部加载更多数据,默认为是 + toBottomLoadingMoreEnabled: { + type: Boolean, + default: u.gc('toBottomLoadingMoreEnabled', true) + }, + //滑动到底部状态为默认状态时,以加载中的状态展示,默认为否。若设置为是,可避免滚动到底部看到默认状态然后立刻变为加载中状态的问题,但分页数量未超过一屏时,不会显示【点击加载更多】 + loadingMoreDefaultAsLoading: { + type: [Boolean], + default: u.gc('loadingMoreDefaultAsLoading', false) + }, + //滑动到底部"默认"文字,默认为【点击加载更多】 + loadingMoreDefaultText: { + type: [String, Object], + default: u.gc('loadingMoreDefaultText', null) + }, + //滑动到底部"加载中"文字,默认为【正在加载...】 + loadingMoreLoadingText: { + type: [String, Object], + default: u.gc('loadingMoreLoadingText', null) + }, + //滑动到底部"没有更多"文字,默认为【没有更多了】 + loadingMoreNoMoreText: { + type: [String, Object], + default: u.gc('loadingMoreNoMoreText', null) + }, + //滑动到底部"加载失败"文字,默认为【加载失败,点击重新加载】 + loadingMoreFailText: { + type: [String, Object], + default: u.gc('loadingMoreFailText', null) + }, + //当没有更多数据且分页内容未超出z-paging时是否隐藏没有更多数据的view,默认为否 + hideNoMoreInside: { + type: Boolean, + default: u.gc('hideNoMoreInside', false) + }, + //当没有更多数据且分页数组长度少于这个值时,隐藏没有更多数据的view,默认为0,代表不限制。 + hideNoMoreByLimit: { + type: Number, + default: u.gc('hideNoMoreByLimit', 0) + }, + //是否显示默认的加载更多text,默认为是 + showDefaultLoadingMoreText: { + type: Boolean, + default: u.gc('showDefaultLoadingMoreText', true) + }, + //是否显示没有更多数据的view + showLoadingMoreNoMoreView: { + type: Boolean, + default: u.gc('showLoadingMoreNoMoreView', true) + }, + //是否显示没有更多数据的分割线,默认为是 + showLoadingMoreNoMoreLine: { + type: Boolean, + default: u.gc('showLoadingMoreNoMoreLine', true) + }, + //自定义底部没有更多数据的分割线样式 + loadingMoreNoMoreLineCustomStyle: { + type: Object, + default: function() { + return u.gc('loadingMoreNoMoreLineCustomStyle', {}); + }, + }, + //当分页未满一屏时,是否自动加载更多,默认为否(nvue无效) + insideMore: { + type: Boolean, + default: u.gc('insideMore', false) + }, + //距底部/右边多远时(单位px),触发 scrolltolower 事件,默认为100rpx + lowerThreshold: { + type: [Number, String], + default: u.gc('lowerThreshold', '100rpx') + }, + }, + data() { + return { + M: Enum.More, + //底部加载更多状态 + loadingStatus: Enum.More.Default, + loadingStatusAfterRender: Enum.More.Default, + loadingMoreTimeStamp: 0, + loadingMoreDefaultSlot: null, + showLoadingMore: false, + customNoMore: -1, + } + }, + computed: { + zLoadMoreConfig() { + return { + status: this.loadingStatusAfterRender, + defaultAsLoading: this.loadingMoreDefaultAsLoading, + defaultThemeStyle: this.finalLoadingMoreThemeStyle, + customStyle: this.loadingMoreCustomStyle, + titleCustomStyle: this.loadingMoreTitleCustomStyle, + iconCustomStyle: this.loadingMoreLoadingIconCustomStyle, + loadingIconType: this.loadingMoreLoadingIconType, + loadingIconCustomImage: this.loadingMoreLoadingIconCustomImage, + loadingAnimated: this.loadingMoreLoadingAnimated, + showNoMoreLine: this.showLoadingMoreNoMoreLine, + noMoreLineCustomStyle: this.loadingMoreNoMoreLineCustomStyle, + defaultText: this.finalLoadingMoreDefaultText, + loadingText: this.finalLoadingMoreLoadingText, + noMoreText: this.finalLoadingMoreNoMoreText, + failText: this.finalLoadingMoreFailText, + hideContent: !this.loadingMoreDefaultAsLoading && this.listRendering, + }; + }, + finalLoadingMoreThemeStyle() { + return this.loadingMoreThemeStyle.length ? this.loadingMoreThemeStyle : this.defaultThemeStyle; + }, + showLoadingMoreDefault() { + return this._showLoadingMore('Default'); + }, + showLoadingMoreLoading() { + return this._showLoadingMore('Loading'); + }, + showLoadingMoreNoMore() { + return this._showLoadingMore('NoMore'); + }, + showLoadingMoreFail() { + return this._showLoadingMore('Fail'); + }, + showLoadingMoreCustom() { + return this._showLoadingMore('Custom'); + } + }, + methods: { + //页面滚动到底部时通知z-paging进行进一步处理 + pageReachBottom() { + !this.useChatRecordMode && this._onLoadingMore('toBottom'); + }, + //手动触发上拉加载更多(非必须,可依据具体需求使用) + doLoadMore(type) { + this._onLoadingMore(type); + }, + //通过@scroll事件检测是否滚动到了底部 + _checkScrolledToBottom(scrollDiff, checked = false) { + if (this.cacheScrollNodeHeight === -1) { + this._getNodeClientRect('.zp-scroll-view').then((res) => { + if (res) { + const pageScrollNodeHeight = res[0].height; + this.cacheScrollNodeHeight = pageScrollNodeHeight; + if (scrollDiff - pageScrollNodeHeight <= this.finalLowerThreshold) { + this._onLoadingMore('toBottom'); + } + } + }); + } else { + if (scrollDiff - this.cacheScrollNodeHeight <= this.finalLowerThreshold) { + this._onLoadingMore('toBottom'); + } else if (scrollDiff - this.cacheScrollNodeHeight <= 500 && !checked) { + u.delay(() => { + this._getNodeClientRect('.zp-scroll-view', true, true).then((res) => { + this.oldScrollTop = res[0].scrollTop; + const newScrollDiff = res[0].scrollHeight - this.oldScrollTop; + this._checkScrolledToBottom(newScrollDiff, true); + }) + }, 150, 'checkScrolledToBottomDelay') + } + } + }, + //触发加载更多时调用,from:toBottom-滑动到底部触发;1、click-点击加载更多触发 + _onLoadingMore(from = 'click') { + if (this.isIos && from === 'toBottom' && !this.scrollToBottomBounceEnabled && this.scrollEnable) { + this.scrollEnable = false; + this.$nextTick(() => { + this.scrollEnable = true; + }) + } + this.$emit('scrolltolower', from); + if (from === 'toBottom' && (!this.toBottomLoadingMoreEnabled || this.useChatRecordMode)) return; + if (this.refresherOnly || !this.loadingMoreEnabled || !(this.loadingStatus === Enum.More.Default || this.loadingStatus === Enum.More.Fail) || this.loading || this.showEmpty) return; + // #ifdef MP-WEIXIN + if (!this.isIos && !this.refresherOnly && !this.usePageScroll) { + const currentTimestamp = u.getTime(); + if (this.loadingMoreTimeStamp > 0 && currentTimestamp - this.loadingMoreTimeStamp < 100) { + this.loadingMoreTimeStamp = 0; + return; + } + } + // #endif + this._doLoadingMore(); + }, + //处理开始加载更多 + _doLoadingMore() { + if (this.pageNo >= this.defaultPageNo && this.loadingStatus !== Enum.More.NoMore) { + this.pageNo ++; + this._startLoading(false); + if (this.isLocalPaging) { + this._localPagingQueryList(this.pageNo, this.defaultPageSize, this.localPagingLoadingTime, res => { + this.completeByTotal(res, this.totalLocalPagingList.length); + }) + } else { + this._emitQuery(this.pageNo, this.defaultPageSize, Enum.QueryFrom.LoadingMore); + this._callMyParentQuery(); + } + this.loadingType = Enum.LoadingType.LoadingMore; + } + }, + //(预处理)判断当没有更多数据且分页内容未超出z-paging时是否显示没有更多数据的view + _preCheckShowNoMoreInside(newVal, scrollViewNode, pagingContainerNode) { + if (this.loadingStatus === Enum.More.NoMore && this.hideNoMoreByLimit > 0 && newVal.length) { + this.showLoadingMore = newVal.length > this.hideNoMoreByLimit; + } else if ((this.loadingStatus === Enum.More.NoMore && this.hideNoMoreInside && newVal.length) || (this.insideMore && this.insideOfPaging !== false && newVal.length)) { + this.$nextTick(() => { + this._checkShowNoMoreInside(newVal, scrollViewNode, pagingContainerNode); + }) + if (this.insideMore && this.insideOfPaging !== false && newVal.length) { + this.showLoadingMore = newVal.length; + } + } else { + this.showLoadingMore = newVal.length; + } + }, + //判断当没有更多数据且分页内容未超出z-paging时是否显示没有更多数据的view + async _checkShowNoMoreInside(totalData, oldScrollViewNode, oldPagingContainerNode) { + try { + const scrollViewNode = oldScrollViewNode || await this._getNodeClientRect('.zp-scroll-view'); + if (this.usePageScroll) { + if (scrollViewNode) { + const scrollViewTotalH = scrollViewNode[0].top + scrollViewNode[0].height; + this.insideOfPaging = scrollViewTotalH < this.windowHeight; + if (this.hideNoMoreInside) { + this.showLoadingMore = !this.insideOfPaging; + } + this._updateInsideOfPaging(); + } + } else { + const pagingContainerNode = oldPagingContainerNode || await this._getNodeClientRect('.zp-paging-container-content'); + const pagingContainerH = pagingContainerNode ? pagingContainerNode[0].height : 0; + const scrollViewH = scrollViewNode ? scrollViewNode[0].height : 0; + this.insideOfPaging = pagingContainerH < scrollViewH; + if (this.hideNoMoreInside) { + this.showLoadingMore = !this.insideOfPaging; + } + this._updateInsideOfPaging(); + } + } catch (e) { + this.insideOfPaging = !totalData.length; + if (this.hideNoMoreInside) { + this.showLoadingMore = !this.insideOfPaging; + } + this._updateInsideOfPaging(); + } + }, + //是否要展示上拉加载更多view + _showLoadingMore(type) { + if (!this.showLoadingMoreWhenReload && (!(this.loadingStatus === Enum.More.Default ? this.nShowBottom : true) || !this.realTotalData.length)) return false; + if (((!this.showLoadingMoreWhenReload || this.isUserPullDown || this.loadingStatus !== Enum.More.Loading) && !this.showLoadingMore) || + (!this.loadingMoreEnabled && (!this.showLoadingMoreWhenReload || this.isUserPullDown || this.loadingStatus !== Enum.More.Loading)) || this.refresherOnly) { + return false; + } + if (this.useChatRecordMode && type !== 'Loading') return false; + if (!this.zSlots) return false; + if (type === 'Custom') { + return this.showDefaultLoadingMoreText && !(this.loadingStatus === Enum.More.NoMore && !this.showLoadingMoreNoMoreView); + } + const res = this.loadingStatus === Enum.More[type] && this.zSlots[`loadingMore${type}`] && (type === 'NoMore' ? this.showLoadingMoreNoMoreView : true); + if (res) { + // #ifdef APP-NVUE + if (!this.isIos) { + this.nLoadingMoreFixedHeight = false; + } + // #endif + } + return res; + }, + } +} diff --git a/uni_modules/z-paging/components/z-paging/js/modules/loading.js b/uni_modules/z-paging/components/z-paging/js/modules/loading.js new file mode 100644 index 0000000..52960a5 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/loading.js @@ -0,0 +1,93 @@ +// [z-paging]loading相关模块 +import u from '.././z-paging-utils' +import Enum from '.././z-paging-enum' + +export default { + props: { + //第一次加载后自动隐藏loading slot,默认为是 + autoHideLoadingAfterFirstLoaded: { + type: Boolean, + default: u.gc('autoHideLoadingAfterFirstLoaded', true) + }, + //loading slot是否铺满屏幕并固定,默认为否 + loadingFullFixed: { + type: Boolean, + default: u.gc('loadingFullFixed', false) + }, + //是否自动显示系统Loading:即uni.showLoading,若开启则将在刷新列表时(调用reload、refresh时)显示,下拉刷新和滚动到底部加载更多不会显示,默认为false。 + autoShowSystemLoading: { + type: Boolean, + default: u.gc('autoShowSystemLoading', false) + }, + //显示系统Loading时是否显示透明蒙层,防止触摸穿透,默认为是(H5、App、微信小程序、百度小程序有效) + systemLoadingMask: { + type: Boolean, + default: u.gc('systemLoadingMask', true) + }, + //显示系统Loading时显示的文字,默认为"加载中" + systemLoadingText: { + type: [String, Object], + default: u.gc('systemLoadingText', null) + }, + }, + data() { + return { + loading: false, + loadingForNow: false, + } + }, + watch: { + loadingStatus(newVal) { + this.$emit('loadingStatusChange', newVal); + this.$nextTick(() => { + this.loadingStatusAfterRender = newVal; + }) + // #ifdef APP-NVUE + if (this.useChatRecordMode) { + if (this.pageNo === this.defaultPageNo && newVal === Enum.More.NoMore) { + this.nIsFirstPageAndNoMore = true; + return; + } + } + this.nIsFirstPageAndNoMore = false; + // #endif + }, + loading(newVal){ + if (newVal) { + this.loadingForNow = newVal; + } + }, + }, + computed: { + showLoading() { + if (this.firstPageLoaded || !this.loading || !this.loadingForNow) return false; + if (this.finalShowSystemLoading){ + uni.showLoading({ + title: this.finalSystemLoadingText, + mask: this.systemLoadingMask + }) + } + return this.autoHideLoadingAfterFirstLoaded ? (this.fromEmptyViewReload ? true : !this.pagingLoaded) : this.loadingType === Enum.LoadingType.Refresher; + }, + finalShowSystemLoading() { + return this.autoShowSystemLoading && this.loadingType === Enum.LoadingType.Refresher; + } + }, + methods: { + //处理开始加载更多状态 + _startLoading(isReload = false) { + if ((this.showLoadingMoreWhenReload && !this.isUserPullDown) || !isReload) { + this.loadingStatus = Enum.More.Loading; + } + this.loading = true; + }, + //停止系统loading和refresh + _endSystemLoadingAndRefresh(){ + this.finalShowSystemLoading && uni.hideLoading(); + !this.useCustomRefresher && uni.stopPullDownRefresh(); + // #ifdef APP-NVUE + this.usePageScroll && uni.stopPullDownRefresh(); + // #endif + } + } +} diff --git a/uni_modules/z-paging/components/z-paging/js/modules/nvue.js b/uni_modules/z-paging/components/z-paging/js/modules/nvue.js new file mode 100644 index 0000000..2228841 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/nvue.js @@ -0,0 +1,249 @@ +// [z-paging]nvue独有部分模块 +import u from '.././z-paging-utils' +import c from '.././z-paging-constant' +import Enum from '.././z-paging-enum' + +// #ifdef APP-NVUE +const weexAnimation = weex.requireModule('animation'); +// #endif +export default { + props: { + // #ifdef APP-NVUE + //nvue中修改列表类型,可选值有list、waterfall和scroller,默认为list + nvueListIs: { + type: String, + default: u.gc('nvueListIs', 'list') + }, + //nvue waterfall配置,仅在nvue中且nvueListIs=waterfall时有效,配置参数详情参见:https://uniapp.dcloud.io/component/waterfall + nvueWaterfallConfig: { + type: Object, + default: function() { + return u.gc('nvueWaterfallConfig', {}); + } + }, + //nvue 控制是否回弹效果,iOS不支持动态修改 + nvueBounce: { + type: Boolean, + default: u.gc('nvueBounce', true) + }, + //nvue中通过代码滚动到顶部/底部时,是否加快动画效果(无滚动动画时无效),默认为否 + nvueFastScroll: { + type: Boolean, + default: u.gc('nvueFastScroll', false) + }, + //nvue中list的id + nvueListId: { + type: String, + default: u.gc('nvueListId', '') + }, + //nvue中refresh组件的样式 + nvueRefresherStyle: { + type: Object, + default: function() { + return u.gc('nvueRefresherStyle', {}); + } + }, + //nvue中是否按分页模式(类似竖向swiper)显示List,默认为false + nvuePagingEnabled: { + type: Boolean, + default: u.gc('nvuePagingEnabled', false) + }, + //是否隐藏nvue列表底部的tagView,此view用于标识滚动到底部位置,若隐藏则滚动到底部功能将失效,在nvue中实现吸顶+swiper功能时需将最外层z-paging的此属性设置为true。默认为否 + hideNvueBottomTag: { + type: Boolean, + default: u.gc('hideNvueBottomTag', false) + }, + //nvue中控制onscroll事件触发的频率:表示两次onscroll事件之间列表至少滚动了10px。注意,将该值设置为较小的数值会提高滚动事件采样的精度,但同时也会降低页面的性能 + offsetAccuracy: { + type: Number, + default: u.gc('offsetAccuracy', 10) + }, + // #endif + }, + data() { + return { + nRefresherLoading: false, + nListIsDragging: false, + nShowBottom: true, + nFixFreezing: false, + nShowRefresherReveal: false, + nIsFirstPageAndNoMore: false, + nFirstPageAndNoMoreChecked: false, + nLoadingMoreFixedHeight: false, + nShowRefresherRevealHeight: 0, + nOldShowRefresherRevealHeight: -1, + nRefresherWidth: uni.upx2px(750), + } + }, + watch: { + // #ifdef APP-NVUE + nIsFirstPageAndNoMore: { + handler(newVal) { + const cellStyle = !this.useChatRecordMode || newVal ? {} : { transform: 'rotate(180deg)' }; + this.$emit('update:cellStyle', cellStyle); + this.$emit('cellStyleChange', cellStyle); + }, + immediate: true + }, + // #endif + }, + computed: { + // #ifdef APP-NVUE + nScopedSlots() { + // #ifdef VUE2 + return this.$scopedSlots; + // #endif + // #ifdef VUE3 + return null; + // #endif + }, + nWaterfallColumnCount() { + if (this.finalNvueListIs !== 'waterfall') return 0; + return this._nGetWaterfallConfig('column-count', 2); + }, + nWaterfallColumnWidth() { + return this._nGetWaterfallConfig('column-width', 'auto'); + }, + nWaterfallColumnGap() { + return this._nGetWaterfallConfig('column-gap', 'normal'); + }, + nWaterfallLeftGap() { + return this._nGetWaterfallConfig('left-gap', 0); + }, + nWaterfallRightGap() { + return this._nGetWaterfallConfig('right-gap', 0); + }, + nViewIs() { + const is = this.finalNvueListIs; + return is === 'scroller' || is === 'view' ? 'view' : is === 'waterfall' ? 'header' : 'cell'; + }, + nSafeAreaBottomHeight() { + return this.safeAreaInsetBottom ? this.safeAreaBottom : 0; + }, + nChatRecordRotateStyle() { + return this.useChatRecordMode ? { transform: this.nIsFirstPageAndNoMore ? 'rotate(0deg)' : 'rotate(180deg)' } : {}; + }, + finalNvueListIs() { + if (this.usePageScroll) return 'view'; + const nvueListIsLowerCase = this.nvueListIs.toLowerCase(); + if (['list','waterfall','scroller'].indexOf(nvueListIsLowerCase) !== -1) return nvueListIsLowerCase; + return 'list'; + }, + finalNvueSuperListIs() { + return this.usePageScroll ? 'view' : 'scroller'; + }, + finalNvueRefresherEnabled() { + return this.finalNvueListIs !== 'view' && this.finalRefresherEnabled && !this.nShowRefresherReveal && !this.useChatRecordMode; + }, + // #endif + }, + mounted(){ + // #ifdef APP-NVUE + //旋转屏幕时更新宽度 + uni.onWindowResize((res) => { + // this._nUpdateRefresherWidth(); + }) + // #endif + }, + methods: { + // #ifdef APP-NVUE + //列表滚动时触发 + _nOnScroll(e) { + this.$emit('scroll', e); + const contentOffsetY = -e.contentOffset.y; + this.oldScrollTop = contentOffsetY; + this.nListIsDragging = e.isDragging; + this._checkShouldShowBackToTop(contentOffsetY, contentOffsetY - 1); + }, + //下拉刷新刷新中 + _nOnRrefresh() { + if (this.nShowRefresherReveal) return; + this.nRefresherLoading = true; + this.refresherStatus = Enum.Refresher.Loading; + this._doRefresherLoad(); + }, + //下拉刷新下拉中 + _nOnPullingdown(e) { + if (this.refresherStatus === Enum.Refresher.Loading || (this.isIos && !this.nListIsDragging)) return; + this._emitTouchmove(e); + const { viewHeight, pullingDistance } = e; + this.refresherStatus = pullingDistance >= viewHeight ? Enum.Refresher.ReleaseToRefresh : Enum.Refresher.Default; + }, + //下拉刷新结束 + _nRefresherEnd(doEnd = true) { + if (doEnd) { + this._nDoRefresherEndAnimation(0, -this.nShowRefresherRevealHeight); + !this.usePageScroll && this.$refs['zp-n-list'].resetLoadmore(); + this.nRefresherLoading = false; + } + }, + //执行主动触发下拉刷新动画 + _nDoRefresherEndAnimation(height, translateY, animate = true, checkStack = true) { + this._cleanRefresherCompleteTimeout(); + this._cleanRefresherEndTimeout(); + + if (!this.finalShowRefresherWhenReload) { + this.refresherEndTimeout = u.delay(() => { + this.refresherStatus = Enum.Refresher.Default; + }, this.refresherCompleteDuration); + return; + } + const stackCount = this.refresherRevealStackCount; + if (height === 0 && checkStack) { + this.refresherRevealStackCount --; + if (stackCount > 1) return; + this.refresherEndTimeout = u.delay(() => { + this.refresherStatus = Enum.Refresher.Default; + }, this.refresherCompleteDuration); + } + if (stackCount > 1) { + this.refresherStatus = Enum.Refresher.Loading; + } + + const duration = animate ? 200 : 0; + if (this.nOldShowRefresherRevealHeight !== height) { + if (height > 0) { + this.nShowRefresherReveal = true; + } + weexAnimation.transition(this.$refs['zp-n-list-refresher-reveal'], { + styles: { + height: `${height}px`, + transform: `translateY(${translateY}px)`, + }, + duration, + timingFunction: 'linear', + needLayout: true, + delay: 0 + }) + } + u.delay(() => { + if (animate) { + this.nShowRefresherReveal = height > 0; + } + }, duration > 0 ? duration - 60 : 0); + this.nOldShowRefresherRevealHeight = height; + }, + //滚动到底部加载更多 + _nOnLoadmore() { + if (this.nShowRefresherReveal || !this.totalData.length) return; + this.useChatRecordMode ? this.doChatRecordLoadMore() : this._onLoadingMore('toBottom'); + }, + //获取nvue waterfall单项配置 + _nGetWaterfallConfig(key, defaultValue) { + return this.nvueWaterfallConfig[key] || defaultValue; + }, + //更新nvue 下拉刷新view容器的宽度 + _nUpdateRefresherWidth() { + u.delay(() => { + this.$nextTick(()=>{ + this._getNodeClientRect('.zp-n-list').then(node => { + if (node) { + this.nRefresherWidth = node[0].width || this.nRefresherWidth; + } + }) + }) + }) + } + // #endif + } +} diff --git a/uni_modules/z-paging/components/z-paging/js/modules/refresher.js b/uni_modules/z-paging/components/z-paging/js/modules/refresher.js new file mode 100644 index 0000000..a349ca9 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/refresher.js @@ -0,0 +1,689 @@ +// [z-paging]下拉刷新view模块 +import u from '.././z-paging-utils' +import c from '.././z-paging-constant' +import Enum from '.././z-paging-enum' + +export default { + props: { + //下拉刷新的主题样式,支持black,white,默认black + refresherThemeStyle: { + type: String, + default: u.gc('refresherThemeStyle', '') + }, + //自定义下拉刷新中左侧图标的样式 + refresherImgStyle: { + type: Object, + default: function() { + return u.gc('refresherImgStyle', {}); + } + }, + //自定义下拉刷新中右侧状态描述文字的样式 + refresherTitleStyle: { + type: Object, + default: function() { + return u.gc('refresherTitleStyle', {}); + } + }, + //自定义下拉刷新中右侧最后更新时间文字的样式(show-refresher-update-time为true时有效) + refresherUpdateTimeStyle: { + type: Object, + default: function() { + return u.gc('refresherUpdateTimeStyle', {}); + } + }, + //在微信小程序和QQ小程序中,是否实时监听下拉刷新中进度,默认为否 + watchRefresherTouchmove: { + type: Boolean, + default: u.gc('watchRefresherTouchmove', false) + }, + //底部加载更多的主题样式,支持black,white,默认black + loadingMoreThemeStyle: { + type: String, + default: u.gc('loadingMoreThemeStyle', '') + }, + //是否只使用下拉刷新,设置为true后将关闭mounted自动请求数据、关闭滚动到底部加载更多,强制隐藏空数据图。默认为否 + refresherOnly: { + type: Boolean, + default: u.gc('refresherOnly', false) + }, + //自定义下拉刷新默认状态下回弹动画时间,单位为毫秒,默认为100毫秒,nvue无效 + refresherDefaultDuration: { + type: [Number, String], + default: u.gc('refresherDefaultDuration', 100) + }, + //自定义下拉刷新结束以后延迟回弹的时间,单位为毫秒,默认为0 + refresherCompleteDelay: { + type: [Number, String], + default: u.gc('refresherCompleteDelay', 0) + }, + //自定义下拉刷新结束回弹动画时间,单位为毫秒,默认为300毫秒(refresherEndBounceEnabled为false时,refresherCompleteDuration为设定值的1/3),nvue无效 + refresherCompleteDuration: { + type: [Number, String], + default: u.gc('refresherCompleteDuration', 300) + }, + //自定义下拉刷新结束状态下是否允许列表滚动,默认为否 + refresherCompleteScrollable: { + type: Boolean, + default: u.gc('refresherCompleteScrollable', false) + }, + //是否使用自定义的下拉刷新,默认为是,即使用z-paging的下拉刷新。设置为false即代表使用uni scroll-view自带的下拉刷新,h5、App、微信小程序以外的平台不支持uni scroll-view自带的下拉刷新 + useCustomRefresher: { + type: Boolean, + default: u.gc('useCustomRefresher', true) + }, + //自定义下拉刷新下拉帧率,默认为40,过高可能会出现抖动问题 + refresherFps: { + type: [Number, String], + default: u.gc('refresherFps', 40) + }, + //自定义下拉刷新允许触发的最大下拉角度,默认为40度,当下拉角度小于设定值时,自定义下拉刷新动画不会被触发 + refresherMaxAngle: { + type: [Number, String], + default: u.gc('refresherMaxAngle', 40) + }, + //自定义下拉刷新的角度由未达到最大角度变到达到最大角度时,是否继续下拉刷新手势,默认为否 + refresherAngleEnableChangeContinued: { + type: Boolean, + default: u.gc('refresherAngleEnableChangeContinued', false) + }, + //自定义下拉刷新默认状态下的文字 + refresherDefaultText: { + type: [String, Object], + default: u.gc('refresherDefaultText', null) + }, + //自定义下拉刷新松手立即刷新状态下的文字 + refresherPullingText: { + type: [String, Object], + default: u.gc('refresherPullingText', null) + }, + //自定义下拉刷新刷新中状态下的文字 + refresherRefreshingText: { + type: [String, Object], + default: u.gc('refresherRefreshingText', null) + }, + //自定义下拉刷新刷新结束状态下的文字 + refresherCompleteText: { + type: [String, Object], + default: u.gc('refresherCompleteText', null) + }, + //自定义下拉刷新默认状态下的图片 + refresherDefaultImg: { + type: String, + default: u.gc('refresherDefaultImg', null) + }, + //自定义下拉刷新松手立即刷新状态下的图片,默认与refresherDefaultImg一致 + refresherPullingImg: { + type: String, + default: u.gc('refresherPullingImg', null) + }, + //自定义下拉刷新刷新中状态下的图片 + refresherRefreshingImg: { + type: String, + default: u.gc('refresherRefreshingImg', null) + }, + //自定义下拉刷新刷新结束状态下的图片 + refresherCompleteImg: { + type: String, + default: u.gc('refresherCompleteImg', null) + }, + //自定义下拉刷新刷新中状态下是否展示旋转动画 + refresherRefreshingAnimated: { + type: Boolean, + default: u.gc('refresherRefreshingAnimated', true) + }, + //是否开启自定义下拉刷新刷新结束回弹效果,默认为是 + refresherEndBounceEnabled: { + type: Boolean, + default: u.gc('refresherEndBounceEnabled', true) + }, + //是否开启自定义下拉刷新,默认为是 + refresherEnabled: { + type: Boolean, + default: u.gc('refresherEnabled', true) + }, + //设置自定义下拉刷新阈值,默认为80rpx + refresherThreshold: { + type: [Number, String], + default: u.gc('refresherThreshold', '80rpx') + }, + //设置系统下拉刷新默认样式,支持设置 black,white,none,none 表示不使用默认样式,默认为black + refresherDefaultStyle: { + type: String, + default: u.gc('refresherDefaultStyle', 'black') + }, + //设置自定义下拉刷新区域背景 + refresherBackground: { + type: String, + default: u.gc('refresherBackground', 'transparent') + }, + //设置固定的自定义下拉刷新区域背景 + refresherFixedBackground: { + type: String, + default: u.gc('refresherFixedBackground', 'transparent') + }, + //设置固定的自定义下拉刷新区域高度,默认为0 + refresherFixedBacHeight: { + type: [Number, String], + default: u.gc('refresherFixedBacHeight', 0) + }, + //设置自定义下拉刷新下拉超出阈值后继续下拉位移衰减的比例,范围0-1,值越大代表衰减越多。默认为0.65(nvue无效) + refresherOutRate: { + type: Number, + default: u.gc('refresherOutRate', 0.65) + }, + //设置自定义下拉刷新下拉时实际下拉位移与用户下拉距离的比值,默认为0.75,即代表若用户下拉10px,则实际位移为7.5px(nvue无效) + refresherPullRate: { + type: Number, + default: u.gc('refresherPullRate', 0.75) + }, + //是否显示最后更新时间,默认为否 + showRefresherUpdateTime: { + type: Boolean, + default: u.gc('showRefresherUpdateTime', false) + }, + //如果需要区别不同页面的最后更新时间,请为不同页面的z-paging的`refresher-update-time-key`设置不同的字符串 + refresherUpdateTimeKey: { + type: String, + default: u.gc('refresherUpdateTimeKey', 'default') + }, + //下拉刷新时下拉到“松手立即刷新”状态时是否使手机短振动,默认为否(h5无效) + refresherVibrate: { + type: Boolean, + default: u.gc('refresherVibrate', false) + }, + //下拉刷新时是否禁止下拉刷新view跟随用户触摸竖直移动,默认为否。注意此属性只是禁止下拉刷新view移动,其他下拉刷新逻辑依然会正常触发 + refresherNoTransform: { + type: Boolean, + default: u.gc('refresherNoTransform', false) + }, + //是否开启下拉刷新状态栏占位,适用于隐藏导航栏时,下拉刷新需要避开状态栏高度的情况,默认为否 + useRefresherStatusBarPlaceholder: { + type: Boolean, + default: u.gc('useRefresherStatusBarPlaceholder', false) + }, + }, + data() { + return { + R: Enum.Refresher, + //下拉刷新状态 + refresherStatus: Enum.Refresher.Default, + refresherTouchstartY: 0, + lastRefresherTouchmove: null, + refresherReachMaxAngle: true, + refresherTransform: 'translateY(0px)', + refresherTransition: '', + finalRefresherDefaultStyle: 'black', + refresherRevealStackCount: 0, + refresherCompleteTimeout: null, + refresherCompleteSubTimeout: null, + refresherEndTimeout: null, + isTouchmovingTimeout: null, + refresherTriggered: false, + isTouchmoving: false, + isTouchEnded: false, + isUserPullDown: false, + privateRefresherEnabled: -1, + privateShowRefresherWhenReload: false, + customRefresherHeight: -1, + showCustomRefresher: false, + doRefreshAnimateAfter: false, + isRefresherInComplete: false, + pullDownTimeStamp: 0, + moveDis: 0, + oldMoveDis: 0, + currentDis: 0, + oldCurrentMoveDis: 0, + oldRefresherTouchmoveY: 0, + oldTouchDirection: '', + oldEmitedTouchDirection: '', + oldPullingDistance: -1, + refresherThresholdUpdateTag: 0 + } + }, + watch: { + refresherDefaultStyle: { + handler(newVal) { + if (newVal.length) { + this.finalRefresherDefaultStyle = newVal; + } + }, + immediate: true + }, + refresherStatus(newVal) { + newVal === Enum.Refresher.Loading && this._cleanRefresherEndTimeout(); + this.refresherVibrate && newVal === Enum.Refresher.ReleaseToRefresh && this._doVibrateShort(); + this.$emit('refresherStatusChange', newVal); + this.$emit('update:refresherStatus', newVal); + }, + refresherEnabled(newVal) { + !newVal && this.endRefresh(); + } + }, + computed: { + pullDownDisTimeStamp() { + return 1000 / this.refresherFps; + }, + finalRefresherEnabled() { + if (this.useChatRecordMode) return false; + if (this.privateRefresherEnabled === -1) return this.refresherEnabled; + return this.privateRefresherEnabled === 1; + }, + finalRefresherThreshold() { + let refresherThreshold = this.refresherThreshold; + let idDefault = false; + if (refresherThreshold === '80rpx') { + idDefault = true; + if (this.showRefresherUpdateTime) { + refresherThreshold = '120rpx'; + } + } + if (idDefault && this.customRefresherHeight > 0) return this.customRefresherHeight + this.finalRefresherThresholdPlaceholder; + return u.convertToPx(refresherThreshold) + this.finalRefresherThresholdPlaceholder; + }, + finalRefresherThresholdPlaceholder() { + return this.useRefresherStatusBarPlaceholder ? this.statusBarHeight : 0; + }, + finalRefresherFixedBacHeight() { + return u.convertToPx(this.refresherFixedBacHeight); + }, + finalRefresherThemeStyle() { + return this.refresherThemeStyle.length ? this.refresherThemeStyle : this.defaultThemeStyle; + }, + finalRefresherOutRate() { + let rate = this.refresherOutRate; + rate = Math.max(0,rate); + rate = Math.min(1,rate); + return rate; + }, + finalRefresherPullRate() { + let rate = this.refresherPullRate; + rate = Math.max(0,rate); + return rate; + }, + finalRefresherTransform() { + if (this.refresherNoTransform || this.refresherTransform === 'translateY(0px)') return 'none'; + return this.refresherTransform; + }, + finalShowRefresherWhenReload() { + return this.showRefresherWhenReload || this.privateShowRefresherWhenReload; + }, + finalRefresherTriggered() { + if (!(this.finalRefresherEnabled && !this.useCustomRefresher)) return false; + return this.refresherTriggered; + }, + showRefresher() { + const showRefresher = this.finalRefresherEnabled && this.useCustomRefresher; + // #ifndef APP-NVUE + this.customRefresherHeight === -1 && showRefresher && this.updateCustomRefresherHeight(); + // #endif + return showRefresher; + }, + hasTouchmove(){ + // #ifdef VUE2 + // #ifdef APP-VUE || H5 + if (this.$listeners && !this.$listeners.refresherTouchmove) return false; + // #endif + // #ifdef MP-WEIXIN || MP-QQ + return this.watchRefresherTouchmove; + // #endif + return true; + // #endif + return this.watchRefresherTouchmove; + }, + }, + methods: { + //终止下拉刷新状态 + endRefresh() { + this.totalData = this.realTotalData; + this._refresherEnd(); + this._endSystemLoadingAndRefresh(); + this._handleScrollViewDisableBounce({ bounce: true }); + this.$nextTick(() => { + this.refresherTriggered = false; + }) + }, + handleRefresherStatusChanged(func) { + this.refresherStatusChangedFunc = func; + }, + //手动更新自定义下拉刷新view高度 + updateCustomRefresherHeight() { + u.delay(() => this.$nextTick(this._updateCustomRefresherHeight)); + }, + //自定义下拉刷新被触发 + _onRefresh(fromScrollView = false,isUserPullDown = true) { + if (fromScrollView && !(this.finalRefresherEnabled && !this.useCustomRefresher)) return; + this.$emit('onRefresh'); + this.$emit('Refresh'); + // #ifdef APP-NVUE + if (this.loading) { + u.delay(this._nRefresherEnd, 500) + return; + } + // #endif + if (this.loading || this.isRefresherInComplete) return; + this.loadingType = Enum.LoadingType.Refresher; + if (this.nShowRefresherReveal) return; + this.isUserPullDown = isUserPullDown; + this.isUserReload = !isUserPullDown; + this._startLoading(true); + this.refresherTriggered = true; + if(this.reloadWhenRefresh && isUserPullDown){ + this.useChatRecordMode ? this._onLoadingMore('click') : this._reload(false, false, isUserPullDown); + } + }, + //自定义下拉刷新被复位 + _onRestore() { + this.refresherTriggered = 'restore'; + this.$emit('onRestore'); + this.$emit('Restore'); + }, + // #ifndef APP-VUE || MP-WEIXIN || MP-QQ || H5 + //拖拽开始 + _refresherTouchstart(e) { + this._handleListTouchstart(); + if (this._touchDisabled()) return; + this._handleRefresherTouchstart(u.getTouch(e)); + }, + // #endif + //进一步处理拖拽开始结果 + _handleRefresherTouchstart(touch) { + if (!this.loading && this.isTouchEnded) { + this.isTouchmoving = false; + } + this.loadingType = Enum.LoadingType.Refresher; + this.isTouchmovingTimeout && clearTimeout(this.isTouchmovingTimeout); + this.isTouchEnded = false; + this.refresherTransition = ''; + this.refresherTouchstartY = touch.touchY; + this.$emit('refresherTouchstart', this.refresherTouchstartY); + this.lastRefresherTouchmove = touch; + this._cleanRefresherCompleteTimeout(); + this._cleanRefresherEndTimeout(); + }, + // #ifndef APP-VUE || MP-WEIXIN || MP-QQ || H5 + //拖拽中 + _refresherTouchmove(e) { + const currentTimeStamp = u.getTime(); + let touch = null; + let refresherTouchmoveY = 0; + if (this.watchTouchDirectionChange) { + touch = u.getTouch(e); + refresherTouchmoveY = touch.touchY; + const direction = refresherTouchmoveY > this.oldRefresherTouchmoveY ? 'top' : 'bottom'; + if (direction === this.oldTouchDirection && direction !== this.oldEmitedTouchDirection) { + this._handleTouchDirectionChange({ direction }); + this.oldEmitedTouchDirection = direction; + } + this.oldTouchDirection = direction; + this.oldRefresherTouchmoveY = refresherTouchmoveY; + } + if (this.pullDownTimeStamp && currentTimeStamp - this.pullDownTimeStamp <= this.pullDownDisTimeStamp) return; + if (this._touchDisabled()) return; + this.pullDownTimeStamp = Number(currentTimeStamp); + touch = u.getTouch(e); + refresherTouchmoveY = touch.touchY; + let moveDis = refresherTouchmoveY - this.refresherTouchstartY; + if (moveDis < 0) return; + if (this.refresherMaxAngle >= 0 && this.refresherMaxAngle <= 90 && this.lastRefresherTouchmove && this.lastRefresherTouchmove.touchY <= refresherTouchmoveY) { + if (!moveDis && !this.refresherAngleEnableChangeContinued && this.moveDis < 1 && !this.refresherReachMaxAngle) return; + const x = Math.abs(touch.touchX - this.lastRefresherTouchmove.touchX); + const y = Math.abs(refresherTouchmoveY - this.lastRefresherTouchmove.touchY); + const z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); + if ((x || y) && x > 1) { + const angle = Math.asin(y / z) / Math.PI * 180; + if (angle < this.refresherMaxAngle) { + this.lastRefresherTouchmove = touch; + this.refresherReachMaxAngle = false; + return; + } + } + } + moveDis = this._getFinalRefresherMoveDis(moveDis); + this._handleRefresherTouchmove(moveDis, touch); + if (!this.disabledBounce) { + if(this.isIos){ + // #ifndef MP-LARK + this._handleScrollViewDisableBounce({ bounce: false }); + // #endif + } + this.disabledBounce = true; + } + this._emitTouchmove({ pullingDistance: moveDis, dy: this.moveDis - this.oldMoveDis }); + }, + // #endif + //进一步处理拖拽中结果 + _handleRefresherTouchmove(moveDis, touch) { + this.refresherReachMaxAngle = true; + this.isTouchmovingTimeout && clearTimeout(this.isTouchmovingTimeout); + this.isTouchmoving = true; + this.isTouchEnded = false; + this.refresherStatus = moveDis >= this.finalRefresherThreshold ? Enum.Refresher.ReleaseToRefresh : this.refresherStatus = Enum.Refresher.Default; + // #ifndef APP-VUE || MP-WEIXIN || MP-QQ || H5 + // this.scrollEnable = false; + this.refresherTransform = `translateY(${moveDis}px)`; + this.lastRefresherTouchmove = touch; + // #endif + this.moveDis = moveDis; + }, + // #ifndef APP-VUE || MP-WEIXIN || MP-QQ || H5 + //拖拽结束 + _refresherTouchend(e) { + if (this._touchDisabled() || !this.isTouchmoving) return; + const touch = u.getTouch(e); + let refresherTouchendY = touch.touchY; + let moveDis = refresherTouchendY - this.refresherTouchstartY; + moveDis = this._getFinalRefresherMoveDis(moveDis); + this._handleRefresherTouchend(moveDis); + this._handleScrollViewDisableBounce({bounce: true}); + this.disabledBounce = false; + }, + // #endif + //进一步处理拖拽结束结果 + _handleRefresherTouchend(moveDis) { + // #ifndef APP-PLUS || H5 || MP-WEIXIN + if (!this.isTouchmoving) return; + // #endif + this.isTouchmovingTimeout && clearTimeout(this.isTouchmovingTimeout); + this.refresherReachMaxAngle = true; + this.isTouchEnded = true; + const refresherThreshold = this.finalRefresherThreshold; + if (moveDis >= refresherThreshold && this.refresherStatus === Enum.Refresher.ReleaseToRefresh) { + // #ifndef APP-VUE || MP-WEIXIN || MP-QQ || H5 + this.refresherTransform = `translateY(${refresherThreshold}px)`; + this.refresherTransition = 'transform .1s linear'; + // #endif + u.delay(() => { + this._emitTouchmove({ pullingDistance: refresherThreshold, dy: this.moveDis - refresherThreshold }); + }, 0.1); + this.moveDis = refresherThreshold; + this.refresherStatus = Enum.Refresher.Loading; + this._doRefresherLoad(); + } else { + this._refresherEnd(); + this.isTouchmovingTimeout = u.delay(() => { + this.isTouchmoving = false; + }, this.refresherDefaultDuration); + } + this.scrollEnable = true; + this.$emit('refresherTouchend', moveDis); + }, + //处理列表触摸开始事件 + _handleListTouchstart() { + if (this.useChatRecordMode && this.autoHideKeyboardWhenChat) { + uni.hideKeyboard(); + this.$emit('hidedKeyboard'); + } + }, + //处理scroll-view bounce是否生效 + _handleScrollViewDisableBounce({ bounce }) { + if (!this.usePageScroll && !this.scrollToTopBounceEnabled && this.wxsScrollTop <= 5) { + // #ifdef APP-VUE || MP-WEIXIN || MP-QQ || H5 + this.refresherTransition = ''; + // #endif + this.scrollEnable = bounce; + } + }, + //wxs正在下拉状态改变处理 + _handleWxsPullingDownStatusChange(onPullingDown) { + this.wxsOnPullingDown = onPullingDown; + if (onPullingDown && !this.useChatRecordMode) { + this.renderPropScrollTop = 0; + } + }, + //wxs正在下拉处理 + _handleWxsPullingDown({ moveDis, diffDis }){ + this._emitTouchmove({ pullingDistance: moveDis,dy: diffDis }); + }, + //wxs触摸方向改变 + _handleTouchDirectionChange({ direction }) { + this.$emit('touchDirectionChange',direction); + }, + //wxs通知更新其props + _handlePropUpdate(){ + this.wxsPropType = u.getTime().toString(); + }, + //下拉刷新结束 + _refresherEnd(shouldEndLoadingDelay = true, fromAddData = false, isUserPullDown = false, setLoading = true) { + if (this.loadingType === Enum.LoadingType.Refresher) { + const refresherCompleteDelay = (fromAddData && (isUserPullDown || this.showRefresherWhenReload)) ? this.refresherCompleteDelay : 0; + const refresherStatus = refresherCompleteDelay > 0 ? Enum.Refresher.Complete : Enum.Refresher.Default; + if (this.finalShowRefresherWhenReload) { + const stackCount = this.refresherRevealStackCount; + this.refresherRevealStackCount --; + if (stackCount > 1) return; + } + this._cleanRefresherEndTimeout(); + this.refresherEndTimeout = u.delay(() => { + this.refresherStatus = refresherStatus; + }, this.refresherStatus !== Enum.Refresher.Default && refresherStatus === Enum.Refresher.Default ? this.refresherCompleteDuration : 0); + + // #ifndef APP-NVUE + if (refresherCompleteDelay > 0) { + this.isRefresherInComplete = true; + } + // #endif + this._cleanRefresherCompleteTimeout(); + this.refresherCompleteTimeout = u.delay(() => { + let animateDuration = 1; + const animateType = this.refresherEndBounceEnabled && fromAddData ? 'cubic-bezier(0.19,1.64,0.42,0.72)' : 'linear'; + if (fromAddData) { + animateDuration = this.refresherEndBounceEnabled ? this.refresherCompleteDuration / 1000 : this.refresherCompleteDuration / 3000; + } + this.refresherTransition = `transform ${fromAddData ? animateDuration : this.refresherDefaultDuration / 1000}s ${animateType}`; + // #ifndef APP-VUE || MP-WEIXIN || MP-QQ || H5 + this.refresherTransform = 'translateY(0px)'; + this.currentDis = 0; + // #endif + // #ifdef APP-VUE || MP-WEIXIN || MP-QQ || H5 + this.wxsPropType = this.refresherTransition + 'end' + u.getTime(); + // #endif + // #ifdef APP-NVUE + this._nRefresherEnd(); + // #endif + this.moveDis = 0; + // #ifndef APP-NVUE + if (refresherStatus === Enum.Refresher.Complete) { + if (this.refresherCompleteSubTimeout) { + clearTimeout(this.refresherCompleteSubTimeout); + this.refresherCompleteSubTimeout = null; + } + this.refresherCompleteSubTimeout = u.delay(() => { + this.$nextTick(() => { + this.refresherStatus = Enum.Refresher.Default; + this.isRefresherInComplete = false; + }) + }, animateDuration * 800); + } + // #endif + this._emitTouchmove({ pullingDistance: 0, dy: this.moveDis }); + }, refresherCompleteDelay); + } + if (setLoading) { + u.delay(() => this.loading = false, shouldEndLoadingDelay ? c.delayTime : 0); + isUserPullDown && this._onRestore(); + } + }, + //模拟用户手动触发下拉刷新 + _doRefresherRefreshAnimate() { + this._cleanRefresherCompleteTimeout(); + // #ifndef APP-NVUE + const doRefreshAnimateAfter = !this.doRefreshAnimateAfter && (this.finalShowRefresherWhenReload) && this + .customRefresherHeight === -1 && this.refresherThreshold === '80rpx'; + if (doRefreshAnimateAfter) { + this.doRefreshAnimateAfter = true; + return; + } + // #endif + this.refresherRevealStackCount ++; + // #ifndef APP-VUE || MP-WEIXIN || MP-QQ || H5 + this.refresherTransform = `translateY(${this.finalRefresherThreshold}px)`; + // #endif + // #ifdef APP-VUE || MP-WEIXIN || MP-QQ || H5 + this.wxsPropType = 'begin' + u.getTime(); + // #endif + this.moveDis = this.finalRefresherThreshold; + this.refresherStatus = Enum.Refresher.Loading; + this.isTouchmoving = true; + this.isTouchmovingTimeout && clearTimeout(this.isTouchmovingTimeout); + this._doRefresherLoad(false); + }, + //触发下拉刷新 + _doRefresherLoad(isUserPullDown = true) { + this._onRefresh(false,isUserPullDown); + this.loading = true; + }, + // #ifndef APP-VUE || MP-WEIXIN || MP-QQ || H5 + //获取处理后的moveDis + _getFinalRefresherMoveDis(moveDis) { + let diffDis = moveDis - this.oldCurrentMoveDis; + this.oldCurrentMoveDis = moveDis; + if (diffDis > 0) { + diffDis = diffDis * this.finalRefresherPullRate; + if (this.currentDis > this.finalRefresherThreshold) { + diffDis = diffDis * (1 - this.finalRefresherOutRate); + } + } + diffDis = diffDis > 100 ? diffDis / 100 : diffDis; + this.currentDis += diffDis; + this.currentDis = Math.max(0, this.currentDis); + return this.currentDis; + }, + //判断touch手势是否要触发 + _touchDisabled() { + const checkOldScrollTop = this.oldScrollTop > 5; + return this.loading || this.isRefresherInComplete || this.useChatRecordMode || !this.refresherEnabled || !this.useCustomRefresher ||(this.usePageScroll && this.useCustomRefresher && this.pageScrollTop > 10) || (!(this.usePageScroll && this.useCustomRefresher) && checkOldScrollTop); + }, + // #endif + //更新自定义下拉刷新view高度 + _updateCustomRefresherHeight() { + this._getNodeClientRect('.zp-custom-refresher-slot-view').then((res) => { + this.customRefresherHeight = res ? res[0].height : 0; + this.showCustomRefresher = this.customRefresherHeight > 0; + if (this.doRefreshAnimateAfter) { + this.doRefreshAnimateAfter = false; + this._doRefresherRefreshAnimate(); + } + }); + }, + //发射pullingDown事件 + _emitTouchmove(e) { + // #ifndef APP-NVUE + e.viewHeight = this.finalRefresherThreshold; + // #endif + e.rate = e.viewHeight > 0 ? e.pullingDistance / e.viewHeight : 0; + this.hasTouchmove && this.oldPullingDistance !== e.pullingDistance && this.$emit('refresherTouchmove', e); + this.oldPullingDistance = e.pullingDistance; + }, + //清除refresherCompleteTimeout + _cleanRefresherCompleteTimeout() { + this.refresherCompleteTimeout = this._cleanTimeout(this.refresherCompleteTimeout); + // #ifdef APP-NVUE + this._nRefresherEnd(false); + // #endif + }, + //清除refresherEndTimeout + _cleanRefresherEndTimeout() { + this.refresherEndTimeout = this._cleanTimeout(this.refresherEndTimeout); + }, + } +} diff --git a/uni_modules/z-paging/components/z-paging/js/modules/scroller.js b/uni_modules/z-paging/components/z-paging/js/modules/scroller.js new file mode 100644 index 0000000..39a2fbc --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/scroller.js @@ -0,0 +1,464 @@ +// [z-paging]scroll相关模块 +import u from '.././z-paging-utils' +import Enum from '.././z-paging-enum' + +// #ifdef APP-NVUE +const weexDom = weex.requireModule('dom'); +// #endif + +export default { + props: { + //使用页面滚动,默认为否,当设置为是时则使用页面的滚动而非此组件内部的scroll-view的滚动,使用页面滚动时z-paging无需设置确定的高度且对于长列表展示性能更高,但配置会略微繁琐 + usePageScroll: { + type: Boolean, + default: u.gc('usePageScroll', false) + }, + //是否可以滚动,使用内置scroll-view和nvue时有效,默认为是 + scrollable: { + type: Boolean, + default: u.gc('scrollable', true) + }, + //控制是否出现滚动条,默认为是 + showScrollbar: { + type: Boolean, + default: u.gc('showScrollbar', true) + }, + //是否允许横向滚动,默认为否 + scrollX: { + type: Boolean, + default: u.gc('scrollX', false) + }, + //iOS设备上滚动到顶部时是否允许回弹效果,默认为否。关闭回弹效果后可使滚动到顶部与下拉刷新更连贯,但是有吸顶view时滚动到顶部时可能出现抖动。 + scrollToTopBounceEnabled: { + type: Boolean, + default: u.gc('scrollToTopBounceEnabled', false) + }, + //iOS设备上滚动到底部时是否允许回弹效果,默认为是。 + scrollToBottomBounceEnabled: { + type: Boolean, + default: u.gc('scrollToBottomBounceEnabled', true) + }, + //在设置滚动条位置时使用动画过渡,默认为否 + scrollWithAnimation: { + type: Boolean, + default: u.gc('scrollWithAnimation', false) + }, + //值应为某子元素id(id不能以数字开头)。设置哪个方向可滚动,则在哪个方向滚动到该元素 + scrollIntoView: { + type: String, + default: u.gc('scrollIntoView', '') + }, + }, + data() { + return { + scrollTop: 0, + oldScrollTop: 0, + scrollViewStyle: {}, + scrollViewContainerStyle: {}, + scrollViewInStyle: {}, + pageScrollTop: -1, + scrollEnable: true, + privateScrollWithAnimation: -1, + cacheScrollNodeHeight: -1 + } + }, + watch: { + oldScrollTop(newVal) { + !this.usePageScroll && this._scrollTopChange(newVal,false); + }, + pageScrollTop(newVal) { + this.usePageScroll && this._scrollTopChange(newVal,true); + }, + usePageScroll: { + handler(newVal) { + this.loaded && this.autoHeight && this._setAutoHeight(!newVal); + // #ifdef H5 + if (newVal) { + this.$nextTick(() => { + const mainScrollRef = this.$refs['zp-scroll-view'].$refs.main; + if (mainScrollRef) { + mainScrollRef.style = {}; + } + }) + } + // #endif + }, + immediate: true + }, + finalScrollTop(newVal) { + if (!this.useChatRecordMode) { + this.renderPropScrollTop = newVal < 6 ? 0 : 10; + } + }, + }, + computed: { + finalScrollWithAnimation() { + if (this.privateScrollWithAnimation !== -1) { + const scrollWithAnimation = this.privateScrollWithAnimation === 1; + this.privateScrollWithAnimation = -1; + return scrollWithAnimation; + } + return this.scrollWithAnimation; + }, + finalScrollViewStyle() { + if (this.superContentZIndex != 1) { + this.scrollViewStyle['z-index'] = this.superContentZIndex; + this.scrollViewStyle['position'] = 'relative'; + } + return this.scrollViewStyle; + }, + finalScrollTop() { + return this.usePageScroll ? this.pageScrollTop : this.oldScrollTop; + }, + finalIsOldWebView() { + return this.isOldWebView && !this.usePageScroll; + } + }, + methods: { + //滚动到顶部,animate为是否展示滚动动画,默认为是 + scrollToTop(animate, checkReverse = true) { + // #ifdef APP-NVUE + if (checkReverse && this.useChatRecordMode) { + if (!this.nIsFirstPageAndNoMore) { + this.scrollToBottom(animate, false); + return; + } + } + // #endif + this.$nextTick(() => { + this._scrollToTop(animate, false); + // #ifdef APP-NVUE + if (this.nvueFastScroll && animate) { + u.delay(() => { + this._scrollToTop(false, false); + }); + } + // #endif + }) + }, + //滚动到底部,animate为是否展示滚动动画,默认为是 + scrollToBottom(animate, checkReverse = true) { + // #ifdef APP-NVUE + if (checkReverse && this.useChatRecordMode) { + if (!this.nIsFirstPageAndNoMore) { + this.scrollToTop(animate, false); + return; + } + } + // #endif + this.$nextTick(() => { + this._scrollToBottom(animate); + // #ifdef APP-NVUE + if (this.nvueFastScroll && animate) { + u.delay(() => { + this._scrollToBottom(false); + }); + } + // #endif + }) + }, + //滚动到指定view(vue中有效)。sel为需要滚动的view的id值,不包含"#";offset为偏移量,单位为px;animate为是否展示滚动动画,默认为否 + scrollIntoViewById(sel, offset, animate) { + this._scrollIntoView(sel, offset, animate); + }, + //滚动到指定view(vue中有效)。nodeTop为需要滚动的view的top值(通过uni.createSelectorQuery()获取);offset为偏移量,单位为px;animate为是否展示滚动动画,默认为否 + scrollIntoViewByNodeTop(nodeTop, offset, animate) { + this.scrollTop = this.oldScrollTop; + this.$nextTick(() => { + this._scrollIntoViewByNodeTop(nodeTop, offset, animate); + }) + }, + //滚动到指定位置(vue中有效)。y为与顶部的距离,单位为px;offset为偏移量,单位为px;animate为是否展示滚动动画,默认为否 + scrollToY(y, offset, animate) { + this.scrollTop = this.oldScrollTop; + this.$nextTick(() => { + this._scrollToY(y, offset, animate); + }) + }, + //滚动到指定view(nvue中有效)。index为需要滚动的view的index(第几个);offset为偏移量,单位为px;animate为是否展示滚动动画,默认为否 + scrollIntoViewByIndex(index, offset, animate) { + this._scrollIntoView(index, offset, animate); + }, + //滚动到指定view(nvue中有效)。view为需要滚动的view(通过`this.$refs.xxx`获取),不包含"#";offset为偏移量,单位为px;animate为是否展示滚动动画,默认为否 + scrollIntoViewByView(view, offset, animate) { + this._scrollIntoView(view, offset, animate); + }, + //当使用页面滚动并且自定义下拉刷新时,请在页面的onPageScroll中调用此方法,告知z-paging当前的pageScrollTop,否则会导致在任意位置都可以下拉刷新 + updatePageScrollTop(value) { + this.pageScrollTop = value; + }, + //当使用页面滚动并且设置了slot="top"时,默认初次加载会自动获取其高度,并使内部容器下移,当slot="top"的view高度动态改变时,在其高度需要更新时调用此方法 + updatePageScrollTopHeight() { + this._updatePageScrollTopOrBottomHeight('top'); + }, + //当使用页面滚动并且设置了slot="bottom"时,默认初次加载会自动获取其高度,并使内部容器下移,当slot="bottom"的view高度动态改变时,在其高度需要更新时调用此方法 + updatePageScrollBottomHeight() { + this._updatePageScrollTopOrBottomHeight('bottom'); + }, + //更新slot="left"和slot="right"宽度,当slot="left"或slot="right"宽度动态改变时调用 + updateLeftAndRightWidth() { + if (!this.finalIsOldWebView) return; + this.$nextTick(() => this._updateLeftAndRightWidth(this.scrollViewContainerStyle, 'zp-page')); + }, + //更新z-paging内置scroll-view的scrollTop + updateScrollViewScrollTop(scrollTop, animate = true) { + this.privateScrollWithAnimation = animate ? 1 : 0; + this.scrollTop = this.oldScrollTop; + this.$nextTick(() => { + this.scrollTop = scrollTop; + this.oldScrollTop = this.scrollTop; + }); + }, + + //当滚动到顶部时 + _onScrollToUpper() { + this.$emit('scrolltoupper'); + this.$emit('scrollTopChange', 0); + this.$nextTick(() => { + this.oldScrollTop = 0; + }) + this.useChatRecordMode && this.loadingStatus !== Enum.More.NoMore && this._onLoadingMore('click'); + }, + //当滚动到底部时 + _onScrollToLower(e) { + (!e.detail || !e.detail.direction || e.detail.direction === 'bottom') && this._onLoadingMore('toBottom') + }, + //滚动到顶部 + _scrollToTop(animate = true, isPrivate = true) { + // #ifdef APP-NVUE + const el = this.$refs['zp-n-list-top-tag']; + if (this.usePageScroll) { + this._getNodeClientRect('zp-page-scroll-top', false).then(node => { + const nodeHeight = node ? node[0].height : 0; + weexDom.scrollToElement(el, { + offset: -nodeHeight, + animated: animate + }); + }); + } else { + if (!this.isIos && this.nvueListIs === 'scroller') { + this._getNodeClientRect('zp-n-refresh-container', false).then(node => { + const nodeHeight = node ? node[0].height : 0; + weexDom.scrollToElement(el, { + offset: -nodeHeight, + animated: animate + }); + }); + } else { + weexDom.scrollToElement(el, { + offset: 0, + animated: animate + }); + } + } + return; + // #endif + if (this.usePageScroll) { + this.$nextTick(() => { + uni.pageScrollTo({ + scrollTop: 0, + duration: animate ? 100 : 0, + }); + }); + return; + } + this.privateScrollWithAnimation = animate ? 1 : 0; + this.scrollTop = this.oldScrollTop; + this.$nextTick(() => { + this.scrollTop = 0; + this.oldScrollTop = this.scrollTop; + }); + }, + //滚动到底部 + async _scrollToBottom(animate = true) { + // #ifdef APP-NVUE + const el = this.$refs['zp-n-list-bottom-tag']; + if (el) { + weexDom.scrollToElement(el, { + offset: 0, + animated: animate + }); + } else { + u.consoleErr('滚动到底部失败,因为您设置了hideNvueBottomTag为true'); + } + return; + // #endif + if (this.usePageScroll) { + this.$nextTick(() => { + uni.pageScrollTo({ + scrollTop: Number.MAX_VALUE, + duration: animate ? 100 : 0, + }); + }); + return; + } + try { + this.privateScrollWithAnimation = animate ? 1 : 0; + const pagingContainerNode = await this._getNodeClientRect('.zp-paging-container'); + const scrollViewNode = await this._getNodeClientRect('.zp-scroll-view'); + const pagingContainerH = pagingContainerNode ? pagingContainerNode[0].height : 0; + const scrollViewH = scrollViewNode ? scrollViewNode[0].height : 0; + if (pagingContainerH > scrollViewH) { + this.scrollTop = this.oldScrollTop; + this.$nextTick(() => { + this.scrollTop = pagingContainerH - scrollViewH + this.virtualPlaceholderTopHeight; + this.oldScrollTop = this.scrollTop; + }); + } + } catch (e) {} + }, + //滚动到指定view + _scrollIntoView(sel, offset = 0, animate = false, finishCallback) { + try { + this.scrollTop = this.oldScrollTop; + this.$nextTick(() => { + // #ifdef APP-NVUE + const refs = this.$parent.$refs; + if (!refs) return; + const dataType = Object.prototype.toString.call(sel); + let el = null; + if (dataType === '[object Number]') { + const els = refs[`z-paging-${sel}`]; + el = els ? els[0] : null; + } else if (dataType === '[object Array]') { + el = sel[0]; + } else { + el = sel; + } + if (el) { + weexDom.scrollToElement(el, { + offset: -offset, + animated: animate + }); + } else { + u.consoleErr('在nvue中滚动到指定位置,cell必须设置 :ref="`z-paging-${index}`"'); + } + return; + // #endif + this._getNodeClientRect('#' + sel.replace('#', ''), this.$parent).then((node) => { + if (node) { + let nodeTop = node[0].top; + this._scrollIntoViewByNodeTop(nodeTop, offset, animate); + finishCallback && finishCallback(); + } + }); + }); + } catch (e) {} + }, + //通过nodeTop滚动到指定view + _scrollIntoViewByNodeTop(nodeTop, offset = 0, animate = false) { + this._scrollToY(nodeTop, offset, animate, true); + }, + //滚动到指定位置 + _scrollToY(y, offset = 0, animate = false, addScrollTop = false) { + this.privateScrollWithAnimation = animate ? 1 : 0; + if (this.usePageScroll) { + uni.pageScrollTo({ + scrollTop: y - offset, + duration: animate ? 100 : 0 + }); + } else { + if(addScrollTop){ + y += this.oldScrollTop; + } + this.scrollTop = y - offset; + this.oldScrollTop = this.scrollTop; + } + }, + //scroll-view滚动中 + _scroll(e) { + this.$emit('scroll', e); + const scrollTop = e.detail.scrollTop; + // #ifndef APP-NVUE + this.finalUseVirtualList && this._updateVirtualScroll(scrollTop, this.oldScrollTop - scrollTop); + // #endif + this.oldScrollTop = scrollTop; + const scrollDiff = e.detail.scrollHeight - this.oldScrollTop; + !this.isIos && this._checkScrolledToBottom(scrollDiff); + }, + //检测scrollView是否要铺满屏幕 + _doCheckScrollViewShouldFullHeight(totalData) { + if (this.autoFullHeight && this.usePageScroll && this.isTotalChangeFromAddData) { + // #ifndef APP-NVUE + this.$nextTick(() => { + this._checkScrollViewShouldFullHeight((scrollViewNode, pagingContainerNode) => { + this._preCheckShowNoMoreInside(totalData, scrollViewNode, pagingContainerNode) + }); + }) + // #endif + // #ifdef APP-NVUE + this._preCheckShowNoMoreInside(totalData) + // #endif + } else { + this._preCheckShowNoMoreInside(totalData) + } + }, + //检测z-paging是否要全屏覆盖(当使用页面滚动并且不满全屏时,默认z-paging需要铺满全屏,避免数据过少时内部的empty-view无法正确展示) + async _checkScrollViewShouldFullHeight(callback) { + try { + const scrollViewNode = await this._getNodeClientRect('.zp-scroll-view'); + const pagingContainerNode = await this._getNodeClientRect('.zp-paging-container-content'); + if (!scrollViewNode || !pagingContainerNode) return; + const scrollViewHeight = pagingContainerNode[0].height; + const scrollViewTop = scrollViewNode[0].top; + if (this.isAddedData && scrollViewHeight + scrollViewTop <= this.windowHeight) { + this._setAutoHeight(true, scrollViewNode); + callback(scrollViewNode, pagingContainerNode); + } else { + this._setAutoHeight(false); + callback(null, null); + } + } catch (e) { + callback(null, null); + } + }, + //scrollTop改变时触发 + _scrollTopChange(newVal, isPageScrollTop){ + this.$emit('scrollTopChange', newVal); + this.$emit('update:scrollTop', newVal); + this._checkShouldShowBackToTop(newVal); + const scrollTop = this.isIos ? (newVal > 5 ? 6 : 0) : (newVal > 105 ? 106 : (newVal > 5 ? 6 : 0)); + if (isPageScrollTop && this.wxsPageScrollTop !== scrollTop) { + this.wxsPageScrollTop = scrollTop; + } else if (!isPageScrollTop && this.wxsScrollTop !== scrollTop) { + this.wxsScrollTop = scrollTop; + if (scrollTop > 6) { + this.scrollEnable = true; + } + } + }, + //更新使用页面滚动时slot="top"或"bottom"插入view的高度 + _updatePageScrollTopOrBottomHeight(type) { + // #ifndef APP-NVUE + if (!this.usePageScroll) return; + // #endif + this._doCheckScrollViewShouldFullHeight(this.realTotalData); + const node = `.zp-page-${type}`; + const marginText = `margin${type.slice(0,1).toUpperCase() + type.slice(1)}`; + let safeAreaInsetBottomAdd = this.safeAreaInsetBottom; + this.$nextTick(() => { + let delayTime = 0; + // #ifdef MP-BAIDU || APP-NVUE + delayTime = 50; + // #endif + u.delay(() => { + this._getNodeClientRect(node).then((res) => { + if (res) { + let pageScrollNodeHeight = res[0].height; + if (type === 'bottom') { + if (safeAreaInsetBottomAdd) { + pageScrollNodeHeight += this.safeAreaBottom; + } + } else { + this.cacheTopHeight = pageScrollNodeHeight; + } + this.$set(this.scrollViewStyle, marginText, `${pageScrollNodeHeight}px`); + } else if (safeAreaInsetBottomAdd) { + this.$set(this.scrollViewStyle, marginText, `${this.safeAreaBottom}px`); + } + }); + }, delayTime) + }) + }, + } +} diff --git a/uni_modules/z-paging/components/z-paging/js/modules/virtual-list.js b/uni_modules/z-paging/components/z-paging/js/modules/virtual-list.js new file mode 100644 index 0000000..dd55127 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/modules/virtual-list.js @@ -0,0 +1,461 @@ +// [z-paging]虚拟列表模块 +import u from '.././z-paging-utils' +import c from '.././z-paging-constant' +import Enum from '.././z-paging-enum' + +export default { + props: { + //是否使用虚拟列表,默认为否 + useVirtualList: { + type: Boolean, + default: u.gc('useVirtualList', false) + }, + //在使用虚拟列表时,是否使用兼容模式,默认为否 + useCompatibilityMode: { + type: Boolean, + default: u.gc('useCompatibilityMode', false) + }, + //使用兼容模式时传递的附加数据 + extraData: { + type: Object, + default: function() { + return u.gc('extraData', {}); + } + }, + //是否在z-paging内部循环渲染列表(内置列表),默认为否。若use-virtual-list为true,则此项恒为true + useInnerList: { + type: Boolean, + default: u.gc('useInnerList', false) + }, + //强制关闭inner-list,默认为false,如果为true将强制关闭innerList,适用于开启了虚拟列表后需要强制关闭inner-list的情况 + forceCloseInnerList: { + type: Boolean, + default: u.gc('forceCloseInnerList', false) + }, + //内置列表cell的key名称,仅nvue有效,在nvue中开启use-inner-list时必须填此项 + cellKeyName: { + type: String, + default: u.gc('cellKeyName', '') + }, + //innerList样式 + innerListStyle: { + type: Object, + default: function() { + return u.gc('innerListStyle', {}); + } + }, + //innerCell样式 + innerCellStyle: { + type: Object, + default: function() { + return u.gc('innerCellStyle', {}); + } + }, + //预加载的列表可视范围(列表高度)页数,默认为12,即预加载当前页及上下各12页的cell。此数值越大,则虚拟列表中加载的dom越多,内存消耗越大(会维持在一个稳定值),但增加预加载页面数量可缓解快速滚动短暂白屏问题 + preloadPage: { + type: [Number, String], + default: u.gc('preloadPage', 12), + validator: (value) => { + if (value <= 0) u.consoleErr('preload-page必须大于0!'); + return value > 0; + } + }, + //虚拟列表cell高度模式,默认为fixed,也就是每个cell高度完全相同,将以第一个cell高度为准进行计算。可选值【dynamic】,即代表高度是动态非固定的,【dynamic】性能低于【fixed】。 + cellHeightMode: { + type: String, + default: u.gc('cellHeightMode', Enum.CellHeightMode.Fixed) + }, + //虚拟列表列数,默认为1。常用于每行有多列的情况,例如每行有2列数据,需要将此值设置为2 + virtualListCol: { + type: [Number, String], + default: u.gc('virtualListCol', 1) + }, + //虚拟列表scroll取样帧率,默认为80,过低容易出现白屏问题,过高容易出现卡顿问题 + virtualScrollFps: { + type: [Number, String], + default: u.gc('virtualScrollFps', 80) + }, + }, + data() { + return { + virtualListKey: u.getInstanceId(), + virtualPageHeight: 0, + virtualCellHeight: 0, + virtualScrollTimeStamp: 0, + + virtualList: [], + virtualPlaceholderTopHeight: 0, + virtualPlaceholderBottomHeight: 0, + virtualTopRangeIndex: 0, + virtualBottomRangeIndex: 0, + lastVirtualTopRangeIndex: 0, + lastVirtualBottomRangeIndex: 0, + virtualItemInsertedCount: 0, + + virtualHeightCacheList: [], + + getCellHeightRetryCount: { + fixed: 0, + dynamic: 0 + }, + pagingOrgTop: -1, + updateVirtualListFromDataChange: false + } + }, + watch: { + realTotalData(newVal) { + // #ifndef APP-NVUE + if (this.finalUseVirtualList) { + this.updateVirtualListFromDataChange = true; + this.$nextTick(() => { + this.getCellHeightRetryCount.fixed = 0; + !newVal.length && this._resetDynamicListState(!this.isUserPullDown); + newVal.length && this.cellHeightMode === Enum.CellHeightMode.Fixed && this.isFirstPage && this._updateFixedCellHeight(); + this._updateVirtualScroll(this.oldScrollTop); + }) + } + // #endif + }, + virtualList(newVal){ + this.$emit('update:virtualList', newVal); + this.$emit('virtualListChange', newVal); + } + }, + computed: { + virtualCellIndexKey() { + return c.listCellIndexKey; + }, + finalUseVirtualList() { + if (this.useVirtualList && this.usePageScroll){ + u.consoleErr('使用页面滚动时,开启虚拟列表无效!'); + } + return this.useVirtualList && !this.usePageScroll; + }, + finalUseInnerList() { + return this.useInnerList || (this.finalUseVirtualList && !this.forceCloseInnerList); + }, + finalCellKeyName() { + // #ifdef APP-NVUE + if (this.finalUseVirtualList && !this.cellKeyName.length){ + u.consoleErr('在nvue中开启use-virtual-list必须设置cell-key-name,否则将可能导致列表渲染错误!'); + } + // #endif + return this.cellKeyName; + }, + finalVirtualPageHeight(){ + return this.virtualPageHeight > 0 ? this.virtualPageHeight : this.windowHeight; + }, + virtualRangePageHeight(){ + return this.finalVirtualPageHeight * this.preloadPage; + }, + virtualScrollDisTimeStamp() { + return 1000 / this.virtualScrollFps; + }, + }, + methods: { + //在使用动态高度虚拟列表时,若在列表数组中需要插入某个item,需要调用此方法;item:需要插入的item,index:插入的cell位置,若index为2,则插入的item在原list的index=1之后,index从0开始 + doInsertVirtualListItem(item, index) { + if (this.cellHeightMode !== Enum.CellHeightMode.Dynamic) return; + this.virtualItemInsertedCount ++; + if (!item || Object.prototype.toString.call(item) !== '[object Object]') { + item = { item }; + } + const cellIndexKey = this.virtualCellIndexKey; + item[cellIndexKey] = `custom-${this.virtualItemInsertedCount}`; + item[c.listCellIndexUniqueKey] = `${this.virtualListKey}-${item[cellIndexKey]}`; + this.totalData.splice(index, 0, item); + this.$nextTick(async () => { + let retryCount = 0; + while (retryCount <= 10) { + await u.wait(c.delayTime); + + const cellNode = await this._getNodeClientRect(`#zp-id-${item[cellIndexKey]}`, this.finalUseInnerList); + if (!cellNode) { + retryCount ++; + continue; + } + + const currentHeight = cellNode ? cellNode[0].height : 0; + const lastHeightCache = this.virtualHeightCacheList[index - 1]; + const lastTotalHeight = lastHeightCache ? lastHeightCache.totalHeight : 0; + this.virtualHeightCacheList.splice(index, 0, { + height: currentHeight, + lastTotalHeight, + totalHeight: lastTotalHeight + currentHeight + }); + + for (let i = index + 1; i < this.virtualHeightCacheList.length; i++) { + const thisNode = this.virtualHeightCacheList[i]; + thisNode.lastTotalHeight += currentHeight; + thisNode.totalHeight += currentHeight; + } + + this._updateVirtualScroll(this.oldScrollTop); + break; + } + }) + }, + //在使用动态高度虚拟列表时,手动更新指定cell的缓存高度(当cell高度在初始化之后再次改变时调用);index:需要更新的cell在列表中的位置,从0开始 + didUpdateVirtualListCell(index) { + if (this.cellHeightMode !== Enum.CellHeightMode.Dynamic) return; + const currentNode = this.virtualHeightCacheList[index]; + this.$nextTick(() => { + this._getNodeClientRect(`#zp-id-${index}`, this.finalUseInnerList).then(cellNode => { + const cellNodeHeight = cellNode ? cellNode[0].height : 0; + const heightDis = cellNodeHeight - currentNode.height; + currentNode.height = cellNodeHeight; + currentNode.totalHeight = currentNode.lastTotalHeight + cellNodeHeight; + + for (let i = index + 1; i < this.virtualHeightCacheList.length; i++) { + const thisNode = this.virtualHeightCacheList[i]; + thisNode.totalHeight += heightDis; + thisNode.lastTotalHeight += heightDis; + } + }); + }) + }, + //在使用动态高度虚拟列表时,若删除了列表数组中的某个item,需要调用此方法以更新高度缓存数组;index:删除的cell在列表中的位置,从0开始 + didDeleteVirtualListCell(index) { + if (this.cellHeightMode !== Enum.CellHeightMode.Dynamic) return; + const currentNode = this.virtualHeightCacheList[index]; + for (let i = index + 1; i < this.virtualHeightCacheList.length; i++) { + const thisNode = this.virtualHeightCacheList[i]; + thisNode.totalHeight -= currentNode.height; + thisNode.lastTotalHeight -= currentNode.height; + } + this.virtualHeightCacheList.splice(index, 1); + }, + //初始化虚拟列表 + _virtualListInit() { + this.$nextTick(() => { + u.delay(() => { + this._getNodeClientRect('.zp-scroll-view').then(node => { + if (node) { + this.pagingOrgTop = node[0].top; + this.virtualPageHeight = node[0].height; + } + }); + }); + }) + }, + //cellHeightMode为fixed时获取第一个cell高度 + _updateFixedCellHeight() { + this.$nextTick(() => { + u.delay(() => { + this._getNodeClientRect(`#zp-id-${0}`,this.finalUseInnerList).then(cellNode => { + if (!cellNode) { + if (this.getCellHeightRetryCount.fixed > 10) return; + this.getCellHeightRetryCount.fixed ++; + this._updateFixedCellHeight(); + } else { + this.virtualCellHeight = cellNode[0].height; + this._updateVirtualScroll(this.oldScrollTop); + } + }); + }, c.delayTime, 'updateFixedCellHeightDelay'); + }) + }, + //cellHeightMode为dynamic时获取每个cell高度 + _updateDynamicCellHeight(list, dataFrom = 'bottom') { + const dataFromTop = dataFrom === 'top'; + const heightCacheList = this.virtualHeightCacheList; + const currentCacheList = dataFromTop ? [] : heightCacheList; + let listTotalHeight = 0; + this.$nextTick(() => { + u.delay(async () => { + for (let i = 0; i < list.length; i++) { + const cellNode = await this._getNodeClientRect(`#zp-id-${list[i][this.virtualCellIndexKey]}`, this.finalUseInnerList); + const currentHeight = cellNode ? cellNode[0].height : 0; + if (!cellNode) { + if (this.getCellHeightRetryCount.dynamic <= 10) { + heightCacheList.splice(heightCacheList.length - i, i); + this.getCellHeightRetryCount.dynamic ++; + this._updateDynamicCellHeight(list, dataFrom); + } + return; + } + const lastHeightCache = currentCacheList.length ? currentCacheList.slice(-1)[0] : null; + const lastTotalHeight = lastHeightCache ? lastHeightCache.totalHeight : 0; + currentCacheList.push({ + height: currentHeight, + lastTotalHeight, + totalHeight: lastTotalHeight + currentHeight + }); + if (dataFromTop) { + listTotalHeight += currentHeight; + } + } + if (dataFromTop && list.length) { + for (let i = 0; i < heightCacheList.length; i++) { + const heightCacheItem = heightCacheList[i]; + heightCacheItem.lastTotalHeight += listTotalHeight; + heightCacheItem.totalHeight += listTotalHeight; + } + this.virtualHeightCacheList = currentCacheList.concat(heightCacheList); + } + this._updateVirtualScroll(this.oldScrollTop); + }, c.delayTime, 'updateDynamicCellHeightDelay') + }) + }, + //设置cellItem的index + _setCellIndex(list, dataFrom = 'bottom') { + let currentItemIndex = 0; + const cellIndexKey = this.virtualCellIndexKey; + if (this.totalData.length) { + if (dataFrom === 'bottom') { + currentItemIndex = this.realTotalData.length; + const lastItem = this.realTotalData.length ? this.realTotalData.slice(-1)[0] : null; + if (lastItem && lastItem[cellIndexKey] !== undefined) { + currentItemIndex = lastItem[cellIndexKey] + 1; + } + } else if (dataFrom === 'top') { + const firstItem = this.realTotalData.length ? this.realTotalData[0] : null; + if (firstItem && firstItem[cellIndexKey] !== undefined) { + currentItemIndex = firstItem[cellIndexKey] - list.length; + } + } + } else { + this._resetDynamicListState(); + } + for (let i = 0; i < list.length; i++) { + let item = list[i]; + if (!item || Object.prototype.toString.call(item) !== '[object Object]') { + item = { item }; + } + item[cellIndexKey] = currentItemIndex + i; + item[c.listCellIndexUniqueKey] = `${this.virtualListKey}-${item[cellIndexKey]}`; + list[i] = item; + } + this.getCellHeightRetryCount.dynamic = 0; + this.cellHeightMode === Enum.CellHeightMode.Dynamic && this._updateDynamicCellHeight(list, dataFrom); + }, + //更新scroll滚动 + _updateVirtualScroll(scrollTop, scrollDiff = 0) { + const currentTimeStamp = u.getTime(); + scrollTop === 0 && this._resetTopRange(); + if (scrollTop !== 0 && this.virtualScrollTimeStamp && currentTimeStamp - this.virtualScrollTimeStamp <= this.virtualScrollDisTimeStamp) { + return; + } + this.virtualScrollTimeStamp = currentTimeStamp; + + let scrollIndex = 0; + const cellHeightMode = this.cellHeightMode; + if (cellHeightMode === Enum.CellHeightMode.Fixed) { + scrollIndex = parseInt(scrollTop / this.virtualCellHeight) || 0; + this._updateFixedTopRangeIndex(scrollIndex); + this._updateFixedBottomRangeIndex(scrollIndex); + } else if(cellHeightMode === Enum.CellHeightMode.Dynamic) { + const scrollDirection = scrollDiff > 0 ? 'top' : 'bottom'; + const rangePageHeight = this.virtualRangePageHeight; + const topRangePageOffset = scrollTop - rangePageHeight; + const bottomRangePageOffset = scrollTop + this.finalVirtualPageHeight + rangePageHeight; + + let virtualBottomRangeIndex = 0; + let virtualPlaceholderBottomHeight = 0; + let reachedLimitBottom = false; + const heightCacheList = this.virtualHeightCacheList; + const lastHeightCache = !!heightCacheList ? heightCacheList.slice(-1)[0] : null; + + let startTopRangeIndex = this.virtualTopRangeIndex; + if (scrollDirection === 'bottom') { + for (let i = startTopRangeIndex; i < heightCacheList.length; i++){ + const heightCacheItem = heightCacheList[i]; + if (heightCacheItem && heightCacheItem.totalHeight > topRangePageOffset) { + this.virtualTopRangeIndex = i; + this.virtualPlaceholderTopHeight = heightCacheItem.lastTotalHeight; + break; + } + } + } else { + let topRangeMatched = false; + for (let i = startTopRangeIndex; i >= 0; i--){ + const heightCacheItem = heightCacheList[i]; + if (heightCacheItem && heightCacheItem.totalHeight < topRangePageOffset) { + this.virtualTopRangeIndex = i; + this.virtualPlaceholderTopHeight = heightCacheItem.lastTotalHeight; + topRangeMatched = true; + break; + } + } + !topRangeMatched && this._resetTopRange(); + } + for (let i = this.virtualTopRangeIndex; i < heightCacheList.length; i++){ + const heightCacheItem = heightCacheList[i]; + if (heightCacheItem && heightCacheItem.totalHeight > bottomRangePageOffset) { + virtualBottomRangeIndex = i; + virtualPlaceholderBottomHeight = lastHeightCache.totalHeight - heightCacheItem.totalHeight; + reachedLimitBottom = true; + break; + } + } + if (!reachedLimitBottom || this.virtualBottomRangeIndex === 0) { + this.virtualBottomRangeIndex = this.realTotalData.length ? this.realTotalData.length - 1 : this.pageSize; + this.virtualPlaceholderBottomHeight = 0; + } else { + this.virtualBottomRangeIndex = virtualBottomRangeIndex; + this.virtualPlaceholderBottomHeight = virtualPlaceholderBottomHeight; + } + this._updateVirtualList(); + } + }, + //更新fixedCell模式下topRangeIndex&placeholderTopHeight + _updateFixedTopRangeIndex(scrollIndex) { + let virtualTopRangeIndex = this.virtualCellHeight === 0 ? 0 : scrollIndex - (parseInt(this.finalVirtualPageHeight / this.virtualCellHeight) || 1) * this.preloadPage; + virtualTopRangeIndex *= this.virtualListCol; + virtualTopRangeIndex = Math.max(0, virtualTopRangeIndex); + this.virtualTopRangeIndex = virtualTopRangeIndex; + this.virtualPlaceholderTopHeight = (virtualTopRangeIndex / this.virtualListCol) * this.virtualCellHeight; + }, + //更新fixedCell模式下bottomRangeIndex&placeholderBottomHeight + _updateFixedBottomRangeIndex(scrollIndex) { + let virtualBottomRangeIndex = this.virtualCellHeight === 0 ? this.pageSize : scrollIndex + (parseInt(this.finalVirtualPageHeight / this.virtualCellHeight) || 1) * (this.preloadPage + 1); + virtualBottomRangeIndex *= this.virtualListCol; + virtualBottomRangeIndex = Math.min(this.realTotalData.length, virtualBottomRangeIndex); + this.virtualBottomRangeIndex = virtualBottomRangeIndex; + this.virtualPlaceholderBottomHeight = (this.realTotalData.length - virtualBottomRangeIndex) * this.virtualCellHeight / this.virtualListCol; + this._updateVirtualList(); + }, + //更新virtualList + _updateVirtualList() { + const shouldUpdateList = this.updateVirtualListFromDataChange || (this.lastVirtualTopRangeIndex !== this.virtualTopRangeIndex || this.lastVirtualBottomRangeIndex !== this.virtualBottomRangeIndex); + if (shouldUpdateList) { + this.updateVirtualListFromDataChange = false; + this.lastVirtualTopRangeIndex = this.virtualTopRangeIndex; + this.lastVirtualBottomRangeIndex = this.virtualBottomRangeIndex; + this.virtualList = this.realTotalData.slice(this.virtualTopRangeIndex, this.virtualBottomRangeIndex + 1); + } + }, + //重置动态cell模式下的高度缓存数据、虚拟列表和滚动状态 + _resetDynamicListState(resetVirtualList = false) { + this.virtualHeightCacheList = []; + if (resetVirtualList) { + this.virtualList = []; + } + this.virtualTopRangeIndex = 0; + this.virtualPlaceholderTopHeight = 0; + }, + //重置topRangeIndex和placeholderTopHeight + _resetTopRange() { + this.virtualTopRangeIndex = 0; + this.virtualPlaceholderTopHeight = 0; + this._updateVirtualList(); + }, + //检测虚拟列表当前滚动位置,如发现滚动位置不正确则重新计算虚拟列表相关参数(为解决在App中可能出现的长时间进入后台后打开App白屏的问题) + _checkVirtualListScroll() { + if (this.finalUseVirtualList) { + this.$nextTick(() => { + this._getNodeClientRect('.zp-paging-touch-view').then(node => { + const currentTop = node ? node[0].top : 0; + if (!node || (currentTop === this.pagingOrgTop && this.virtualPlaceholderTopHeight !== 0)) { + this._updateVirtualScroll(0); + } + }); + }) + } + }, + //处理使用内置列表时点击了cell事件 + _innerCellClick(item, index) { + this.$emit('innerCellClick', item, index); + } + } +} diff --git a/uni_modules/z-paging/components/z-paging/js/z-paging-config.js b/uni_modules/z-paging/components/z-paging/js/z-paging-config.js new file mode 100644 index 0000000..c7b714e --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/z-paging-config.js @@ -0,0 +1,21 @@ +// [z-paging]处理main.js中的配置信息工具 + +let config = null; +let getedStorage = false; +const storageKey = 'Z-PAGING-CONFIG-STORAGE-KEY' + +function setConfig(value) { + uni.setStorageSync(storageKey, value); +} + +function getConfig() { + if (getedStorage) return config; + config = uni.getStorageSync(storageKey); + getedStorage = true; + return config; +} + +export default { + setConfig, + getConfig +}; diff --git a/uni_modules/z-paging/components/z-paging/js/z-paging-constant.js b/uni_modules/z-paging/components/z-paging/js/z-paging-constant.js new file mode 100644 index 0000000..93e8518 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/z-paging-constant.js @@ -0,0 +1,12 @@ +// [z-paging]常量 + +export default { + version: '2.6.2', + delayTime: 100, + errorUpdateKey: 'z-paging-error-emit', + completeUpdateKey: 'z-paging-complete-emit', + cachePrefixKey: 'z-paging-cache', + + listCellIndexKey: 'zp_index', + listCellIndexUniqueKey: 'zp_unique_index' +} diff --git a/uni_modules/z-paging/components/z-paging/js/z-paging-enum.js b/uni_modules/z-paging/components/z-paging/js/z-paging-enum.js new file mode 100644 index 0000000..17ad63a --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/z-paging-enum.js @@ -0,0 +1,44 @@ +// [z-paging]枚举 + +export default { + //当前加载类型 0.下拉刷新 1.上拉加载更多 + LoadingType: { + Refresher: 0, + LoadingMore: 1 + }, + //下拉刷新状态 0.默认状态 1.松手立即刷新 2.刷新中 3.刷新结束 + Refresher: { + Default: 0, + ReleaseToRefresh: 1, + Loading: 2, + Complete: 3 + }, + //底部加载更多状态 0.默认状态 1.加载中 2.没有更多数据 3.加载失败 + More: { + Default: 0, + Loading: 1, + NoMore: 2, + Fail: 3 + }, + //@query触发来源 0.用户主动下拉刷新 1.通过reload触发 2.通过refresh触发 3.通过滚动到底部加载更多或点击底部加载更多触发 + QueryFrom: { + UserPullDown: 0, + Reload: 1, + Refresh: 2, + LoadingMore: 3 + }, + //虚拟列表cell高度模式 + CellHeightMode: { + //固定高度 + Fixed: 'fixed', + //动态高度 + Dynamic: 'dynamic' + }, + //列表缓存模式 + CacheMode: { + //默认模式,只会缓存一次 + Default: 'default', + //总是缓存,每次列表刷新(下拉刷新、调用reload等)都会更新缓存 + Always: 'always' + } +} \ No newline at end of file diff --git a/uni_modules/z-paging/components/z-paging/js/z-paging-interceptor.js b/uni_modules/z-paging/components/z-paging/js/z-paging-interceptor.js new file mode 100644 index 0000000..d0e9b2b --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/z-paging-interceptor.js @@ -0,0 +1,48 @@ +// [z-paging]拦截器 + +//拦截&处理@query事件 +function handleQuery(callback) { + try { + setTimeout(function() { + _getApp().globalData.zp_handleQueryCallback = callback; + }, 1); + } catch (e) {} +} + +//拦截&处理@query事件(私有,请勿调用) +function _handleQuery(pageNo, pageSize, from, lastItem){ + const callback = _getApp().globalData.zp_handleQueryCallback; + return callback ? callback(pageNo, pageSize, from, lastItem) : [pageNo, pageSize, from]; +} + +//拦截&处理系统language转i18n local +function handleLanguage2Local(callback) { + try { + setTimeout(function() { + _getApp().globalData.zp_handleLanguage2LocalCallback = callback; + }, 1); + } catch (e) {} +} + +//拦截&处理系统language转i18n local(私有,请勿调用) +function _handleLanguage2Local(language, local){ + const callback = _getApp().globalData.zp_handleLanguage2LocalCallback; + return callback ? callback(language, local) : local; +} + +//获取当前app对象 +function _getApp(){ + // #ifndef APP-NVUE + return getApp(); + // #endif + // #ifdef APP-NVUE + return getApp({ allowDefault: true }); + // #endif +} + +export default { + handleQuery, + _handleQuery, + handleLanguage2Local, + _handleLanguage2Local +}; diff --git a/uni_modules/z-paging/components/z-paging/js/z-paging-main.js b/uni_modules/z-paging/components/z-paging/js/z-paging-main.js new file mode 100644 index 0000000..6812252 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/z-paging-main.js @@ -0,0 +1,447 @@ +// [z-paging]核心js + +import zStatic from './z-paging-static' +import c from './z-paging-constant' +import u from './z-paging-utils' + +import zPagingRefresh from '../components/z-paging-refresh' +import zPagingLoadMore from '../components/z-paging-load-more' +import zPagingEmptyView from '../../z-paging-empty-view/z-paging-empty-view' + +// modules +import commonLayoutModule from './modules/common-layout' +import dataHandleModule from './modules/data-handle' +import i18nModule from './modules/i18n' +import nvueModule from './modules/nvue' +import emptyModule from './modules/empty' +import refresherModule from './modules/refresher' +import loadMoreModule from './modules/load-more' +import loadingModule from './modules/loading' +import scrollerModule from './modules/scroller' +import backToTopModule from './modules/back-to-top' +import virtualListModule from './modules/virtual-list' + +import Enum from './z-paging-enum' + +const systemInfo = uni.getSystemInfoSync(); + +export default { + name: "z-paging", + components: { + zPagingRefresh, + zPagingLoadMore, + zPagingEmptyView + }, + mixins: [ + commonLayoutModule, + dataHandleModule, + i18nModule, + nvueModule, + emptyModule, + refresherModule, + loadMoreModule, + loadingModule, + scrollerModule, + backToTopModule, + virtualListModule + ], + data() { + return { + //--------------静态资源--------------- + base64Arrow: zStatic.base64Arrow, + base64Flower: zStatic.base64Flower, + base64BackToTop: zStatic.base64BackToTop, + + //-------------全局数据相关-------------- + //当前加载类型 + loadingType: Enum.LoadingType.Refresher, + requestTimeStamp: 0, + chatRecordLoadingMoreText: '', + wxsPropType: '', + renderPropScrollTop: -1, + checkScrolledToBottomTimeOut: null, + cacheTopHeight: -1, + statusBarHeight: systemInfo.statusBarHeight, + + //--------------状态&判断--------------- + insideOfPaging: -1, + isLoadFailed: false, + isIos: systemInfo.platform === 'ios', + disabledBounce: false, + fromCompleteEmit: false, + disabledCompleteEmit: false, + pageLaunched: false, + + //---------------wxs相关--------------- + wxsIsScrollTopInTopRange: true, + wxsScrollTop: 0, + wxsPageScrollTop: 0, + wxsOnPullingDown: false, + }; + }, + props: { + //调用complete后延迟处理的时间,单位为毫秒,默认0毫秒,优先级高于minDelay + delay: { + type: [Number, String], + default: u.gc('delay', 0), + }, + //触发@query后最小延迟处理的时间,单位为毫秒,默认0毫秒,优先级低于delay(假设设置为300毫秒,若分页请求时间小于300毫秒,则在调用complete后延迟[300毫秒-请求时长];若请求时长大于300毫秒,则不延迟),当show-refresher-when-reload为true或reload(true)时,其最小值为400 + minDelay: { + type: [Number, String], + default: u.gc('minDelay', 0), + }, + //设置z-paging的style,部分平台(如微信小程序)无法直接修改组件的style,可使用此属性代替 + pagingStyle: { + type: Object, + default: function() { + return u.gc('pagingStyle', {}); + }, + }, + //z-paging的高度,优先级低于pagingStyle中设置的height;传字符串,如100px、100rpx、100% + height: { + type: String, + default: u.gc('height', '') + }, + //z-paging的宽度,优先级低于pagingStyle中设置的width;传字符串,如100px、100rpx、100% + width: { + type: String, + default: u.gc('width', '') + }, + //z-paging的背景色,优先级低于pagingStyle中设置的background。传字符串,如"#ffffff" + bgColor: { + type: String, + default: u.gc('bgColor', '') + }, + //设置z-paging的容器(插槽的父view)的style + pagingContentStyle: { + type: Object, + default: function() { + return u.gc('pagingContentStyle', {}); + }, + }, + //z-paging是否自动高度,若自动高度则会自动铺满屏幕 + autoHeight: { + type: Boolean, + default: u.gc('autoHeight', false) + }, + //z-paging是否自动高度时,附加的高度,注意添加单位px或rpx,若需要减少高度,则传负数 + autoHeightAddition: { + type: [Number, String], + default: u.gc('autoHeightAddition', '0px') + }, + //loading(下拉刷新、上拉加载更多)的主题样式,支持black,white,默认black + defaultThemeStyle: { + type: String, + default: u.gc('defaultThemeStyle', 'black') + }, + //z-paging是否使用fixed布局,若使用fixed布局,则z-paging的父view无需固定高度,z-paging高度默认为100%,默认为是(当使用内置scroll-view滚动时有效) + fixed: { + type: Boolean, + default: u.gc('fixed', true) + }, + //是否开启底部安全区域适配 + safeAreaInsetBottom: { + type: Boolean, + default: u.gc('safeAreaInsetBottom', false) + }, + //开启底部安全区域适配后,是否使用placeholder形式实现,默认为否。为否时滚动区域会自动避开底部安全区域,也就是所有滚动内容都不会挡住底部安全区域,若设置为是,则滚动时滚动内容会挡住底部安全区域,但是当滚动到底部时才会避开底部安全区域 + useSafeAreaPlaceholder: { + type: Boolean, + default: u.gc('useSafeAreaPlaceholder', false) + }, + //slot="top"的view的z-index,默认为99,仅使用页面滚动时有效 + topZIndex: { + type: Number, + default: u.gc('topZIndex', 99) + }, + //z-paging内容容器父view的z-index,默认为1 + superContentZIndex: { + type: Number, + default: u.gc('superContentZIndex', 1) + }, + //z-paging内容容器部分的z-index,默认为10 + contentZIndex: { + type: Number, + default: u.gc('contentZIndex', 10) + }, + //使用页面滚动时,是否在不满屏时自动填充满屏幕,默认为是 + autoFullHeight: { + type: Boolean, + default: u.gc('autoFullHeight', true) + }, + //是否监听列表触摸方向改变,默认为否 + watchTouchDirectionChange: { + type: Boolean, + default: u.gc('watchTouchDirectionChange', false) + }, + }, + created(){ + if (this.createdReload && !this.refresherOnly && this.auto) { + this._startLoading(); + this.$nextTick(this._preReload); + } + }, + mounted() { + this.wxsPropType = u.getTime().toString(); + this.renderJsIgnore; + if (!this.createdReload && !this.refresherOnly && this.auto) { + this.$nextTick(this._preReload); + } + this.finalUseCache && this._setListByLocalCache(); + let delay = 0; + // #ifdef H5 || MP + delay = c.delayTime; + // #endif + this.$nextTick(() => { + this.systemInfo = uni.getSystemInfoSync(); + !this.usePageScroll && this.autoHeight && this._setAutoHeight(); + this.loaded = true; + }) + this.updatePageScrollTopHeight(); + this.updatePageScrollBottomHeight(); + this.updateLeftAndRightWidth(); + if (this.finalRefresherEnabled && this.useCustomRefresher) { + this.$nextTick(() => { + this.isTouchmoving = true; + }) + } + this._onEmit(); + // #ifdef APP-NVUE + if (!this.isIos && !this.useChatRecordMode) { + this.nLoadingMoreFixedHeight = true; + } + this._nUpdateRefresherWidth(); + // #endif + // #ifndef APP-NVUE + this.finalUseVirtualList && this._virtualListInit(); + // #endif + // #ifndef APP-PLUS + this.$nextTick(() => { + setTimeout(() => { + this._getCssSafeAreaInsetBottom(() => this.safeAreaInsetBottom && this.updatePageScrollBottomHeight()); + }, delay) + }) + // #endif + }, + destroyed() { + this._offEmit(); + }, + // #ifdef VUE3 + unmounted() { + this._offEmit(); + }, + // #endif + watch: { + defaultThemeStyle: { + handler(newVal) { + if (newVal.length) { + this.finalRefresherDefaultStyle = newVal; + } + }, + immediate: true + }, + autoHeight(newVal) { + this.loaded && !this.usePageScroll && this._setAutoHeight(newVal); + }, + autoHeightAddition(newVal) { + this.loaded && !this.usePageScroll && this.autoHeight && this._setAutoHeight(newVal); + }, + }, + computed: { + finalPagingStyle() { + const pagingStyle = this.pagingStyle; + if (!this.systemInfo) return pagingStyle; + const { windowTop, windowBottom } = this; + if (!this.usePageScroll && this.fixed) { + if (windowTop && !pagingStyle.top) { + pagingStyle.top = windowTop + 'px'; + } + if (windowBottom && !pagingStyle.bottom) { + pagingStyle.bottom = windowBottom + 'px'; + } + } + if (this.bgColor.length && !pagingStyle['background']) { + pagingStyle['background'] = this.bgColor; + } + if (this.height.length && !pagingStyle['height']) { + pagingStyle['height'] = this.height; + } + if (this.width.length && !pagingStyle['width']) { + pagingStyle['width'] = this.width; + } + return pagingStyle; + }, + finalLowerThreshold() { + return u.convertToPx(this.lowerThreshold); + }, + finalPagingContentStyle() { + if (this.contentZIndex != 1) { + this.pagingContentStyle['z-index'] = this.contentZIndex; + this.pagingContentStyle['position'] = 'relative'; + } + return this.pagingContentStyle; + }, + renderJsIgnore() { + if ((this.usePageScroll && this.useChatRecordMode) || !this.refresherEnabled || !this.useCustomRefresher) { + this.$nextTick(() => { + this.renderPropScrollTop = 10; + }) + } + return 0; + }, + windowHeight() { + if (!this.systemInfo) return 0; + return this.systemInfo.windowHeight || 0; + }, + windowBottom() { + if (!this.systemInfo) return 0; + let windowBottom = this.systemInfo.windowBottom || 0; + if (this.safeAreaInsetBottom && !this.useSafeAreaPlaceholder) { + windowBottom += this.safeAreaBottom; + } + return windowBottom; + }, + isIosAndH5() { + // #ifndef H5 + return false; + // #endif + return this.isIos; + } + }, + methods: { + //当前版本号 + getVersion() { + return `z-paging v${c.version}`; + }, + //设置nvue List的specialEffects + setSpecialEffects(args) { + this.setListSpecialEffects(args); + }, + //与setSpecialEffects等效,兼容旧版本 + setListSpecialEffects(args) { + this.nFixFreezing = args && Object.keys(args).length; + if (this.isIos) { + this.privateRefresherEnabled = 0; + } + !this.usePageScroll && this.$refs['zp-n-list'].setSpecialEffects(args); + }, + // #ifdef APP-VUE + //当app长时间进入后台后进入前台,因系统内存管理导致app重新加载时,进行一些适配处理 + _handlePageLaunch() { + // 首次触发不进行处理,只有进入后台后打开app重新加载时才处理 + if (this.pageLaunched) { + // 解决在vue3+ios中,app ReLaunch时顶部下拉刷新展示位置向下偏移的问题 + // #ifdef VUE3 + this.refresherThresholdUpdateTag = 1; + this.$nextTick(() => { + this.refresherThresholdUpdateTag = 0; + }) + // #endif + // 解决使用虚拟列表时,app ReLaunch时白屏问题 + this._checkVirtualListScroll(); + } + this.pageLaunched = true; + }, + // #endif + //使手机发生较短时间的振动(15ms) + _doVibrateShort() { + // #ifndef H5 + + // #ifdef APP-PLUS + if (this.isIos) { + const UISelectionFeedbackGenerator = plus.ios.importClass('UISelectionFeedbackGenerator'); + const feedbackGenerator = new UISelectionFeedbackGenerator(); + feedbackGenerator.init(); + setTimeout(() => { + feedbackGenerator.selectionChanged(); + }, 0) + } else { + plus.device.vibrate(15); + } + // #endif + // #ifndef APP-PLUS + uni.vibrateShort(); + // #endif + + // #endif + }, + //设置z-paging高度 + async _setAutoHeight(shouldFullHeight = true, scrollViewNode = null) { + let heightKey = 'min-height'; + // #ifndef APP-NVUE + heightKey = 'min-height'; + // #endif + try { + if (shouldFullHeight) { + let finalScrollViewNode = scrollViewNode || await this._getNodeClientRect('.zp-scroll-view'); + let finalScrollBottomNode = await this._getNodeClientRect('.zp-page-bottom'); + if (finalScrollViewNode) { + const scrollViewTop = finalScrollViewNode[0].top; + let scrollViewHeight = this.windowHeight - scrollViewTop; + scrollViewHeight -= finalScrollBottomNode ? finalScrollBottomNode[0].height : 0; + const additionHeight = u.convertToPx(this.autoHeightAddition); + const finalHeight = scrollViewHeight + additionHeight - (this.insideMore ? 1 : 0) + 'px !important'; + this.$set(this.scrollViewStyle, heightKey, finalHeight); + this.$set(this.scrollViewInStyle, heightKey, finalHeight); + } + } else { + this.$delete(this.scrollViewStyle, heightKey); + this.$delete(this.scrollViewInStyle, heightKey); + } + } catch (e) {} + }, + //触发更新是否超出页面状态 + _updateInsideOfPaging() { + this.insideMore && this.insideOfPaging === true && setTimeout(this.doLoadMore, 200) + }, + //清除timeout + _cleanTimeout(timeout) { + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + return timeout; + }, + //添加全局emit监听 + _onEmit() { + uni.$on(c.errorUpdateKey, () => { + this.loading && this.complete(false).catch(() => {}); + }) + uni.$on(c.completeUpdateKey, (data) => { + setTimeout(() => { + if (this.loading) { + if (!this.disabledCompleteEmit) { + const type = data.type || 'normal'; + const list = data.list || data; + const rule = data.rule; + this.fromCompleteEmit = true; + switch (type){ + case 'normal': + this.complete(list); + break; + case 'total': + this.completeByTotal(list, rule); + break; + case 'nomore': + this.completeByNoMore(list, rule); + break; + case 'key': + this.completeByKey(list, rule); + break; + default: + break; + } + } else { + this.disabledCompleteEmit = false; + } + } + }, 1); + }) + }, + //销毁全局emit和listener监听 + _offEmit(){ + uni.$off(c.errorUpdateKey); + uni.$off(c.completeUpdateKey); + } + }, +}; diff --git a/uni_modules/z-paging/components/z-paging/js/z-paging-mixin.js b/uni_modules/z-paging/components/z-paging/js/z-paging-mixin.js new file mode 100644 index 0000000..9d09caf --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/z-paging-mixin.js @@ -0,0 +1,22 @@ +// [z-paging]使用页面滚动时引入此mixin,用于监听和处理onPullDownRefresh等页面生命周期方法 + +export default { + onPullDownRefresh() { + if (this.isPagingRefNotFound()) return; + this.$refs.paging.reload().catch(() => {}); + }, + onPageScroll(e) { + if (this.isPagingRefNotFound()) return; + this.$refs.paging.updatePageScrollTop(e.scrollTop); + e.scrollTop < 10 && this.$refs.paging.doChatRecordLoadMore(); + }, + onReachBottom() { + if (this.isPagingRefNotFound()) return; + this.$refs.paging.pageReachBottom(); + }, + methods: { + isPagingRefNotFound() { + return !this.$refs.paging; + } + } +} diff --git a/uni_modules/z-paging/components/z-paging/js/z-paging-static.js b/uni_modules/z-paging/components/z-paging/js/z-paging-static.js new file mode 100644 index 0000000..05f80d5 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/z-paging-static.js @@ -0,0 +1,13 @@ +// [z-paging]公用的静态图片资源 + +export default { + base64Arrow: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkBAMAAACCzIhnAAAAD1BMVEVHcExRUVFMTExRUVFRUVE9CdWsAAAABHRSTlMAjjrY9ZnUjwAAAQFJREFUWMPt2MsNgzAMgGEEE1B1gKJmAIRYoCH7z9RCXrabh33iYktcIv35EEg5ZBh07pvxJU6MFSPOSRnjnBUjUsaciRUjMsb4xIoRCWNiYsUInzE5sWKEyxiYWDbyefqHx1zIeiYTk7mQYziTYecxHvEJjwmIT3hMQELCYSISEg4TkZj0mYTEpM8kJCU9JiMp6TEZyUmbAUhO2gxAQNJiIAKSFgMRmNQZhMCkziAEJTUGIyipMRjBSZkhCE7KDEFIUmTeGCHJxWz0zXaE0GTCG8ZFtEaS347r/1fe11YyHYVfubxayfjoHmc0YYwmmmiiiSaaaKLJ7ckyz5ve+dw3Xw2emdwm9xSbAAAAAElFTkSuQmCC', + base64ArrowWhite: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkBAMAAACCzIhnAAAAElBMVEVHcEz///////////////////+IGTx/AAAABnRSTlMA/dAkXZOhASU/AAABYElEQVRYw+2YwXLCIBCGsdAHWGbyAKZ4zxi9O017rxLf/1UaWFAgA1m8dcpedNSPf/l/Vh0Ya/Wn6hN0JcGvoCqRM4C8VBFiDwBqqNuJKV0rAnCgy3AUqZE57x0iqTL8Br4U3WBf/YWaIlTKfAcELU/h9w72CSVPa3C3OCDvhpHbRp/s2vq4fHhCeiCl2A3m4Qd71DQR257mFBlMcTlbFnFWzNtHxewYEfSiaLS4el8d8nyhmKJd1CF4eOS0keLMAuSxubLBIeIGQW8YHCFFo7EH9+YDcQt9FMZEswTheaNxTHwHT8SZorJjMrEVwo4Zo0U8HSEyZvJMOg4RjnmmRr8nDYeIz3OMkbfE/QhBo+U9RnZJxjGCRh/WKmHEMWLNkfPKsGh/CWJk1JjG0kcuJggTt34VDP8aWAFhp4nybVb5+9qQhjSkIQ1pSEMa8k+Q5U9rV3dF8MpFBK+/7miVq1/HZ2qmo9D+pAAAAABJRU5ErkJggg==', + base64Flower: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkBAMAAACCzIhnAAAAKlBMVEVHcEzDw8Ovr6+pqamUlJTCwsKenp61tbWxsbGysrLNzc2bm5u5ubmjo6MpovhuAAAACnRSTlMA/P79/sHDhiZS0DxZowAABBBJREFUWMPtl89rE0EUx7ctTXatB3MI1SWnDbUKPUgXqh4ED8Uf7KUVSm3ooVSpSii0Fn/gD4j4o+APiEoVmos9FO2celiqZVgwgaKHPQiCCkv+F99kM7Ozm5kxq1dfD91k9pPve9/3ZjbRNHHok/mKli4eIPNgSuRObuN9SqSEzM20iGnm0yIbqCuV7NSSSIV7uyPM6JMBYdeTOanh/QihJYZsUCSby+VkMj2AvOt0rAeQAwqE3lfKMZVlQCZk1QOCKkkVPadITCfIRNKxfoJI5+0OIFtJx14CMSg1mRSDko7VAfksRQzEbGYqxOJcVTWMCH2I1/IACNW0PWU2M8cmAVHtnH5mM1VRWtwKZjOd5JbF6s1IbaYqaotjNlPHgDAnlAizubTR6ovMYn052g/U5qcmOpi0WL8xTS/3IfSet5m8MEr5ajjF5le6dq/OJpobrdY0t3i9QgefWrxW9/1BLhk0E9m8FeUMhhXal499iD0eQRfDF+ts/tttORRerfp+oV7f4xJj82iUYm1Yzod+ZQEAlS/8mMBwKebVmCVp1f0JLS6zKd17+iwRKTARVg2SHtz3iEbBH+Q+U28zW2Jiza8Tjb1YFoYZMsJyjDqp3M9XBQdSdPLFdxEpvOB37JrHcmR/y9+LgoTlCFGZEa2sc6d4PGlweEa2JSVPoVm+IfGG3ZL037iV9oH+P+Jxc4HGVflNq1M0pivao/EopO4b/ojVCP9GjmiXOeS0DOn1o/iiccT4ORnyvBGF3yUywkQajW4Ti0SGuiy/wVSg/L8w+X/8Q+hvUx8Xd90z4oV5a1i88MbFWHz0WZZ1UrTwBGPX3Rat9AFiXRMRjoMdIdJLEOt2h7jrYOzgOamKZSWSNspOS0X8SAqRYmxRL7sg4eLzYmNehcxh3uoyud/BH2Udux4ywxFTc1xC7Mgf4vMhc5S+kSH3Y7yj+qpwIWSoPTVCOOPVthGx9FbGqrwFw6wSFxJr+17zeKcztt3u+2roAEVgUjDd+AHGuxHy2rZHaa8JMkTHEeyi85ANPO9j9BVuBRD2FY5LDMo/Sz/2hReqGIs/KiFin+CsPsYO/yvM3jL2vE8EbX7/Bf8ejtr2GLN65bioAdgLd8Bis/mD5GmP2qeqyo2ZwQEOtAjRIDH7mBKpUcMoApbZJ5UIxkEwxyMZyMxW/uKFvHCFR3SSmerHyDNQ2dF4JG6zIMpBgLfjSF9x1D6smFcYnGApjmSLICO3ecCDWrQ48geba9DI3STy2i7ax6WIB62fSyIZIiO3GFQqSURp8wCo7GhJBGwuSovJBNjb7kT6FPVnIa9qJ2Ko+l9mefGIdinaMp0yC1URYiwsdfNE45EuA5Cx9EhalfvN5s+UyItm81vaB3p4joniN+SCP7Qc1hblAAAAAElFTkSuQmCC', + base64FlowerWhite: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkBAMAAACCzIhnAAAAElBMVEX///9HcEz///////////////84chYNAAAABnRSTlP/AGzCOYZj5g1nAAACfklEQVRYw+2YTVPDIBCGtza9Jw25a0bvcax30o73OOr//yvma2F3YWlpPTijXNpAHrK8LLALVPFium2vNIFSbwGKTGQA2GUiHcD29yDNy3sMIdUBQl7r2H8mOEVqAHgPkYZUS6Qc2zYhQqtjyDZEximCZwWZLIBeIgYShs2NzxKpSUehYpMJhURGb+O+w5BpMCAREKPnCDHbIY20SzhM5yxziAXpOiBXydrekT9i5XDEq4NIIHHgyU5mRGqviII4mREJJA4QJzMiILwlRJzpKxJKvCBm8OsBBbLux0tsPl4RKYm5aPu6jw1U4mGxEUR9g8M1PcqBEp/WJliNgYOXueBzS4jZSIcgY5lCtevgDSgyzE+rAfuOTQMq0yzvoGH18qju27Mayzs4fPyMziCx81NJa5RNfW7vPYK9KOfDiVkBxFHG8hAj9txuoBuSWORsFfkpBf7xKFLSeaOefEojh5jz22DJEqMP8fUyaKdQx+RnG+yXMpe8Aars8ueR1pVH/bW3FyyvPRw90upLDHwpgBDtg4aUBNkxRLXMAi03IhcZtr1m+FeI/O/JNyDmmL1djLOauSlNflBpW18RQ2bPqXI22MXXEk75KRHTnkPkYbESbdKP2ZFk0r5sIwffAjy1lx+vx7NLjB6/E7Jfv5ERKhzpN0w8IDE8IGFDv5dhz10s7GFiXRZcUeLCEG5P5nDq9k4PFDcoMpE3GY4OuxuCXhmuyNB6k0RsLIAvqp9NE5r8ZCSS8gxnUp7ODdYhZTqxuiJ9uyJJtPmpqJ7wVj+XVieS903iViHziqAhchLEJAyb7jWU647EpUofQ0ziUuXXXhDddtlllSwjgSQu7r4BRWhQqfDPMVwAAAAASUVORK5CYII=', + base64Success: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkBAMAAACCzIhnAAAAElBMVEVRUVFHcExTU1NRUVFRUVFRUVFOSlSUAAAABnRSTlP/AI6+VySB3ZENAAACcElEQVRYw+2YyYKCMAyGI8hdpdxdZu7gcpdZ7jL6/s8yYheSNi0aPdqbwOffpGmaFOYPD3gj4bisN7vddv17N/JVgxn5x12IWgIaWTuO/IE3PseQbwjGPo2cgRmHFLJwdm/X643zwiqOKPPJ1nj3sjEP2iiifZWj5bhopSyGaEO2HX5fbQJzwJ+W7x/jw5ZFjsEU0PMph9xE8i5EqprKALW95eJQURkgzw98uJ/JvwGecR7bIjWWsUgVrrIfFZ2HlLy3sKETD1mmRLRMRhGVssRa0xJkdn3SpJBymBkM8+pSSDXMDNyDaToVHd2fgpNt0sjwiUZO19+jGQ+gQEg9Oq+bufmAVGihomNmjQG7UG3020vrlm7lkFnKFGU3kZ0KGAdmKe821pipQ+qEKcrZeTL2g5FsUks4cStjEZWwXg0b0n4GxmEpkWwIs5VBynjgK7xZaz1/0D7OxkVuLpsY5BQNFyLS84VBjjbg0iL2r2EQHBOxBhikuUOkdxODVF1cxHoWtPPsiyXO455Iv34hssCO8EV4ZIYTjS8SR4qYSHRiTiYQ4ZFbHi0iIhhBTi6dTCgSWRcnw4h4yGTuyTAiOGBIWGoZTgSHJQl+LcOJ4OCnW6yX2bMnJ9pidCOXtkTkTrIGpYuOynAiOF14SamMiOCk5Ke+mq8BcOrrvym8d0zKIQnWT+M1WwOQNO4fFiWb18hhERxJPx2fblbPHHyC41VyiAtKBUFBIih7JMWVoIQTFIr3lKPN80WvoLSWFPC653ioTZA0I0FrQ7qU6asaK0H7JmkSJa2ooOGVtNUsc3j9FYHkIkJy3SG6VHnfXKXGP9t4N9Q4Ye98AAAAAElFTkSuQmCC', + base64SuccessWhite: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkBAMAAACCzIhnAAAAGFBMVEVHcEz///////////////////////////8dS1W+AAAAB3RSTlMAiVYk6KvDHLfaegAAAo1JREFUWMPtWEtzmzAQNhCTq910ytXpiyvxTNOr60zrayepx9d02gnX4sTm7xcEiJX2gdnkGJ1A4tOnfWqXyeR1vMRYzrcPD9v5h5MBl3/Ldvx4cxIg/FWC8X0xjLjalM54uhhCfCrRuJURX0pi3EmIqZV7O59vrRZmguStHL9b7S7ftfLwOtiZDw7AHMtmquAQ12b5Wwbnordm8g9zLLO49qc/m2n6aKnhwPOGZ08hAiNHhheiHae1lOUPGZpQkPKa3q0mOUjaRzSRaGUjpy/mmWSwySSpllcEteBKAT52KEnSbblA51pJEPxBQoiH1FP4E3s5+FJv07h6/ylD6ui7B+9fq/ehrFB98ghec9EoVtyjK8pqCHLmCBOwMWSCeWFNN4MbPAk55NhsvoFHSSVR0k5TCTTEzlUGcqV/nVp7n9oIVkmtaqbAEqEgfdgHJPwsEAyZ9r4VAZXFjpEwyaw3+H2v42KYxKhs1XvY/gSSGv+IHyUSuHXCeZhLAgVI3EjgSGo1Fb3xO0tGGU9S2/KAIbtjxpJASG73qox6w5LUq0cEOa+iIONIWIilQSQ0pPa2jgaRQAgQP7c0mITRWGxpMAmEQFN2NAQJNCV0mI6GIIEO47hlQ0ORQLd0nL+hoUjg1m6I1TRr8uYEAriBHLcVFQ5UEMiBe3XkTBEG04WXlGKGxPnMS305XQPA1Ocn2JiuAZwE66fxnKwBnDTuXxZTMq85lwW6kt5ndLqZPefiU1yvmktcUSooChJF2aMprhQlnKJQ5FxRKkcVRa+itNYU8Io2oVkY14w0NMWYlqft91Bj9VHq+ca3b43BxjWJmla0sfKohlfTVpPN+93L/yLQ/IjQ/O5Q/VR5HdL4D7mlxmjwVdELAAAAAElFTkSuQmCC', + base64Empty: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADIBAMAAABfdrOtAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAbUExURdvc3EdwTMLBwcjIyLSzs/Hx8ff39////19dXXz7IJEAAAAFdFJOU/4A6J9QDyyutAAAB5VJREFUeNrtnM1z4jYYxhUHkR4hdu9eU7Z75Ct7jgPbs9ZZmSuTrUWPmXTA186e+LMrf0uWLMtf2WkHXQgzln88et5XeiVMwPQdGrhCrpAr5Aq5Qv4TkJ07OGQFMLp1B4VYCz+kDblDQhJGeH4eEDLBYdLOHwaDWNBPIeHLYJAJ3meQ83IoCMTHDBKOBoKYGOeM8G0gyD0LObnDQB5ZSCtTNCBfsM9AboaBPLCQcDAIM1zht/dQEkMsd1DjI4hpw2YzMtBJeBbydWpCTJs3YDKGX62YgfGoVwi9KwtZJAzcYHHRm7sYCKD390nQSIoO5JGZIEOYxNoZ4+deISYLyeL5hLHbJ2QK98W0kudMgJe9Qh73odhO+KZHyNYGvgQS9gmJKhUigwSj3iBPUhXxePWmxBqHw0Mej9WQ3qILVjLC177yxNxXQ/7uK+Mn1aNVLsGsBTaWrSAPobYl0aUHt2fIs2Rgz7c9QYL0pSTkSzILLFtAJMH1cidN998T9E0/Sg73/pEEwrgkYRh86wlC949gJsR6EobBcz8hHOVgKYi2m6kZtodIkjEQvF3QjbGpmplB4/lRgJhxgRS2N15iijAvPmByDtCxfQhPJ8J4CR82rgCCBILarScw6X0OcMUyYrFVmbxErl0ZacFIoloOLdJAO42qY+NMDss2kKS8xmiZxcCpFKXWvpRGbQqJp5ixyRfJMmR6x0Fk+z29kmgWDYI5ziFbdug/84HxvduhWhLOJ2StPDQrMJPSjNANklh8QhB7dBO0yTGRwn1fkOk8rbQjiB8Ymww+JuiuN0icmSccK4naLMWYa/euL0+m23GyM8kgAc6sYeL4z04Qa4WjGepcKIliO8EUGSk7d9OGWOsoK31OSdy8TQZ59Y/hWbaV1IVs5/Ed6UzGK4nANAJiyGhRsZPUg2yzLe9hLyiJIyCaDU7udC2uy9pnkKvidlBUEltzFAqxRhBrBZm7HfZnjEQI3boqTsJq15PUDEaKZLgiJYc8OZtCtnM/4G93OFYooXpvdy0guwWWNQkEHl/j7Jw1XRmtlS9HYJkSPjk1IUnyyRqUKQn45NSDlP1mcg9i6En1ZU2IADnEtHF1Q+JwIcS/d5YakPuDUamEShGUHHikAz9oQCaE0CsrpYjDBVkEHQYdyK+EkKPhVErxqh1xbJ/oQf4gEeVsOIEc41WJNAwcd9GBfCZJezXsJhAvH+ImEEIOzlwXgpw5wQ0gH3MIOcsiQAahZuSD69/UQyxcQEggiQARQseVFO/ASAMCgM9gjkHZmhLENzi1AOhA7ullkMWUrfHKfpMiDBHtDIx6yCS6jseEnDUe7zcT6DGCtnrIY3olZw1hrPHkfucIAJa1EDu/lsVEyVmGGA67coKijeogFnMxlEaAV5ghRdDm1kDuuatZTJBGgJdOthIzsvZbDWRRuh6ScgR4EQLgagQvRQIxxQ4sxqcR4GE+c4CkjZQQW9YF89Y4OFAjOCki5KmiDxsBL3PlSJWlAFVogaoIePlYi2ClCJAHRa/cmre5eqTii4uvisqQJxqnip6pNd68DhEvyEs5xIyHBNdh4thCKhU++10kD7Gy1Up1A/o56FKuRJQWSFCuf8dpbisxhqHSKlSSgvG7VTaFKO5TzYD5VMPUxEB2YJNiqq3xYJ0KrroH8mq7xpoXqEZgfgNRUQsDtTVvUOk3sLUKbqrBr7YGvkCkQNC/9SA+vTYtvERrxiKEmcogk4ZqCLUd59MIEiFYHlIoxelCaJWDMmtOPIa80XVLbkb6hzaEwwTcPEmV4AIRlBGNIEmuJBFwLAZoHClJ36J8h+wxihpCqJosAnJrSKwEcQOFAFeWN4RQMYc0Ao4Jhg5gpASzyWcDvjpuDIlTkrGGJEro1rHIjHKR3wJCAj+z5oyi11gJBkXy9QFJIiAu78d+pgSjuWhGN0gUAZAcEncSJf4LRrZ8I94WEmcNCJJqBWYjVbE9bg2JxiyrViBWty6QvO56D8jPVWLA4ZX8dfkxvJJPl8t8aCX+pU/Iz1SCf7lc4OBK0OWfQaKLP0TKjj96VvIp+/BDZjwNKF2ItV2vN7sWStAl87oWkm3dZ+k3lEMoYXe8cT1eq2TOePJDD8KfQdxu6iEPxanUZa4HmZRq3dunGsj3BzFq6yD3wnZNX4n2emI2hXyXQpi6RRZdfSgxHNuxVZBFdyVeBPDmCsiksxKUiDAUEKuzkvRUEs0V08pjVyU2/yqFmF2VZGYop3peitdUiQd1pnrL7qTE01tPzE6eaEKm23dQwh2jNlbiay+/245zl94abw45CzNPyqYQ2++kxHGV1crWzg4A2yvR+BY7wziwnRLN7+O36aA54+ZKGjxZYK3txJpxQyUNn5GwtquII4+ACiWtnvawduu1A3SVtH5uhTvAVSpBG7fDYz6RQ+M6JWjmKm6g+RvTla9UMtspu+s+37VbVCupNqPx43CsNawSb1PbtcmDfQWmUILW7rRXSPHtSq5k5ur0a/hb7DQCUiW3G71ejX/wvV1kSoyNbp8Wvyqn1lCIKvl6gNDkNBYzt0GHdr+Pt9xGl1//ncAVcoVcIVfIFXKFXCFXyP8I8i8SyTW4yTz2lwAAAABJRU5ErkJggg==', + base64Error: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADIBAMAAABfdrOtAAAAJFBMVEVHcEzo6Oibm5ukpKSbm5uampqbm5ubm5u5ubnn5+fm5ub6+vpGpDPdAAAAC3RSTlMA/v4hb+u20dq8aQhnHL4AAATwSURBVHja7ZvNb+JGGMbdjjdVe3NPodzeMhj1ZMUGujkh28B9wKR7iwwBqafWSbPqsbm0uTWtVlrTS9v0Et9yqLQS/1zHNiTZMMB4bO92d+dRUITt8c/PvPPx2h4URUpKSkpKSkpK6m3K6lFN73Q+S/+es3W3fzabTh2Dl0FAXEM+BgrgeXxRsdILTDU9n7J0vz/+EsCYC9KEiSFc06pf5zouqAkjkGWo0OG5Fq6j2IwZ6I4/4DhyTxc20oUjAj5PRTTrwvGAZ9p+ADzlD4RDctCoLhb7JUP87xeLxS3BZUIQ+YNCFi8wRwc4GIqGRK/GkM+5ILV8kFflOmkkkH/LddJ4c05eSSfSyTvrZPEmnCw+UCeuk84QvTSnUF0uCL68fBle/swF+RL1QZ/EpU6gHtOsAM64pnjPwxgTLsjoBM58ODNaAXYBT5QeGdr0KwcEA8He0TkPBLCjUDNHpG4qlg8eTCzXht1FVd1MxTPHj5LTtUiSrKK+7iDf8wBGxk4If3arLv/HF4Tox0A2nlFIGp+CIA+LzSamgbp4TNvZjECtDAjyMcB5HybLO6NxsRA1vmFCNjguNXDGWygbRPXh/B+zn9zPWK5RCkT18QxA57YgAqE+HGS6/tAoD4JO0ts+M2tbyQJpc95a5oI0xXNhCZGQ/x8E0VSCkUZY6Z6CIE/qdO5eL+yPlW6tMMgefPs3o7Bdt8iguJj4DThlZSY/rJ0yB+RraLDK2jAQCHyr4zIhT9mQ7vowygMZjpgQG+CYUV2E1EWqixyzICr8eFFnBB5ba1Y4IIfeKQvysW7ssZrwQLEFmvCBM2U6oRkdI5Wgm1QnO8RUTDlASoiESIiESMh7BDHKhlhu/LbSNUuEqL3lu1p945vO3BArADiaum7vBGDUKQfSIjBykooyrRPQnTIglHFfSagHeqd4iErwa9duEebpckGQjx/VT4v5fC0XhJHAd1mPRvJAVMZiAeQzTpgHYrPKqkGnUEiX+dCoNS4UgniHMTnUS4iESIiE7IS0x+mnVAidglDwVcmQJpy2WQ8VC4UgogfbA1RE4Nuw3UghEBV2rKl7V5ygAJPSY9KGQbP01mVjA5Fa2f1kQN2U3k+M9POWB8gnJUNMZJioWTMzKwOklyxgDrCXVcMMEF90tXM9C2TiCqmfCdIRi/jeewNpyerKok9WkGuzfCdYC+fXRsmBxxpVGG2zY0ZBbieJKvPrDQce3lxppBhIjGFWGkVoxUEoZt0Mukn2XBQH0bTHZpaMIp2sU/6qasU70W6/eHjM09VmYSc6C6Jpvz+orKvVxot8kL3HkMr9IZ9qeZ2o6RrO9mOI9ufdIR9peZ2gNIW31yC/MpyI9ngUDNIsezPks3vIsWDGdYA7cZa9pbqUVeCr/neiaR3U3R4BfXPg75vwb8I/b7HjxChobDZCO+Ny4wuxxaVxPPowcoNnrzPmzGFlX3RJHz2FafbhJ41n8PLx2DCM7KkwQgpqka1DVzKdJNHfJwBe9l/n0eSZFsIPjVSY8xZKZpSXnogwled98wAx3xRcdBNq1f1fhFVdIcL5tvaDolC7XaqaWStEtLOJHkbhlSauMLrma4yHEa03AVUoIUs/M2NQFkchBZiGUPeKonAnqhLOo4hrKf0WTyZ1FcU0Ki0hVrSr+Mucnvya7jYUKSkpKSkpKSmpD0f/AXq+Umj5XnXDAAAAAElFTkSuQmCC', + base64BackToTop: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADIBAMAAABfdrOtAAAAElBMVEVRUVH+/v5HcEyZmZlRUVFRUVGm1ByOAAAABnRSTlPMzADMTZAJBBGsAAAEnElEQVR42t2cS27jMAyGf7/2U+QCQeDsbeQCgZDujaC5/1UmkzaJn+JDFGcw3LdfflKibJkkDnxrL7dbg7sNt6+L4O8OYBM+B0ys+QrGkHZG+OEEQ8g6go8Bx1GIGMdpNOQyIG6XdMgnSPtKhLQDGEZFBgYMkhKFtGBb0EIEjDgFRowoBVaMGAWpMedEfxMiZtwpUsgZCqtlkCNUdpVAWigtCCCDFtLwIWeoreZCWiRYYEKGFEjDg+yRZCUH0iLRAgNyToXUNCRZyMqWhGnUN2IPm3wSlwJ7IUspyCBkIQUZhCykIIeQuRTkEDKXAuM9srrtYbrZN7Y98giZSoFd+t1OxmMITG0dcrSFXFchZ1tIvQZpYWxhBbK3hpQrkMEa0iwh5t4a+QvZvDXyF7J5a+Qv5PPW21/I5623v5DPW29/IaO3Xv5Clrw1y1/Ikrdm+Qs5svw83yNnSJ5BQb4F/F7EIEJSnThGBAXxkFQfLOviQUE8JAUPsosHBfGQfDAtHhREQ1JxIV00KIgmrnRI84S0yAd5BAXxxJUck0f6Qnwr9qmr6xF5xLMjcwn/iudIEAdWnyjkEXlQKZiRVzoqRyLbgeUKKR8Q4alY7cSnoxzSf2ggsqehKr6YVpcXpOd7H93f60cKhOd7Re2LteUF4eLqiVS1mr0ge4io6C2+soaFkJ7MuuuQs1yITEp9hwwKISIpzR2iESKSIoT0rLNwuVHQqoSIpAQJpGce60vIUSdEIuUqgPTsJ5QFZK8UIpBS8iG94GFrDjlrhfCl8CG96Llxmle4kEr6vKWBPIVo9kqDQSRk9/3cWoikcCFPAd33v4dIChPyEvLzBA6RlEYWke4JEUnhKXkLeUEKxRHJFfKCQHGucIW8IdZSRkLeEGMpYyEjiK2UsZARxFTKRMgYYillImQMMZQyFTKB2EmZCplAuFLIHT8TMoWwpQwiIVMIUwqpZP5bp5CCvCTiQKr5f5lCQN+tPCBn2ZvVDFJwIDUP0m1BYAfZYRNSsCB7BqTbhoARePIxtZ9tgwWkoJcwCalmv3MBAemtO4R6dah2HaKQqj8Zvp9sQDjvJ21+SPCBHPJDDk6QITekEV7gqCC19CpKAym9IMfckKv4olMBCeIrWwVEfvkshzQekO9r9P1/ALk+IG1eSPCDiCJfyG+FyU+A6ZCa/piZDinpz7LpkCv5gdkAEshP5emQhv7onw6pGeULyZCSUYiRDAmMkpJkCKs4JhFSq8p8hJBSVbAkhARV6ZUQoisik0FqXTmcDHLVFfbJIEFXoiiCNMpiSxGkVJaNiiBBWQArgTTaUl4JpNQWJUsgQVteXQg+AKkLxQWFGKW+5J2+eVp4S168X3CF1CltCKdTJ8lb84YK2bUBO+wZW0Pqv9nk4tKu49N45NJC5dMM5tLW5tOg59Jq6NM06dL+abFXwr/RkuvTXJwae1abtE/Dt0/ruksTvs84AZ/BCC4jHnyGVfiM3VBQFANEXEah+Ax18RlP4zNox2dkkM/wI58xTn8yDCXGYCDV3W5RGSajtXyGhG1jbpbjzpwGt/0MJft8jqC7iUbQ/QZaxdnKqcIftwAAAABJRU5ErkJggg==', +} diff --git a/uni_modules/z-paging/components/z-paging/js/z-paging-utils.js b/uni_modules/z-paging/components/z-paging/js/z-paging-utils.js new file mode 100644 index 0000000..59e9bf6 --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/js/z-paging-utils.js @@ -0,0 +1,228 @@ +// [z-paging]工具类 + +import zConfig from './z-paging-config' +import zLocalConfig from '../config/index' +import c from './z-paging-constant' + +const storageKey = 'Z-PAGING-REFRESHER-TIME-STORAGE-KEY'; +let config = null; +const timeoutMap = {}; + +/* +当z-paging未使用uni_modules管理时,控制台会有警告:WARNING: Module not found: Error: Can't resolve '@/uni_modules/z-paging'... +此时注释下方try中的代码即可 +*/ +// #ifdef VUE2 +try { + const contextKeys = require.context('@/uni_modules/z-paging', false, /\z-paging-config$/).keys(); + if (contextKeys.length) { + const suffix = '.js'; + config = require('@/uni_modules/z-paging/z-paging-config' + suffix); + } +} catch (e) {} +// #endif + +//获取默认配置信息 +function gc(key, defaultValue) { + if (!config) { + if (zLocalConfig && Object.keys(zLocalConfig).length) { + config = zLocalConfig; + } else { + const tempConfig = zConfig.getConfig(); + if (zConfig && tempConfig) { + config = tempConfig; + } + } + } + if (!config) return defaultValue; + const value = config[_toKebab(key)]; + return value === undefined ? defaultValue : value; +} + + +//获取最终的touch位置 +function getTouch(e) { + let touch = null; + if (e.touches && e.touches.length) { + touch = e.touches[0]; + } else if (e.changedTouches && e.changedTouches.length) { + touch = e.changedTouches[0]; + } else if (e.datail && e.datail != {}) { + touch = e.datail; + } else { + return { + touchX: 0, + touchY: 0 + } + } + return { + touchX: touch.clientX, + touchY: touch.clientY + }; +} + +//判断当前手势是否在z-paging内触发 +function getTouchFromZPaging(target) { + if (target && target.tagName && target.tagName !== 'BODY' && target.tagName !== 'UNI-PAGE-BODY') { + const classList = target.classList; + if (classList && classList.contains('z-paging-content')) { + return { + isFromZp: true, + isPageScroll: classList.contains('z-paging-content-page'), + isReachedTop: classList.contains('z-paging-reached-top') + }; + } else { + return getTouchFromZPaging(target.parentNode); + } + } else { + return { isFromZp: false }; + } +} + +//获取z-paging所在的parent +function getParent(parent) { + if (!parent) return null; + if (parent.$refs.paging) return parent; + return getParent(parent.$parent); +} + +//打印错误信息 +function consoleErr(err) { + console.error(`[z-paging]${err}`); +} + +//延时操作,如果key存在,调用时根据key停止之前的延时操作 +function delay(callback, ms = c.delayTime, key) { + const timeout = setTimeout(callback, ms);; + if (!!key) { + timeoutMap[key] && clearTimeout(timeoutMap[key]); + timeoutMap[key] = timeout; + } + return timeout; +} + +//设置下拉刷新时间 +function setRefesrherTime(time, key) { + const datas = getRefesrherTime() || {}; + datas[key] = time; + uni.setStorageSync(storageKey, datas); +} + +//获取下拉刷新时间 +function getRefesrherTime() { + return uni.getStorageSync(storageKey); +} + +//通过下拉刷新标识key获取下拉刷新时间 +function getRefesrherTimeByKey(key) { + const datas = getRefesrherTime(); + return datas && datas[key] ? datas[key] : null; +} + +//通过下拉刷新标识key获取下拉刷新时间(格式化之后) +function getRefesrherFormatTimeByKey(key, textMap) { + const time = getRefesrherTimeByKey(key); + const timeText = time ? _timeFormat(time, textMap) : textMap.none; + return `${textMap.title}${timeText}`; +} + +//将文本的px或者rpx转为px的值 +function convertToPx(text) { + const dataType = Object.prototype.toString.call(text); + if (dataType === '[object Number]') return text; + let isRpx = false; + if (text.indexOf('rpx') !== -1 || text.indexOf('upx') !== -1) { + text = text.replace('rpx', '').replace('upx', ''); + isRpx = true; + } else if (text.indexOf('px') !== -1) { + text = text.replace('px', ''); + } + if (!isNaN(text)) { + if (isRpx) return Number(uni.upx2px(text)); + return Number(text); + } + return 0; +} + +//获取当前时间 +function getTime() { + return (new Date()).getTime(); +} + +//获取z-paging实例id +function getInstanceId() { + const s = []; + const hexDigits = "0123456789abcdef"; + for (let i = 0; i < 10; i++) { + s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); + } + return s.join('') + getTime(); +} + +// 等待一段时间 +function wait(ms) { + return new Promise(resolve => { + setTimeout(resolve, ms); + }); +} + +//------------------ 私有方法 ------------------------ +//时间格式化 +function _timeFormat(time, textMap) { + const date = new Date(time); + const currentDate = new Date(); + const dateDay = new Date(time).setHours(0, 0, 0, 0); + const currentDateDay = new Date().setHours(0, 0, 0, 0); + const disTime = dateDay - currentDateDay; + let dayStr = ''; + const timeStr = _dateTimeFormat(date); + if (disTime === 0) { + dayStr = textMap.today; + } else if (disTime === -86400000) { + dayStr = textMap.yesterday; + } else { + dayStr = _dateDayFormat(date, date.getFullYear() !== currentDate.getFullYear()); + } + return `${dayStr} ${timeStr}`; +} + +//date格式化为年月日 +function _dateDayFormat(date, showYear = true) { + const year = date.getFullYear(); + const month = date.getMonth() + 1; + const day = date.getDate(); + return showYear ? `${year}-${_fullZeroToTwo(month)}-${_fullZeroToTwo(day)}` : `${_fullZeroToTwo(month)}-${_fullZeroToTwo(day)}`; +} + +//data格式化为时分 +function _dateTimeFormat(date) { + const hour = date.getHours(); + const minute = date.getMinutes(); + return `${_fullZeroToTwo(hour)}:${_fullZeroToTwo(minute)}`; +} + +//不满2位在前面填充0 +function _fullZeroToTwo(str) { + str = str.toString(); + return str.length === 1 ? '0' + str : str; +} + +//驼峰转短横线 +function _toKebab(value) { + return value.replace(/([A-Z])/g, "-$1").toLowerCase(); +} + +export default { + gc, + setRefesrherTime, + getRefesrherFormatTimeByKey, + getTouch, + getTouchFromZPaging, + getParent, + convertToPx, + getTime, + getInstanceId, + consoleErr, + delay, + wait +}; diff --git a/uni_modules/z-paging/components/z-paging/wxs/z-paging-renderjs.js b/uni_modules/z-paging/components/z-paging/wxs/z-paging-renderjs.js new file mode 100644 index 0000000..9ecf76b --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/wxs/z-paging-renderjs.js @@ -0,0 +1,58 @@ +// [z-paging]使用renderjs在app-vue和h5中对touchmove事件冒泡进行处理 + +import u from '../js/z-paging-utils' +const data = { + startY: 0, + isTouchFromZPaging: false, + isUsePageScroll: false, + isReachedTop: true, + isIosAndH5: false, + appLaunched: false +} + +export default { + mounted() { + if (window) { + this._handleTouch(); + // #ifdef APP-VUE + this.$ownerInstance.callMethod('_handlePageLaunch'); + // #endif + } + }, + methods: { + //接收逻辑层发送的数据 + renderPropIsIosAndH5Change(newVal) { + if (newVal === -1) return; + data.isIosAndH5 = newVal; + }, + //拦截处理touch事件 + _handleTouch() { + if (!window.$zPagingRenderJsInited) { + window.$zPagingRenderJsInited = true; + window.addEventListener('touchstart', this._handleTouchstart, { passive: true }) + window.addEventListener('touchmove', this._handleTouchmove, { passive: false }) + } + }, + _handleTouchstart(e) { + const touch = u.getTouch(e); + data.startY = touch.touchY; + const touchResult = u.getTouchFromZPaging(e.target); + data.isTouchFromZPaging = touchResult.isFromZp; + data.isUsePageScroll = touchResult.isPageScroll; + data.isReachedTop = touchResult.isReachedTop; + }, + _handleTouchmove(e) { + const touch = u.getTouch(e); + const moveY = touch.touchY - data.startY; + if (data.isTouchFromZPaging && ((data.isReachedTop && moveY > 0) || (data.isIosAndH5 && !data.isUsePageScroll && moveY < 0))) { + if (e.cancelable && !e.defaultPrevented) { + e.preventDefault(); + } + } + }, + _removeAllEventListener(){ + window.removeEventListener('touchstart'); + window.removeEventListener('touchmove'); + } + } +}; diff --git a/uni_modules/z-paging/components/z-paging/wxs/z-paging-wxs.wxs b/uni_modules/z-paging/components/z-paging/wxs/z-paging-wxs.wxs new file mode 100644 index 0000000..4dbc64f --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/wxs/z-paging-wxs.wxs @@ -0,0 +1,340 @@ +// [z-paging]微信小程序、QQ小程序、app-vue、h5上使用wxs实现自定义下拉刷新,降低逻辑层与视图层的通信折损,提升性能 + +var currentDis = 0; +var isPCFlag = -1; +var startY = -1; + +function propObserver(newValue, oldValue, ownerIns, ins) { + var state = ownerIns.getState() || {}; + state.currentIns = ins; + var dataset = ins.getDataset(); + var loading = dataset.loading == true; + if (newValue && newValue.indexOf('end') != -1) { + var transition = newValue.split('end')[0]; + _setTransform('translateY(0px)', ins, false, transition); + state.moveDis = 0; + state.oldMoveDis = 0; + currentDis = 0; + } else if (newValue && newValue.indexOf('begin') != -1) { + var refresherThreshold = ins.getDataset().refresherthreshold; + _setTransformValue(refresherThreshold, ins, state, false); + } +} + +function touchstart(e, ownerIns) { + var ins = _getIns(ownerIns); + var state = {}; + var dataset = {}; + ownerIns.callMethod('_handleListTouchstart'); + if (ins) { + state = ins.getState(); + dataset = ins.getDataset(); + if (_touchDisabled(e, ins, 0)) return; + } + var isTouchEnded = state.isTouchEnded; + state.oldMoveDis = 0; + var touch = _getTouch(e); + var loading = _isTrue(dataset.loading); + state.startY = touch.touchY; + startY = state.startY; + state.lastTouch = touch; + if (!loading && isTouchEnded) { + state.isTouchmoving = false; + } + state.isTouchEnded = false; + ownerIns.callMethod('_handleRefresherTouchstart', touch); +} + +function touchmove(e, ownerIns) { + var touch = _getTouch(e); + var ins = _getIns(ownerIns); + var dataset = ins.getDataset(); + var refresherThreshold = dataset.refresherthreshold; + var isIos = _isTrue(dataset.isios); + var state = ins.getState(); + var watchTouchDirectionChange = _isTrue(dataset.watchtouchdirectionchange); + var moveDisObj = {}; + var moveDis = 0; + var prevent = false; + if (watchTouchDirectionChange) { + moveDisObj = _getMoveDis(e, ins); + moveDis = moveDisObj.currentDis; + prevent = moveDisObj.isDown; + var direction = prevent ? 'top' : 'bottom'; + if (prevent == state.oldTouchDirection && prevent != state.oldEmitedTouchDirection) { + ownerIns.callMethod('_handleTouchDirectionChange', { direction: direction }); + state.oldEmitedTouchDirection = prevent; + } + state.oldTouchDirection = prevent; + } + if (_touchDisabled(e, ins, 1)) { + _handlePullingDown(state, ownerIns, false); + return true; + } + if (!_getAngleIsInRange(e, touch, state, dataset)) { + _handlePullingDown(state, ownerIns, false); + return true; + } + moveDisObj = _getMoveDis(e, ins); + moveDis = moveDisObj.currentDis; + prevent = moveDisObj.isDown; + if (moveDis < 0) { + _setTransformValue(0, ins, state, false); + _handlePullingDown(state, ownerIns, false); + return true; + } + if (prevent && !state.disabledBounce) { + ownerIns.callMethod('_handleScrollViewDisableBounce', {bounce: false}); + state.disabledBounce = true; + _handlePullingDown(state, ownerIns, prevent); + return !prevent; + } + _setTransformValue(moveDis, ins, state, false); + var oldRefresherStatus = state.refresherStatus; + var oldIsTouchmoving = _isTrue(dataset.oldistouchmoving); + var hasTouchmove = _isTrue(dataset.hastouchmove); + var isTouchmoving = state.isTouchmoving; + state.refresherStatus = moveDis >= refresherThreshold ? 1 : 0; + if (!isTouchmoving) { + state.isTouchmoving = true; + isTouchmoving = true; + } + if (state.isTouchEnded) { + state.isTouchEnded = false; + } + if (hasTouchmove) { + ownerIns.callMethod('_handleWxsPullingDown', { moveDis:moveDis, diffDis:moveDisObj.diffDis }); + } + if (oldRefresherStatus == undefined || oldRefresherStatus != state.refresherStatus || oldIsTouchmoving != isTouchmoving) { + ownerIns.callMethod('_handleRefresherTouchmove', moveDis, touch); + } + _handlePullingDown(state, ownerIns, prevent); + return !prevent; +} + +function touchend(e, ownerIns) { + var touch = _getTouch(e); + var ins = _getIns(ownerIns); + var dataset = ins.getDataset(); + var state = ins.getState(); + if (_touchDisabled(e, ins, 2)) return; + state.reachMaxAngle = true; + state.hitReachMaxAngleCount = 0; + state.disabledBounce = false; + state.fixedIsTopHitCount = 0; + if (!state.isTouchmoving) return; + var oldRefresherStatus = state.refresherStatus; + var oldMoveDis = state.moveDis; + var refresherThreshold = ins.getDataset().refresherthreshold + var moveDis = _getMoveDis(e, ins).currentDis; + if (!(moveDis >= refresherThreshold && oldRefresherStatus === 1)) { + state.isTouchmoving = false; + } + ownerIns.callMethod('_handleRefresherTouchend', moveDis); + state.isTouchEnded = true; + if (oldMoveDis < refresherThreshold) return; + var animate = false; + if (moveDis >= refresherThreshold) { + moveDis = refresherThreshold; + animate = true; + } + _setTransformValue(moveDis, ins, state, animate); +} + +// #ifdef H5 +function isPC() { + if (!navigator) return false; + if (isPCFlag != -1) return isPCFlag; + var agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; + isPCFlag = agents.every(function(item) { return navigator.userAgent.indexOf(item) < 0 }); + return isPCFlag; +} + +var movable = false; + +function mousedown(e, ins) { + if (!isPC()) return; + touchstart(e, ins); + movable = true; +} + +function mousemove(e, ins) { + if (!isPC() || !movable) return; + touchmove(e, ins); +} + +function mouseup(e, ins) { + if (!isPC()) return; + touchend(e, ins); + movable = false; +} + +function mouseleave(e, ins) { + if (!isPC()) return; + movable = false; +} +// #endif + + +function _setTransformValue(value, ins, state, animate) { + value = value || 0; + if (state.moveDis == value) return; + state.moveDis = value; + _setTransform('translateY(' + value + 'px)', ins, animate, ''); +} + +function _setTransform(transform, ins, animate, transition) { + var dataset = ins.getDataset(); + if (_isTrue(dataset.refreshernotransform)) return; + transform = transform == 'translateY(0px)' ? 'none' : transform; + ins.requestAnimationFrame(function() { + var stl = { 'transform': transform }; + if (animate) { + stl['transition'] = 'transform .1s linear'; + } + if (transition.length) { + stl['transition'] = transition; + } + ins.setStyle(stl); + }) +} + +function _getMoveDis(e, ins) { + var state = ins.getState(); + var refresherThreshold = parseFloat(ins.getDataset().refresherthreshold); + var refresherOutRate = parseFloat(ins.getDataset().refresheroutrate); + var refresherPullRate = parseFloat(ins.getDataset().refresherpullrate); + var touch = _getTouch(e); + var currentStartY = !state.startY || state.startY == 'NaN' ? startY : state.startY; + var moveDis = touch.touchY - currentStartY; + var oldMoveDis = state.oldMoveDis || 0; + state.oldMoveDis = moveDis; + var diffDis = moveDis - oldMoveDis; + if (diffDis > 0) { + diffDis = diffDis * refresherPullRate; + if (currentDis > refresherThreshold) { + diffDis = diffDis * (1 - refresherOutRate); + } + } + diffDis = diffDis > 100 ? diffDis / 100 : (diffDis > 20 ? diffDis / 1.2 : diffDis); + currentDis += diffDis; + currentDis = Math.max(0, currentDis); + return { + currentDis: currentDis, + diffDis: diffDis, + isDown: diffDis > 0 + }; +} + +function _getTouch(e) { + var touch = e; + if (e.touches && e.touches.length) { + touch = e.touches[0]; + } else if (e.changedTouches && e.changedTouches.length) { + touch = e.changedTouches[0]; + } else if (e.datail && e.datail != {}) { + touch = e.datail; + } + return { + touchX: touch.clientX, + touchY: touch.clientY + }; +} + +function _getIns(ownerIns) { + var ins = ownerIns.getState().currentIns; + if (!ins) { + ownerIns.callMethod('_handlePropUpdate'); + } + return ins; +} + +function _touchDisabled(e, ins, processTag) { + var dataset = ins.getDataset(); + var state = ins.getState(); + var loading = _isTrue(dataset.loading); + var useChatRecordMode = _isTrue(dataset.usechatrecordmode); + var refresherEnabled = _isTrue(dataset.refresherenabled); + var useCustomRefresher = _isTrue(dataset.usecustomrefresher); + var usePageScroll = _isTrue(dataset.usepagescroll); + var pageScrollTop = parseFloat(dataset.pagescrolltop); + var scrollTop = parseFloat(dataset.scrolltop); + var finalScrollTop = usePageScroll ? pageScrollTop : scrollTop; + var fixedIsTop = false; + var isIos = _isTrue(dataset.isios); + if (!isIos && finalScrollTop == (state.startScrollTop || 0) && finalScrollTop <= 105) { + fixedIsTop = true; + } + var fixedIsTopHitCount = state.fixedIsTopHitCount || 0; + if (fixedIsTop) { + fixedIsTopHitCount ++; + if (fixedIsTopHitCount <= 2) { + fixedIsTop = false; + } + state.fixedIsTopHitCount = fixedIsTopHitCount; + } else { + state.fixedIsTopHitCount = 0; + } + if (!isIos && processTag === 0) { + state.startScrollTop = finalScrollTop || 0; + } + if (!isIos && processTag === 2) { + fixedIsTop = true; + } + return loading || useChatRecordMode || !refresherEnabled || !useCustomRefresher || + ((usePageScroll && useCustomRefresher && pageScrollTop > 5) && !fixedIsTop) || + ((!usePageScroll && useCustomRefresher && scrollTop > 5) && !fixedIsTop); +} + +function _getAngleIsInRange(e, touch, state, dataset) { + var maxAngle = dataset.refreshermaxangle; + var refresherAecc = _isTrue(dataset.refresheraecc); + var lastTouch = state.lastTouch; + var reachMaxAngle = state.reachMaxAngle; + var moveDis = state.oldMoveDis; + if (!lastTouch) return true; + if (maxAngle >= 0 && maxAngle <= 90 && lastTouch) { + if ((!moveDis || moveDis < 1) && !refresherAecc && reachMaxAngle != null && !reachMaxAngle) return false; + var x = Math.abs(touch.touchX - lastTouch.touchX); + var y = Math.abs(touch.touchY - lastTouch.touchY); + var z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); + if ((x || y) && x > 1) { + var angle = Math.asin(y / z) / Math.PI * 180; + if (angle < maxAngle) { + var hitReachMaxAngleCount = state.hitReachMaxAngleCount || 0; + state.hitReachMaxAngleCount = ++hitReachMaxAngleCount; + if (state.hitReachMaxAngleCount > 2) { + state.lastTouch = touch; + state.reachMaxAngle = false; + } + return false; + } + } + } + state.lastTouch = touch; + return true; +} + +function _handlePullingDown(state, ins, onPullingDown) { + var oldOnPullingDown = state.onPullingDown || false; + if (oldOnPullingDown != onPullingDown) { + ins.callMethod('_handleWxsPullingDownStatusChange', onPullingDown); + } + state.onPullingDown = onPullingDown; +} + +function _isTrue(value) { + value = (typeof(value) === 'string' ? JSON.parse(value) : value) || false; + return value == true || value == 'true'; +} + +module.exports = { + touchstart: touchstart, + touchmove: touchmove, + touchend: touchend, + mousedown: mousedown, + mousemove: mousemove, + mouseup: mouseup, + mouseleave: mouseleave, + propObserver: propObserver +} diff --git a/uni_modules/z-paging/components/z-paging/z-paging.vue b/uni_modules/z-paging/components/z-paging/z-paging.vue new file mode 100644 index 0000000..30c675a --- /dev/null +++ b/uni_modules/z-paging/components/z-paging/z-paging.vue @@ -0,0 +1,310 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/uni_modules/zxz-uni-data-select/package.json b/uni_modules/zxz-uni-data-select/package.json new file mode 100644 index 0000000..7817030 --- /dev/null +++ b/uni_modules/zxz-uni-data-select/package.json @@ -0,0 +1,85 @@ +{ + "id": "zxz-uni-data-select", + "displayName": "zxz-uni-data-select 下拉框选择器(添加下拉框检索,多选功能,多选搜索功能,自定义数据)", + "version": "1.0.14", + "description": "通过数据驱动的下拉框选择器(添加下拉框检索,多选功能,多选搜索功能,自定义数据)", + "keywords": [ + "uni-ui", + "select", + "uni-data-select", + "下拉框", + "下拉选" +], + "repository": "", + "engines": { + "HBuilderX": "^3.1.1" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-load-more"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "u", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y", + "京东": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/zxz-uni-data-select/readme.md b/uni_modules/zxz-uni-data-select/readme.md new file mode 100644 index 0000000..594b69e --- /dev/null +++ b/uni_modules/zxz-uni-data-select/readme.md @@ -0,0 +1,26 @@ +## DataSelect 下拉框选择器 +> **组件名:zxz-uni-data-select** +> 代码块: `zxz-uni-data-select` + +当选项过多时,使用下拉菜单展示并选择内容 +## API + +### zxz-uni-data-select Props + +| 属性名 | 类型 | 默认值 | 说明 | +| - | - | - | - | +| v-model | String、Array、Number |- | 选中项绑定值 | +| multiple | Boolean | false | 是否多选 | +| disabled | Boolean |false | 是否禁用 | +| dataKey | String |"key" | 作为 key 唯一标识的键名 | +| dataValue | String | "value" | 作为 value 唯一标识的键名 | +| collapseTags | Boolean | false | 多选时是否将选中值按文字的形式展示| +|collapseTagsNum|Number | 1 | 多选时选中值按文字的形式展示的数量| +| localdata | Array |- | 下拉列表本地数据 | +|label | String | - | 左侧标题 +|placeholder | String | "请选择" | 输入框的提示文字 +|emptyTips | String |"无选项" | 无选项提示 +|clear | Boolean | true| 是否清空 +|format | String | - | 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}" + +#### 如使用过程中有任何问题,或者您对组件有一些好的建议,欢迎加微weiyila520 diff --git a/utils/README.md b/utils/README.md new file mode 100644 index 0000000..b2cbfa0 --- /dev/null +++ b/utils/README.md @@ -0,0 +1,60 @@ + + + + +# weapp-qrcode +微信小程序生成二维码工具 + +> 生成二维码数据的主要代码来自[davidshimjs/qrcodejs](https://github.com/davidshimjs/qrcodejs),因为它这个里面生成二维码图片的功能在微信小程序里不能使用,我将这个功能改写成可以在微信小程序中使用。 + +## 截图 + +![截图1](http://upload-images.jianshu.io/upload_images/2158535-a571aa52e76c5fd4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300) +![截图2](http://upload-images.jianshu.io/upload_images/2158535-e83a4b25271ab401.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300) +![gif](http://upload-images.jianshu.io/upload_images/2158535-1aebcd12a2ff1272.gif?imageMogr2/auto-orient/strip%7CimageView2/2/w/300) + +## 使用 + +页面`wxml`中放置绘制二维码的`canvas`: +``` + +``` + +页面`js`中引入: +``` +var QRCode = require('../../utils/weapp-qrcode.js') +``` + +页面加载好后: +```js +//传入wxml中二维码canvas的canvas-id +var qrcode = new QRCode('canvas', { + // usingIn: this, + text: "https://github.com/tomfriwel/weapp-qrcode", + width: 150, + height: 150, + colorDark: "#000000", + colorLight: "#ffffff", + correctLevel: QRCode.CorrectLevel.H, +}); +``` + +`usingIn`为可选参数,详情清查卡[在自定义组件使用时失效及解决思路 #1](https://github.com/tomfriwel/weapp-qrcode/issues/1) + +`text`为需要转化为二维码的字符串; + +`width`和`height`为绘制出的二维码长宽,这里设置为跟`canvas`同样的长宽; + +`colorDark`和`colorLight`为二维码交替的两种颜色; + +`correctLevel`没有细看源码,命名上看应该是准确度; + +如果需要再次生成二维码,调用`qrcode.makeCode('text you want convert')`。 + +## 主要流程 + +![主流程](http://upload-images.jianshu.io/upload_images/2158535-eb145383b2c50518.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/800) + +## TODO + +* https://github.com/SumiMakito/Awesome-qr.js diff --git a/utils/auth.token.js b/utils/auth.token.js new file mode 100644 index 0000000..18a9c46 --- /dev/null +++ b/utils/auth.token.js @@ -0,0 +1,13 @@ +const TokenKey = 'satoken' + +const token = { + + getToken: function() { + return uni.getStorageSync(TokenKey) + }, + setToken: function(token) { + return uni.setStorageSync(TokenKey, token) + } +} + +export default token diff --git a/utils/request/index.js b/utils/request/index.js new file mode 100644 index 0000000..6658821 --- /dev/null +++ b/utils/request/index.js @@ -0,0 +1,13 @@ +// 引入配置 +import config from '@/common/config' +// 初始化请求配置 +uni.$u.http.setConfig((defaultConfig) => { + /* defaultConfig 为默认全局配置 */ + defaultConfig.baseURL = config.baseUrl /* 根域名 */ + return defaultConfig +}) + +module.exports = (vm) => { + require('./requestInterceptors')(vm) + require('./responseInterceptors')(vm) +} diff --git a/utils/request/requestInterceptors.js b/utils/request/requestInterceptors.js new file mode 100644 index 0000000..30c5994 --- /dev/null +++ b/utils/request/requestInterceptors.js @@ -0,0 +1,35 @@ +import conf from "@/common/config.js" +import token from '@/utils/auth.token.js' +/** + * 请求拦截 + * @param {Object} http + */ +module.exports = (vm) => { + uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作 + // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} + config.data = config.data || {} + // 可以在此通过vm引用vuex中的变量,具体值在vm.$store.state中 + // console.log(vm.$store.state); + + // 设置请求头中token的名字,以及token的值 + let _token = token.getToken() + let _tokenName = 'Authorization' + if (conf.tokenName) { + _tokenName = conf.tokenName + } + config.header[_tokenName] = _token + + // 设置针对响应结果的处理方式 + let _cus = { + showLoading: true, // 是否显示加载等待框 + loadingTitle: '加载中', // 加载等待框的提示文字 + showFailMessage: true, // 返回失败信息是否显示 + catchError: true, // 是否集中管理Catch, + } + Object.assign(_cus, config.custom) + config.custom = _cus + + return config + }, (config) => // 可使用async await 做异步操作 + Promise.reject(config)) +} diff --git a/utils/request/responseInterceptors.js b/utils/request/responseInterceptors.js new file mode 100644 index 0000000..3650e9c --- /dev/null +++ b/utils/request/responseInterceptors.js @@ -0,0 +1,130 @@ +import conf from "@/common/config.js" +/** + * 响应拦截 + * @param {Object} http + */ +module.exports = (vm) => { + uni.$u.http.interceptors.response.use((response) => { + /* 对响应成功做点什么 可使用async await 做异步操作*/ + + // 自定义参数 + let _cus = { + showLoading: true, // 是否显示加载等待框 + loadingTitle: '加载中', // 加载等待框的提示文字 + showFailMessage: true, // 返回失败信息是否显示 + catchError: true, // 是否集中管理Catch, + } + if (response.config && response.config.custom) + Object.assign(_cus, response.config.custom) + + if (200 == response.statusCode) { + let data = response.data + if (_cus.catchError) { + if (data.success) { + return data.data + } else { + let loginTimeoutCode = "5000" + let loginTimeoutPage = "/pages/login/index" + if (conf.loginTimeoutCode) { + loginTimeoutCode = "" + conf.loginTimeoutCode + } + if (conf.loginTimeoutPage) { + loginTimeoutPage = conf.loginTimeoutPage + } + if (loginTimeoutCode === data.code) { + uni.showModal({ + title: '提示', + content: '登录过期或失效,请重新登录!', + showCancel: false, + success: function(res) { + uni.reLaunch({ + url: loginTimeoutPage + }) + } + }); + } else { + if (_cus.showFailMessage) { + uni.showToast({ + title: data.msg, + icon: 'none', + duration: 2000, + }) + } + } + return Promise.reject(data) + } + } else { + return data + } + } else { + console.log('response.statusCode--', response) + let em = { + "code": "" + response.statusCode, + "data": "", + "msg": "网络请求失败~", + "success": false, + "timestamp": new Date().getTime() + } + if (res.data) { + em.msg = res.data + } + if (_cus.showFailMessage) { + uni.showToast({ + title: em.msg, + icon: 'none', + duration: 2000, + }) + } + return Promise.reject(em) + } + + // const data = response.data + // if (data.code !== 200) { // 服务端返回的状态码不等于200,则reject() + // // 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示 + // if (custom.toast !== false) { + // uni.$u.toast(data.message) + // } + // // 如果需要catch返回,则进行reject + // if (custom?.catch) { + // return Promise.reject(data) + // } else { + // // 否则返回一个pending中的promise + // return new Promise(() => {}) + // } + // } + // return data.data || {} + }, (error) => { + console.log('request-fail', error) + let _opts = { + showLoading: true, // 是否显示加载等待框 + loadingTitle: '加载中', // 加载等待框的提示文字 + showFailMessage: true, // 返回失败信息是否显示 + catchError: true, // 是否集中管理Catch, + } + if (error.config && error.config.custom) + Object.assign(_opts, response.config.custom) + let em = { + "code": "600", + "data": "", + "msg": "网络请求失败~", + "success": false, + "timestamp": new Date().getTime() + } + if (404 == error.statusCode) { + em.code = "404" + em.msg = "404,请求地址错误" + } + if (500 == error.statusCode) { + em.code = "500" + em.msg = "500,内部服务错误" + } + if (_opts.showFailMessage) { + uni.showToast({ + title: em.msg, + icon: 'none', + duration: 2000, + }) + } + return Promise.reject(em) + }) +} diff --git a/utils/requester.js b/utils/requester.js new file mode 100644 index 0000000..f6640e0 --- /dev/null +++ b/utils/requester.js @@ -0,0 +1,202 @@ +/** + * config 配置项说明 + * baseUrl = "", // 接口的根地址 + * tokenName = "Authorization", // 请求头中token的名字,与服务器端对应 + * loginTimeoutCode : "5000", // 登录超时或失效的情况下,服务器端返回的错误码 + * loginTimeoutPage = "/pages/login/index", // 登录超时或失效的情况下,跳转到的登录页面 + */ +import config from '@/common/config.js' +import token from '@/utils/auth.token.js' + +/** + * request options配置项说明 + * url: '', // url String 是 开发者服务器接口地址 + * data: {}, // data Object/String/ArrayBuffer 否 请求的参数 App 3.3.7 以下不支持 ArrayBuffer 类型 + * header: {}, // header Object 否 设置请求的 header,header 中不能设置 Referer。 App、H5端会自动带上cookie,且H5端不可手动修改 + * method: 'GET', // method String 否 GET 有效值详见下方说明 + * timeout: 6000, // timeout Number 否 60000 超时时间,单位 ms H5(HBuilderX 2.9.9+)、APP(HBuilderX 2.9.9+)、微信小程序(2.10.0)、支付宝小程序 + * showLoading: true, // 是否显示加载等待框 + * loadingTitle: '加载中', // 加载等待框的提示文字 + * showFailMessage: true, // 返回失败信息是否显示 + * catchError: true, // 是否集中管理返回的success为false的情况,如果为false,在请求处判断code值做业务处理 + */ +const request = (options, noLoading,noFailMessage) => { + let _opts = { + url: '', // url String 是 开发者服务器接口地址 + data: {}, // data Object/String/ArrayBuffer 否 请求的参数 App 3.3.7 以下不支持 ArrayBuffer 类型 + header: {}, // header Object 否 设置请求的 header,header 中不能设置 Referer。 App、H5端会自动带上cookie,且H5端不可手动修改 {"content-type": "application/json"} + method: 'GET', // method String 否 GET 有效值详见下方说明 + timeout: 60000, // timeout Number 否 60000 超时时间,单位 ms H5(HBuilderX 2.9.9+)、APP(HBuilderX 2.9.9+)、微信小程序(2.10.0)、支付宝小程序 + // dataType String 否 json 如果设为 json,会尝试对返回的数据做一次 JSON.parse + // responseType String 否 text 设置响应的数据类型。合法值:text、arraybuffer 支付宝小程序不支持 + // sslVerify Boolean 否 true 验证 ssl 证书 仅App安卓端支持(HBuilderX 2.3.3+),不支持离线打包 + // withCredentials Boolean 否 false 跨域请求时是否携带凭证(cookies) 仅H5支持(HBuilderX 2.6.15+) + // firstIpv4 Boolean 否 false DNS解析时优先使用ipv4 仅 App-Android 支持 (HBuilderX 2.8.0+) + // success Function 否 收到开发者服务器成功返回的回调函数 + // fail Function 否 接口调用失败的回调函数 + // complete Function 否 接口调用结束的回调函数(调用成功、失败都会执行) + showLoading: !noLoading, // 是否显示加载等待框 + loadingTitle: '加载中', // 加载等待框的提示文字 + showFailMessage: !noFailMessage, // 返回失败信息是否显示 + catchError: true, // 是否集中管理Catch, + } + Object.assign(_opts, options) + let _token = token.getToken() + console.log("token", _token) + let _baseUrl = config.baseUrl + let _tokenName = config.tokenName + if (_tokenName) { + _opts.header[_tokenName] = _token + } else { + _opts.header['satoken'] = _token + } + + return new Promise((resolve, reject) => { + if (_opts.showLoading) { + uni.showLoading({ + title: _opts.loadingTitle || '加载中', + mask: true + }) + } + return uni.request({ + url: (_baseUrl || '') + (_opts.url || ''), + method: _opts.method, + data: _opts.data || null, + header: _opts.header, + timeout: _opts.timeout || 60000, + success: res => { + if (200 === res.statusCode) { + let data = res.data + if (_opts.catchError) { + if (data.success) { + resolve(data.data) + } else { + let loginTimeoutCode = "5000" + let loginTimeoutPage = "/pages/login/index" + if (config.loginTimeoutCode) { + loginTimeoutCode = "" + config.loginTimeoutCode + } + if (config.loginTimeoutPage) { + loginTimeoutPage = config.loginTimeoutPage + } + if (loginTimeoutCode === data.code) { + uni.showModal({ + title: '提示', + content: '登录过期或失效,请重新登录!', + showCancel: false, + success: function(res) { + uni.reLaunch({ + url: loginTimeoutPage + }) + } + }); + } else { + if (_opts.showFailMessage) { + + console.log("data.msg>>>>>", data.msg); + + uni.showToast({ + title: data.msg, + icon: 'none', + duration: 5000, + }) + } + } + reject(data) + } + } else { + resolve(data) + } + } else { + let em = { + "code": "404", + "data": "", + "msg": "网络请求失败~", + "success": false, + "timestamp": new Date().getTime() + } + if (res.data) { + if (res.data.error) { + if (res.data.path) { + em.msg = res.data.path + res.data.error + } else { + em.msg = res.data.error + } + } + if (res.data.status) { + em.code = "" + res.data.status + } + } + if (_opts.showFailMessage) { + uni.showToast({ + title: em.msg, + icon: 'none', + duration: 2000, + }) + } + reject(em) + } + }, + fail: error => { + console.log('request-fail: ', error) + let em = { + "code": "600", + "data": "", + "msg": "网络请求失败~", + "success": false, + "timestamp": new Date().getTime() + } + if (error.errMsg) { + // em.msg = error.errMsg + } + if (_opts.showFailMessage) { + uni.showToast({ + title: em.msg, + icon: 'none', + duration: 2000, + }) + } + reject(em) + }, + complete() { + if (_opts.showLoading) { + console.log("showLoading>>>>>", _opts.showLoading); + uni.hideLoading() + + } + } + }) + }) + +} + +const req = function(url, method = "GET", data = {}, header = {}, options = {}, noLoading,noFailMessage) { + let _opts = { + url: url, + method: method, + data: data, + header: header + } + Object.assign(options, _opts) + return request(options, noLoading,noFailMessage) +} + +const get = function(url, data = {}, header = {}, options = {}, noLoading,noFailMessage) { + return req(url, "GET", data, header, options, noLoading,noFailMessage) +} +const post = function(url, data = {}, header = {}, options = {}, noLoading,noFailMessage) { + return req(url, "POST", data, header, options, noLoading,noFailMessage) +} +const formpost = function(url, data = {}, header = {}, options = {}, noLoading,noFailMessage) { + let _head = { + "content-type": "application/x-www-form-urlencoded" + } + Object.assign(header, _head) + return req(url, "POST", data, header, options, noLoading,noFailMessage) +} +request.get = get +request.post = post +request.formpost = formpost +request.req = req + +export default request \ No newline at end of file diff --git a/utils/weapp-qrcode.js b/utils/weapp-qrcode.js new file mode 100644 index 0000000..382c43d --- /dev/null +++ b/utils/weapp-qrcode.js @@ -0,0 +1,426 @@ +// Core code comes from https://github.com/davidshimjs/qrcodejs +var QRCode; + +(function () { + /** + * Get the type by string length + * + * @private + * @param {String} sText + * @param {Number} nCorrectLevel + * @return {Number} type + */ + function _getTypeNumber(sText, nCorrectLevel) { + var nType = 1; + var length = _getUTF8Length(sText); + + for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) { + var nLimit = 0; + + switch (nCorrectLevel) { + case QRErrorCorrectLevel.L: + nLimit = QRCodeLimitLength[i][0]; + break; + case QRErrorCorrectLevel.M: + nLimit = QRCodeLimitLength[i][1]; + break; + case QRErrorCorrectLevel.Q: + nLimit = QRCodeLimitLength[i][2]; + break; + case QRErrorCorrectLevel.H: + nLimit = QRCodeLimitLength[i][3]; + break; + } + + if (length <= nLimit) { + break; + } else { + nType++; + } + } + + if (nType > QRCodeLimitLength.length) { + throw new Error("Too long data"); + } + + return nType; + } + + function _getUTF8Length(sText) { + var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); + return replacedText.length + (replacedText.length != sText ? 3 : 0); + } + + function QR8bitByte(data) { + this.mode = QRMode.MODE_8BIT_BYTE; + this.data = data; + this.parsedData = []; + + // Added to support UTF-8 Characters + for (var i = 0, l = this.data.length; i < l; i++) { + var byteArray = []; + var code = this.data.charCodeAt(i); + + if (code > 0x10000) { + byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18); + byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12); + byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[3] = 0x80 | (code & 0x3F); + } else if (code > 0x800) { + byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12); + byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[2] = 0x80 | (code & 0x3F); + } else if (code > 0x80) { + byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6); + byteArray[1] = 0x80 | (code & 0x3F); + } else { + byteArray[0] = code; + } + + this.parsedData.push(byteArray); + } + + this.parsedData = Array.prototype.concat.apply([], this.parsedData); + + if (this.parsedData.length != this.data.length) { + this.parsedData.unshift(191); + this.parsedData.unshift(187); + this.parsedData.unshift(239); + } + } + + QR8bitByte.prototype = { + getLength: function (buffer) { + return this.parsedData.length; + }, + write: function (buffer) { + for (var i = 0, l = this.parsedData.length; i < l; i++) { + buffer.put(this.parsedData[i], 8); + } + } + }; + + + // QRCodeModel + function QRCodeModel(typeNumber, errorCorrectLevel) { + this.typeNumber = typeNumber; + this.errorCorrectLevel = errorCorrectLevel; + this.modules = null; + this.moduleCount = 0; + this.dataCache = null; + this.dataList = []; + } + QRCodeModel.prototype = { + addData: function (data) { var newData = new QR8bitByte(data); this.dataList.push(newData); this.dataCache = null; }, isDark: function (row, col) { + if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { throw new Error(row + "," + col); } + return this.modules[row][col]; + }, getModuleCount: function () { return this.moduleCount; }, make: function () { this.makeImpl(false, this.getBestMaskPattern()); }, makeImpl: function (test, maskPattern) { + this.moduleCount = this.typeNumber * 4 + 17; this.modules = new Array(this.moduleCount); for (var row = 0; row < this.moduleCount; row++) { this.modules[row] = new Array(this.moduleCount); for (var col = 0; col < this.moduleCount; col++) { this.modules[row][col] = null; } } + this.setupPositionProbePattern(0, 0); this.setupPositionProbePattern(this.moduleCount - 7, 0); this.setupPositionProbePattern(0, this.moduleCount - 7); this.setupPositionAdjustPattern(); this.setupTimingPattern(); this.setupTypeInfo(test, maskPattern); if (this.typeNumber >= 7) { this.setupTypeNumber(test); } + if (this.dataCache == null) { this.dataCache = QRCodeModel.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); } + this.mapData(this.dataCache, maskPattern); + }, setupPositionProbePattern: function (row, col) { for (var r = -1; r <= 7; r++) { if (row + r <= -1 || this.moduleCount <= row + r) continue; for (var c = -1; c <= 7; c++) { if (col + c <= -1 || this.moduleCount <= col + c) continue; if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } } }, getBestMaskPattern: function () { + var minLostPoint = 0; var pattern = 0; for (var i = 0; i < 8; i++) { this.makeImpl(true, i); var lostPoint = QRUtil.getLostPoint(this); if (i == 0 || minLostPoint > lostPoint) { minLostPoint = lostPoint; pattern = i; } } + return pattern; + }, createMovieClip: function (target_mc, instance_name, depth) { + var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); var cs = 1; this.make(); for (var row = 0; row < this.modules.length; row++) { var y = row * cs; for (var col = 0; col < this.modules[row].length; col++) { var x = col * cs; var dark = this.modules[row][col]; if (dark) { qr_mc.beginFill(0, 100); qr_mc.moveTo(x, y); qr_mc.lineTo(x + cs, y); qr_mc.lineTo(x + cs, y + cs); qr_mc.lineTo(x, y + cs); qr_mc.endFill(); } } } + return qr_mc; + }, setupTimingPattern: function () { + for (var r = 8; r < this.moduleCount - 8; r++) { + if (this.modules[r][6] != null) { continue; } + this.modules[r][6] = (r % 2 == 0); + } + for (var c = 8; c < this.moduleCount - 8; c++) { + if (this.modules[6][c] != null) { continue; } + this.modules[6][c] = (c % 2 == 0); + } + }, setupPositionAdjustPattern: function () { + var pos = QRUtil.getPatternPosition(this.typeNumber); for (var i = 0; i < pos.length; i++) { + for (var j = 0; j < pos.length; j++) { + var row = pos[i]; var col = pos[j]; if (this.modules[row][col] != null) { continue; } + for (var r = -2; r <= 2; r++) { for (var c = -2; c <= 2; c++) { if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } } + } + } + }, setupTypeNumber: function (test) { + var bits = QRUtil.getBCHTypeNumber(this.typeNumber); for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; } + for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; } + }, setupTypeInfo: function (test, maskPattern) { + var data = (this.errorCorrectLevel << 3) | maskPattern; var bits = QRUtil.getBCHTypeInfo(data); for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 6) { this.modules[i][8] = mod; } else if (i < 8) { this.modules[i + 1][8] = mod; } else { this.modules[this.moduleCount - 15 + i][8] = mod; } } + for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 8) { this.modules[8][this.moduleCount - i - 1] = mod; } else if (i < 9) { this.modules[8][15 - i - 1 + 1] = mod; } else { this.modules[8][15 - i - 1] = mod; } } + this.modules[this.moduleCount - 8][8] = (!test); + }, mapData: function (data, maskPattern) { + var inc = -1; var row = this.moduleCount - 1; var bitIndex = 7; var byteIndex = 0; for (var col = this.moduleCount - 1; col > 0; col -= 2) { + if (col == 6) col--; while (true) { + for (var c = 0; c < 2; c++) { + if (this.modules[row][col - c] == null) { + var dark = false; if (byteIndex < data.length) { dark = (((data[byteIndex] >>> bitIndex) & 1) == 1); } + var mask = QRUtil.getMask(maskPattern, row, col - c); if (mask) { dark = !dark; } + this.modules[row][col - c] = dark; bitIndex--; if (bitIndex == -1) { byteIndex++; bitIndex = 7; } + } + } + row += inc; if (row < 0 || this.moduleCount <= row) { row -= inc; inc = -inc; break; } + } + } + } + }; + QRCodeModel.PAD0 = 0xEC; + QRCodeModel.PAD1 = 0x11; + QRCodeModel.createData = function (typeNumber, errorCorrectLevel, dataList) { + var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); var buffer = new QRBitBuffer(); for (var i = 0; i < dataList.length; i++) { var data = dataList[i]; buffer.put(data.mode, 4); buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber)); data.write(buffer); } + var totalDataCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalDataCount += rsBlocks[i].dataCount; } + if (buffer.getLengthInBits() > totalDataCount * 8) { + throw new Error("code length overflow. (" + + buffer.getLengthInBits() + + ">" + + totalDataCount * 8 + + ")"); + } + if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { buffer.put(0, 4); } + while (buffer.getLengthInBits() % 8 != 0) { buffer.putBit(false); } + while (true) { + if (buffer.getLengthInBits() >= totalDataCount * 8) { break; } + buffer.put(QRCodeModel.PAD0, 8); if (buffer.getLengthInBits() >= totalDataCount * 8) { break; } + buffer.put(QRCodeModel.PAD1, 8); + } + return QRCodeModel.createBytes(buffer, rsBlocks); + }; + QRCodeModel.createBytes = function (buffer, rsBlocks) { + var offset = 0; var maxDcCount = 0; var maxEcCount = 0; var dcdata = new Array(rsBlocks.length); var ecdata = new Array(rsBlocks.length); for (var r = 0; r < rsBlocks.length; r++) { + var dcCount = rsBlocks[r].dataCount; var ecCount = rsBlocks[r].totalCount - dcCount; maxDcCount = Math.max(maxDcCount, dcCount); maxEcCount = Math.max(maxEcCount, ecCount); dcdata[r] = new Array(dcCount); for (var i = 0; i < dcdata[r].length; i++) { dcdata[r][i] = 0xff & buffer.buffer[i + offset]; } + offset += dcCount; var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); var modPoly = rawPoly.mod(rsPoly); ecdata[r] = new Array(rsPoly.getLength() - 1); for (var i = 0; i < ecdata[r].length; i++) { var modIndex = i + modPoly.getLength() - ecdata[r].length; ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0; } + } + var totalCodeCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalCodeCount += rsBlocks[i].totalCount; } + var data = new Array(totalCodeCount); var index = 0; for (var i = 0; i < maxDcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < dcdata[r].length) { data[index++] = dcdata[r][i]; } } } + for (var i = 0; i < maxEcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < ecdata[r].length) { data[index++] = ecdata[r][i]; } } } + return data; + }; + var QRMode = { MODE_NUMBER: 1 << 0, MODE_ALPHA_NUM: 1 << 1, MODE_8BIT_BYTE: 1 << 2, MODE_KANJI: 1 << 3 }; + var QRErrorCorrectLevel = { L: 1, M: 0, Q: 3, H: 2 }; + var QRMaskPattern = { PATTERN000: 0, PATTERN001: 1, PATTERN010: 2, PATTERN011: 3, PATTERN100: 4, PATTERN101: 5, PATTERN110: 6, PATTERN111: 7 }; + var QRUtil = { + PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), getBCHTypeInfo: function (data) { + var d = data << 10; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15))); } + return ((data << 10) | d) ^ QRUtil.G15_MASK; + }, getBCHTypeNumber: function (data) { + var d = data << 12; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18))); } + return (data << 12) | d; + }, getBCHDigit: function (data) { + var digit = 0; while (data != 0) { digit++; data >>>= 1; } + return digit; + }, getPatternPosition: function (typeNumber) { return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; }, getMask: function (maskPattern, i, j) { switch (maskPattern) { case QRMaskPattern.PATTERN000: return (i + j) % 2 == 0; case QRMaskPattern.PATTERN001: return i % 2 == 0; case QRMaskPattern.PATTERN010: return j % 3 == 0; case QRMaskPattern.PATTERN011: return (i + j) % 3 == 0; case QRMaskPattern.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0; case QRMaskPattern.PATTERN101: return (i * j) % 2 + (i * j) % 3 == 0; case QRMaskPattern.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 == 0; case QRMaskPattern.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 == 0; default: throw new Error("bad maskPattern:" + maskPattern); } }, getErrorCorrectPolynomial: function (errorCorrectLength) { + var a = new QRPolynomial([1], 0); for (var i = 0; i < errorCorrectLength; i++) { a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0)); } + return a; + }, getLengthInBits: function (mode, type) { if (1 <= type && type < 10) { switch (mode) { case QRMode.MODE_NUMBER: return 10; case QRMode.MODE_ALPHA_NUM: return 9; case QRMode.MODE_8BIT_BYTE: return 8; case QRMode.MODE_KANJI: return 8; default: throw new Error("mode:" + mode); } } else if (type < 27) { switch (mode) { case QRMode.MODE_NUMBER: return 12; case QRMode.MODE_ALPHA_NUM: return 11; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 10; default: throw new Error("mode:" + mode); } } else if (type < 41) { switch (mode) { case QRMode.MODE_NUMBER: return 14; case QRMode.MODE_ALPHA_NUM: return 13; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 12; default: throw new Error("mode:" + mode); } } else { throw new Error("type:" + type); } }, getLostPoint: function (qrCode) { + var moduleCount = qrCode.getModuleCount(); var lostPoint = 0; for (var row = 0; row < moduleCount; row++) { + for (var col = 0; col < moduleCount; col++) { + var sameCount = 0; var dark = qrCode.isDark(row, col); for (var r = -1; r <= 1; r++) { + if (row + r < 0 || moduleCount <= row + r) { continue; } + for (var c = -1; c <= 1; c++) { + if (col + c < 0 || moduleCount <= col + c) { continue; } + if (r == 0 && c == 0) { continue; } + if (dark == qrCode.isDark(row + r, col + c)) { sameCount++; } + } + } + if (sameCount > 5) { lostPoint += (3 + sameCount - 5); } + } + } + for (var row = 0; row < moduleCount - 1; row++) { for (var col = 0; col < moduleCount - 1; col++) { var count = 0; if (qrCode.isDark(row, col)) count++; if (qrCode.isDark(row + 1, col)) count++; if (qrCode.isDark(row, col + 1)) count++; if (qrCode.isDark(row + 1, col + 1)) count++; if (count == 0 || count == 4) { lostPoint += 3; } } } + for (var row = 0; row < moduleCount; row++) { for (var col = 0; col < moduleCount - 6; col++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) { lostPoint += 40; } } } + for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount - 6; row++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) { lostPoint += 40; } } } + var darkCount = 0; for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount; row++) { if (qrCode.isDark(row, col)) { darkCount++; } } } + var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; lostPoint += ratio * 10; return lostPoint; + } + }; + var QRMath = { + glog: function (n) { + if (n < 1) { throw new Error("glog(" + n + ")"); } + return QRMath.LOG_TABLE[n]; + }, gexp: function (n) { + while (n < 0) { n += 255; } + while (n >= 256) { n -= 255; } + return QRMath.EXP_TABLE[n]; + }, EXP_TABLE: new Array(256), LOG_TABLE: new Array(256) + }; for (var i = 0; i < 8; i++) { QRMath.EXP_TABLE[i] = 1 << i; } + for (var i = 8; i < 256; i++) { QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8]; } + for (var i = 0; i < 255; i++) { QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; } + function QRPolynomial(num, shift) { + if (num.length == undefined) { throw new Error(num.length + "/" + shift); } + var offset = 0; while (offset < num.length && num[offset] == 0) { offset++; } + this.num = new Array(num.length - offset + shift); for (var i = 0; i < num.length - offset; i++) { this.num[i] = num[i + offset]; } + } + QRPolynomial.prototype = { + get: function (index) { return this.num[index]; }, getLength: function () { return this.num.length; }, multiply: function (e) { + var num = new Array(this.getLength() + e.getLength() - 1); for (var i = 0; i < this.getLength(); i++) { for (var j = 0; j < e.getLength(); j++) { num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j))); } } + return new QRPolynomial(num, 0); + }, mod: function (e) { + if (this.getLength() - e.getLength() < 0) { return this; } + var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0)); var num = new Array(this.getLength()); for (var i = 0; i < this.getLength(); i++) { num[i] = this.get(i); } + for (var i = 0; i < e.getLength(); i++) { num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio); } + return new QRPolynomial(num, 0).mod(e); + } + }; + function QRRSBlock(totalCount, dataCount) { this.totalCount = totalCount; this.dataCount = dataCount; } + QRRSBlock.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]]; + QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) { + var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); if (rsBlock == undefined) { throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); } + var length = rsBlock.length / 3; var list = []; for (var i = 0; i < length; i++) { var count = rsBlock[i * 3 + 0]; var totalCount = rsBlock[i * 3 + 1]; var dataCount = rsBlock[i * 3 + 2]; for (var j = 0; j < count; j++) { list.push(new QRRSBlock(totalCount, dataCount)); } } + return list; + }; + QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) { switch (errorCorrectLevel) { case QRErrorCorrectLevel.L: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; case QRErrorCorrectLevel.M: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; case QRErrorCorrectLevel.Q: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; case QRErrorCorrectLevel.H: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; default: return undefined; } }; + function QRBitBuffer() { this.buffer = []; this.length = 0; } + QRBitBuffer.prototype = { + get: function (index) { var bufIndex = Math.floor(index / 8); return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1; }, put: function (num, length) { for (var i = 0; i < length; i++) { this.putBit(((num >>> (length - i - 1)) & 1) == 1); } }, getLengthInBits: function () { return this.length; }, putBit: function (bit) { + var bufIndex = Math.floor(this.length / 8); if (this.buffer.length <= bufIndex) { this.buffer.push(0); } + if (bit) { this.buffer[bufIndex] |= (0x80 >>> (this.length % 8)); } + this.length++; + } + }; + var QRCodeLimitLength = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]]; + + // QRCode object + QRCode = function (canvasId, vOption) { + this._htOption = { + width: 256, + height: 256, + typeNumber: 4, + colorDark: "#000000", + colorLight: "#ffffff", + correctLevel: QRErrorCorrectLevel.H + }; + + if (typeof vOption === 'string') { + vOption = { + text: vOption + }; + } + + // Overwrites options + if (vOption) { + for (var i in vOption) { + this._htOption[i] = vOption[i]; + } + } + + this._oQRCode = null; + this.canvasId = canvasId + + if (this._htOption.text && this.canvasId) { + this.makeCode(this._htOption.text); + } + }; + + QRCode.prototype.makeCode = function (sText) { + this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel); + this._oQRCode.addData(sText); + this._oQRCode.make(); + this.makeImage(); + }; + + QRCode.prototype.makeImage = function () { + var _oContext + if (this._htOption.usingIn) { + _oContext = wx.createCanvasContext(this.canvasId, this._htOption.usingIn) + } + else { + _oContext = wx.createCanvasContext(this.canvasId) + } + var _htOption = this._htOption; + var oQRCode = this._oQRCode + + var nCount = oQRCode.getModuleCount(); + var nWidth = _htOption.padding ? (_htOption.width - 2 * _htOption.padding) / nCount : _htOption.width / nCount; + var nHeight = _htOption.padding ? (_htOption.height - 2 * _htOption.padding) / nCount : _htOption.height / nCount; + var nRoundedHeight = Math.round(nHeight); + var nRoundedWidth = Math.round(nWidth); + + if (_htOption.image && _htOption.image != '') { + _oContext.drawImage(_htOption.image, 0, 0, _htOption.width, _htOption.height) + } + _oContext.setFillStyle('#fff') + _oContext.fillRect(0, 0, _htOption.width, _htOption.height) + _oContext.save() + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + var bIsDark = oQRCode.isDark(row, col); + var nLeft = _htOption.padding ? col * nWidth + _htOption.padding : col * nWidth; + var nTop = _htOption.padding ? row * nHeight + _htOption.padding : row * nHeight; + _oContext.setStrokeStyle(bIsDark ? _htOption.colorDark : _htOption.colorLight) + // _oContext.setStrokeStyle('red') + _oContext.setLineWidth(1) + _oContext.setFillStyle(bIsDark ? _htOption.colorDark : _htOption.colorLight) + // _oContext.setFillStyle('red') + // if (bIsDark) { + _oContext.fillRect(nLeft, nTop, nWidth, nHeight); + // } + + // 안티 앨리어싱 방지 처리 + // if (bIsDark) { + _oContext.strokeRect( + Math.floor(nLeft) + 0.5, + Math.floor(nTop) + 0.5, + nRoundedHeight + ); + + _oContext.strokeRect( + Math.ceil(nLeft) - 0.5, + Math.ceil(nTop) - 0.5, + nRoundedWidth, + nRoundedHeight + ); + // } + // _oContext.fillRect( + // Math.floor(nLeft) + 0.5, + // Math.floor(nTop) + 0.5, + // nRoundedWidth, + // nRoundedHeight + // ); + // _oContext.fillRect( + // Math.ceil(nLeft) - 0.5, + // Math.ceil(nTop) - 0.5, + // nRoundedWidth, + // nRoundedHeight + // ); + // _oContext.clearRect( + // Math.floor(nLeft) + 0.5, + // Math.floor(nTop) + 0.5, + // nRoundedWidth, + // nRoundedHeight + // ); + // _oContext.clearRect( + // Math.ceil(nLeft) - 0.5, + // Math.ceil(nTop) - 0.5, + // nRoundedWidth, + // nRoundedHeight + // ); + } + } + + _oContext.draw(false, () => { + setTimeout(() => { + this.exportImage() + }, 800) + }) + }; + + // 保存为图片,将临时路径传给回调 + QRCode.prototype.exportImage = function (callback) { + if (this._htOption.callback && typeof this._htOption.callback === 'function') { + wx.canvasToTempFilePath({ + x: 0, + y: 0, + width: this._htOption.width, + height: this._htOption.height, + destWidth: this._htOption.width, + destHeight: this._htOption.height, + canvasId: this.canvasId, + success: (res) => { + this._htOption.callback({path: res.tempFilePath}) + } + }) + } + } + + QRCode.CorrectLevel = QRErrorCorrectLevel; +})(); + +module.exports = QRCode \ No newline at end of file