uniapp 根据返回的数组类型判断跳转页面

uniapp yekong

uniapp 微信小程序开发一个微信小程序有四个角色,一个账号可以拥有4个角色,要求角色权重依次是1>2>3>4,有1类型就优先跳转1,有2和3就优先跳2

gopage() {
				var that = this;
				that.listtype = []
				that.list.forEach(function(item, index) {
					that.listtype.push(item.UserType)
				});
				if (this.listtype.indexOf(1) != -1) {
					uni.setStorageSync('uid', that.list[this.listtype.indexOf(1)].Id)
					uni.redirectTo({
						url: '/pages/home/enterprise/index'
					})
				} else if (this.listtype.indexOf(2) != -1) {
					uni.setStorageSync('uid', that.list[this.listtype.indexOf(2)].Id)
					uni.redirectTo({
						url: '/pages/home/client/index'
					})
				} else if (this.listtype.indexOf(3) != -1) {
					uni.setStorageSync('uid', that.list[this.listtype.indexOf(3)].Id)
					uni.redirectTo({
						url: '/pages/home/owner/index'
					})
				} else if (this.listtype.indexOf(4) != -1) {
					uni.setStorageSync('uid', that.list[this.listtype.indexOf(4)].Id)
					uni.redirectTo({
						url: '/pages/home/driver/index'
					})
				}
			},
喜欢