index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="main">
  3. <view class="one">
  4. <upload class='upload' :list="user.icon" name="icon" :count="1" @uplSuc="uplSuc" @uplDel="uplDel">
  5. </upload>
  6. </view>
  7. <view class="two">
  8. <view class="two_1">
  9. <view class="left">姓名</view>
  10. <view class="right">
  11. <input v-model="user.name" placeholder="请输入真实姓名" />
  12. <text class="iconfont icon-dayuhao"></text>
  13. </view>
  14. </view>
  15. <view class="two_1">
  16. <view class="left">手机号</view>
  17. <view class="right">
  18. <input v-model="user.mobile" placeholder="请输入手机号" />
  19. <text class="iconfont icon-dayuhao"></text>
  20. </view>
  21. </view>
  22. <view class="two_1">
  23. <view class="left">性别</view>
  24. <view class="right">
  25. <picker class="picker" mode="selector" :range="genderList" @change="genderChange" range-key="label">
  26. <view>{{user.gender||'请选择性别'}}</view>
  27. </picker>
  28. <text class="iconfont icon-dayuhao"></text>
  29. </view>
  30. </view>
  31. <view class="two_1">
  32. <view class="left">医院名称</view>
  33. <view class="right">
  34. <input v-model="user.hos_name" placeholder="请输入医院名称" />
  35. <text class="iconfont icon-dayuhao"></text>
  36. </view>
  37. </view>
  38. <view class="two_1">
  39. <view class="left">科室名称</view>
  40. <view class="right">
  41. <input v-model="user.dept_name" placeholder="请输入科室名称" />
  42. <text class="iconfont icon-dayuhao"></text>
  43. </view>
  44. </view>
  45. <view class="two_1">
  46. <view class="left">职务</view>
  47. <view class="right">
  48. <input v-model="user.title" placeholder="请输入职务" />
  49. <text class="iconfont icon-dayuhao"></text>
  50. </view>
  51. </view>
  52. <view class="two_1">
  53. <view class="left">职称</view>
  54. <view class="right">
  55. <input v-model="user.post" placeholder="请输入职称" />
  56. <text class="iconfont icon-dayuhao"></text>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="thr">
  61. <button class="button" type="primary" size="mini" @click="onSubmit()">保存</button>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import upload from '../../components/upload/index.vue';
  67. export default {
  68. components: {
  69. upload
  70. },
  71. data() {
  72. return {
  73. user: {},
  74. gender_name: '',
  75. // 字典表
  76. genderList: [{
  77. label: '男',
  78. value: '男'
  79. },
  80. {
  81. label: '女',
  82. value: '女'
  83. }
  84. ],
  85. }
  86. },
  87. onLoad: async function(e) {
  88. const that = this;
  89. await that.search();
  90. },
  91. onShow: async function() {
  92. const that = this;
  93. that.searchToken();
  94. },
  95. methods: {
  96. // 用户信息
  97. searchToken() {
  98. const that = this;
  99. try {
  100. const res = uni.getStorageSync('token');
  101. if (res) {
  102. const user = that.$jwt(res);
  103. that.$set(that, `user`, user);
  104. }
  105. } catch (e) {}
  106. },
  107. // 查询
  108. async search() {
  109. const that = this;
  110. },
  111. // 图片上传
  112. uplSuc(e) {
  113. const that = this;
  114. that.$set(that.user, `icon`, [e.data]);
  115. },
  116. // 图片删除
  117. uplDel(e) {
  118. const that = this;
  119. that.$set(that.user, `icon`, [])
  120. },
  121. // 性别选择
  122. genderChange(e) {
  123. const that = this;
  124. let data = that.genderList[e.detail.value];
  125. if (data) that.$set(that.user, `gender`, data.value)
  126. },
  127. // 保存
  128. async onSubmit() {
  129. const that = this;
  130. const form = that.user;
  131. let res;
  132. res = await that.$api(`/doctor/${form._id}`, 'POST', form);
  133. if (res.errcode == '0') {
  134. uni.showToast({
  135. title: '维护信息成功',
  136. icon: 'none'
  137. })
  138. } else {
  139. uni.showToast({
  140. title: res.errmsg,
  141. icon: 'none'
  142. })
  143. }
  144. },
  145. }
  146. }
  147. </script>
  148. <style lang="scss" scoped>
  149. .main {
  150. .one {
  151. display: flex;
  152. justify-content: center;
  153. padding: 2vw;
  154. }
  155. .two {
  156. padding: 2vw;
  157. .two_1 {
  158. display: flex;
  159. justify-content: space-between;
  160. padding: 4vw;
  161. border-bottom: 1px solid var(--f9Color);
  162. font-size: var(--font14Size);
  163. color: var(--f69Color);
  164. .right {
  165. display: flex;
  166. align-items: center;
  167. input {
  168. text-align: right;
  169. padding: 0 1vw;
  170. }
  171. }
  172. }
  173. }
  174. .thr {
  175. text-align: center;
  176. .button {
  177. margin: 2vw 0 0 0;
  178. background-color: var(--f3CColor);
  179. color: var(--mainColor);
  180. font-size: var(--font14Size);
  181. }
  182. }
  183. }
  184. </style>