弹窗跳转链接

master
blak-kong 2 years ago
parent ba3cae78e7
commit dc991c4626

Binary file not shown.

62181
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -20,6 +20,7 @@ export default defineAppConfig({
'pages/consultant/consultant',
'pages/integral_list/integral_list',
"pages/recording/recording",
"pages/webViewPage/webViewPage",
'pages/template/template',
],
"tabBar": {

@ -1,4 +1,5 @@
import classnames from "classnames";
import Taro from "@tarojs/taro";
import { Component } from "react";
import {
@ -71,16 +72,6 @@ export default class PopupSiteSwiper extends Component<any, any> {
onConfirm = (item: any) => {
let { type } = item;
// switch (type) {
// case "1": // 未注册
// go("/pages/register/register");
// break;
// case "2": // 登录过期
// go("/pages/login/login");
// break;
// case "3": // 前端提示-关注公众号
// break;
// }
this.props.confirm();
};
@ -97,17 +88,96 @@ export default class PopupSiteSwiper extends Component<any, any> {
}
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();
onClickSwiperItem(item) {
// 跳转类型0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间',
/**
* `link` '跳转链接(跳转外部链接、跳转内部链接)',
`link_params` '跳转链接参数(跳转内部链接)',
`redirect_appid` '外链小程序appid跳转小程序',
`redirect_url` '外链小程序url跳转小程序',
`video_no` '视频号(导向视频号、导向视频号直播间)',
`feed_id` '视频号feedId导向视频号',
*/
console.log("item", item);
let { type } = item;
if (type === 0) {
return;
}
switch (type) {
case 1: // 跳转内部链接
if (item.linkParams) {
Taro.reLaunch({
url: item.link + "?" + item.linkParams,
});
} else {
Taro.reLaunch({
url: item.link,
});
}
break;
case 3: // 跳转外部链接
if (item.linkParams) {
Taro.navigateTo({
url:
"/pages/webViewPage/webViewPage?url=" +
item.link +
"?" +
item.linkParams,
});
} else {
Taro.navigateTo({
url: "/pages/webViewPage/webViewPage?url=" + item.link,
});
}
break;
case 4: // 跳转小程序
Taro.navigateToMiniProgram({
appId: item.redirectAppid,
path: item.redirectUrl,
success: (res) => {
// 打开成功
console.log("跳转小程序success", res);
},
fail: (res) => {
console.log("跳转小程序fail", res);
},
});
break;
case 5: // 跳转视频号
Taro.openChannelsActivity({
finderUserName: item.videoNo,
feedId: item.feedId,
success: (res) => {
// 打开成功
console.log("跳转视频号success", res);
},
fail: (res) => {
console.log("跳转视频号fail", res);
},
});
break;
case 6: // 跳转视频号直播间
Taro.openChannelsLive({
finderUserName: item.videoNo,
feedId: item.feedId,
success: (res) => {
// 打开成功
console.log("视频号直播间success", res);
},
fail: (res) => {
console.log("视频号直播间fail", res);
},
});
break;
}
// const { current } = this.state;
// const { siteData } = this.props;
// if (current < siteData.length - 1) {
// this.setState({
// current: current + 1,
// isClick: true,
// });
// }
}
onFinish(event) {
const { current } = event.detail;
@ -161,7 +231,7 @@ export default class PopupSiteSwiper extends Component<any, any> {
return (
<SwiperItem
className="absolutely"
onClick={this.onClickSwiperItem.bind(this)}
onClick={this.onClickSwiperItem.bind(this, item)}
key={"swiper_" + index}
>
<View
@ -178,12 +248,6 @@ export default class PopupSiteSwiper extends Component<any, any> {
mode="aspectFit"
></Image>
</View>
{/* <Button
className="site-popup-btn"
onClick={this.onConfirm.bind(this, item)}
>
</Button> */}
</SwiperItem>
);
})}

@ -183,7 +183,12 @@ class Index extends Component<any, any> {
if (res.data.code === 200) {
// console.log("GetSitePopupList", res);
if (res.data.data) {
this.setState({ sitePopupList: res.data.data, isShowSiteSwiper: true });
if (res.data.data.length) {
this.setState({
sitePopupList: res.data.data,
isShowSiteSwiper: true,
});
}
} else {
// msg("暂无数据");
}

@ -69,6 +69,9 @@ class User extends Component<any, any> {
};
let res = await SaveMessage(params);
if (res.data.code === 200) {
msg("提交成功!");
} else {
msg("提交失败!");
}
};

@ -0,0 +1,41 @@
import Taro from "@tarojs/taro";
import { Component } from "react";
import { Block, WebView } from "@tarojs/components";
// 打开外部页面使用
export default class WebViewPage extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "webView",
url: "",
};
}
$instance = Taro.getCurrentInstance();
async onLoad() {}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {
this.initData();
}
componentDidHide() {}
async initData() {
console.log("this.$instance.router", this.$instance.router);
this.setState({ url: this.$instance.router?.params?.url });
}
render() {
let { url } = this.state;
return (
<Block>
<WebView src={url}></WebView>
</Block>
);
}
}

@ -198,7 +198,7 @@ export const GetSiteCarousel = (data) => {
export const GetSiteAddTag = (data) => {
// 站点管理-轮播图-添加标签 传值是id
return Ajax({
url: "/hzwx/addTag/" + data,
url: "/hzwx/siteInfo/addTag/" + data,
data,
method: "get",
});

Loading…
Cancel
Save