index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="login-register" v-if="userStore.showLoginModal">
  3. <div class="lr-box" v-if="!userStore.isRegister">
  4. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/c79318ee-e219-4f01-9dfb-91d7180a0972.png" class="lr-box-topbg" mode="widthFix"></image>
  5. <div class="lr-box-top adfacjb">
  6. <image class="lr-box-top-left" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/64d76db1-be28-4ba2-a8f0-57e2408beebc.png"></image>
  7. <image class="lr-box-top-right" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/c3c4fa76-32d2-4d11-915d-5e655c6b5c72.png" @tap="close"></image>
  8. </div>
  9. <div class="lr-box-title">
  10. <p class="p">欢迎来到善行少年</p>
  11. <p class="p tip">首次登录需要简单填写信息即可进入</p>
  12. </div>
  13. <div class="lr-box-form">
  14. <div class="lr-box-form-item adfacjb">
  15. <div class="lr-box-form-item-left adfac">
  16. <div class="text" style="margin-right: 32rpx;"><span style="color: #F4657A;">*</span>手机号码</div>
  17. <up-input v-model="register.phone" border="none" placeholder="请输入手机号码"></up-input>
  18. </div>
  19. <div class="lr-box-form-item-right">
  20. <button class="yjsq" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">一键授权</button>
  21. </div>
  22. </div>
  23. <div class="lr-box-form-item adfacjb">
  24. <div class="lr-box-form-item-left adfac">
  25. <div class="text"><span style="color: #F4657A;">*</span>头像</div>
  26. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/a2944f51-2c7b-41e7-8206-8a3be1f76d11.png" v-if="!register.avatar"></image>
  27. <image :src="register.avatar"></image>
  28. </div>
  29. <div class="lr-box-form-item-right">
  30. <button class="yjsq" open-type="chooseAvatar" @bindchooseavatar="onChooseAvatar">设置</button>
  31. </div>
  32. </div>
  33. <div class="lr-box-form-item adfacjb">
  34. <div class="lr-box-form-item-left">
  35. <div class="text"><span style="color: #F4657A;">*</span>用户名</div>
  36. </div>
  37. <div class="lr-box-form-item-right">
  38. <up-input v-model="register.userName" border="none" inputAlign="right" placeholder="请输入真实姓名"></up-input>
  39. </div>
  40. </div>
  41. <div class="lr-box-form-item adfacjb">
  42. <div class="lr-box-form-item-left">
  43. <div class="text">家庭公益名称</div>
  44. </div>
  45. <div class="lr-box-form-item-right">
  46. <up-input v-model="register.nonprofitName" border="none" inputAlign="right" placeholder="请输入至少三个字"></up-input>
  47. </div>
  48. </div>
  49. <div class="lr-box-form-item adfacjb">
  50. <div class="lr-box-form-item-left">
  51. <div class="text">家庭公益口号</div>
  52. </div>
  53. <div class="lr-box-form-item-right">
  54. <up-input v-model="register.nonprofitNumber" border="none" inputAlign="right" placeholder="家庭公益口号"></up-input>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="lr-box-btns">
  59. <div class="btn" @tap="toRegister">立即注册</div>
  60. <div class="btn login" @tap="readLogin">已有账号,去登录</div>
  61. </div>
  62. </div>
  63. <div class="lr-box login" v-else>
  64. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/c79318ee-e219-4f01-9dfb-91d7180a0972.png" class="lr-box-topbg" mode="widthFix"></image>
  65. <div class="lr-box-top login adfacjb">
  66. <image class="lr-box-top-left login" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/d0f892c8-1f96-4c86-b62b-a8b027b4bf6e.png"></image>
  67. <image class="lr-box-top-right" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/c3c4fa76-32d2-4d11-915d-5e655c6b5c72.png" @tap="close"></image>
  68. </div>
  69. <div class="lr-box-memo">公益献爱心 真情暖人心!</div>
  70. <div class="lr-box-agree adfac">
  71. <image v-if="agree" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/87b5b244-d14f-43cd-991b-4ac9f48d909e.png" @tap="changeAgree"></image>
  72. <image v-else src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/b8a5cabd-57f8-4ad7-9677-f6372423c50a.png" @tap="changeAgree"></image>
  73. <div class="text">我已阅读并同意<span>《善行少年小程序隐私政策》</span>及<span>《善行少年服务协议》</span></div>
  74. </div>
  75. <div class="lr-box-login">
  76. <button class="phone-login" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumberLogin">手机号登录</button>
  77. </div>
  78. </div>
  79. </view>
  80. </template>
  81. <script setup name="">
  82. import { ref, getCurrentInstance } from 'vue'
  83. const { proxy } = getCurrentInstance()
  84. import { useUserStore } from '@/common/stores/user.js';
  85. const userStore = useUserStore();
  86. const register = ref({
  87. phone:null,
  88. avatar:null,
  89. userName:null,
  90. nonprofitName:null,
  91. nonprofitNumber:null,
  92. })
  93. const agree = ref(false)
  94. const close = () => {
  95. userStore.closeLoginModal();
  96. }
  97. const decryptPhoneNumber = e => {
  98. if(e.detail.code) getPhone(e.detail.code);
  99. }
  100. const onChooseAvatar = e => {
  101. }
  102. const getPhone = code => {
  103. }
  104. const toRegister = () => {
  105. if(!proxy.$reg.mobile(register.value.phone)) return proxy.$showToast('请输入正确的手机号码')
  106. if(!register.value.avatar) return proxy.$showToast('请设置头像')
  107. if(!register.value.userName) return proxy.$showToast('请输入真实姓名')
  108. userStore.register();
  109. }
  110. const readLogin = () => {
  111. userStore.isRegister = true;
  112. }
  113. const changeAgree = () => {
  114. agree.value = !agree.value;
  115. }
  116. const decryptPhoneNumberLogin = e => {
  117. if(e.detail.code) toPhoneLogin(e.detail.code);
  118. }
  119. const toPhoneLogin = code => {
  120. if(!agree.value) return proxy.$showToast('请勾选隐私政策和服务协议')
  121. userStore.login({});
  122. }
  123. </script>
  124. <style scoped lang="scss">
  125. .login-register{
  126. position: fixed;
  127. top: 0;
  128. left: 0;
  129. right: 0;
  130. bottom: 0;
  131. background: rgba(0, 0, 0, .4);
  132. z-index: 9999;
  133. display: flex;
  134. flex-direction: column;
  135. justify-content: flex-end;
  136. .lr-box{
  137. background: #F7F7F7;
  138. border-radius: 24rpx 24rpx 0rpx 0rpx;
  139. padding: 58rpx 30rpx 68rpx;
  140. position: relative;
  141. &.login{
  142. padding: 32rpx 40rpx 88rpx;
  143. }
  144. &-topbg{
  145. width: 100%;
  146. position: absolute;
  147. left: 0;
  148. top: 0;
  149. }
  150. &-top{
  151. position: relative;
  152. padding: 0 10rpx 0 34rpx;
  153. &.login{
  154. padding: 0;
  155. }
  156. &-left{
  157. width: 158rpx;
  158. height: 88rpx;
  159. &.login{
  160. width: 224rpx;
  161. height: 48rpx;
  162. }
  163. }
  164. &-right{
  165. width: 28rpx;
  166. height: 28rpx;
  167. }
  168. }
  169. &-title{
  170. position: relative;
  171. margin-top: 18rpx;
  172. padding-left: 34rpx;
  173. .p{
  174. font-family: PingFangSC, PingFang SC;
  175. font-weight: 600;
  176. font-size: 44rpx;
  177. color: #151B29;
  178. line-height: 62rpx;
  179. &.tip{
  180. font-weight: 400;
  181. font-size: 26rpx;
  182. color: rgba(21,27,41,0.61);
  183. line-height: 37rpx;
  184. margin-top: 10rpx;
  185. }
  186. }
  187. }
  188. &-form{
  189. position: relative;
  190. margin-top: 10rpx;
  191. &-item{
  192. height: 120rpx;
  193. background: #FFFFFF;
  194. border-radius: 16rpx;
  195. border: 1rpx solid #E0E1E4;
  196. padding: 0 30rpx;
  197. margin-top: 20rpx;
  198. &-left{
  199. width: 370rpx;
  200. .text{
  201. font-family: PingFangSC, PingFang SC;
  202. font-weight: 400;
  203. font-size: 30rpx;
  204. color: #151B29;
  205. line-height: 42rpx;
  206. }
  207. image{
  208. width: 60rpx;
  209. height: 60rpx;
  210. margin-left: 28rpx;
  211. }
  212. }
  213. &-right{
  214. width: calc(100% - 370rpx);
  215. padding-left: 20rpx;
  216. box-sizing: border-box;
  217. .yjsq{
  218. font-family: PingFangSC, PingFang SC;
  219. font-weight: 400;
  220. font-size: 28rpx;
  221. color: #0593FE;
  222. line-height: 40rpx;
  223. background-color: transparent;
  224. text-align: right;
  225. padding: 0;
  226. &::after{
  227. width: auto;
  228. border: none;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. &-btns{
  235. margin-top: 20rpx;
  236. padding: 0 10rpx;
  237. overflow: hidden;
  238. .btn{
  239. width: 100%;
  240. height: 90rpx;
  241. background: #B7F358;
  242. border-radius: 45rpx;
  243. font-family: PingFang-SC, PingFang-SC;
  244. font-weight: bold;
  245. font-size: 32rpx;
  246. color: #151B29;
  247. line-height: 90rpx;
  248. text-align: center;
  249. letter-spacing: 2rpx;
  250. margin-top: 20rpx;
  251. &.login{
  252. background: #ECEEF5;
  253. }
  254. }
  255. }
  256. &-memo{
  257. position: relative;
  258. font-family: PingFangSC, PingFang SC;
  259. font-weight: 400;
  260. font-size: 26rpx;
  261. color: #151B29;
  262. line-height: 36rpx;
  263. letter-spacing: 4rpx;
  264. margin-top: 41rpx;
  265. }
  266. &-agree{
  267. position: relative;
  268. margin-top: 95rpx;
  269. image{
  270. width: 48rpx;
  271. height: 48rpx;
  272. }
  273. .text{
  274. width: calc(100% - 48rpx);
  275. padding-left: 19rpx;
  276. box-sizing: border-box;
  277. font-family: PingFangSC, PingFang SC;
  278. font-weight: 400;
  279. font-size: 26rpx;
  280. color: #151B29;
  281. line-height: 36rpx;
  282. label{
  283. color: #E77687;
  284. }
  285. }
  286. }
  287. &-login{
  288. margin-top: 122rpx;
  289. .phone-login{
  290. width: 100%;
  291. height: 90rpx;
  292. background: #B7F358;
  293. border-radius: 45rpx;
  294. font-family: PingFang-SC, PingFang-SC;
  295. font-weight: bold;
  296. font-size: 32rpx;
  297. color: #151B29;
  298. line-height: 90rpx;
  299. text-align: center;
  300. letter-spacing: 2rpx;
  301. &::after{
  302. border: none;
  303. }
  304. }
  305. }
  306. }
  307. }
  308. </style>