Loading…

"Angel Children's Clothes" transforms Toutiao mini program

If you have nothing to do, just find a WeChat Mini Program and transform it into a ByteDance mini program to play with: # Download the latest mini program source code [https://github.com/EastWorld/wechat-app-mall](https://github.com/EastWorld/wechat-app-mall) After decompression, delete the node_modules and miniprogram_npm folders. These files are not used. Modify the appid in the project.config.json file to the appid of your own Toutiao applet # Delete ad slot global searchApp.ttss and the place where weui is imported into the header should also be modified. weui.wxss -> weui.ttss ## apifm-wxapi module Because the Toutiao applet does not currently support npm modules, you can modify the application method of the apifm-wxapi module: 1. app.js ```javascript const WXAPI = require('apifm-wxapi') Change to const WXAPI = require('utils/apifm-wxapi') ``` 2. All js files under pages and template folders ```javascript const WXAPI = require('apifm-wxapi') Global batch replacement with const WXAPI = require('../../utils/apifm-wxapi') ``` 3. Download the latest apifm-wxapi.js file [https://github.com/gooking/apifm-wxapi/blob/master/src/index.js](https://github.com/gooking/apifm-wxapi/blob/master/src/index.js) Download the latest apifm-wxapi.js file and store it in the utils directory ## ES6 support If the console reports an error: ```bash Uncaught ReferenceError: regeneratorRuntime is not defined at eval (auth.js:3) at eval (auth.js:55) at te (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/dist/preload/bgPreload.5b60a3b353d7604dbca0.js:278),:1:10248) at eval (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/dist/preload/bgPreload.5b60a3b353d7604dbca0.js:278), :1:9886) at eval (app.js? [sm]:3) at te (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/dist/preload/bgPreload.5b60a3b353d7604dbca0.js:278), :1:10248) at Q (eval at window.loadTmaScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/dist/preload/bgPreload.5b60a3b353d7604dbca0.js:278), :1:9435) at eval (app-service.js:24) at eval () at window.loadScript (/Applications/bytedanceide.app/Contents/Resources/app.asar.unpacked/simulator-sdk/dist/preload/bgPreload.5b60a3b353d7604dbca0.js:278) at :1:1 at WebFrame.(:20002/static/dist/common/anonymous function) [as executeJavaScript] (/Applications/bytedanceide.app/Contents/Resources/electron.asar/renderer/api/web-frame.js:56:27) at EventEmitter.electron.ipcRenderer.on (/Applications/bytedanceide.app/Contents/Resources/electron.asar/renderer/web-frame-init.js:36) at EventEmitter.emit (events.js:182) ``` **Then, you need to uncheck "ES6 to ES5"** ![](https://dcdn.it120.cc/yuque/0/2019/png/572726/1575357564594-babb543e-59ec-4605-964c-7f99a42121c6.png) ## List loop method List rendering method of Toutiao applet: [https://microapp.bytedance.com/dev/cn/mini-app/develop/framework/view/ttml-list-draw](https://microapp.bytedance.com/dev/cn/mini-app/develop/framework/view/ttml-list-draw) Therefore, we need to globally search and replace the original list loop method (wx:for-items)  -->  (tt:for), delete at the same timewx:key## Login authorization Global searchWXAPI.login_wx is replaced in batches byWXAPI.login_tt ## New user registration WeChat's pop-up authorization method has been changed to Toutiao's authorization method, which allows direct pop-up. Therefore, the original pop-up box of WeChat Mini Program prompting users to log in can be directly changed to a forced pop-up asking for authorization and registration. The user registration interface method is changed toWXAPI.register_tt ## Generate small program code interfaceWXAPI.wxaQrcode method changed toWXAPI.ttaQrcode ## Rich text parsing tool [https://gitee.com/sootou/wxParse-for-toutiao](https://gitee.com/sootou/wxParse-for-toutiao) Global replacementwxParse.wxml  --> ttParse.wxml  wxParse.wxss  --> wxParse.ttss