鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

379 lines
8.8 KiB

2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="page__view">
  3. <image class="bg" src="@/static/image/center-bg.png" mode="widthFix"></image>
  4. <view class="main">
  5. <view class="content">
  6. <view class="flex user">
  7. <!-- 用户信息 -->
  8. <template v-if="isLogin">
  9. <view class="user-avatar" v-if="userInfo.headImage">
  10. <image class="user-avatar-img" :src="userInfo.headImage" mode="scaleToFill"></image>
  11. </view>
  12. <view class="user-avatar is-default" v-else>
  13. <image class="user-avatar-img" src="@/pages_order/static/center/avatar-default.png" mode="scaleToFill"></image>
  14. </view>
  15. <view class="user-info">
  16. <view class="flex user-info-name">
  17. <view class="highligt" v-if="userInfo.nickName">{{ userInfo.nickName || '' }}</view>
  18. <view class="flex light" @click="$utils.copyText(userInfo.id)">
  19. <view>{{ `ID:${userInfo.id}` }}</view>
  20. <uv-icon name="file-text" color="#FFFFFF" size="28rpx"></uv-icon>
  21. </view>
  22. </view>
  23. <view class="user-info-desc" v-if="userInfo.phone">{{ `手机号${userInfo.phone}` }}</view>
  24. </view>
  25. </template>
  26. <template v-else>
  27. <view class="user-avatar is-default">
  28. <image class="user-avatar-img" src="@/pages_order/static/center/avatar-default.png" mode="scaleToFill"></image>
  29. </view>
  30. <view class="user-info">
  31. <view class="user-info-tips">暂未登录 请先登录</view>
  32. </view>
  33. </template>
  34. </view>
  35. <template v-if="isLogin">
  36. <view class="flex card member-bind">
  37. <view class="left">成员绑定</view>
  38. <view class="flex right">
  39. <button class="btn" @click="jumpToBindMember">绑定</button>
  40. <uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon>
  41. </view>
  42. </view>
  43. <!-- 订单信息 -->
  44. <order-card></order-card>
  45. <!-- 用户菜单 -->
  46. <view class="card">
  47. <view v-for="item in list1" :key="item.id">
  48. <template v-if="item.key === 'service'">
  49. <button plain class="flex btn-service" open-type="contact">
  50. <view class="flex row">
  51. <view class="flex label">
  52. <image class="icon" :src="item.icon" mode="scaleToFill"></image>
  53. <view>{{ item.label }}</view>
  54. </view>
  55. <uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon>
  56. </view>
  57. </button>
  58. </template>
  59. <view v-else class="flex row" @click="onClick(item)">
  60. <view class="flex label">
  61. <image class="icon" :src="item.icon" mode="scaleToFill"></image>
  62. <view>{{ item.label }}</view>
  63. </view>
  64. <uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="card">
  69. <view v-for="item in list2" :key="item.id">
  70. <view class="flex row" @click="onClick(item)">
  71. <view class="flex label">
  72. <image class="icon" :src="item.icon" mode="scaleToFill"></image>
  73. <view>{{ item.label }}</view>
  74. </view>
  75. <view class="flex right">
  76. <!-- 开营通知 -->
  77. <view class="flex sup" v-if="item.id === '006' && userCenterData.noticeNum">{{ userCenterData.noticeNum }}</view>
  78. <uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </template>
  84. <!-- 用户登陆 -->
  85. <template v-else>
  86. <view class="login">
  87. <button class="btn" @click="$utils.toLogin">立即登录</button>
  88. <view class="tips">暂未登录 请先登录</view>
  89. </view>
  90. </template>
  91. </view>
  92. <tabber select="center" />
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import { mapState } from 'vuex'
  98. import tabber from '@/components/base/tabbar.vue'
  99. import orderCard from '@/pages_order/center/orderCard.vue'
  100. export default {
  101. components: {
  102. orderCard,
  103. tabber,
  104. },
  105. data() {
  106. return {
  107. list1: [
  108. { id: '001', label: '我的收藏', icon: '/pages_order/static/center/icon-collect.png', path: '/pages_order/product/collectList' },
  109. { id: '004', label: '学员管理', icon: '/pages_order/static/center/icon-student.png', path: `/pages_order/member/memberList` },
  110. { id: '003', label: '我的优惠券', icon: '/pages_order/static/center/icon-coupon.png', path: `/pages_order/coupon/couponList/index` },
  111. ],
  112. list2: [
  113. { id: '005', label: '我的评价', icon: '/pages_order/static/center/icon-comment.png', path: `/pages_order/comment/commentRecords` },
  114. { id: '006', label: '开营通知', icon: '/pages_order/static/center/icon-msg.png', path: `/pages_order/message/list` },
  115. { id: '007', label: '修改信息', icon: '/pages_order/static/center/icon-modifyInfo.png', path: `/pages_order/auth/wxUserInfo?mode=edit` },
  116. { id: '008', label: '退出登录', icon: '/pages_order/static/center/icon-logout.png', key: 'logout' },
  117. ],
  118. }
  119. },
  120. computed: {
  121. ...mapState(['userInfo', 'userCenterData', 'configList']),
  122. isLogin() {
  123. return this.userInfo && this.userInfo.id
  124. }
  125. },
  126. onShow() {
  127. if(uni.getStorageSync('token')){
  128. this.$store.commit('getUserInfo')
  129. this.$store.commit('getUserCenterData')
  130. }
  131. },
  132. methods: {
  133. onClick(target) {
  134. const { key, path } = target
  135. switch(key) {
  136. case 'comment':
  137. this.$utils.navigateTo('/pages_order/comment/commentRecords')
  138. break
  139. case 'logout':
  140. this.$store.commit('logout')
  141. break
  142. default:
  143. path && this.$utils.navigateTo(path)
  144. break
  145. }
  146. },
  147. jumpToBindMember() {
  148. this.$utils.navigateTo('/pages_order/member/memberBind')
  149. },
  150. },
  151. }
  152. </script>
  153. <style scoped lang="scss">
  154. .page__view {
  155. width: 100vw;
  156. min-height: 100vh;
  157. background: $uni-bg-color;
  158. position: relative;
  159. /deep/ .nav-bar__view {
  160. position: fixed;
  161. top: 0;
  162. left: 0;
  163. }
  164. .nav-icon {
  165. width: 200rpx;
  166. height: auto;
  167. vertical-align: top;
  168. }
  169. }
  170. .bg {
  171. width: 100vw;
  172. height: auto;
  173. }
  174. .main {
  175. position: absolute;
  176. top: 176rpx;
  177. left: 0;
  178. width: 100%;
  179. }
  180. .content {
  181. width: 100%;
  182. padding: 16rpx 32rpx 80rpx 32rpx;
  183. box-sizing: border-box;
  184. }
  185. .user {
  186. column-gap: 24rpx;
  187. &-avatar {
  188. flex: none;
  189. width: 100rpx;
  190. height: 100rpx;
  191. border: 4rpx solid #FFFFFF;
  192. border-radius: 50%;
  193. overflow: hidden;
  194. &.is-default {
  195. width: 108rpx;
  196. height: 108rpx;
  197. border: none;
  198. }
  199. &-img {
  200. width: 100%;
  201. height: 100%;
  202. }
  203. }
  204. &-info {
  205. flex: 1;
  206. &-name {
  207. justify-content: flex-start;
  208. flex-wrap: wrap;
  209. gap: 16rpx;
  210. font-family: PingFang SC;
  211. color: #FFFFFF;
  212. .highligt {
  213. font-weight: 600;
  214. font-size: 36rpx;
  215. line-height: 1.2;
  216. text-shadow: 0 1px 0 #37313140;
  217. }
  218. .light {
  219. font-size: 24rpx;
  220. justify-content: flex-start;
  221. column-gap: 8rpx;
  222. }
  223. }
  224. &-desc {
  225. margin-top: 4rpx;
  226. font-family: PingFang SC;
  227. font-weight: 400;
  228. font-size: 24rpx;
  229. line-height: 1.8;
  230. color: #FFFFFF;
  231. text-shadow: 0 1px 0 #37313140;
  232. }
  233. &-tips {
  234. font-family: PingFang SC;
  235. font-weight: 400;
  236. font-size: 36rpx;
  237. line-height: 1.2;
  238. color: #FFFFFF;
  239. }
  240. }
  241. }
  242. .card {
  243. margin-top: 32rpx;
  244. width: 100%;
  245. background: #FFFFFF;
  246. border: 2rpx solid #FFFFFF;
  247. border-radius: 32rpx;
  248. box-sizing: border-box;
  249. .row {
  250. justify-content: space-between;
  251. width: 100%;
  252. padding: 40rpx;
  253. box-sizing: border-box;
  254. .label {
  255. font-family: PingFang SC;
  256. font-weight: 400;
  257. font-size: 28rpx;
  258. line-height: 1;
  259. color: #252545;
  260. .icon {
  261. margin-right: 16rpx;
  262. width: 40rpx;
  263. height: 40rpx;
  264. }
  265. }
  266. .right {
  267. column-gap: 8rpx;
  268. }
  269. .sup {
  270. min-width: 32rpx;
  271. height: 32rpx;
  272. font-family: PingFang SC;
  273. font-weight: 500;
  274. font-size: 24rpx;
  275. line-height: 1.3;
  276. color: #FFFFFF;
  277. background: #F53F3F;
  278. border-radius: 32rpx;
  279. }
  280. }
  281. }
  282. .btn-service {
  283. border: none;
  284. padding: 0;
  285. }
  286. .login {
  287. margin-top: 307rpx;
  288. padding: 0 128rpx;
  289. .btn {
  290. padding: 16rpx 0;
  291. font-family: PingFang SC;
  292. font-weight: 500;
  293. font-size: 36rpx;
  294. line-height: 1.4;
  295. color: #FFFFFF;
  296. background-image: linear-gradient(to right, #21FEEC, #019AF9);
  297. border-radius: 41rpx;
  298. }
  299. .tips {
  300. margin-top: 16rpx;
  301. text-align: center;
  302. font-family: PingFang SC;
  303. font-weight: 400;
  304. font-size: 26rpx;
  305. line-height: 1.4;
  306. color: #A3A3A3;
  307. }
  308. }
  309. .member-bind {
  310. justify-content: space-between;
  311. padding: 32rpx;
  312. background: linear-gradient(to right, #FBFEFF, #DAF3FF);
  313. .left {
  314. font-size: 36rpx;
  315. font-weight: 600;
  316. color: #252545;
  317. }
  318. .right {
  319. column-gap: 16rpx;
  320. .btn {
  321. padding: 6rpx 50rpx;
  322. font-size: 28rpx;
  323. font-weight: 500;
  324. line-height: 1.5;
  325. color: #FFFFFF;
  326. background: linear-gradient(to right, #21FEEC, #019AF9);
  327. border: 2rpx solid #00A9FF;
  328. border-radius: 30rpx;
  329. }
  330. }
  331. }
  332. </style>