|
|
@@ -0,0 +1,85 @@
|
|
|
+<template>
|
|
|
+ <view class="app-content">
|
|
|
+ <view>
|
|
|
+ <form @submit="formSubmit">
|
|
|
+ <view class="module-com input-line-wrap">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title" style="width:120upx;">账号</view>
|
|
|
+
|
|
|
+ <input type="number" v-model="form.mobile" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" name="mobile" placeholder="请填写账号" />
|
|
|
+
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title" style="width:120upx;">密码</view>
|
|
|
+
|
|
|
+ <input type="password" v-model="form.password" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" name="password" placeholder="请填写密码" />
|
|
|
+
|
|
|
+ </tui-list-cell>
|
|
|
+ <view class="btn-wrap">
|
|
|
+ <button class="admin-button-com blue big" style="border:none;" formType="submit">登录</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </form>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import TuiListCell from "@/components/plugin/list-cell"
|
|
|
+const form = require("@/utils/formValidation.js")
|
|
|
+import { accountLogin } from "@/api/user"
|
|
|
+import store from '@/store'
|
|
|
+export default {
|
|
|
+ name: "account",
|
|
|
+ components: {
|
|
|
+ TuiListCell
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ form: {
|
|
|
+ mobile:"",
|
|
|
+ password:""
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init(){
|
|
|
+
|
|
|
+ },
|
|
|
+ confirmFn() {
|
|
|
+ let that = this
|
|
|
+ accountLogin({...this.form}).then(res => {
|
|
|
+ if(res.code == 1){
|
|
|
+ uni.setStorageSync('token', res.data.token)
|
|
|
+ if(res.data.user && !that.$util.isEmpty(res.data.user)){
|
|
|
+ store.commit('setLoginInfo', res.data.user)
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ formSubmit(e) {
|
|
|
+ let rules = [
|
|
|
+ {
|
|
|
+ name: "mobile",
|
|
|
+ rule: ["required"],
|
|
|
+ msg: ["请填写账号"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "password",
|
|
|
+ rule: ["required"],
|
|
|
+ msg: ["请填写密码"]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ let formData = this.form;
|
|
|
+ let checkRes = form.validation(formData, rules);
|
|
|
+ if (!checkRes) {
|
|
|
+ this.confirmFn();
|
|
|
+ } else {
|
|
|
+ this.$msg(checkRes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+</style>
|