<script>
	import {
		openSqlite,
		isOpenSqlite,
		closeSqlite,
		executeSql,
		selectFromTable
	} from '@/common/sqlite.js'
	export default {
		methods: {
		
		},
		onLaunch: async function() {
			console.log('App Launch')
			// #ifdef APP-PLUS
			try {
				if (!isOpenSqlite()) {
					await openSqlite()
				}
				await executeSql(`
				    create table if not exists property(
					  "assets_id" INTEGER PRIMARY KEY,
				      "serial" TEXT,
					  "name" TEXT,
					  "position" TEXT,
					  "worker_name" TEXT,
					  "worker_id" INTEGER,
					  "assets_status" TEXT,
					  "photo" TEXT,
					  "content" TEXT,
					  "is_check" INTEGER DEFAULT 0
					);
				`)
				await executeSql(`
				    create table if not exists log(
				      "id" INTEGER PRIMARY KEY AUTOINCREMENT,
					  "type" INTEGER DEFAULT 0,
				      "remark" TEXT,
				      "created_at" TIMESTAMP DEFAULT (datetime('now','localtime'))
				    );
				`)
				await executeSql(`
				    create table if not exists worker(
				      "id" INTEGER PRIMARY KEY AUTOINCREMENT,
					  "name" TEXT
				    );
				`)
			
			} catch (err) {
				throw new Error(err.message)
			}
			// #endif
		},

		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

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