1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- // components/My_navBar/index.js
- Component({
- /**
- * 组件的属性列表
- */
- options: {
- addGlobalClass: true
- },
- properties: {
- },
- lifetimes: {
- ready: function () {
- // 在组件实例进入页面节点树时执行
- //获取当前登录用户名
- const that = this;
- setTimeout(() => {
- let data = wx.getStorageSync('account_list')[[wx.getStorageSync('userData').index]]
- let userName = '';
- (data.fbrand != null && data.fbrand != undefined) ? userName = data.fbrand + '-': userName = data.fname + '-';
- userName += (data.frole ? data.frole : '未知');
- that.setData({
- userName
- })
- }, 500)
- },
- detached: function () {
- // 在组件实例被从页面节点树移除时执行
- },
- },
- /**
- * 组件的初始数据
- */
- data: {
- userName: "", //用户名
- NavHeight: getApp().globalData.myNavBorHeight, //头部导航高度
- capsule: wx.getMenuButtonBoundingClientRect(), //胶囊位置
- },
- /**
- * 组件的方法列表
- */
- methods: {
- a1212() {
- //跳转到选择账号
- wx.navigateTo({
- url: '/pages/login/index?type=changeUser&inherit=1',
- })
- }
- }
- })
|