洛阳学员端
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.

266 lines
7.2 KiB

10 months ago
10 months ago
3 months ago
3 months ago
3 months ago
10 months ago
10 months ago
10 months ago
5 months ago
10 months ago
4 months ago
10 months ago
3 months ago
10 months ago
3 months ago
3 months ago
10 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
10 months ago
10 months ago
10 months ago
3 months ago
3 months ago
10 months ago
4 months ago
10 months ago
  1. <template>
  2. <view class="pageBg">
  3. <view class="pad">
  4. <view class="avatarBox" @click="editAvatar">
  5. <view class="avatar">
  6. <image :src="vuex_userInfo.newPhotoPath?vuex_userInfo.newPhotoPath:vuex_userInfo.photoPath" mode="aspectFill"></image>
  7. <view class="imgMask" v-if="vuex_userInfo.avatarCheckStatus==0&&vuex_userInfo.newPhotoPath">审核中</view>
  8. <view class="imgMask" v-if="vuex_userInfo.avatarCheckStatus==2&&vuex_userInfo.newPhotoPath" style="color: red;">审核失败</view>
  9. </view>
  10. <view class="editBtn" v-if="vuex_userInfo.avatarCheckStatus!=0">修改头像</view>
  11. </view>
  12. <view class="card">
  13. <view class="row">
  14. <view class="lab">手机号</view>
  15. <view class="val">{{ vuex_userInfo.phone }}</view>
  16. </view>
  17. </view>
  18. <view class="card" v-if="vuex_userInfo.schoolName">
  19. <view class="row border">
  20. <view class="lab">我的驾校</view>
  21. <view class="val">{{ vuex_userInfo.schoolName||'' }}</view>
  22. </view>
  23. <view class="row border">
  24. <view class="lab">我的教练</view>
  25. <view class="val">{{ vuex_userInfo.coachName||'' }}</view>
  26. </view>
  27. <view class="row border">
  28. <view class="lab">所学车型</view>
  29. <view class="val">{{ vuex_userInfo.trainType||'' }}</view>
  30. </view>
  31. <view class="row">
  32. <view class="lab">报名时间</view>
  33. <view class="val">{{ $u.timeFormat(vuex_userInfo.applyDate, 'yyyy-mm-dd hh:MM:ss')}}</view>
  34. </view>
  35. </view>
  36. <view class="card" v-if="vuex_userInfo.cardType>1" @click="$goPage('/pages/mineEntry/personaInfo/myInfo')">
  37. <view class="row">
  38. <view class="lab">个人信息</view>
  39. <view class="flex">
  40. <view class="val">查看</view>
  41. <view class="icon">
  42. <u-icon name="arrow-right"></u-icon>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="card" v-if="vuex_userInfo.cardType==1">
  48. <view class="row">
  49. <view class="lab">实名认证</view>
  50. <view class="val">已完成</view>
  51. </view>
  52. </view>
  53. <!-- <view class="card" v-if="vuex_userInfo.cardType==1">
  54. <view class="row">
  55. <view class="lab">拍照&体检&面签</view>
  56. <view class="val">已完成</view>
  57. </view>
  58. </view> -->
  59. <!-- <view class="logout" @click="deleteTestClick" style="margin-top: 40rpx;">删除测试账号开发用的</view> -->
  60. </view>
  61. <view class="footerBtn">
  62. <view class="btnBg" @click="logOutFn">退出登录</view>
  63. <view class="AccountCancellation" @click="AccountCanceFn">注销账号</view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import { logOut,deleteTest, avatarApply } from '@/config/api.js'
  69. import { uploadImgApi } from '@/config/utils.js'
  70. export default {
  71. data() {
  72. return {
  73. avatarLink: '',
  74. photoPath: ''
  75. }
  76. },
  77. onLoad() {
  78. this.$store.dispatch('getUserInfo')
  79. uni.$on('uAvatarCropper', async (res)=>{
  80. const photoPath = await uploadImgApi(res, 'face')
  81. this.photoPath = photoPath
  82. this.avatarApplyFn()
  83. })
  84. },
  85. onShow() {
  86. if(uni.getStorageSync('avatarBase64')) this.avatarBase64 = uni.getStorageSync('avatarBase64')
  87. },
  88. methods: {
  89. // 修改头像申请
  90. async avatarApplyFn() {
  91. const res = await avatarApply({avatarImg: this.photoPath})
  92. if(res.code==0) {
  93. this.$u.toast('申请成功,等待审核')
  94. }
  95. this.$store.dispatch('getUserInfo')
  96. console.log('申请成功')
  97. console.log(res)
  98. },
  99. // 点击修改头像
  100. editAvatar() {
  101. if(this.vuex_userInfo.avatarCheckStatus==0) return false
  102. this.uploadTapFn()
  103. },
  104. uploadTapFn() {
  105. const _this = this;
  106. uni.chooseImage({
  107. count: 1, // 默认9
  108. sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
  109. sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
  110. success: (res) => {
  111. let url = res.tempFilePaths[0];
  112. // 获取裁剪图片资源后,给data添加src属性及其值
  113. console.log('跳转到哪了?')
  114. // uni.navigateTo({
  115. // url: '/pages/mineEntry/uAvatarCropper/uAvatarCropper?src=' + encodeURIComponent(url)
  116. // })
  117. uni.navigateTo({
  118. url: '/pages/indexEntry/enroll/uploadAvatar/uAvatarCropper/uAvatarCropper?url=' + encodeURIComponent(url)
  119. })
  120. }
  121. });
  122. },
  123. AccountCanceFn() {
  124. this.$goPage('/pages/mineEntry/personaInfo/AccountCance')
  125. },
  126. logOutFn() {
  127. let _this = this
  128. uni.showModal({
  129. content: '确定要退出登录吗?',
  130. success: async function (res) {
  131. if (res.confirm) {
  132. logOut().then(()=>{
  133. _this.$store.commit('goLogin')
  134. }).catch(()=>{
  135. _this.$store.commit('goLogin')
  136. })
  137. } else if (res.cancel) {
  138. console.log('用户点击取消');
  139. }
  140. }
  141. });
  142. },
  143. async deleteTestClick() {
  144. const res = await deleteTest({phone: this.vuex_userInfo.phone})
  145. this.$store.commit('goLogin')
  146. console.log(res)
  147. },
  148. uploadTap() {
  149. // let studentId = uni.getStorageSync('studentId')
  150. // if(!studentId&&!this.havePay) return false
  151. const _this = this;
  152. uni.chooseImage({
  153. count: 1, // 默认9
  154. sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
  155. sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
  156. success: (res) => {
  157. let url = res.tempFilePaths[0];
  158. // 获取裁剪图片资源后,给data添加src属性及其值
  159. uni.navigateTo({
  160. url: '/pages/indexEntry/enroll/uploadAvatar/uAvatarCropper/uAvatarCropper?url=' + encodeURIComponent(url)
  161. })
  162. }
  163. });
  164. },
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. .editBtn {
  170. padding: 10rpx 20rpx ;
  171. border: 1rpx solid #ebedf0;
  172. font-size: 28rpx;
  173. color: #333;
  174. border-radius: 10rpx;
  175. margin: 10rpx 0 30rpx 0;
  176. background-color: #fff;
  177. }
  178. .card {
  179. padding: 6rpx;
  180. margin-bottom: 20rpx;
  181. }
  182. .pad {
  183. overflow: hidden;
  184. }
  185. .avatarBox {
  186. display: flex;
  187. flex-direction: column;
  188. justify-content: center;
  189. align-items: center;
  190. position: relative;
  191. .avatar {
  192. width: 175rpx;
  193. height: 175rpx;
  194. border-radius: 50%;
  195. overflow: hidden;
  196. background-color: #E8E9EC;
  197. position: relative;
  198. .imgMask {
  199. position: absolute;
  200. left: 0;
  201. right: 0;
  202. top: 0;
  203. bottom: 0;
  204. // background: rgba(0,0,0,1);
  205. background-color: rgba(0,0,0,0.4);
  206. font-size: 24rpx;
  207. color: rgba(255,255,255,0.8);
  208. // opacity: 0.4;
  209. line-height: 104rpx;
  210. text-align: center;
  211. }
  212. }
  213. .phoneIcon {
  214. width: 46rpx;
  215. height: 46rpx;
  216. position: absolute;
  217. right: 0;
  218. bottom: 0;
  219. z-index: 9;
  220. }
  221. }
  222. .row {
  223. display: flex;
  224. align-items: center;
  225. justify-content: space-between;
  226. height: 98rpx;
  227. font-size: 28rpx;
  228. padding: 0 30rpx;
  229. &.border {
  230. border-bottom: 2rpx solid #E8E9EC;
  231. }
  232. }
  233. .logout {
  234. width: 396rpx;
  235. height: 72rpx;
  236. background: #FFFFFF;
  237. border-radius: 8rpx;
  238. border: 2rpx solid #E8E9EC;
  239. font-size: 28rpx;
  240. color: #ADADAD;
  241. text-align: center;
  242. line-height: 72rpx;
  243. margin: 88rpx auto;
  244. }
  245. .AccountCancellation {
  246. border: 1px solid #d1d1d1;;
  247. border-radius: 8rpx;
  248. border-color: linear-gradient(180deg, #3593FB 0%, #53D3E5 100%);
  249. line-height: 72rpx;
  250. color: #999;
  251. text-align: center;
  252. font-size: 28rpx;
  253. margin-top: 30rpx;
  254. }
  255. </style>