1 Star 0 Fork 0

橙暖不冬 / qutoutiao

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index-1.html 11.89 KB
一键复制 编辑 原始数据 按行查看 历史
橙暖不冬 提交于 2020-09-15 17:11 . 提交
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"
/>
<meta name="format-detection" content="telephone=no" />
<title>首页</title>
<link rel="stylesheet" type="text/css" href="css/aui.css" />
<link rel="stylesheet" type="text/css" href="css/ffxiang.css" />
<link rel="stylesheet" type="text/css" href="css/footer.css" />
<style>
#fx-header {
margin-bottom: 0px;
padding-bottom: 32px;
border-bottom: 1px solid #E2E2E2;
}
</style>
</head>
<body>
<header class="aui-bar aui-bar-nav" id="fx-header">
<div class="fx-header-logo">
<a class="aui-pull-left">
<span class="aui-iconfont aui-icon-left"></span>
</a>
<div class="aui-title" style="left:5rem; right: 0.2rem;" tapmode onclick="search()">
<div class="aui-searchbar" id="search">
<div class="aui-searchbar-input aui-border-radius">
<i class="aui-iconfont aui-icon-search"></i>
<input type="search" placeholder="搜索关键词" id="search-input" readonly>
</div>
</div>
</div>
</div>
<!--暂时后期开发-->
<!--<div class="fx-right-jia" tapmode onclick="_url('jiatypeid_win','','1')">
<i class="aui-iconfont aui-icon-plus"></i>
</div>-->
</header>
<footer class="aui-bar aui-bar-tab" id="fx-footer">
<div class="aui-bar-tab-item aui-active">
<img class="aui-img-object" src="image/w1s.png" />
<div class="aui-bar-tab-label">
主页
</div>
</div>
<div class="aui-bar-tab-item" tapmode onclick="_index_win('video_win')">
<img class="aui-img-object" src="image/w2.png" />
<div class="aui-bar-tab-label">
视频
</div>
</div>
<div class="aui-bar-tab-item" tapmode onclick="_index_win('weitoutiao_win')">
<img class="aui-img-object" src="image/w3.png" />
<div class="aui-bar-tab-label">
趣交流
</div>
</div>
<!--<div class="aui-bar-tab-item" tapmode onclick="_index_win('xiaoshipin_win')">
<img class="aui-img-object" src="image/w5.png" />
<div class="aui-bar-tab-label">
小视频
</div>
</div>-->
<div class="aui-bar-tab-item" tapmode onclick="_index_win('member_win')">
<img class="aui-img-object" src="image/w4.png" />
<div class="aui-bar-tab-label">
会员
</div>
</div>
</footer>
</body>
<script type="text/javascript" src="script/api.js"></script>
<script type="text/javascript" src="script/ffxiang.js"></script>
<script type="text/javascript">
var body_h;
var headerPos;
var typeid;
var NVNavigationBar;
// 分类栏目模块
var heiff = 35;
var activity
var likaitime = 60000; //1000=1秒
var time
//输入35会显示右侧点击
apiready = function () {
api.addEventListener({
name: 'keyback'
}, function () {
// alert(1111)
api.closeWidget({
id: 'A6925751383007',
retData: {
name: 'closeWidget'
},
animation: {
type: 'flip',
subType: 'from_bottom',
duration: 500
},
silent: true
})
})
NVNavigationBar = api.require('NVNavigationBar');
if (!$api.getStorage('yindaotu')) {
_openFrame('yindaotu')
} else {
dat()
}
// _url({index:1},'member/ScLs_win',true)
// 回到屏幕
api.addEventListener({
name: 'viewappear'
}, function (ret, err) {
_heibai();
api.setFullScreen({
fullScreen: false
});
// 2018年3月10日 22:09:31 增加
// 每日登录奖励
_daily({
name: 'money_login'
})
// 每日阅读5篇奖励
//_daily({name:'money_news'})
});
_heibai();
api.addEventListener({
name: 'smartupdatefinish'
}, function (ret, err) {
alert('APP自动修复完成,需要重启APP才能生效');
api.rebootApp();
});
// 监听夜间
api.addEventListener({
name: 'yejian'
}, function (ret, err) {
if (ret) {
_yejians();
}
});
//应用进入后台事件
api.addEventListener({
name: 'pause'
}, function (ret, err) {
time = Date.parse(new Date());
time = time + likaitime
$api.setStorage('time', time);
});
// 应用从后台回到前台事件
api.addEventListener({
name: 'resume'
}, function (ret, err) {
time = Date.parse(new Date());
if ($api.getStorage('time')) {
if (time > $api.getStorage('time')) {
ad()
}
}
});
}
function view() {
header = $api.byId('fx-header');
$api.fixStatusBar(header);
headerPos = $api.offset(header);
body_h = $api.offset($api.dom('body')).h;
$api.fixTabBar($api.byId('fx-footer'))
footerh = $api.offset($api.byId('fx-footer')).h;
footerh = footerh - 5
var ret = $api.getStorage('typeid');
// 获取上架显示
_shangjia()
// 2018年3月1日 13:35:28 增加获取配置
_config();
// 配置结束
if (ret) {
api.closeFrame({
name: 'error'
});
console.log(headerPos.h)
typeid = ret.typeid // 获取分类json
// 读取栏目分类模块
NVNavigationBar.open({
rect: {
x: 0,
y: headerPos.h - 36,
w: api.frameWidth,
h: heiff
},
styles: {
orientation: 'horizontal',
bg: '#fff',
bgAlpha: 1,
font: {
size: 17,
sizeSelected: 18,
color: '#222222',
colorSelected: '#D43D3D',
alpha: 1
},
itemSize: {
w: 50,
h: heiff
}
},
items: ret.data,
selectedIndex: 0,
fixedOn: api.frameName,
id: 'first'
}, function (ret, err) {
console.log(JSON.stringify(ret))
// UILoadingClose();
if (ret.eventType == 'click') {
randomSwitchBtn(ret.index)
}
if (ret.eventType == 'show') {
UILoadingClose()
if ($api.getStorage('city')) {
updateItem()
} else {
cityAjax()
}
}
});
// 读取frm文件
var frames = [];
for (var i = 0; i < typeid.length; i++) {
var frame = {};
frame.name = 'frame_' + i;
frame.url = html_win + 'ffxiang_frm.html';
frame.pageParam = {
id: typeid[i],
};
// frame.vScrollBarEnabled = false;
// frame.hScrollBarEnabled = false;
frames.push(frame);
frames.useWKWebView = true;
frames.historyGestureEnabled = true;
}
openFrameGroup(frames);
// 上面全部加载完毕解析 属性 不然点击按钮会有延时300
api.parseTapmode();
} else {
api.openFrame({
name: 'error',
url: html_win + 'error.html',
bounces: false,
rect: {
x: 0,
y: 0,
w: 'auto',
h: 'auto'
},
useWKWebView: true,
historyGestureEnabled: true,
vScrollBarEnabled: false,
hScrollBarEnabled: false,
})
//alert(JSON.stringify(err))
}
}
function openFrameGroup(frames) {
api.openFrameGroup({
name: 'ffxiang_frm',
scrollEnabled: true,
rect: {
x: 0,
y: headerPos.h + heiff - 35,
w: 'auto',
h: body_h - headerPos.h - heiff + 30 - footerh,
},
index: 1,
frames: frames,
preload: 0, // 预加载的 frame 个数,默认加载当前页后面一个
}, function (ret, err) {
// 当滑动时,设置栏目选中颜色
NVNavigationBar.setSelected({
id: 'first',
index: ret.index,
selected: true
});
retindex = ret.index
});
}
// 点击分类栏目时,设置 frame 组当前可见 frame
function randomSwitchBtn(index) {
api.setFrameGroupIndex({
name: 'ffxiang_frm',
index: index,
scroll: true, //是否平滑滚动至目标窗口,即是否带有动画
//reload:true, // 刷新
});
}
// 读取会员信息
function _user() {
api.sendEvent({
name: 'ffxiangUser',
extra: {
user: $api.getStorage('user'),
}
});
}
// 搜索
function search() {
api.openWin({
name: 'search_win',
url: html_win + 'search_win.html',
slidBackEnabled: false,
animation: {
type: "fade", //动画类型(详见动画类型常量)
subType: "from_right", //动画子类型(详见动画子类型常量)
duration: 300
},
pageParam: {
qian: 1,
fan: 0
}
});
}
// 打开提示
function UILoadings() {
var loading = new Array;
for (var i = 0; i < 39; i++) {
loading[i] = {
frame: 'widget://image/loading/' + (i + 1) + '.fw.png'
};
}
UILoading = api.require('UILoading');
UILoading.keyFrame({
rect: {
w: api.winWidth,
h: api.winHeight
},
styles: {
bg: '#fff',
corner: 0,
interval: 39,
frame: {
w: 247,
h: 271
}
},
content: loading,
mask: '#fff'
}, function (ret) {});
}
// 关闭提示
function UILoadingClose() {
UILoading.closeKeyFrame();
}
// 夜间
function yejian() {
api.sendEvent({
name: 'yejian',
extra: {
yejian: '1',
}
});
}
// 首次获取城市定位
function cityAjax() {
var baiduLocation = api.require('baiduLocation');
baiduLocation.startLocation({}, function (ret, err) {
if (ret.status) {
var latitude = ret.latitude
var longitude = ret.longitude
if (latitude && longitude) {
_ajax('api/index/cityDingwei', function (ret, err) {
if (ret) {
if (ret.ret) {
// alert('latitude:'+latitude+"\r\nlongitude:"+longitude+"\r\nret:"+JSON.stringify(ret.ret))
ret = ret.ret
$api.setStorage('city', encodeURIComponent(encodeURIComponent(ret)));
updateItem(ret)
}
}
}, {
latitude: latitude,
longitude: longitude
})
}
}
});
}
// 更新栏目城市
function updateItem(ret) {
ret = ret ? ret : decodeURIComponent(decodeURIComponent($api.getStorage('city')));
if (!ret || ret == "") {
return;
}
if (ret == 'undefined') {
ret = '本地'
}
var w = typeidstrlen(ret);
NVNavigationBar.updateItem({
id: 'first',
index: 2,
item: {
title: ret,
bgSelected: '#fff',
bg: '#fff',
size: {
w: w,
h: heiff
}
}
});
}
// 更新选择城市新闻
function cityNews() {
updateItem()
api.execScript({
frameName: 'frame_2',
script: 'cityNews()'
});
NVNavigationBar.setSelected({
id: 'first',
index: 2,
selected: true
});
}
// 分类取出长度
function typeidstrlen(str) {
if (str.length < 3) {
return 50;
}
var len = 0;
for (var i = 0; i < str.length; i++) {
var c = str.charCodeAt(i);
//单字节加1
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
len++;
} else {
len += 3;
}
}
return Math.ceil(len * 8.3333333);
}
// 广告
function ad() {
if ($api.getStorage('ad') && $api.getStorage('adimage')) {
api.openWin({
name: 'ad',
url: html_win + 'ad.html',
reload: true,
bounces: false,
animation: {
type: "none", //动画类型(详见动画类型常量)
subType: "from_bottom", //动画子类型(详见动画子类型常量)
duration: 300
},
});
} else {
adAjax()
}
}
function adAjax() {
_ajax('api/article/ad', function (ret, err) {
if (ret) {
if (ret.ret) {
console.log(JSON.stringify(ret.ret));
$api.setStorage('ad', ret.ret);
console.log(fx_cdn + ret.ret.data.image)
api.imageCache({
url: fx_cdn + ret.ret.data.image,
thumbnail: false,
}, function (ret, err) {
if (ret) {
if (ret.status) {
console.log(ret.url);
$api.setStorage('adimage', ret.url);
}
}
});
return;
}
}
$api.rmStorage('ad')
$api.rmStorage('adimage')
})
}
// 获取配置
function _config() {
_ajax('api/article/config', function (ret, err) {
if (ret) {
// console.log(JSON.stringify(ret));
$api.setStorage('config', ret);
// _index_win('member_win')
} else {
alert(JSON.stringify(err));
}
})
}
// 获取上架记录
function _shangjia() {
_ajax('api/index/pingguoApp', function (ret, err) {
if (ret) {
$api.setStorage('app', '1');
} else {
$api.rmStorage('app')
}
})
}
// 更新用户信息
function _userInfo() {
console.log('用户更新成功拉!')
_user = $api.getStorage('user')
if (!_user) {
return;
}
_ajax('api/member/info', function (ret, err) {
if (ret) {
$api.setStorage('user', ret.ret);
}
})
}
function dat() {
UILoadings()
view();
ad()
}
</script>
</html>
1
https://gitee.com/sudongdong/qutoutiao.git
git@gitee.com:sudongdong/qutoutiao.git
sudongdong
qutoutiao
qutoutiao
master

搜索帮助