提交信息
Some checks are pending
deploy / deploy (push) Waiting to run

This commit is contained in:
sjeam 2025-07-22 17:09:25 +08:00
parent 013373d61f
commit 3b1e06937d
9 changed files with 859 additions and 862 deletions

View File

@ -318,10 +318,10 @@ be imported.
```
此时升级微信开发者工具,或者安装`@babel/plugin-proposal-private-property-in-object`依赖即可解决问题。
### 捐赠
<!-- ### 捐赠
如果你觉得这个项目对你有帮助,你可以请作者喝饮料🍹
<p align='center'>
<img alt="微信收款码" src="./src/static/images/pay.png" height="330" style="display:inline-block; height:330px;">
</p>
</p> -->

View File

@ -2,21 +2,23 @@
*
*/
import type { CommonRes } from '@/api/common/types';
import type { LoginByCodeReq, LoginByCodeRes, LoginReq, LoginRes, ProfileReq, ProfileRes } from './types';
import type { LoginByCodeReq, LoginByCodeRes, LoginReq, LoginRes, ProfileRes } from './types';
import { get, post } from '@/utils/request';
/** 获取用户信息 */
export const profile = (params?: ProfileReq) => get<ProfileRes>('/user/profile', { params });
// export const profile = (params?: ProfileReq) => get<ProfileRes>('/user/profile', { params });
export const profile = (data: any) => get<ProfileRes>('/api/user', { data, custom: { toast: false } });
/** 登录 */
export const login = (data: LoginReq) => post<LoginRes>('/user/login', { data, custom: { auth: false } });
export const login = (data: LoginReq) => post<LoginRes>('/api/auth/login', { data, custom: { auth: false } });
// 账号登录
export const passwordLogin = (data: any) => post('/api/auth/login', { data, custom: { toast: false } });
/** 验证码登录 */
export const loginByCode = (data: LoginByCodeReq) => post<LoginByCodeRes>('/user/loginByCode', { data });
/** 退出登录 */
export const logout = () => post<CommonRes>('/user/logout');
export const logout = () => post<CommonRes>('/api/logout');
export const goodsMenu = () => get<CommonRes>('/api/config');
// export const goodsMenu = (data:any) => get<CommonRes>('/api/config', { data, custom: { toast: false } });

View File

@ -7,12 +7,16 @@ export interface ProfileRes {
user_name?: string;
avatar?: string;
token?: string;
user?: any;
}
export interface LoginReq {
phone: string;
code: string;
}
export interface LoginReqPassword {
account: string;
password: string;
}
export interface LoginRes {
token: string;

View File

@ -1,12 +1,15 @@
<style>
.ellipsis {
white-space: nowrap;
/* 防止文字换行 */
overflow: hidden;
/* 隐藏超出部分的文字 */
text-overflow: ellipsis;
/* 在末尾显示省略号 */
width: 420rpx;
/* 防止文字换行 */
overflow: hidden;
/* 隐藏超出部分的文字 */
text-overflow: ellipsis;
white-space: nowrap;
/* 确保元素有宽度 */
}
</style>
@ -17,7 +20,9 @@
leftIconColor="#303133" :safeAreaInsetTop="true" :placeholder="true" :fixed="true"></up-navbar>
<view class="address_box">
<view class=" pt-2 pb-2 ps-2 pe-2" style="">
<text class="ellipsis" style="margin: 0rpx 0rpx 0rpx 40rpx;text-align:left;display: inline-block;width: calc(100% - 100rpx);" >江阳区学校2016工作室放假咯解fafsf方法 <span>18181941463</span> </text>
<text class="ellipsis"
style="display: inline-block;width: calc(100% - 100rpx);margin: 0rpx 0rpx 0rpx 40rpx;text-align:left;">江阳区学校2016工作室放假咯解fafsf方法
<span>18181941463</span> </text>
</view>
<view class="flex box-border flex-row pb-2 ps-2 pe-2" style="" @click="getopenLocation">
<up-text class="" size="26rpx" :text="'四川省泸州市江阳区龙马大道海吉星农贸市场32号附一号2楼307号'" :flex1="true" align="left"
@ -27,14 +32,14 @@
<u-icon slot="right" name="arrow-right"></u-icon>
</view>
<view class="flex box-border flex-row pb-2 ps-2 pe-2" style="">
<up-text class="" size="26rpx" color="#59CB56"
:text="'配送时间 7月17日(周三) 19:00-21:00 送达'" :flex1="true" align="left" prefixIcon="clock" wordWrap="normal"
:show="true" iconStyle="font-size:32rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
<up-text class="" size="26rpx" color="#59CB56" :text="'配送时间 7月17日(周三) 19:00-21:00 送达'" :flex1="true"
align="left" prefixIcon="clock" wordWrap="normal" :show="true"
iconStyle="font-size:32rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<u-icon slot="right" name="arrow-right"></u-icon>
</view>
</view>
<z-paging ref="pagingRefSC" v-model="matchedItems_sc" @query="changeSC('')" style="bottom: 110rpx;top:300rpx"
<z-paging ref="pagingRefSC" v-model="matchedItems_sc" @query="changeSC('')" style="top:300rpx;bottom: 110rpx"
class="fv-page flex-col px-2">
<view v-for="(item, index) in matchedItems_sc" :key="index">
<u-cell>
@ -48,8 +53,9 @@
<view class="h-60 flex">
<text class=" ellipsis" style="font-size: 24rpx;font-weight: bold;">营养{{ item.name
}}</text>
<up-text style="margin-right: 10rpx;" class="text-black" size="24rpx" :text="item.num + item.unit_name" :flex1="true"
suffixIcon="" align="right" wordWrap="normal" :show="true" type="#59CB56"
<up-text style="margin-right: 10rpx;" class="text-black" size="24rpx"
:text="item.num + item.unit_name" :flex1="true" suffixIcon="" align="right"
wordWrap="normal" :show="true" type="#59CB56"
iconStyle="font-size: 36rpx;font-weight: bold;" decoration="none">
</up-text>
</view>
@ -76,234 +82,130 @@
</template>
<!-- 食谱清单 -->
<script setup lang="ts">
<script lang="ts">
import { CommonApi } from '@/api';
// const { openLocation } = useLocation();
import { useLocation } from '@/hooks';
import { defineComponent } from 'vue';
import { useShare,useLocation } from '@/hooks';
const { openLocation } = useLocation();
//
function getopenLocation(){
openLocation(32.05, 32.05);
}
import {
ref,
reactive,
} from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { func } from "@/uni_modules/uview-plus/libs/function/test";
//
onLoad((options) => {
// loadData();
});
onShow(() => { });
const goods_list = [
export default defineComponent({
data () {
return {
aloneChecked: false, //
checkboxValueNum: 0, //
checkboxValue: [],
propShow: false,
currentTab: 0, // tab
menu_list: [{ name: '食谱清单' }, { name: '食菜配置' }],
totalNum: 0,
keyword_sc: '',
goods_info: {},
menuIndex: 0,
matchedItems_sc: [],
goods_list_info:
{
total_num: 1,
info: [
{
id: 1,
name: "大份芒果芒果",
label: "描述信息",
image: " ",
name: '猪肉',
label: '青椒肉丝',
image: ' ',
disabled: true,
num: 100,
unit_name: "个",
default_num: 100,
num: 88,
unit_name: 'g',
default_num: 88,
},
{
id: 2,
name: "新鲜西瓜不甜不要钱,随便吃哦,华友很多方式JFK了就爱上基金大幅方法是飞机离开房间发士大夫十分恐惧撒发范德萨发生",
label: "描述信息,新鲜西瓜不甜不要钱,随便吃哦,华友很多方式JFK了就爱上基金大幅方法是飞机",
image: "https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png",
name: '毛豆',
label: '青椒肉丝',
image: 'https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png',
disabled: false,
num: 100,
unit_name: "个",
unit_name: 'ml',
default_num: 100,
},
{
id: 3,
name: "大份芒果芒果",
label: "描述信息",
image: "https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png",
name: '食用油',
label: '青椒肉丝',
image: 'https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png',
disabled: false,
num: 100,
unit_name: "个",
unit_name: 'g',
default_num: 100,
},
{
id: 4,
name: "新鲜西瓜不甜不要钱,随便吃哦",
label: "描述信息",
image: "https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png",
name: '豆瓣酱',
label: '青椒肉丝',
image: 'https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png',
disabled: false,
num: 100,
unit_name: "个",
unit_name: 'ml',
default_num: 100,
},
{
id: 5,
name: "大份芒果芒果",
label: "描述信息",
image: "https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png",
disabled: false,
num: 100,
unit_name: "个",
default_num: 100,
],
},
{
id: 6,
name: "新鲜西瓜不甜不要钱,随便吃哦",
label: "描述信息",
image: "https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png",
disabled: false,
num: 100,
unit_name: "个",
default_num: 100,
};
},
{
id: 7,
name: "大份芒果芒果",
label: "描述信息",
image: "https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png",
disabled: false,
num: 100,
unit_name: "个",
default_num: 100,
created () {
//
this.goodList();
},
{
id: 8,
name: "新鲜西瓜不甜不要钱,随便吃哦",
label: "描述信息",
image: "https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png",
disabled: false,
num: 100,
unit_name: "个",
default_num: 100,
},
{
id: 9,
name: "大份芒果芒果",
label: "描述信息",
image: "https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png",
disabled: false,
num: 100,
unit_name: "个",
default_num: 100,
},
{
id: 10,
name: "新鲜西瓜不甜不要钱,随便吃哦",
label: "描述信息",
image: "https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png",
disabled: false,
num: 100,
unit_name: "个",
default_num: 100,
},
];
// const menu_list =[{'name':'','icon':'photo'},{'name':'','icon':'photo'}]
const menu_list = [{ name: "食谱清单" }, { name: "食菜配置" }];
const listLoading = ref(false);
const dataPage = ref({
page: 0,
limit: 10,
total: 0,
methods: {
goodList () {
CommonApi.goodsMenu({ key: 123 }).catch((res) => {
if (res.status === 200) {
// this.goods_list_info = res.data;
console.log(res);
}
else {
uni.$u.toast(res.message);
}
});
//
const keyword_sp = ref("");
const keyword_sc = ref("");
//
const pagingRefSP = ref<InstanceType<typeof zPaging> | null>(null);
const pagingRefSC = ref<InstanceType<typeof zPaging> | null>(null);
function changeSC (e) {
// console.log(e);
},
changeSC () {
console.log('请求食谱数据');
try {
//
const regex = new RegExp(e, "i");
const regex = new RegExp(this.keyword_sc, 'i');
// goods_list 使 filter matchedItems_sp.value
matchedItems_sc.value = goods_list.filter((item) => regex.test(item.name));
} catch (error) {
console.error("匹配过程中发生错误:", error);
matchedItems_sc.value = []; // matchedItems
}
// console.log(matchedItems_sc.value);
pagingRefSC.value?.complete([]);
pagingRefSC.value?.complete(matchedItems_sc.value);
}
function changeSP (e) {
// console.log(e);
try {
//
const regex = new RegExp(e, "i");
// goods_list 使 filter matchedItems_sp.value
matchedItems_sp.value = goods_list.filter((item) => regex.test(item.name));
this.matchedItems_sc = this.goods_list_info.info.filter(item => regex.test(item.name));
// console.log(matchedItems_sp.value);
} catch (error) {
console.error("匹配过程中发生错误:", error);
matchedItems_sp.value = []; // matchedItems
}
pagingRefSP.value?.complete([]);
pagingRefSP.value?.complete(matchedItems_sp.value);
}
// checkbox
const checkboxValueNum = ref(0);
const checkboxValue = reactive([]);
const matchedItems_sp = reactive(goods_list);
const matchedItems_sc = reactive(goods_list);
const aloneChecked = ref(false);
function checkboxChange (e) {
checkboxValue.length = 0;
e.forEach((item) => {
if (!checkboxValue.includes(item)) {
checkboxValue.push(item);
}
});
console.log(checkboxValue);
checkboxValueNum.value = checkboxValue.length;
}
function handleAllCheckChange (e) {
checkboxValue.length = 0;
if (e) {
// matchedItems_sp id checkboxValue
matchedItems_sp.forEach((item) => {
if (!checkboxValue.includes(item.id)) {
checkboxValue.push(item.id);
}
});
}
console.log(e);
console.log(checkboxValue);
checkboxValueNum.value = checkboxValue.length;
}
// //
// const loadData = (refresh = false) => {
// listLoading.value = true;
// //
// listLoading.value = false;
// };
const currentTab1 = ref(0);
// tab
function changeTab (e) {
console.log(e);
catch (error) {
console.error('匹配过程中发生错误:', error);
this.matchedItems_sc = []; // matchedItems
}
this.$refs.pagingRefSC.complete();
this.$refs.pagingRefSC.complete(this.matchedItems_sc);
},
//
function handleClick (value) {
handleClick (value) {
console.log(value);
uni.navigateTo({
url: `/pages/common/goods/detail?id=${value.name}`
url: `/pages/common/goods/detail?id=${value.name}`,
});
}
},
//
function handleSubmit () {
// uni.navigateTo({
// url: `/pages/common/goods/order`
// });
console.log('提交订单');
handleSubmit () {
uni.navigateTo({
url: `/pages/common/goods/order`,
});
},
//
getopenLocation () {
openLocation(32.05, 32.05);
}
},
});
</script>

View File

@ -4,22 +4,32 @@
<view class="title">
欢迎登录
</view>
<input v-model="tel" class="u-border-bottom" type="number" placeholder="请输入手机号">
<view class="u-border-bottom my-40rpx flex">
<input v-model="code" class="flex-1" type="number" placeholder="请输入验证码">
<!-- <input v-model="account" class="u-border-bottom" type="number" placeholder="请输入手机号"> -->
<u--input v-model="account" placeholder="请输入手机号" type="number" />
<view v-if="loginType" class="u-border-bottom my-40rpx flex">
<!-- <input v-model="code" class="flex-1" type="number" placeholder="请输入验证码"> -->
<u--input v-model="code" placeholder="请输入验证码" type="number" />
<view>
<u-code ref="uCodeRef" @change="codeChange" />
<u-button :text="tips" type="success" size="mini" @click="getCode" />
</view>
</view>
<view v-if="!loginType" class="u-border-bottom my-40rpx flex">
<u--input v-model="password" placeholder="请输密码" type="password" />
<!-- <input v-model="password" class="flex-1" type="password" placeholder="请输密码"> -->
</view>
<button class="login-btn" :style="[inputStyle]" @tap="submit">
登录 <text class="i-mdi-login" />
</button>
<view class="alternative">
<view class="password">
<view v-if="loginType" class="password" @click="changLoginType(0)">
密码登录
</view>
<view v-if="!loginType" class="password" @click="changLoginType(1)">
验证码登录
</view>
<view class="issue flex items-center">
遇到问题 <text class="i-mdi-help" />
</view>
@ -52,20 +62,24 @@
<script setup lang="ts">
import type { CSSProperties } from 'vue';
import { HOME_PATH, isTabBarPath, LOGIN_PATH, removeQueryString } from '@/router';
import { setToken } from '@/utils/auth';
import { useUserStore } from '@/store';
import { setToken ,getToken , isLogin } from '@/utils/auth';
import uCode from 'uview-plus/components/u-code/u-code.vue';
// import { useUserStore } from '@/store';
// const userStore = useUserStore();
const tel = ref<string>('18502811111');
const userStore = useUserStore();
const loginType = ref(0);
const account = ref<string>('18181941463');
const code = ref<string>('1234');
const password = ref<string>('123456');
const tips = ref<string>();
const uCodeRef = ref<InstanceType<typeof uCode> | null>(null);
let redirect = HOME_PATH;
const inputStyle = computed<CSSProperties>(() => {
const style = {} as CSSProperties;
if (tel.value && code.value) {
if (account.value && code.value) {
style.color = '#fff';
style.backgroundColor = uni.$u.color.warning;
}
@ -76,6 +90,10 @@ function codeChange(text: string) {
tips.value = text;
}
function changLoginType(text: number) {
loginType.value = text;
}
function getCode() {
if (uCodeRef.value?.canGetCode) {
//
@ -94,26 +112,56 @@ function getCode() {
}
}
async function submit() {
if (!uni.$u.test.mobile(Number(tel.value))) {
if (!uni.$u.test.mobile(Number(account.value))) {
uni.$u.toast('请输入正确的手机号');
return;
}
if (loginType.value === 0) {
if (!password.value) {
uni.$u.toast('请输入密码');
return;
}
await userStore.passwordLogin({ account: account.value, password: password.value }).catch((res) => {
console.log(res);
if (res.status === 200) {
setToken(res.data.token);
uni.$u.toast('登录成功');
}
else {
uni.$u.toast(`登录失败,${res.message}`);
}
});
}
else {
if (!code.value) {
uni.$u.toast('请输入验证码');
return;
}
//
// const res = await userStore.login({ phone: tel.value, code: code.value }).catch(() => {
// uni.$u.toast('');
// });
// if (!res) return;
setToken('1234567890');
await userStore.login({ account: account.value, code: password.value }).catch(() => {
if (res.status === 200) {
setToken(res.data.token);
uni.$u.toast('登录成功');
}
else {
uni.$u.toast(`登录失败,${res.message}`);
}
});
}
if(isLogin()){
await userStore.info()
setTimeout(() => {
uni.$u.route({
type: isTabBarPath(redirect) ? 'switchTab' : 'redirectTo',
url: redirect,
});
}, 800);
}else{
uni.$u.toast('登录失败,请重新登录 ');
setToken('');
}
// setToken('1234567890');
}
onLoad((options: any) => {
@ -123,6 +171,13 @@ onLoad((options: any) => {
});
</script>
<style>
html,
body {
height: 0;
}
</style>
<style lang="scss" scoped>
.login-form-wrap {
@apply mt-80rpx mx-auto mb-0 w-600rpx;

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,15 @@
<style>
.detail_box {
border: 1rpx solid #dfdfdf;
border-radius: 20rpx;
margin: 20rpx;
background-color: #ffffff;
}
html, body {
height: 0px;
}
</style>
<template>
<view class="page-wrap p-2">
<view class="flex detail_box p-4 bg-white">
<view class="detail-box flex bg-white p-4">
<view class="mr-10rpx">
<u-avatar src="/static/images/logo.png" size="70" />
<u-avatar :src="userStore.user.avatar " size="70" />
</view>
<view class="flex-1">
<view class="pb-20rpx font-size-36rpx">
uni-app
{{ userStore.user.nickname }}
</view>
<view class="u-tips-color font-size-28rpx" @click="toCopy">
微信号:uni-app
{{ userStore.user.phone }}
</view>
</view>
<view class="ml-10rpx p-10rpx">
@ -31,42 +20,80 @@ html, body {
</view>
</view>
<view class="detail_box bg-white">
<u-cell icon="" title="昵称" is-link rightIcon="lock" value="小花猫" :border="false" size="large"
customStyle="padding:20rpx;font-size:28rpx" />
<view class="detail-box bg-white">
<u-cell
icon="" title="昵称" is-link right-icon="lock" :value="userStore.user.nickname" :border="false" size="large"
custom-style="padding:20rpx;font-size:28rpx"
/>
<u-cell icon="" title="ID" is-link rightIcon="lock" value="26" :border="false" size="large"
customStyle="padding:20rpx;font-size:28rpx" />
<u-cell
icon="" title="ID" is-link right-icon="lock" :value="userStore.user.uid" :border="false" size="large"
custom-style="padding:20rpx;font-size:28rpx"
/>
<u-cell icon="" title="手机号" is-link rightIcon="lock" value="18181941463" :border="false" size="large"
customStyle="padding:20rpx;font-size:28rpx" />
<u-cell
icon="" title="手机号" is-link right-icon="lock" :value="userStore.user.phone" :border="false" size="large"
custom-style="padding:20rpx;font-size:28rpx"
/>
<u-cell icon="order" title="订单详情" is-link value="" :border="false" size="large"
customStyle="padding:20rpx;font-size:28rpx" />
<u-cell
icon="order" title="订单详情" is-link value="" :border="false" size="large"
custom-style="padding:20rpx;font-size:28rpx"
/>
</view>
<view class="p-2 bg-white">
<u-button class="p-2" size="large" text="退出登录" type="primary" color="#59CB56" shape="circle"
custom-style="width:100%;" @click="loginOut">
</u-button>
<view class="bg-white p-2">
<u-button
class="p-2" size="large" text="退出登录" type="primary" color="#59CB56" shape="circle"
custom-style="width:100%;" @click="loginOut"
/>
</view>
</view>
</template>
<script setup lang="ts">
import { HOME_PATH, isTabBarPath, LOGIN_PATH, removeQueryString } from '@/router';
import { useClipboard, usePermission } from '@/hooks';
import { useClipboard, useModal, usePermission } from '@/hooks';
import { HOME_PATH, isTabBarPath } from '@/router';
import { useUserStore } from '@/store';
import { setToken } from '@/utils/auth';
// import { useUserStore } from '@/store';
// const userStore = useUserStore();
let redirect = HOME_PATH;
async function loginOut() {
const { showModal } = useModal();
const { setClipboardData, getClipboardData } = useClipboard();
const userStore = useUserStore();
const redirect = HOME_PATH;
console.log('userStore', userStore);
console.log('userStore', userStore.user_name);
// import { CommonApi, UserApi } from "@/api";
// profile
//
const toCopy = async () => {
await setClipboardData({ data: '1234567890' });
const data = await getClipboardData();
console.log('[ data ] >', data);
};
function loginOut() {
showModal('success', {
title: '提示',
content: '确定退出登录?',
showCancel: true,
confirmText: '确定',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
// 退
// const res = await userStore.logout().catch(() => {
// uni.$u.toast('退');
// });
// if (!res) return;
loginOuts();
}
},
});
}
// userStore.info()
async function loginOuts() {
// 退
await userStore.logout().catch(() => {
setToken('');
setTimeout(() => {
uni.$u.route({
@ -74,6 +101,7 @@ async function loginOut() {
url: redirect,
});
}, 800);
});
}
// tabbaruni.switchTabonShow
onShow(async () => {
@ -81,3 +109,17 @@ onShow(async () => {
console.log(hasPermission ? '已登录' : '未登录,拦截跳转');
});
</script>
<style scoped>
.detail-box {
margin: 20rpx;
background-color: #fff;
border: 1rpx solid #dfdfdf;
border-radius: 20rpx;
}
html,
body {
height: 0;
}
</style>

View File

@ -1,4 +1,4 @@
import type { LoginReq } from '@/api/user/types';
import type { LoginReq, LoginReqPassword } from '@/api/user/types';
import type { providerType, UserState } from './types';
import { UserApi } from '@/api';
import { clearToken, setToken } from '@/utils/auth';
@ -9,8 +9,9 @@ const useUserStore = defineStore('user', {
state: (): UserState => ({
user_id: '0',
user_name: '游客登录',
avatar: '',
avatar: 'https://test.shop.lihaink.cn/static/f.png',
token: '',
user: {},
}),
getters: {
userInfo(state: UserState): UserState {
@ -27,9 +28,12 @@ const useUserStore = defineStore('user', {
this.$reset();
},
// 获取用户信息
async info() {
const result = await UserApi.profile();
this.setInfo(result);
info() {
UserApi.profile().catch((res) => {
console.log('登录信息',res.data);
// reject(error);
this.setInfo({ user: res.data });
});
},
// 异步登录并存储token
login(loginForm: LoginReq) {
@ -45,6 +49,20 @@ const useUserStore = defineStore('user', {
});
});
},
passwordLogin(loginForm: LoginReqPassword) {
return new Promise((resolve, reject) => {
UserApi.passwordLogin(loginForm).then((res) => {
const token = res.token;
if (token) {
setToken(token);
}
resolve(res);
}).catch((error) => {
reject(error);
});
});
},
// Logout
async logout() {
await UserApi.logout();

View File

@ -4,6 +4,7 @@ export interface UserState {
user_name?: string;
avatar?: string;
token?: string;
user?: any;
}
export type providerType =