pupilMine.vue 12 KB

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