index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. "font-weight": 'bold',
  79. "background":'#F2F2F2',
  80. "border-radius": "10px",
  81. fontSize: "32rpx"
  82. },
  83. customStyleOk: {
  84. marginTop: '20rpx',
  85. color: '#fff',
  86. // border: '2px solid #eaad1a',
  87. "font-weight": 'bold',
  88. "background":'#F2F2F2',
  89. "border-radius": "10px",
  90. fontSize: "32rpx",
  91. padding:'0 20rpx',
  92. background: "#eaad1a"
  93. },
  94. };
  95. },
  96. props: {
  97. content: {
  98. type: String,
  99. default: ""
  100. },
  101. },
  102. watch:{
  103. },
  104. mounted() {
  105. that = this
  106. },
  107. computed: {
  108. },
  109. methods: {
  110. open(){
  111. this.showAuthorizePhone=true
  112. },
  113. toDetail(){
  114. this.showAuthorizePhone = false
  115. uni.navigateTo({
  116. url:'/pageA/login/index'
  117. })
  118. },
  119. async getPhoneNumber(e) {
  120. console.log(0)
  121. that.userInfo = await this.$request.wxlogin()
  122. console.log(that.userInfo,1111)
  123. that.userInfo.phone = await this.$request.getPhone(e, that.userInfo)
  124. console.log(that.userInfo,2222)
  125. this.showAuthorizePhone = false
  126. this.showAuthorizeUser = true
  127. },
  128. async authUser(type) {
  129. //同步信息,没有头像和昵称自动生成
  130. this.userInfo = await this.$request.syncInfo(this.userInfo)
  131. if (this.userInfo.openId) {
  132. uni.setStorageSync("userInfo", that.userInfo)
  133. that.showAuthorizeUser = false
  134. // that.mescroll.resetUpScroll()
  135. }
  136. },
  137. }
  138. }
  139. </script>
  140. <style lang='scss' scoped>
  141. .auth-btncard {
  142. display: flex !important;
  143. justify-content: space-between !important;
  144. .btn-unok {
  145. width: 40%;
  146. }
  147. .btn-ok {
  148. width: 40%;
  149. }
  150. }
  151. .auth-card {
  152. text-align: center;
  153. .avatar-img {
  154. width: 250rpx;
  155. }
  156. .title {
  157. font-size: 20rpx;
  158. }
  159. .content {
  160. font-size: 32rpx;
  161. font-weight: bold;
  162. color: #1A1A1A;
  163. margin-bottom: 30rpx;
  164. }
  165. }
  166. .avatar-wrapper {
  167. color: #333 !important;
  168. border: none !important;
  169. border-radius: 0 !important;
  170. background-color: transparent !important;
  171. padding: 0;
  172. }
  173. .avatar-wrapper::after {
  174. border: none !important;
  175. }
  176. .avatar {
  177. width: 100rpx;
  178. height: 100rpx;
  179. overflow: hidden;
  180. border-radius: 100%;
  181. }
  182. /deep/.u-popup__content {
  183. border-radius: 20rpx !important;
  184. }
  185. /deep/.u-button--normal{
  186. padding: 0 5px;
  187. }
  188. .slot-content{
  189. width: 100%;
  190. }
  191. </style>