mine.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. <!-- 我的 -->
  2. <template>
  3. <view id="mine">
  4. <view class="top-max-big-box" v-if="pageType">
  5. <!--老师-->
  6. <view class="top-max-box-two" v-if="userType==1&&certification.auditStatus">
  7. <view class="user-img-box" @click="selectImage">
  8. <img v-if="userData.avatar" :src="userData.avatarUrl">
  9. <img v-else src="@/images/basicsModules/icon_01.png">
  10. <view>{{userData.avatar?'编辑':'未上传'}}</view>
  11. </view>
  12. <view class="name-box">
  13. <view>{{userData.userName}}</view>
  14. <view>{{userData.professional}}丨{{userData.deptName}}</view>
  15. </view>
  16. </view>
  17. <!--学生-->
  18. <view class="user-top-max-box-one" v-if="userType==2">
  19. <view class="back-posi"></view>
  20. <view class="top-max-box-one">
  21. <view class="user-img-box" @click="selectImage">
  22. <img v-if="userData.avatar" :src="userData.avatarUrl">
  23. <img v-else src="@/images/basicsModules/icon_01.png">
  24. <view>{{userData.avatar?'编辑':'未上传'}}</view>
  25. </view>
  26. <view class="name-box">
  27. <view class="name-box-min">
  28. <view>{{userData.userName}}</view>
  29. <view :class="userData.status == 2?'view-color-one':(userData.status == 3?'view-color-two':(userData.status == 1?'view-color-tree':''))">{{userData.status == 2?'负面清单':(userData.status == 3?'黑名单':(userData.status == 1?'正常':''))}}</view>
  30. </view>
  31. <view class="name-box-user">{{userData.professional}}丨{{userData.deptName}}</view>
  32. </view>
  33. </view>
  34. <view class="num-max-box">
  35. <view class="min-num-box" @click="goUserPage('none')">
  36. <view class="min-num-view color-one">{{creditScore}}</view>
  37. <view class="bottom-min-num-view">
  38. <img class="img-one" src="@/images/basicsModules/icon_wd_xyf.png">
  39. <view>信用分</view>
  40. </view>
  41. </view>
  42. <view class="null-p"></view>
  43. <view class="min-num-box" @click="goUserPage('none')">
  44. <view class="min-num-view color-two">{{bonusPoints}}</view>
  45. <view class="bottom-min-num-view">
  46. <img class="img-two" src="@/images/basicsModules/icon_wd_jlf.png">
  47. <view>奖励分</view>
  48. </view>
  49. </view>
  50. <view class="null-p"></view>
  51. <view class="min-num-box" @click="goUserPage(3)">
  52. <view class="min-num-view">扫一扫</view>
  53. <view class="bottom-min-num-view">
  54. <img class="img-two" src="@/images/basicsModules/icon_wd_dh.png">
  55. <view>兑换礼品</view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <mineConfigurationSlot v-for="(item,index) in mineConfigData" :key="index" :mineConfig="item"></mineConfigurationSlot>
  62. <view class="out-button" @click="clickOut">退出登录</view>
  63. <tab-bar></tab-bar>
  64. </view>
  65. </template>
  66. <script>
  67. import { config } from '@/api/request/config.js'
  68. import { logout,studentinfoFacemy,simpleInfo,getSafeWarnList,getMyPointsLogInfo,
  69. querySignature,fingerprintQuantity,fingerprintQueryList,systemAppletLayoutSelect} from '@/api/basicsModules/index.js'
  70. import { tabBar } from '@/component/tabBar.vue'
  71. import { mineConfigurationSlot } from '@/component/mineConfigurationSlot'
  72. import { getMineConfig } from '@/utils/mineConfig'
  73. export default {
  74. components: {
  75. tabBar,
  76. mineConfigurationSlot,
  77. },
  78. data() {
  79. return {
  80. mineConfigData: [],
  81. //页面状态
  82. pageType:false,
  83. //认证数据
  84. certification:{
  85. },
  86. userType:0,
  87. userData:{
  88. deptName: "",
  89. professional: "",
  90. userName: "",
  91. },
  92. securityAlertNum:0,
  93. adminSubCount:0,
  94. wranDoCount:0,
  95. //奖励分
  96. bonusPoints:0,
  97. //信用分
  98. creditScore:0,
  99. //用户签名
  100. signatureUrl:'',
  101. // 人脸
  102. ifFaceFeature:"",
  103. //签名
  104. isUpload:"",
  105. Quantity:0,//指纹录取数量
  106. }
  107. },
  108. onLoad() {
  109. },
  110. onShow(){
  111. this.systemAppletLayoutSelect();
  112. if(uni.getStorageSync('token')&&uni.getStorageSync('userId')&&uni.getStorageSync('userType')){
  113. this.userType = uni.getStorageSync('userType')
  114. this.studentinfoFacemy();
  115. this.simpleInfo();
  116. this.querySignature();
  117. }else{
  118. uni.removeStorageSync('token');
  119. uni.removeStorageSync('userId');
  120. uni.removeStorageSync('userType');
  121. uni.redirectTo({
  122. url: '/pages/login',
  123. });
  124. }
  125. },
  126. methods: {
  127. //获取菜单配置
  128. async systemAppletLayoutSelect() {
  129. const {data} = await systemAppletLayoutSelect({module:'mine'})
  130. if(data.code == 200){
  131. let list = JSON.parse(JSON.stringify(data.data))
  132. for(let i=0;i<list.length;i++){
  133. list[i].layout = JSON.parse(list[i].layout);
  134. }
  135. this.$set(this,'mineConfigData',getMineConfig(list));
  136. console.log('mineConfigData',this.mineConfigData)
  137. }
  138. },
  139. //学生端-信用分/奖励分/扫一扫按钮
  140. goUserPage(type){
  141. let self = this;
  142. if(type == 1){
  143. uni.navigateTo({
  144. url: '/pages_student/mine/creditPoints',
  145. });
  146. }else if(type == 2){
  147. uni.navigateTo({
  148. url: '/pages_student/mine/rewardPoints',
  149. });
  150. }else if(type == 3){
  151. uni.scanCode({
  152. onlyFromCamera: true,
  153. success: function (res) {
  154. uni.navigateTo({
  155. url: '/pages_student/integralManage/codeSuccess?q='+encodeURIComponent(JSON.stringify(res.result))
  156. });
  157. }
  158. });
  159. }else if(type == 'none'){
  160. uni.showToast({
  161. title: '暂未开放',
  162. icon:"none",
  163. mask:true,
  164. duration: 2000
  165. });
  166. }
  167. },
  168. //获取个人信息
  169. async simpleInfo(){
  170. const {data} = await simpleInfo();
  171. if(data.code == 200){
  172. this.userData = data.data;
  173. this.userData.avatar=data.data.avatar;
  174. this.userData.avatarUrl=config.base_url+data.data.avatar;
  175. console.log(config.base_url)
  176. console.log(this.userData.avatarUrl)
  177. if(this.userType == 1){
  178. this.getSafeWarnList();
  179. }else if(this.userType == 2){
  180. //this.getMyPointsLogInfo();
  181. }
  182. if(data.data.count){
  183. this.adminSubCount = data.data.count.adminSubCount;
  184. this.wranDoCount = data.data.count.wranDoCount;
  185. }
  186. this.pageType = true;
  187. }
  188. },
  189. //查询用户指纹录取数量
  190. async fingerprintQuantityFun(){
  191. let _this=this;
  192. const {data} = await fingerprintQuantity(uni.getStorageSync('userId'));
  193. if(data.code == 200){
  194. _this.Quantity=data.data;
  195. }
  196. },
  197. //查询用户指纹录取数据
  198. async fingerprintClick(){
  199. let _this=this;
  200. const {data} = await fingerprintQueryList(uni.getStorageSync('userId'));
  201. if(data.code == 200){
  202. uni.navigateTo({
  203. url: '/pages/fingerprint',//指纹信息
  204. });
  205. }
  206. },
  207. //查询用户电子签名
  208. async querySignature(){
  209. let _this=this;
  210. const {data} = await querySignature();
  211. if(data.code == 200){
  212. _this.isUpload=data.data.isUpload;
  213. _this.signatureUrl=data.data.signature;
  214. }
  215. },
  216. //获取个人奖励分/信用分
  217. async getMyPointsLogInfo(){
  218. const {data} = await getMyPointsLogInfo();
  219. if(data.code == 200){
  220. this.bonusPoints = data.data.bonusPoints;
  221. this.creditScore = data.data.creditScore;
  222. }
  223. },
  224. //获取报警信息列表
  225. async getSafeWarnList(){
  226. let obj = {
  227. pageNum:1,
  228. pageSize:1,
  229. count:0,
  230. groupStatus:1,
  231. };
  232. const {data} = await getSafeWarnList(obj);
  233. if(data.code == 200){
  234. if(data.rows[0]){
  235. this.securityAlertNum = data.rows[0].todayHappenCount;
  236. }else{
  237. this.securityAlertNum = 0;
  238. }
  239. }
  240. },
  241. //获取当前身份人脸验证状态与学生卡上传状态
  242. async studentinfoFacemy(){
  243. let obj = {
  244. studentsId:uni.getStorageSync('userId')
  245. }
  246. const {data} = await studentinfoFacemy(obj)
  247. if(data.code == 200){
  248. this.certification = data.data;
  249. this.ifFaceFeature = data.data.ifFaceFeature;
  250. }
  251. },
  252. //退出按钮
  253. clickOut(){
  254. let self = this;
  255. uni.showModal({
  256. // title: '确认要退出吗?',
  257. content: '确认要退出吗',
  258. cancelColor:"#999",
  259. confirmColor:"#0183FA",
  260. success: function (res) {
  261. if (res.confirm) {
  262. self.logout();
  263. } else if (res.cancel) {
  264. }
  265. }
  266. });
  267. },
  268. //退出登录
  269. async logout() {
  270. let self = this;
  271. const {data} = await logout();
  272. if(data.code == 200){
  273. uni.removeStorageSync('token');
  274. uni.removeStorageSync('userId');
  275. uni.removeStorageSync('userType');
  276. uni.redirectTo({
  277. url: '/pages/login/login',
  278. });
  279. }
  280. },
  281. //页面跳转
  282. goPage(type){
  283. if(type == 'pointsRecord'){//积分记录
  284. uni.navigateTo({
  285. url: '/pages_student/mine/pointsRecord',
  286. });
  287. }else if(type == 'faceImage'){//身份验证
  288. uni.navigateTo({
  289. url: '/pages/faceImage',
  290. });
  291. }else if(type == 'laboratory'){
  292. uni.navigateTo({
  293. url: '/pages_manage/workbench/laboratory/meLaboratory',//我的实验室
  294. });
  295. }else if(type == 'alarm'){
  296. uni.navigateTo({
  297. url: '/pages/earlyWarningManage/earlyWarningList',//安全警报
  298. });
  299. }else if(type == 'record'){
  300. uni.navigateTo({
  301. url: '/pages_manage/workbench/plan/planList',//预案执行记录
  302. });
  303. }else if(type == 'signature'){
  304. uni.navigateTo({
  305. url: '/pages_manage/workbench/signature/signature?item='+this.signatureUrl,//电子签名
  306. });
  307. }
  308. },
  309. // 头像上传
  310. selectImage() {
  311. let self = this;
  312. wx.chooseImage({
  313. count: 1,
  314. sizeType: ["original", "compressed"],
  315. sourceType: ["album", "camera"],
  316. success: function(res) {
  317. let tempFilePaths = res.tempFilePaths[0];
  318. self.uploadImg(tempFilePaths);
  319. }
  320. });
  321. },
  322. async uploadImg(tempFilePaths){
  323. var self = this;
  324. uni.showLoading({
  325. title: '上传中',
  326. mask: true
  327. });
  328. uni.uploadFile({
  329. url: config.base_url+'/base/file/upload', //仅为示例,非真实的接口地址
  330. header:{'Authorization':uni.getStorageSync('token')},
  331. filePath: tempFilePaths,
  332. name: 'file',
  333. formData: {
  334. 'user': 'test'
  335. },
  336. success: (uploadFileRes) => {
  337. let res = JSON.parse(uploadFileRes.data);
  338. if(res.code == 200){
  339. uni.navigateTo({
  340. url: '/pages/avatar?src='+config.base_url+res.data.url,//预案执行记录
  341. });
  342. }else{
  343. uni.showToast({
  344. title: res.msg,
  345. icon:"none",
  346. mask:true,
  347. duration: 2000
  348. });
  349. }
  350. },
  351. fail: err => {},
  352. complete: () => {
  353. uni.hideLoading()
  354. }
  355. });
  356. },
  357. },
  358. }
  359. </script>
  360. <style lang="stylus" scoped>
  361. #mine{
  362. height:100%;
  363. .top-max-big-box{
  364. /*background:#ffffff;*/
  365. .user-top-max-box-one{
  366. overflow hidden
  367. background url("@/images/basicsModules/img_wd_bg.png") no-repeat
  368. background-size:100%;
  369. height:350rpx;
  370. .top-max-box-one{
  371. background #fff
  372. margin:40rpx 40rpx 0;
  373. z-index:1;
  374. height:180rpx;
  375. border-top-right-radius 20rpx
  376. border-top-left-radius 20rpx
  377. display flex
  378. overflow hidden
  379. .user-img-box{
  380. height:120rpx;
  381. width:100rpx;
  382. margin:30rpx 53rpx 0 22rpx;
  383. img{
  384. height:100rpx;
  385. width:100rpx;
  386. border-radius:50%;
  387. }
  388. view{
  389. font-size:22rpx;
  390. color:#666666;
  391. text-align center
  392. line-height:22rpx;
  393. margin-top:10rpx;
  394. }
  395. }
  396. .name-box{
  397. margin-top:30rpx;
  398. .name-box-min{
  399. display flex
  400. overflow hidden
  401. margin-bottom:11rpx;
  402. view:nth-child(1){
  403. height:48rpx;
  404. line-height:48rpx;
  405. font-size: 30rpx;
  406. color: #333;
  407. }
  408. view:nth-child(2){
  409. height:30rpx;
  410. line-height:30rpx;
  411. font-size:20rpx;
  412. padding:0 20rpx;
  413. margin:9rpx 0 9rpx 20rpx;
  414. }
  415. view-color-one{
  416. background #FDD255;
  417. }
  418. view-color-two{
  419. background #A2A2A2;
  420. }
  421. view-color-tree{
  422. background #0183FA;
  423. }
  424. }
  425. .name-box-user{
  426. line-height:41rpx;
  427. font-size: 22rpx;
  428. color: #333;
  429. }
  430. }
  431. }
  432. .num-max-box{
  433. width:670rpx;
  434. background #fff
  435. border-bottom-right-radius 20rpx
  436. border-bottom-left-radius 20rpx
  437. height:130rpx;
  438. margin:0 40rpx;
  439. display flex
  440. .min-num-box{
  441. flex:1;
  442. .min-num-view{
  443. margin-top:30rpx;
  444. height:30rpx;
  445. line-height:30rpx;
  446. font-size:22rpx;
  447. text-align center
  448. }
  449. .color-one{
  450. font-weight:700;
  451. font-size:26rpx;
  452. color:#2B99FE;
  453. }
  454. .color-two{
  455. font-weight:700;
  456. font-size:26rpx;
  457. color:#FDD255;
  458. }
  459. .bottom-min-num-view{
  460. display flex
  461. margin-top:20rpx;
  462. .img-one{
  463. width:25rpx;
  464. height:28rpx;
  465. margin: 0 10rpx 0 58rpx;
  466. }
  467. .img-two{
  468. width:28rpx;
  469. height:26rpx;
  470. margin: 0 10rpx 0 59rpx;
  471. }
  472. view{
  473. font-size:22rpx;
  474. }
  475. }
  476. }
  477. }
  478. .null-p{
  479. background #dedede
  480. height:30rpx;
  481. width:2rpx;
  482. margin:50rpx 0 0;
  483. }
  484. }
  485. .top-max-box-two{
  486. background url("@/images/basicsModules/img_wd_bg.png")
  487. background-size:100%;
  488. height:245rpx;
  489. display flex
  490. overflow hidden
  491. .user-img-box{
  492. height:120rpx;
  493. width:100rpx;
  494. margin:50rpx 53rpx 0 22rpx;
  495. img{
  496. height:100rpx;
  497. width:100rpx;
  498. border-radius:50%;
  499. }
  500. view{
  501. font-size:22rpx;
  502. color:#fff;
  503. text-align center
  504. line-height:22rpx;
  505. margin-top:10rpx;
  506. }
  507. }
  508. .name-box{
  509. margin-top:50rpx;
  510. view:nth-child(1){
  511. line-height:48rpx;
  512. margin-bottom:11rpx;
  513. font-size: 30rpx;
  514. color: #fff;
  515. }
  516. view:nth-child(2){
  517. line-height:41rpx;
  518. font-size: 22rpx;
  519. color: #fff;
  520. }
  521. }
  522. }
  523. .button-max-big-box{
  524. background #fff
  525. padding:0 20rpx;
  526. margin-top:30rpx;
  527. .button-max-box{
  528. height:100rpx;
  529. display flex
  530. border-top:1rpx solid #e0e0e0;
  531. .left-img{
  532. height:30rpx;
  533. width:30rpx;
  534. margin:34rpx 44rpx 0 0;
  535. }
  536. view{
  537. line-height:100rpx;
  538. }
  539. view:nth-child(2){
  540. flex:1;
  541. color:#333333;
  542. font-size: 30rpx;
  543. }
  544. .right-img{
  545. height:24rpx;
  546. width:12rpx;
  547. margin:39rpx 0 0 0;
  548. }
  549. .colorA{
  550. color:#E45656!important;
  551. }
  552. .marginType{
  553. margin-right:12rpx;
  554. }
  555. .view-three-one{
  556. width:30rpx;
  557. height:30rpx;
  558. text-align center
  559. background #FF4552
  560. border-radius:50%;
  561. font-size:20rpx;
  562. line-height:30rpx;
  563. color:#fff;
  564. margin:36rpx 20rpx;
  565. }
  566. .view-three-two{
  567. width:30rpx;
  568. height:30rpx;
  569. text-align center
  570. border-radius:50%;
  571. font-size:20rpx;
  572. line-height:30rpx;
  573. color:#999;
  574. margin:36rpx 20rpx;
  575. }
  576. .view-three-type{
  577. width:120rpx;
  578. text-align center;
  579. color:#CCCCCC;
  580. font-size: 26rpx;
  581. }
  582. }
  583. .button-max-box:nth-child(1){
  584. border:none;
  585. }
  586. }
  587. }
  588. .out-button{
  589. position absolute
  590. bottom:140rpx;
  591. left:25rpx;
  592. width:700rpx;
  593. height:100rpx;
  594. line-height:100rpx;
  595. border-radius:10rpx;
  596. text-align center
  597. background #E0E0E0
  598. color:#0183FA;
  599. font-size: 30rpx;
  600. margin:0 auto;
  601. }
  602. }
  603. </style>