123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <!-- 账号密码登录 accountLogin -->
- <template>
- <view>
- <!-- 表单项 -->
- <u-form
- ref="accountLoginRef"
- labelWidth="140"
- labelAlign="left"
- labelPosition="top"
- >
- <u-form-item prop="mobile" label="手机号">
- <view class="input-line">
- <u-input
- placeholder="请输入手机号"
- v-model="model.mobile"
- border="none"
- type="number"
- maxlength="11"
- ></u-input>
- </view>
- </u-form-item>
- <u-form-item prop="password" label="密码">
- <view class="input-line">
- <u-input
- type="password"
- placeholder="请输入密码"
- v-model="model.password"
- border="none"
- ></u-input>
- </view>
- </u-form-item>
- </u-form>
- </view>
- </template>
- <script>
- export default{
- data() {
- return {
- model:{
- mobile:'',
- password:''
- },
- rules:{
- mobile: [
- {
- required: true,
- errorMessage: '请输入手机号',
- },
- {
- validateFunction: function (rule, value, data, callback) {
- if (!test.mobile(value)) {
- callback('手机号码格式不正确');
- }
- return true;
- },
- },
- ],
- password: [
- {
- required: true,
- errorMessage: '请输入密码',
- },
- ],
- }
- }
- },
- methods:{
- accountLoginSubmit() {
- if(!uni.$u.test.mobile(this.model.mobile)){
- return uni.$u.toast("请输入正确手机号");
- }
- if(!this.model.password) {
- return uni.$u.toast("请输入密码");
- }
- uni.$u.toast("登录成功!");
- setTimeout(()=>{
- uni.redirectTo({
- url:'/pages/index/index'
- })
- },1000)
- }
- }
- }
- // import { computed, watch, ref, reactive, unref } from "vue";
- // import sheep from "@/sheep";
- // import { mobile, password } from "@/sheep/validate/form";
- // import { showAuthModal, closeAuthModal } from "@/sheep/hooks/useModal";
- // import { Base64 } from "js-base64";
- // const accountLoginRef = ref(null);
- // const props = defineProps({
- // agreeStatus: {
- // type: Boolean,
- // default: false,
- // },
- // });
- // // 数据
- // const state = reactive({
- // model: {
- // mobile: "", // 账号
- // password: "", // 密码
- // },
- // rules: {
- // mobile,
- // password,
- // },
- // });
- // defineExpose({
- // accountLoginSubmit,
- // });
- </script>
- <style lang="scss" scoped>
- // @import "../index.scss";
- .input-line {
- display: flex;
- align-items: center;
- width: 100%;
- background-color: #f5f7fb;
- border-radius: 16rpx;
- padding-left: 30rpx;
- height: 88rpx;
- box-sizing: border-box;
- }
- </style>
|