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

365 lines
8.2 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="@/static/image/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/common?key=instruc&title=服用说明` },
  105. ],
  106. list2: [
  107. { id: '005', label: '我的评价', icon: '/pages_order/static/center/icon-comment.png', path: `/pages_order/comment/commentRecords` },
  108. // todo: check key
  109. { id: '006', label: '开营通知', icon: '/pages_order/static/center/icon-msg.png', path: `/pages_order/common?key=aboutUs&title=关于我们` },
  110. { id: '007', label: '修改信息', icon: '/pages_order/static/center/icon-modifyInfo.png', path: `/pages_order/auth/wxUserInfo?mode=edit` },
  111. { id: '008', label: '退出登录', icon: '/pages_order/static/center/icon-logout.png', key: 'logout' },
  112. ],
  113. }
  114. },
  115. computed: {
  116. ...mapState(['userInfo', 'configList']),
  117. isLogin() {
  118. // todo: delete
  119. return true
  120. return this.userInfo && this.userInfo.id
  121. }
  122. },
  123. onShow() {
  124. if(uni.getStorageSync('token')){
  125. this.$store.commit('getUserInfo')
  126. this.fetchOrderStatistics()
  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. async fetchOrderStatistics() {
  145. return
  146. try {
  147. this.statistics = await this.$fetch('getOrderStatistics', { id: '' })
  148. } catch (err) {
  149. }
  150. },
  151. jumpToBindMember() {
  152. this.$utils.navigateTo('/pages_order/member/memberBind')
  153. },
  154. },
  155. }
  156. </script>
  157. <style scoped lang="scss">
  158. .page__view {
  159. width: 100vw;
  160. min-height: 100vh;
  161. background-color: $uni-bg-color;
  162. position: relative;
  163. /deep/ .nav-bar__view {
  164. position: fixed;
  165. top: 0;
  166. left: 0;
  167. }
  168. .nav-icon {
  169. width: 200rpx;
  170. height: auto;
  171. vertical-align: top;
  172. }
  173. }
  174. .bg {
  175. width: 100vw;
  176. height: auto;
  177. }
  178. .main {
  179. position: absolute;
  180. top: 176rpx;
  181. left: 0;
  182. width: 100%;
  183. }
  184. .content {
  185. width: 100%;
  186. padding: 16rpx 32rpx 80rpx 32rpx;
  187. box-sizing: border-box;
  188. }
  189. .user {
  190. column-gap: 24rpx;
  191. &-avatar {
  192. flex: none;
  193. width: 100rpx;
  194. height: 100rpx;
  195. border: 4rpx solid #FFFFFF;
  196. border-radius: 50%;
  197. overflow: hidden;
  198. &.is-default {
  199. width: 108rpx;
  200. height: 108rpx;
  201. border: none;
  202. }
  203. &-img {
  204. width: 100%;
  205. height: 100%;
  206. }
  207. }
  208. &-info {
  209. flex: 1;
  210. &-name {
  211. justify-content: flex-start;
  212. column-gap: 16rpx;
  213. font-family: PingFang SC;
  214. color: #FFFFFF;
  215. .highligt {
  216. font-weight: 600;
  217. font-size: 36rpx;
  218. line-height: 1.2;
  219. text-shadow: 0 1px 0 #37313140;
  220. }
  221. .light {
  222. font-size: 24rpx;
  223. }
  224. }
  225. &-desc {
  226. margin-top: 4rpx;
  227. font-family: PingFang SC;
  228. font-weight: 400;
  229. font-size: 24rpx;
  230. line-height: 1.8;
  231. color: #FFFFFF;
  232. text-shadow: 0 1px 0 #37313140;
  233. }
  234. &-tips {
  235. font-family: PingFang SC;
  236. font-weight: 400;
  237. font-size: 36rpx;
  238. line-height: 1.2;
  239. color: #FFFFFF;
  240. }
  241. }
  242. }
  243. .card {
  244. margin-top: 32rpx;
  245. width: 100%;
  246. background: #FFFFFF;
  247. border: 2rpx solid #FFFFFF;
  248. border-radius: 32rpx;
  249. box-sizing: border-box;
  250. .row {
  251. justify-content: space-between;
  252. width: 100%;
  253. padding: 40rpx;
  254. box-sizing: border-box;
  255. .label {
  256. font-family: PingFang SC;
  257. font-weight: 400;
  258. font-size: 28rpx;
  259. line-height: 1;
  260. color: #252545;
  261. .icon {
  262. margin-right: 16rpx;
  263. width: 40rpx;
  264. height: 40rpx;
  265. }
  266. }
  267. }
  268. }
  269. .btn-service {
  270. border: none;
  271. padding: 0;
  272. }
  273. .login {
  274. margin-top: 307rpx;
  275. padding: 0 128rpx;
  276. .btn {
  277. padding: 16rpx 0;
  278. font-family: PingFang SC;
  279. font-weight: 500;
  280. font-size: 36rpx;
  281. line-height: 1.4;
  282. color: #FFFFFF;
  283. background-image: linear-gradient(to right, #21FEEC, #019AF9);
  284. border-radius: 41rpx;
  285. }
  286. .tips {
  287. margin-top: 16rpx;
  288. text-align: center;
  289. font-family: PingFang SC;
  290. font-weight: 400;
  291. font-size: 26rpx;
  292. line-height: 1.4;
  293. color: #A3A3A3;
  294. }
  295. }
  296. .member-bind {
  297. justify-content: space-between;
  298. padding: 32rpx;
  299. background: linear-gradient(to right, #FBFEFF, #DAF3FF);
  300. .left {
  301. font-size: 36rpx;
  302. font-weight: 600;
  303. color: #252545;
  304. }
  305. .right {
  306. column-gap: 16rpx;
  307. .btn {
  308. padding: 6rpx 50rpx;
  309. font-size: 28rpx;
  310. font-weight: 500;
  311. line-height: 1.5;
  312. color: #FFFFFF;
  313. background: linear-gradient(to right, #21FEEC, #019AF9);
  314. border: 2rpx solid #00A9FF;
  315. border-radius: 30rpx;
  316. }
  317. }
  318. }
  319. </style>