微信扫一扫问题总结

个人订阅号自定义菜单栏不能绑定第三方外链网站解决方案

 

1、订阅号通过appid绑定企业认证小程序

2、跳转到uniapp制作的默认页面,附带参数

pages/index/index?url=c1

3、uniapp页面跳转到第三方页面

index.vue

<template>
	<view class="container">
		<content-main v-if="configstate == 0" :list="list"> </content-main>

		<search-index v-else-if="configstate == 1" :url="url" > </search-index>


	</view>
</template>

<script>
	import contentMain from "../../components/content-main.vue"
	import searchIndex from "../../components/search-index.vue"

	const USER = require("../../api/user");
	export default {
		components: {
			contentMain,
			searchIndex
		},
		onLoad(option) {
			var this_ = this
			USER.config({
				"type": '1'
			}).then(res => {
				this.configstate = res.configstate

				switch (option.url) {
					case 'c1':
						this.url = res.url
						break;
					case 'c2':
						this.url = res.url2
						break;
					case 'c3':
						this.url = res.url3
						break;
					default:
						this.configstate = false;
				}
			}).catch(err => {
				// alert('失败')
				console.log("失败", err)
			})
			
			 
			USER.getCategory({
				"type": '1'
			}).then(res => {
				this.list = res
				console.log(this.list)

			}).catch(err => {
				// alert('失败')
				console.log("失败", err)
			})
			 
		},
		data() {
			return {
				configstate: '',
				url: '',
				list:''
			}
		},
		onShow: function() {

		},
		mounted: function() {

		},
		methods: {
			// linkOthers(){
			// 	uni.navigateTo({
			// 	    url: '/pages/index/linkOthers?url=1'
			// 	});				
			// }
		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>

 

组件search-index

<template>
	<view>
			<web-view :src="url"></web-view>
	</view>
</template>

<script>
	export default {
		name:"search-index",
		props:{
			url:{
				type: [String, Number],
				default: ''
			}
		},
		data() {
			return {
			
			};
		},
		methods:{
			 
		}
	}
</script>

<style>
button.weui-btn, input.weui-btn {
    width: 100%;
    border-width: 0;
    outline: 0;
    -webkit-appearance: none;
}
.weui-btn_primary {
    background-color: #199619;
}
.weui-btn {
    position: relative;
    display: block;
    margin-left: auto;
    margin-right: auto;
    padding-left: 14px;
    padding-right: 14px;
    box-sizing: border-box;
    font-size: 18px;
    text-align: center;
    text-decoration: none;
    color: #fff;
    line-height: 2.55555556;
    border-radius: 5px;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    overflow: hidden;
}
.weui-btn_default {
    color: #000;
    background-color: #f8f8f8;
}
.weui-btn+.weui-btn {
    margin-top: 15px;
}
.text-dec{
	font-size: .7rem; 
	font-weight: bold;
	text-align: center;
	line-height: 3.5rem;
}
.weui-footer {
    color: #999;
	margin-top: 25px;
}
.weui-footer, .weui-grid__label {
    text-align: center;
    font-size: 14px;
}
.weui-footer__text {
    padding: 0 .34em;
    font-size: 12px;
}
.weui-img{
	width: 80%;
	height: auto;
}
 
</style>

组件content-main

<template>
	<view>
		<view class="intro">
			<img :src="imageUrl" alt="" width="100%">
		</view>
		<text class="intro">
			{{list.description}}
		</text>
	</view>
</template>

<script>
	const USER = require("../api/user");
	export default {
		name: "content-main",
		props: ["list"],
		data() {
			return {
				 
			};
		},
		computed:{
			imageUrl(){
				return "https://dgcmsy.cn"+this.list.image
			}
		}
		
	}
</script>

<style>
	.uu {
		color: #F43530;
	}
</style>

 

您还没有登录,请先 登录或者 注册后,添加评论