Commit 6bb39b51 authored by leiqingsong's avatar leiqingsong

图片显示问题

parent 09fbefc3
......@@ -6,7 +6,7 @@ import request from "@/utils/request";
*/
export function inviteCode(userId) {
return request({
url: `/api/user/registerByQrCode?userId=${userId}`,
url: `/api/user/registerByQrCode?height=150&userId=${userId}&width=150`,
responseType: "arraybuffer",
method: "get"
});
......
......@@ -3,7 +3,7 @@
<div
class="invite-code"
v-lazy:background-image="imgSrc"
:style="`;background-size: 100% 100%;background-repeat: no-repeat;`"
style="background-size: 100% 100%; background-repeat: no-repeat"
>
<div class="nav">
<van-icon
......@@ -19,7 +19,7 @@
</div>
</template>
<script>
// import { inviteCode } from "@/api/invite";
import { inviteCode } from "@/api/invite";
export default {
name: "Invite",
data() {
......@@ -30,7 +30,7 @@ export default {
timer: null
};
},
mounted() {
created() {
this.timer = setTimeout(() => {
this.inviteCode();
}, 200);
......@@ -49,20 +49,20 @@ export default {
}
},
inviteCode() {
// const _this = this;
// let loading = _this.$toast.loading({
// forbidClick: true,
// message: "加载中..."
// });
const _this = this;
let loading = _this.$toast.loading({
forbidClick: true,
message: "加载中..."
});
const userId = JSON.parse(localStorage.getItem("user")).userId;
// inviteCode(userId).then(res => {
// if (loading) _this.$toast.clear();
// _this.imgSrc = _this.getUserPhoto(res);
// });
this.imgSrc = `${process.env.VUE_APP_BASE_URL}/shop-mall/api/user/registerByQrCode?height=150&userId=${userId}&width=150`;
inviteCode(userId).then(res => {
if (loading) _this.$toast.clear();
_this.imgSrc = _this.getUserPhoto(res);
this.btnTimer = setTimeout(() => {
this.showBtn = true;
}, 1500);
}, 200);
});
// this.imgSrc = `${process.env.VUE_APP_BASE_URL}/shop-mall/api/user/registerByQrCode?height=150&userId=${userId}&width=150`;
},
getUserPhoto(res) {
let uInt8Array = new Uint8Array(res);
......
<template>
<div class="invitee">
<div class="baseInfo">
<img class="avatar" :src="imageUrl + inviteeItem.headImage" alt="用户头像" />
<img
class="avatar"
:src="imageUrl + inviteeItem.headImage"
alt="用户头像"
/>
<span class="userName">{{ inviteeItem.userId }}</span>
</div>
<div class="detail">
......@@ -33,7 +37,7 @@ export default {
data() {
return {
imageUrl: process.env.VUE_APP_BASE_URL
}
};
}
};
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment