pupilMine.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <view class="pupilMine">
  3. <!-- 背景渐变色 -->
  4. <view class="back-img-box"></view>
  5. <!-- 信息面板 -->
  6. <view class="user-info-box">
  7. <view class="left-img-box">
  8. <img v-if="userData.avatar" class="avatar-img" :src="userData.avatar">
  9. <img v-else class="avatar-img" src="@/pages/images/icon_01.png">
  10. <img class="edit-img" src="@/pages/images/newImage/icon_wd_bj@1x.png">
  11. </view>
  12. <view class="right-name-box">
  13. <view class="right-name-top-box">
  14. <view>{{userData.userName}}</view>
  15. <view v-if="negativeType">负面清单</view>
  16. </view>
  17. <view class="right-name-bottom-box">{{userData.deptName}}</view>
  18. </view>
  19. </view>
  20. <!-- 信用分面板 -->
  21. <view class="points-max-box">
  22. <view class="points-big-box">
  23. <view class="num-p colorA">{{creditScore?creditScore:'-'}}</view>
  24. <view class="img-box">
  25. <img src="@/pages/images/newImage/icon_wd_xyf@1x.png">
  26. <view>信用分</view>
  27. </view>
  28. </view>
  29. <view class="border-null-p"></view>
  30. <view class="points-big-box">
  31. <view class="num-p colorB">{{bonusPoints?bonusPoints:'-'}}</view>
  32. <view class="img-box">
  33. <img src="@/pages/images/newImage/icon_wd_jlf@1x.png">
  34. <view>奖励分</view>
  35. </view>
  36. </view>
  37. <view class="border-null-p"></view>
  38. <view class="points-big-box">
  39. <view class="num-p colorC">扫一扫</view>
  40. <view class="img-box">
  41. <img style="margin-left:30rpx;" src="@/pages/images/newImage/icon_wd_dh@1x.png">
  42. <view>积分兑换</view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 按钮部分 -->
  47. <view class="button-max-big-box">
  48. <view class="button-big-box" @click="goPage('entryAndExitRecordPupil')">
  49. <img class="left-img" src="@/pages/images/newImage/icon_wd_jcjl.png">
  50. <view class="left-text-p">进出记录</view>
  51. <view class="right-text-p"></view>
  52. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  53. </view>
  54. </view>
  55. <view class="button-max-big-box">
  56. <view class="button-big-box" @click="goPage('identityAuthenticationPupil')">
  57. <img class="left-img" src="@/pages/images/newImage/icon_wd_sfyz@1x.png">
  58. <view class="left-text-p">身份验证</view>
  59. <view class="right-text-p"></view>
  60. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  61. </view>
  62. <view class="button-big-box" @click="goPage('electronicSignaturePupil')">
  63. <img class="left-img" src="@/pages/images/newImage/icon_wd_dzqm@1x.png">
  64. <view class="left-text-p">电子签名</view>
  65. <view class="right-text-p"></view>
  66. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  67. </view>
  68. </view>
  69. <view class="out-button" @click="clickOut">退出登录</view>
  70. <tab-bar></tab-bar>
  71. </view>
  72. </template>
  73. <script>
  74. import {
  75. config
  76. } from '@/api/request/config.js'
  77. import {
  78. logout,
  79. systemUserProfile,
  80. examPointsRecordGetMyPointsLogInfo,
  81. } from '@/pages/api/index.js'
  82. import {
  83. pageRestrictVerify
  84. } from '@/utils/index'
  85. import {
  86. tabBar
  87. } from '@/pages/component/tabBar.vue'
  88. export default {
  89. name: "pupilMine",
  90. components: {
  91. tabBar,
  92. },
  93. data() {
  94. return {
  95. userData:{},
  96. bonusPoints:null,
  97. creditScore:null,
  98. negativeType:false,
  99. }
  100. },
  101. created() {
  102. },
  103. mounted() {
  104. this.systemUserProfile();
  105. this.examPointsRecordGetMyPointsLogInfo();
  106. },
  107. methods: {
  108. goPage(type) {
  109. if (!pageRestrictVerify(type)) {
  110. uni.showToast({
  111. title: '没有相关权限,请联系管理员',
  112. icon: "none",
  113. mask: true,
  114. duration: 2000
  115. });
  116. return
  117. }
  118. if (type == 'entryAndExitRecordPupil') {
  119. //进出记录
  120. }else if (type == 'identityAuthenticationPupil') {
  121. //身份验证
  122. } else if (type == 'electronicSignaturePupil') {
  123. //电子签名
  124. }
  125. },
  126. //获取个人信息
  127. async systemUserProfile() {
  128. const {
  129. data
  130. } = await systemUserProfile();
  131. if (data.code == 200) {
  132. this.$set(this, 'userData', data.data)
  133. uni.setStorageSync('faceImg', data.data.faceImg);
  134. }
  135. },
  136. //查询学生-信用分/奖励分
  137. async examPointsRecordGetMyPointsLogInfo() {
  138. const {
  139. data
  140. } = await examPointsRecordGetMyPointsLogInfo();
  141. if (data.code == 200) {
  142. this.bonusPoints = data.data.bonusPoints;
  143. this.creditScore = data.data.creditScore;
  144. }
  145. },
  146. //退出按钮
  147. clickOut() {
  148. let self = this;
  149. uni.showModal({
  150. // title: '确认要退出吗?',
  151. content: '确认要退出吗',
  152. cancelColor: "#999",
  153. confirmColor: "#0183FA",
  154. success: function(res) {
  155. if (res.confirm) {
  156. self.logout();
  157. } else if (res.cancel) {}
  158. }
  159. });
  160. },
  161. //退出登录
  162. async logout() {
  163. let self = this;
  164. const {
  165. data
  166. } = await logout();
  167. if (data.code == 200) {
  168. uni.removeStorageSync('token');
  169. uni.removeStorageSync('userId');
  170. uni.removeStorageSync('userType');
  171. uni.redirectTo({
  172. url: '/pages/views/login/login',
  173. });
  174. }
  175. },
  176. // 头像上传
  177. selectImage() {
  178. let self = this;
  179. wx.chooseImage({
  180. count: 1,
  181. sizeType: ["original", "compressed"],
  182. sourceType: ["album", "camera"],
  183. success: function(res) {
  184. let tempFilePaths = res.tempFilePaths[0];
  185. self.uploadImg(tempFilePaths);
  186. }
  187. });
  188. },
  189. async uploadImg(tempFilePaths) {
  190. var self = this;
  191. uni.showLoading({
  192. title: '上传中',
  193. mask: true
  194. });
  195. uni.uploadFile({
  196. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  197. header: {
  198. 'Authorization': uni.getStorageSync('token')
  199. },
  200. filePath: tempFilePaths,
  201. name: 'file',
  202. formData: {
  203. 'user': 'test'
  204. },
  205. success: (uploadFileRes) => {
  206. let res = JSON.parse(uploadFileRes.data);
  207. if (res.code == 200) {
  208. uni.navigateTo({
  209. url: '/pages_basics/views/avatar?src=' + config.base_url + res.data.url,
  210. });
  211. } else {
  212. uni.showToast({
  213. title: res.msg,
  214. icon: "none",
  215. mask: true,
  216. duration: 2000
  217. });
  218. }
  219. },
  220. fail: err => {},
  221. complete: () => {
  222. uni.hideLoading()
  223. }
  224. });
  225. },
  226. }
  227. }
  228. </script>
  229. <style lang="stylus" scoped>
  230. .pupilMine {
  231. flex: 1;
  232. display: flex;
  233. flex-direction: column;
  234. overflow: hidden;
  235. .back-img-box{
  236. z-index:0;
  237. position: absolute;
  238. top:0;
  239. left: 0;
  240. width:750rpx;
  241. height:291rpx;
  242. background: linear-gradient(180deg, rgba(1,131,250,1) 0%, rgba(255,255,255,0) 100%);
  243. }
  244. .user-info-box{
  245. z-index:10;
  246. margin:39rpx 24rpx 0;
  247. display: flex;
  248. .left-img-box{
  249. width:132rpx;
  250. height:132rpx;
  251. position: relative;
  252. margin-right:22rpx;
  253. .avatar-img{
  254. position: absolute;
  255. top:6rpx;
  256. left:6rpx;
  257. width:116rpx;
  258. height:116rpx;
  259. border-radius:50%;
  260. border:2rpx solid #fff;
  261. }
  262. .edit-img{
  263. z-index:5;
  264. position: absolute;
  265. right:0;
  266. bottom:6rpx;
  267. width:40rpx;
  268. height:40rpx;
  269. }
  270. }
  271. .right-name-box{
  272. padding-top:6rpx;
  273. .right-name-top-box{
  274. display: flex;
  275. view:nth-child(1){
  276. height:68rpx;
  277. line-height:62rpx;
  278. font-size:32rpx;
  279. color:#fff;
  280. }
  281. view:nth-child(2){
  282. margin-top:14rpx;
  283. margin-left:30rpx;
  284. width: 120rpx;
  285. height:40rpx;
  286. line-height:40rpx;
  287. background: #FF8C00;
  288. border-radius: 50rpx;
  289. font-size:24rpx;
  290. color:#fff;
  291. text-align: center;
  292. }
  293. }
  294. .right-name-bottom-box{
  295. height:50rpx;
  296. line-height:50rpx;
  297. font-size:28rpx;
  298. color:#fff;
  299. }
  300. }
  301. }
  302. .points-max-box{
  303. z-index:10;
  304. width: 690rpx;
  305. height: 160rpx;
  306. background: #FFFFFF;
  307. border-radius: 20rpx;
  308. margin:38rpx 30rpx 0;
  309. display: flex;
  310. .points-big-box{
  311. flex:1;
  312. .num-p{
  313. margin:39rpx 0 19rpx 0;
  314. text-align: center;
  315. font-size:28rpx;
  316. line-height:39rpx;
  317. }
  318. .img-box{
  319. display: flex;
  320. img{
  321. width:30rpx;
  322. height:30rpx;
  323. display: block;
  324. margin:0 20rpx 0 42rpx;
  325. }
  326. view{
  327. color:#333333;
  328. line-height:30rpx;
  329. font-size:28rpx;
  330. }
  331. }
  332. .colorA{
  333. color:#0183FA;
  334. }
  335. .colorB{
  336. color:#26C736;
  337. }
  338. .colorC{
  339. color:#333333;
  340. }
  341. }
  342. .border-null-p{
  343. width:1rpx;
  344. height:40rpx;
  345. margin:60rpx 0 0;
  346. background-color: #e0e0e0;
  347. }
  348. }
  349. .button-max-big-box{
  350. background-color: #fff;
  351. border-radius:20rpx;
  352. margin:20rpx 30rpx 0;
  353. .button-big-box:nth-child(1){
  354. border-top:none;
  355. }
  356. .button-big-box{
  357. border-top:1px solid #E0E0E0;
  358. display: flex;
  359. padding:0 30rpx 0 26rpx;
  360. .left-img{
  361. display: block;
  362. width:36rpx;
  363. height:36rpx;
  364. margin-top:25rpx;
  365. margin-right:21rpx;
  366. }
  367. .left-text-p{
  368. flex:1;
  369. front-size:30rpx;
  370. line-height:40rpx;
  371. margin:20rpx 0;
  372. }
  373. .right-text-p{
  374. front-size:30rpx;
  375. line-height:40rpx;
  376. margin:20rpx 0;
  377. }
  378. .right-img{
  379. display: block;
  380. width:30rpx;
  381. height:30rpx;
  382. margin-top:28rpx;
  383. }
  384. }
  385. }
  386. .out-button {
  387. position absolute;
  388. bottom: 140rpx;
  389. left: 75rpx;
  390. width: 600rpx;
  391. height: 80rpx;
  392. line-height: 80rpx;
  393. border-radius: 100rpx;
  394. text-align center;
  395. background #0183FA;
  396. color: #ffffff;
  397. font-size: 30rpx;
  398. margin: 0 auto;
  399. }
  400. }
  401. </style>