更新:登录功能

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,19 @@
@import "./../common/abstracts/_mixin.scss";
@import "./../common/abstracts/variable.scss";
@include b(img) {
position: relative;
display: inline-block;
@include e(image) {
display: block;
width: 100%;
height: 100%;
box-sizing: border-box;
}
@include when(round) {
overflow: hidden;
border-radius: 50%;
}
}

View File

@@ -0,0 +1,61 @@
import { baseProps, makeBooleanProp, makeStringProp, numericProp } from '../common/props'
export type ImageMode =
| 'scaleToFill'
| 'aspectFit'
| 'aspectFill'
| 'widthFix'
| 'heightFix'
| 'top'
| 'bottom'
| 'center'
| 'left'
| 'right'
| 'top left'
| 'top right'
| 'bottom left'
| 'bottom right'
export const imgProps = {
...baseProps,
customImage: makeStringProp(''),
/**
* 图片链接
*/
src: String,
/**
* 预览图片链接
*/
previewSrc: String,
/**
* 是否显示为圆形
*/
round: makeBooleanProp(false),
/**
* 填充模式:'top left' / 'top right' / 'bottom left' / 'bottom right' / 'right' / 'left' / 'center' / 'bottom' / 'top' / 'heightFix' / 'widthFix' / 'aspectFill' / 'aspectFit' / 'scaleToFill'
*/
mode: makeStringProp<ImageMode>('scaleToFill'),
/**
* 是否懒加载
*/
lazyLoad: makeBooleanProp(false),
/**
* 宽度默认单位为px
*/
width: numericProp,
/**
* 高度默认单位为px
*/
height: numericProp,
/**
* 圆角大小默认单位为px
*/
radius: numericProp,
/**
* 是否允许预览
*/
enablePreview: makeBooleanProp(false),
/**
* 开启长按图片显示识别小程序码菜单,仅在微信小程序平台有效
*/
showMenuByLongpress: makeBooleanProp(false)
}

View File

@@ -0,0 +1,89 @@
<!--
* @Author: 810505339
* @Date: 2024-09-25 11:30:46
* @LastEditors: 810505339
* @LastEditTime: 2025-01-09 11:37:45
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-img\wd-img.vue
* 记得注释
-->
<template>
<view :class="rootClass" @click="handleClick" :style="rootStyle">
<image
:class="`wd-img__image ${customImage}`"
:style="status !== 'success' ? 'width: 0;height: 0;' : ''"
:src="src"
:mode="mode"
:show-menu-by-longpress="showMenuByLongpress"
:lazy-load="lazyLoad"
@load="handleLoad"
@error="handleError"
/>
<slot v-if="status === 'loading'" name="loading"></slot>
<slot v-if="status === 'error'" name="error"></slot>
</view>
</template>
<script lang="ts">
export default {
name: 'wd-img',
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: 'shared'
}
}
</script>
<script lang="ts" setup>
import { computed, ref } from 'vue'
import { addUnit, isDef, objToStyle } from '../common/util'
import { imgProps } from './types'
const props = defineProps(imgProps)
const emit = defineEmits<{
(e: 'error', event: Event): void
(e: 'click', event: MouseEvent): void
(e: 'load', event: Event): void
}>()
const rootStyle = computed(() => {
const style: Record<string, string | number> = {}
if (isDef(props.height)) {
style['height'] = addUnit(props.height)
}
if (isDef(props.width)) {
style['width'] = addUnit(props.width)
}
if (isDef(props.radius)) {
style['border-radius'] = addUnit(props.radius)
style['overflow'] = 'hidden'
}
return `${objToStyle(style)}${props.customStyle}`
})
const rootClass = computed(() => {
return `wd-img ${props.round ? 'is-round' : ''} ${props.customClass}`
})
const status = ref<'loading' | 'error' | 'success'>('loading')
function handleError(event: any) {
status.value = 'error'
emit('error', event)
}
function handleClick(event: MouseEvent) {
if (props.enablePreview && props.src && status.value == 'success') {
uni.previewImage({
urls: [props.previewSrc || props.src]
})
}
emit('click', event)
}
function handleLoad(event: any) {
status.value = 'success'
emit('load', event)
}
</script>
<style lang="scss" scoped>
@import './index.scss';
</style>