notification.blade.php
2.48 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
@extends('layout')
@section('title', $title)
@pushonce('style')
    <style>
        img {
            height: auto !important;
            max-width: 100%;
            object-fit: contain;
        }
        video {
            max-width: 100%;
            height: auto !important;
            display: block;
            margin: 0 auto;
        }
    </style>
@endpushonce
@section('body')
    <body style="padding: 10px;font-size: 14px">
    {!! $rich_content !!}
    </body>
@endsection
@pushonce('script')
    <script type="text/javascript" src="https://hising-cdn.hikoon.com/vendor/jweixin-1.3.2.js" defer></script>
    <script lang="ts">
        const isInWechatMP = () => {
            return (navigator.userAgent.match(/micromessenger/i) && navigator.userAgent.match(/miniprogram/i)) || window.__wxjs_environment === 'miniprogram';
        };
        const isAndroid = () => {
            return (navigator.userAgent.indexOf('Android') > -1 || navigator.userAgent.indexOf('Adr') > -1) && window.android?.invokeFun;
        }
        const isIos = () => {
            return (!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) && window.webkit?.messageHandlers?.invokeFun
        }
        function toShow(type, id) {
            if (isInWechatMP()) {
                return wx.miniProgram.navigateTo({url: `/packageApp/pages/h5/index?type=${type}&id=${id}`});
            }
            if (isAndroid()) {
                return window.android.invokeFun(type, id)
            }
            if (isIos()) {
                return window.webkit.messageHandlers.invokeFun.postMessage({type, id});
            }
        }
        [].forEach.call(document.querySelectorAll('video'), function (el) {
            el.setAttribute('playsinline', true);
            el.setAttribute('webkit-playsinline', true);
        });
        [].forEach.call(document.querySelectorAll('span[data-w-e-type="user-card"]'), function (el) {
            el.addEventListener('click', (e) => toShow('user', e.currentTarget.getAttribute('data-id')));
        });
        [].forEach.call(document.querySelectorAll('span[data-w-e-type="project-card"]'), function (el) {
            el.addEventListener('click', (e) => toShow('project', e.currentTarget.getAttribute('data-id')));
        });
        [].forEach.call(document.querySelectorAll('span[data-w-e-type="activity-card"]'), function (el) {
            el.addEventListener('click', (e) => toShow('activity', e.currentTarget.getAttribute('data-id')));
        });
    </script>
@endpushonce