w-ui-v1 1.0.16 → 1.0.18
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/w-card/utils/utils.ts +12 -0
- package/w-detail/w-detail.vue +48 -0
- package/w-login/w-login.vue +3 -0
- package/w-menu/w-menu.vue +29 -2
- package/w-user/w-user.vue +1 -2
package/package.json
CHANGED
package/w-card/utils/utils.ts
CHANGED
|
@@ -45,6 +45,18 @@ export function getValue(content: any, title: any): any {
|
|
|
45
45
|
type: '图片',
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
//文件链接
|
|
50
|
+
if (obj.base?.path && (obj.base?.type.includes('docx') )) {
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
|
|
54
|
+
name:obj.base.fileName,
|
|
55
|
+
type: '文件',
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
48
60
|
}
|
|
49
61
|
|
|
50
62
|
// 根据content中 "@R@" 分割字符串,取最后一项
|
package/w-detail/w-detail.vue
CHANGED
|
@@ -56,6 +56,51 @@ function goto(PItem: any,item:any) {
|
|
|
56
56
|
url: `/pages/detail/detail?sourceId=${item.pointSourceId}&code=${PItem.code}`
|
|
57
57
|
})
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
//下载文件
|
|
61
|
+
const downloadFile=(url:any)=>{
|
|
62
|
+
console.log(url)
|
|
63
|
+
uni.downloadFile({
|
|
64
|
+
url: url, // 文件的网络地址
|
|
65
|
+
success: (res) => {
|
|
66
|
+
if (res.statusCode === 200) {
|
|
67
|
+
console.log('下载成功', res.tempFilePath);
|
|
68
|
+
|
|
69
|
+
// 将临时文件保存到本地
|
|
70
|
+
uni.saveFile({
|
|
71
|
+
tempFilePath: res.tempFilePath,
|
|
72
|
+
success: (saveRes) => {
|
|
73
|
+
console.log('文件保存成功', saveRes.savedFilePath);
|
|
74
|
+
uni.showToast({
|
|
75
|
+
title: '文件保存成功',
|
|
76
|
+
icon: 'success'
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
fail: (saveErr) => {
|
|
80
|
+
console.error('文件保存失败', saveErr);
|
|
81
|
+
uni.showToast({
|
|
82
|
+
title: '文件保存失败',
|
|
83
|
+
icon: 'none'
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
} else {
|
|
88
|
+
console.error('下载失败', res);
|
|
89
|
+
uni.showToast({
|
|
90
|
+
title: '下载失败',
|
|
91
|
+
icon: 'none'
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
fail: (err) => {
|
|
96
|
+
console.error('下载失败', err);
|
|
97
|
+
uni.showToast({
|
|
98
|
+
title: '下载失败',
|
|
99
|
+
icon: 'none'
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
59
104
|
</script>
|
|
60
105
|
|
|
61
106
|
<template>
|
|
@@ -101,6 +146,9 @@ function goto(PItem: any,item:any) {
|
|
|
101
146
|
<wd-img v-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
|
|
102
147
|
width="100rpx" height="100rpx" :src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url"
|
|
103
148
|
:enable-preview="true" />
|
|
149
|
+
<view v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type ==='文件'" class="value">
|
|
150
|
+
<wd-text type="primary" @click="downloadFile(getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url)" :text="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).name"/>
|
|
151
|
+
</view>
|
|
104
152
|
<view v-else class="value">
|
|
105
153
|
{{ getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}
|
|
106
154
|
</view>
|
package/w-login/w-login.vue
CHANGED
package/w-menu/w-menu.vue
CHANGED
|
@@ -128,8 +128,17 @@ function queryList() {
|
|
|
128
128
|
<wd-card v-for="(item, index) in filtermenu" :key="index" :title="item.title">
|
|
129
129
|
<template #default>
|
|
130
130
|
<wd-grid :column="5" :clickable="true">
|
|
131
|
-
<wd-grid-item v-for="(subItem, subIndex) in item.items" :key="subIndex"
|
|
132
|
-
|
|
131
|
+
<wd-grid-item use-slot v-for="(subItem, subIndex) in item.items" :key="subIndex"
|
|
132
|
+
@itemclick="gotoPage(subItem)" use-text-slot>
|
|
133
|
+
<template #default>
|
|
134
|
+
<view class="grid-item">
|
|
135
|
+
<wd-icon name="list" size="22px" color="#0083ff"></wd-icon>
|
|
136
|
+
<wd-text type="primary" :text="subItem.title"></wd-text>
|
|
137
|
+
<!-- <wd-text type="primary" text="我的订单我的订单我的订单我的订单"></wd-text> -->
|
|
138
|
+
</view>
|
|
139
|
+
|
|
140
|
+
</template>
|
|
141
|
+
</wd-grid-item>
|
|
133
142
|
</wd-grid>
|
|
134
143
|
</template>
|
|
135
144
|
</wd-card>
|
|
@@ -150,4 +159,22 @@ function queryList() {
|
|
|
150
159
|
display: flex;
|
|
151
160
|
justify-content: center;
|
|
152
161
|
}
|
|
162
|
+
.grid-item{
|
|
163
|
+
position: relative;
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-direction: column;
|
|
166
|
+
//实现...
|
|
167
|
+
overflow: hidden;
|
|
168
|
+
text-overflow: ellipsis;
|
|
169
|
+
white-space: nowrap;
|
|
170
|
+
|
|
171
|
+
}
|
|
172
|
+
// .grid-item::after {
|
|
173
|
+
// content: "...";
|
|
174
|
+
// position: absolute;
|
|
175
|
+
// bottom: 0;
|
|
176
|
+
// right: -5px;
|
|
177
|
+
// background: linear-gradient(to right, transparent, white 50%);
|
|
178
|
+
// padding-left: 1em;
|
|
179
|
+
// }
|
|
153
180
|
</style>
|