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

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