You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
716 B
37 lines
716 B
<template>
|
|
<!-- TODO: 设置默认图片 -->
|
|
<image :src="src" mode="aspectFit" class="image" @click="getCode"></image>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return { src: '' };
|
|
},
|
|
|
|
created() {
|
|
this.getCode();
|
|
},
|
|
|
|
methods: {
|
|
// 获取图形验证码
|
|
async getCode() {
|
|
try {
|
|
const data = await this.$u.api.getImageCode();
|
|
const { imageBase64, verificationCodeId } = data;
|
|
this.src = imageBase64;
|
|
this.$emit('on-code', verificationCodeId);
|
|
} catch (error) {
|
|
console.error('error: ', error);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.image {
|
|
width: 100px !important;
|
|
height: 35px !important;
|
|
}
|
|
</style>
|
|
|