From 482ffccbb7e8e8a37ce19267f69cb71d7b2c39bf Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Sat, 11 Dec 2021 01:08:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=A7=86=E9=A2=91=E3=80=81=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E3=80=81=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 +- changelog.md | 25 +- common/js/lib/html-parser.js | 352 ----- components/copyright/copyright.vue | 2 +- components/quick-nav/quick-nav.vue | 12 +- pages/article-detail/article-detail.vue | 8 +- pages/goods-detail/goods-detail.vue | 7 +- pages/plugins/blog/detail/detail.vue | 8 +- pages/plugins/shop/detail/detail.vue | 4 +- pages/user-order/user-order.vue | 5 +- uni_modules/mp-html/README.md | 160 +++ uni_modules/mp-html/changelog.md | 62 + .../mp-html/components/mp-html/mp-html.vue | 432 ++++++ .../mp-html/components/mp-html/node/node.vue | 524 +++++++ .../mp-html/components/mp-html/parser.js | 1223 +++++++++++++++++ uni_modules/mp-html/package.json | 79 ++ .../static/app-plus/mp-html/js/handler.js | 1 + .../app-plus/mp-html/js/uni.webview.min.js | 1 + .../static/app-plus/mp-html/local.html | 1 + 19 files changed, 2529 insertions(+), 409 deletions(-) delete mode 100644 common/js/lib/html-parser.js create mode 100644 uni_modules/mp-html/README.md create mode 100644 uni_modules/mp-html/changelog.md create mode 100644 uni_modules/mp-html/components/mp-html/mp-html.vue create mode 100644 uni_modules/mp-html/components/mp-html/node/node.vue create mode 100644 uni_modules/mp-html/components/mp-html/parser.js create mode 100644 uni_modules/mp-html/package.json create mode 100644 uni_modules/mp-html/static/app-plus/mp-html/js/handler.js create mode 100644 uni_modules/mp-html/static/app-plus/mp-html/js/uni.webview.min.js create mode 100644 uni_modules/mp-html/static/app-plus/mp-html/local.html diff --git a/README.md b/README.md index 78467820..2553c0dd 100644 --- a/README.md +++ b/README.md @@ -4,43 +4,45 @@ * 后端支持依托于ShopXO免费开源电商系统开发的uniapp端主题源码 * 内置8中搭配主色(可自行扩展更多配色)、自由快捷切换适应各大行业需求 -* 已支持小程序(微信、QQ、百度、支付宝、头条&抖音),(H5+APP正在紧急适配中) +* 已支持小程序(微信、QQ、百度、支付宝、头条&抖音)+ H5,(APP正在紧急适配中) #### 使用教程 -`程序打包操作需要有一定的编程技术基础、如需帮助请到git平台提issues寻求帮助` -* 打包教程 https://doc.shopxo.net/article/1/293727233598554112.html +`程序打包操作需要有一定的编程技术基础、如需帮助请到git平台提issues寻求帮助` +* 打包教程 [https://doc.shopxo.net/article/1/293727233598554112.html](https://doc.shopxo.net/article/1/293727233598554112.html) -1. 先安装ShopXO免费开源系统 http://install.shopxo.net/ +1. 先安装ShopXO免费开源系统 [http://install.shopxo.net/](http://install.shopxo.net/) 2. 将该源码导入HBuilderX开发工具、顶部工具栏 `运行->运行到小程序模拟器->(根据支持平台自行选择、如 微信开发者工具)` 3. App.vue中修改 request_url 和 static_url 地址为自己的商城地址即可使用 4. 主题默认为黄色(yellow),如更改主题 App.vue文件中 default_theme + 底部css引入,pages.json文件中 tabBar选中图标+selectedColor选中颜色 5. 发布、HBuilderX开发工具、顶部工具栏 `发行->(根据支持平台自行选择、如 微信开发者工具)` +#### 官方QQ群、答案`shopxo.net` +* 官方uniapp群:679303149 + #### 小程序体验 ![小程序.jpg](https://doc.shopxo.net/upload/image/20210727/1627370121546835.jpeg) - #### 当前项目源代码平台 -* Gitee:https://gitee.com/zongzhige/shopxo-uniapp -* GitHub:https://github.com/gongfuxiang/shopxo-uniapp -* Coding:https://zongzhige.coding.net/public/shopxo/uniapp/git -* CodeChina:https://codechina.csdn.net/zongzhige/shopxo-uniapp -* uni-app:https://ext.dcloud.net.cn/plugin?id=6380 +* Gitee:[https://gitee.com/zongzhige/shopxo-uniapp](https://gitee.com/zongzhige/shopxo-uniapp) +* GitHub:[https://github.com/gongfuxiang/shopxo-uniapp](https://github.com/gongfuxiang/shopxo-uniapp) +* Coding:[https://zongzhige.coding.net/public/shopxo/uniapp/git](https://zongzhige.coding.net/public/shopxo/uniapp/git) +* Gitcode:[https://gitcode.net/zongzhige/shopxo-uniapp](https://gitcode.net/zongzhige/shopxo-uniapp) +* uni-app:[https://ext.dcloud.net.cn/plugin?id=6380](https://ext.dcloud.net.cn/plugin?id=6380) #### ShopXO后端源代码平台 -* Gitee:https://gitee.com/zongzhige/shopxo -* GitHub:https://github.com/gongfuxiang/shopxo -* Coding:https://zongzhige.coding.net/public/shopxo/shopxo/git -* CodeChina:https://codechina.csdn.net/zongzhige/shopxo +* Gitee:[https://gitee.com/zongzhige/shopxo](https://gitee.com/zongzhige/shopxo) +* GitHub:[https://github.com/gongfuxiang/shopxo](https://github.com/gongfuxiang/shopxo) +* Coding:[https://zongzhige.coding.net/public/shopxo/shopxo/git](https://zongzhige.coding.net/public/shopxo/shopxo/git) +* Gitcode:[https://gitcode.net/zongzhige/shopxo](https://gitcode.net/zongzhige/shopxo) #### API接口文档 -* https://doc.shopxo.net/article/2.html +* [https://doc.shopxo.net/article/2.html](https://doc.shopxo.net/article/2.html) #### 支持多种配色 diff --git a/changelog.md b/changelog.md index 27b46e2c..afae85fd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,14 @@ -## v2.2.1(2021-10-24) -* 支持微信小程序(首页、分类、购物车、用户中心、商品搜索、商品详情、订单确认、授权登陆、订单管理、订单售后、商品收藏、商品足迹、直播、签到、积分商城、多商户、钱包、批发) +## v2.2.3(2021-12-13) +* 整体适配H5端 +* 订单、钱包、会员等级支付优化适配 +* 支持(账号、手机、邮箱)登录注册方式 +* 分享逻辑优化全局处理 +* 分销新增上级用户、阶梯返佣提示 +* 新增独立新增错误页面 +* 适配第三方登录插件 +* 支持线下支付自定义信息展示 +* 规格切换购买数量错误修复 +* 富文本详情支持视频、超链接、图片预览 ## v2.2.2(2021-11-23) @@ -17,13 +26,5 @@ * 支持菜鸟物流查询 -## v2.2.3(xxx) -* 整体适配H5端 -* 订单、钱包、会员等级支付优化适配 -* 支持(账号、手机、邮箱)登录注册方式 -* 分享逻辑优化全局处理 -* 分销新增上级用户、阶梯返佣提示 -* 新增独立新增错误页面 -* 适配第三方登录插件 -* 支持线下支付自定义信息展示 -* 规格切换购买数量错误修复 \ No newline at end of file +## v2.2.1(2021-10-24) +* 支持微信小程序(首页、分类、购物车、用户中心、商品搜索、商品详情、订单确认、授权登陆、订单管理、订单售后、商品收藏、商品足迹、直播、签到、积分商城、多商户、钱包、批发) \ No newline at end of file diff --git a/common/js/lib/html-parser.js b/common/js/lib/html-parser.js deleted file mode 100644 index 20a89b28..00000000 --- a/common/js/lib/html-parser.js +++ /dev/null @@ -1,352 +0,0 @@ -/* - * HTML5 Parser By Sam Blowes - * - * Designed for HTML5 documents - * - * Original code by John Resig (ejohn.org) - * http://ejohn.org/blog/pure-javascript-html-parser/ - * Original code by Erik Arvidsson, Mozilla Public License - * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js - * - * ---------------------------------------------------------------------------- - * License - * ---------------------------------------------------------------------------- - * - * This code is triple licensed using Apache Software License 2.0, - * Mozilla Public License or GNU Public License - * - * //////////////////////////////////////////////////////////////////////////// - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * //////////////////////////////////////////////////////////////////////////// - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. - * - * The Original Code is Simple HTML Parser. - * - * The Initial Developer of the Original Code is Erik Arvidsson. - * Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights - * Reserved. - * - * //////////////////////////////////////////////////////////////////////////// - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * ---------------------------------------------------------------------------- - * Usage - * ---------------------------------------------------------------------------- - * - * // Use like so: - * HTMLParser(htmlString, { - * start: function(tag, attrs, unary) {}, - * end: function(tag) {}, - * chars: function(text) {}, - * comment: function(text) {} - * }); - * - * // or to get an XML string: - * HTMLtoXML(htmlString); - * - * // or to get an XML DOM Document - * HTMLtoDOM(htmlString); - * - * // or to inject into an existing document/DOM node - * HTMLtoDOM(htmlString, document); - * HTMLtoDOM(htmlString, document.body); - * - */ -// Regular Expressions for parsing tags and attributes -var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/; -var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/; -var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5 - -var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5 -// fixed by xxx 将 ins 标签从块级名单中移除 - -var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5 - -var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open -// (and which close themselves) - -var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled" - -var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything) - -var special = makeMap('script,style'); -function HTMLParser(html, handler) { - var index; - var chars; - var match; - var stack = []; - var last = html; - - stack.last = function () { - return this[this.length - 1]; - }; - - while (html) { - chars = true; // Make sure we're not in a script or style element - - if (!stack.last() || !special[stack.last()]) { - // Comment - if (html.indexOf(''); - - if (index >= 0) { - if (handler.comment) { - handler.comment(html.substring(4, index)); - } - - html = html.substring(index + 3); - chars = false; - } // end tag - - } else if (html.indexOf(']*>'), function (all, text) { - text = text.replace(/|/g, '$1$2'); - - if (handler.chars) { - handler.chars(text); - } - - return ''; - }); - parseEndTag('', stack.last()); - } - - if (html == last) { - throw 'Parse Error: ' + html; - } - - last = html; - } // Clean up any remaining tags - - - parseEndTag(); - - function parseStartTag(tag, tagName, rest, unary) { - tagName = tagName.toLowerCase(); - - if (block[tagName]) { - while (stack.last() && inline[stack.last()]) { - parseEndTag('', stack.last()); - } - } - - if (closeSelf[tagName] && stack.last() == tagName) { - parseEndTag('', tagName); - } - - unary = empty[tagName] || !!unary; - - if (!unary) { - stack.push(tagName); - } - - if (handler.start) { - var attrs = []; - rest.replace(attr, function (match, name) { - var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : ''; - attrs.push({ - name: name, - value: value, - escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // " - - }); - }); - - if (handler.start) { - handler.start(tagName, attrs, unary); - } - } - } - - function parseEndTag(tag, tagName) { - // If no tag name is provided, clean shop - if (!tagName) { - var pos = 0; - } // Find the closest opened tag of the same type - else { - for (var pos = stack.length - 1; pos >= 0; pos--) { - if (stack[pos] == tagName) { - break; - } - } - } - - if (pos >= 0) { - // Close all the open elements, up the stack - for (var i = stack.length - 1; i >= pos; i--) { - if (handler.end) { - handler.end(stack[i]); - } - } // Remove the open elements from the stack - - - stack.length = pos; - } - } -} - -function makeMap(str) { - var obj = {}; - var items = str.split(','); - - for (var i = 0; i < items.length; i++) { - obj[items[i]] = true; - } - - return obj; -} - -function removeDOCTYPE(html) { - return html.replace(/<\?xml.*\?>\n/, '').replace(/\n/, '').replace(/\n/, ''); -} - -function parseAttrs(attrs) { - return attrs.reduce(function (pre, attr) { - var value = attr.value; - var name = attr.name; - - if (pre[name]) { - pre[name] = pre[name] + " " + value; - } else { - pre[name] = value; - } - - return pre; - }, {}); -} - -function parseHtml(html) { - html = removeDOCTYPE(html); - var stacks = []; - var results = { - node: 'root', - children: [] - }; - HTMLParser(html, { - start: function start(tag, attrs, unary) { - var node = { - name: tag - }; - - if (attrs.length !== 0) { - node.attrs = parseAttrs(attrs); - } - - if (unary) { - var parent = stacks[0] || results; - - if (!parent.children) { - parent.children = []; - } - - parent.children.push(node); - } else { - stacks.unshift(node); - } - }, - end: function end(tag) { - var node = stacks.shift(); - if (node.name !== tag) console.error('invalid state: mismatch end tag'); - - if (stacks.length === 0) { - results.children.push(node); - } else { - var parent = stacks[0]; - - if (!parent.children) { - parent.children = []; - } - - parent.children.push(node); - } - }, - chars: function chars(text) { - var node = { - type: 'text', - text: text - }; - - if (stacks.length === 0) { - results.children.push(node); - } else { - var parent = stacks[0]; - - if (!parent.children) { - parent.children = []; - } - - parent.children.push(node); - } - }, - comment: function comment(text) { - var node = { - node: 'comment', - text: text - }; - var parent = stacks[0]; - - if (!parent.children) { - parent.children = []; - } - - parent.children.push(node); - } - }); - return results.children; -} - -export default parseHtml; diff --git a/components/copyright/copyright.vue b/components/copyright/copyright.vue index 20c156f0..4a237901 100644 --- a/components/copyright/copyright.vue +++ b/components/copyright/copyright.vue @@ -20,7 +20,7 @@ diff --git a/uni_modules/mp-html/components/mp-html/node/node.vue b/uni_modules/mp-html/components/mp-html/node/node.vue new file mode 100644 index 00000000..530991e7 --- /dev/null +++ b/uni_modules/mp-html/components/mp-html/node/node.vue @@ -0,0 +1,524 @@ +