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

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

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

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

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

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

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

Loading…
Cancel
Save