completeInformation.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <template>
  2. <view id="completeInformation">
  3. <view class="top-title-box-">
  4. <view>个人信息</view>
  5. <view>请完善个人信息</view>
  6. </view>
  7. <view class="bottom-input-max-box">
  8. <view class="text-max-box">
  9. <view class="text-top-box">
  10. <view>*</view>
  11. <view>姓名</view>
  12. </view>
  13. <view class="text-bottom-p">{{newData.userName}}</view>
  14. </view>
  15. <view class="text-max-box">
  16. <view class="text-top-box">
  17. <view>*</view>
  18. <view>{{newData.userType==1?'卡号':(newData.userType==2?'卡号':'')}}</view>
  19. </view>
  20. <view class="text-bottom-p">{{newData.account}}</view>
  21. </view>
  22. <view class="text-max-box">
  23. <view class="text-top-box">
  24. <view>*</view>
  25. <view>所在所</view>
  26. </view>
  27. <view class="text-bottom-p">{{newData.deptName?newData.deptName:'-'}}</view>
  28. </view>
  29. <view class="text-max-box" v-if="newData.userType == 2">
  30. <view class="text-top-box">
  31. <view>*</view>
  32. <view>专业</view>
  33. </view>
  34. <view class="text-bottom-p">{{newData.majorName?newData.majorName:'-'}}</view>
  35. </view>
  36. <view class="text-max-box" v-if="newData.mobile">
  37. <view class="text-top-box">
  38. <view>*</view>
  39. <view>手机号</view>
  40. </view>
  41. <view class="text-bottom-p">{{newData.mobile}}</view>
  42. </view>
  43. <view class="input-max-box" v-if="!newData.mobile">
  44. <view class="input-top-box">
  45. <view>*</view>
  46. <view>手机号</view>
  47. </view>
  48. <input class="input-top-p" :always-embed="true" :cursor-spacing="10"
  49. v-model="form.mobile" maxlength="11" focus placeholder="请输入手机号码">
  50. </view>
  51. <view class="input-button-max-box" v-if="!newData.mobile">
  52. <view class="input-top-box">
  53. <view>*</view>
  54. <view>手机验证码</view>
  55. </view>
  56. <view class="input-button-box">
  57. <input maxlength="6" :always-embed="true" :cursor-spacing="10"
  58. v-model="form.captcha" focus placeholder="请输入手机验证码" />
  59. <view @click="getCode()" :class="codeType?'checkButton':'noCheckButton'">
  60. {{codeType?seconds+'秒后重试':'获取验证码'}}
  61. </view>
  62. </view>
  63. </view>
  64. <view class="button-max-box" v-if="newData.userType == 2 && !newData.tutorUserName">
  65. <view class="button-top-box">
  66. <view>*</view>
  67. <view>领导</view>
  68. </view>
  69. <input class="button-bottom-p" :always-embed="true" :cursor-spacing="10"
  70. :disabled="true" v-model="form.supervisorName"
  71. maxlength="30" focus placeholder="请选择领导" @click="userButton()">
  72. </view>
  73. <view class="text-max-box" v-if="newData.userType == 2 && newData.tutorUserName">
  74. <view class="text-top-box">
  75. <view>*</view>
  76. <view>领导</view>
  77. </view>
  78. <view class="text-bottom-p">{{newData.tutorUserName}}</view>
  79. </view>
  80. <view class="bottom-button-p" @click="submitButton()">确定</view>
  81. </view>
  82. <view class="shade-max-big-box" v-if="userShowType">
  83. <view class="null-back-box" @click="userButton()"></view>
  84. <view class="shade-big-box">
  85. <view class="shade-top-box">
  86. <view class="shade-top-left-box">
  87. <uni-icons type="search" class="icon-view-left" size="20" color="#999999"></uni-icons>
  88. <input class="input-top-p" :always-embed="true" :cursor-spacing="10"
  89. @confirm="searchButton()"
  90. v-model="getData.userName" maxlength="10" focus placeholder="请输入领导">
  91. <uni-icons v-if="getData.userName" @click="clearButton()"
  92. type="clear" class="icon-view-right" size="20" color="#999999"></uni-icons>
  93. </view>
  94. <view class="shade-top-right-button" @click="searchButton()">搜索</view>
  95. </view>
  96. <scroll-view scroll-y @scrolltolower="scrollGet" class="shade-bottom-box">
  97. <view @click="checkUser(item)"
  98. class="for-user-box" :class="checkUserUserId==item.userId?'check-user':''"
  99. v-for="(item,index) in dataList" :key="index">
  100. <view>{{item.userName}}{{item.account?'('+item.account+')':''}}</view>
  101. <view>{{item.deptName}}</view>
  102. </view>
  103. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  104. <view class="get-data-null-p" v-else="getDataType">- 滑动加载更多 -</view>
  105. </scroll-view>
  106. </view>
  107. </view>
  108. </view>
  109. </template>
  110. <script>
  111. import {
  112. systemUserDetail,
  113. systemUserSelectByPage,
  114. systemUserEditUser,
  115. authNumCaptchaNotRegistered,
  116. } from '@/pages_basics/api/index.js'
  117. export default {
  118. data() {
  119. return {
  120. newData:{
  121. userName:"",
  122. account:"",
  123. deptName:"",
  124. majorName:"",
  125. userType:0,
  126. },
  127. form:{
  128. mobile:"",
  129. supervisorName:"",
  130. supervisorId:"",
  131. },
  132. userShowType:false,
  133. checkUserUserId:null,
  134. //查询
  135. getData: {
  136. userType:1,
  137. page: 1,
  138. pageSize: 20,
  139. userName: '',
  140. },
  141. getDataType: false,
  142. total: 0,
  143. dataList:[],
  144. //定时器
  145. codeType: false,
  146. seconds: 0,
  147. timer:null,
  148. }
  149. },
  150. onLoad(option) {
  151. },
  152. onShow() {
  153. this.systemUserDetail();
  154. },
  155. methods: {
  156. async systemUserDetail(){
  157. const { data } = await systemUserDetail({userId:uni.getStorageSync('userId')});
  158. if (data.code == 200) {
  159. this.$set(this,'newData',data.data);
  160. this.systemUserSelectByPage();
  161. }
  162. },
  163. //获取验证码
  164. getCode() {
  165. let self = this;
  166. const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
  167. if (this.codeType) {
  168. uni.showToast({
  169. title: '请稍后再试',
  170. icon: "none",
  171. duration: 3000
  172. });
  173. return
  174. } else if (!this.form.mobile) {
  175. uni.showToast({
  176. title: '请输入手机号码',
  177. icon: "none",
  178. duration: 3000
  179. });
  180. return
  181. } else if (!reg.test(this.form.mobile)) {
  182. uni.showToast({
  183. title: '请输入正确的手机号码',
  184. icon: "none",
  185. duration: 3000
  186. });
  187. return
  188. }
  189. this.authNumCaptchaNotRegistered();
  190. },
  191. async authNumCaptchaNotRegistered() {
  192. let self = this;
  193. const {
  194. data
  195. } = await authNumCaptchaNotRegistered({mobile:this.form.mobile});
  196. if (data.code == 200) {
  197. uni.showToast({
  198. title: '发送成功',
  199. icon: "none",
  200. mask: true,
  201. duration: 2000
  202. });
  203. const TIME_COUNT = 60;
  204. this.$set(this, 'codeType', true);
  205. if (!this.timer) {
  206. this.$set(this, 'seconds', TIME_COUNT);
  207. this.timer = setInterval(() => {
  208. if (this.seconds > 1 && this.seconds <= TIME_COUNT) {
  209. this.seconds -= 1;
  210. } else {
  211. this.$set(this, 'codeType', false);
  212. clearInterval(this.timer);
  213. this.$set(this, 'timer', null);
  214. }
  215. }, 1000);
  216. }
  217. }
  218. },
  219. //提交
  220. submitButton(){
  221. let self = this;
  222. const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
  223. if(this.newData.userType == 1){
  224. if(!this.form.mobile){
  225. uni.showToast({
  226. title: '请输入手机号码',
  227. icon: "none",
  228. duration: 3000
  229. });
  230. return
  231. }else if (!reg.test(this.form.mobile)) {
  232. uni.showToast({
  233. title: '请输入正确的手机号码',
  234. icon: "none",
  235. duration: 3000
  236. });
  237. return
  238. } else if (!this.form.captcha) {
  239. uni.showToast({
  240. title: '请输入手机验证码',
  241. icon: "none",
  242. duration: 3000
  243. });
  244. return
  245. }
  246. }else if(this.newData.userType == 2){
  247. if(!this.newData.mobile && !this.newData.tutorUserName){
  248. if(!this.form.mobile){
  249. uni.showToast({
  250. title: '请输入手机号码',
  251. icon: "none",
  252. duration: 3000
  253. });
  254. return
  255. }else if (!reg.test(this.form.mobile)) {
  256. uni.showToast({
  257. title: '请输入正确的手机号码',
  258. icon: "none",
  259. duration: 3000
  260. });
  261. return
  262. } else if (!this.form.captcha) {
  263. uni.showToast({
  264. title: '请输入手机验证码',
  265. icon: "none",
  266. duration: 3000
  267. });
  268. return
  269. } else if(!this.checkUserUserId){
  270. uni.showToast({
  271. title: '请选择领导',
  272. icon: "none",
  273. duration: 3000
  274. });
  275. return
  276. }
  277. }else if(this.newData.mobile){
  278. if(!this.checkUserUserId){
  279. uni.showToast({
  280. title: '请选择领导',
  281. icon: "none",
  282. duration: 3000
  283. });
  284. return
  285. }
  286. }else{
  287. if(!this.form.mobile){
  288. uni.showToast({
  289. title: '请输入手机号码',
  290. icon: "none",
  291. duration: 3000
  292. });
  293. return
  294. }else if (!reg.test(this.form.mobile)) {
  295. uni.showToast({
  296. title: '请输入正确的手机号码',
  297. icon: "none",
  298. duration: 3000
  299. });
  300. return
  301. } else if (!this.form.captcha) {
  302. uni.showToast({
  303. title: '请输入手机验证码',
  304. icon: "none",
  305. duration: 3000
  306. });
  307. return
  308. }
  309. }
  310. }
  311. uni.showModal({
  312. title: '确认提交?',
  313. cancelColor: '#999999',
  314. confirmColor: '#0183FA',
  315. content: '',
  316. success(res) {
  317. if (res.confirm) {
  318. // console.log('确定')
  319. self.systemUserEditUser();
  320. } else if (res.cancel) {
  321. // console.log('取消')
  322. }
  323. }
  324. })
  325. },
  326. //完善用户信息-提交
  327. async systemUserEditUser(){
  328. let obj = {
  329. userId:this.newData.userId,
  330. }
  331. if(this.newData.userType == 1){
  332. obj.mobile = this.form.mobile;
  333. obj.captcha = this.form.captcha;
  334. } else if(this.newData.userType == 2){
  335. if(!this.newData.mobile && !this.newData.tutorUserName){
  336. obj.tutorUserId = this.checkUserUserId;
  337. obj.mobile = this.form.mobile;
  338. obj.captcha = this.form.captcha;
  339. }else if(this.newData.mobile){
  340. obj.tutorUserId = this.checkUserUserId;
  341. }else{
  342. obj.mobile = this.form.mobile;
  343. obj.captcha = this.form.captcha;
  344. }
  345. }
  346. const { data } = await systemUserEditUser(obj);
  347. if (data.code == 200) {
  348. uni.showToast({
  349. title: '提交成功',
  350. mask: true,
  351. icon: "none",
  352. duration: 2000
  353. });
  354. setTimeout(function(){
  355. uni.redirectTo({
  356. url: '/pages/views/home/home',
  357. });
  358. },2000);
  359. }
  360. },
  361. //搜索按钮
  362. clearButton(){
  363. this.$set(this, 'getDataType', false);
  364. this.$set(this, 'dataList', []);
  365. this.$set(this, 'total', 0);
  366. this.$set(this.getData, 'userName','');
  367. this.$set(this.getData, 'page', 1);
  368. this.systemUserSelectByPage();
  369. },
  370. //搜索按钮
  371. searchButton(){
  372. this.$set(this, 'getDataType', false);
  373. this.$set(this, 'dataList', []);
  374. this.$set(this, 'total', 0);
  375. this.$set(this.getData, 'page', 1);
  376. this.systemUserSelectByPage();
  377. },
  378. userButton(type){
  379. this.$set(this,'userShowType',!this.userShowType);
  380. },
  381. checkUser(item){
  382. this.$set(this.form,'supervisorName',item.userName);
  383. this.$set(this.form,'supervisorId',item.account);
  384. this.$set(this,'checkUserUserId',item.userId);
  385. this.$set(this,'userShowType',false);
  386. },
  387. //滚动加载事件
  388. scrollGet() {
  389. let self = this;
  390. if (self.total / self.getData.pageSize <= self.getData.page) {
  391. this.$set(this, 'getDataType', true);
  392. } else {
  393. this.getData.page += 1;
  394. this.$nextTick(() => {
  395. this.systemUserSelectByPage();
  396. })
  397. }
  398. },
  399. //获取实验室
  400. async systemUserSelectByPage() {
  401. let self = this;
  402. let obj = {
  403. userType:this.getData.userType,
  404. page:this.getData.page,
  405. pageSize:this.getData.pageSize,
  406. userName:this.getData.userName,
  407. };
  408. if(!obj.userName){
  409. obj.deptId = this.newData.deptId
  410. }
  411. const {
  412. data
  413. } = await systemUserSelectByPage(obj);
  414. if (data.code == 200) {
  415. if (self.getData.page == 1) {
  416. this.dataList = data.data.records;
  417. this.total = data.data.total;
  418. if (data.data.total / self.getData.pageSize <= self.getData.page) {
  419. this.$set(this, 'getDataType', true);
  420. }
  421. } else {
  422. this.dataList = [...this.dataList, ...data.data.records]
  423. this.total = data.data.total;
  424. if (data.data.total / self.getData.pageSize <= self.getData.page) {
  425. this.$set(this, 'getDataType', true);
  426. }
  427. }
  428. }
  429. },
  430. },
  431. }
  432. </script>
  433. <style lang="stylus" scoped>
  434. #completeInformation {
  435. height:100%;
  436. display: flex;
  437. flex-direction: column;
  438. overflow: hidden;
  439. .top-title-box-{
  440. height:110rpx;
  441. display: flex;
  442. background-color: #FFFFFF;
  443. margin-bottom:20rpx;
  444. view:nth-child(1){
  445. line-height:100rpx;
  446. font-size:34rpx;
  447. margin:0 45rpx 0 32rpx;
  448. color:#333;
  449. font-weight:700;
  450. }
  451. view:nth-child(2){
  452. line-height:100rpx;
  453. font-size:30rpx;
  454. color:#999999;
  455. }
  456. }
  457. .bottom-input-max-box{
  458. flex:1;
  459. overflow-x: hidden;
  460. overflow-y: scroll;
  461. background-color: #FFFFFF;
  462. .text-max-box{
  463. .text-top-box{
  464. display: flex;
  465. margin-left:32rpx;
  466. view{
  467. font-size:30rpx;
  468. line-height: 100rpx;
  469. }
  470. view:nth-child(1){
  471. color:#FF0000;
  472. }
  473. view:nth-child(2){
  474. color:#333;
  475. }
  476. }
  477. .text-bottom-p{
  478. margin-left:32rpx;
  479. width: 630rpx;
  480. line-height: 100rpx;
  481. background: #F5F5F5;
  482. border-radius: 10rpx 10rpx 10rpx 10rpx;
  483. padding:0 30rpx;
  484. }
  485. }
  486. .input-max-box{
  487. .input-top-box{
  488. display: flex;
  489. margin-left:32rpx;
  490. view{
  491. font-size:30rpx;
  492. line-height: 100rpx;
  493. }
  494. view:nth-child(1){
  495. color:#FF0000;
  496. }
  497. view:nth-child(2){
  498. color:#333;
  499. }
  500. }
  501. .input-top-p{
  502. margin-left:34rpx;
  503. width: 630rpx;
  504. height: 100rpx;
  505. padding:0 30rpx;
  506. border-radius: 10rpx 10rpx 10rpx 10rpx;
  507. border: 1rpx solid #E0E0E0;
  508. }
  509. }
  510. .input-button-max-box{
  511. .input-top-box{
  512. display: flex;
  513. margin-left:32rpx;
  514. view{
  515. font-size:30rpx;
  516. line-height: 100rpx;
  517. }
  518. view:nth-child(1){
  519. color:#FF0000;
  520. }
  521. view:nth-child(2){
  522. color:#333;
  523. }
  524. }
  525. .input-button-box {
  526. display: flex;
  527. margin-left:30rpx;
  528. input {
  529. width: 412rpx;
  530. height: 100rpx;
  531. line-height: 100rpx;
  532. border-radius: 10rpx;
  533. border: 1px solid #D8D8D8;
  534. padding: 0 30rpx;
  535. margin-right: 18rpx;
  536. }
  537. view {
  538. width: 200rpx;
  539. line-height: 100rpx;
  540. text-align: center;
  541. font-size: 30rpx;
  542. border-radius: 10rpx;
  543. }
  544. .checkButton {
  545. color: #333;
  546. background-color: #E8E8E8;
  547. }
  548. .noCheckButton {
  549. color: #fff;
  550. background-color: #0183FA;
  551. }
  552. }
  553. }
  554. .button-max-box{
  555. .button-top-box{
  556. display: flex;
  557. margin-left:32rpx;
  558. view{
  559. font-size:30rpx;
  560. line-height: 100rpx;
  561. }
  562. view:nth-child(1){
  563. color:#FF0000;
  564. }
  565. view:nth-child(2){
  566. color:#333;
  567. }
  568. }
  569. .button-bottom-p{
  570. margin-left:34rpx;
  571. width: 630rpx;
  572. height: 100rpx;
  573. padding:0 30rpx;
  574. border-radius: 10rpx 10rpx 10rpx 10rpx;
  575. border: 1rpx solid #E0E0E0;
  576. }
  577. }
  578. .bottom-button-p{
  579. margin:40rpx 34rpx;
  580. background-color: #0183FA;
  581. line-height:100rpx;
  582. text-align: center;
  583. color:#fff;
  584. font-size:30rpx;
  585. border-radius:50rpx;
  586. }
  587. }
  588. .shade-max-big-box{
  589. position: fixed;
  590. height:100%;
  591. width:100%;
  592. background-color: rgba(0,0,0,0.5);
  593. z-index:100;
  594. display: flex;
  595. flex-direction: column;
  596. overflow: hidden;
  597. .null-back-box{
  598. height:20%;
  599. }
  600. .shade-big-box{
  601. flex:1;
  602. display: flex;
  603. flex-direction: column;
  604. background-color: #fff;
  605. border-top-left-radius:20rpx;
  606. border-top-right-radius:20rpx;
  607. overflow: hidden;
  608. z-index:110;
  609. .shade-top-box{
  610. height:122rpx;
  611. border-bottom:1px solid #dedede;
  612. display: flex;
  613. .shade-top-left-box{
  614. display: flex;
  615. border-radius: 50rpx 50rpx 50rpx 50rpx;
  616. border: 1rpx solid #E0E0E0;
  617. height:80rpx;
  618. margin:20rpx 0 0 30rpx;
  619. width:580rpx;
  620. .icon-view-left{
  621. margin:20rpx 21rpx 0 18rpx;
  622. color:#999999;
  623. }
  624. .input-top-p{
  625. line-height:80rpx;
  626. height:80rpx;
  627. width:420rpx;
  628. }
  629. .icon-view-right{
  630. width:80rpx;
  631. height:80rpx;
  632. line-height:80rpx;
  633. text-align: center;
  634. }
  635. }
  636. .shade-top-right-button{
  637. width:120rpx;
  638. text-align: center;
  639. line-height:80rpx;
  640. margin:20rpx 0;
  641. color:#0183FA;
  642. font-size:28rpx;
  643. }
  644. }
  645. .shade-bottom-box{
  646. flex:1;
  647. overflow-x: hidden;
  648. overflow-y: scroll;
  649. .for-user-box:nth-child(1){
  650. border:none;
  651. }
  652. .for-user-box{
  653. border-top:1px solid #e0e0e0;
  654. margin:0 30rpx;
  655. padding:20rpx 0;
  656. view{
  657. font-size:28rpx;
  658. line-height:39rpx;
  659. }
  660. view:nth-child(1){
  661. margin-bottom:19rpx;
  662. }
  663. }
  664. .check-user{
  665. color:#0183FA;
  666. }
  667. .get-data-null-p {
  668. text-align: center;
  669. line-height: 100rpx;
  670. padding-bottom: 80px;
  671. color: #999;
  672. }
  673. }
  674. }
  675. }
  676. }
  677. </style>