pupilMine.vue 11 KB

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