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

364 lines
8.1 KiB

  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">
  10. <!-- todo: check key -->
  11. <image class="user-avatar-img" src="@/pages_order/static/temp-30.png" mode="scaleToFill"></image>
  12. </view>
  13. <view class="user-info">
  14. <!-- todo: check key -->
  15. <view class="flex user-info-name">
  16. <view class="highligt">战斗世界</view>
  17. <view class="light">ID5625354</view>
  18. </view>
  19. <!-- todo: check key -->
  20. <view class="user-info-desc">手机号19989674531</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 :statistics="statistics"></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. statistics: {},
  101. list1: [
  102. { id: '001', label: '我的收藏', icon: '/pages_order/static/center/icon-collect.png', path: '/pages_order/product/collectList' },
  103. { id: '004', label: '学员管理', icon: '/pages_order/static/center/icon-student.png', path: `/pages_order/member/memberList` },
  104. { id: '003', label: '我的优惠券', icon: '/pages_order/static/center/icon-coupon.png', path: `/pages_order/coupon/couponList/index` },
  105. ],
  106. list2: [
  107. { id: '005', label: '我的评价', icon: '/pages_order/static/center/icon-comment.png', path: `/pages_order/comment/commentRecords` },
  108. { id: '006', label: '开营通知', icon: '/pages_order/static/center/icon-msg.png', path: `/pages_order/message/list` },
  109. { id: '007', label: '修改信息', icon: '/pages_order/static/center/icon-modifyInfo.png', path: `/pages_order/auth/wxUserInfo?mode=edit` },
  110. { id: '008', label: '退出登录', icon: '/pages_order/static/center/icon-logout.png', key: 'logout' },
  111. ],
  112. }
  113. },
  114. computed: {
  115. ...mapState(['userInfo', 'configList']),
  116. isLogin() {
  117. // todo: delete
  118. return true
  119. return this.userInfo && this.userInfo.id
  120. }
  121. },
  122. onShow() {
  123. if(uni.getStorageSync('token')){
  124. this.$store.commit('getUserInfo')
  125. this.fetchOrderStatistics()
  126. }
  127. },
  128. methods: {
  129. onClick(target) {
  130. const { key, path } = target
  131. switch(key) {
  132. case 'comment':
  133. this.$utils.navigateTo('/pages_order/comment/commentRecords')
  134. break
  135. case 'logout':
  136. this.$store.commit('logout')
  137. break
  138. default:
  139. path && this.$utils.navigateTo(path)
  140. break
  141. }
  142. },
  143. async fetchOrderStatistics() {
  144. return
  145. try {
  146. this.statistics = await this.$fetch('getOrderStatistics', { id: '' })
  147. } catch (err) {
  148. }
  149. },
  150. jumpToBindMember() {
  151. this.$utils.navigateTo('/pages_order/member/memberBind')
  152. },
  153. },
  154. }
  155. </script>
  156. <style scoped lang="scss">
  157. .page__view {
  158. width: 100vw;
  159. min-height: 100vh;
  160. background: $uni-bg-color;
  161. position: relative;
  162. /deep/ .nav-bar__view {
  163. position: fixed;
  164. top: 0;
  165. left: 0;
  166. }
  167. .nav-icon {
  168. width: 200rpx;
  169. height: auto;
  170. vertical-align: top;
  171. }
  172. }
  173. .bg {
  174. width: 100vw;
  175. height: auto;
  176. }
  177. .main {
  178. position: absolute;
  179. top: 176rpx;
  180. left: 0;
  181. width: 100%;
  182. }
  183. .content {
  184. width: 100%;
  185. padding: 16rpx 32rpx 80rpx 32rpx;
  186. box-sizing: border-box;
  187. }
  188. .user {
  189. column-gap: 24rpx;
  190. &-avatar {
  191. flex: none;
  192. width: 100rpx;
  193. height: 100rpx;
  194. border: 4rpx solid #FFFFFF;
  195. border-radius: 50%;
  196. overflow: hidden;
  197. &.is-default {
  198. width: 108rpx;
  199. height: 108rpx;
  200. border: none;
  201. }
  202. &-img {
  203. width: 100%;
  204. height: 100%;
  205. }
  206. }
  207. &-info {
  208. flex: 1;
  209. &-name {
  210. justify-content: flex-start;
  211. column-gap: 16rpx;
  212. font-family: PingFang SC;
  213. color: #FFFFFF;
  214. .highligt {
  215. font-weight: 600;
  216. font-size: 36rpx;
  217. line-height: 1.2;
  218. text-shadow: 0 1px 0 #37313140;
  219. }
  220. .light {
  221. font-size: 24rpx;
  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. }
  267. }
  268. .btn-service {
  269. border: none;
  270. padding: 0;
  271. }
  272. .login {
  273. margin-top: 307rpx;
  274. padding: 0 128rpx;
  275. .btn {
  276. padding: 16rpx 0;
  277. font-family: PingFang SC;
  278. font-weight: 500;
  279. font-size: 36rpx;
  280. line-height: 1.4;
  281. color: #FFFFFF;
  282. background-image: linear-gradient(to right, #21FEEC, #019AF9);
  283. border-radius: 41rpx;
  284. }
  285. .tips {
  286. margin-top: 16rpx;
  287. text-align: center;
  288. font-family: PingFang SC;
  289. font-weight: 400;
  290. font-size: 26rpx;
  291. line-height: 1.4;
  292. color: #A3A3A3;
  293. }
  294. }
  295. .member-bind {
  296. justify-content: space-between;
  297. padding: 32rpx;
  298. background: linear-gradient(to right, #FBFEFF, #DAF3FF);
  299. .left {
  300. font-size: 36rpx;
  301. font-weight: 600;
  302. color: #252545;
  303. }
  304. .right {
  305. column-gap: 16rpx;
  306. .btn {
  307. padding: 6rpx 50rpx;
  308. font-size: 28rpx;
  309. font-weight: 500;
  310. line-height: 1.5;
  311. color: #FFFFFF;
  312. background: linear-gradient(to right, #21FEEC, #019AF9);
  313. border: 2rpx solid #00A9FF;
  314. border-radius: 30rpx;
  315. }
  316. }
  317. }
  318. </style>