information.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view style="width: 100%;height: 100%;background-color: #FFFFFF;">
  3. <!-- 头像 -->
  4. <view style="padding: 36rpx 28rpx;" class="flex align-center justify-around">
  5. <view style="width: 80%;font-size: 28rpx;background-color: ;">头像</view>
  6. <view class="flex align-center">
  7. <image style="border-radius: 50%;margin-right:20rpx;width: 88rpx;height: 88rpx;" @click="ChooseImage" :src='imgList[0]'
  8. mode='aspectFill'></image>
  9. <u-icon name="arrow-right" color="#C0C0C0"></u-icon>
  10. </view>
  11. </view>
  12. <!-- 个人简介 -->
  13. <view style="margin: 36rpx 28rpx;" class="flex align-center justify-around">
  14. <view style="width: 40%;font-size: 28rpx;">个人签名</view>
  15. <view class="flex align-center" style="width: 60%;">
  16. <u-input v-model="value" @input="inputTextAreaBlur" type="text" maxlength="10" :placeholder="placeholder1" input-align="right"
  17. :clearable="false" :customStyle="inputStyle" />
  18. </view>
  19. </view>
  20. <!-- 服务简介和输入域 -->
  21. <view style="margin: 40rpx 28rpx;">
  22. <view style="font-size: 28rpx;margin-bottom: 20rpx;">服务简介</view>
  23. <view style="">
  24. <textarea @input="bindTextAreaBlur" style="height: 200rpx;width: 100%;" :placeholder="placeholder2" />
  25. </view>
  26. </view>
  27. <!-- 分隔 -->
  28. <u-gap height="30" bg-color="#e1e1e1"></u-gap>
  29. <!-- 修改密码 -->
  30. <view style="padding: 36rpx 28rpx;" class="flex align-center justify-around" @click="next">
  31. <view style="width: 95%;font-size: 28rpx;background-color: ;">修改密码</view>
  32. <view class="flex align-center">
  33. <u-icon name="arrow-right" color="#C0C0C0"></u-icon>
  34. </view>
  35. </view>
  36. <view style="padding: 36rpx 28rpx;" class="flex align-center justify-around" @click="modalShow=true">
  37. <view style="width: 95%;font-size: 28rpx;background-color: ;">退出登录</view>
  38. <view class="flex align-center">
  39. <u-icon name="arrow-right" color="#C0C0C0"></u-icon>
  40. </view>
  41. </view>
  42. <!-- 弹窗 -->
  43. <u-modal v-model="modalShow" content="确定退出登录?" @confirm="edit" :show-cancel-button="true"></u-modal>
  44. <!-- 底部按钮 -->
  45. <view class="bottomButton" @click="bc">
  46. 保存
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import { mapState, mapMutations, mapGetters, mapActions } from 'vuex';
  52. import {
  53. imglocal
  54. } from '@/common/env';
  55. export default {
  56. data() {
  57. return {
  58. status:0,
  59. //弹窗
  60. modalShow:false,
  61. //头像数组
  62. imgList:[],
  63. //头像
  64. // 标签输入
  65. value: '',
  66. //标签样式
  67. inputStyle:{
  68. width:'420rpx',
  69. },
  70. //标签占位符
  71. placeholder1:'请输入个人标签,用于展示给患者',
  72. //输入域值
  73. areaValue:'',
  74. url:'',
  75. //输入域占位符
  76. placeholder2:'请填写服务范围、经验等信息,用于展示给患者。'
  77. }
  78. },
  79. onLoad(data) {
  80. console.log(data)
  81. this.status = data.status
  82. this.getInfo();
  83. },
  84. methods: {
  85. ...mapMutations(['logout']),
  86. getInfo: async function(){
  87. let res = await this.$request.get('doctor/doctorInfoEdit')
  88. console.log(res);
  89. this.imgList.push(res.data.avatar);
  90. this.placeholder1=res.data.sign;
  91. this.placeholder2=res.data.intro;
  92. },
  93. //修改密码
  94. next(){
  95. uni.navigateTo({
  96. url:'modifypassword?state='+this.status
  97. })
  98. },
  99. //退出登录
  100. edit(){
  101. let that = this
  102. uni.showLoading({
  103. title: '退出中...'
  104. });
  105. setTimeout(function() {
  106. that.logout ()
  107. uni.clearStorage();
  108. uni.hideLoading();
  109. uni.reLaunch({
  110. url:"../login/login"
  111. })
  112. }, 2000);
  113. },
  114. //输入框焦点消失事件
  115. bindTextAreaBlur({detail}){
  116. console.log(detail.value)
  117. this.placeholder2 = detail.value
  118. },
  119. //输入框焦点消失事件
  120. inputTextAreaBlur(e){
  121. console.log(e)
  122. this.placeholder1 = e
  123. },
  124. //保存按钮
  125. bc:async function(e){
  126. let res = await this.$request.post('doctor/doctorInfoEdit',{'intro':this.placeholder2,'avatar':this.url,'sign':this.placeholder1})
  127. if(res.status==0){
  128. uni.showToast({
  129. title: '修改成功',
  130. duration: 2000
  131. });
  132. uni.switchTab({
  133. url:'/pages/index/index'
  134. })
  135. }else{
  136. uni.showToast({
  137. title: '修改失败,请稍后重试',
  138. icon:'none',
  139. duration: 2000
  140. });
  141. }
  142. return false;
  143. },
  144. ChooseImage() {
  145. let that =this;
  146. uni.chooseImage({
  147. count: 1, //默认9
  148. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  149. sourceType: ['album', 'camera'], //从相册选择
  150. success: (res) => {
  151. that.imgList = res.tempFilePaths
  152. console.log('我是file:',res.tempFilePaths[0])
  153. that.$request.upload("Common/uploadFile",that.imgList[0],{}).then(res=>{
  154. that.url = imglocal+JSON.parse(res).data.url;
  155. console.log(that.url)
  156. })
  157. }
  158. });
  159. },
  160. }
  161. }
  162. </script>
  163. <style>
  164. page{
  165. background-color: #e1e1e1;
  166. }
  167. .bottomButton {
  168. width: 100%;
  169. height: 100rpx;
  170. position: fixed;
  171. bottom: 0;
  172. left: 0;
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. background-color: #0B73B9;
  177. color: #FFFFFF;
  178. font-size: 32rpx;
  179. z-index: 99;
  180. }
  181. </style>