合同小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.7 KiB

  1. <template>
  2. <view class="container">
  3. <view class="form">
  4. <input class="input" type="text" placeholder="请输入您的账号" v-model="username" />
  5. <input class="input" type="password" placeholder="请输入您的密码" v-model="password" />
  6. <view class="agreement">
  7. <checkbox-group @change="handleAgreementChange">
  8. <label>
  9. <checkbox value="agree" /> 阅读并同意《用户协议》和《隐私政策》
  10. </label>
  11. </checkbox-group>
  12. </view>
  13. <button class="button" @click="handleLogin">登录</button>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. username: '',
  22. password: '',
  23. agreed: false
  24. };
  25. },
  26. methods: {
  27. handleAgreementChange(e) {
  28. this.agreed = e.detail.value.includes('agree');
  29. },
  30. handleLogin() {
  31. if (!this.agreed) {
  32. uni.showToast({
  33. title: '请先同意用户协议和隐私政策',
  34. icon: 'none'
  35. });
  36. return;
  37. }
  38. // 这里可以添加登录逻辑
  39. uni.showToast({
  40. title: '登录成功',
  41. icon: 'success'
  42. });
  43. }
  44. }
  45. };
  46. </script>
  47. <style>
  48. .container {
  49. display: flex;
  50. justify-content: center;
  51. align-items: center;
  52. height: 100vh;
  53. background-color: #f5f5f5;
  54. }
  55. .form {
  56. width: 80%;
  57. background-color: #fff;
  58. padding: 20px;
  59. border-radius: 8px;
  60. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  61. }
  62. .input {
  63. width: 100%;
  64. height: 40px;
  65. margin-bottom: 15px;
  66. padding: 10px;
  67. border: 1px solid #ccc;
  68. border-radius: 4px;
  69. }
  70. .agreement {
  71. margin-bottom: 15px;
  72. }
  73. .button {
  74. width: 100%;
  75. height: 40px;
  76. background-color: #007aff;
  77. color: #fff;
  78. border: none;
  79. border-radius: 4px;
  80. font-size: 16px;
  81. }
  82. </style>