index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class='loginWrap'>
  3. <view style='text-align:center;padding:60rpx;'>
  4. <u--image width='80' height='80' src="/static/logo.png" radius='10' shape="square"></u--image>
  5. </view>
  6. <view style='width:80%;margin:0 auto;'>
  7. <u-button :customStyle="customStyleOk" open-type="getPhoneNumber"
  8. @getphonenumber="getPhoneNumber"> 微信用户一键登录</u-button>
  9. </view>
  10. <!-- <view><u-button :customStyle="customStyleUnOk" @click="showAuthorizePhone=false" :plain="true">
  11. 拒绝</u-button></view> -->
  12. <view style='margin:40rpx 0;'>
  13. <view style='width: 77%;margin: 0 auto;' class='flex'>
  14. <view style='margin-right:5rpx;'>
  15. <u--image @click='value= !value' width='16' height='16' :src="value?'/static/image/login/checked.png':'/static/image/login/no-checked.png'" radius='10' shape="square"></u--image>
  16. </view>
  17. 登录代表您已同意<navigator
  18. url="/pageA/webview?can_share=false&url=https://liangxin.zthymaoyi.com/youyuquan.html"
  19. class="path" hover-class="navigator-hover">用户服务协议和隐私政策</navigator>
  20. </view>
  21. </view>
  22. <u-modal :show="showAuthorizeUser" :showConfirmButton="false">
  23. <view class="slot-content">
  24. <view class="auth-card">
  25. <view class="img">
  26. <img class="avatar-img" src="@/static/logo.png" mode="widthFix">
  27. </view>
  28. <view class="content">邀请您补全个人信息<br></br>(昵称、头像)</view>
  29. <view style="margin-left: 100rpx;margin-right: 100rpx">
  30. <u-form :model="userInfo" ref="uForm">
  31. <u-form-item label="头像">
  32. <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"
  33. slot="right">
  34. <image class="avatar"
  35. :src="userInfo.head?userInfo.head:'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'">
  36. </image>
  37. </button>
  38. </u-form-item>
  39. <u-form-item label="昵称">
  40. <u-input inputAlign='right' v-model="userInfo.nickname" class="weui-input"
  41. @blur="userNameInput" placeholder="请输入昵称" border="false" />
  42. <!-- <input type="nickname" :value="userInfo.nickname" class="weui-input" @blur="userNameInput" placeholder="请输入昵称"/> -->
  43. </u-form-item>
  44. </u-form>
  45. </view>
  46. </view>
  47. <view class="auth-btncard">
  48. <view class="btn-unok"><u-button :customStyle="customStyleUnOk" @click="authUser(0)">
  49. 拒绝</u-button>
  50. </view>
  51. <view class="btn-ok">
  52. <u-button :customStyle="customStyleOk" @click="authUser(1)"> 允许</u-button>
  53. </view>
  54. </view>
  55. </view>
  56. </u-modal>
  57. </view>
  58. </template>
  59. <script>
  60. var that
  61. export default {
  62. data() {
  63. return {
  64. userInfo: {
  65. head: '',
  66. nickname: '',
  67. phone: '',
  68. },
  69. showAuthorizeUser:false,
  70. value:false,
  71. customStyleUnOk: {
  72. marginTop: '20rpx',
  73. color: '#eaad1a',
  74. border: '2px solid #eaad1a',
  75. "border-radius": "10px",
  76. fontSize: "32rpx"
  77. },
  78. customStyleOk: {
  79. marginTop: '20rpx',
  80. color: '#000',
  81. // border: '2px solid #eaad1a',
  82. "border-radius": "10px",
  83. fontSize: "32rpx",
  84. padding:'40rpx',
  85. background: " linear-gradient(to right,#FED41E,#FDC21D);"
  86. },
  87. };
  88. },
  89. props: {
  90. content: {
  91. type: String,
  92. default: ""
  93. },
  94. },
  95. watch:{
  96. },
  97. mounted() {
  98. that = this
  99. },
  100. computed: {
  101. },
  102. methods: {
  103. radiochange(e){
  104. },
  105. open(){
  106. this.showAuthorizePhone=true
  107. },
  108. async getPhoneNumber(e) {
  109. if(this.value){
  110. console.log(0)
  111. that.userInfo = await this.$request.wxlogin()
  112. console.log(that.userInfo,1111)
  113. that.userInfo.phone = await this.$request.getPhone(e, that.userInfo)
  114. console.log(that.userInfo,2222)
  115. this.showAuthorizeUser = true
  116. }else{
  117. uni.showToast({
  118. icon: "none",
  119. title: '请阅读并勾选用户协议和隐私政策',
  120. duration: 3000
  121. });
  122. }
  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. uni.navigateBack()
  131. // that.mescroll.resetUpScroll()
  132. }
  133. },
  134. }
  135. }
  136. </script>
  137. <style lang='scss' scoped>
  138. .loginWrap{
  139. background:#fff;
  140. height:100vh;
  141. }
  142. /deep/.u-transition{
  143. align-items: center;
  144. }
  145. .path{
  146. color:#FDC21D;
  147. }
  148. /deep/.u-radio-group{
  149. flex: 0.7 !important;
  150. }
  151. .auth-btncard {
  152. display: flex !important;
  153. justify-content: space-between !important;
  154. .btn-unok {
  155. width: 40%;
  156. }
  157. .btn-ok {
  158. width: 40%;
  159. }
  160. }
  161. .auth-card {
  162. text-align: center;
  163. .avatar-img {
  164. width: 250rpx;
  165. }
  166. .title {
  167. font-size: 20rpx;
  168. }
  169. .content {
  170. font-size: 32rpx;
  171. font-weight: bold;
  172. color: #1A1A1A;
  173. margin-bottom: 30rpx;
  174. }
  175. }
  176. .avatar-wrapper {
  177. color: #333 !important;
  178. border: none !important;
  179. border-radius: 0 !important;
  180. background-color: transparent !important;
  181. padding: 0;
  182. }
  183. .avatar-wrapper::after {
  184. border: none !important;
  185. }
  186. .avatar {
  187. width: 100rpx;
  188. height: 100rpx;
  189. overflow: hidden;
  190. border-radius: 100%;
  191. }
  192. /deep/.u-popup__content {
  193. border-radius: 20rpx !important;
  194. }
  195. /deep/.u-button--normal{
  196. padding: 0 5px;
  197. }
  198. </style>