仁慧眼-上市公司微财报PC版前端
hailu
2022-11-02 77c50c239cf12e9d14b4eb1812f72125be4f615b
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
<template>
    <div class="search">
        <div class="logo">
            <img src="../assets/images/logo1.png" alt="">
        </div>
        <div class="name">上市公司微财报</div>
        <div class="input">
            <div class="draw pointer" @click="pickShow">{{ selectVal.text }} <i
                    class="iconfont iconsanjiaojiantoutriangular"></i></div>
            <div class="keyval">
                <input type="text" placeholder="请输入股票代码或股票名称" v-model="searchVal">
            </div>
        </div>
        <transition name="van-slide-down">
            <ul v-show="visible" class="list">
                <li class="pointer" v-for="(item, index) in serachList" @click="tohome(item)" :key='index'>
                    <span>{{ item.StockName }}</span>
                    <span>{{ item.StockCode }}</span>
                </li>
            </ul>
        </transition>
 
        <van-popup class="pick" v-model="pickToggle" position="bottom" :style="{ height: 'auto', width: '100%' }">
            <van-picker show-toolbar :columns="columns" @confirm="confirm" @cancel="pickHide" />
        </van-popup>
        <div class="clearfix" style="margin-top: 12px;position: relative;min-height: 14vh;">
            <div class="loadingbox" v-if="loading1">
                <div class="loading">
                    <van-loading type="spinner" size="60px" />
                </div>
            </div>
            <div style="width: 18%;float: left;font-size: 14px;font-weight: bold;color: white;text-align: center;">财报预告
            </div>
            <div class="clearfix" style="width: 81%;float: right;margin-top: 2px;">
                <p v-for="(item, index) in companyList" :key="`companyList_${index}`" @click="quickTurn(item)"
                    style="width: 33.33%;float: left;color: white;">{{ `${item.ts_name}(${item.pre_date_show})` }}</p>
                <p v-if="showTips1" style="width: 50%;float: left;color: white;">暂无数据</p>
            </div>
        </div>
        <div class="clearfix" style="margin-top: 12px;position: relative;">
            <div class="loadingbox" v-if="loading2">
                <div class="loading">
                    <van-loading type="spinner" size="60px" />
                </div>
            </div>
            <div style="width: 18%;float: left;">
                <p style="font-size: 14px;font-weight: bold;color: white;text-align: center;">财报预告</p>
                <p style="font-size: 14px;font-weight: bold;color: white;text-align: center;"> 半导体</p>
            </div>
            <div class="clearfix" style="width: 81%;float: right;margin-top: 2px;">
                <p v-for="(item, index) in companyList_Semi" :key="`companyList_${index}`" @click="quickTurn(item)"
                    style="width: 33.33%;float: left;color: white;">{{ `${item.ts_name}(${item.pre_date_show})` }}</p>
                <p v-if="showTips2" style="width: 50%;float: left;color: white;">暂无数据</p>
            </div>
        </div>
        <div class="to-message pointer" style="max-width: 630px;">
            <u @click="clickToMessage">找不到想要的数据? 欢迎给我们留言</u>
        </div>
    </div>
</template>
 
<script>
import {
    Popup,
    Picker,
    Loading
} from 'vant';
import wxapi from '@/assets/js/wxapi.js';
 
