chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
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
{yun:}include file="$wapstyle/header.htm"{/yun}
 
<link rel="stylesheet" href="{yun:}$config.sy_weburl{/yun}/app/template/wap/css/css.css?v={yun:}$config.cachecode{/yun}" type="text/css">
<link href="{yun:}$config_wapdomain{/yun}/js/vant/lib/index.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" />
 
<header class="nav_bar">
    <div class="header_bg">
        <a class="hd-lbtn" href="javascript:goBack();"><i class="header_top_l iconfont"></i></a>
        <div class="header_h1" style=" line-height:30px">{yun:}$headertitle{/yun}</div>
    </div>
</header>
 
<div id="app" class="none">
    <van-search v-model="searchKey" placeholder="搜索分站" ></van-search>
            
    <van-index-bar :index-list="indexList" :sticky='false'>
    
        <van-cell v-show="allShow">
            <a href="javascript:void(0)" onclick="setsite('-1','')">{yun:}$config.sy_indexcity{/yun}</a>
        </van-cell>
        <template v-if="cityShow">
            <template :index="cityKey" v-for="(cityValue,cityKey) in filterTex(searchKey, 1)">
                <div>
                    <van-index-anchor v-if="cityValue != ''">{{cityKey}}</van-index-anchor>
                    <van-cell :index="item.name" v-for="(item,index) in cityValue" @click="changeSite(item.url)">
                        {{item.name}}
                    </van-cell>
                </div> 
            </template>
        </template>
    
 
        <div v-show="hyShow">
            <van-index-anchor >行业分站</van-index-anchor>
            <van-cell :index="hyKey" v-for="(item,hyKey) in filterTex(searchKey, 2)" @click="changeSite(item.url)">
                {{item.hyname}}
            </van-cell>
        </div>
    </van-index-bar>
</div>
 
<script>var weburl="{yun:}$config.sy_weburl{/yun}",wapurl="{yun:}url m=wap{/yun}";</script>
{yun:}include file="$wapstyle/publichtm/public_js.htm"{/yun}
<script type="text/javascript" charset="utf-8">
 
function setsite(cityid,name){
    $.post("{yun:}url m=wap c=site a=domain{/yun}",{cityid:cityid,cityname:name},function(data){
        window.location.href=wapurl;
    });
}
var arr = {};
 
var vm = new Vue({
        el: '#app',
        name:"list",
        data: {
            cityList:[],
            indexList:[],
            hyList:[],
            searchKey:'',
            cityShow:true,
            hyShow:true,
            allShow:true,
        },
        created() {
            this.getSite()
        },
        methods: {
            getSite(){
                let self = this;
                $.post('index.php?c=site&a=cache',{rand: Math.random()}, function(res){
                    self.cityList = res.city;
                    self.hyList = res.hy;
                    $.each(res.city, function(index, item){
                        self.indexList.push(index); 
                    });
                    $('#app').css('display','block');
                },'json');
            },
            filterTex(indexKey, flag){
                var $this=this;
                var isReturn = false;
                let newCityArray = newHyArray = {};
                $this.allShow = indexKey ? false : true;
                if (flag == 1) {            
                    if (indexKey) {
                        $.each(this.cityList, function(index, citys){
                            newCityArray[index] = citys.filter(function(item, index){
                                if (item.name.includes(indexKey)) {
                                    return item;        
                                }
                            })
                        });
                        $.each(newCityArray, function(index, item){
                            if (item != '') {
                                isReturn = true;
                                return;
                            }
                        });
                        
                        if (isReturn) {
                            $this.hyShow = false;
                            return newCityArray;
                        }
                    } else {
                        $this.hyShow = true;
                        return $this.cityList;
                    }
                } else {
                    if (indexKey) {
                        newHyArray = this.hyList.filter(function(item){
                            if (item.hyname.includes(indexKey)) {
                                return item;
                            }
                        });
                        $this.hyShow = newHyArray != '' ? true : false;
                        if (newHyArray) {
                            return newHyArray;
                        }
                    } else {
                        $this.cityShow = true;
                         return $this.hyList;
                    }
                }
            },
            changeSite(url){
                window.location.href = url;
            }
        }
    });
 
</script> 
 
</body>
</html>