123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <!DOCTYPE html>
- <html lang="en-US">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
- <title>多玩游戏大厅(珠海页游) | 偶游前端</title>
- <meta name="generator" content="VuePress 1.9.7">
-
- <meta name="description" content="">
-
- <link rel="preload" href="/docs/assets/css/0.styles.d94ea0ab.css" as="style"><link rel="preload" href="/docs/assets/js/app.2431a00a.js" as="script"><link rel="preload" href="/docs/assets/js/2.f7777874.js" as="script"><link rel="preload" href="/docs/assets/js/3.a1131818.js" as="script"><link rel="prefetch" href="/docs/assets/js/10.9d1aad53.js"><link rel="prefetch" href="/docs/assets/js/11.30b895bf.js"><link rel="prefetch" href="/docs/assets/js/12.875be95c.js"><link rel="prefetch" href="/docs/assets/js/13.5a9efc48.js"><link rel="prefetch" href="/docs/assets/js/14.b907632b.js"><link rel="prefetch" href="/docs/assets/js/15.4905f579.js"><link rel="prefetch" href="/docs/assets/js/16.76ac9ec7.js"><link rel="prefetch" href="/docs/assets/js/17.2ddbc696.js"><link rel="prefetch" href="/docs/assets/js/18.38ed2bd0.js"><link rel="prefetch" href="/docs/assets/js/19.29f587ce.js"><link rel="prefetch" href="/docs/assets/js/20.fedca497.js"><link rel="prefetch" href="/docs/assets/js/21.70316301.js"><link rel="prefetch" href="/docs/assets/js/22.d06b9c4f.js"><link rel="prefetch" href="/docs/assets/js/23.cfe38809.js"><link rel="prefetch" href="/docs/assets/js/24.ca50f3c1.js"><link rel="prefetch" href="/docs/assets/js/4.d31729fa.js"><link rel="prefetch" href="/docs/assets/js/5.4e04916d.js"><link rel="prefetch" href="/docs/assets/js/6.91b60684.js"><link rel="prefetch" href="/docs/assets/js/7.467cbd0c.js"><link rel="prefetch" href="/docs/assets/js/8.de63b438.js"><link rel="prefetch" href="/docs/assets/js/9.d353de00.js">
- <link rel="stylesheet" href="/docs/assets/css/0.styles.d94ea0ab.css">
- </head>
- <body>
- <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/docs/" class="home-link router-link-active"><!----> <span class="site-name">偶游前端</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <!----></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/docs/" aria-current="page" class="sidebar-link">偶游前端(冯垣玮)</a></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>项目</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/docs/currentProgram/guide.html" class="sidebar-link">智能鞋落地页</a></li><li><a href="/docs/currentProgram/uni-app-pro.html" class="sidebar-link">智能鞋小程序商城</a></li><li><a href="/docs/currentProgram/customerService.html" class="sidebar-link">智能鞋客服系统</a></li><li><a href="/docs/currentProgram/tank.html" class="sidebar-link">坦克专题</a></li><li><a href="/docs/currentProgram/hiydMini.html" class="sidebar-link">hi运动教练小程序</a></li><li><a href="/docs/currentProgram/hiydShop.html" class="sidebar-link">hi运动商城</a></li><li><a href="/docs/currentProgram/webGame.html" aria-current="page" class="active sidebar-link">多玩游戏大厅</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#开发人员" class="sidebar-link">开发人员</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#项目地址" class="sidebar-link">项目地址</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#技术栈" class="sidebar-link">技术栈</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#项目域名" class="sidebar-link">项目域名</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#项目结构" class="sidebar-link">项目结构</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#sdk" class="sidebar-link">sdk</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#混入方法" class="sidebar-link">混入方法</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#上报方式" class="sidebar-link">上报方式</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#充值" class="sidebar-link">充值</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#游戏页" class="sidebar-link">游戏页</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#广告" class="sidebar-link">广告</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#备注" class="sidebar-link">备注</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#项目启动" class="sidebar-link">项目启动</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#fis-的语法" class="sidebar-link">fis 的语法</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/webGame.html#暂时遇到的坑-或者你有更好的解决方法-欢迎提-issue" class="sidebar-link">暂时遇到的坑(或者你有更好的解决方法,欢迎提 issue)</a></li></ul></li></ul></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="多玩游戏大厅-珠海页游"><a href="#多玩游戏大厅-珠海页游" class="header-anchor">#</a> 多玩游戏大厅(珠海页游)</h1> <blockquote><p>多玩游戏大厅是 fis3 构建和打包(Webpack 不支持 IE8),通过 avalon 配合 JQuery 实现视图的逻辑(Vue 和 React 都不支持)。页面跳转是通过多页面实现的(不是一个单页面应用)。</p></blockquote> <h2 id="开发人员"><a href="#开发人员" class="header-anchor">#</a> 开发人员</h2> <ul><li>康志鸿 百醇 唐喜君 杜文华</li></ul> <h2 id="项目地址"><a href="#项目地址" class="header-anchor">#</a> 项目地址</h2> <ul><li>svn://svn.webdev.ouj.com/biz/page_game/trunk/web</li></ul> <h2 id="技术栈"><a href="#技术栈" class="header-anchor">#</a> 技术栈</h2> <ul><li>环境依赖 : node6+ , fis3 ,mod.js</li> <li>开发技术 : JQuery , avalon, sass</li></ul> <h2 id="项目域名"><a href="#项目域名" class="header-anchor">#</a> 项目域名</h2> <table><thead><tr><th>环境</th> <th>域名</th></tr></thead> <tbody><tr><td>正式环境</td> <td><a href="http://wan.ouj.com" target="_blank" rel="noopener noreferrer">http://wan.ouj.com<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></td></tr> <tr><td>测试环境</td> <td><a href="http://test-wan.ouj.com" target="_blank" rel="noopener noreferrer">http://test-wan.ouj.com<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></td></tr> <tr><td>预发环境</td> <td><a href="http://new-wan.ouj.com" target="_blank" rel="noopener noreferrer">http://new-wan.ouj.com<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></td></tr></tbody></table> <h2 id="项目结构"><a href="#项目结构" class="header-anchor">#</a> 项目结构</h2> <div class="language-Text extra-class"><pre class="language-text"><code>|- src
- |- api --- 通用的http请求api(封装http请求)
- |- modules --- 按模块分类的api
- |- assets --- 静态资源文件(图片)
- |- components --- 不同模块对应的小组件
- |- lib --- 项目引入的第三方库
- |- mixins --- 全局混合(按需引入)
- |- modules --- 封装的插件(lazhload,md5,qrcode...)
- |- page --- 页面代码
- |- bt --- bt页游
- |- fcm --- 防沉迷
- |- hezi --- 目前dnf旧版&amp;新版盒子,lol盒子,坦克世界盒子左侧游戏tab入口(2个尺寸)
- |- lolbox --- lol盒子和旧版dnf
- |- box --- 坦克世界盒子和新版dnf
- |- index --- 首页
- |- popup --- 多玩游戏大厅盒子-内嵌webview弹窗页面
- |- propCenter --- 道具中心-主要入口为运营推广广告
- |- self --- 多玩游戏大厅盒子-左侧个人中心
- |- agreement.html --- 多玩游戏充值协议
- |- asset.html --- 各页面通用配置-若js没有&lt;!--ignore-->标志会自动编译到下面的
- |- index.html --- 首页
- |- list.html --- 游戏列表-精品游戏
- |- sdk --- 全局对象DW_APP_SDK 用于调用SDK的API
- |- style --- 样式表(components,modules,page)
- |- tpl --- 模板
- |- typeing --- 类型检查
- |- eslintrc.js --- eslint配置文件
- |- fis-conf.js --- fis配置文件
- </code></pre></div><h2 id="sdk"><a href="#sdk" class="header-anchor">#</a> sdk</h2> <p><code>sdk/index</code>文件保存全局方法,分别给游戏大厅,游戏盒子交互的。</p> <h2 id="混入方法"><a href="#混入方法" class="header-anchor">#</a> 混入方法</h2> <p><code>mixins/index</code>文件是全局混入的方法,在 avalon 定义 VM 的时候要通过 underscore 的 extend 方法扩展。</p> <div class="language-JS extra-class"><pre class="language-js"><code><span class="token keyword">import</span> _ <span class="token keyword">from</span> <span class="token string">"underscore"</span>
- <span class="token keyword">var</span> vm <span class="token operator">=</span> avalon<span class="token punctuation">.</span><span class="token function">define</span><span class="token punctuation">(</span>_<span class="token punctuation">.</span><span class="token function">extend</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
- <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">mixins(这里加mixins的内容)</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span>
- </code></pre></div><p>提供公共方法</p> <div class="language-js extra-class"><pre class="language-js"><code>checkLogin <span class="token operator">--</span><span class="token operator">-</span> 检测页面登录态
- onEnterGame <span class="token operator">--</span><span class="token operator">-</span>进入游戏(要登录态)
- onEnterGameWithoutLogin <span class="token operator">--</span><span class="token operator">-</span>进入游戏(不检测登录)
- onChoiceServer <span class="token operator">--</span><span class="token operator">-</span>选服
- </code></pre></div><h2 id="上报方式"><a href="#上报方式" class="header-anchor">#</a> 上报方式</h2> <p>1.多玩通用统计-目前用于自定义页游广告点击</p> <p>2.大厅统计 pv/uv 地方加上 date-gid,data-poskey,data-dwgameclick 标志,对应的方法</p> <p><a href="../image/webgame.png"><img src="/docs/assets/img/webgame.1d6ec041.png" alt="avatar"></a></p> <p>3.loginGame 接口里面第三个参数(userSource)标志用户的来源,做到上报的</p> <div class="language-JS extra-class"><pre class="language-js"><code> <span class="token function">getLoginGame</span> <span class="token punctuation">(</span><span class="token parameter"><span class="token punctuation">{</span> gid<span class="token punctuation">,</span> sid<span class="token punctuation">,</span> userSource <span class="token punctuation">}</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
- <span class="token keyword">return</span> ax<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">'/loginGame.do'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
- <span class="token literal-property property">params</span><span class="token operator">:</span> <span class="token punctuation">{</span> gid<span class="token punctuation">,</span> sid<span class="token punctuation">,</span> userSource <span class="token punctuation">}</span>
- <span class="token punctuation">}</span><span class="token punctuation">)</span>
- <span class="token punctuation">}</span>
- </code></pre></div><p>4.游戏页</p> <ul><li><strong>任务上报</strong> 判断是否有 channel 参数(道具中心来源),然后获取道具中心的对应任务,匹配则在结束时上报</li> <li><strong>时长上报</strong> 关闭浏览器 tab 页时上报游戏时长,暴露上报方法给大厅盒子检测用户关闭时调用上报</li></ul> <p>5....</p> <h2 id="充值"><a href="#充值" class="header-anchor">#</a> 充值</h2> <p>1.充值页,大厅盒子充值弹框,游戏页充值弹框都为同一个组件</p> <p>2.默认帮用户选择游戏和区服(通过链接的&game_code=DZ&server_code=s4 主动选择)</p> <p>3.初始化方法暴露了一个 initPayPopup 方法,主要用于引入的页面主动调起初始化,避免多余请求</p> <p>4.微信支付是后端返回一个支付链接前端生成二维码,支付宝支付则是后端返回支付宝的页面,前端通过 iframe 引入再用 css 调整显示二维码位置</p> <h2 id="游戏页"><a href="#游戏页" class="header-anchor">#</a> 游戏页</h2> <p>1.iframe 引入游戏页面,游戏链接都是有时效性&登录态的,故从接口拿</p> <p>2.里面含上报,任务上报和时长上报(看上面上报那点)</p> <h2 id="广告"><a href="#广告" class="header-anchor">#</a> 广告</h2> <p>广告部分暂时有两个自定义的广告位置,一个是右上角的,有个是右边侧边栏,对应接口是一个静态的 JSON 文件。修改图片链接或者是其他都在 JSON 文件中直接修改</p> <p>模板位置:</p> <p><img src="/docs/assets/img/cms61.6d86a7fd.png" alt="avatar"></p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">// 多玩游戏大厅/模板管理/广告数据</span>
- <span class="token function">jsonp_dwDa</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
- <span class="token comment">//web顶部导航-图文广告300*76</span>
- <span class="token literal-property property">headerRight</span><span class="token operator">:</span> <span class="token punctuation">{</span>
- <span class="token literal-property property">title</span><span class="token operator">:</span> <span class="token string">"xx"</span><span class="token punctuation">,</span>
- <span class="token literal-property property">clientLink</span><span class="token operator">:</span> <span class="token string">"http://www.duowan.com/"</span><span class="token punctuation">,</span> <span class="token comment">// 客户端打开的链接</span>
- <span class="token literal-property property">webLink</span><span class="token operator">:</span> <span class="token string">"http://pgame.duowan.com/dwgame.html"</span><span class="token punctuation">,</span> <span class="token comment">// web downLoad的链接</span>
- <span class="token literal-property property">img</span><span class="token operator">:</span> <span class="token string">"http://img.dwstatic.com/yxdt/adPic/1907topright.png"</span><span class="token punctuation">,</span>
- <span class="token literal-property property">report</span><span class="token operator">:</span> <span class="token string">"dwgame_nav_youshangjiao"</span> <span class="token comment">//上报id</span>
- <span class="token punctuation">}</span><span class="token punctuation">,</span>
- <span class="token comment">//主页-右侧广告-宽250</span>
- <span class="token literal-property property">mainRight</span><span class="token operator">:</span> <span class="token punctuation">{</span>
- <span class="token literal-property property">title</span><span class="token operator">:</span> <span class="token string">"xx"</span><span class="token punctuation">,</span>
- <span class="token literal-property property">clientLink</span><span class="token operator">:</span> <span class="token string">"dwgame://yygame"</span><span class="token punctuation">,</span> <span class="token comment">// 客户端打开的链接</span>
- <span class="token literal-property property">webLink</span><span class="token operator">:</span> <span class="token string">"http://wan.yy.com/"</span><span class="token punctuation">,</span> <span class="token comment">// web 打开的链接</span>
- <span class="token literal-property property">img</span><span class="token operator">:</span> <span class="token string">"http://img.dwstatic.com/yxdt/adPic/1906right.jpg"</span><span class="token punctuation">,</span>
- <span class="token literal-property property">report</span><span class="token operator">:</span> <span class="token string">"dwgame_main_youce"</span> <span class="token comment">//上报id</span>
- <span class="token punctuation">}</span>
- <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
- </code></pre></div><ul><li>在发布器中,对应项目中的模板中会可以看到对应的广告。增加广告或者是删除广告等。</li></ul> <p><a href="../image/webgame1.png"><img src="/docs/assets/img/webgame1.6820a5c3.png" alt="avatar"></a></p> <h2 id="备注"><a href="#备注" class="header-anchor">#</a> 备注</h2> <h3 id="项目启动"><a href="#项目启动" class="header-anchor">#</a> 项目启动</h3> <ul><li>安装选择的时候直接选 fis-parser-node-sass</li> <li>配置 host,需要多玩域记录登录状态</li></ul> <div class="language-Text extra-class"><pre class="language-text"><code>// hosts文件在C:\Windows\System32\drivers\etc
- 127.0.0.1 yournickname.duowan.com
- </code></pre></div><h3 id="fis-的语法"><a href="#fis-的语法" class="header-anchor">#</a> fis 的语法</h3> <ul><li><p><code>?__inline</code>可以实现对整个外部文件的引入,eg:html</p></li> <li><p><code>background(url?__sprite)</code>实现对图片进行整合成雪碧图</p></li></ul> <h3 id="暂时遇到的坑-或者你有更好的解决方法-欢迎提-issue"><a href="#暂时遇到的坑-或者你有更好的解决方法-欢迎提-issue" class="header-anchor">#</a> 暂时遇到的坑(或者你有更好的解决方法,欢迎提 issue)</h3> <p>1.游戏是通过 iframe 承载的,元素分为窗口元素和无窗口元素,在 ie 下窗口元素在最高层级的,设置 z-index 都是无效的,假如需要在游戏上面添加覆盖元素,要将覆盖的元素最下方添加一个空的 iframe</p> <p><strong><em>参考</em></strong> web 端游戏页游戏助手</p> <p>2.上报的时候,在点击关闭的时候触发 onbeforeunload 的方法。这个方法在 JQuery 引入的情况下,Chrome,Firefox 浏览器都不能直接使用要套在 JQuery 方法里面才能使用</p> <div class="language-JS extra-class"><pre class="language-js"><code><span class="token function">$</span><span class="token punctuation">(</span>window<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">load</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
- window<span class="token punctuation">.</span><span class="token function-variable function">onunload</span> <span class="token operator">=</span> <span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
- _this<span class="token punctuation">.</span><span class="token function">gameReport</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
- <span class="token keyword">return</span> <span class="token string">"Are you sure"</span>
- <span class="token punctuation">}</span>
- <span class="token punctuation">}</span><span class="token punctuation">)</span>
- </code></pre></div><p>3.window.open 打开异步获取的链接或被浏览器 adblock 拦截</p> <ul><li><strong>失败尝试 1</strong> - 异步前先打开一个空窗口,然后在 window 赋值,在普通浏览器可以解决被 adblock 拦截的情况 <strong><em>但是</em></strong> 在盒子赋值打开的链接不是同一个浏览器了,window 的对象已经发生改变,导致用户访问了一个空白页面</li> <li><strong>失败尝试 2</strong> - 加个 a 标签动态赋值,然后 js 模拟点击,尝试打开 <strong><em>结果</em></strong> 依旧被 adblock 拦截</li></ul></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
- ←
- <a href="/docs/currentProgram/hiydShop.html" class="prev">
- hi运动商城
- </a></span> <!----></p></div> </main></div><div class="global-ui"></div></div>
- <script src="/docs/assets/js/app.2431a00a.js" defer></script><script src="/docs/assets/js/2.f7777874.js" defer></script><script src="/docs/assets/js/3.a1131818.js" defer></script>
- </body>
- </html>
|