123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <template>
- <div class="d1" >
- <img class="logo" src="../../../public/loginbg/logo.png"/>
- </div>
-
- <van-form style="margintop:20px ;">
- <van-cell-group>
- <van-field v-if="type==1"
- v-model="userName"
- label="用户名"
- placeholder="用户名"
- :rules="[{ required: true, message: '请填写用户名' }]"
- />
- <van-field v-if="type==1"
- v-model="userPwd"
- type="password"
- label="密码"
- placeholder="密码"
- :rules="[{ required: true, message: '请填写密码' }]"
- />
- <van-field v-if="type==2"
- v-model="phone"
- label="手机号码"
- placeholder="手机号码"
- :rules="[{ required: true, message: '请填写手机号码' }]"
- />
- <van-field v-if="type==2"
- v-model="sms"
- center
- clearable
- label="短信验证码"
- placeholder="请输入短信验证码"
- >
- <template #button>
- <van-button size="small" type="primary">发送验证码</van-button>
- </template>
- </van-field>
- </van-cell-group>
- <div class="changetype" @click="changetbt"> {{changet}} </div>
- <div style="margin: 16px;">
- <van-button round block type="primary" native-type="submit" @click="save" >
- 登录
- </van-button>
- </div>
- </van-form>
- </template>
- <script>
- import { useStore } from 'vuex';
- export default {
-
- data () {
- return {
- userName:"",
- userPwd:"",
- phone:"",
- sms:"",
- onSubmit:"",
- type:1,
- changet: '用户名密码登录',
- t1:'用户名',
- t2:'密码',
-
- }
- },
- methods: {
- save(){
-
- const inputForm ={
- 'username': this.userName,
- 'password': this.userPwd,
- 'code': '',
- 'uuid': ''
- }
- //store.commit('setUser',"asdsdasd");
- // login(inputForm).then(({data}) => {
- // this.$store.commit('setUser',data);
- // })
- // login(inputForm).then(res => {
- // this.$store.commit('setUser',res.data);
- // })
- this.$router.push({name:'tabAll',query: {id:'123456'}})
- },
- changetbt(){
- if(this.type==1){
- this.type=2;
- this.changet='手机验证码登录';
- this.t1="手机号码";
- }else{
- this.type=1;
- this.changet='用户名密码登录';
- this.t1="用户名";
- }
- },
- }
- };
- </script>
- <style>
- </style>
|