提交 078bd476 编写于 作者: D dexiaoly
......@@ -2,10 +2,15 @@
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
"version": "0.0",
"configurations": [{
"type": "uniCloud",
"default": {
"launchtype": "local"
}
}
"default" :
{
"launchtype" : "local"
},
"h5" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}
<template>
<view>
<form @submit="formSubmit" >
<view class="uni-form-item uni-column">
<view class="title">用户名</view>
<input class="uni-input" name="username" placeholder="这是一个输入框" />
</view>
<view class="uni-form-item uni-column">
<view class="title">密码</view>
<input class="uni-input" name="password" placeholder="这是一个输入框" />
</view>
<view class="uni-btn-v">
<button form-type="submit">登陆</button>
</view>
</form>
</view>
</template>
<script>
export default {
data() {
return {
};
},
methods:{
formSubmit: function(e) {
var formdata = e.detail.value
console.log(formdata.username)
uni.request({
url: 'http://127.0.0.1:8000/login/',
method:'POST',
data: {
username: formdata.username,
pwd: formdata.password,
},
success: (res) => {
console.log(res.data);
if(res.data.code == 1){
uni.showToast({
icon:'error',
title: res.data.msg,
duration: 2000
});
}
else{
uni.setStorage({
key: 'token',
data: res.data.data.token
});
uni.navigateTo({
url: '../vip_index/index'
});
}
},
fail(e) {
uni.showToast({
title: '服务器出错,请联系管理员!',
duration: 2000
});
}
});
},
}
}
</script>
<style lang="scss">
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册