Skip to content

Commit

Permalink
feat: 键盘增加0,00键可替换
Browse files Browse the repository at this point in the history
  • Loading branch information
qifeng0748 committed Oct 11, 2023
1 parent 3c5b59f commit 3921655
Show file tree
Hide file tree
Showing 18 changed files with 220 additions and 136 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
title: Change Log
toc: hidden
---
### 2.6.2

`2023-08-24`

- Feature
- `NumberKeyboard`
- `professional` type keyboard `text-render` replacement key increased `0, 00`

- Fix
- `Icon`
- Fixed the default size error in SVG format

### 2.6.1

`2022-02-02`
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@ title: 更新日志
toc: hidden
---

### 2.6.2

`2023-08-24`

- Feature
- `NumberKeyboard`
- `professional` 类型键盘 `text-render`替换键增加 `0, 00`
- Fix
- `Icon`
- 修复 SVG 格式下,默认尺寸错误的问题

### 2.6.1

`2022-02-02`
`2023-02-02`

- Design
- 🍭金融设计规范更新
Expand Down
10 changes: 5 additions & 5 deletions components/activity-indicator/component.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
"name": "activity-indicator",
"text": "活动指示器",
"category": "basic",
"description": "",
"author": "xuxiaoyan"
'name': 'activity-indicator',
'text': '活动指示器',
'category': 'basic',
'description': '',
'author': 'xuxiaoyan'
}
10 changes: 5 additions & 5 deletions components/bill/component.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
"name": "bill",
"text": "票据",
"category": "business",
"description": "",
"author": "xuxiaoyan"
'name': 'bill',
'text': '票据',
'category': 'business',
'description': '',
'author': 'xuxiaoyan'
}
75 changes: 32 additions & 43 deletions components/captcha/demo/cases/demo2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,12 @@
</div>
</template>

<script>
import {
Button,
Toast,
Captcha,
InputItem,
Field,
FieldItem,
Switch,
Dialog
} from "mand-mobile";
<script>import {Button, Toast, Captcha, InputItem, Field, FieldItem, Switch, Dialog} from 'mand-mobile'
export default {
name: "captcha-demo",
name: 'captcha-demo',
/* DELETE */
title: "半屏自定义",
titleEnUS: "Customize",
title: '半屏自定义',
titleEnUS: 'Customize',
height: 650,
/* DELETE */
components: {
Expand All @@ -88,19 +78,18 @@ export default {
[Field.name]: Field,
[FieldItem.name]: FieldItem,
[Switch.name]: Switch,
[Dialog.name]: Dialog
[Dialog.name]: Dialog,
},
data() {
return {
show: false,
appendTo:
document.querySelector(".doc-demo-box-priview") || document.body,
appendTo: document.querySelector('.doc-demo-box-priview') || document.body,
title: '输入短信验证码 完成验证',
subtitle: '用于核验信息有效性及确定本人操作',
content: '验证码已发送至 186****5407',
countNormalText: '发送验证码',
limit: true,
maxlength: "4",
maxlength: '4',
mask: false,
system: true,
useSendTimes: 3,
Expand All @@ -111,66 +100,66 @@ export default {
btns: [
{
text: '我知道了',
handler: this.onConfirm
}
]
}
};
handler: this.onConfirm,
},
],
},
}
},
methods: {
next() {
this.show = true;
this.show = true
},
submit(val) {
const max = parseFloat(this.maxlength);
const max = parseFloat(this.maxlength)
setTimeout(() => {
if (!this.limit || max < 0 || val.length === max) {
if (val !== "1234") {
this.$refs.captcha.setError("验证码错误,请重新输入");
if (val !== '1234') {
this.$refs.captcha.setError('验证码错误,请重新输入')
} else {
this.show = false;
this.show = false
Toast({
content: `你输入了${val}`
});
content: `你输入了${val}`,
})
}
}
}, 300);
}, 300)
},
onSend(cb) {
// -------- 发送验证码成功 -------
// 修改按钮文字
if (this.sendTimes === 0) {
this.countNormalText = '重新发送'
}
this.sendTimes += 1;
this.sendTimes += 1
if (this.sendTimes > this.useSendTimes) {
this.disableSend = true
this.$refs.captcha.setError("发送次数已用完,请一小时后再试");
this.$refs.captcha.setError('发送次数已用完,请一小时后再试')
return
}
const difference = this.useSendTimes - this.sendTimes
if(this.sendTimes > 1 && difference !== 0) {
if (this.sendTimes > 1 && difference !== 0) {
Toast({
content: `您还可以重发${difference}`
});
content: `您还可以重发${difference}`,
})
}
// 倒计时开始
cb()
console.log("click resend button.");
console.log('click resend button.')
},
onShow() {},
onHide() {
// this.show = false;
},
hintHandle() {
this.dialogConfig.open = true;
this.dialogConfig.open = true
},
onConfirm() {
this.dialogConfig.open = false;
}
}
};
</script>
this.dialogConfig.open = false
},
},
}
</script>

