datain.vue
2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<template>
<view class="page">
<view class="listBox">
<view class="content">
<!-- 列表 -->
<view class="user-list" v-show="!isAdmin">
<view class="list" @click="toData">
<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'
})
},
// 去表单填写页面
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>