pupilMine.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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. }
  241. },
  242. // 头像上传
  243. selectImage() {
  244. let self = this;
  245. wx.chooseImage({
  246. count: 1,
  247. sizeType: ["original", "compressed"],
  248. sourceType: ["album", "camera"],
  249. success: function(res) {
  250. let tempFilePaths = res.tempFilePaths[0];
  251. self.uploadImg(tempFilePaths);
  252. }
  253. });
  254. },
  255. async uploadImg(tempFilePaths) {
  256. var self = this;
  257. uni.showLoading({
  258. title: '上传中',
  259. mask: true
  260. });
  261. uni.uploadFile({
  262. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  263. header: {
  264. 'Authorization': uni.getStorageSync('token')
  265. },
  266. filePath: tempFilePaths,
  267. name: 'file',
  268. formData: {
  269. 'user': 'test'
  270. },
  271. success: (uploadFileRes) => {
  272. let res = JSON.parse(uploadFileRes.data);
  273. if (res.code == 200) {
  274. uni.navigateTo({
  275. url: '/pages_basics/views/avatar?src=' + config.base_url + res.data
  276. .url,
  277. });
  278. } else {
  279. uni.showToast({
  280. title: res.msg,
  281. icon: "none",
  282. mask: true,
  283. duration: 2000
  284. });
  285. }
  286. },
  287. fail: err => {},
  288. complete: () => {
  289. uni.hideLoading()
  290. }
  291. });
  292. },
  293. }
  294. }
  295. </script>
  296. <style lang="stylus" scoped>
  297. .pupilMine {
  298. flex: 1;
  299. display: flex;
  300. flex-direction: column;
  301. overflow-y: scroll;
  302. overflow-x: hidden;
  303. padding-bottom:200rpx;
  304. .back-img-box {
  305. z-index: 0;
  306. position: absolute;
  307. top: 0;
  308. left: 0;
  309. width: 750rpx;
  310. height: 291rpx;
  311. background: linear-gradient(180deg, rgba(1, 131, 250, 1) 0%, rgba(255, 255, 255, 0) 100%);
  312. }
  313. .user-info-box {
  314. z-index: 10;
  315. margin: 39rpx 24rpx 0;
  316. display: flex;
  317. .left-img-box {
  318. width: 132rpx;
  319. height: 132rpx;
  320. position: relative;
  321. margin-right: 22rpx;
  322. .avatar-img {
  323. position: absolute;
  324. top: 6rpx;
  325. left: 6rpx;
  326. width: 116rpx;
  327. height: 116rpx;
  328. border-radius: 50%;
  329. border: 2rpx solid #fff;
  330. }
  331. .edit-img {
  332. z-index: 5;
  333. position: absolute;
  334. right: 0;
  335. bottom: 6rpx;
  336. width: 40rpx;
  337. height: 40rpx;
  338. }
  339. }
  340. .right-name-box {
  341. padding-top: 6rpx;
  342. .right-name-top-box {
  343. display: flex;
  344. view:nth-child(1) {
  345. height: 68rpx;
  346. line-height: 62rpx;
  347. font-size: 32rpx;
  348. color: #fff;
  349. }
  350. view:nth-child(2) {
  351. margin-top: 14rpx;
  352. margin-left: 30rpx;
  353. width: 120rpx;
  354. height: 40rpx;
  355. line-height: 40rpx;
  356. background: #FF8C00;
  357. border-radius: 50rpx;
  358. font-size: 24rpx;
  359. color: #fff;
  360. text-align: center;
  361. }
  362. }
  363. .right-name-bottom-box {
  364. height: 50rpx;
  365. line-height: 50rpx;
  366. font-size: 28rpx;
  367. color: #fff;
  368. }
  369. }
  370. }
  371. .points-max-box {
  372. z-index: 10;
  373. width: 690rpx;
  374. height: 160rpx;
  375. background: #FFFFFF;
  376. border-radius: 20rpx;
  377. margin: 38rpx 30rpx 0;
  378. display: flex;
  379. .points-big-box {
  380. flex: 1;
  381. .num-p {
  382. margin: 39rpx 0 19rpx 0;
  383. text-align: center;
  384. font-size: 28rpx;
  385. line-height: 39rpx;
  386. }
  387. .img-box {
  388. display: flex;
  389. img {
  390. width: 30rpx;
  391. height: 30rpx;
  392. display: block;
  393. margin: 0 20rpx 0 42rpx;
  394. }
  395. view {
  396. color: #333333;
  397. line-height: 30rpx;
  398. font-size: 28rpx;
  399. }
  400. }
  401. .colorA {
  402. color: #0183FA;
  403. }
  404. .colorB {
  405. color: #26C736;
  406. }
  407. .colorC {
  408. color: #333333;
  409. }
  410. }
  411. .border-null-p {
  412. width: 1rpx;
  413. height: 40rpx;
  414. margin: 60rpx 0 0;
  415. background-color: #e0e0e0;
  416. }
  417. }
  418. .button-max-big-box {
  419. background-color: #fff;
  420. border-radius: 20rpx;
  421. margin: 20rpx 30rpx 0;
  422. .button-big-box:nth-child(1) {
  423. border-top: none;
  424. }
  425. .button-big-box {
  426. border-top: 1px solid #E0E0E0;
  427. display: flex;
  428. padding: 0 30rpx 0 26rpx;
  429. .left-img {
  430. display: block;
  431. width: 36rpx;
  432. height: 36rpx;
  433. margin-top: 25rpx;
  434. margin-right: 21rpx;
  435. }
  436. .left-text-p {
  437. flex: 1;
  438. front-size: 30rpx;
  439. line-height: 40rpx;
  440. margin: 20rpx 0;
  441. }
  442. .right-text-p {
  443. front-size: 30rpx;
  444. line-height: 40rpx;
  445. margin: 20rpx 0;
  446. }
  447. .right-img {
  448. display: block;
  449. width: 30rpx;
  450. height: 30rpx;
  451. margin-top: 28rpx;
  452. }
  453. }
  454. .color-D{
  455. color:#0183FA!important;
  456. }
  457. }
  458. .null-flex-p{
  459. flex:1;
  460. }
  461. .out-button {
  462. // position absolute;
  463. // bottom: 140rpx;
  464. // left: 75rpx;
  465. margin:20rpx 0 20rpx 75rpx;
  466. width: 600rpx;
  467. height: 80rpx;
  468. line-height: 80rpx;
  469. border-radius: 100rpx;
  470. text-align center;
  471. background #0183FA;
  472. color: #ffffff;
  473. font-size: 30rpx;
  474. }
  475. }
  476. </style>