my.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="intro-page common">
  3. <view class="top-class"></view>
  4. <view class="title">
  5. <view class="logo-container">
  6. <image class="logo-text" @click="openDetail" src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/xhc/common/logo.png" />
  7. </view>
  8. <view class="title-1">
  9. <view class="title-image-2"></view>
  10. </view>
  11. </view>
  12. <view class="head">
  13. <u-row class="row-class" justify="flex-end">
  14. <u-col span="4">
  15. <image class="logo-rules-2" @click="openDetail" src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/xhc/common/rules.png" />
  16. </u-col>
  17. </u-row>
  18. </view>
  19. <view class="content-2">
  20. <view class="content-title">
  21. 个人中心
  22. </view>
  23. <view style = "margin-top: 100rpx">
  24. <u-row customStyle="margin-bottom: 10px">
  25. <u-col span="4">
  26. <image class="tubiao"
  27. :src="image"
  28. mode="aspectFit" />
  29. </u-col>
  30. <u-col span="8">
  31. <view class="jf_phone">
  32. {{nickName}}
  33. </view>
  34. </u-col>
  35. </u-row>
  36. </view>
  37. <view class="content_title">
  38. 我的服务
  39. </view>
  40. <view class="">
  41. <u-row style="height: 200rpx;">
  42. <u-col span="4" textAlign="center" @click="jumpScanLog">
  43. <image class="tubiao" src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/qilang/scan.png" mode="aspectFit" />
  44. <view class="text-class">
  45. 扫码记录
  46. </view>
  47. </u-col>
  48. </u-row>
  49. </view>
  50. </view>
  51. <view class="return_view">
  52. <view class="return-button" @click="goBack()">返回</view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import CustomTabbar from '@/components/tabbar_common.vue';
  58. import {
  59. getMiniCustomerUserInfo
  60. } from '@/api/scan';
  61. export default {
  62. components: {
  63. CustomTabbar
  64. },
  65. data() {
  66. return {
  67. nickName:'',
  68. userPhone: '',
  69. point: 0,
  70. image:'https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/xhc/common/logo.png'
  71. }
  72. },
  73. onLoad() {
  74. this.initUserData();
  75. },
  76. methods: {
  77. openDetail() {
  78. uni.navigateTo({
  79. url: '/pages/xhc/index/rules'
  80. });
  81. },
  82. initUserData() {
  83. let that = this;
  84. getMiniCustomerUserInfo().then(res => {
  85. if (res.code === 0) {
  86. that.userPhone = res.data.phone;
  87. that.nickName = res.data.nickName;
  88. that.point = res.data.point;
  89. // 验证图片路径是否为有效字符串,避免将布尔值当作路径
  90. if (typeof res.data.image === 'string' && res.data.image !== '' && res.data.image != null && res.data.image.startsWith('http')){
  91. that.image = res.data.image;
  92. } else {
  93. // 如果不是有效的图片路径,使用默认图片
  94. that.image = 'https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/xhc/common/logo.png';
  95. }
  96. console.log(that.point);
  97. }
  98. })
  99. },
  100. goBack() {
  101. uni.navigateBack();
  102. },
  103. jumpScanLog() {
  104. uni.navigateTo({
  105. url: '/pages/xhc/record/record'
  106. });
  107. },
  108. // 图片加载错误处理
  109. onImageError(e) {
  110. console.log('图片加载失败', e);
  111. // 可以在这里设置默认图片
  112. this.image = 'https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/xhc/common/logo.png';
  113. },
  114. // 图片加载成功处理
  115. onImageLoad(e) {
  116. console.log('图片加载成功', e);
  117. },
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. @import url('../../../static/scss/common_xhc.css');
  123. .row-class {
  124. height: 80rpx;
  125. }
  126. .content_text {
  127. height: calc(100% - 300rpx);
  128. }
  129. .content_title {
  130. font-weight: 700;
  131. font-size: 38rpx;
  132. color: #F8D994;
  133. margin-bottom: 10rpx;
  134. margin-left: 30rpx;
  135. }
  136. .content {
  137. height: 64vh;
  138. border-radius: 10rpx;
  139. margin: 16vh 40rpx 0vh 40rpx;
  140. padding: 10rpx 24rpx;
  141. overflow: auto;
  142. align-items: center;
  143. justify-content: center;
  144. border-radius: 48px;
  145. background: #FDE2B1;
  146. border: 6px solid #FB911b;
  147. }
  148. .tubiao {
  149. background-size: cover;
  150. /* 确保背景图片自适应填充整个容器 */
  151. background-position: center;
  152. /* 背景图片居中显示 */
  153. background-repeat: no-repeat;
  154. /* 防止背景图重复 */
  155. height: 120rpx;
  156. width: 100%;
  157. }
  158. .text-class {
  159. font-weight: 600;
  160. font-size: 16px;
  161. color: #FDE2B1;
  162. }
  163. .jf_phone {
  164. font-weight: bold;
  165. font-size: 30rpx;
  166. color: #F8D994;
  167. margin-bottom: 10rpx;
  168. }
  169. </style>