member-info.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!-- -->
  2. <template>
  3. <div class="u-member-info">
  4. <img class="u-member-info-img" :src="basicSet.shop_logo" alt="">
  5. <div class="u-member-info-text">Hi,您好!</div>
  6. <div class="u-member-info-welcome">
  7. <a href="#" :title="`欢迎来到${basicSet.shop_name}!`">欢迎来到{{basicSet.shop_name}}!</a>
  8. </div>
  9. <div class="logged-botton" v-if="basicSet.is_login">已登录</div>
  10. <div class="no-logged-botton" v-else @click="toUrl('login',{select: '1'})">请登录</div>
  11. <div class="user-botton">
  12. <div class="botton-min" @click="toUrl('cart')">购物车</div>
  13. <div class="botton-min" @click="toUrl('order')">我的订单</div>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import {mapState} from 'vuex'
  19. export default {
  20. data () {
  21. return {
  22. };
  23. },
  24. activated() {},
  25. components: {},
  26. computed: {
  27. ...mapState(['basicSet'])
  28. },
  29. mounted() {},
  30. methods: {
  31. toUrl(url, params) {
  32. if(url == 'login') {
  33. sessionStorage.setItem("yz_redirect", document.location.href);
  34. }
  35. this.$router.push(this.fun.getUrl(url, params));
  36. },
  37. }
  38. }
  39. </script>
  40. <style lang='scss' rel='stylesheet/scss' scoped>
  41. .u-member-info{
  42. padding: 18px;
  43. width: 100%;
  44. background: #fff;
  45. text-align: center;
  46. box-sizing: border-box;
  47. text-align: center;
  48. flex: 1;
  49. display: flex;
  50. flex-direction: column;
  51. align-items: center;
  52. justify-content: center;
  53. overflow: hidden;
  54. border-radius: 5px;
  55. .u-member-info-img{
  56. width: 80px;
  57. height: 80px;
  58. border-radius: 50%;
  59. }
  60. .u-member-info-text,.u-member-info-welcome{
  61. color: #707070;
  62. font-size: 16px;
  63. font-weight: bold;
  64. line-height: 33px;
  65. }
  66. .u-member-info-welcome{
  67. width: 100%;
  68. overflow: hidden;/*超出部分隐藏*/
  69. text-overflow:ellipsis;/* 超出部分显示省略号 */
  70. white-space: nowrap;/*规定段落中的文本不进行换行 */
  71. a{
  72. color: #707070;
  73. }
  74. }
  75. .logged-botton,.no-logged-botton{
  76. width: 190px;
  77. height: 30px;
  78. line-height: 30px;
  79. background-color: #f4ac05;
  80. color: #fff;
  81. border-radius: 5px;
  82. margin: 10px auto 16px;
  83. &:hover{
  84. cursor: pointer;
  85. }
  86. }
  87. .no-logged-botton{
  88. background-color: #0090ff;
  89. }
  90. .user-botton{
  91. width: 190px;
  92. margin: 0 auto;
  93. display: flex;
  94. justify-content: space-between;
  95. .botton-min{
  96. width: 90px;
  97. height: 30px;
  98. line-height: 30px;
  99. color: #fff;
  100. background-color: #fb5c46;
  101. border-radius: 5px;
  102. &:hover{
  103. cursor: pointer;
  104. }
  105. }
  106. }
  107. }
  108. </style>