更新:登录功能

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,89 @@
@import '../common/abstracts/variable';
@import '../common/abstracts/mixin';
.wot-theme-dark {
@include b(sort-button) {
@include e(wrapper) {
color: $-dark-color;
}
}
}
@include b(sort-button) {
display: inline-block;
height: $-sort-button-height;
line-height: $-sort-button-height;
@include m(line) {
.wd-sort-button__left {
&::after {
position: absolute;
content: '';
width: 19px;
height: 3px;
bottom: 6px;
left: 50%;
transform: translate(-50%, 0);
background: $-sort-button-line-color;
border-radius: calc($-sort-button-line-height / 2);
transition: opacity .15s;
opacity: 0;
}
&.is-active::after {
opacity: 1;
}
}
}
@include e(wrapper) {
font-size: $-sort-button-fs;
color: $-sort-button-color;
word-break: break-all;
white-space: nowrap;
}
@include e(left) {
position: relative;
display: inline-block;
vertical-align: middle;
@include when(active) {
font-weight: $-fw-medium;
.wd-sort-button__right {
justify-content: center;
}
}
}
@include e(right) {
display: inline-block;
min-width: 14px;
margin-left: 2px;
vertical-align: middle;
line-height: 1.1;
@include when(active) {
:deep(.wd-sort-button__icon-up),
:deep(.wd-sort-button__icon-down) {
transform: scale(calc((10 / 14)));
}
}
}
@include edeep(icon-up) {
display: block !important;
line-height: 1.1;
transform: scale(calc((10 / 14))) translate(0, 7px);
}
@include edeep(icon-down) {
display: block !important;
line-height: 1.1;
transform: scale(calc((10 / 14))) translate(0, -7px);
}
}

View File

@@ -0,0 +1,43 @@
import type { ExtractPropTypes } from 'vue'
import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../common/props'
export const sortButtonProps = {
...baseProps,
/**
* 选中的箭头方向1表示升序0表示重置状态-1表示降序。
* 类型: number
* 可选值: -1, 0, 1
* 默认值: 0或-1根据具体实现可能有所不同
*/
modelValue: makeNumberProp(0),
/**
* 排序按钮展示的文案。
* 类型: string
* 默认值: ''
*/
title: makeStringProp(''),
/**
* 当展示双箭头时,是否允许手动重置按钮。
* 类型: boolean
* 默认值: false
*/
allowReset: makeBooleanProp(false),
/**
* 是否优先切换为降序,如果不开启则默认优先切换为升序。
* 类型: boolean
* 默认值: false
*/
descFirst: makeBooleanProp(false),
/**
* 是否展示下划线,当只有一个排序按钮时,通常不展示下划线。
* 类型: boolean
* 默认值: true
*/
line: makeBooleanProp(true)
}
export type SortButtonProps = ExtractPropTypes<typeof sortButtonProps>

View File

@@ -0,0 +1,69 @@
<template>
<view :class="`wd-sort-button ${line ? 'wd-sort-button--line' : ''} ${customClass}`" :style="customStyle" @click="handleClick">
<view class="wd-sort-button__wrapper">
<view :class="`wd-sort-button__left ${modelValue !== 0 ? 'is-active' : ''}`">
{{ title }}
</view>
<view :class="`wd-sort-button__right ${modelValue !== 0 ? 'is-active' : ''}`">
<wd-icon v-if="modelValue !== 1" name="arrow-up" custom-class="wd-sort-button__icon-up" />
<wd-icon v-if="modelValue !== -1" name="arrow-down" custom-class="wd-sort-button__icon-down" />
</view>
</view>
</view>
</template>
<script lang="ts">
export default {
name: 'wd-sort-button',
options: {
addGlobalClass: true,
virtualHost: true,
styleIsolation: 'shared'
}
}
</script>
<script lang="ts" setup>
import wdIcon from '../wd-icon/wd-icon.vue'
import { sortButtonProps } from './types'
const props = defineProps(sortButtonProps)
const emit = defineEmits(['change', 'update:modelValue'])
function handleClick() {
let { modelValue: value, allowReset, descFirst } = props
if (descFirst) {
if (value === 0) {
value = -1
} else if (value === -1) {
value = 1
} else if (value === 1) {
if (allowReset) {
value = 0
} else {
value = -1
}
}
} else {
if (value === 0) {
value = 1
} else if (value === 1) {
value = -1
} else if (value === -1) {
if (allowReset) {
value = 0
} else {
value = 1
}
}
}
emit('update:modelValue', value)
emit('change', {
value
})
}
</script>
<style lang="scss" scoped>
@import './index.scss';
</style>