hiydMini.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!DOCTYPE html>
  2. <html lang="en-US">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <title>Hi 运动(教练端)小程序 | 偶游前端</title>
  7. <meta name="generator" content="VuePress 1.9.7">
  8. <meta name="description" content="">
  9. <link rel="preload" href="/docs/assets/css/0.styles.e901f3ad.css" as="style"><link rel="preload" href="/docs/assets/js/app.9d841bbb.js" as="script"><link rel="preload" href="/docs/assets/js/2.a7c99d38.js" as="script"><link rel="preload" href="/docs/assets/js/14.86faea9b.js" as="script"><link rel="prefetch" href="/docs/assets/js/10.dffec12e.js"><link rel="prefetch" href="/docs/assets/js/11.29345ef4.js"><link rel="prefetch" href="/docs/assets/js/12.d71ff1f2.js"><link rel="prefetch" href="/docs/assets/js/13.eadceca7.js"><link rel="prefetch" href="/docs/assets/js/15.8cc4ecb6.js"><link rel="prefetch" href="/docs/assets/js/16.e10f6d69.js"><link rel="prefetch" href="/docs/assets/js/17.255d9f5b.js"><link rel="prefetch" href="/docs/assets/js/18.9f1823b8.js"><link rel="prefetch" href="/docs/assets/js/19.03db59c9.js"><link rel="prefetch" href="/docs/assets/js/20.f003980f.js"><link rel="prefetch" href="/docs/assets/js/21.5ec8f90e.js"><link rel="prefetch" href="/docs/assets/js/22.77e586e0.js"><link rel="prefetch" href="/docs/assets/js/23.793cee7f.js"><link rel="prefetch" href="/docs/assets/js/24.b9b4a05b.js"><link rel="prefetch" href="/docs/assets/js/25.12ca9a6b.js"><link rel="prefetch" href="/docs/assets/js/3.de84d37d.js"><link rel="prefetch" href="/docs/assets/js/4.47824499.js"><link rel="prefetch" href="/docs/assets/js/5.bd819ce0.js"><link rel="prefetch" href="/docs/assets/js/6.dfb8683d.js"><link rel="prefetch" href="/docs/assets/js/7.0e5538c2.js"><link rel="prefetch" href="/docs/assets/js/8.d3104372.js"><link rel="prefetch" href="/docs/assets/js/9.f4b68565.js">
  10. <link rel="stylesheet" href="/docs/assets/css/0.styles.e901f3ad.css">
  11. </head>
  12. <body>
  13. <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/funfet.html" class="sidebar-link">智能鞋官网</a></li><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" aria-current="page" class="active sidebar-link">hi运动教练小程序</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/docs/currentProgram/hiydMini.html#项目地址" class="sidebar-link">项目地址</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/hiydMini.html#技术选型" class="sidebar-link">技术选型</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/hiydMini.html#最终的技术栈" class="sidebar-link">最终的技术栈</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/hiydMini.html#项目架构" class="sidebar-link">项目架构</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/hiydMini.html#开发时发现的问题" class="sidebar-link">开发时发现的问题</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/docs/currentProgram/hiydMini.html#_2020-5-6" class="sidebar-link">2020/5/6</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/hiydMini.html#_20205-14" class="sidebar-link">20205/14</a></li><li class="sidebar-sub-header"><a href="/docs/currentProgram/hiydMini.html#_2020-5-22" class="sidebar-link">2020/5/22</a></li></ul></li></ul></li><li><a href="/docs/currentProgram/hiydShop.html" class="sidebar-link">hi运动商城</a></li><li><a href="/docs/currentProgram/webGame.html" class="sidebar-link">多玩游戏大厅</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="hi-运动-教练端-小程序"><a href="#hi-运动-教练端-小程序" class="header-anchor">#</a> Hi 运动(教练端)小程序</h1> <blockquote><p>请编辑过的人员留下你的姓名</p></blockquote> <ul><li>文档编辑人员 杜文华(2020/4/27)</li></ul> <h2 id="项目地址"><a href="#项目地址" class="header-anchor">#</a> 项目地址</h2> <ul><li>svn://svn.webdev.ouj.com/biz/hiyd_miniprogram/wx</li></ul> <h2 id="技术选型"><a href="#技术选型" class="header-anchor">#</a> 技术选型</h2> <blockquote><p>目标:单纯的微信小程序,没有任何跨端的需求</p></blockquote> <ol><li>针对当时有挺多可选择的方案,(1)原生,(2)框架</li> <li>框架来说,就是更多的用于跨端的,所以感觉没多大必要。但是原生也会有原生的问题</li></ol> <p>原生的问题:</p> <ol><li>比如 npm 的管理就比较棘手,官方的 npm 引入需要构建然后需要外部相对路径的引入,这样的灵活性不太高</li> <li>对于 sass,TypeScript 等预编译的操作无法实现</li> <li>不支持 ES7 以上的高级语法,如 async await 等特性</li> <li>不管是体验版还是开发版只能存在一种环境,一旦发布预览测试环境切换繁琐</li> <li>缺少集中式的 API 地址和 ENV 环境变量管理</li></ol> <p>最终由于技术人员大家的技术都倾向于原生比较容易上手,框架需要再熟悉可能有碍于开发效率等,选择了原生</p> <h2 id="最终的技术栈"><a href="#最终的技术栈" class="header-anchor">#</a> 最终的技术栈</h2> <blockquote><p>Gulp4.x + TypeScript(后来觉得 wx 的类型可能有点坑就放弃了) + Babel + Scss + 原生小程序内置 Api + jest(单元测试,node 版本要尽量高不然会报错) + Mobx</p></blockquote> <p>5/22注后来发现TypeScript也是可以做的,wx的类型直接引入微信的库就可以了,我们要做的只是用TypeScript转换成JS就可以了</p> <h2 id="项目架构"><a href="#项目架构" class="header-anchor">#</a> 项目架构</h2> <div class="language-Bash extra-class"><pre class="language-bash"><code>- dist
  14. - node_modules
  15. - src
  16. <span class="token operator">|</span>- <span class="token punctuation">..</span>.
  17. <span class="token operator">|</span>- __test__ --- jest单元测试
  18. <span class="token operator">|</span>- assets --- 静态资源文件<span class="token punctuation">(</span>*png,*jpg<span class="token punctuation">)</span>
  19. <span class="token operator">|</span>- components --- 公共组件<span class="token punctuation">(</span>自定义<span class="token punctuation">)</span>
  20. <span class="token operator">|</span>- custom-tab-bar --- 自定义tabbar<span class="token punctuation">(</span>一定要放在最外层<span class="token punctuation">)</span>
  21. <span class="token operator">|</span>- libs --- 用上了ES7的async的地方都得用这个库 <span class="token punctuation">(</span>在头部得引入不然会报错<span class="token punctuation">)</span>
  22. <span class="token operator">|</span>- miniprogram_npm --- 小程序的npm
  23. <span class="token operator">|</span>- pages --- 页面
  24. <span class="token operator">|</span>- <span class="token punctuation">..</span>.
  25. <span class="token operator">|</span>- <span class="token punctuation">..</span>.
  26. <span class="token operator">|</span>- router --- 封装的路由
  27. <span class="token operator">|</span>- services --- 业务层
  28. <span class="token operator">|</span>- lib --- 封装的ajax
  29. <span class="token operator">|</span>- styles --- 定义的全局scss
  30. <span class="token operator">|</span>- utils --- 工具类
  31. <span class="token operator">|</span>- index.d.ts --- 用来提示类型的<span class="token punctuation">(</span>不是用TypeScript但是可以透过工具达到类型提示的效果<span class="token punctuation">)</span>
  32. <span class="token operator">|</span>- <span class="token punctuation">..</span>.
  33. - gulpfile.js --- 构建打包的配置文件
  34. </code></pre></div><h2 id="开发时发现的问题"><a href="#开发时发现的问题" class="header-anchor">#</a> 开发时发现的问题</h2> <h3 id="_2020-5-6"><a href="#_2020-5-6" class="header-anchor">#</a> 2020/5/6</h3> <p>小程序的背景图片不能直接引入本地的,可能是因为线上的缘故吧。要转成 base64 或者是引入线上服务器的地址才可以引入。</p> <p>数据流最后是通过 mobx 进行传递。写了一些例子可能都不太好,没有那种修改了马上更新的操作,放在 globalData 就更加不行</p> <p>使用 async 的地方都得引入 libs 里面的 runtime 库不然会报错(本地可能不报错,但是线上会报错)</p> <h3 id="_20205-14"><a href="#_20205-14" class="header-anchor">#</a> 20205/14</h3> <p>商品管理的拖动还是存在bug,比如无法实时看到拖动的效果,只能在拖动完最后才能看到效果。(最主要还是安卓存在的性能问题,因为每次都会load图片,安卓load图片就会出现性能的问题,IOS不会有这个问题,实现的原理得自己看下里面的)</p> <p>保存海报是通过canvas画出来的,所以要看一下对应的微信提供的Api</p> <p>小程序自带的mobx在App.js无法使用,因为没有办法代理App.js里面的数据。page里面如果在onload,等生命周期使用。得下一轮循环才行(不知道是不是推到微任务里面去了)</p> <h3 id="_2020-5-22"><a href="#_2020-5-22" class="header-anchor">#</a> 2020/5/22</h3> <p>tabPage是自定义,并且是重写了onShow方法,是在Page实例化前调用的,所以在tabPage的onShow里面没有找到当前tabPage的this。</p></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
  35. <a href="/docs/currentProgram/tank.html" class="prev">
  36. 坦克专题
  37. </a></span> <span class="next"><a href="/docs/currentProgram/hiydShop.html">
  38. hi运动商城
  39. </a>
  40. </span></p></div> </main></div><div class="global-ui"></div></div>
  41. <script src="/docs/assets/js/app.9d841bbb.js" defer></script><script src="/docs/assets/js/2.a7c99d38.js" defer></script><script src="/docs/assets/js/14.86faea9b.js" defer></script>
  42. </body>
  43. </html>