Commit e4059fb2 by 姜雷

添加首页

parent 60c084a4
...@@ -48,7 +48,7 @@ const createFetch = (basePath: string) => { ...@@ -48,7 +48,7 @@ const createFetch = (basePath: string) => {
} }
if (data.code === LogoutCode) { if (data.code === LogoutCode) {
Taro.reLaunch({ Taro.reLaunch({
url: "/pages/Login/Login" url: "/pages/FakeHome/FakeHome"
}); });
throw data; throw data;
} }
......
...@@ -46,6 +46,7 @@ class App extends Component { ...@@ -46,6 +46,7 @@ class App extends Component {
'pages/WashingMachine/AppointmentPay', 'pages/WashingMachine/AppointmentPay',
'pages/stringPay/stringPay', 'pages/stringPay/stringPay',
'pages/AppPay/AppPay', 'pages/AppPay/AppPay',
'pages/FakeHome/FakeHome',
], ],
window: { window: {
backgroundTextStyle: 'light', backgroundTextStyle: 'light',
......
.FakeHome {
.Home-UserBox {
position: relative;
height: 320px;
padding: 0 32px;
// margin: 0 32px;
box-sizing: content-box;
background-color: #eee;
.Home-UserBox-content {
position: relative;
width: 100%;
height: 100%;
z-index: 0;
overflow: hidden;
.bg {
height: 390px;
}
.Home-UserBox-Setting {
position: absolute;
right: 28px;
top: 22px;
width: 38px;
height: 38px;
}
.Home-UserBox-info {
padding: 80px 88px 20px 76px;
display: flex;
justify-content: space-between;
color: #333;
}
.Home-UserBox-name {
font-size: 44px;
margin-bottom: 8px;
}
.Home-UserBox-tel {
font-size: 32px;
margin-bottom: 8px;
}
.Home-UserBox-addr {
font-size: 24px;
}
.Home-UserBox-headimg {
width: 100px;
height: 100px;
border-radius: 50%;
border: 10px solid #c8ccfc;
}
.Home-UserBox-line {
width: 620px;
border-top: 1px solid #d7daff;
margin: 0 auto;
}
}
.Home-UserBox-Order {
position: absolute;
left: 50%;
bottom: -40px;
transform: translate(-50%);
width: 572px;
height: 80px;
line-height: 80px;
background-color: #6180f4;
border-radius: 50px;
display: flex;
overflow: hidden;
.Home-UserBox-Order-text {
position: relative;
flex: 1;
text-align: center;
color: #fff;
font-size: 24px;
&:first-child::after {
content: " ";
position: absolute;
height: 44px;
width: 1px;
background-color: #abbcf9;
right: 0;
top: 18px;
}
}
}
}
.Home-Service {
padding-top: 40px;
.Home-Service-List {
display: flex;
flex-flow: wrap;
justify-content: space-between;
.Home-Service-List {
margin-top: 20px;
}
&.normal,
&.block {
padding: 0 32px;
margin: 20px auto;
}
&.big {
width: 686px;
margin: 20px auto 0;
}
}
}
}
import "./FakeHome.scss";
import Taro from "@tarojs/taro";
import { View, Image, Text } from "@tarojs/components";
import SettingIcon from "../../images/home/icon_shezhi@2x.png";
import UserBoxBg from "../../images/home/img_bg@2x.png";
import UserHeaderF from "../../images/home/img_girl_touxiang@2x.png";
import MenuIconNormal from "@/components/MenuIcon/normal/MenuIconNormal";
import WaterIconNormal from "../../images/menu/ic_zizhu@2x.png";
import DryerIconNormal from "../../images/menu/ic_chuifeng@2x.png";
import DispenserIconNormal from "../../images/menu/ic_bigua@2x.png";
import WasherIconNormal from "../../images/menu/ic_xiyi@2x.png";
function FakeHome() {
const goLoginPage = () => {
Taro.showModal({
title: "提示",
content: "请登录后使用"
})
.then(res => {
if (res.confirm) {
Taro.navigateTo({
url: "/pages/Login/Login"
});
}
})
.catch(err => {
console.log(err);
});
};
return (
<View className="FakeHome">
<View className="Home-UserBox">
<View className="Home-UserBox-content">
<Image
className="Home-UserBox-Setting"
src={SettingIcon}
onClick={goLoginPage}
/>
<Image className="bg" src={UserBoxBg} />
<View className="Home-UserBox-info">
<View className="Home-UserBox-other">
<View className="Home-UserBox-name">用户</View>
{/* <View className="Home-UserBox-tel">
{userinfo.customerPhone &&
this.formatePhone(userinfo.customerPhone)}
</View> */}
<View className="Home-UserBox-addr">校区名称</View>
</View>
<Image
className="Home-UserBox-headimg"
src={UserHeaderF}
onClick={goLoginPage}
/>
</View>
</View>
<View className="Home-UserBox-Order">
<Text className="Home-UserBox-Order-text" onClick={goLoginPage}>
我的订单
</Text>
<Text className="Home-UserBox-Order-text" onClick={goLoginPage}>
账户
</Text>
</View>
</View>
<View className="Home-Service">
<View className="Home-Service-List normal">
<MenuIconNormal
key="1"
icon={WaterIconNormal}
text="饮水"
onClick={goLoginPage}
/>
<MenuIconNormal
key="1"
icon={DryerIconNormal}
text="吹风"
onClick={goLoginPage}
/>
<MenuIconNormal
key="1"
icon={DispenserIconNormal}
text="壁挂机"
onClick={goLoginPage}
/>
<MenuIconNormal
key="1"
icon={WasherIconNormal}
text="洗衣"
onClick={goLoginPage}
/>
</View>
</View>
</View>
);
}
export default FakeHome;
import { ComponentClass } from 'react'; import { ComponentClass } from "react";
import Taro, { Component, Config } from '@tarojs/taro'; import Taro, { Component, Config } from "@tarojs/taro";
import { View } from '@tarojs/components'; import { View } from "@tarojs/components";
import './index.scss'; import "./index.scss";
import { connect } from '@tarojs/redux'; import { connect } from "@tarojs/redux";
import { updateUserInfo, UserState } from '../../store/rootReducers/userinfo'; import { updateUserInfo, UserState } from "../../store/rootReducers/userinfo";
import { appLogin } from '../../api/customer'; import { appLogin } from "../../api/customer";
import { shareHandle } from '@/common/shareMethod'; import { shareHandle } from "@/common/shareMethod";
import useSystemInfo from '@/hooks/useSystemInfo'; import useSystemInfo from "@/hooks/useSystemInfo";
type PageDispatchProps = { type PageDispatchProps = {
updateUserInfo: (e: UserState | { token: string }) => void; updateUserInfo: (e: UserState | { token: string }) => void;
...@@ -32,8 +32,8 @@ interface Index { ...@@ -32,8 +32,8 @@ interface Index {
dispatch => ({ dispatch => ({
updateUserInfo(entity: UserState) { updateUserInfo(entity: UserState) {
dispatch(updateUserInfo(entity)); dispatch(updateUserInfo(entity));
}, }
}), })
) )
class Index extends Component { class Index extends Component {
config: Config = {}; config: Config = {};
...@@ -41,7 +41,7 @@ class Index extends Component { ...@@ -41,7 +41,7 @@ class Index extends Component {
constructor(props: IProps) { constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {
errorText: '', errorText: ""
}; };
} }
onShareAppMessage = shareHandle; onShareAppMessage = shareHandle;
...@@ -53,11 +53,11 @@ class Index extends Component { ...@@ -53,11 +53,11 @@ class Index extends Component {
checkUser() { checkUser() {
Taro.getStorage({ Taro.getStorage({
key: 'token', key: "token"
}) })
.then(res => { .then(res => {
const data = res.data; const data = res.data;
console.log('token ' + data); console.log("token " + data);
}) })
.catch(() => { .catch(() => {
this.loginHandle(); this.loginHandle();
...@@ -71,16 +71,16 @@ class Index extends Component { ...@@ -71,16 +71,16 @@ class Index extends Component {
console.log(res); console.log(res);
const code = res.code; const code = res.code;
updateUserInfo({ updateUserInfo({
code, code
}); });
appLogin({ appLogin({
code: res.code, code: res.code
}) })
.then(res => { .then(res => {
const data = res.data; const data = res.data;
updateUserInfo(data); updateUserInfo(data);
Taro.redirectTo({ Taro.redirectTo({
url: '/pages/Home/Home', url: "/pages/Home/Home"
// url: '/pages/WashingMachine/WashingMachine', // url: '/pages/WashingMachine/WashingMachine',
}); });
}) })
...@@ -88,7 +88,7 @@ class Index extends Component { ...@@ -88,7 +88,7 @@ class Index extends Component {
console.log(err); console.log(err);
Taro.hideLoading(); Taro.hideLoading();
Taro.redirectTo({ Taro.redirectTo({
url: '/pages/Login/Login', url: "/pages/FakeHome/FakeHome"
}); });
}); });
}) })
...@@ -100,7 +100,7 @@ class Index extends Component { ...@@ -100,7 +100,7 @@ class Index extends Component {
render() { render() {
const { errorText } = this.state; const { errorText } = this.state;
useSystemInfo(); useSystemInfo();
return <View className='Index'>{errorText}</View>; return <View className="Index">{errorText}</View>;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment