changeGroupDetail.vue
3.34 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<template>
<view>
<uni-collapse>
<uni-collapse-item :title="n.newName" v-for="n in list" :key="n.id" open>
<view class="collapseBody">
<view>
<label>会员编号:</label>
<text>{{n.memCode}}</text>
</view>
<view>
<label>团体会员名称:</label>
<view>
{{n.oldName}}
<text class="text-primary" v-if="n.oldName!=n.newName">变更为 </text>
<text class="text-danger" v-if="n.oldName!=n.newName">{{ n.newName }}</text>
</view>
</view>
<view v-if="n.fileUrl">
<label>附件:</label>
<text class="text-primary" @click="showImg(n)">
查看附件
</text>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app'
import * as api from '@/common/api.js'
import config from '@/config.js'
const queryParams = ref({})
const total = ref(0)
const list = ref([])
const popup = ref(null)
const type = ref('')
const form = ref({})
onLoad((option) => {
if (option.rangeId) {
queryParams.value.rangeId = option.rangeId
getList()
}
})
function getList() {
uni.showLoading({
title: '加载中'
})
api.getChangeGroupByRangeId(queryParams.value).then(res => {
list.value = res.rows
list.value.forEach(item => {
item.fileUrl = JSON.parse(item.fileUrl)
})
total.value = res.total
uni.hideLoading()
})
}
function showImg(n) {
var str = config.baseUrl_api + n.fileUrl[0]?.url
if (n.fileUrl[0]?.url.indexOf('png') > -1 || n.fileUrl[0]?.url.indexOf('jpg') > -1 || n.fileUrl[0]?.url.indexOf(
'jpeg') > -1) {
uni.previewImage({
urls: [str],
success: function(res) {
console.log('success', res)
},
fail: function(res) {
console.log('fail', res)
},
complete: function(res) {
console.log('complete', res)
}
})
} else {
goWebView(str)
}
}
function goWebView(url) {
url = url.replace("http://", "https://")
uni.showLoading({
title: '下载中'
});
uni.downloadFile({
url: url,
success: function(res) {
uni.hideLoading();
var filePath = res.tempFilePath;
uni.showLoading({
title: '正在打开'
});
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function(res) {
uni.hideLoading();
},
fail: function(err) {
uni.hideLoading();
uni.showToast({
title: err,
icon: 'none',
duration: 2000
});
}
});
},
fail: function(error) {
uni.hideLoading();
uni.showToast({
title: `下载失败`,
icon: 'none',
duration: 2000
});
}
});
}
</script>
<style scoped lang="scss">
.flexbox {
padding: 30rpx 30rpx 0
}
.danger-button {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.collapseBody {
padding: 0 30rpx;
box-sizing: border-box;
font-size: 28rpx;
&>view {
margin: 0 0 20rpx;display: flex;
label {
width: 7em;
color: #999;
display: inline-block;
text-align: right;flex:0 0 auto;
}
view{flex:1 1 auto;}
}
}
.popBody {
background: #fff;
padding: 30rpx;
}
</style>