Merge pull request 'xbx' (#25) from xbx into master

Reviewed-on: http://git.luyuan.tk/luyuan/beelink/pulls/25
This commit is contained in:
luyuan 2020-10-09 14:31:43 +08:00
commit 0a06e29fca
5 changed files with 33 additions and 6 deletions

View File

@ -7,10 +7,14 @@ import { AxiosPromise } from 'axios'
* @param type 0 1
*/
export function sendsms(phone: string, type?: number): Promise<AxiosPromise>{
export function sendsms(phone: string, type?: number): Promise<AxiosPromise>{
return post('SendSms',{phone, type})
}
export function loginpass(phone: string, password: string): Promise<AxiosPromise>{
return post("login",{type: 2,username: phone, password: password})
}
// 下面是示例接口 可以删除

View File

@ -1,5 +1,5 @@
import axios from 'axios'
axios.defaults.baseURL = 'http://beelink.com/home/';
axios.defaults.baseURL = '/beelink/public/home/';
axios.defaults.headers.common['Authorization'] = 'token';
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

4
src/import-png.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
declare module "*.png" {
const value: any;
export default value;
}

View File

@ -48,6 +48,7 @@
<a-input
style="width: 80%"
placeholder="请输入您的邮箱或者手机号"
v-model:value="userinfo.phone"
/>
</a-input-group>
</a-form-item>
@ -58,11 +59,12 @@
placeholder="请输入您的密码"
type="password"
class="shuru"
v-model:value="userinfo.password"
/>
<div class="forget">忘记密码?</div>
</a-input-group>
</a-form-item>
<div class="submit">立即登录</div>
<div class="submit" @click="login">立即登录</div>
</a-form>
</div>
</div>
@ -144,10 +146,10 @@
</template>
<script lang="ts">
import { defineComponent, ref } from "vue";
import { defineComponent, reactive, ref } from "vue";
import LoginTab from "@/components/login/LoginTab.vue";
import NavTop from "@/components/NavTop.vue"
import { sendsms } from '@/api';
import { loginpass, sendsms } from '@/api';
export default defineComponent({
name: "Login",
@ -163,6 +165,10 @@ export default defineComponent({
const tabselected = ref(1); //tab
const time = ref(60);//
const phone = ref(""); //
const userinfo = reactive({
phone: '',
password: ''
})
/**
* @param val 子组件传过来的值
*/
@ -192,13 +198,22 @@ export default defineComponent({
}
}, 1000);
};
function login(): void {
console.log(userinfo.phone,userinfo.password)
loginpass(userinfo.phone,userinfo.password).then((res)=>{
console.log(res)
})
}
return {
formLayout,
tabselected,
Selectnum,
getcode,
time,
phone
phone,
login,
userinfo
};
},
});

View File

@ -17,6 +17,10 @@ module.exports = {
// 为生产环境修改配置...
} else {
// 为开发环境修改配置...
config.devServer = {
proxy: 'http://case.sy-my.net'
}
}
}
}