From c0051fba69438a587afb92f7d4e6ae5ded3a8521 Mon Sep 17 00:00:00 2001 From: Mila <Mila@pollex.com.tw> Date: 星期一, 15 十一月 2021 08:04:24 +0800 Subject: [PATCH] add: TODO#130194 串接取得顧問img api --- PAMapp/components/Consultant/ConsultantCard.vue | 9 ++++----- PAMapp/components/QuickFilter/QuickFilterConsultantList.vue | 8 ++++---- PAMapp/assets/scss/vendors/elementUI/_avatar.scss | 5 +++++ PAMapp/components/Consultant/ConsultantSwiper.vue | 2 +- PAMapp/components/Ui/UiAvatar.vue | 21 +++++++++++++++++++++ PAMapp/assets/ts/api/consultant.ts | 2 +- PAMapp/nuxt.config.js | 3 +++ 7 files changed, 39 insertions(+), 11 deletions(-) diff --git a/PAMapp/assets/scss/vendors/elementUI/_avatar.scss b/PAMapp/assets/scss/vendors/elementUI/_avatar.scss index af1f06b..7ea70ca 100644 --- a/PAMapp/assets/scss/vendors/elementUI/_avatar.scss +++ b/PAMapp/assets/scss/vendors/elementUI/_avatar.scss @@ -2,3 +2,8 @@ width: 150px; height: 150px } + +.pam-avatar>img { + width: 100%; + object-position: center top; +} \ No newline at end of file diff --git a/PAMapp/assets/ts/api/consultant.ts b/PAMapp/assets/ts/api/consultant.ts index c761f2f..32789aa 100644 --- a/PAMapp/assets/ts/api/consultant.ts +++ b/PAMapp/assets/ts/api/consultant.ts @@ -5,7 +5,7 @@ import Router from 'vue-router'; export const service = axios.create({ - baseURL: 'http://localhost:8080/api' + baseURL: process.env.BASE_URL }) service.interceptors.request.use(function (config: AxiosRequestConfig) { diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue index d74a6eb..383c739 100644 --- a/PAMapp/components/Consultant/ConsultantCard.vue +++ b/PAMapp/components/Consultant/ConsultantCard.vue @@ -5,12 +5,11 @@ <el-col :xs="22" :sm="23"> <el-row type="flex"> <el-col class="flex_column" :xs="5" :sm="3"> - <el-avatar + <UiAvatar :size="50" - :src="agentInfo.img" - class="cursor--pointer" - @click.native="showAgentDetail(agentInfo.agentNo);" - ></el-avatar> + :fileName="agentInfo.img" + @click.native="showAgentDetail(agentInfo.agentNo)" + ></UiAvatar> <div class="satisfaction"> <i class="icon-star pam-icon icon--yellow satisfaction"></i> <span>{{agentInfo.avgScore }}</span> diff --git a/PAMapp/components/Consultant/ConsultantSwiper.vue b/PAMapp/components/Consultant/ConsultantSwiper.vue index 21e04da..ec5231d 100644 --- a/PAMapp/components/Consultant/ConsultantSwiper.vue +++ b/PAMapp/components/Consultant/ConsultantSwiper.vue @@ -10,7 +10,7 @@ :key="index" > <div class="consultantCardStyle" > - <el-avatar class="mb-10" :size="80" :src="agentInfo.img"></el-avatar> + <UiAvatar :size="80" :fileName="agentInfo.img" class="mb-10"></UiAvatar> <div class="name">{{agentInfo.name}}</div> <div> <i class="icon-star pam-icon icon--yellow"></i> diff --git a/PAMapp/components/QuickFilter/QuickFilterConsultantList.vue b/PAMapp/components/QuickFilter/QuickFilterConsultantList.vue index 9658e72..149b42f 100644 --- a/PAMapp/components/QuickFilter/QuickFilterConsultantList.vue +++ b/PAMapp/components/QuickFilter/QuickFilterConsultantList.vue @@ -17,12 +17,12 @@ @touchstart="touchStart" @touchend="moveCard" > - <el-avatar + <UiAvatar :size="200" - class="mx-auto cursor--pointer" + :fileName="item.img" + class="mx-auto" @click.native="showAgentDetail(item.agentNo)" - :src="item.img" - /> + ></UiAvatar> <div class="mdTxt mt-30 mb-30 text--center">{{item.name}}(隡舀��蝬�鈭�)</div> <el-row> <el-col :span="12"> diff --git a/PAMapp/components/Ui/UiAvatar.vue b/PAMapp/components/Ui/UiAvatar.vue new file mode 100644 index 0000000..b9a79d1 --- /dev/null +++ b/PAMapp/components/Ui/UiAvatar.vue @@ -0,0 +1,21 @@ +<template> + <el-avatar + :size="size" + :src="imgSrc" + class="pam-avatar cursor--pointer" + ></el-avatar> +</template> + +<script lang="ts"> +import { Vue, Component, Prop } from 'nuxt-property-decorator'; + +@Component +export default class UiAvatar extends Vue { + @Prop() size!: number; + @Prop() fileName!: string; + + get imgSrc() { + return process.env.BASE_URL + '/consultant/avatar/' + this.fileName; + } +} +</script> \ No newline at end of file diff --git a/PAMapp/nuxt.config.js b/PAMapp/nuxt.config.js index ee4a9dc..c30508a 100644 --- a/PAMapp/nuxt.config.js +++ b/PAMapp/nuxt.config.js @@ -71,5 +71,8 @@ document.documentElement.scrollTop = 0; } } + }, + env: { + BASE_URL: 'http://localhost:8080/api' } } -- Gitblit v1.8.0