更新:登录功能

This commit is contained in:
2025-11-04 12:37:04 +08:00
commit a21fb92916
897 changed files with 51500 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
@import "../common/abstracts/variable";
@import "../common/abstracts/mixin";
.wot-theme-dark {
@include b(password-input) {
@include e(item) {
color: $-dark-color;
background: $-dark-background2;
@include when(border) {
border-color: $-dark-border-color;
}
}
@include e(mask) {
background-color: $-dark-color;
}
@include e(cursor) {
background-color: $-dark-color;
}
@include e(info) {
color: $-dark-color;
@include when(border) {
color: $-dark-color2;
}
}
}
}
@include b(password-input) {
position: relative;
margin: 0 $-password-input-margin;
user-select: none;
@include e(security) {
display: flex;
width: 100%;
height: $-password-input-height;
cursor: pointer;
}
@include e(item) {
position: relative;
display: flex;
flex: 1;
align-items: center;
justify-content: center;
height: 100%;
color: $-password-input-text-color;
font-size: $-password-input-font-size;
line-height: 1.2;
background: $-password-input-background;
@include when(border) {
border: 1px solid $-password-input-border-color;
&:not(:last-child) {
border-right: none;
}
&:first-child {
border-top-left-radius: $-password-input-radius;
border-bottom-left-radius: $-password-input-radius;
}
&:last-child {
border-top-right-radius: $-password-input-radius;
border-bottom-right-radius: $-password-input-radius;
}
}
}
@include e(mask) {
position: absolute;
top: 50%;
left: 50%;
width: $-password-input-dot-size;
height: $-password-input-dot-size;
background: $-password-input-dot-color;
border-radius: 100%;
transform: translate(-50%, -50%);
visibility: hidden;
}
@include e(cursor) {
position: absolute;
top: 50%;
left: 50%;
width: $-password-input-cursor-width;
height: $-password-input-cursor-height;
background: $-password-input-cursor-color;
transform: translate(-50%, -50%);
animation: $-password-input-cursor-duration cursor-flicker infinite;
}
@include e(info) {
margin-top: $-password-input-margin;
font-size: $-password-input-info-font-size;
text-align: center;
color: $-password-input-info-color;
@include when(error) {
color: $-password-input-error-info-color;
}
}
}
@keyframes cursor-flicker {
from {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}

View File

@@ -0,0 +1,42 @@
/*
* @Author: weisheng
* @Date: 2024-03-15 20:40:34
* @LastEditTime: 2024-03-18 15:12:17
* @LastEditors: weisheng
* @Description:
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-password-input\types.ts
* 记得注释
*/
import { baseProps, makeBooleanProp, makeNumberProp, makeNumericProp, makeStringProp } from '../common/props'
export const passwordInputProps = {
...baseProps,
/**
* 绑定的值
*/
modelValue: makeStringProp(''),
/**
* 是否隐藏密码内容
*/
mask: makeBooleanProp(true),
/**
* 输入框下方文字提示
*/
info: makeStringProp(''),
/**
* 输入框下方错误提示
*/
errorInfo: makeStringProp(''),
/**
* 输入框格子之间的间距,如 20px 2em默认单位为 px
*/
gutter: makeNumericProp(0),
/**
* 密码最大长度
*/
length: makeNumberProp(6),
/**
* 是否已聚焦,聚焦时会显示光标
*/
focused: makeBooleanProp(true)
}

View File

@@ -0,0 +1,49 @@
<template>
<view :class="`wd-password-input ${customClass}`" :style="customStyle">
<view @touchstart="onTouchStart" class="wd-password-input__security">
<view
v-for="(_, index) in length"
:key="index"
:class="`wd-password-input__item ${gutter ? '' : 'is-border'}`"
:style="{ marginLeft: index !== 0 && gutter ? addUnit(gutter) : 0 }"
>
<view v-if="focused && index === modelValue.length" class="wd-password-input__cursor"></view>
<view v-else :class="`wd-password-input__value`">
<view :style="{ visibility: mask && modelValue[index] ? 'visible' : 'hidden' }" class="wd-password-input__mask"></view>
<text v-if="!mask && modelValue[index]">{{ modelValue[index] }}</text>
</view>
</view>
</view>
<view v-if="info || errorInfo" :class="`wd-password-input__info ${errorInfo ? 'is-error' : ''}`">
{{ errorInfo || info }}
</view>
</view>
</template>
<script lang="ts">
export default {
name: 'wd-password-input',
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: 'shared'
}
}
</script>
<script lang="ts" setup>
import { addUnit } from '../common/util'
import { passwordInputProps } from './types'
defineProps(passwordInputProps)
const emit = defineEmits(['focus'])
function onTouchStart(event: Event) {
emit('focus', event)
}
</script>
<style lang="scss" scoped>
@import './index.scss';
</style>