export default {
    name: 'search',
    components: {
        Popup,
        Loading
    },
    data() {
        return {
            loading1: true,
            loading2: true,
            columns: [
                {
                    value: 0,
                    text: '年报'
                },
                {
                    value: 1,
                    text: '半年报'
                },
                {
                    value: 2,
                    text: '一季报'
                },
                {
                    value: 3,
                    text: '三季报'
                }
            ],
            pickToggle: false,
            selectVal: {},
            searchVal: '',
            serachList: [],
            visible: false,
            companyList: [],//公司列表
            companyList_Semi: [],//公司列表(半导体)
            showTips1: false,//是否显示暂无数据提示
            showTips2: false,//是否显示暂无数据提示
        }
    },
    activated() {
        this.getCompanyList()
        this.getCompanyList('Semi')
        this.getDefaultReportType()
        this.selectVal = this.columns[0];
        // wxapi.wxRegister(data, option);
        // this.getShareInfo('这里是标题啊啊啊啊啊啊', location.href.split('#')[0]);
    },
    deactivated: function () {
        this.selectVal = {};
        this.searchVal = '';
        this.serachList = [];
    },
    methods: {
        /**
         * 获取默认财报类型
         */
        getDefaultReportType() {
            this.$axios.post('/DisclosureDate/GetDefaultReportType', {
                TypeInfo: 'month'
            }).then((res) => {
                this.selectVal = this.columns[res.data.Data];
            }).catch((err) => {
                this.selectVal = {}
            });
        },
        /**
         * 获取公司列表
         */
        getCompanyList(Plate) {
            let data = {
                TypeInfo: 'month'
            }
            if (Plate == 'Semi') {
                data.Plate = 'Semi'
                this.loading2 = true
            } else {
                this.loading1 = true
            }
            let that = this
            this.$axios.post('/DisclosureDate/GetDisclosureDateList', data).then((res) => {
                if (res.data.Data && res.data.Data.length > 0) {
                    if (Plate == 'Semi') {
                        that.showTips2 = false
                        this.companyList_Semi = res.data.Data;
                    } else {
                        that.showTips2 = false
                        this.companyList = res.data.Data;
                    }
                } else {
                    if (Plate == 'Semi') {
                        that.showTips2 = true
                        this.companyList_Semi = []
                    } else {
                        that.showTips1 = true
                        this.companyList = []
                    }
                }
                if (Plate == 'Semi') {
                    this.loading2 = false
                } else {
                    this.loading1 = false
                }
            }).catch((err) => {
                if (Plate == 'Semi') {
                    this.loading2 = false
                    that.showTips2 = true
                    this.companyList_Semi = []
                } else {
                    this.loading1 = false
                    that.showTips1 = true
                    this.companyList = []
                }
            });
        },
        // getShareInfo: function(tit, fxUrl) { //如果分享的内容会根据情况变化,那么这里可以传入分享标题及url
        //     var data = { //请求参数
        //         url: this.jmUrl,
        //         token: this.token,
        //         code: this.code
        //     };
        //     //这里我写了一个公用的接口请求js,这里正常axios请求就可以,只要拿到数据都可以
        //     getShare(data).then(res => {
        //         localStorage.setItem("jsapi_ticket", res.jsapi_ticket);
        //         //拿到后端给的这些数据
        //         let appId = res.appId;
        //         let timestamp = res.timestamp;
        //         let nonceStr = res.noncestr;
        //         let signature = res.signature;
        //         wx.config({
        //             debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
        //             appId: 'wx56a464621c6314a', // 必填,公众号的唯一标识,填自己的!
        //             timestamp: timestamp, // 必填,生成签名的时间戳,刚才接口拿到的数据
        //             nonceStr: nonceStr, // 必填,生成签名的随机串
        //             signature: signature, // 必填,签名,见附录1
        //             jsApiList: [
        //                 'onMenuShareTimeline',
        //                 'onMenuShareAppMessage'
        //             ]
        //         })
 
        //         wx.ready(function() {
        //             //分享到朋友圈
        //             wx.onMenuShareTimeline({
        //                 title: tit, // 分享时的标题
        //                 link: fxUrl, // 分享时的链接
        //                 imgUrl: _this.pic, // 分享时的图标
        //                 success: function() {
        //                     console.log("分享成功");
        //                 },
        //                 cancel: function() {
        //                     console.log("取消分享");
        //                 }
        //             });
        //             //分享给朋友
        //             wx.onMenuShareAppMessage({
        //                 title: tit,
        //                 desc: '这件商品终于优惠了,每件只需5555555555555555555元',
        //                 link: fxUrl,
        //                 imgUrl: _this.pic,
        //                 type: '',
        //                 dataUrl: '',
        //                 success: function() {
        //                     console.log("分享成功");
        //                 },
        //                 cancel: function() {
        //                     console.log("取消分享");
        //                 }
        //             });
        //         })
        //     })
        // },
        pickShow: function () {
            this.pickToggle = true;
        },
        pickHide: function () {
            this.pickToggle = false;
        },
        confirm: function (value) {
            this.selectVal = value;
            this.pickHide();
        },
        tohome: function (item) {
            // sessionStorage.setItem('param', JSON.stringify({
            //     id: item.id,
            //     type: this.selectVal.value
            // }));
            // this.$router.push('/home')
            console.log(item);
            console.log(this.selectVal);
            let imgName = item.StockName + '(' + item.TSCode + ')' + this.selectVal.text
 
            let routeUrl=this.$router.resolve({
                path: "home",
                 query: {
                    name: item.StockName,
                    TSCode: item.TSCode,
                    selectVal: this.selectVal.text,
                    id: item.id,
                    type: this.selectVal.value
                }
            })
            window.open(routeUrl.href, '_blank');
            // localStorage.setItem('imgName', imgName)
            // this.$router.push({
            //     name: 'home',
            //     query: {
            //         id: item.id,
            //         type: this.selectVal.value
            //     }
            // })
        },
        /**
         * 快速查看
         */
        quickTurn(item) {
            this.$router.push({
                name: 'home',
                query: {
                    id: 0,
                    ReportType: item.report_type,
                    TSCode: item.ts_code,
                }
            })
        },
        search: function () {
            if (!this.searchVal) {
                return false
            }
            let that = this;
            if (this.searchVal) {
                this.visible = true;
            } else {
                this.visible = false;
            }
            this.$axios.post('/ChinaStock/GetChinaStockList', {
                SearchInfo: that.searchVal,
                ReportType: that.selectVal.value
            }).then(function (res) {
                that.serachList = res.data.Data;
            }).catch(function (err) {
                console.log('请求失败之后', err);
            });
        },
        clickToMessage() {
            // this.$router.push('/message')
            onclick = ClinkChatWeb.openSessionWindow()
        }
    },
    watch: {
        searchVal() {
            setTimeout(() => {
                console.log('监听改变');
                this.search()
            }, 20)
        }
    },
}
</script>
 
