<script>
	// 工具库
	import util from '@/common/js/util';
	// vuex
	import store from '@/store/index.js'
	// import Mixins from '@/utils/Mixins.js'
	uni.setStorageSync('token',`eyJhbGciOiJIUzUxMiJ9.eyJhcHBVc2VyIjp7ImNyZWF0ZVRpbWUiOiIyMDI0LTEyLTMwIDE0OjUxOjEyIiwiY3JlYXRlQnkiOiIwIiwidXBkYXRlVGltZSI6IjIwMjUtMDEtMDEgMDU6MTQ6NDgiLCJ1cGRhdGVCeSI6IjAiLCJkZWxGbGFnIjoiMCIsImlkIjoiMTMiLCJ1c2VyTmFtZSI6IkppdVlp55So5oi3NzZkbHA2cTAiLCJwaG9uZU51bWJlciI6IjE1NjY2MDA2NTkyIiwiaW52aXRhdGlvbkNvZGUiOiJTd3ZKdDkwbSIsInVzZXJOaWNrbmFtZSI6IuWFrOWQq-W6mSIsInNleCI6bnVsbCwiYXZhdGFyIjpudWxsLCJiaXJ0aGRheSI6bnVsbCwiYWNjb3VudCI6Ijc2ZGxwNnEwIiwidXNlclJlYWxOYW1lIjpudWxsLCJ1c2VySWRDYXJkIjpudWxsLCJob21lVG93biI6bnVsbCwicGVyc29uYWxTaWduYXR1cmUiOm51bGwsImhhc1NlY29uZENpcGhlciI6bnVsbCwidXNlckltZWkiOiIxNzM1NTczOTk1NjQ3NzE1OTc0MCIsInVzZXJBdHRlbnRpb24iOm51bGwsInVzZXJGYW5zIjpudWxsLCJwdWJsaWNQcmFpc2VkIjpudWxsLCJwcml2YWN5UHJhaXNlZCI6bnVsbCwic2NvcmUiOjBFLTEwLCJsYXNoaW5Bd2FyZCI6MCwiZnJ1aXQiOjkzMDAsInVzZXJMaW5lU3RhdGUiOjEsImlzU2hvcCI6MCwiYmFja2dyb3VuZCI6bnVsbCwiYWNjb3VudFVwZGF0ZVRpbWUiOm51bGwsImlzUmVhbE5hbWUiOm51bGwsInJlZmVycmVyVXNlcklkIjoxfX0.nhK1AawF-ynYZ-tZ1IRvgkc5jcmVkEAyuli3z025akFFljfuK8wlz2rBGELtPvg-746G4mg1Bvgku4_MXEuzhQ`)

	export default {
		// mixins: [Mixins],
		onLaunch() {
			this.getUserinfo()
		},

		methods: {
			getUserinfo() {
				// 登录令牌
				const token = uni.getStorageSync('token')
				// 用户信息
				const userinfo = uni.getStorageSync('userinfo')

				// 如果登录保活
				if (token) {
					// 用户信息
					if (userinfo) store.commit('setState', {
						key: 'userinfo',
						value: userinfo
					})

					util.getUserinfo(() => {
						// 腾讯im登录
						util.loginTencent(userinfo)
						// 储存登录账号
						util.loginAccountManagement(userinfo)
					})
				}
			},
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "./common/css/style.scss";
</style>