<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<view>
				{{ userName }}
			</view>
			<text @click="changeTitle" class="title">123</text>
		</view>
	</view>
</template>

<script>
import { ref, inject,computed } from 'vue';
import { getList, upload } from '../../apis/clientApi.js';
import { tab2 } from '../../utils/hook.js';
import {userAction} from '../../store/global.js'
export default {
	setup() {
		const title = ref('12');
		let name = 'zhangsan'
		const changeTitle = () => {
			title.value = title.value === '12' ? '345' : '12';
			// console.log($pubFn.dateTimeFormat(new Date(),'yyyy-mm-dd hh:MM:ss'))
			// tab2('mine')
			// getList({
			// 	isPromoting: 0,
			// 	pageNum: 1,
			// 	pageSize: 10
			// }).then(res => {
			// 	console.log('res',res)
			// })
			uni.chooseImage({
				success: chooseImageRes => {
					const tempFilePaths = chooseImageRes.tempFilePaths;
					upload({ filePath: tempFilePaths[0] }).then(res => {
						console.log('res', res);
					});
				}
			});
			name == 'zhangsan' ? name = 'lisi': name="zhangsan"
			userAction.setUserInfo({name:name})
		};
			
		const userName = computed(() => {
			return userAction.getUserInfo().name
		})
		
		const $pubFn = inject('$pubFn');
		return {
			title,
			changeTitle,
			userName
		};
	}
};
</script>

<style>
.content {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.logo {
	height: 200rpx;
	width: 200rpx;
	margin-top: 200rpx;
	margin-left: auto;
	margin-right: auto;
	margin-bottom: 50rpx;
}

.text-area {
	display: flex;
	justify-content: center;
}

.title {
	font-size: 36rpx;
	color: #8f8f94;
}
</style>
