teamUserDetail.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="default_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header :title='title'></cus-header>
  4. <view class="form">
  5. <view class="form-item adfacjb">
  6. <view class="form-item-left">姓名</view>
  7. <view class="form-item-right">
  8. <u-input v-model="userInfo.realName" placeholder="请输入团队人员姓名" border="none" style="font-size: 28rpx;color: #B3BFC8;line-height: 28rpx;" inputAlign="right"></u-input>
  9. </view>
  10. </view>
  11. <view class="form-item adfacjb">
  12. <view class="form-item-left">手机号码</view>
  13. <view class="form-item-right">
  14. <u-input v-model="userInfo.mobile" placeholder="请输入手机号码" border="none" style="font-size: 28rpx;color: #B3BFC8;line-height: 28rpx;" inputAlign="right"></u-input>
  15. </view>
  16. </view>
  17. <view class="form-item adfacjb">
  18. <view class="form-item-left">邮箱</view>
  19. <view class="form-item-right">
  20. <u-input v-model="userInfo.email" placeholder="请输入邮箱" border="none" style="font-size: 28rpx;color: #B3BFC8;line-height: 28rpx;" inputAlign="right"></u-input>
  21. </view>
  22. </view>
  23. </view>
  24. <!-- <view class="type adfacjb" @click="typeShow=true">
  25. <view class="type-left">团队人员身份类型</view>
  26. <view class="type-right adfac">
  27. <text>{{typeText}}</text>
  28. <image :src="imgBase+'my_arrow_right.png'"></image>
  29. </view>
  30. </view> -->
  31. <view class="zt_btn" @click="handleConfirm">确定</view>
  32. <u-picker :itemHeight="88" :immediateChange="true" :show="typeShow" :columns="typeData" title="成员身份类型"
  33. @cancel="typeShow=false" @confirm="typeConfirm" keyName="name" ></u-picker>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data(){
  39. return {
  40. title:'团队成员',
  41. userInfo:{
  42. id:'',
  43. coachId:JSON.parse(uni.getStorageSync('userInfo')).id,
  44. realName:'',
  45. mobile:'',
  46. email:'',
  47. },
  48. typeText:'请选择',
  49. typeShow:false,
  50. typeData:[[
  51. {id:1,name:'团队Leader'},
  52. {id:2,name:'团队成员Member'},
  53. {id:3,name:'利益相关者Stakeholder'},
  54. {id:4,name:'赞助人Sponsor'}
  55. ]],
  56. }
  57. },
  58. onLoad(options) {
  59. if(options.id){
  60. this.title = '编辑成员';
  61. this.getDetail(options.id)
  62. }
  63. },
  64. methods:{
  65. getDetail(id){
  66. this.$api.get(`/core/member/${id}`).then(({data:res})=>{
  67. if(res.code!==0) return this.$showToast(res.msg)
  68. this.userInfo = {...this.userInfo,...res.data}
  69. })
  70. },
  71. typeConfirm(e){
  72. this.typeShow = false;
  73. },
  74. handleConfirm(){
  75. if(!this.userInfo.realName) return this.$showToast('请输入姓名')
  76. if(!this.$reg.mobile(this.userInfo.mobile)) return this.$showToast('请输入正确的手机号')
  77. if(!this.$reg.email(this.userInfo.email)) return this.$showToast('请输入正确的邮箱')
  78. this.$api[this.userInfo.id?'put':'post']('/core/member',this.userInfo).then(({data:res})=>{
  79. if(res.code!==0) return this.$showToast(res.msg)
  80. this.$showToast(`${this.userInfo.id?'编辑':'添加'}成功`);
  81. setTimeout(()=>{
  82. uni.redirectTo({
  83. url:'/pagesMy/teamUser'
  84. })
  85. },1000)
  86. })
  87. }
  88. }
  89. }
  90. </script>
  91. <style scoped lang="scss">
  92. .default_page{
  93. padding: 0 24rpx 54rpx;
  94. box-sizing: border-box;
  95. background: #F7F7F7;
  96. .form{
  97. background: #FFFFFF;
  98. border-radius: 24rpx 24rpx 0rpx 0rpx;
  99. margin-top: 20rpx;
  100. &-item{
  101. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #EFEFEF;
  102. padding: 28rpx 24rpx;
  103. &-left{
  104. font-family: PingFangSC, PingFang SC;
  105. font-weight: 400;
  106. font-size: 30rpx;
  107. color: #002846;
  108. line-height: 42rpx;
  109. }
  110. }
  111. }
  112. .type{
  113. background: #FFFFFF;
  114. box-shadow: inset 0rpx -1rpx 0rpx 0rpx rgba(229,231,235,0.5);
  115. border-radius: 24rpx;
  116. margin-top: 20rpx;
  117. padding: 28rpx 24rpx;
  118. &-left{
  119. font-family: PingFangSC, PingFang SC;
  120. font-weight: 400;
  121. font-size: 30rpx;
  122. color: #002846;
  123. line-height: 42rpx;
  124. }
  125. &-right{
  126. text{
  127. font-family: PingFangSC, PingFang SC;
  128. font-weight: 400;
  129. font-size: 28rpx;
  130. color: #B3BFC8;
  131. line-height: 40rpx;
  132. }
  133. image{
  134. width: 30rpx;
  135. height: 30rpx;
  136. box-sizing: border-box;
  137. }
  138. }
  139. }
  140. .zt_btn{
  141. width: calc(100% - 100rpx);
  142. position: fixed;
  143. left: 50rpx;
  144. bottom: 54px;
  145. }
  146. }
  147. </style>