completeInformation.vue 17 KB

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