blak-kong 2 years ago
parent fb085d4bb9
commit 402c519c3c

@ -0,0 +1,22 @@
.FadeOutFrame {
opacity: 1;
}
.FadeOutFrame.fadeout {
-webkit-transition: all 1.5s;
-moz-transition: all 1.5s;
-ms-transition: all 1.5s;
-o-transition: all 1.5s;
transition: all 1.5s;
opacity: 0;
}
.FadeInFrame {
opacity: 0;
}
.FadeInFrame.fadein {
-webkit-transition: all 1.5s;
-moz-transition: all 1.5s;
-ms-transition: all 1.5s;
-o-transition: all 1.5s;
transition: all 1.5s;
opacity: 1;
}

@ -0,0 +1,6 @@
.site-popup-content-box {
margin: 0;
}
.van-popup {
background-color: transparent;
}

@ -16,6 +16,7 @@ import { Popup } from "@antmjs/vantui";
import "./popup.less";
import "./popup-site-swiper.less";
import "./fade.css";
import { go } from "../../utils/traoAPI";
@ -34,6 +35,9 @@ export default class PopupSiteSwiper extends Component<any, any> {
super(props);
this.state = {
name: "确认组件",
current: 0,
toRight: false,
isClick: false,
};
}
@ -46,7 +50,13 @@ export default class PopupSiteSwiper extends Component<any, any> {
componentDidHide() {}
async initData() {}
initData = () => {
console.log("this.props.siteData", this.props.siteData);
if (this.props.siteData) {
let arr = JSON.parse(JSON.stringify(this.props.siteData));
this.setState({ siteList: arr });
}
};
onClose = () => {
this.props.close();
@ -72,16 +82,45 @@ export default class PopupSiteSwiper extends Component<any, any> {
e.stopPropagation();
};
onChange(event) {
const current = event.detail.current;
const { current: curCurrent } = this.state;
const { siteData } = this.props;
if (curCurrent + 2 === siteData.length && current + 1 === siteData.length) {
this.setState({ toRight: true });
}
this.setState({ current });
}
onClickSwiperItem() {
const { current } = this.state;
const { siteData } = this.props;
if (current < siteData.length - 1) {
this.setState({
current: current + 1,
isClick: true,
});
} else {
// this.toHomePage();
}
}
onFinish(event) {
const { current } = event.detail;
const { toRight, isClick } = this.state;
const { siteData } = this.props;
if (current === siteData.length - 1) {
if (toRight || isClick) {
this.setState({ toRight: false, isClick: false });
} else {
// this.toHomePage();
}
}
}
render() {
let {
title,
content,
confirmButtonText,
textAlgin,
isShow,
isLarge,
// type,
} = this.props;
let { confirmButtonText, isShow, siteData } = this.props;
let { current } = this.state;
console.log("siteData", siteData);
return (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
@ -96,70 +135,51 @@ export default class PopupSiteSwiper extends Component<any, any> {
className="at-icon at-icon-close common-close"
onClick={this.onClose}
></View>
<View
className={classnames("common-box", {
large: isLarge,
})}
>
{/* <View className="common-popup-title">{title}</View>
<View className="common-popup-content-box">
<View
className={classnames("common-popup-content", {
"text-left": textAlgin === "left",
"text-right": textAlgin === "right",
"text-center": textAlgin === "center",
})}
<View className={classnames("common-box")}>
<View className="site-popup-content-box">
<Swiper
className="absolutely"
style="width: 600rpx;height: 800rpx"
current={current}
onChange={this.onChange.bind(this)}
onAnimationFinish={this.onFinish.bind(this)}
duration={800}
indicatorDots={true}
indicatorColor="#999"
indicatorActiveColor="#333"
>
{content}
</View>
</View> */}
{/* <Swiper
className="absolutely"
current={current}
onChange={this.onChange.bind(this)}
onAnimationFinish={this.onFinish.bind(this)}
duration={800}
indicatorDots={true}
indicatorColor="#999"
indicatorActiveColor="#333"
>
{welcomeList.map((item, index) => {
return (
<SwiperItem
className="absolutely"
onClick={this.onClickSwiperItem.bind(this)}
key={"swiper_" + index}
>
<View
className="body FadeInFrame fadein"
style={{
top: menu.top + "px",
height: "calc(" + (100 % -menu.height) + "px)",
display: current === index ? "block" : "none",
}}
{siteData.map((item, index) => {
return (
<SwiperItem
className="absolutely"
onClick={this.onClickSwiperItem.bind(this)}
key={"swiper_" + index}
>
<View>
<View
// className="body FadeInFrame fadein"
style={{
width: "100%",
height: "100%",
// display: current === index ? "block" : "none",
}}
>
<Image
className="cover"
src={item.image}
mode="aspectFill"
mode="aspectFit"
></Image>
</View>
<View className="bottom-card">
<View className="text slide-left">{item.title}</View>
<View className="txt slide-left">{item.desc}</View>
</View>
</View>
</SwiperItem>
);
})}
</Swiper> */}
</SwiperItem>
);
})}
</Swiper>
</View>
<View className="common-popup-btns">
{/* <View className="common-popup-btns">
<Button className="common-popup-btn" onClick={this.onConfirm}>
{confirmButtonText}
</Button>
</View>
</View> */}
</View>
</Popup>
</Block>

@ -5,6 +5,9 @@
.large {
width: 670rpx;
}
.middle {
width: 580rpx;
}
.common-box {
padding: 38rpx 30rpx;

@ -8,7 +8,7 @@ import { Block, View, Text, Image, PageMeta, Button } from "@tarojs/components";
import { connect } from "react-redux";
import { userRefresh } from "../../store/features/userInfo";
import { otherSettingRefresh } from "../../store/features/otherSetting";
import { setIndexFlag } from "../../store/features/global";
import { setIndexFlag } from "../../store/features/globalStore";
/*** redux end ***/
/** 自定义组件 **/
@ -32,7 +32,7 @@ import {
// css引入
import "taro-ui/rn/style/components/calendar.scss";
import "./index.less";
import { go } from "../../utils/traoAPI";
import { go, msg } from "../../utils/traoAPI";
// PropsWithChildren
class Index extends Component<any, any> {
@ -41,6 +41,7 @@ class Index extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
isShowIndexFlag: this.props.isShowIndexFlag,
isShowPrivacyPopup: false,
isShowSiteSwiper: false,
isNotRegister: false, // 是否未注册
@ -102,7 +103,13 @@ class Index extends Component<any, any> {
if (mobile) {
this.GetNoReadMessageNum(); // 查询是否有消息
this.RefreshWxUserInfo();
this.GetSitePopupList();
// if (!this.state.isShowIndexFlag) {
// // 仅初次进入首页运行
// this.GetSitePopupList();
// this.props.setIndexFlag(true);
// }
}
}
}
@ -159,13 +166,37 @@ class Index extends Component<any, any> {
// 获取站点管理-弹窗列表 1-首页 2-发现模块 3-活动模块
GetSitePopupList = async () => {
this.intData();
// return;
let res = await GetSitePopupList(1);
if (res.data.code === 200) {
// console.log("GetSitePopupList", res);
this.setState({ sitePopupList: res.data.data, isShowSiteSwiper: true });
if (res.data.data) {
this.setState({ sitePopupList: res.data.data, isShowSiteSwiper: true });
} else {
msg("暂无数据");
}
}
};
async intData() {
let MpSplashDetail_type1 =
Taro.getStorageSync("MpSplashDetail_type1") || undefined;
if (MpSplashDetail_type1) {
let detail = JSON.parse(MpSplashDetail_type1);
let list = detail.filter((item: any) => item.fileSuffix === "images");
let welcomeList = list.map((item) => {
return {
image: item.filePath,
title: item.title,
desc: item.content,
};
});
console.log("welcomeList", welcomeList);
this.setState({ sitePopupList: welcomeList, isShowSiteSwiper: true });
}
}
goRegister() {
go("/pages/register/register");
}
@ -273,12 +304,10 @@ class Index extends Component<any, any> {
/>
<PopupSiteSwiper
isShow={isShowSiteSwiper}
data={sitePopupList}
title="提示"
content="暂未授权注册,请点击注册"
siteData={sitePopupList}
size="middle"
confirmButtonText="确定"
textAlgin="center"
type="1"
close={this.closeSiteSwiper}
confirm={this.closeSiteSwiper}
/>
@ -353,6 +382,7 @@ class Index extends Component<any, any> {
const mapStateToProps = (state) => ({
background: state.navigation.background,
mobile: state.userInfo.mobile,
isShowIndexFlag: state.globalStore.isShowIndexFlag,
});
const mapDispatchToProps = (dispatch) => ({
userRefresh(data) {

@ -192,7 +192,6 @@ class Initiate extends Component<any, any> {
const mapStateToProps = (state) => ({
mobile: state.userInfo.mobile,
token: state.global.token,
});
const mapDispatchToProps = (dispatch) => ({
userRefresh(value) {

@ -2,8 +2,8 @@ import Taro from "@tarojs/taro";
import { createSlice } from "@reduxjs/toolkit";
// 全局变量
const globalReducer = createSlice({
name: "global", // store的名字
const globalStoreReducer = createSlice({
name: "globalStore", // store的名字
initialState: {
domain: "http://110.41.134.131:8080", // 请求地址
// domain: "http://192.168.10.147:8080", // 请求地址
@ -24,5 +24,5 @@ const globalReducer = createSlice({
},
});
export const { setToken, setIndexFlag } = globalReducer.actions;
export default globalReducer.reducer;
export const { setToken, setIndexFlag } = globalStoreReducer.actions;
export default globalStoreReducer.reducer;

@ -3,7 +3,7 @@ import { configureStore } from "@reduxjs/toolkit";
import counterReducer from "./features/counter";
import navigationReducer from "./features/navigation";
import userInfoReducer from "./features/userInfo";
import globalReducer from "./features/global";
import globalStoreReducer from "./features/globalStore";
import otherSettingReducer from "./features/otherSetting";
const store = configureStore({
@ -12,7 +12,7 @@ const store = configureStore({
counter: counterReducer,
navigation: navigationReducer,
userInfo: userInfoReducer,
global: globalReducer,
globalStore: globalStoreReducer,
otherSetting: otherSettingReducer,
},
});

@ -5,7 +5,7 @@ import Taro from "@tarojs/taro";
import formdata from "./wxFormdata/formData";
import store from "../store";
const global = store.getState().global;
const global = store.getState().globalStore;
const global_requestUrlList = []; // 全局正在请求的url地址防止多次点击

Loading…
Cancel
Save