康巴易测肤/伤疤uniapp小程序类
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.

1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
1 月之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="app-container">
  3. <view class="main">
  4. <view class="img-box">
  5. <image :showLoading="true" class="img_login" :src="img_login" mode="widthFix"></image>
  6. </view>
  7. <view class="login-box">
  8. <view class="form-box">
  9. <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
  10. <u-form-item label="号码" prop="userInfo.name" borderBottom>
  11. <u-input v-model="form.userInfo.phone" border="none" placeholder="请输入手机号" type="number"></u-input>
  12. </u-form-item>
  13. <u-form-item label="验证码" prop="userInfo.name" borderBottom labelWidth="60">
  14. <u--input v-model="form.userInfo.code" border="none" placeholder="请输入验证码" type="number"></u--input>
  15. <u-code :seconds="seconds" @end="end" @start="start" ref="uCode"
  16. @change="codeChange"></u-code>
  17. <u-button @click="getCode" color="#f8f8f8" type="default" size="normal" slot="right">
  18. <u--text color="#333" :text="tips"></u--text>
  19. </u-button>
  20. </u-form-item>
  21. </u--form>
  22. </view>
  23. <view class="action-box">
  24. <view class="btn-box">
  25. <u-button @click="login('phone')" :color="bgthemeColor" type="info" size="large">
  26. <text class="black" :class="!checked ? 'gray' : ''">手机号码登录</text>
  27. </u-button>
  28. </view>
  29. <view class="btn-box">
  30. <u-button @click="login('wx')" :color="bgthemeColor" type="info" size="large">
  31. <text class="black" :class="!checked ? 'gray' : ''">微信一键登录</text>
  32. </u-button>
  33. </view>
  34. </view>
  35. <view class="agree-box">
  36. <u-checkbox-group>
  37. <u-checkbox v-model="checked" @change="onChange" shape="circle" size="20">
  38. </u-checkbox>
  39. </u-checkbox-group>
  40. <view class="agree-text">
  41. 同意<text class="blue" @click="onUserAgreement">用户协议</text>和<text class="blue">隐私协议</text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. img_login: 'https://telpo-healthy.oss-cn-hangzhou.aliyuncs.com/healthy/knowledge/202502/008071d3dcac4785b3929a00800ae501.jpg',
  53. checked: false,
  54. tips: '',
  55. seconds: 10,
  56. active: false,
  57. form: {
  58. userInfo: {
  59. phone: '',
  60. code: ''
  61. }
  62. },
  63. value: '',
  64. tips: '',
  65. show: false,
  66. rules: {
  67. username: [{
  68. required: true,
  69. message: '请输入用户名',
  70. trigger: ['blur', 'change']
  71. }],
  72. password: [{
  73. required: true,
  74. message: '请输入密码',
  75. trigger: ['blur', 'change']
  76. }]
  77. }
  78. }
  79. },
  80. computed: {
  81. bgthemeColor() {
  82. return this.checked ? 'linear-gradient(90deg,rgba(158, 135, 255, 0.95),rgba(84, 71, 135, 0.95))' : 'linear-gradient(90deg,rgba(158, 135, 255, 0.4),rgba(84, 71, 135, 0.4))'
  83. },
  84. },
  85. onLoad() {
  86. // TODO 测试缓存
  87. this.$store.commit('SET_TEST_TEXT', '测试');
  88. this.$store.commit('SET_USER_ID', 'userId测试');
  89. console.log("testText", this.$store.getters.testText);
  90. console.log("userId", this.$store.getters.userId);
  91. },
  92. methods: {
  93. onUserAgreement() {},
  94. onAgreeChange() { },
  95. openPrivacyPolicy() { },
  96. codeChange(text) {
  97. this.tips = text;
  98. },
  99. login(type) {
  100. },
  101. getCode() {
  102. if (this.$refs.uCode.canGetCode) {
  103. // 模拟向后端请求验证码
  104. uni.showLoading({
  105. title: '正在获取验证码'
  106. })
  107. setTimeout(() => {
  108. uni.hideLoading();
  109. // 这里此提示会被this.start()方法中的提示覆盖
  110. uni.$u.toast('验证码已发送');
  111. // 通知验证码组件内部开始倒计时
  112. this.$refs.uCode.start();
  113. }, 2000);
  114. } else {
  115. }
  116. },
  117. end() {
  118. // uni.$u.toast('倒计时结束');
  119. },
  120. start() {
  121. uni.$u.toast('验证码已发送');
  122. },
  123. // 登录按钮操作
  124. handleSubmit() {
  125. this.$refs.form.validate().then(res => {
  126. this.$store.dispatch('Login', this.form)
  127. .then(res => {
  128. // 显示登录成功
  129. uni.showToast({
  130. title: "登录成功"
  131. });
  132. // 跳转到首页
  133. setTimeout(() => {
  134. uni.reLaunch({
  135. url: '/pages/index/index'
  136. });
  137. }, 1000)
  138. })
  139. })
  140. },
  141. getphonenumber(e) {
  142. console.log("快速登录", e);
  143. },
  144. onChange(n) {
  145. this.checked = n;
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="scss">
  151. .app-container {
  152. position: relative;
  153. height: 100vh;
  154. width: 100vw;
  155. overflow: hidden;
  156. .main {
  157. height: 100vh;
  158. .img-box {
  159. width: 100vw;
  160. z-index: 99;
  161. .img_login {
  162. width: 100%;
  163. }
  164. }
  165. .login-box {
  166. position: fixed;
  167. bottom: 0;
  168. width: 100vw;
  169. padding: 30rpx 0;
  170. padding-bottom: 60rpx;
  171. border-top-left-radius: 30rpx;
  172. border-top-right-radius: 30rpx;
  173. background: white;
  174. z-index: 999;
  175. .form-box {
  176. .u-form-item__body {
  177. padding: 20rpx !important;
  178. .u-button {
  179. padding: 20rpx 10rpx !important;
  180. }
  181. }
  182. }
  183. .action-box {
  184. padding: 0 30rpx;
  185. .btn-box {
  186. margin-top: 20rpx;
  187. display: flex;
  188. justify-content: center;
  189. align-items: center;
  190. text {
  191. font-size: 36rpx;
  192. }
  193. .black {
  194. color: $uni-text-color;
  195. }
  196. .gray {
  197. color: $uni-text-color-grey;
  198. }
  199. }
  200. }
  201. .agree-box {
  202. padding: 40rpx 30rpx;
  203. display: flex;
  204. justify-content: center;
  205. align-items: center;
  206. .agree-text {
  207. margin-left: 30rpx;
  208. .blue {
  209. color: $uni-color-primary;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. </style>