pupilMine.vue 11 KB

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