<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
			// #ifdef MP-WEIXIN
			if (uni.getStorageSync("token") && uni.getStorageSync("hx_username")) {
				this.$WebIM.conn.open({
					user: uni.getStorageSync("hx_username"),
					pwd: "999999",
				}).then(() => {
					console.log("login success");
				}).catch((reason) => {
					console.log("login fail", reason);
				});
			}
			this.$u.post('/api/Index/platform_config').then(res => {
				if (res.code == 1) {
					this.$store.commit('setconfig', res.data)
				}
			})
			this.$u.post('/api/Index/popularity').then(res => {
				this.$store.commit('setpopularity', res.data)
			})
			this.$amapPlugin.getRegeo({
				success: (res) => {
					//成功回调
					// console.log(res[0].regeocodeData.addressComponent);
					this.$store.commit('setcity', res[0].regeocodeData.addressComponent)
				},
				fail: function(info) {
					//失败回调
					// console.log(info)
					this.$store.commit('setcity', '定位失败')
				}
			})
			// #endif
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";
</style>