Blame view

绿纤uni-app/App.vue 1.01 KB
29608708   李宇   增加unia-app和html
1
2
3
4
  <script>
  	export default {
  		onLaunch: function() {
  			console.log('App Launch')
bae2f235   李宇   最新
5
6
7
8
9
10
11
12
13
14
15
16
17
  			let userInfo = uni.getStorageSync('userInfo')
  			if (!userInfo || !userInfo.userId) {
  				return
  			}
  			this.API.getAppAuthorize().then(res => {
  				if (res.code === 200 && res.data) {
  					// 将菜单数据存储到本地存储
  					uni.setStorageSync('appMenuData', res.data)
  					console.log('菜单数据已保存:', res.data)
  				}
  			}).catch(err => {
  				console.error('获取菜单数据失败:', err)
  			})
ba43caee   李宇   最新
18
19
20
21
22
23
24
25
26
27
28
  			this.API.getCurrentUser().then(res => {
  				console.error(res)
  				if (res.code === 200) {
  					uni.setStorageSync('userInfo', res.data.userInfo)
  				}
  			})
  			this.API.getUsers(userInfo.userId).then(res => {
  				if (res.code === 200) {
  					uni.setStorageSync('newuserInfo', res.data)
  				}
  			})
29608708   李宇   增加unia-app和html
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  		},
  		onShow: function() {
  			console.log('App Show')
  		},
  		onHide: function() {
  			console.log('App Hide')
  		}
  	}
  </script>
  
  <style lang="scss">
  	/*每个页面公共css */
  	@import "@/uni_modules/uview-ui/index.scss";
  	
  </style>