pupilMine.vue 12 KB

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