diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index a97fd25..4bbcf3c 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -14,6 +14,10 @@ { "launchtype" : "local" }, + "mp-weixin" : + { + "launchtype" : "local" + }, "type" : "uniCloud" } ] diff --git a/apis/interfaces/scan.js b/apis/interfaces/scan.js index 7208570..82c5faf 100644 --- a/apis/interfaces/scan.js +++ b/apis/interfaces/scan.js @@ -1,33 +1,33 @@ -/** - * Web-zdx - * moduleName:核销相关操作 - */ - -import { - request -} from '../index' - - -// 扫码前置条件 get 核销前置 post 表示核销 -const scanInfo = (apiUrl, data, method) => { - return request({ - url: apiUrl, - method: method, - data: data - }) -} - -// 核销记录 -const scanList = (apiUrl, data) => { - return request({ - url: apiUrl, - method: 'GET', - data: data - }) -} - - -export { - scanInfo, - scanList +/** + * Web-zdx + * moduleName:核销相关操作 + */ + +import { + request +} from '../index' + + +// 扫码前置条件 get 核销前置 post 表示核销 +const scanInfo = (apiUrl, data, method) => { + return request({ + url: apiUrl, + method: method, + data: data + }) +} + +// 核销记录 +const scanList = (apiUrl, data) => { + return request({ + url: apiUrl, + method: 'GET', + data: data + }) +} + + +export { + scanInfo, + scanList } diff --git a/apis/interfaces/setting.js b/apis/interfaces/setting.js new file mode 100644 index 0000000..956163f --- /dev/null +++ b/apis/interfaces/setting.js @@ -0,0 +1,84 @@ +/** + * Web-zdx + * moduleName: 登录(手机号) + */ + +import { request } from '../index' + +// 手机号登陆接口 +const login = (data) => { + return request({ + url: 'user/socialite/login/wechat/mini', + method: 'POST', + data: data + }) +} +// 修改用户信息 +const wechatbind = (data) => { + return request({ + url: 'user/socialite/wechatbind', + method: 'PUT', + data: data + }) +} + +// 修改用户头像或昵称 +const resetUserInfo = (data) => { + return request({ + url: 'user/' + data.key, + method: 'PUT', + data: { + value: data.value + } + }) +} + +// 获取用户的Openid +const getOpenid = (code) => { + return request({ + url: 'user/socialite/login/wechat/openid', + method: 'GET', + data: { + code: code + } + }) + +} +// 隐私条款 +const agreementSecret = (data) => { + return request({ + url: 'articles/agreement/secret' + }) +} + +// 注册协议 +const agreementLogin = (data) => { + return request({ + url: 'articles/agreement/login' + }) +} + +// 获取用户设置中心的信息 +const getUserSettingInfo = () => { + return request({ + url: 'user/setting' + }) +} + +// 关于我们 +const aboutUs = () => { + return request({ + url: 'articles/about' + }) +} + +export { + login, + wechatbind, + getOpenid, + agreementSecret, + agreementLogin, + resetUserInfo, + getUserSettingInfo, + aboutUs +} diff --git a/components/tn-datepicker/tn-datepicker.vue b/components/tn-datepicker/tn-datepicker.vue index 8ca83fe..b6f926d 100644 --- a/components/tn-datepicker/tn-datepicker.vue +++ b/components/tn-datepicker/tn-datepicker.vue @@ -1,206 +1,206 @@ - - - - - diff --git a/pages.json b/pages.json index 8340288..ecff9b5 100644 --- a/pages.json +++ b/pages.json @@ -1,118 +1,132 @@ { "pages": [{ - "path": "pages/index/index", - "name": "Index", - "aliasPath": "/", - "style": { - "navigationBarTitleText":"发现能量" + "path": "pages/index/index", + "name": "Index", + "aliasPath": "/", + "style": { + "navigationBarTitleText": "发现能量" } }, { - "path": "pages/found/index", - "name": "Found", - "auth": true, - "style": { - "navigationBarTitleText":"发现更多" + "path": "pages/found/index", + "name": "Found", + "auth": true, + "style": { + "navigationBarTitleText": "发现更多" } }, { - "path": "pages/user/index", - "name": "User", - "auth": true, - "style": { - "navigationBarTitleText":"节点中心" + "path": "pages/user/index", + "name": "User", + "auth": true, + "style": { + "navigationBarTitleText": "节点中心" } }, { - "path": "pages/instrument/basics", - "name": "instrumentBasics", - "style": { - "navigationBarTitleText":"企业基础信息" + "path": "pages/instrument/basics", + "name": "instrumentBasics", + "style": { + "navigationBarTitleText": "企业基础信息" } }, { - "path": "pages/goods/management", - "name": "goodsManagement", - "style": { - "navigationBarTitleText":"商品权证管理" + "path": "pages/goods/management", + "name": "goodsManagement", + "style": { + "navigationBarTitleText": "商品权证管理" } }, { - "path": "pages/goods/addClassify", - "name": "goodsaddClassify", - "style": { - "navigationBarTitleText":"发布商品类目" + "path": "pages/goods/addClassify", + "name": "goodsaddClassify", + "style": { + "navigationBarTitleText": "发布商品类目" } }, { - "path": "pages/goods/add", - "name": "goodsAdd", - "style": { - "navigationBarTitleText":"商品权证创建" + "path": "pages/goods/add", + "name": "goodsAdd", + "style": { + "navigationBarTitleText": "商品权证创建" } }, { - "path": "pages/goods/goodsAuth", - "name": "goodsAddAuth", - "style": { - "navigationBarTitleText":"商品权证认证" - } + "path": "pages/goods/goodsAuth", + "name": "goodsAddAuth", + "style": { + "navigationBarTitleText": "商品权证认证" + } }, { - "path": "pages/coupons/management", - "name": "couponsManagement", - "style": { - "navigationBarTitleText":"优惠券管理" - } + "path": "pages/coupons/management", + "name": "couponsManagement", + "style": { + "navigationBarTitleText": "创建优惠券" + } }, { - "path": "pages/coupons/add", - "name": "couponsAdd", - "style": { - "navigationBarTitleText":"创建优惠券" - } + "path": "pages/coupons/add", + "name": "couponsAdd", + "style": { + "navigationBarTitleText": "创建优惠券" + } }, { - "path": "pages/coupons/magDetails", - "name": "couponsDetails", - "style": { - "navigationBarTitleText":"优惠券详情" - } + "path": "pages/coupons/magDetails", + "name": "couponsDetails", + "style": { + "navigationBarTitleText": "优惠券详情" + } }, { - "path": "pages/coupons/selectGoods", - "name": "couponsSelectGoods", - "style": { - "navigationBarTitleText":"关联产品" - } - }, { - "path": "pages/login/login", - "name": "Login", - "style": { - "navigationBarTitleText":"登录" - } - }, { - "path" : "pages/certification/personal", - "name" : "Personal", - "auth" : true, - "style": { - "navigationBarTitleText":"个人认证" - } + "path": "pages/coupons/selectGoods", + "name": "couponsSelectGoods", + "style": { + "navigationBarTitleText": "关联产品" + } + }, { + "path": "pages/login/login", + "name": "Login", + "style": { + "navigationBarTitleText": "登录" + } + }, { + "path": "pages/certification/personal", + "name": "Personal", + "auth": true, + "style": { + "navigationBarTitleText": "个人认证" + } + }, { + "path": "pages/setting/setting", + "name": "setting", + "auth": true, + "style": { + "navigationBarTitleText": "设置中心" + } + }, { + "path": "pages/setting/aboutUs", + "name": "aboutUs", + "auth": true, + "style": { + "navigationBarTitleText": "关于我们" + } }], "globalStyle": { "navigationStyle": "custom", "backgroundColor": "#F5F5F5" }, - "tabBar": { - "borderStyle": "white", - "backgroundColor": "#FFFFFF", - "selectedColor" : "#774ffd", - "iconWidth":"26px", - "spacing": "0", - "height":"60px", + "tabBar": { + "borderStyle": "white", + "backgroundColor": "#FFFFFF", + "selectedColor": "#774ffd", + "iconWidth": "26px", + "spacing": "0", + "height": "60px", "list": [{ - "text": "发现能量", - "iconPath":"static/tabBar/tabBar_icon_00.png", - "selectedIconPath":"static/tabBar/tabBar_show_00.png", + "text": "发现能量", + "iconPath": "static/tabBar/tabBar_icon_00.png", + "selectedIconPath": "static/tabBar/tabBar_show_00.png", "pagePath": "pages/index/index" }, { - "text": "发现更多", - "iconPath":"static/tabBar/tabBar_icon_01.png", - "selectedIconPath":"static/tabBar/tabBar_show_01.png", + "text": "发现更多", + "iconPath": "static/tabBar/tabBar_icon_01.png", + "selectedIconPath": "static/tabBar/tabBar_show_01.png", "pagePath": "pages/found/index" }, { - "text": "节点中心", - "iconPath":"static/tabBar/tabBar_icon_02.png", - "selectedIconPath":"static/tabBar/tabBar_show_02.png", + "text": "节点中心", + "iconPath": "static/tabBar/tabBar_icon_02.png", + "selectedIconPath": "static/tabBar/tabBar_show_02.png", "pagePath": "pages/user/index" }] }, diff --git a/pages/certification/personal.vue b/pages/certification/personal.vue index 227847d..33ffa42 100644 --- a/pages/certification/personal.vue +++ b/pages/certification/personal.vue @@ -73,9 +73,16 @@ front_card: this.positive.path, back_card: this.reverse.path, }).then(res=>{ - console.log(res) + uni.showModal({ + title: '提示', + content: '个人认证信息已提交,请耐心等待审核', + showCancel: false, + confirmColor: '#8b64fd', + success: modalRes => { + this.$Router.back() + } + }) }).catch(err => { - console.log(err) uni.showToast({ icon: 'none', title: err.message diff --git a/pages/found/index.vue b/pages/found/index.vue index 9d93727..706aafc 100644 --- a/pages/found/index.vue +++ b/pages/found/index.vue @@ -1,549 +1,549 @@ - - - - - + + + + + diff --git a/pages/goods/add.vue b/pages/goods/add.vue index 441f033..02c9fb6 100644 --- a/pages/goods/add.vue +++ b/pages/goods/add.vue @@ -1,4 +1,4 @@ - diff --git a/public/date.js b/public/date.js index ca30b41..abb6103 100644 --- a/public/date.js +++ b/public/date.js @@ -1,9 +1,9 @@ -/** - * Web唐明明 - * 匆匆数载恍如梦,岁月迢迢华发增。 - * 碌碌无为枉半生,一朝惊醒万事空。 - * moduleName: 日期 +/** + * Web唐明明 + * 匆匆数载恍如梦,岁月迢迢华发增。 + * 碌碌无为枉半生,一朝惊醒万事空。 + * moduleName: 日期 */ export default getDate = (type) =>{ diff --git a/public/userAuth.js b/public/userAuth.js index 2349145..fd9b22b 100644 --- a/public/userAuth.js +++ b/public/userAuth.js @@ -1,16 +1,16 @@ -/** - * Web唐明明 - * 匆匆数载恍如梦,岁月迢迢华发增。 - * 碌碌无为枉半生,一朝惊醒万事空。 - * moduleName: 登录 +/** + * Web唐明明 + * 匆匆数载恍如梦,岁月迢迢华发增。 + * 碌碌无为枉半生,一朝惊醒万事空。 + * moduleName: 登录 */ import { router } from '../router' import { keyAuth } from '../apis/interfaces/auth' import store from '../store' -class userAuth { +class userAuth { constructor() { this.univerfyConfig = { fullScreen : true, @@ -130,6 +130,6 @@ class userAuth { updAuthToken(){ } -} - +} + export default userAuth diff --git a/scss/globa.scss b/scss/globa.scss index 2876f60..6966e36 100644 --- a/scss/globa.scss +++ b/scss/globa.scss @@ -10,7 +10,7 @@ $text-color: #333; $text-gray: #555; $text-gray-m: #999; $text-price: #8b64fd; -$mian-color: #8b64fd; +$mian-color: #b11eff; $mian-color-deep: #824f9a; // 边框颜色 diff --git a/static/imgs/company-icon.png b/static/imgs/company-icon.png new file mode 100644 index 0000000..ad8e0f4 Binary files /dev/null and b/static/imgs/company-icon.png differ diff --git a/static/imgs/link-wechat.png b/static/imgs/link-wechat.png new file mode 100644 index 0000000..2775884 Binary files /dev/null and b/static/imgs/link-wechat.png differ diff --git a/static/imgs/mine-about.png b/static/imgs/mine-about.png new file mode 100644 index 0000000..88cca13 Binary files /dev/null and b/static/imgs/mine-about.png differ diff --git a/static/imgs/mine-self-name.png b/static/imgs/mine-self-name.png new file mode 100644 index 0000000..d527b4c Binary files /dev/null and b/static/imgs/mine-self-name.png differ diff --git a/static/imgs/no-avatar.png b/static/imgs/no-avatar.png new file mode 100644 index 0000000..5ebdf71 Binary files /dev/null and b/static/imgs/no-avatar.png differ diff --git a/static/imgs/reset-info.png b/static/imgs/reset-info.png new file mode 100644 index 0000000..06e2ea6 Binary files /dev/null and b/static/imgs/reset-info.png differ diff --git a/static/imgs/self-icon.png b/static/imgs/self-icon.png new file mode 100644 index 0000000..09c8644 Binary files /dev/null and b/static/imgs/self-icon.png differ diff --git a/static/imgs/top_bg.png b/static/imgs/top_bg.png new file mode 100644 index 0000000..6f9be4a Binary files /dev/null and b/static/imgs/top_bg.png differ diff --git a/static/imgs/top_logo.png b/static/imgs/top_logo.png new file mode 100644 index 0000000..5f56a8f Binary files /dev/null and b/static/imgs/top_logo.png differ diff --git a/static/imgs/user-avatar.png b/static/imgs/user-avatar.png new file mode 100644 index 0000000..8f95acc Binary files /dev/null and b/static/imgs/user-avatar.png differ diff --git a/uni_modules/lime-f2/changelog.md b/uni_modules/lime-f2/changelog.md index f565cda..d96c8d1 100644 --- a/uni_modules/lime-f2/changelog.md +++ b/uni_modules/lime-f2/changelog.md @@ -6,18 +6,18 @@ ## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) ## 0.4.9(2021-05-12) - fix: 修复 百度平台 多个图表时 只生效一个的bug -## 0.4.8(2021-05-10) -- feat: 增加 `destroy` 方法,用于销毁实例 -- feat: 增加 `canvasToTempFilePath` 方法,用于生成图片 -```js -this.$refs.chart.canvasToTempFilePath({success: res => { - console.log('tempFilePath:', res.tempFilePath) -}}) -``` -## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) - -## 0.4.7(2021-05-10) -- chore: F2 版本更新至 3.8.7 +## 0.4.8(2021-05-10) +- feat: 增加 `destroy` 方法,用于销毁实例 +- feat: 增加 `canvasToTempFilePath` 方法,用于生成图片 +```js +this.$refs.chart.canvasToTempFilePath({success: res => { + console.log('tempFilePath:', res.tempFilePath) +}}) +``` +## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) + +## 0.4.7(2021-05-10) +- chore: F2 版本更新至 3.8.7 ## 0.4.6(2021-05-05) - docs: nvue 使用文档更新 ## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example) diff --git a/uni_modules/lime-f2/components/lime-f2/canvas.js b/uni_modules/lime-f2/components/lime-f2/canvas.js index e747e3a..0e107e5 100644 --- a/uni_modules/lime-f2/components/lime-f2/canvas.js +++ b/uni_modules/lime-f2/components/lime-f2/canvas.js @@ -1,121 +1,121 @@ -import { - pixelRatio, - sleep -} from './utils'; - -const UNI_CANVAS_CONTEXT_MAP = { - // #ifndef MP-WEIXIN - fillStyle: 'FillStyle', - fontSize: 'FontSize', - globalAlpha: 'GlobalAlpha', - opacity: 'GlobalAlpha', - lineCap: 'LineCap', - lineJoin: 'LineJoin', - lineWidth: 'LineWidth', - miterLimit: 'MiterLimit', - strokeStyle: 'StrokeStyle', - textAlign: 'TextAlign', - textBaseline: 'TextBaseline', - shadow: 'Shadow', - // #endif - // #ifdef MP-TOUTIAO || H5 || APP-PLUS - font: 'FontSize', - // #endif -}; - -function strLen(str) { - let len = 0; - for (let i = 0; i < str.length; i++) { - if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) { - len++; - } else { - len += 2; - } - } - return len; -} - -// 头条小程序目前仅支持 setFontSize -// f2 会将所有属性整合为 font 简写,从中提取 fontSize 支持 -const fontSizeReg = /(\d*\.?\d*)px/; -const colorReg = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\b/g; -export default (ctx) => { - // #ifdef H5 || APP-PLUS - ctx.uniTransform = ctx.transform - ctx.transform = (...agrs) => { - if (ctx.draw && agrs[6]) { - agrs[4] *= pixelRatio - agrs[5] *= pixelRatio - } - if (agrs.length > 6) { - agrs.pop() - } - ctx.uniTransform(...agrs) - } - // #endif - // #ifdef MP-ALIPAY - ctx.canvasGetImageData = ctx.getImageData - ctx.getImageData = null - // #endif - if (!ctx.getImageData) { - ctx.getImageData = (...agrs) => { - const [x, y, width, height] = agrs - return new Promise(resolve => { - const parms = { - canvasId: ctx.id || ctx.canvasId, - x, - y, - width, - height, - success: res => { - resolve(res.data) - } - } - // #ifndef MP-ALIPAY || MP-TOUTIAO - uni.canvasGetImageData(parms) - // #endif - // #ifdef MP-ALIPAY || MP-TOUTIAO - ctx.canvasGetImageData(parms) - // #endif - }) - } - } - // 钉钉小程序框架不支持 measureText 方法,用此方法 mock - if (!ctx.measureText) { - ctx.measureText = text => { - let fontSize = 12; - const font = ctx.__font; - if (font) { - fontSize = parseInt(font.split(' ')[3], 10); - } - fontSize /= 2; - return { - width: strLen(text) * fontSize - }; - } - } - Object.keys(UNI_CANVAS_CONTEXT_MAP).forEach(key => { - Object.defineProperty(ctx, key, { - set(val) { - const name = `set${UNI_CANVAS_CONTEXT_MAP[key]}`; - if (!ctx[name]) { - return; - } - if (key === 'font' && fontSizeReg.test(val)) { - const match = fontSizeReg.exec(val); - ctx[name](match[1]); - return; - } - if (key === 'shadow' && Array.isArray(val)) { - ctx[name](...val); - return; - } - if(colorReg.test(val)) { - val = val.replace(colorReg, '#$1$1$2$2$3$3') - } - ctx[name](val); - } - }); - }); - return ctx +import { + pixelRatio, + sleep +} from './utils'; + +const UNI_CANVAS_CONTEXT_MAP = { + // #ifndef MP-WEIXIN + fillStyle: 'FillStyle', + fontSize: 'FontSize', + globalAlpha: 'GlobalAlpha', + opacity: 'GlobalAlpha', + lineCap: 'LineCap', + lineJoin: 'LineJoin', + lineWidth: 'LineWidth', + miterLimit: 'MiterLimit', + strokeStyle: 'StrokeStyle', + textAlign: 'TextAlign', + textBaseline: 'TextBaseline', + shadow: 'Shadow', + // #endif + // #ifdef MP-TOUTIAO || H5 || APP-PLUS + font: 'FontSize', + // #endif +}; + +function strLen(str) { + let len = 0; + for (let i = 0; i < str.length; i++) { + if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) { + len++; + } else { + len += 2; + } + } + return len; +} + +// 头条小程序目前仅支持 setFontSize +// f2 会将所有属性整合为 font 简写,从中提取 fontSize 支持 +const fontSizeReg = /(\d*\.?\d*)px/; +const colorReg = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\b/g; +export default (ctx) => { + // #ifdef H5 || APP-PLUS + ctx.uniTransform = ctx.transform + ctx.transform = (...agrs) => { + if (ctx.draw && agrs[6]) { + agrs[4] *= pixelRatio + agrs[5] *= pixelRatio + } + if (agrs.length > 6) { + agrs.pop() + } + ctx.uniTransform(...agrs) + } + // #endif + // #ifdef MP-ALIPAY + ctx.canvasGetImageData = ctx.getImageData + ctx.getImageData = null + // #endif + if (!ctx.getImageData) { + ctx.getImageData = (...agrs) => { + const [x, y, width, height] = agrs + return new Promise(resolve => { + const parms = { + canvasId: ctx.id || ctx.canvasId, + x, + y, + width, + height, + success: res => { + resolve(res.data) + } + } + // #ifndef MP-ALIPAY || MP-TOUTIAO + uni.canvasGetImageData(parms) + // #endif + // #ifdef MP-ALIPAY || MP-TOUTIAO + ctx.canvasGetImageData(parms) + // #endif + }) + } + } + // 钉钉小程序框架不支持 measureText 方法,用此方法 mock + if (!ctx.measureText) { + ctx.measureText = text => { + let fontSize = 12; + const font = ctx.__font; + if (font) { + fontSize = parseInt(font.split(' ')[3], 10); + } + fontSize /= 2; + return { + width: strLen(text) * fontSize + }; + } + } + Object.keys(UNI_CANVAS_CONTEXT_MAP).forEach(key => { + Object.defineProperty(ctx, key, { + set(val) { + const name = `set${UNI_CANVAS_CONTEXT_MAP[key]}`; + if (!ctx[name]) { + return; + } + if (key === 'font' && fontSizeReg.test(val)) { + const match = fontSizeReg.exec(val); + ctx[name](match[1]); + return; + } + if (key === 'shadow' && Array.isArray(val)) { + ctx[name](...val); + return; + } + if(colorReg.test(val)) { + val = val.replace(colorReg, '#$1$1$2$2$3$3') + } + ctx[name](val); + } + }); + }); + return ctx } diff --git a/uni_modules/lime-f2/components/lime-f2/index.vue b/uni_modules/lime-f2/components/lime-f2/index.vue index 94bcf5a..8e3ef78 100644 --- a/uni_modules/lime-f2/components/lime-f2/index.vue +++ b/uni_modules/lime-f2/components/lime-f2/index.vue @@ -1,417 +1,417 @@ - - + + diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js index a747b9f..6ef26a2 100644 --- a/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js +++ b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js @@ -1,45 +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 +// #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 index 7c8a0d3..291634c 100644 --- 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 @@ -1,263 +1,263 @@ - - - - - + + + + + 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 index f6bbccd..f4c85e2 100644 --- 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 @@ -1,143 +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 index 3d9365a..705902d 100644 --- 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 @@ -1,185 +1,185 @@ - - - - + + + + diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/en.json b/uni_modules/uni-popup/components/uni-popup/i18n/en.json index 8c0f5f3..7f1bd06 100644 --- a/uni_modules/uni-popup/components/uni-popup/i18n/en.json +++ b/uni_modules/uni-popup/components/uni-popup/i18n/en.json @@ -1,6 +1,6 @@ -{ - "uni-popup.cancel": "cancel", - "uni-popup.ok": "ok", +{ + "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 index fa8f0f3..de7509c 100644 --- a/uni_modules/uni-popup/components/uni-popup/i18n/index.js +++ b/uni_modules/uni-popup/components/uni-popup/i18n/index.js @@ -1,8 +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 +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 index 8e5b99f..5e3003c 100644 --- a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json +++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json @@ -1,7 +1,7 @@ -{ - "uni-popup.cancel": "取消", +{ + "uni-popup.cancel": "取消", "uni-popup.ok": "确定", "uni-popup.placeholder": "请输入", "uni-popup.title": "提示", - "uni-popup.shareTitle": "分享到" + "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 index 06ce162..13e39eb 100644 --- a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json +++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json @@ -1,7 +1,7 @@ -{ - "uni-popup.cancel": "取消", +{ + "uni-popup.cancel": "取消", "uni-popup.ok": "確定", "uni-popup.placeholder": "請輸入", "uni-popup.title": "提示", - "uni-popup.shareTitle": "分享到" + "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 index 16a5818..62dda46 100644 --- a/uni_modules/uni-popup/components/uni-popup/keypress.js +++ b/uni_modules/uni-popup/components/uni-popup/keypress.js @@ -1,45 +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 +// #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 index a37fb9f..c4e5781 100644 --- a/uni_modules/uni-popup/components/uni-popup/popup.js +++ b/uni_modules/uni-popup/components/uni-popup/popup.js @@ -1,9 +1,9 @@ -export default { - data() { - return { - - } +export default { + data() { + return { + + } }, created(){ this.popup = this.getParent() @@ -22,5 +22,5 @@ export default { } 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 index 32419d8..59698b7 100644 --- a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue +++ b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue @@ -1,240 +1,240 @@ -