鸿宇研学生前端代码
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.

354 lines
8.1 KiB

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