2023-08-24 15:50:37 +08:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Window 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import FluentUI 1.0
|
2023-08-18 11:46:02 +08:00
|
|
|
import "qrc:///example/qml/component"
|
2023-08-26 17:20:30 +08:00
|
|
|
import "../component"
|
2023-08-18 11:46:02 +08:00
|
|
|
|
|
|
|
FluScrollablePage{
|
|
|
|
|
|
|
|
title:"Captcha"
|
|
|
|
|
|
|
|
FluCaptcha{
|
|
|
|
id:captcha
|
|
|
|
Layout.topMargin: 20
|
2023-09-13 15:11:22 +08:00
|
|
|
ignoreCase:switch_case.checked
|
2023-08-18 11:46:02 +08:00
|
|
|
MouseArea{
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
|
|
|
captcha.refresh()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FluButton{
|
|
|
|
text:"Refresh"
|
|
|
|
Layout.topMargin: 20
|
|
|
|
onClicked: {
|
|
|
|
captcha.refresh()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-13 15:11:22 +08:00
|
|
|
FluToggleSwitch{
|
|
|
|
id:switch_case
|
|
|
|
text:"Ignore Case"
|
|
|
|
checked: true
|
|
|
|
Layout.topMargin: 10
|
|
|
|
}
|
|
|
|
|
2023-08-18 11:46:02 +08:00
|
|
|
RowLayout{
|
|
|
|
spacing: 10
|
|
|
|
Layout.topMargin: 10
|
|
|
|
FluTextBox{
|
|
|
|
id:text_box
|
|
|
|
placeholderText: "请输入验证码"
|
2023-11-24 22:05:53 +08:00
|
|
|
Layout.preferredWidth: 240
|
2023-08-18 11:46:02 +08:00
|
|
|
}
|
|
|
|
FluButton{
|
|
|
|
text:"verify"
|
|
|
|
onClicked: {
|
|
|
|
var success = captcha.verify(text_box.text)
|
|
|
|
if(success){
|
|
|
|
showSuccess("验证码正确")
|
|
|
|
}else{
|
|
|
|
showError("错误验证,请重新输入")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|