login.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view>
  3. <back></back>
  4. <image src="https://chenglantimes.com/prod-api/profile/upload/2024/08/27/1724751981292.jpg" mode="widthFix" style="width: 100%"></image>
  5. <view class="bg">
  6. <image src="https://chenglantimes.com/prod-api/profile/upload/2025/01/02/1735784855953.jpg" mode="widthFix" class="llg animated fadeInDown"></image>
  7. <view class="xy">
  8. <u-checkbox-group class="checkbox" v-model="item.checked">
  9. <u-checkbox size="15" shape="circle" label="我已阅读并同意" labelSize="14" name="true"></u-checkbox>
  10. </u-checkbox-group>
  11. <text class="a" @click="go('/pages/other/agreement?title=用户协议')">《用户协议》</text>
  12. <text>和</text>
  13. <text class="a" @click="go('/pages/other/agreement?title=隐私政策')">《隐私政策》</text>
  14. </view>
  15. <button class="btn" @click="getUserProfile()" :disabled="disabled">用户登录</button>
  16. </view>
  17. <view class="doctor" @click="go('/pages/user/loginDoctor')">
  18. <view class="login">
  19. <text class="icon">&#xe6a3;</text>
  20. <text>医生登录</text>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. item: {},
  30. disabled: false //防止重复点击
  31. };
  32. },
  33. methods: {
  34. getUserProfile() {
  35. let rule = [{ name: 'checked', checkType: 'notnull', errorMsg: '请同意并勾选协议' }];
  36. if (!this.verify.check(this.item, rule)) {
  37. uni.showModal({ content: this.verify.error, showCancel: false });
  38. return false;
  39. }
  40. this.disabled = true;
  41. let code = '';
  42. uni.login({
  43. provider: 'weixin',
  44. success: (res) => {
  45. code = res.code;
  46. }
  47. });
  48. //获取用户信息
  49. uni.getUserProfile({
  50. desc: '用于完善会员资料',
  51. lang: 'zh_CN',
  52. provider: 'weixin',
  53. success: (info) => {
  54. let item = info.userInfo;
  55. item.code = code;
  56. this.http.request({
  57. url: '/app/user/login',
  58. data: item,
  59. method: 'POST',
  60. success: (res) => {
  61. this.disabled = false;
  62. uni.setStorageSync('user', res.data.data);
  63. uni.navigateBack();
  64. },
  65. fail: (res) => {
  66. this.disabled = false;
  67. }
  68. });
  69. },
  70. fail: (res) => {
  71. this.disabled = false;
  72. }
  73. });
  74. },
  75. go(url) {
  76. uni.navigateTo({ url: url });
  77. }
  78. }
  79. };
  80. </script>
  81. <style lang="scss">
  82. page {
  83. background-color: white;
  84. }
  85. .bg {
  86. padding: 30px;
  87. position: relative;
  88. margin-top: -30px;
  89. background-color: white;
  90. border-radius: 25px 25px 0px 0px;
  91. text-align: center;
  92. .llg{
  93. margin: 0 auto;
  94. border-radius: 25px;
  95. margin-bottom: 15px;
  96. width: 100%;
  97. height: 222px;
  98. }
  99. }
  100. .doctor {
  101. position: fixed;
  102. width: 100%;
  103. bottom: 10px;
  104. .login {
  105. text-align: center;
  106. padding: 20px;
  107. color: $font-c;
  108. .icon {
  109. padding-right: 5px;
  110. }
  111. }
  112. }
  113. </style>