叶松
2023-11-21 6eaaba4f97028d581df3e019a7705d60b398c26e
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<template>
    <view class="train_details">
        <view class="train_details_list">
            <view class="train_details_card">
                <view class="train_details_header">
                    <view class="train_details_text">{{detailsList.secureName}}</view>
                    <view class="train_details_btns" v-if="showBtns === '1'">{{showBtns === '1'?'已完成':''}}</view>
                </view>
                <view class="train_details_main">
                    <view class="train_details_phone">
                        <scroll-view scroll-x="true" class="content_file">
                            <view class="file_item" v-for="(item,index) in detailsList.securePathDtos" :key="index"  @click="lookFile(item)">
                                <image src="../../static/e.jpg" class="file_image" v-if="item.securePathVideo.split('.')[1] == 'xls'||item.securePathVideo.split('.')[1] == 'xlsx'"></image>
                                <image src="../../static/p.jpg" class="file_image" v-if="item.securePathVideo.split('.')[1] == 'pdf'"></image>
                                <image src="../../static/ppt.png" class="file_image" v-if="item.securePathVideo.split('.')[1] == 'ppt'||item.securePathVideo.split('.')[1] == 'pptx'"></image>
                                <image src="../../static/w.jpg" class="file_image" v-if="item.securePathVideo.split('.')[1] == 'doc'||item.securePathVideo.split('.')[1] == 'docx'"></image>
                                <view class="file_label">{{item.securePathVideoName}}</view>
                            </view>
                        </scroll-view>
                        <view class="train_details_times">培训日期:<span>{{detailsList.secureTime}}</span></view>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default{
        data(){
            return{
                showBtns:null,
                detailsList:[],//培训详情
            }
        },
        onLoad(option) {
            this.showBtns = option.stateSafe
            if(option.stateSafe !=='1'){
                this.overClick(option.secureId)
            }
            this.getAllDatas(option.secureId)
        },
        methods:{
            // 预览文件
            lookFile(item) {
                uni.showLoading({
                    title: '加载中...',
                    mask: true
                })
                uni.downloadFile({
                  url: `https://szpipe.thhy-tj.com/${item.securePathVideo}`,
                  success: function (res) {
                    var filePath = res.tempFilePath;
                    uni.hideLoading()
                    uni.openDocument({
                      filePath: filePath,
                      showMenu:true,
                      fileType:item.securePathVideo.split('.')[1],
                      success: function (res) {
                        console.log('打开文档成功');
                      }
                    });
                  }
                });
            },
            //进行点击确认
            overClick(val){
                this.$api.labourSystem.getOverState({secureId:val})
            },
            //回显数据
            getAllDatas(val){
                this.$api.labourSystem.getTrainingInfo({secureId:val}).then(res=>{
                    if(res.statusMsg === 'ok'){
                        this.detailsList = res.data
                    }else{
                        uni.$u.toast(res.statusMsg);
                    }
                }).catch((err) => {
                    uni.$u.toast('请检查网络服务或联系管理员!')
                })
            }
        }
    }
</script>
 
<style scoped lang="scss">
    .train_details{
        height:100vh;
        background-color: #F6F6F6;
        .train_details_list{
            padding: 10px 15px;
            .train_details_card{
                // height: 30vh;
                margin-bottom: 15px;
                background-color: #FFFFFF;
                border-radius: 6px;
                padding-bottom: 10px;
                
                .train_details_header{
                    height: 8vh;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    padding: 0px 18px;
                    border-bottom: 1px solid #F7F7F7;
                    
                    .train_details_text{
                        font-size: 17px;
                        position: relative;
                        &::before{
                            width: 2px;
                            height: 16px;
                            content: '';
                            position: absolute;
                            top: 2px;
                            left: -8px;
                            background-color: #1976FF;
                        }
                    }
                    .train_details_btns{
                        color:#FFFFFF ;
                        background-color: #1977FF;
                        padding: 3px 15px;
                        border-radius: 59px;
                    }
                }
                .train_details_main{
                    height: calc(100% - 96px);
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    flex-direction: column;
                    padding: 15px 15px 20px;
                    position: relative;
                    
                    .train_details_phone{
                        width: 100%;
                        height: 127px;
                        .content_file {
                            width: 100%;
                            height: 120px;
                            display: flex;
                            flex-wrap: nowrap;
                            white-space: nowrap;
                            
                            .file_item {
                                // width: 90px;
                                height: calc(100% - 8px);
                                margin: 4px;
                                display: inline-block;
                                margin-right: 24px;
                            
                                .file_image {
                                    width: 90px;
                                    height: calc(100% - 20px);
                                }
                            
                                .file_label {
                                    width: 100%;
                                    height: 20px;
                                    font-size: 3.5vw;
                                    // white-space: nowrap;
                                    // overflow: hidden;
                                    // text-overflow: ellipsis;
                                    display: block;
                                }
                            }
                        }
                        .train_details_times{
                            width: 91%;
                            border-bottom-left-radius: 6px;
                            border-bottom-right-radius: 6px;
                            position: absolute;
                            bottom: 0px;
                            margin-top: 30px;
                            // background-color: #000000;
                            display: flex;
                            align-items: center;
                            span{
                                // color:#FFFFFF ;
                                margin-left: 28px;
                                position: relative;
                                &::before{
                                    content: '';
                                    width: 100%;
                                    height: 100%;
                                    position: absolute;
                                    top: 3px;
                                    left: -19px;
                                    background: url('../../static/time.png') no-repeat;
                                }
                            }
                        }
                    }
                    
                }
            }
        }
    }
</style>