index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view>
  3. <u-modal :show="showAuthorizePhone" :showConfirmButton="false">
  4. <view class="slot-content">
  5. <view class="auth-card">
  6. <view class="img">
  7. <img class="avatar-img" src="@/static/logo.png" mode="widthFix">
  8. </view>
  9. <view class="content">{{content}}</view>
  10. </view>
  11. <view class="auth-btncard">
  12. <view class="btn-unok">
  13. <u-button :customStyle="customStyleUnOk" @click="showAuthorizePhone=false" :plain="true">
  14. 拒绝</u-button>
  15. </view>
  16. <view class="btn-ok">
  17. <u-button :customStyle="customStyleOk"
  18. @click="toDetail"> 立即登录</u-button>
  19. <!-- <u-button :customStyle="customStyleOk" open-type="getPhoneNumber"
  20. @getphonenumber="getPhoneNumber"> 立即登录</u-button> -->
  21. </view>
  22. </view>
  23. </view>
  24. </u-modal>
  25. <u-modal :show="showAuthorizeUser" :showConfirmButton="false">
  26. <view class="slot-content">
  27. <view class="auth-card">
  28. <view class="img">
  29. <img class="avatar-img" src="@/static/logo.png" mode="widthFix">
  30. </view>
  31. <view class="content">邀请您补全个人信息<br></br>(昵称、头像)</view>
  32. <view style="margin-left: 100rpx;margin-right: 100rpx">
  33. <u-form :model="userInfo" ref="uForm">
  34. <u-form-item label="头像">
  35. <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"
  36. slot="right">
  37. <image class="avatar"
  38. :src="userInfo.head?userInfo.head:'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'">
  39. </image>
  40. </button>
  41. </u-form-item>
  42. <u-form-item label="昵称">
  43. <u-input inputAlign='right' v-model="userInfo.nickname" class="weui-input"
  44. @blur="userNameInput" placeholder="请输入昵称" border="false" />
  45. <!-- <input type="nickname" :value="userInfo.nickname" class="weui-input" @blur="userNameInput" placeholder="请输入昵称"/> -->
  46. </u-form-item>
  47. </u-form>
  48. </view>
  49. </view>
  50. <view class="auth-btncard">
  51. <view class="btn-unok"><u-button :customStyle="customStyleUnOk" @click="authUser(0)">
  52. 拒绝</u-button>
  53. </view>
  54. <view class="btn-ok">
  55. <u-button :customStyle="customStyleOk" @click="authUser(1)"> 允许</u-button>
  56. </view>
  57. </view>
  58. </view>
  59. </u-modal>
  60. </view>
  61. </template>
  62. <script>
  63. var that
  64. export default {
  65. data() {
  66. return {
  67. showAuthorizePhone:false,
  68. showAuthorizeUser:false,
  69. userInfo: {
  70. head: '',
  71. nickname: '',
  72. phone: '',
  73. },
  74. customStyleUnOk: {
  75. marginTop: '20rpx',
  76. color: '#eaad1a',
  77. border: '2px solid #eaad1a',
  78. "border-radius": "10px",
  79. fontSize: "32rpx"
  80. },
  81. customStyleOk: {
  82. marginTop: '20rpx',
  83. color: '#fff',
  84. border: '2px solid #eaad1a',
  85. "border-radius": "10px",
  86. fontSize: "32rpx",
  87. padding:'0 5px',
  88. background: "#eaad1a"
  89. },
  90. };
  91. },
  92. props: {
  93. content: {
  94. type: String,
  95. default: ""
  96. },
  97. },
  98. watch:{
  99. },
  100. mounted() {
  101. that = this
  102. },
  103. computed: {
  104. },
  105. methods: {
  106. open(){
  107. this.showAuthorizePhone=true
  108. },
  109. toDetail(){
  110. this.showAuthorizePhone = false
  111. uni.navigateTo({
  112. url:'/pageA/login/index'
  113. })
  114. },
  115. async getPhoneNumber(e) {
  116. console.log(0)
  117. that.userInfo = await this.$request.wxlogin()
  118. console.log(that.userInfo,1111)
  119. that.userInfo.phone = await this.$request.getPhone(e, that.userInfo)
  120. console.log(that.userInfo,2222)
  121. this.showAuthorizePhone = false
  122. this.showAuthorizeUser = true
  123. },
  124. async authUser(type) {
  125. //同步信息,没有头像和昵称自动生成
  126. this.userInfo = await this.$request.syncInfo(this.userInfo)
  127. if (this.userInfo.openId) {
  128. uni.setStorageSync("userInfo", that.userInfo)
  129. that.showAuthorizeUser = false
  130. // that.mescroll.resetUpScroll()
  131. }
  132. },
  133. }
  134. }
  135. </script>
  136. <style lang='scss' scoped>
  137. .auth-btncard {
  138. display: flex !important;
  139. justify-content: space-between !important;
  140. .btn-unok {
  141. width: 40%;
  142. }
  143. .btn-ok {
  144. width: 40%;
  145. }
  146. }
  147. .auth-card {
  148. text-align: center;
  149. .avatar-img {
  150. width: 250rpx;
  151. }
  152. .title {
  153. font-size: 20rpx;
  154. }
  155. .content {
  156. font-size: 32rpx;
  157. font-weight: bold;
  158. color: #1A1A1A;
  159. margin-bottom: 30rpx;
  160. }
  161. }
  162. .avatar-wrapper {
  163. color: #333 !important;
  164. border: none !important;
  165. border-radius: 0 !important;
  166. background-color: transparent !important;
  167. padding: 0;
  168. }
  169. .avatar-wrapper::after {
  170. border: none !important;
  171. }
  172. .avatar {
  173. width: 100rpx;
  174. height: 100rpx;
  175. overflow: hidden;
  176. border-radius: 100%;
  177. }
  178. /deep/.u-popup__content {
  179. border-radius: 20rpx !important;
  180. }
  181. /deep/.u-button--normal{
  182. padding: 0 5px;
  183. }
  184. </style>