<script>
	import {
		login
	} from '@/api/user.js'
	import md5 from 'js-md5'
	export default {
		onLaunch: function(options) {
			if(options && options.query && options.query.user){
				this.getUserInfo({
					smsCode: "",
					captchaKey: "",
					captchaValue: "",
					username: options.query.user,
					password: "",
					mark: ""
				}).then(res => {
					if(this.loginCallBack){
						this.loginCallBack()
					}
				})
			}
		},
		onShow: function() {

		},
		onHide: function() {

		},
		methods: {
			getUserInfo(params) {
				return new Promise((resolve, reject) => {
					login({
						...params,
						mark: md5(params.username + 'gdnxfdexam321')
					}).then(res => {
						// 保存本地token
						uni.setStorageSync('token', res.token);
						resolve(res)
					}).catch(err => {
						reject(err)
					})
				})
			}
		}
	}
</script>

<style lang="scss">
	/* uni.css - 通用组件、模板样式库，可以当作一套ui库应用 */
	@import './style/uni.css';


	/* 考试相关样式 */
	@import './style/style.css';



	/* 重写样式 */
	.uni-load-more__text {
		font-size: 14px !important;
	}





	.page-box {
		padding: 20px;
		font-size: 14px;
		display: flex;
		flex-direction: column;
		height: 100vh;
	}
</style>
