completeInformation.vue 16 KB

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