TODO#128785 首頁-我的顧問清單 畫面刻版
¤ñ¹ï·sÀÉ®× |
| | |
| | | <template> |
| | | <div> |
| | | <el-row type="flex" class="rowStyle"> |
| | | <el-col :xs="2" :sm="1" :class="{'state': agentInfo.new}"></el-col> |
| | | <el-col :xs="22" :sm="23"> |
| | | <el-row type="flex"> |
| | | <el-col class="flex_column" :xs="5" :sm="3"> |
| | | <img class="avator" :src="agentInfo.img" alt=""> |
| | | <div class="star">{{agentInfo.satisfaction}}</div> |
| | | </el-col> |
| | | <el-col class="flex_column" :xs="10" :sm="15"> |
| | | <div class="smTxt_bold name">{{agentInfo.name}}</div> |
| | | <div class="tagStyle"> |
| | | <span |
| | | class="tagTxt" |
| | | v-for="(tag, index) in agentInfo.tags" :key="index">#{{tag}}</span> |
| | | </div> |
| | | <div class="delete" @click="removeAgent">ç§»é¤</div> |
| | | </el-col> |
| | | <el-col class="flex_column" :xs="9" :sm="6"> |
| | | <el-button |
| | | class="smTxt_bold btn" |
| | | @click="reserveCommunication" |
| | | :class="{'reservedBtn': agentInfo.reserve}" |
| | | >{{ agentInfo.reserve ? 'å·²é ç´' : 'é²è¡é ç´'}}</el-button> |
| | | <div class="time">ä»å¤© 10:00 å å
¥</div> |
| | | </el-col> |
| | | </el-row> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component, Prop, Emit, Watch } from 'nuxt-property-decorator'; |
| | | import { Agents } from '~/plugins/api/home'; |
| | | |
| | | @Component |
| | | export default class ConsultantCard extends Vue { |
| | | @Prop() agentInfo!: Agents; |
| | | |
| | | reserveCommunication() { |
| | | if (!this.agentInfo.reserve) { |
| | | this.$router.push('/communication/myDemand') |
| | | } |
| | | |
| | | } |
| | | |
| | | @Emit('removeAgent') removeAgent() { |
| | | console.log('removeAgent') |
| | | return this.agentInfo.id; |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .rowStyle { |
| | | padding: 10px; |
| | | background-color: #FFFFFF; |
| | | margin-bottom: 10px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | |
| | | .state { |
| | | width: 10px; |
| | | height: 10px; |
| | | border-radius: 50px; |
| | | background-color: #F2C75C; |
| | | margin: auto 0; |
| | | } |
| | | |
| | | .avator { |
| | | width: 50px; |
| | | height: 50px; |
| | | border-radius: 50px ; |
| | | } |
| | | |
| | | .star { |
| | | font-size: 12px; |
| | | font-weight: bold; |
| | | |
| | | &:before { |
| | | content: '\2605'; |
| | | color: #ED1B2E; |
| | | margin: 5px; |
| | | } |
| | | } |
| | | |
| | | .tagStyle { |
| | | overflow: hidden; |
| | | white-space: nowrap; |
| | | text-overflow: ellipsis; |
| | | .tagTxt { |
| | | font-size: 12px; |
| | | font-weight: bold; |
| | | margin-right: 5px; |
| | | } |
| | | } |
| | | |
| | | .delete { |
| | | color: #ED1B2E; |
| | | font-size: 14px; |
| | | font-weight: bold; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .btn { |
| | | color: #ED1B2E; |
| | | border: solid 2px; |
| | | border-radius: 30px; |
| | | padding: 10px 16px; |
| | | } |
| | | |
| | | .reservedBtn { |
| | | color: #009CBD; |
| | | cursor: auto; |
| | | |
| | | &:hover { |
| | | color: #009CBD; |
| | | border-color: #009CBD; |
| | | background-color: #ffffff; |
| | | } |
| | | } |
| | | |
| | | .time { |
| | | font-size: 12px; |
| | | font-weight: bold; |
| | | color: #707070; |
| | | text-align: right; |
| | | } |
| | | } |
| | | |
| | | .flex_column { |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | </style> |
¤ñ¹ï·sÀÉ®× |
| | |
| | | <template> |
| | | <div> |
| | | <template v-if="agents.length > 0"> |
| | | <ConsultantCard |
| | | v-for="(agent, index) in agents" |
| | | :key="index" |
| | | :agentInfo="agent" |
| | | @removeAgent="removeAgent" |
| | | ></ConsultantCard> |
| | | </template> |
| | | <template v-else-if="noLogin"> |
| | | <div class="emptyRowStyle"> |
| | | <div class="mdTxt login" @click="$router.push('/login')">ç»å
¥</div> |
| | | <div class="smTxt txt">æ¥çæ´å¤å·²é¸é¡§å</div> |
| | | </div> |
| | | </template> |
| | | <template v-else> |
| | | <div class="emptyRowStyle"> |
| | | <div class="smTxt txt">æ¨ç®åç¡å·²é¸é¡§å</div> |
| | | </div> |
| | | </template> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component, Prop, Emit } from 'nuxt-property-decorator'; |
| | | import { Agents } from '~/plugins/api/home'; |
| | | |
| | | @Component |
| | | export default class ConsultantList extends Vue { |
| | | @Prop() agents!: Agents[]; |
| | | |
| | | noLogin = false; |
| | | |
| | | @Emit('removeAgent') removeAgent(agentId: number) { |
| | | return agentId; |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .emptyRowStyle { |
| | | background-color: #FFFFFF; |
| | | width: 100%; |
| | | height: 100px; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | |
| | | .login { |
| | | color: #ED1B2E; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .txt { |
| | | color: #68737A; |
| | | margin-left: 17px; |
| | | } |
| | | } |
| | | |
| | | </style> |
| | |
| | | class="reserveConsultantBtn" |
| | | @click="routerPush('/quickFilter')" |
| | | >å¿«é篩é¸</el-button> |
| | | <h5 class="mdTxt mb-20">æç顧忏
å®</h5> |
| | | <el-button @click="routerPush('/contactList/consultantList')">æ¥çæ´å¤</el-button> |
| | | <el-button @click="routerPush('/communication/consult')">諮詢</el-button> |
| | | <div class="rowStyle mb-20"> |
| | | <div class="flex"> |
| | | <h5 class="mdTxt">æç顧忏
å®</h5> |
| | | <span class="smTxt_bold align_center amount">å
± {{agents.length}} ç</span> |
| | | </div> |
| | | <div |
| | | class="mdTxt readMore" |
| | | @click="routerPush('/contactList/consultantList')" |
| | | >æ¥çæ´å¤</div> |
| | | </div> |
| | | <ConsultantList |
| | | :agents="agents.slice(0, 3)" |
| | | @removeAgent="removeAgent" |
| | | ></ConsultantList> |
| | | <h5 class="mdTxt mb-20 mt-32">æ¨è¦ä¿éªé¡§å</h5> |
| | | <Ui-Swiper :agents="agents"></Ui-Swiper> |
| | | <Ui-Swiper :agents="swiperAgents"></Ui-Swiper> |
| | | </div> |
| | | |
| | | </div> |
| | |
| | | }) |
| | | export default class MainComponent extends Vue { |
| | | agents: Agents[] = []; |
| | | swiperAgents: Agents[] = []; |
| | | |
| | | async asyncData(context: Context) { |
| | | let agents: Agents[] = []; |
| | |
| | | agents = result; |
| | | }) |
| | | |
| | | const swiperAgents = JSON.parse(JSON.stringify(agents)); |
| | | |
| | | return { |
| | | agents |
| | | agents, |
| | | swiperAgents |
| | | } |
| | | } |
| | | |
| | | routerPush(path: string) { |
| | | this.$router.push(path); |
| | | } |
| | | |
| | | removeAgent(agentId: number) { |
| | | const findIndex = this.agents.findIndex((item, i) => { |
| | | return item.id === agentId; |
| | | }) |
| | | this.agents.splice(findIndex, 1) |
| | | } |
| | | } |
| | | |
| | |
| | | margin-left: 0px; |
| | | } |
| | | |
| | | .rowStyle { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | .flex { |
| | | display: flex; |
| | | .amount { |
| | | color: #68737A; |
| | | margin-left: 10px; |
| | | align-self: center; |
| | | } |
| | | } |
| | | .readMore { |
| | | color: #ED1B2E; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | |
| | | </style> |
| | |
| | | id: 0, |
| | | name: 'å¼µå°ç¾', |
| | | img: 'https://randomuser.me/api/portraits/women/31.jpg', |
| | | loginState: 'ä¸ç·', |
| | | satisfaction: 4.8 |
| | | new: false, |
| | | tags: ['財åè¦å', 'è³ç¢è½ç§»'], |
| | | satisfaction: 4.8, |
| | | reserve: false |
| | | }, |
| | | { |
| | | id: 1, |
| | | name: 'è£å¸¥å¥', |
| | | img: 'https://randomuser.me/api/portraits/men/32.jpg', |
| | | loginState: 'ä¸ç·', |
| | | satisfaction: 4 |
| | | new: true, |
| | | tags: [], |
| | | satisfaction: 4, |
| | | reserve: false |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: 'æç¾å¥³', |
| | | img: 'https://randomuser.me/api/portraits/women/33.jpg', |
| | | loginState: 'é¢ç·', |
| | | satisfaction: 5 |
| | | new: false, |
| | | tags: ['財åè¦å', 'è³ç¢è½ç§»'], |
| | | satisfaction: 5, |
| | | reserve: true |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: 'è¡ç¾ç', |
| | | img: 'https://randomuser.me/api/portraits/women/34.jpg', |
| | | loginState: 'ä¸ç·', |
| | | satisfaction: 4.3 |
| | | new: true, |
| | | tags: ['財åè¦å', 'è³ç¢è½ç§»'], |
| | | satisfaction: 4.3, |
| | | reserve: false |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: 'å¼µå°ç¾', |
| | | img: 'https://randomuser.me/api/portraits/women/35.jpg', |
| | | loginState: 'å¿ç¢', |
| | | satisfaction: 4.8 |
| | | state: 'å¿ç¢', |
| | | tags: [], |
| | | satisfaction: 4.8, |
| | | reserve: true |
| | | }, |
| | | { |
| | | id: 5, |
| | | name: 'è£å¸¥å¥', |
| | | img: 'https://randomuser.me/api/portraits/men/36.jpg', |
| | | loginState: 'é¢ç·', |
| | | satisfaction: 4 |
| | | new: true, |
| | | tags: ['財åè¦å', 'è³ç¢è½ç§»'], |
| | | satisfaction: 4, |
| | | reserve: false |
| | | }, |
| | | { |
| | | id: 6, |
| | | name: 'æç¾å¥³', |
| | | img: 'https://randomuser.me/api/portraits/women/37.jpg', |
| | | loginState: 'å¿ç¢', |
| | | satisfaction: 5 |
| | | state: 'å¿ç¢', |
| | | tags: [], |
| | | satisfaction: 5, |
| | | reserve: false |
| | | }, |
| | | { |
| | | id: 7, |
| | | name: 'è¡ç¾ç', |
| | | img: 'https://randomuser.me/api/portraits/women/38.jpg', |
| | | loginState: 'ä¸ç·', |
| | | satisfaction: 4.3 |
| | | new: false, |
| | | tags: [], |
| | | satisfaction: 4.3, |
| | | reserve: true |
| | | } |
| | | ] |
| | | return CommonService.prototype.withDebugData(debugData, 'https://randomuser.me/api/') |
| | |
| | | id: number, |
| | | name: string, |
| | | img: string, |
| | | loginState: string, |
| | | satisfaction: number |
| | | new: boolean, |
| | | satisfaction: number, |
| | | tags: string[], |
| | | reserve: boolean |
| | | } |