精简样式

This commit is contained in:
xiangheng
2024-06-06 13:35:44 +08:00
parent 4c8f516438
commit b3f9aa0962
7 changed files with 245 additions and 689 deletions

View File

@@ -3,7 +3,7 @@
import env from "@/utils/env"; import env from "@/utils/env";
let baseUrl =env.baseUrl+'/api/common'; let baseUrl =env.baseUrl+'/api/common';
export const myRequest = (option={})=>{ export const myRequest = (option):any=>{
return new Promise((reslove,reject)=>{ return new Promise((reslove,reject)=>{
uni.request({ uni.request({
url: baseUrl + option.url, url: baseUrl + option.url,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,32 +1,33 @@
<template> <template>
<view style="position: relative; touch-action: none; touch-action: pan-y"> <view style="position: relative; touch-action: none; touch-action: pan-y">
<view class="verify-img-out" :style="{ height: (parseInt(props.imgSize.height) + vSpace) + 'px' }"> <view class="verify-img-out" :style="{ height: (parseInt(props.imgSize.height) + props.vSpace) + 'px' }">
<view class="verify-img-panel" :style="{ <view class="verify-img-panel" :style="{
width: props.imgSize.width, width: props.imgSize.width+ 'px',
height: props.imgSize.height, height: props.imgSize.height+ 'px',
}"> }">
<img :src="data.backImgBase" style="width:100%;height:100%;display:block"></img> <image :src="data.backImgBase" style="width:100%;height:100%;display:block"></image>
<view class="verify-refresh" @click="refresh" v-show="data.showRefresh"> <view class="verify-refresh icon-refresh" @click="refresh" v-show="data.showRefresh">
<text class="iconfont icon-refresh"></text>
</view> </view>
<!-- <transition name="tips"> --> <!-- <transition name="tips"> -->
<text class="verify-tips" v-if="data.tipWords" :class="data.passFalg ? 'suc-bg' : 'err-bg'">{{ <text class="verify-tips" v-if="data.tipWords" :class="data.passFlag ? 'suc-bg' : 'err-bg'">{{
data.tipWords }}</text> data.tipWords }}</text>
<!-- </transition> --> <!-- </transition> -->
</view> </view>
</view> </view>
<!-- 公共部分 --> <!-- 公共部分 -->
<view class="verify-bar-area" :style="{ width: imgSize.width, height: '40px', 'line-height': '40px' }"> <view class="verify-bar-area" :style="{ width: props.imgSize.width+ 'px', height: '40px', 'line-height': '40px' }">
<text class="verify-msg" v-text="data.text"></text> <text class="verify-msg" v-text="data.text"></text>
<view class="verify-left-bar" <view class="verify-left-bar"
:style="{ width: data.leftBarWidth ? data.leftBarWidth : '40px', height: '40px', 'border-color': data.leftBarBorderColor, }"> :style="{ width: data.leftBarWidth ? data.leftBarWidth : '40px', height: '40px', 'border-color': data.leftBarBorderColor, }">
<text class="verify-msg" v-text="data.finishText"></text> <text class="verify-msg" v-text="data.finishText"></text>
<view class="verify-move-block" @touchstart="start" @mousedown="start" @touchend="end" @touchmove="move" <view class="verify-move-block" @touchstart="start" @mousedown="start" @touchend="end" @touchmove="move"
:style="{ width: '40px', height: '40px', 'background-color': data.moveBlockBackgroundColor, left: data.moveBlockLeft, transition: data.transitionLeft }"> :style="{ width: '40px', height: '40px', 'background-color': data.moveBlockBackgroundColor, left: data.moveBlockLeft, transition: data.transitionLeft }">
<text :class="['verify-icon iconfont', data.iconClass]" :style="{ color: data.iconColor }"></text> <text :class="['verify-icon', data.iconClass]" :style="{ color: data.iconColor }"></text>
<view class="verify-sub-block" :style="{ <view class="verify-sub-block" :style="{
'width': Math.floor(parseInt(props.imgSize.width) * 47 / 310) + 'px', 'width': Math.floor(parseInt(props.imgSize.width) * 47 / 310) + 'px',
'height': props.imgSize.height, 'height': props.imgSize.height,
@@ -39,7 +40,7 @@
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup lang="ts">
/** /**
* VerifySlide * VerifySlide
* @description 滑块 * @description 滑块
@@ -57,7 +58,10 @@ defineOptions({
let emit = defineEmits(['success', 'error']) let emit = defineEmits(['success', 'error'])
const props = defineProps({ const props = defineProps({
captchaType: String, captchaType: {
type: String,
default: ''
},
vSpace: { vSpace: {
type: Number, type: Number,
@@ -86,7 +90,7 @@ const props = defineProps({
// Data 定义 // Data 定义
const data = reactive({ const data = reactive({
secretKey: '', //后端返回的加密秘钥 字段 secretKey: '', //后端返回的加密秘钥 字段
passFalg: false, //请求通过与否 passFlag: false, //请求通过与否
backImgBase: '', //验证码背景图片 backImgBase: '', //验证码背景图片
blockBackImgBase: '', //验证滑块的背景图片 blockBackImgBase: '', //验证滑块的背景图片
backToken: "", //后端返回的唯一token值 backToken: "", //后端返回的唯一token值
@@ -248,7 +252,7 @@ const end = () => {
setTimeout(() => { setTimeout(() => {
refresh(); refresh();
}, 1000) }, 1000)
data.passFalg = true data.passFlag = true
data.tipWords = `${((data.endMovetime - data.startMoveTime) / 1000).toFixed(2)}s验证成功` data.tipWords = `${((data.endMovetime - data.startMoveTime) / 1000).toFixed(2)}s验证成功`
setTimeout(() => { setTimeout(() => {
data.tipWords = "" data.tipWords = ""
@@ -261,7 +265,7 @@ const end = () => {
data.leftBarBorderColor = '#d9534f' data.leftBarBorderColor = '#d9534f'
data.iconColor = '#fff' data.iconColor = '#fff'
data.iconClass = 'icon-close' data.iconClass = 'icon-close'
data.passFalg = false data.passFlag = false
setTimeout(() => { setTimeout(() => {
refresh(); refresh();
}, 1000); }, 1000);
@@ -565,14 +569,6 @@ onMounted(() => {
z-index: 3; z-index: 3;
} }
/*字体图标的css*/
/*@font-face {font-family: "iconfont";*/
/*src: url('../fonts/iconfont.eot?t=1508229193188'); !* IE9*!*/
/*src: url('../fonts/iconfont.eot?t=1508229193188#iefix') format('embedded-opentype'), !* IE6-IE8 *!*/
/*url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAaAAAsAAAAACUwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZW7kiSY21hcAAAAYAAAAB3AAABuM+qBlRnbHlmAAAB+AAAAnQAAALYnrUwT2hlYWQAAARsAAAALwAAADYPNwajaGhlYQAABJwAAAAcAAAAJAfeA4dobXR4AAAEuAAAABMAAAAYF+kAAGxvY2EAAATMAAAADgAAAA4CvAGsbWF4cAAABNwAAAAfAAAAIAEVAF1uYW1lAAAE/AAAAUUAAAJtPlT+fXBvc3QAAAZEA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/6bK4yuopwo9py1sw8F9kdw4AmurRpLUM3tYx5ZnKpfHPi8dzz19vJ6MjyxYUrpqeb1uLs3eGV6vr21pSqpeWkqonAN9oUyIiXpv8XvlN5e3icY2BkYGAA4n0vN4fG89t8ZeBmYQCBa9wPPRH0/wcsDMwmQC4HAxNIFABAfAqaAHicY2BkYGBu+N/AEMPCAAJAkpEBFbABAEcMAm94nGNhYGBgfsnAwMKAigESnwEBAAAAAAAAdgCkANoBCAFsAAB4nGNgZGBgYGMIZGBlAAEmIOYCQgaG/2A+AwARSAFzAHicZY9NTsMwEIVf+gekEqqoYIfkBWIBKP0Rq25YVGr3XXTfpk6bKokjx63UA3AejsAJOALcgDvwSCebNpbH37x5Y08A3OAHHo7fLfeRPVwyO3INF7gXrlN/EG6QX4SbaONVuEX9TdjHM6bCbXRheYPXuGL2hHdhDx18CNdwjU/hOvUv4Qb5W7iJO/wKt9Dx6sI+5l5XuI1HL/bHVi+cXqnlQcWhySKTOb+CmV7vkoWt0uqca1vEJlODoF9JU51pW91T7NdD5yIVWZOqCas6SYzKrdnq0AUb5/JRrxeJHoQm5Vhj/rbGAo5xBYUlDowxQhhkiMro6DtVZvSvsUPCXntWPc3ndFsU1P9zhQEC9M9cU7qy0nk6T4E9XxtSdXQrbsuelDSRXs1JErJCXta2VELqATZlV44RelzRiT8oZ0j/AAlabsgAAAB4nGNgYoAALgbsgI2RiZGZkYWRlZGNkZ2BsYI1OSM1OZs1OSe/OJW1KDM9o4S9KDWtKLU4g4EBAJ79CeQ=') format('woff'),*/
/*url('../fonts/iconfont.ttf?t=1508229193188') format('truetype'), !* chrome, firefox, opera, Safari, Android, iOS 4.2+*!*/
/*url('../fonts/iconfont.svg?t=1508229193188#iconfont') format('svg'); !* iOS 4.1- *!*/
/*}*/
.iconfont { .iconfont {
font-family: "iconfont" !important; font-family: "iconfont" !important;

View File

@@ -7,6 +7,7 @@
}, },
"devDependencies": { "devDependencies": {
"@dcloudio/types": "^3.4.8", "@dcloudio/types": "^3.4.8",
"@uni-helper/uni-app-types": "^0.5.13" "@uni-helper/uni-app-types": "^0.5.13",
"typescript": "^5.4.5"
} }
} }

View File

@@ -1,12 +1,6 @@
<template> <template>
<view class="form"> <view class="form">
<uv-form <uv-form ref="form" labelAlign="right" :model="model" :rules="rules">
ref="form"
labelAlign="right"
:model="model"
:rules="rules"
>
<uv-form-item :customStyle="hide"> <uv-form-item :customStyle="hide">
<uv-input <uv-input
v-model="model.username" v-model="model.username"
@@ -40,9 +34,9 @@
<Verify <Verify
:mode="'pop'" :mode="'pop'"
:captchaType="'clickWord'" :captchaType="'blockPuzzle'"
ref="verifyRef" ref="verifyRef"
:imgSize="{ width: '310px', height: '155px' }" :imgSize="{ width: 310, height: 155 }"
@success="VerifySuccess" @success="VerifySuccess"
></Verify> ></Verify>
@@ -54,7 +48,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive } from "vue"; import { ref, reactive ,shallowRef} from "vue";
import Verify from "@/components/verify/verify.vue"; import Verify from "@/components/verify/verify.vue";
@@ -94,13 +88,14 @@ const rules = {
], ],
}; };
const form = ref(); const form = ref();
const verifyRef = ref(); // const verifyRef = ref();
function VerifyShow(e) { const verifyRef = shallowRef<InstanceType<typeof Verify>>()
function VerifyShow() {
form.value form.value
.validate() .validate()
.then((res) => { .then(() => {
verifyRef.value.show(); verifyRef.value.show();
}) })
.catch((err) => { .catch((err) => {
// alert(err.message); // alert(err.message);
@@ -144,16 +139,8 @@ function handleSubmit(verify) {
.form { .form {
margin: 200rpx 20rpx; margin: 200rpx 20rpx;
.captchaImage {
padding: 0 10rpx;
}
.footer { .footer {
padding: 60rpx 20rpx 200rpx; padding: 60rpx 20rpx 200rpx;
.btn {
background-color: #00b294;
}
} }
} }
</style> </style>