w-ui-v1 1.0.14 → 1.0.16

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/index.ts CHANGED
@@ -8,6 +8,7 @@ import wSelectPicker from './w-select-picker/w-select-picker.vue'
8
8
  import wDetail from './w-detail/w-detail.vue'
9
9
  import wAdd from './w-add/w-add.vue'
10
10
  import WSearch from './w-search/w-search.vue'
11
+ import WUser from './w-user/w-user.vue'
11
12
  const coms: any[] = [
12
13
  wTest,
13
14
  wLogin,
@@ -17,7 +18,8 @@ const coms: any[] = [
17
18
  wSelectPicker,
18
19
  wDetail,
19
20
  wAdd,
20
- WSearch
21
+ WSearch,
22
+ WUser
21
23
  ]
22
24
  // 批量组件注册
23
25
  function install(Vue: App) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
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)
@@ -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
- uni.navigateTo({
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 style="border-bottom:1px solid #e8e5e5;padding: 10rpx;">
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,subItem)" style="color: #4d80f0;" v-for="(subItem, subIndex) in getValue(item.content, item.title)?.split(',')" :key="subIndex">
111
- <text> {{ subItem}}</text>
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
- <wd-button v-if="showMore" type="icon" :icon="isExpanded ? 'arrow-up' : 'arrow-down'" size="small"
121
- custom-class="expand-btn" @click="toggleExpand" />
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
 
@@ -29,7 +29,7 @@ onLoad((option: any) => {
29
29
  sourceId.value = props.sourceId || option.sourceId
30
30
  code.value = option.code||props.code
31
31
  getPageData()
32
-
32
+ uni.setNavigationBarTitle({ title: "详情" })
33
33
  })
34
34
  // 获取页面配置
35
35
  function getPageConfig() {
@@ -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 style="box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 17px 0px;margin: 0;" title=" " v-if="item.type === 'fieldGroup'">
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 style="box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 17px 0px;margin: 0 0 10px 0;" title=" " v-for="(PItem, PIndex) in pageData.arrayMap[item.id]" :key="PIndex">
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
@@ -47,7 +47,7 @@ function sheetGotoPage(item: any) {
47
47
  function goto(item: any) {
48
48
  if (item.pageType) {
49
49
  uni.navigateTo({
50
- url: `/pages/table/table?sourceId=${item.id}&pageType=${item.pageType}`,
50
+ url: `/pages/table/table?sourceId=${item.id}&pageTitle=${item.title}`,
51
51
  })
52
52
  return true
53
53
  }
@@ -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提供了方案可以全局统一处理
@@ -38,7 +38,7 @@
38
38
 
39
39
  </view>
40
40
  <view class="search-btn">
41
- <wd-button style="margin-right: 20rpx;" size="small" icon="search" @click="search">确定</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
  }
@@ -31,6 +31,7 @@ const pageData = ref<{
31
31
  }>({ criterias: [], buttons: [] })
32
32
  onLoad((option: any) => {
33
33
  sourceId.value = props.sourceId || option.sourceId
34
+ uni.setNavigationBarTitle({ title: option.pageTitle })
34
35
  getPageConfig()
35
36
  })
36
37
 
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <view class="user">
3
+ <view class="top">
4
+ <view class="circle">
5
+ <wd-icon name="user-circle" size="120rpx" color="#bababa"></wd-icon>
6
+ </view>
7
+ <view class="username">
8
+ <view class="name">
9
+ <text>{{ userInfo['用户名'] }}</text>
10
+ </view>
11
+ </view>
12
+ </view>
13
+ <wd-cell-group>
14
+ <wd-cell title="退出登录" icon="logout" :is-link="true" :clickable="true" @click="quit" />
15
+ </wd-cell-group>
16
+ <wd-message-box />
17
+ </view>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ import { ref } from 'vue';
22
+ import {
23
+ useMessage
24
+ } from 'wot-design-uni'
25
+ defineOptions({
26
+ name: 'WUser'
27
+ })
28
+ const message = useMessage()
29
+ const userInfo = ref({
30
+ '用户名': 'admin',
31
+ '昵称': '管理员'
32
+ })
33
+ const quit = () => {
34
+ message
35
+ .confirm({
36
+ // msg: '提示文案',
37
+ title: '退出登录'
38
+ })
39
+ .then(() => {
40
+ uni.removeStorageSync('token')
41
+ uni.reLaunch({
42
+ url: '/pages/login/login'
43
+ })
44
+ })
45
+ .catch(() => {
46
+ console.log('点击了取消按钮')
47
+ })
48
+
49
+ }
50
+ </script>
51
+
52
+ <style scoped lang="scss">
53
+ .user {
54
+ background-color: #f5f5f5;
55
+ height: 100vh;
56
+
57
+ .top {
58
+ display: flex;
59
+ align-items: center;
60
+ padding: 25rpx;
61
+ background-color: #fff;
62
+
63
+ .circle {
64
+ background-color: #efefef;
65
+ border-radius: 100%;
66
+ margin-right: 20rpx;
67
+ }
68
+
69
+ .username {
70
+ font-size: 40rpx;
71
+
72
+ .name {
73
+ margin-bottom: 10rpx;
74
+ }
75
+
76
+ .ic {
77
+ font-size: 30rpx;
78
+ color: #ccc;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ </style>