w-ui-v1 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/http.ts +14 -0
- package/w-card/utils/utils.ts +1 -1
- package/w-card/w-card.vue +22 -14
- package/w-detail/w-detail.vue +6 -2
- package/w-menu/w-menu.vue +1 -0
- package/w-search/w-search.vue +2 -1
package/package.json
CHANGED
package/utils/http.ts
CHANGED
|
@@ -24,8 +24,16 @@ export default function request(options: any): Promise<any> {
|
|
|
24
24
|
responseType: 'json',
|
|
25
25
|
// #endif
|
|
26
26
|
success: (res: any) => {
|
|
27
|
+
console.log('request', res)
|
|
27
28
|
// 判断状态
|
|
28
29
|
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
30
|
+
if(res.data.message==='权限不足或没有资源'){
|
|
31
|
+
uni.showToast({ title:res.data.message, icon: 'none' })
|
|
32
|
+
uni.removeStorageSync('token')
|
|
33
|
+
uni.reLaunch({ url: '/pages/login/login' })
|
|
34
|
+
reject(res)
|
|
35
|
+
return
|
|
36
|
+
}
|
|
29
37
|
resolve(res)
|
|
30
38
|
}
|
|
31
39
|
if (res.statusCode === 401) {
|
|
@@ -39,6 +47,12 @@ export default function request(options: any): Promise<any> {
|
|
|
39
47
|
reject(res)
|
|
40
48
|
// TODO 404
|
|
41
49
|
}
|
|
50
|
+
if (res.statusCode === 405) {
|
|
51
|
+
uni.showToast({ title: '登录过期,请重新登录', icon: 'none' })
|
|
52
|
+
uni.removeStorageSync('token')
|
|
53
|
+
uni.reLaunch({ url: '/pages/login/login' })
|
|
54
|
+
// TODO 404
|
|
55
|
+
}
|
|
42
56
|
if (res.statusCode === 500) {
|
|
43
57
|
uni.showToast({ title: '服务器错误', icon: 'none' })
|
|
44
58
|
reject(res)
|
package/w-card/utils/utils.ts
CHANGED
|
@@ -38,7 +38,7 @@ export function getValue(content: any, title: any): any {
|
|
|
38
38
|
const obj = JSON.parse(content)
|
|
39
39
|
|
|
40
40
|
// 图片链接
|
|
41
|
-
if (obj.base?.path && (obj.base?.type.includes('jpg') || obj.base?.type.includes('png'))) {
|
|
41
|
+
if (obj.base?.path && (obj.base?.type.includes('jpg') || obj.base?.type.includes('png')||obj.base?.type.includes('jpeg'))) {
|
|
42
42
|
|
|
43
43
|
return {
|
|
44
44
|
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
package/w-card/w-card.vue
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
defineProps,
|
|
5
5
|
ref,
|
|
6
6
|
} from 'vue'
|
|
7
|
-
import { hasY,getValue } from './utils/utils'
|
|
7
|
+
import { hasY, getValue } from './utils/utils'
|
|
8
8
|
|
|
9
9
|
const props = defineProps({
|
|
10
10
|
page: {
|
|
@@ -37,11 +37,11 @@ const items = computed(() => {
|
|
|
37
37
|
return {
|
|
38
38
|
title: item.title,
|
|
39
39
|
content: props.itemData?.fieldMap[item.id],
|
|
40
|
-
data:props.itemData?.fieldMap[item.id],
|
|
40
|
+
data: props.itemData?.fieldMap[item.id],
|
|
41
41
|
id: item.id,
|
|
42
42
|
mstrucId: item.mstrucId,
|
|
43
43
|
sourceId: item.sourceId,
|
|
44
|
-
buttons:item.buttons
|
|
44
|
+
buttons: item.buttons
|
|
45
45
|
}
|
|
46
46
|
}) || []
|
|
47
47
|
})
|
|
@@ -64,8 +64,8 @@ function toggleExpand() {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
// 跳转页页面
|
|
67
|
-
function goto(type: string,item:any={},subItem:string='') {
|
|
68
|
-
|
|
67
|
+
function goto(type: string, item: any = {}, subItem: string = '') {
|
|
68
|
+
|
|
69
69
|
switch (type) {
|
|
70
70
|
case 'detail':
|
|
71
71
|
uni.navigateTo({
|
|
@@ -73,10 +73,10 @@ function goto(type: string,item:any={},subItem:string='') {
|
|
|
73
73
|
})
|
|
74
74
|
break
|
|
75
75
|
case 'link':
|
|
76
|
-
let data=item.data.find((item:any)=>{
|
|
76
|
+
let data = item.data.find((item: any) => {
|
|
77
77
|
return item.includes(subItem)
|
|
78
78
|
}).split('@R@')[0]
|
|
79
|
-
|
|
79
|
+
uni.navigateTo({
|
|
80
80
|
url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${data}`,
|
|
81
81
|
})
|
|
82
82
|
break
|
|
@@ -92,7 +92,7 @@ function goto(type: string,item:any={},subItem:string='') {
|
|
|
92
92
|
<wd-card :title="getValue(visibleItems[0]?.content, visibleItems[0]?.title) || ' '">
|
|
93
93
|
<view class="table_collapse">
|
|
94
94
|
<view v-for="(item, index) in visibleItems" :key="index" class="cloum">
|
|
95
|
-
<wd-row
|
|
95
|
+
<wd-row >
|
|
96
96
|
<wd-col :span="6">
|
|
97
97
|
<view class="lable">
|
|
98
98
|
<text>{{ item.title }}:</text>
|
|
@@ -107,8 +107,9 @@ function goto(type: string,item:any={},subItem:string='') {
|
|
|
107
107
|
}}
|
|
108
108
|
</view>
|
|
109
109
|
<view v-else-if="item.buttons.includes('detail')">
|
|
110
|
-
<view @click="goto('link',item,
|
|
111
|
-
|
|
110
|
+
<view @click="goto('link', item, subItem)" class="link"
|
|
111
|
+
v-for="(subItem, subIndex) in getValue(item.content, item.title)?.split(',')" :key="subIndex">
|
|
112
|
+
<text> {{ subItem }}</text>
|
|
112
113
|
</view>
|
|
113
114
|
</view>
|
|
114
115
|
<view v-else class="value">
|
|
@@ -117,8 +118,11 @@ function goto(type: string,item:any={},subItem:string='') {
|
|
|
117
118
|
</wd-col>
|
|
118
119
|
</wd-row>
|
|
119
120
|
</view>
|
|
120
|
-
<
|
|
121
|
-
|
|
121
|
+
<view class="expand-btn-container">
|
|
122
|
+
<wd-button v-if="showMore" type="icon" :icon="isExpanded ? 'arrow-up' : 'arrow-down'" size="small"
|
|
123
|
+
@click="toggleExpand" />
|
|
124
|
+
</view>
|
|
125
|
+
|
|
122
126
|
</view>
|
|
123
127
|
<template #footer>
|
|
124
128
|
<wd-button size="small" class="btn" v-if="props.page.buttons.includes('detail')" @click="goto('detail')">
|
|
@@ -147,7 +151,8 @@ function goto(type: string,item:any={},subItem:string='') {
|
|
|
147
151
|
overflow: hidden;
|
|
148
152
|
max-height: 100px;
|
|
149
153
|
color: #3e3e3e;
|
|
150
|
-
|
|
154
|
+
border-bottom: 1px solid #e8e5e5;
|
|
155
|
+
padding: 15rpx 10rpx;
|
|
151
156
|
.lable {
|
|
152
157
|
// font-weight: 600;
|
|
153
158
|
text-align: left;
|
|
@@ -169,7 +174,7 @@ function goto(type: string,item:any={},subItem:string='') {
|
|
|
169
174
|
position: relative; // 添加定位上下文
|
|
170
175
|
padding-bottom: 80rpx; // 为按钮预留空间
|
|
171
176
|
|
|
172
|
-
.expand-btn
|
|
177
|
+
.expand-btn-container{
|
|
173
178
|
/* 尺寸调整 */
|
|
174
179
|
padding: 8rpx 20rpx;
|
|
175
180
|
font-size: 24rpx;
|
|
@@ -189,6 +194,9 @@ function goto(type: string,item:any={},subItem:string='') {
|
|
|
189
194
|
// border-radius: 16rpx;
|
|
190
195
|
// box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
|
191
196
|
}
|
|
197
|
+
.link{
|
|
198
|
+
color: #4d80f0;
|
|
199
|
+
}
|
|
192
200
|
|
|
193
201
|
}
|
|
194
202
|
|
package/w-detail/w-detail.vue
CHANGED
|
@@ -65,7 +65,7 @@ function goto(PItem: any,item:any) {
|
|
|
65
65
|
</view>
|
|
66
66
|
<wd-collapse v-model="value" v-else>
|
|
67
67
|
<wd-collapse-item :title="item.title" :name="item.id" v-for="(item, index) in pageConf.groups" :key="index">
|
|
68
|
-
<wd-card
|
|
68
|
+
<wd-card class="card" title=" " v-if="item.type === 'fieldGroup'">
|
|
69
69
|
<view v-for="(subItem, subIndex) in item.fields" :key='subIndex' style='margin-bottom: 15px;'>
|
|
70
70
|
<wd-row v-if="!subItem.hidden">
|
|
71
71
|
<wd-col :span="6">
|
|
@@ -89,7 +89,7 @@ function goto(PItem: any,item:any) {
|
|
|
89
89
|
</template>
|
|
90
90
|
</wd-card>
|
|
91
91
|
<view v-if="item.type === 'relation'">
|
|
92
|
-
<wd-card
|
|
92
|
+
<wd-card class="card" title=" " v-for="(PItem, PIndex) in pageData.arrayMap[item.id]" :key="PIndex">
|
|
93
93
|
<view v-for="(subItem, subIndex) in item.fields" :key='subIndex' style='margin-bottom: 15px;'>
|
|
94
94
|
<wd-row v-if="!subItem.hidden">
|
|
95
95
|
<wd-col :span="6">
|
|
@@ -134,4 +134,8 @@ function goto(PItem: any,item:any) {
|
|
|
134
134
|
word-break: break-all;
|
|
135
135
|
color: #333;
|
|
136
136
|
}
|
|
137
|
+
.card{
|
|
138
|
+
box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 17px 0px;
|
|
139
|
+
margin: 0 0 10px 0;
|
|
140
|
+
}
|
|
137
141
|
</style>
|
package/w-menu/w-menu.vue
CHANGED
|
@@ -108,6 +108,7 @@ function queryList() {
|
|
|
108
108
|
menu().then(res => {
|
|
109
109
|
// 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
|
|
110
110
|
paging.value.complete(res.data?.blocks||[]);
|
|
111
|
+
uni.setNavigationBarTitle({ title: res.data?.programName||''})
|
|
111
112
|
}).catch(res => {
|
|
112
113
|
// 如果请求失败写this.$refs.paging.complete(false),会自动展示错误页面
|
|
113
114
|
// 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
|
package/w-search/w-search.vue
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
</view>
|
|
40
40
|
<view class="search-btn">
|
|
41
|
-
<wd-button
|
|
41
|
+
<wd-button size="small" icon="search" @click="search">确定</wd-button>
|
|
42
42
|
<wd-button size="small" icon="refresh" @click="clear">清空</wd-button>
|
|
43
43
|
</view>
|
|
44
44
|
|
|
@@ -174,6 +174,7 @@ async function getEnumer() {
|
|
|
174
174
|
margin: 20rpx;
|
|
175
175
|
display: flex;
|
|
176
176
|
justify-content: center;
|
|
177
|
+
gap: 20rpx;
|
|
177
178
|
|
|
178
179
|
}
|
|
179
180
|
}
|