feat: 新增我的页面

This commit is contained in:
eric
2023-12-02 15:28:57 +08:00
parent 79970d9371
commit 3d6d6901b8
6 changed files with 198 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
export default {
pages: [
'pages/index/index'
'pages/index/index',
'pages/my/index'
],
window: {
backgroundTextStyle: 'light',

View File

@@ -1,21 +1,124 @@
import { Component } from 'react'
import { View, Text } from '@tarojs/components'
import './index.scss'
import { Component } from "react";
import Taro from '@tarojs/taro'
import { View, Text, Image} from "@tarojs/components";
import "./index.scss";
import { AtTabBar } from "taro-ui";
import React, { useCallback, useEffect, useState } from "react";
import { AtGrid } from "taro-ui";
import { Swiper, SwiperItem } from "@tarojs/components";
import { AtCard } from "taro-ui";
import { AtImagePicker } from "taro-ui";
export default class Index extends Component {
componentDidMount () { }
// export default class Index extends Component {
const Index = () => {
const [current, setcurrent] = useState(0);
const handleClick = (value) => {
console.log("value", value);
setcurrent(value);
if (value == 2) {
// 跳转到目的页面,在当前页面打开
Taro.redirectTo({
url: "/pages/my/index",
});
}
//
};
return (
<View className="index">
{/* <Text>Hello world!</Text> */}
componentWillUnmount () { }
<Swiper
className="indexSwiper"
indicatorColor="#999"
indicatorActiveColor="#333"
// vertical
circular
indicatorDots
autoplay
>
<SwiperItem>
<View className="demo-text">
{" "}
<Image
// style="width: 300px;height: 100px;background: #fff;"
src={
"https://7084298024874.huodongxing.com/file/ue/20211008/115427740E13BBD5BD7B56940467DC03B4/30435083489707317.jpeg"
}
/>
</View>
</SwiperItem>
<SwiperItem>
<View className="demo-text">
{" "}
<Image
// style="width: 300px;height: 100px;background: #fff;"
src={
"https://7084298024874.huodongxing.com/file/ue/20211008/115427740E13BBD5BD7B56940467DC03B4/30435083489707317.jpeg"
}
/>
</View>
</SwiperItem>
<SwiperItem>
<View className="demo-text">
{" "}
<Image
// style="width: 300px;height: 100px;background: #fff;"
src={
"https://7084298024874.huodongxing.com/file/ue/20211008/115427740E13BBD5BD7B56940467DC03B4/30435083489707317.jpeg"
}
/>
</View>
</SwiperItem>
</Swiper>
componentDidShow () { }
<AtGrid
data={[
{
image:
"https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png",
value: "打卡",
},
{
image:
"https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png",
value: "活动",
},
{
image:
"https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png",
value: "视频",
},
]}
/>
componentDidHide () { }
<AtCard
note="星期三 2023-12-06"
extra=""
title="这是个[副业交流] 沙龙茶话会标题"
thumb="http://www.logoquan.com/upload/list/20180421/logoquan15259400209.PNG"
>
{/* 这也是内容区 可以随意定义功能 */}
<Image
style="width: 300px;height: 100px;background: #fff;"
src={
"https://7084298024874.huodongxing.com/file/ue/20211008/115427740E13BBD5BD7B56940467DC03B4/30435083489707317.jpeg"
}
/>
</AtCard>
render () {
return (
<View className='index'>
<Text>Hello world!</Text>
<View className="indexTablebar">
<AtTabBar
tabList={[
{ title: "首页", text: "" },
{ title: "活动" },
{ title: "我的" },
]}
onClick={(value) => handleClick(value)}
current={current}
/>
</View>
)
}
}
</View>
);
};
export default Index;

View File

@@ -0,0 +1,29 @@
.index {
display: flex;
flex-direction: column;
// align-items: center;
justify-content: center;
.indexSwiper {
// margin-top: 20px;
// padding: 20px;
.demo-text {
// display: flex;
// flex-direction: column;
// align-items: center;
// justify-content: center;
background-color: yellow;
height: 300px;
width: 100%;
// Image{
// width: 90%;
// }
}
}
.indexTablebar {
position: fixed;
bottom: 0;
width: 100%;
}
}

49
src/pages/my/index.jsx Normal file
View File

@@ -0,0 +1,49 @@
import { Component } from "react";
import { View, Text, Image } from "@tarojs/components";
import "./index.scss";
import { AtTabBar } from "taro-ui";
import React, { useCallback, useEffect, useState } from "react";
import { AtGrid } from "taro-ui";
import { Swiper, SwiperItem } from "@tarojs/components";
import { AtCard } from "taro-ui";
import { AtImagePicker } from "taro-ui";
import Taro from '@tarojs/taro'
// export default class Index extends Component {
const Index = () => {
const [current, setcurrent] = useState(2);
const handleClick = (value) => {
console.log('value',value)
setcurrent(value)
if (value == 2) {
// 跳转到目的页面,在当前页面打开
Taro.redirectTo({
url: "/pages/my/index",
});
}else if(value == 0){
Taro.redirectTo({
url: "/pages/index/index",
});
}
};
return (
<View className="index">
{/* <Text>Hello world!</Text> */}
my
<View className="indexTablebar">
<AtTabBar
tabList={[
{ title: "首页", text: "" },
{ title: "活动" },
{ title: "我的" },
]}
onClick={(value) => handleClick(value)}
current={current}
/>
</View>
</View>
);
};
export default Index;

0
src/pages/my/index.scss Normal file
View File