<template>
	<view class="container clearfix rich-text-temp">
		<rich-text-template ref="childTemplate"></rich-text-template>
	</view>
</template>

<script>
	import richTextTemplate from '@/components/module/listTemplate/richTextTemplate'
	
	var self;
	export default{
		components: {
		   richTextTemplate
		},
		data() {
			return{
				serverUrl: '',
				type: ''
			}
		},
		onLoad(){
			let self = this;
			uni.getStorage({
			    key: 'user_key',
			    success: function (res) {
			        const resData = res.data;
					if(resData.code == '1'){
						self.serverUrl = `/personal/myCentre?openid=${resData.openid}&userOrganizeID=${self.userOrganizeID}`;
						self.type = 'introduction';
						self.initData();
					}
			    }
			});
			
		},
		methods:{
			initData(){
				let self = this;
				self.$api.get(self.serverUrl,{organizeID:self.userOrganizeID}, response => {
					if (response.code == "1") {
						let _data =response.data,
							type = self.type;
						if(type) {
							let html = self.$api.adaptRichTextImg(_data[type]);
							self.$refs.childTemplate.html = html;
						}
					} else {
						self.$util.msg(response.msg,2000);
					}
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
