datain.vue 3.13 KB
<template>
	<view class="page">
		<view class="listBox">
			<view class="content">
				<!-- 列表 -->
				<view class="user-list" v-show="!isAdmin">
					<view class="list" @click="toData" style="background-color:#D32D25;">
						<view class="title" style="color:white">
							<text>表单设计</text>
						</view>
						<view class="more-content">
							<view class="more-content-img">
								<image src="../../static/right2.png"></image>
							</view>
						</view>
					</view>
				</view>
				<view class="user-list">
					<view class="list" @click="toPostCom()" >
						<view class="title" >
							<text>企业信息采集</text>
						</view>
						<view class="more-content">
							<view class="more-content-img">
								<image src="../../static/right2.png"></image>
							</view>
						</view>
					</view>
				</view>
				<view class="user-list" v-for="(item,index) in formList">
					<view class="list" @click="toForm(it)" v-for="(it,index) in item.children">
						<view class="title">
							<text>{{it.fullName}}</text>
						</view>
						<view class="more-content">
							<view class="more-content-img">
								<image src="../../static/right2.png"></image>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	import request from "@/utils/request"
	export default {
		data() {
			return {
				formList:[],
				// 判断用户是否是管理员
				isAdmin:false
			}
		},
		onLoad() {
			this.getUser()
		},
		created() {
			this.getFormList()
		},
		methods: {
			// 获取用户信息
			getUser(){
				if (uni.getStorageSync('user')) {
					let userCode = uni.getStorageSync('user')
					// console.log("用户的code", this.userCode)
					this.userId = userCode.userInfo.userId
					this.userName = userCode.userInfo.userAccount
					this.userIcon = userCode.userInfo.headIcon
					this.organizeName = userCode.userInfo.organizeName
					this.isAdmin = userCode.userInfo.isCompany
					console.log(userCode)
				} else {
					uni.showToast({
						title: '请登录',
						icon: 'none'
					})
					setTimeout(() => {
						uni.reLaunch({
							url: '/pages/login/index'
						})
					})
				}
			},
			// 获取表单列表
			getFormList() {
				let that = this
				request({
					url: '/api/visualdev/Base',
					method: 'get',
					data: {type:2},
				}).then(res => {
					console.log(res)
					if(res.code === 600){
						uni.showToast({
							icon:"exception",
							title:'登录过期,请重新登录'
						})
					}
					this.formList = res.data.list
				})
			},
			toData() {
				uni.navigateTo({
					url: '/pages/data/data'
				})
			},
			// 去企业信息表单采集
			toPostCom(){
				uni.navigateTo({
					url:'/pages/postCompany/postCompany'
				})
			},
			// 去表单填写页面
			toForm(item){
				// uni.navigateTo({
				// 	url: `/pages/apply/dynamicModel/index?data=${JSON.stringify(it)}`
				// })
				uni.navigateTo({
					url: '/pages/apply/dynamicModel/index?id=' + item.id + '&fullName=' + item.fullName,
					fail: (err) => {
						this.$u.toast("暂无此页面")
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	@import 'datain.scss';
</style>