详情小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
3.0 KiB

5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <view class="head">
  4. <image class="img" src="../../static/images/add_wechat.png"></image>
  5. </view>
  6. <view class="content">
  7. <view class="title">添加微信号</view>
  8. <view class="desc">请输入正确的微信号以便客服人员能准确的联系到你哟</view>
  9. <view class="input-box">
  10. <input v-model="wechat_num"
  11. :adjust-position="false"
  12. :auto-blur="true"
  13. @focus="inputFocus"
  14. @blur="inputBlur"
  15. placeholder="请输入微信号" />
  16. <view class="clear" v-if="wechat_num.length" @click="wechat_num = ''">
  17. <text class="lf-iconfont icon-shanchu"></text>
  18. </view>
  19. </view>
  20. <button class="confirm" hover-class="lf-opacity" @click="confirm">确认</button>
  21. </view>
  22. <view class="hide-view" :style="is_focus ? 'height: 540rpx' : 'height: 40rpx'"></view>
  23. </view>
  24. </template>
  25. <script>
  26. let time = null;
  27. export default {
  28. data(){
  29. return {
  30. wechat_num: '',
  31. is_focus: false,
  32. button_click: false
  33. }
  34. },
  35. onLoad(){
  36. },
  37. methods: {
  38. inputFocus(){
  39. time = setTimeout(() => {
  40. this.is_focus = true;
  41. }, 0); // 给blur事件留出时间
  42. setTimeout(() => {
  43. uni.pageScrollTo({
  44. scrollTop: 190,
  45. duration: 100
  46. })
  47. }, 200);
  48. },
  49. inputBlur(){
  50. time = setTimeout(() => {
  51. this.is_focus = false;
  52. }, 0); // 给click事件留出时间
  53. },
  54. confirm(){
  55. let wechat_num = this.wechat_num;
  56. if(!wechat_num) return this.$msg('请您先输入微信号');
  57. this.$http(this.API.API_USER_UPDATE_WEIXIN, {
  58. weixin: wechat_num
  59. }).then(res => {
  60. this.$msg(res.data).then(() => this.$toBack());
  61. })
  62. }
  63. }
  64. }
  65. </script>
  66. <style>
  67. page{
  68. width: 100vw;
  69. height: 100%;
  70. /* overflow-x: hidden; */
  71. /* background: linear-gradient(180deg, #FE3EA5 0%, #FE7749 100%); */
  72. background: linear-gradient(180deg, #FE3EA5 0%, #FE7749 100%);
  73. }
  74. </style>
  75. <style lang="scss" scoped="scoped">
  76. .head{
  77. width: 100vw;
  78. height: max-content;
  79. display: flex;
  80. justify-content: center;
  81. padding-top: 80rpx;
  82. .img{
  83. width: 661rpx;
  84. height: 620rpx;
  85. }
  86. }
  87. .content{
  88. width: 630rpx;
  89. // height: 572rpx;
  90. height: max-content;
  91. background: #FFFFFF;
  92. border-radius: 60rpx;
  93. position: relative;
  94. z-index: 2;
  95. margin: 0 auto;
  96. margin-top: -150rpx;
  97. box-sizing: border-box;
  98. padding: 60rpx;
  99. .title{
  100. text-align: center;
  101. font-weight: bold;
  102. font-size: 32rpx;
  103. color: #222222;
  104. }
  105. .desc{
  106. font-size: 24rpx;
  107. margin-top: 20rpx;
  108. color: #999999;
  109. }
  110. .input-box{
  111. margin-top: 60rpx;
  112. border-bottom: 1rpx solid #e5e5e5;
  113. width: 100%;
  114. height: 80rpx;
  115. display: flex;
  116. align-items: center;
  117. justify-content: space-between;
  118. & > input{
  119. width: 430rpx;
  120. height: 80rpx;
  121. font-size: 28rpx;
  122. }
  123. .clear{
  124. padding: 20rpx;
  125. }
  126. }
  127. .confirm{
  128. width: 100%;
  129. height: 100rpx;
  130. background: #E21196;
  131. border-radius: 60rpx;
  132. margin-top: 80rpx;
  133. color: #FFFFFF;
  134. line-height: 100rpx;
  135. }
  136. }
  137. .hide-view{
  138. background-color: #fe7054;
  139. }
  140. </style>