userMsgMenager.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view>
  3. <customNav :shownav="true" :title="$t('index.usermsg')" titledetl=""></customNav>
  4. <view class="yzmctV">
  5. <yhdslCropper ref="yhdslCropper" :quality="1" mode="scale" @uploadImg="uploadImg" :scale="scale"></yhdslCropper>
  6. <myImage class="imagV" :mysrc="userIcon" :isIcon="true" mymode="heightFix" v-on:Emyimageclick='imageUpdata' ></myImage>
  7. </view>
  8. <view class="yzmlist bottomline">
  9. <text class="tittext">{{$t('user.nicheng')}}:</text>
  10. <input class="noinputV" type="text" :placeholder="$t('user.qingshuryhnc')" :value="nikename" @input="phoneinput">
  11. </view>
  12. <view class="yzmlist bottomline">
  13. <text class="tittext">e-mail:</text>
  14. <input class="noinputV" type="text" :placeholder="$t('user.qingtianxndyx')" :value="email" @input="smsCodeinput">
  15. </view>
  16. <!-- <view class="yzmctV">
  17. <input class="noinputV" type="text" :placeholder="$t('user.qingtianxndyx')" :value="email" @input="smsCodeinput">
  18. </view> -->
  19. <view class="yzmctV">
  20. <radio-group @change="radioChange">
  21. <radio value="0" :checked="sex==0" />
  22. {{$t('index.xiansheng')}}
  23. <radio value="1" :checked="sex==1"/>
  24. {{$t('index.nvshi')}}
  25. <radio value="2" :checked="sex==2"/>
  26. {{$t('index.weizhi')}}
  27. </radio-group>
  28. </view>
  29. <view class="yzmctV">
  30. <text class="querenBt" @click="updata">{{$t('index.tijiao')}}</text>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import api from "@/pages/api/api.js"
  36. import yhdslCropper from '@/components/yhdsl-cropper/yhdsl-cropper.vue';
  37. export default {
  38. components: {
  39. yhdslCropper
  40. },
  41. data() {
  42. return {
  43. token:'',
  44. nikename:'',
  45. email:'',
  46. sex:1,
  47. userIcon:'',
  48. userInfo:[],
  49. scale:1
  50. }
  51. },
  52. onLoad() {
  53. this.userInfo = uni.getStorageSync("userInfo");
  54. this.nikename=this.userInfo.nickName;
  55. this.email = this.userInfo.email;
  56. this.sex = this.userInfo.sex;
  57. this.userIcon = this.userInfo.avatar;
  58. },
  59. methods: {
  60. radioChange(e){
  61. console.log(e.detail.value)
  62. this.sex=e.detail.value;
  63. },
  64. phoneinput(event){
  65. this.nikename = event.target.value;
  66. },
  67. smsCodeinput(event){
  68. this.email = event.target.value;
  69. },
  70. imageUpdata(){
  71. this.$refs.yhdslCropper.chooseImage();
  72. },
  73. uploadImg(e) {
  74. console.log('------------uploadImg:',e)
  75. this.spImage = e;
  76. var that = this;
  77. uni.uploadFile({
  78. url: this.$upImagurl, //上传图片api
  79. filePath: e,
  80. name: 'file',
  81. header:{
  82. //"Authorization": userinfo.token
  83. },
  84. success: (res) => {
  85. let group = JSON.parse(res.data);
  86. that.userIcon=group.data;
  87. uni.showToast({
  88. title:that.$t('mend.shangccg'),
  89. icon:"success"
  90. })
  91. }
  92. });
  93. },
  94. updata(){
  95. var pattern = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$/;
  96. if (pattern.test(this.email)) {
  97.   ;
  98. } else {
  99.   console.log("错误的邮箱地址!");
  100. if(this.email==''||null==this.email||undefined==this.email){
  101. }
  102. else{
  103. uni.showToast({
  104. title:'Nhầm địa chỉ email!',
  105. icon:"none"
  106. })
  107. return;
  108. }
  109. }
  110. this.updataUserMsg();
  111. },
  112. updataUserMsg(){
  113. api('updataUserMsg',{
  114. "nickName":this.nikename,
  115. "email":this.email,
  116. "sex": this.sex,
  117. "avatar": this.userIcon,
  118. "status": 0
  119. },res=>{
  120. console.log(res.data)
  121. uni.navigateBack({
  122. delta:1,//返回层数,2则上上页
  123. })
  124. },failc=>{
  125. //console.log('getadvertis----',failc)
  126. })
  127. },
  128. }
  129. }
  130. </script>
  131. <style>
  132. .imagV{
  133. margin-top: 30rpx;
  134. padding: 8rpx;
  135. width: 120rpx;
  136. height: 120rpx;
  137. border: 2rpx solid darkgray;
  138. }
  139. .yzmctV{
  140. display: flex;
  141. flex-direction: row;
  142. align-items: center;
  143. justify-content: center;
  144. margin-top: 40rpx;
  145. }
  146. .yzmlist{
  147. display: flex;
  148. flex-direction: row;
  149. align-items: center;
  150. justify-content: flex-start;
  151. width: 100%;
  152. margin-top: 40rpx;
  153. padding: 20rpx;
  154. }
  155. .bottomline{
  156. border: solid lightgray;
  157. border-width: 0px 0px 2rpx 0px;
  158. }
  159. .tittext{
  160. font-size: 26rpx;
  161. width: 20%;
  162. text-align: right;
  163. }
  164. .noinputV{
  165. width: 70%;
  166. margin-left: 2%;
  167. height: 60rpx;
  168. line-height: 60rpx;
  169. border-radius: 20rpx;
  170. border: 2rpx solid lightgray;
  171. }
  172. .querenBt{
  173. margin-top: 30rpx;
  174. width: 80%;
  175. height: 60rpx;
  176. line-height: 60rpx;
  177. padding: 10rpx;
  178. border-radius: 20rpx;
  179. border: solid crimson;
  180. border-width: 0px 0px 6rpx 0px;
  181. text-align: center;
  182. justify-content: center;
  183. background-color: #00A6FF;
  184. color: white;
  185. box-shadow: 0rpx 0rpx 10rpx 0rpx #00A6FF;
  186. }
  187. </style>