fix:修改学员操作样式

This commit is contained in:
lixg
2022-12-19 17:33:25 +08:00
parent ca49ab9dfc
commit ff2a15ae1f
6 changed files with 443 additions and 406 deletions

View File

@@ -1,19 +1,20 @@
<template>
<a-input
v-model:value="modelV"
:placeholder="placeholder"
:show-count="showCount"
:maxlength="maxlength"
:validate="validate"
@blur="validateProName"
@change="validateProName"
<a-input
v-model:value="modelV"
:placeholder="placeholder"
:show-count="showCount"
:maxlength="maxlength"
:validate="validate"
@blur="validateProName"
@change="validateProName"
/>
<div style="color:red;font-size: 10px" v-if="value && !validate">名称重复请重新输入</div>
<div style="color: red; font-size: 10px" v-if="value && !validate">
名称重复请重新输入
</div>
</template>
<script setup>
import {defineProps, defineEmits, watch, ref, onMounted} from "vue";
import {validateName} from "@/api/index1";
import { defineProps, defineEmits, watch, ref, onMounted } from "vue";
import { validateName } from "@/api/index1";
const props = defineProps({
value: {
@@ -21,7 +22,7 @@ const props = defineProps({
},
validate: {
type: Boolean,
default:true
default: true,
},
id: {
type: String,
@@ -31,73 +32,78 @@ const props = defineProps({
},
type: {
type: Number,
default: 1
default: 1,
},
maxlength: {
type: Number,
default: 30
default: 30,
},
showCount: {
type: Boolean,
default: false
default: false,
},
});
const emit = defineEmits({});
const modelV = ref();
onMounted(() => {
modelV.value = props.value;
});
watch(
() => props.value,
() => {
if (props.value !== modelV.value) {
modelV.value = props.value;
}
}
})
const emit = defineEmits({})
const modelV = ref()
onMounted(()=>{
modelV.value = props.value
})
watch(() => props.value, () => {
if (props.value !== modelV.value) {
modelV.value = props.value
}
})
);
watch(modelV, () => {
emit('update:value', modelV.value)
})
emit("update:value", modelV.value);
});
function validateProName() {
emit('update:finished', false);
props.value && validateName({name: props.value, type: props.type, id: props.id}).then(res => {
if(props.value==""){
emit('update:validate', res.data.data === 1)
}else{
emit('update:validate', res.data.data !== 1)
emit('update:finished', true);
}
})
emit("update:finished", false);
props.value &&
validateName({ name: props.value, type: props.type, id: props.id }).then(
(res) => {
console.log("resresresres", res);
if (props.value == "") {
emit("update:validate", res.data.data === 1);
} else {
emit("update:validate", res.data.data !== 1);
emit("update:finished", true);
}
}
);
}
</script>
<style lang="scss">
.in{
.pro{
.ant-input-affix-wrapper {
position: relative;
display: inline-block;
width: 99%;
min-width: 0;
padding: 4px 8px;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
line-height: 1.5715;
background-color: #fff;
background-image: none;
border: 1px solid #d9d9d9;
border-radius: 8px;
transition: all 0.3s;
display: inline-flex;
}
.in {
.pro {
.ant-input-affix-wrapper {
position: relative;
display: inline-block;
width: 99%;
min-width: 0;
padding: 4px 8px;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
line-height: 1.5715;
background-color: #fff;
background-image: none;
border: 1px solid #d9d9d9;
border-radius: 8px;
transition: all 0.3s;
display: inline-flex;
}
}
}
.in{
.in {
.ant-input-affix-wrapper {
position: relative;
display: inline-block;
@@ -113,11 +119,11 @@ function validateProName() {
border-radius: 8px;
transition: all 0.3s;
display: inline-flex;
}
}
}
.b_input,.i1_input{
.b_input,
.i1_input {
.ant-input-affix-wrapper {
position: relative;
display: inline-block;
@@ -133,7 +139,6 @@ function validateProName() {
border-radius: 8px;
transition: all 0.3s;
display: inline-flex;
}
}
}
</style>

View File

@@ -66,7 +66,13 @@
:row-selection="stuRowSelection"
>
<template #action="{ record }">
<a-row gutter="12">
<div
@click="del(record.id)"
style="color: #4ea6ff; font-size: 14px; text-align: center"
>
删除
</div>
<!-- <a-row gutter="12">
<a-col>
<slot name="extension" v-bind:data="{ record }"></slot>
</a-col>
@@ -76,8 +82,14 @@
<div @click="del(record.id)">删除</div>
</a-select-option>
</a-select>
<div
@click="del(record.id)"
style="color: #4ea6ff; font-size: 14px; text-align: center"
>
删除
</div>
</a-col>
</a-row>
</a-row> -->
</template>
</a-table>
</div>