improve.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view class="con">
  3. <view class="improve">
  4. <view class="improve_title">完善信息</view>
  5. <view class="improve_con">
  6. <view class="improve_con_item">
  7. <view class="improve_con_item_title">姓名*</view>
  8. <view class="improve_con_item_con">
  9. <input class="uni-mt-5" trim="all" maxlength="30" v-model="form.name" placeholder="输入姓名" @input="formatterInput($event , 'name')"></input>
  10. </view>
  11. </view>
  12. <view class="improve_con_item">
  13. <view class="improve_con_item_title">医院/公司</view>
  14. <view class="improve_con_item_con">
  15. <input class="uni-mt-5" trim="all" maxlength="30" v-model="form.company" placeholder="输入您所在的单位" @input="formatterInput($event , 'company')"></input>
  16. </view>
  17. </view>
  18. </view>
  19. <u-button type="primay" class="improve_btn" color="var(--phone-theme-color)" @click="submit">完成</u-button>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { setUser } from "@/api/system/user"
  25. export default {
  26. data() {
  27. return {
  28. form: {
  29. name: '',
  30. company: '',
  31. loginIdentity:''
  32. },
  33. isReady: true,
  34. }
  35. },
  36. onLoad(options) {
  37. this.form.loginIdentity = options.loginIdentity || ''
  38. },
  39. methods:{
  40. formatterInput(e,name){
  41. let temp = e.target.value.replace(/[^a-zA-Z0-9\u4E00-\u9FA5\,\.\-]/g, '')
  42. this.$nextTick(()=>{
  43. this.form[name] = temp
  44. })
  45. },
  46. async submit(){
  47. if(!this.form.name){
  48. uni.$u.toast("请输入姓名!")
  49. return
  50. }else if(!this.form.company){
  51. uni.$u.toast("请输入单位姓名!")
  52. return
  53. }
  54. let userId = this.$store.state.user.userInfo.userId
  55. let params = {
  56. "userId": userId, //用户ID
  57. "nickName": this.form.name, //用户昵称
  58. "organizationName": this.form.company, //单位名称
  59. "loginIdentity": this.form.loginIdentity, //身份
  60. }
  61. let res1 = await setUser(params)
  62. if(res1.code != 200){
  63. return
  64. }
  65. let res2 = await this.$store.dispatch('GetInfo')
  66. if(res2.code != 200){
  67. return
  68. }
  69. this.$tab.reLaunch('/pages/phone/index')
  70. }
  71. },
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .con{
  76. .improve{
  77. width: 100%;
  78. height: 100%;
  79. display: flex;
  80. flex-direction: column;
  81. &_title{
  82. margin-top: 86rpx;
  83. margin-bottom: 40rpx;
  84. text-align: center;
  85. }
  86. &_con{
  87. padding: 0 32rpx;
  88. &_item{
  89. margin: 16rpx 0;
  90. &_title{
  91. margin-bottom: 8rpx;
  92. color: #86909C;
  93. font-size: 26rpx;
  94. font-weight: 400;
  95. line-height: 44rpx; /* 169.231% */
  96. }
  97. &_con{
  98. padding: 0 24rpx;
  99. border-radius: 8rpx;
  100. background: #F7F8FA;
  101. }
  102. }
  103. }
  104. &_btn{
  105. position: absolute;
  106. bottom: 0px;
  107. left: 40rpx;
  108. right: 40rpx;
  109. height: 88rpx;
  110. line-height: 88rpx;
  111. text-align: center;
  112. border-radius: 8rpx;
  113. color: #FFF;
  114. font-size: 28rpx;
  115. font-weight: 400;
  116. width: calc(100% - 80rpx);
  117. }
  118. }
  119. }
  120. .disabled_btn{
  121. opacity: .4;
  122. }
  123. /deep/ .is-input-border{
  124. border: none;
  125. height: 88rpx;
  126. line-height: 88rpx;
  127. background-color: #F7F8FA!important;
  128. }
  129. input{
  130. padding: 0!important;
  131. height: 88rpx;
  132. line-height: 88rpx;
  133. color: black;
  134. text-overflow: ellipsis;
  135. white-space: nowrap;
  136. font-size: 28rpx;
  137. font-weight: 400;
  138. line-height: 88rpx; /* 157.143% */
  139. }
  140. </style>