index.vue 5.3 KB

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