46 lines
1.0 KiB
Vue
46 lines
1.0 KiB
Vue
<template>
|
|
<view class="" style="padding: 100rpx;">
|
|
<up-input :customStyle="{height: '100%'}" v-model="zh" placeholderClass="place" placeholder="请输入手机号" />
|
|
<up-button @click="submit" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"
|
|
size="28"></up-icon>账号登录</up-button>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {
|
|
userLoginApi,
|
|
userInfoApi
|
|
} from "@/api/user.js";
|
|
import {
|
|
ref
|
|
} from "vue"
|
|
import useUserStore from "@/store/user";
|
|
const userStore = useUserStore();
|
|
const zh = ref("")
|
|
|
|
const submit = () => {
|
|
userLoginApi({
|
|
account: zh.value,
|
|
"password": "123456",
|
|
"terminal": 2,
|
|
"scene": 1
|
|
}).then(res => {
|
|
uni.setStorageSync('token', res.data.token);
|
|
userStore.setToken(res.data.token);
|
|
console.log(res.data.token)
|
|
userInfoApi().then(res => {
|
|
const user = res.data;
|
|
userStore.setUserInfo(user);
|
|
uni.reLaunch({
|
|
url: '/pages/index/index'
|
|
}) // 存储token到本地存储中
|
|
})
|
|
})
|
|
|
|
|
|
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style> |