teacherMine.vue 13 KB

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