w-ui-v1 1.0.17 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
@@ -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@" 分割字符串,取最后一项
@@ -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-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" icon="list"
132
- :text="subItem.title" @itemclick="gotoPage(subItem)" />
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>
package/w-user/w-user.vue CHANGED
@@ -27,7 +27,7 @@ defineOptions({
27
27
  })
28
28
  const message = useMessage()
29
29
  const userInfo = ref({
30
- '用户名':uni.getStorageSync('userInfo').username,
30
+ '用户名':uni.getStorageSync('userInfo').username || 'adminkk',
31
31
  })
32
32
  const quit = () => {
33
33
  message