<style lang="less" scoped>
.search {
    // background: linear-gradient(to top, #E40A0A, #E56E6E);
    background: linear-gradient(to top, #03a2e9, #09a2e9);
    height: 100vh;
    padding: 150px 15px 0;
    position: relative;
 
    .logo {
        height: 0.8rem;
 
        img {
            display: block;
            height: 100%;
            margin: auto;
        }
    }
 
    .name {
        font-size: 36px;
        text-align: center;
        font-weight: bolder;
        color: #fff;
        margin: 10px 0;
    }
 
    .input {
        height: 40px;
        width: 100%;
        display: flex;
        background-color: #fff;
        border-radius: 20px;
 
        .draw {
            width: 100px;
            height: 100%;
            line-height: 40px;
            text-align: center;
 
            i.ionfont {
                font-size: 12px;
            }
        }
 
        .keyval {
            width: calc(100% - 100px);
 
            input {
                display: block;
                width: 100%;
                height: 100%;
                background-color: transparent;
            }
        }
    }
 
    .list {
        padding: 0 10px;
        width: 80%;
        max-height: 50%;
        overflow: auto;
        margin: 0 auto;
        background-color: #fff;
        border-bottom-right-radius: 6px;
        border-bottom-left-radius: 6px;
        position: absolute;
        left: 10%;
        z-index: 99;
 
        li:nth-last-of-type(1) {
            border-bottom: none;
        }
 
        li {
            height: 40px;
            line-height: 40px;
            width: 100%;
            border-bottom: 1px solid #ddd;
 
            span:nth-child(1) {
                font-size: 14px;
                margin-right: 10px;
            }
 
            span:nth-child(2) {
                color: #666;
            }
        }
    }
 
    .pick {
        max-width: 650px;
        right: 0;
        margin: auto;
    }
 
    .to-message {
        width: 100%;
        text-align: center;
        padding: 10px 0;
        position: fixed;
        bottom: 10px;
        // background-color: #e41616;
        z-index: 9;
 
        u {
            color: white;
            padding-bottom: 2px;
            line-height: 14px;
        }
    }
}
 
.loadingbox {
    position: absolute;
    width: 140px;
    height: 140px;
    overflow: auto;
    top: 0;
    left: 100px;
    z-index: 999999;
    //background-color: darkgray;
    //opacity: 0.9;
 
    .loading {
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 99999;
    }
}
 
.pointer {
    cursor: pointer;
}
</style>