<style lang="stylus">
.md-example-child-captcha
Expand Down
62 changes: 29 additions & 33 deletions components/captcha/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,9 @@
</div>
</template>

<script>
import Dialog from '../dialog'
import Popup from "../popup";
import PopupTitlebar from "../popup/title-bar";
<script>import Dialog from '../dialog'
import Popup from '../popup'
import PopupTitlebar from '../popup/title-bar'
import Codebox from '../codebox'
import Button from '../button'
import {mdDocument} from '../_util'
Expand All @@ -163,7 +162,7 @@ export default {
type: String,
},
subtitle: {
type: String
type: String,
},
brief: {
type: String,
Expand Down Expand Up @@ -214,16 +213,16 @@ export default {
},
type: {
type: String,
default: "dialog"
default: 'dialog',
},
inputType: {
type: String,
default: 'tel',
},
disableSend: {
type: Boolean,
default: false
}
default: false,
},
},
data() {
Expand All @@ -235,8 +234,8 @@ export default {
firstShown: false,
countBtnText: this.countNormalText,
isKeyboard: false,
originHeight: 0
};
originHeight: 0,
}
},
watch: {
Expand All @@ -257,19 +256,18 @@ export default {
},
computed: {
isInline() {
return this.isView || this.type === "inline";
return this.isView || this.type === 'inline'
},
isShowErrorStyle() {
return this.errorMsg !== "" && !this.disableSend;
}
return this.errorMsg !== '' && !this.disableSend
},
},
mounted() {
// Andriod 键盘收起:Andriod 键盘弹起或收起页面高度会发生变化,以此为依据获知键盘收起
if (this.judgeDeviceType().isAndroid && this.type === "halfScreen") {
if (this.judgeDeviceType().isAndroid && this.type === 'halfScreen') {
// 记录初始高度
this.originHeight =
document.documentElement.clientHeight || document.body.clientHeight;
window.addEventListener("resize", this.listenResize, false);
this.originHeight = document.documentElement.clientHeight || document.body.clientHeight
window.addEventListener('resize', this.listenResize, false)
}
if (this.appendTo && !this.isInline) {
this.appendTo.appendChild(this.$el)
Expand All @@ -281,8 +279,8 @@ export default {
},
beforeDestroy() {
if (this.judgeDeviceType().isAndroid && this.type === "halfScreen") {
window.removeEventListener("resize", this.listenResize);
if (this.judgeDeviceType().isAndroid && this.type === 'halfScreen') {
window.removeEventListener('resize', this.listenResize)
}
if (this.appendTo && !this.isInline) {
this.appendTo.removeChild(this.$el)
Expand Down Expand Up @@ -318,24 +316,23 @@ export default {
},
// MARK: public methods
listenResize() {
let resizeHeight =
document.documentElement.clientHeight || document.body.clientHeight;
let resizeHeight = document.documentElement.clientHeight || document.body.clientHeight
if (this.originHeight < resizeHeight) {
this.isKeyboard = false;
this.isKeyboard = false
} else {
this.isKeyboard = true;
this.isKeyboard = true
}
this.originHeight = resizeHeight;
this.originHeight = resizeHeight
},
// 判断设备类型
judgeDeviceType() {
let ua = window.navigator.userAgent.toLocaleLowerCase();
let isIOS = /iphone|ipad|ipod/.test(ua);
let isAndroid = /android/.test(ua);
let ua = window.navigator.userAgent.toLocaleLowerCase()
let isIOS = /iphone|ipad|ipod/.test(ua)
let isAndroid = /android/.test(ua)
return {
isIOS: isIOS,
isAndroid: isAndroid
};
isAndroid: isAndroid,
}
},
countdown() {
if (!this.count) {
Expand Down Expand Up @@ -368,12 +365,11 @@ export default {
})
},
close() {
this.$emit("input", false)
}
this.$emit('input', false)
},
},
}
</script>
</script>

<style lang="stylus">
.md-captcha
Expand Down
Loading

0 comments on commit 3921655

Please sign in to comment.