1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{271:function(t,a,s){t.exports=s.p+"assets/img/webgame.1d6ec041.png"},272:function(t,a,s){t.exports=s.p+"assets/img/cms61.6d86a7fd.png"},273:function(t,a,s){t.exports=s.p+"assets/img/webgame1.6820a5c3.png"},291:function(t,a,s){"use strict";s.r(a);var n=s(13),e=Object(n.a)({},(function(){var t=this,a=t._self._c;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h1",{attrs:{id:"多玩游戏大厅-珠海页游"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#多玩游戏大厅-珠海页游"}},[t._v("#")]),t._v(" 多玩游戏大厅(珠海页游)")]),t._v(" "),a("blockquote",[a("p",[t._v("多玩游戏大厅是 fis3 构建和打包(Webpack 不支持 IE8),通过 avalon 配合 JQuery 实现视图的逻辑(Vue 和 React 都不支持)。页面跳转是通过多页面实现的(不是一个单页面应用)。")])]),t._v(" "),a("h2",{attrs:{id:"开发人员"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#开发人员"}},[t._v("#")]),t._v(" 开发人员")]),t._v(" "),a("ul",[a("li",[t._v("康志鸿 百醇 唐喜君 杜文华")])]),t._v(" "),a("h2",{attrs:{id:"项目地址"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#项目地址"}},[t._v("#")]),t._v(" 项目地址")]),t._v(" "),a("ul",[a("li",[t._v("svn://svn.webdev.ouj.com/biz/page_game/trunk/web")])]),t._v(" "),a("h2",{attrs:{id:"技术栈"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#技术栈"}},[t._v("#")]),t._v(" 技术栈")]),t._v(" "),a("ul",[a("li",[t._v("环境依赖 : node6+ , fis3 ,mod.js")]),t._v(" "),a("li",[t._v("开发技术 : JQuery , avalon, sass")])]),t._v(" "),a("h2",{attrs:{id:"项目域名"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#项目域名"}},[t._v("#")]),t._v(" 项目域名")]),t._v(" "),a("table",[a("thead",[a("tr",[a("th",[t._v("环境")]),t._v(" "),a("th",[t._v("域名")])])]),t._v(" "),a("tbody",[a("tr",[a("td",[t._v("正式环境")]),t._v(" "),a("td",[a("a",{attrs:{href:"http://wan.ouj.com",target:"_blank",rel:"noopener noreferrer"}},[t._v("http://wan.ouj.com"),a("OutboundLink")],1)])]),t._v(" "),a("tr",[a("td",[t._v("测试环境")]),t._v(" "),a("td",[a("a",{attrs:{href:"http://test-wan.ouj.com",target:"_blank",rel:"noopener noreferrer"}},[t._v("http://test-wan.ouj.com"),a("OutboundLink")],1)])]),t._v(" "),a("tr",[a("td",[t._v("预发环境")]),t._v(" "),a("td",[a("a",{attrs:{href:"http://new-wan.ouj.com",target:"_blank",rel:"noopener noreferrer"}},[t._v("http://new-wan.ouj.com"),a("OutboundLink")],1)])])])]),t._v(" "),a("h2",{attrs:{id:"node版本"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#node版本"}},[t._v("#")]),t._v(" node版本")]),t._v(" "),a("blockquote",[a("p",[t._v('"node": "6.11.5"')])]),t._v(" "),a("h2",{attrs:{id:"项目结构"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#项目结构"}},[t._v("#")]),t._v(" 项目结构")]),t._v(" "),a("div",{staticClass:"language-Text extra-class"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[t._v("|- src\n |- api --- 通用的http请求api(封装http请求)\n |- modules --- 按模块分类的api\n |- assets --- 静态资源文件(图片)\n |- components --- 不同模块对应的小组件\n |- lib --- 项目引入的第三方库\n |- mixins --- 全局混合(按需引入)\n |- modules --- 封装的插件(lazhload,md5,qrcode...)\n |- page --- 页面代码\n |- bt --- bt页游\n |- fcm --- 防沉迷\n |- hezi --- 目前dnf旧版&新版盒子,lol盒子,坦克世界盒子左侧游戏tab入口(2个尺寸)\n |- lolbox --- lol盒子和旧版dnf\n |- box --- 坦克世界盒子和新版dnf\n |- index --- 首页\n |- popup --- 多玩游戏大厅盒子-内嵌webview弹窗页面\n |- propCenter --- 道具中心-主要入口为运营推广广告\n |- self --- 多玩游戏大厅盒子-左侧个人中心\n |- agreement.html --- 多玩游戏充值协议\n |- asset.html --- 各页面通用配置-若js没有<!--ignore--\x3e标志会自动编译到下面的\n |- index.html --- 首页\n |- list.html --- 游戏列表-精品游戏\n |- sdk --- 全局对象DW_APP_SDK 用于调用SDK的API\n |- style --- 样式表(components,modules,page)\n |- tpl --- 模板\n|- typeing --- 类型检查\n|- eslintrc.js --- eslint配置文件\n|- fis-conf.js --- fis配置文件\n")])])]),a("h2",{attrs:{id:"sdk"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#sdk"}},[t._v("#")]),t._v(" sdk")]),t._v(" "),a("p",[a("code",[t._v("sdk/index")]),t._v("文件保存全局方法,分别给游戏大厅,游戏盒子交互的。")]),t._v(" "),a("h2",{attrs:{id:"混入方法"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#混入方法"}},[t._v("#")]),t._v(" 混入方法")]),t._v(" "),a("p",[a("code",[t._v("mixins/index")]),t._v("文件是全局混入的方法,在 avalon 定义 VM 的时候要通过 underscore 的 extend 方法扩展。")]),t._v(" "),a("div",{staticClass:"language-JS extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" _ "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"underscore"')]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" vm "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" avalon"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("define")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("extend")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token template-string"}},[a("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("mixins(这里加mixins的内容)")]),a("span",{pre:!0,attrs:{class:"token template-punctuation string"}},[t._v("`")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("提供公共方法")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[t._v("checkLogin "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("--")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),t._v(" 检测页面登录态\nonEnterGame "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("--")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),t._v("进入游戏(要登录态)\nonEnterGameWithoutLogin "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("--")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),t._v("进入游戏(不检测登录)\nonChoiceServer "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("--")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),t._v("选服\n")])])]),a("h2",{attrs:{id:"上报方式"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#上报方式"}},[t._v("#")]),t._v(" 上报方式")]),t._v(" "),a("p",[t._v("1.多玩通用统计-目前用于自定义页游广告点击")]),t._v(" "),a("p",[t._v("2.大厅统计 pv/uv 地方加上 date-gid,data-poskey,data-dwgameclick 标志,对应的方法")]),t._v(" "),a("p",[a("a",{attrs:{href:"../image/webgame.png"}},[a("img",{attrs:{src:s(271),alt:"avatar"}})])]),t._v(" "),a("p",[t._v("3.loginGame 接口里面第三个参数(userSource)标志用户的来源,做到上报的")]),t._v(" "),a("div",{staticClass:"language-JS extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("getLoginGame")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" gid"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" sid"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" userSource "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" ax"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("get")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/loginGame.do'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("params")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" gid"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" sid"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" userSource "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("4.游戏页")]),t._v(" "),a("ul",[a("li",[a("strong",[t._v("任务上报")]),t._v(" 判断是否有 channel 参数(道具中心来源),然后获取道具中心的对应任务,匹配则在结束时上报")]),t._v(" "),a("li",[a("strong",[t._v("时长上报")]),t._v(" 关闭浏览器 tab 页时上报游戏时长,暴露上报方法给大厅盒子检测用户关闭时调用上报")])]),t._v(" "),a("p",[t._v("5....")]),t._v(" "),a("h2",{attrs:{id:"充值"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#充值"}},[t._v("#")]),t._v(" 充值")]),t._v(" "),a("p",[t._v("1.充值页,大厅盒子充值弹框,游戏页充值弹框都为同一个组件")]),t._v(" "),a("p",[t._v("2.默认帮用户选择游戏和区服(通过链接的&game_code=DZ&server_code=s4 主动选择)")]),t._v(" "),a("p",[t._v("3.初始化方法暴露了一个 initPayPopup 方法,主要用于引入的页面主动调起初始化,避免多余请求")]),t._v(" "),a("p",[t._v("4.微信支付是后端返回一个支付链接前端生成二维码,支付宝支付则是后端返回支付宝的页面,前端通过 iframe 引入再用 css 调整显示二维码位置")]),t._v(" "),a("h2",{attrs:{id:"游戏页"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#游戏页"}},[t._v("#")]),t._v(" 游戏页")]),t._v(" "),a("p",[t._v("1.iframe 引入游戏页面,游戏链接都是有时效性&登录态的,故从接口拿")]),t._v(" "),a("p",[t._v("2.里面含上报,任务上报和时长上报(看上面上报那点)")]),t._v(" "),a("h2",{attrs:{id:"广告"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#广告"}},[t._v("#")]),t._v(" 广告")]),t._v(" "),a("p",[t._v("广告部分暂时有两个自定义的广告位置,一个是右上角的,有个是右边侧边栏,对应接口是一个静态的 JSON 文件。修改图片链接或者是其他都在 JSON 文件中直接修改")]),t._v(" "),a("p",[t._v("模板位置:")]),t._v(" "),a("p",[a("img",{attrs:{src:s(272),alt:"avatar"}})]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 多玩游戏大厅/模板管理/广告数据")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("jsonp_dwDa")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//web顶部导航-图文广告300*76")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("headerRight")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"xx"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("clientLink")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"http://www.duowan.com/"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 客户端打开的链接")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("webLink")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"http://pgame.duowan.com/dwgame.html"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// web downLoad的链接")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("img")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"http://img.dwstatic.com/yxdt/adPic/1907topright.png"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("report")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"dwgame_nav_youshangjiao"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//上报id")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//主页-右侧广告-宽250")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("mainRight")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("title")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"xx"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("clientLink")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"dwgame://yygame"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 客户端打开的链接")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("webLink")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"http://wan.yy.com/"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// web 打开的链接")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("img")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"http://img.dwstatic.com/yxdt/adPic/1906right.jpg"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("report")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"dwgame_main_youce"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//上报id")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),a("ul",[a("li",[t._v("在发布器中,对应项目中的模板中会可以看到对应的广告。增加广告或者是删除广告等。")])]),t._v(" "),a("p",[a("a",{attrs:{href:"../image/webgame1.png"}},[a("img",{attrs:{src:s(273),alt:"avatar"}})])]),t._v(" "),a("h2",{attrs:{id:"备注"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#备注"}},[t._v("#")]),t._v(" 备注")]),t._v(" "),a("h3",{attrs:{id:"项目启动"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#项目启动"}},[t._v("#")]),t._v(" 项目启动")]),t._v(" "),a("ul",[a("li",[t._v("安装选择的时候直接选 fis-parser-node-sass")]),t._v(" "),a("li",[t._v("配置 host,需要多玩域记录登录状态")])]),t._v(" "),a("div",{staticClass:"language-Text extra-class"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[t._v("// hosts文件在C:\\Windows\\System32\\drivers\\etc\n127.0.0.1 yournickname.duowan.com\n")])])]),a("h3",{attrs:{id:"fis-的语法"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#fis-的语法"}},[t._v("#")]),t._v(" fis 的语法")]),t._v(" "),a("ul",[a("li",[a("p",[a("code",[t._v("?__inline")]),t._v("可以实现对整个外部文件的引入,eg:html")])]),t._v(" "),a("li",[a("p",[a("code",[t._v("background(url?__sprite)")]),t._v("实现对图片进行整合成雪碧图")])])]),t._v(" "),a("h3",{attrs:{id:"暂时遇到的坑-或者你有更好的解决方法-欢迎提-issue"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#暂时遇到的坑-或者你有更好的解决方法-欢迎提-issue"}},[t._v("#")]),t._v(" 暂时遇到的坑(或者你有更好的解决方法,欢迎提 issue)")]),t._v(" "),a("p",[t._v("1.游戏是通过 iframe 承载的,元素分为窗口元素和无窗口元素,在 ie 下窗口元素在最高层级的,设置 z-index 都是无效的,假如需要在游戏上面添加覆盖元素,要将覆盖的元素最下方添加一个空的 iframe")]),t._v(" "),a("p",[a("strong",[a("em",[t._v("参考")])]),t._v(" web 端游戏页游戏助手")]),t._v(" "),a("p",[t._v("2.上报的时候,在点击关闭的时候触发 onbeforeunload 的方法。这个方法在 JQuery 引入的情况下,Chrome,Firefox 浏览器都不能直接使用要套在 JQuery 方法里面才能使用")]),t._v(" "),a("div",{staticClass:"language-JS extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token function"}},[t._v("$")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("window"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("load")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n window"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("onunload")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n _this"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("gameReport")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Are you sure"')]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("3.window.open 打开异步获取的链接或被浏览器 adblock 拦截")]),t._v(" "),a("ul",[a("li",[a("strong",[t._v("失败尝试 1")]),t._v(" - 异步前先打开一个空窗口,然后在 window 赋值,在普通浏览器可以解决被 adblock 拦截的情况 "),a("strong",[a("em",[t._v("但是")])]),t._v(" 在盒子赋值打开的链接不是同一个浏览器了,window 的对象已经发生改变,导致用户访问了一个空白页面")]),t._v(" "),a("li",[a("strong",[t._v("失败尝试 2")]),t._v(" - 加个 a 标签动态赋值,然后 js 模拟点击,尝试打开 "),a("strong",[a("em",[t._v("结果")])]),t._v(" 依旧被 adblock 拦截")])])])}),[],!1,null,null,null);a.default=e.exports}}]);
|