From f63eea04bbc075d0aeff054f3047510c2c464dc3 Mon Sep 17 00:00:00 2001 From: fanshuai Date: Fri, 25 Apr 2025 17:54:49 +0800 Subject: [PATCH] 0000 --- app/app.js | 19 + app/app.json | 45 + app/app.wxss | 4 + app/components/Authorize.vue | 145 - app/components/Loading/index.vue | 57 - app/components/PriceChange/index.vue | 173 - app/components/adc/index.vue | 185 - app/components/addressWindow/index.vue | 193 - app/components/countDown/index.vue | 162 - app/components/couponListWindow/index.vue | 235 - app/components/couponWindow/index.vue | 172 - app/components/easy-upload/easy-upload.vue | 260 - app/components/easy-upload/readme.md | 40 - app/components/emptyPage.vue | 37 - app/components/goodList/index.vue | 143 - app/components/goods-list/goods-list.js | 24 + app/components/goods-list/goods-list.json | 4 + app/components/goods-list/goods-list.wxml | 68 + app/components/goods-list/goods-list.wxss | 36 + app/components/home/index.vue | 116 - app/components/jyf-parser/jyf-parser.vue | 814 - app/components/jyf-parser/libs/CssHandler.js | 102 - .../jyf-parser/libs/MpHtmlParser.js | 577 - app/components/jyf-parser/libs/config.js | 80 - app/components/jyf-parser/libs/handler.sjs | 35 - app/components/jyf-parser/libs/handler.wxs | 44 - app/components/jyf-parser/libs/trees.vue | 476 - app/components/login_mobile/index.vue | 296 - app/components/login_mobile/routine_phone.vue | 160 - .../mpvue-calendar/browser-style.css | 406 - app/components/mpvue-calendar/calendarinit.js | 524 - app/components/mpvue-calendar/icon.css | 15 - .../mpvue-calendar/mpvue-calendar.vue | 1153 -- app/components/mpvue-calendar/style.css | 394 - app/components/orderGoods/index.vue | 117 - app/components/payment/index.vue | 314 - app/components/productConSwiper/index.vue | 149 - app/components/productWindow/index.vue | 344 - app/components/promotionGood/index.vue | 110 - app/components/recommend/index.vue | 118 - app/components/shareInfo/index.vue | 47 - app/components/shareRedPackets/index.vue | 57 - app/components/swipers/index.vue | 52 - app/components/tabNav.vue | 197 - app/components/ucharts/component.vue | 165 - app/components/ucharts/ucharts.js | 5658 ------- app/components/ucharts/ucharts.min.js | 1 - app/components/uni-calendar/calendar.js | 546 - .../uni-calendar/uni-calendar-item.vue | 152 - app/components/uni-calendar/uni-calendar.vue | 434 - app/components/uni-calendar/util.js | 327 - app/components/userEvaluation/index.vue | 151 - app/components/vconsole.min.js | 10 - app/components/wPicker/city-data/area.js | 12542 ---------------- app/components/wPicker/city-data/city.js | 1503 -- app/components/wPicker/city-data/province.js | 139 - app/components/wPicker/w-picker.js | 680 - app/components/wPicker/w-picker.vue | 1138 -- app/package-lock.json | 451 +- app/project.config.json | 19 +- app/project.private.config.json | 6 +- 61 files changed, 226 insertions(+), 32395 deletions(-) create mode 100644 app/app.js create mode 100644 app/app.json create mode 100644 app/app.wxss delete mode 100644 app/components/Authorize.vue delete mode 100644 app/components/Loading/index.vue delete mode 100644 app/components/PriceChange/index.vue delete mode 100644 app/components/adc/index.vue delete mode 100644 app/components/addressWindow/index.vue delete mode 100644 app/components/countDown/index.vue delete mode 100644 app/components/couponListWindow/index.vue delete mode 100644 app/components/couponWindow/index.vue delete mode 100644 app/components/easy-upload/easy-upload.vue delete mode 100644 app/components/easy-upload/readme.md delete mode 100644 app/components/emptyPage.vue delete mode 100644 app/components/goodList/index.vue create mode 100644 app/components/goods-list/goods-list.js create mode 100644 app/components/goods-list/goods-list.json create mode 100644 app/components/goods-list/goods-list.wxml create mode 100644 app/components/goods-list/goods-list.wxss delete mode 100644 app/components/home/index.vue delete mode 100644 app/components/jyf-parser/jyf-parser.vue delete mode 100644 app/components/jyf-parser/libs/CssHandler.js delete mode 100644 app/components/jyf-parser/libs/MpHtmlParser.js delete mode 100644 app/components/jyf-parser/libs/config.js delete mode 100644 app/components/jyf-parser/libs/handler.sjs delete mode 100644 app/components/jyf-parser/libs/handler.wxs delete mode 100644 app/components/jyf-parser/libs/trees.vue delete mode 100644 app/components/login_mobile/index.vue delete mode 100644 app/components/login_mobile/routine_phone.vue delete mode 100644 app/components/mpvue-calendar/browser-style.css delete mode 100644 app/components/mpvue-calendar/calendarinit.js delete mode 100644 app/components/mpvue-calendar/icon.css delete mode 100644 app/components/mpvue-calendar/mpvue-calendar.vue delete mode 100644 app/components/mpvue-calendar/style.css delete mode 100644 app/components/orderGoods/index.vue delete mode 100644 app/components/payment/index.vue delete mode 100644 app/components/productConSwiper/index.vue delete mode 100644 app/components/productWindow/index.vue delete mode 100644 app/components/promotionGood/index.vue delete mode 100644 app/components/recommend/index.vue delete mode 100644 app/components/shareInfo/index.vue delete mode 100644 app/components/shareRedPackets/index.vue delete mode 100644 app/components/swipers/index.vue delete mode 100644 app/components/tabNav.vue delete mode 100644 app/components/ucharts/component.vue delete mode 100644 app/components/ucharts/ucharts.js delete mode 100644 app/components/ucharts/ucharts.min.js delete mode 100644 app/components/uni-calendar/calendar.js delete mode 100644 app/components/uni-calendar/uni-calendar-item.vue delete mode 100644 app/components/uni-calendar/uni-calendar.vue delete mode 100644 app/components/uni-calendar/util.js delete mode 100644 app/components/userEvaluation/index.vue delete mode 100644 app/components/vconsole.min.js delete mode 100644 app/components/wPicker/city-data/area.js delete mode 100644 app/components/wPicker/city-data/city.js delete mode 100644 app/components/wPicker/city-data/province.js delete mode 100644 app/components/wPicker/w-picker.js delete mode 100644 app/components/wPicker/w-picker.vue diff --git a/app/app.js b/app/app.js new file mode 100644 index 0000000..802034d --- /dev/null +++ b/app/app.js @@ -0,0 +1,19 @@ +// app.js +App({ + onLaunch() { + // 展示本地存储能力 + const logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + + // 登录 + // wx.login({ + // success: res => { + // // 发送 res.code 到后台换取 openId, sessionKey, unionId + // } + // }) + }, + globalData: { + userInfo: null + } +}) diff --git a/app/app.json b/app/app.json new file mode 100644 index 0000000..84a06c5 --- /dev/null +++ b/app/app.json @@ -0,0 +1,45 @@ + +{ + "usingComponents": { + "van-button": "@vant/weapp/button/index" + }, + "pages": [ + "pages/index/index", + "pages/shopping/shopping", + "pages/mine/mine", + "pages/logs/logs" + ], + "window": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "嗨果嗨鲜", + "navigationBarBackgroundColor": "#ffffff", + "navigationStyle": "custom" + }, + + "componentFramework": "glass-easel", + "sitemapLocation": "sitemap.json", + "lazyCodeLoading": "requiredComponents", + + "tabBar": { + "list": [ + { + "pagePath": "pages/index/index", + "text":"首页", + "iconPath": "/images/shouye.png", + "selectedIconPath": "/images/shouye1.png" + }, + { + "pagePath": "pages/shopping/shopping", + "text":"购物车", + "iconPath": "/images/gouwuche.png", + "selectedIconPath": "/images/gouwuche1.png" + }, + { + "pagePath": "pages/mine/mine", + "text":"我的", + "iconPath": "/images/wodedangxuan.png", + "selectedIconPath": "/images/wodedangxuan1.png" + } + ] + } +} diff --git a/app/app.wxss b/app/app.wxss new file mode 100644 index 0000000..26d68b5 --- /dev/null +++ b/app/app.wxss @@ -0,0 +1,4 @@ +page { + font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif; + +} \ No newline at end of file diff --git a/app/components/Authorize.vue b/app/components/Authorize.vue deleted file mode 100644 index 8ddc8cb..0000000 --- a/app/components/Authorize.vue +++ /dev/null @@ -1,145 +0,0 @@ - - - - - diff --git a/app/components/Loading/index.vue b/app/components/Loading/index.vue deleted file mode 100644 index a83945f..0000000 --- a/app/components/Loading/index.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/components/PriceChange/index.vue b/app/components/PriceChange/index.vue deleted file mode 100644 index a2c1b34..0000000 --- a/app/components/PriceChange/index.vue +++ /dev/null @@ -1,173 +0,0 @@ - - - diff --git a/app/components/adc/index.vue b/app/components/adc/index.vue deleted file mode 100644 index e9ec4a0..0000000 --- a/app/components/adc/index.vue +++ /dev/null @@ -1,185 +0,0 @@ - - - - - diff --git a/app/components/addressWindow/index.vue b/app/components/addressWindow/index.vue deleted file mode 100644 index 7f68195..0000000 --- a/app/components/addressWindow/index.vue +++ /dev/null @@ -1,193 +0,0 @@ - - - - - diff --git a/app/components/countDown/index.vue b/app/components/countDown/index.vue deleted file mode 100644 index 291c6e6..0000000 --- a/app/components/countDown/index.vue +++ /dev/null @@ -1,162 +0,0 @@ - - - - - diff --git a/app/components/couponListWindow/index.vue b/app/components/couponListWindow/index.vue deleted file mode 100644 index 9df55d8..0000000 --- a/app/components/couponListWindow/index.vue +++ /dev/null @@ -1,235 +0,0 @@ - - - - - diff --git a/app/components/couponWindow/index.vue b/app/components/couponWindow/index.vue deleted file mode 100644 index d30efa0..0000000 --- a/app/components/couponWindow/index.vue +++ /dev/null @@ -1,172 +0,0 @@ - - - - - diff --git a/app/components/easy-upload/easy-upload.vue b/app/components/easy-upload/easy-upload.vue deleted file mode 100644 index f90721d..0000000 --- a/app/components/easy-upload/easy-upload.vue +++ /dev/null @@ -1,260 +0,0 @@ - - - - - diff --git a/app/components/easy-upload/readme.md b/app/components/easy-upload/readme.md deleted file mode 100644 index de403f9..0000000 --- a/app/components/easy-upload/readme.md +++ /dev/null @@ -1,40 +0,0 @@ -### easy-upload 组件 - -使用方法 -```js - - - //先引入组件 - import easyUpload from '@/components/easy-upload/easy-upload.vue' - //注册组件 - components:{ - easyUpload - } - - //使用 easycom 可以直接使用 - -``` - -| 参数 | 类型 | 是否必填 | 参数描述 -| ---- | ---- | ---- | ---- -| types | String | 否 | 上传类型 image/video -| dataList | Array | 否 | 图片/视频数据展示 -| clearIcon | String | 否 | 删除图标(可以换成自己本地图片) -| uploadUrl | String | 否 | 上传的接口 -| deleteUrl | String | 否 | 删除的接口 -| uploadCount | Number | 否 | 上传图片最大个数(默认为一张) -| upload_max | Number | 否 | 上传大小(默认为3M) -| upload_max | Number | 否 | 上传大小(默认为3M) -| upload_max | Number | 否 | 上传大小(默认为3M) - -| 事件 | 是否必填 | 参数描述 -| ---- | ---- | ---- -| successImage | 否 | 上传图片成功事件 -| successVideo | 否 | 上传视频成功回调 - -示例项目中有服务端代码 (node.js) - diff --git a/app/components/emptyPage.vue b/app/components/emptyPage.vue deleted file mode 100644 index 0d737d7..0000000 --- a/app/components/emptyPage.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - - - diff --git a/app/components/goodList/index.vue b/app/components/goodList/index.vue deleted file mode 100644 index a2ce0b4..0000000 --- a/app/components/goodList/index.vue +++ /dev/null @@ -1,143 +0,0 @@ - - - - - diff --git a/app/components/goods-list/goods-list.js b/app/components/goods-list/goods-list.js new file mode 100644 index 0000000..bac4bc5 --- /dev/null +++ b/app/components/goods-list/goods-list.js @@ -0,0 +1,24 @@ +// components/goods-list/goods-list.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) \ No newline at end of file diff --git a/app/components/goods-list/goods-list.json b/app/components/goods-list/goods-list.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/app/components/goods-list/goods-list.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/app/components/goods-list/goods-list.wxml b/app/components/goods-list/goods-list.wxml new file mode 100644 index 0000000..197dd4e --- /dev/null +++ b/app/components/goods-list/goods-list.wxml @@ -0,0 +1,68 @@ + + + + + + + 松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影 + + ¥21298.00 + + + + + + + + + 松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影 + + ¥21298.00 + + + + + + + + + 松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影 + + ¥21298.00 + + + + + + + + + 松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影 + + ¥21298.00 + + + + + + + + + 松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影 + + ¥21298.00 + + + + + + + + + 松下(Panasonic)DC-BS1HGK微单相机 数码相机 模块化摄影机 视频 直播多机位 电影 + + ¥21298.00 + + + + \ No newline at end of file diff --git a/app/components/goods-list/goods-list.wxss b/app/components/goods-list/goods-list.wxss new file mode 100644 index 0000000..9a902d2 --- /dev/null +++ b/app/components/goods-list/goods-list.wxss @@ -0,0 +1,36 @@ +.list{ + width: 100%; + padding: 5px; + box-sizing: border-box; +} +.list .item{ + width: 48%; + padding: 5px; + box-sizing: border-box; + float: left; + background: #fff; + margin: 2px 1%; +} +.list .item .goods_img image{ + width: 100%; +} +.list .item .goods_info .goods_name{ + font-size: 14px; + text-align: left; + line-height:1.05rem; + height: 4.8rem; + font-family: -apple-system,'Helvetica Neue', sans-serif; + overflow: hidden; + display: -webkit-box; + word-wrap: break-all; +} +.list .item .goods_info .goods_price{ + font-size: normal; + font-family: JDZH-Regular, sans-serif; + display: inline-block; + font-size: 0.7rem; + color:#ff4142; +} +.list .item .goods_info .goods_price text{ + font-size: 1rem; +} \ No newline at end of file diff --git a/app/components/home/index.vue b/app/components/home/index.vue deleted file mode 100644 index f1b9262..0000000 --- a/app/components/home/index.vue +++ /dev/null @@ -1,116 +0,0 @@ - - - - diff --git a/app/components/jyf-parser/jyf-parser.vue b/app/components/jyf-parser/jyf-parser.vue deleted file mode 100644 index 6bc4fbd..0000000 --- a/app/components/jyf-parser/jyf-parser.vue +++ /dev/null @@ -1,814 +0,0 @@ - - - - - - diff --git a/app/components/jyf-parser/libs/CssHandler.js b/app/components/jyf-parser/libs/CssHandler.js deleted file mode 100644 index 6798178..0000000 --- a/app/components/jyf-parser/libs/CssHandler.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - 解析和匹配 Css 的选择器 - github:https://github.com/jin-yufeng/Parser - docs:https://jin-yufeng.github.io/Parser - author:JinYufeng - update:2020/03/15 -*/ -var cfg = require('./config.js'); -class CssHandler { - constructor(tagStyle) { - var styles = Object.assign({}, cfg.userAgentStyles); - for (var item in tagStyle) - styles[item] = (styles[item] ? styles[item] + ';' : '') + tagStyle[item]; - this.styles = styles; - } - getStyle = data => this.styles = new CssParser(data, this.styles).parse(); - match(name, attrs) { - var tmp, matched = (tmp = this.styles[name]) ? tmp + ';' : ''; - if (attrs.class) { - var items = attrs.class.split(' '); - for (var i = 0, item; item = items[i]; i++) - if (tmp = this.styles['.' + item]) - matched += tmp + ';'; - } - if (tmp = this.styles['#' + attrs.id]) - matched += tmp + ';'; - return matched; - } -} -module.exports = CssHandler; -class CssParser { - constructor(data, init) { - this.data = data; - this.floor = 0; - this.i = 0; - this.list = []; - this.res = init; - this.state = this.Space; - } - parse() { - for (var c; c = this.data[this.i]; this.i++) - this.state(c); - return this.res; - } - section = () => this.data.substring(this.start, this.i); - isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); - // 状态机 - Space(c) { - if (c == '.' || c == '#' || this.isLetter(c)) { - this.start = this.i; - this.state = this.Name; - } else if (c == '/' && this.data[this.i + 1] == '*') - this.Comment(); - else if (!cfg.blankChar[c] && c != ';') - this.state = this.Ignore; - } - Comment() { - this.i = this.data.indexOf('*/', this.i) + 1; - if (!this.i) this.i = this.data.length; - this.state = this.Space; - } - Ignore(c) { - if (c == '{') this.floor++; - else if (c == '}' && !--this.floor) this.state = this.Space; - } - Name(c) { - if (cfg.blankChar[c]) { - this.list.push(this.section()); - this.state = this.NameSpace; - } else if (c == '{') { - this.list.push(this.section()); - this.Content(); - } else if (c == ',') { - this.list.push(this.section()); - this.Comma(); - } else if (!this.isLetter(c) && (c < '0' || c > '9') && c != '-' && c != '_') - this.state = this.Ignore; - } - NameSpace(c) { - if (c == '{') this.Content(); - else if (c == ',') this.Comma(); - else if (!cfg.blankChar[c]) this.state = this.Ignore; - } - Comma() { - while (cfg.blankChar[this.data[++this.i]]); - if (this.data[this.i] == '{') this.Content(); - else { - this.start = this.i--; - this.state = this.Name; - } - } - Content() { - this.start = ++this.i; - if ((this.i = this.data.indexOf('}', this.i)) == -1) this.i = this.data.length; - var content = this.section(); - for (var i = 0, item; item = this.list[i++];) - if (this.res[item]) this.res[item] += ';' + content; - else this.res[item] = content; - this.list = []; - this.state = this.Space; - } -} diff --git a/app/components/jyf-parser/libs/MpHtmlParser.js b/app/components/jyf-parser/libs/MpHtmlParser.js deleted file mode 100644 index 111e02e..0000000 --- a/app/components/jyf-parser/libs/MpHtmlParser.js +++ /dev/null @@ -1,577 +0,0 @@ -/* - 将 html 解析为适用于小程序 rich-text 的 DOM 结构 - github:https://github.com/jin-yufeng/Parser - docs:https://jin-yufeng.github.io/Parser - author:JinYufeng - update:2020/04/13 -*/ -var cfg = require('./config.js'), - blankChar = cfg.blankChar, - CssHandler = require('./CssHandler.js'), - { - screenWidth, - system - } = wx.getSystemInfoSync(); -// #ifdef MP-BAIDU || MP-ALIPAY || MP-TOUTIAO -var entities = { - lt: '<', - gt: '>', - amp: '&', - quot: '"', - apos: "'", - nbsp: '\xA0', - ensp: '\u2002', - emsp: '\u2003', - ndash: '–', - mdash: '—', - middot: '·', - lsquo: '‘', - rsquo: '’', - ldquo: '“', - rdquo: '”', - bull: '•', - hellip: '…', - permil: '‰', - copy: '©', - reg: '®', - trade: '™', - times: '×', - divide: '÷', - cent: '¢', - pound: '£', - yen: '¥', - euro: '€', - sect: '§' -}; -// #endif -var emoji; // emoji 补丁包 https://jin-yufeng.github.io/Parser/#/instructions?id=emoji -class MpHtmlParser { - constructor(data, options = {}) { - this.attrs = {}; - this.compress = options.compress; - this.CssHandler = new CssHandler(options.tagStyle, screenWidth); - this.data = data; - this.domain = options.domain; - this.DOM = []; - this.i = this.start = this.audioNum = this.imgNum = this.videoNum = 0; - this.protocol = this.domain && this.domain.includes('://') ? this.domain.split('://')[0] : ''; - this.state = this.Text; - this.STACK = []; - this.useAnchor = options.useAnchor; - this.xml = options.xml; - } - parse() { - if (emoji) this.data = emoji.parseEmoji(this.data); - for (var c; c = this.data[this.i]; this.i++) - this.state(c); - if (this.state == this.Text) this.setText(); - while (this.STACK.length) this.popNode(this.STACK.pop()); - // #ifdef MP-BAIDU || MP-TOUTIAO - // 将顶层标签的一些样式提取出来给 rich-text - (function f(ns) { - for (var i = ns.length, n; n = ns[--i];) { - if (n.type == 'text') continue; - if (!n.c) { - var style = n.attrs.style; - if (style) { - var j, k, res; - if ((j = style.indexOf('display')) != -1) - res = style.substring(j, (k = style.indexOf(';', j)) == -1 ? style.length : k); - if ((j = style.indexOf('float')) != -1) - res += ';' + style.substring(j, (k = style.indexOf(';', j)) == -1 ? style.length : k); - n.attrs.contain = res; - } - } else f(n.children); - } - })(this.DOM); - // #endif - if (this.DOM.length) { - this.DOM[0].PoweredBy = 'Parser'; - if (this.title) this.DOM[0].title = this.title; - } - return this.DOM; - } - // 设置属性 - setAttr() { - var name = this.getName(this.attrName); - if (cfg.trustAttrs[name]) { - if (!this.attrVal) { - if (cfg.boolAttrs[name]) this.attrs[name] = 'T'; - } else if (name == 'src') this.attrs[name] = this.getUrl(this.attrVal.replace(/&/g, '&')); - else this.attrs[name] = this.attrVal; - } - this.attrVal = ''; - while (blankChar[this.data[this.i]]) this.i++; - if (this.isClose()) this.setNode(); - else { - this.start = this.i; - this.state = this.AttrName; - } - } - // 设置文本节点 - setText() { - var back, text = this.section(); - if (!text) return; - text = (cfg.onText && cfg.onText(text, () => back = true)) || text; - if (back) { - this.data = this.data.substr(0, this.start) + text + this.data.substr(this.i); - let j = this.start + text.length; - for (this.i = this.start; this.i < j; this.i++) this.state(this.data[this.i]); - return; - } - if (!this.pre) { - // 合并空白符 - var tmp = []; - for (let i = text.length, c; c = text[--i];) - if (!blankChar[c] || (!blankChar[tmp[0]] && (c = ' '))) tmp.unshift(c); - text = tmp.join(''); - if (text == ' ') return; - } - // 处理实体 - var siblings = this.siblings(), - i = -1, - j, en; - while (1) { - if ((i = text.indexOf('&', i + 1)) == -1) break; - if ((j = text.indexOf(';', i + 2)) == -1) break; - if (text[i + 1] == '#') { - en = parseInt((text[i + 2] == 'x' ? '0' : '') + text.substring(i + 2, j)); - if (!isNaN(en)) text = text.substr(0, i) + String.fromCharCode(en) + text.substring(j + 1); - } else { - en = text.substring(i + 1, j); - // #ifdef MP-WEIXIN || MP-QQ || APP-PLUS - if (en == 'nbsp') text = text.substr(0, i) + '\xA0' + text.substr(j + 1); // 解决   失效 - else if (en != 'lt' && en != 'gt' && en != 'amp' && en != 'ensp' && en != 'emsp' && en != 'quot' && en != 'apos') { - i && siblings.push({ - type: 'text', - text: text.substr(0, i) - }) - siblings.push({ - type: 'text', - text: `&${en};`, - en: 1 - }) - text = text.substr(j + 1); - i = -1; - } - // #endif - // #ifdef MP-BAIDU || MP-ALIPAY || MP-TOUTIAO - if (entities[en]) text = text.substr(0, i) + entities[en] + text.substr(j + 1); - // #endif - } - } - text && siblings.push({ - type: 'text', - text - }) - } - // 设置元素节点 - setNode() { - var node = { - name: this.tagName.toLowerCase(), - attrs: this.attrs - }, - close = cfg.selfClosingTags[node.name] || (this.xml && this.data[this.i] == '/'); - this.attrs = {}; - if (!cfg.ignoreTags[node.name]) { - this.matchAttr(node); - if (!close) { - node.children = []; - if (node.name == 'pre' && cfg.highlight) { - this.remove(node); - this.pre = node.pre = true; - } - this.siblings().push(node); - this.STACK.push(node); - } else if (!cfg.filter || cfg.filter(node, this) != false) - this.siblings().push(node); - } else { - if (!close) this.remove(node); - else if (node.name == 'source') { - var parent = this.STACK[this.STACK.length - 1], - attrs = node.attrs; - if (parent && attrs.src) - if (parent.name == 'video' || parent.name == 'audio') - parent.attrs.source.push(attrs.src); - else { - var i, media = attrs.media; - if (parent.name == 'picture' && !parent.attrs.src && !(attrs.src.indexOf('.webp') && system.includes('iOS')) && - (!media || (media.includes('px') && - (((i = media.indexOf('min-width')) != -1 && (i = media.indexOf(':', i + 8)) != -1 && screenWidth > parseInt( - media.substr(i + 1))) || - ((i = media.indexOf('max-width')) != -1 && (i = media.indexOf(':', i + 8)) != -1 && screenWidth < parseInt( - media.substr(i + 1))))))) - parent.attrs.src = attrs.src; - } - } else if (node.name == 'base' && !this.domain) this.domain = node.attrs.href; - } - if (this.data[this.i] == '/') this.i++; - this.start = this.i + 1; - this.state = this.Text; - } - // 移除标签 - remove(node) { - var name = node.name, - j = this.i; - while (1) { - if ((this.i = this.data.indexOf('', this.i)) == -1) this.i = this.data.length; - // 处理 svg - if (name == 'svg') { - var src = this.data.substring(j, this.i + 1); - if (!node.attrs.xmlns) src = ' xmlns="http://www.w3.org/2000/svg"' + src; - var i = j; - while (this.data[j] != '<') j--; - src = this.data.substring(j, i) + src; - var parent = this.STACK[this.STACK.length - 1]; - if (node.attrs.width == '100%' && parent && (parent.attrs.style || '').includes('inline')) - parent.attrs.style = 'width:300px;max-width:100%;' + parent.attrs.style; - this.siblings().push({ - name: 'img', - attrs: { - src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'), - ignore: 'T' - } - }) - } - return; - } - } - } - // 处理属性 - matchAttr(node) { - var attrs = node.attrs, - style = this.CssHandler.match(node.name, attrs, node) + (attrs.style || ''), - styleObj = {}; - if (attrs.id) { - if (this.compress & 1) attrs.id = void 0; - else if (this.useAnchor) this.bubble(); - } - if ((this.compress & 2) && attrs.class) attrs.class = void 0; - switch (node.name) { - case 'img': - if (attrs['data-src']) { - attrs.src = attrs.src || attrs['data-src']; - attrs['data-src'] = void 0; - } - if (attrs.src && !attrs.ignore) { - if (this.bubble()) attrs.i = (this.imgNum++).toString(); - else attrs.ignore = 'T'; - } - break; - case 'a': - case 'ad': - // #ifdef APP-PLUS - case 'iframe': - case 'embed': - // #endif - this.bubble(); - break; - case 'font': - if (attrs.color) { - styleObj['color'] = attrs.color; - attrs.color = void 0; - } - if (attrs.face) { - styleObj['font-family'] = attrs.face; - attrs.face = void 0; - } - if (attrs.size) { - var size = parseInt(attrs.size); - if (size < 1) size = 1; - else if (size > 7) size = 7; - var map = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']; - styleObj['font-size'] = map[size - 1]; - attrs.size = void 0; - } - break; - case 'video': - case 'audio': - if (!attrs.id) attrs.id = node.name + (++this[`${node.name}Num`]); - else this[`${node.name}Num`]++; - if (node.name == 'video') { - if (attrs.width) { - style = `width:${parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px')};${style}`; - attrs.width = void 0; - } - if (attrs.height) { - style = `height:${parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px')};${style}`; - attrs.height = void 0; - } - if (this.videoNum > 3) node.lazyLoad = true; - } - attrs.source = []; - if (attrs.src) attrs.source.push(attrs.src); - if (!attrs.controls && !attrs.autoplay) - console.warn(`存在没有 controls 属性的 ${node.name} 标签,可能导致无法播放`, node); - this.bubble(); - break; - case 'td': - case 'th': - if (attrs.colspan || attrs.rowspan) - for (var k = this.STACK.length, item; item = this.STACK[--k];) - if (item.name == 'table') { - item.c = void 0; - break; - } - } - if (attrs.align) { - styleObj['text-align'] = attrs.align; - attrs.align = void 0; - } - // 压缩 style - var styles = style.replace(/"/g, '"').replace(/&/g, '&').split(';'); - style = ''; - for (var i = 0, len = styles.length; i < len; i++) { - var info = styles[i].split(':'); - if (info.length < 2) continue; - let key = info[0].trim().toLowerCase(), - value = info.slice(1).join(':').trim(); - if (value.includes('-webkit') || value.includes('-moz') || value.includes('-ms') || value.includes('-o') || value - .includes( - 'safe')) - style += `;${key}:${value}`; - else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import')) - styleObj[key] = value; - } - if (node.name == 'img' && parseInt(styleObj.width || attrs.width) > screenWidth) - styleObj.height = 'auto'; - for (var key in styleObj) { - var value = styleObj[key]; - if (key.includes('flex') || key == 'order' || key == 'self-align') node.c = 1; - // 填充链接 - if (value.includes('url')) { - var j = value.indexOf('('); - if (j++ != -1) { - while (value[j] == '"' || value[j] == "'" || blankChar[value[j]]) j++; - value = value.substr(0, j) + this.getUrl(value.substr(j)); - } - } - // 转换 rpx - else if (value.includes('rpx')) - value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * screenWidth / 750 + 'px'); - else if (key == 'white-space' && value.includes('pre')) - this.pre = node.pre = true; - style += `;${key}:${value}`; - } - style = style.substr(1); - if (style) attrs.style = style; - } - // 节点出栈处理 - popNode(node) { - // 空白符处理 - if (node.pre) { - node.pre = this.pre = void 0; - for (let i = this.STACK.length; i--;) - if (this.STACK[i].pre) - this.pre = true; - } - if (node.name == 'head' || (cfg.filter && cfg.filter(node, this) == false)) - return this.siblings().pop(); - var attrs = node.attrs; - // 替换一些标签名 - if (node.name == 'picture') { - node.name = 'img'; - if (!attrs.src && (node.children[0] || '').name == 'img') - attrs.src = node.children[0].attrs.src; - if (attrs.src && !attrs.ignore) - attrs.i = (this.imgNum++).toString(); - return node.children = void 0; - } - if (cfg.blockTags[node.name]) node.name = 'div'; - else if (!cfg.trustTags[node.name]) node.name = 'span'; - // 处理列表 - if (node.c) { - if (node.name == 'ul') { - var floor = 1; - for (let i = this.STACK.length; i--;) - if (this.STACK[i].name == 'ul') floor++; - if (floor != 1) - for (let i = node.children.length; i--;) - node.children[i].floor = floor; - } else if (node.name == 'ol') { - for (let i = 0, num = 1, child; child = node.children[i++];) - if (child.name == 'li') { - child.type = 'ol'; - child.num = ((num, type) => { - if (type == 'a') return String.fromCharCode(97 + (num - 1) % 26); - if (type == 'A') return String.fromCharCode(65 + (num - 1) % 26); - if (type == 'i' || type == 'I') { - num = (num - 1) % 99 + 1; - var one = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'], - ten = ['X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'], - res = (ten[Math.floor(num / 10) - 1] || '') + (one[num % 10 - 1] || ''); - if (type == 'i') return res.toLowerCase(); - return res; - } - return num; - })(num++, attrs.type) + '.'; - } - } - } - // 处理表格的边框 - if (node.name == 'table') { - var padding = attrs.cellpadding, - spacing = attrs.cellspacing, - border = attrs.border; - if (node.c) { - this.bubble(); - if (!padding) padding = 2; - if (!spacing) spacing = 2; - } - if (border) attrs.style = `border:${border}px solid gray;${attrs.style || ''}`; - if (spacing) attrs.style = `border-spacing:${spacing}px;${attrs.style || ''}`; - if (border || padding) - (function f(ns) { - for (var i = 0, n; n = ns[i]; i++) { - if (n.name == 'th' || n.name == 'td') { - if (border) n.attrs.style = `border:${border}px solid gray;${n.attrs.style}`; - if (padding) n.attrs.style = `padding:${padding}px;${n.attrs.style}`; - } else f(n.children || []); - } - })(node.children) - } - this.CssHandler.pop && this.CssHandler.pop(node); - // 自动压缩 - if (node.name == 'div' && !Object.keys(attrs).length) { - var siblings = this.siblings(); - if (node.children.length == 1 && node.children[0].name == 'div') - siblings[siblings.length - 1] = node.children[0]; - } - } - // 工具函数 - bubble() { - for (var i = this.STACK.length, item; item = this.STACK[--i];) { - if (cfg.richOnlyTags[item.name]) { - if (item.name == 'table' && !Object.hasOwnProperty.call(item, 'c')) item.c = 1; - return false; - } - item.c = 1; - } - return true; - } - getName = val => this.xml ? val : val.toLowerCase(); - getUrl(url) { - if (url[0] == '/') { - if (url[1] == '/') url = this.protocol + ':' + url; - else if (this.domain) url = this.domain + url; - } else if (this.domain && url.indexOf('data:') != 0 && !url.includes('://')) - url = this.domain + '/' + url; - return url; - } - isClose = () => this.data[this.i] == '>' || (this.data[this.i] == '/' && this.data[this.i + 1] == '>'); - section = () => this.data.substring(this.start, this.i); - siblings = () => this.STACK.length ? this.STACK[this.STACK.length - 1].children : this.DOM; - // 状态机 - Text(c) { - if (c == '<') { - var next = this.data[this.i + 1], - isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); - if (isLetter(next)) { - this.setText(); - this.start = this.i + 1; - this.state = this.TagName; - } else if (next == '/') { - this.setText(); - if (isLetter(this.data[++this.i + 1])) { - this.start = this.i + 1; - this.state = this.EndTag; - } else - this.Comment(); - } else if (next == '!') { - this.setText(); - this.Comment(); - } - } - } - Comment() { - var key; - if (this.data.substring(this.i + 2, this.i + 4) == '--') key = '-->'; - else if (this.data.substring(this.i + 2, this.i + 9) == '[CDATA[') key = ']]>'; - else key = '>'; - if ((this.i = this.data.indexOf(key, this.i + 2)) == -1) this.i = this.data.length; - else this.i += key.length - 1; - this.start = this.i + 1; - this.state = this.Text; - } - TagName(c) { - if (blankChar[c]) { - this.tagName = this.section(); - while (blankChar[this.data[this.i]]) this.i++; - if (this.isClose()) this.setNode(); - else { - this.start = this.i; - this.state = this.AttrName; - } - } else if (this.isClose()) { - this.tagName = this.section(); - this.setNode(); - } - } - AttrName(c) { - var blank = blankChar[c]; - if (blank) { - this.attrName = this.section(); - c = this.data[this.i]; - } - if (c == '=') { - if (!blank) this.attrName = this.section(); - while (blankChar[this.data[++this.i]]); - this.start = this.i--; - this.state = this.AttrValue; - } else if (blank) this.setAttr(); - else if (this.isClose()) { - this.attrName = this.section(); - this.setAttr(); - } - } - AttrValue(c) { - if (c == '"' || c == "'") { - this.start++; - if ((this.i = this.data.indexOf(c, this.i + 1)) == -1) return this.i = this.data.length; - this.attrVal = this.section(); - this.i++; - } else { - for (; !blankChar[this.data[this.i]] && !this.isClose(); this.i++); - this.attrVal = this.section(); - } - this.setAttr(); - } - EndTag(c) { - if (blankChar[c] || c == '>' || c == '/') { - var name = this.getName(this.section()); - for (var i = this.STACK.length; i--;) - if (this.STACK[i].name == name) break; - if (i != -1) { - var node; - while ((node = this.STACK.pop()).name != name); - this.popNode(node); - } else if (name == 'p' || name == 'br') - this.siblings().push({ - name, - attrs: {} - }); - this.i = this.data.indexOf('>', this.i); - this.start = this.i + 1; - if (this.i == -1) this.i = this.data.length; - else this.state = this.Text; - } - } -} -module.exports = MpHtmlParser; diff --git a/app/components/jyf-parser/libs/config.js b/app/components/jyf-parser/libs/config.js deleted file mode 100644 index bee0e69..0000000 --- a/app/components/jyf-parser/libs/config.js +++ /dev/null @@ -1,80 +0,0 @@ -/* 配置文件 */ -// #ifdef MP-WEIXIN -const canIUse = wx.canIUse('editor'); // 高基础库标识,用于兼容 -// #endif -module.exports = { - // 过滤器函数 - filter: null, - // 代码高亮函数 - highlight: null, - // 文本处理函数 - onText: null, - blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'), - // 块级标签,将被转为 div - blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,section' + ( - // #ifdef MP-WEIXIN - canIUse ? '' : - // #endif - ',pre')), - // 将被移除的标签 - ignoreTags: makeMap( - 'area,base,basefont,canvas,command,frame,input,isindex,keygen,link,map,meta,param,script,source,style,svg,textarea,title,track,use,wbr' - // #ifdef MP-WEIXIN - + (canIUse ? ',rp' : '') - // #endif - // #ifndef APP-PLUS - + ',embed,iframe' - // #endif - ), - // 只能被 rich-text 显示的标签 - richOnlyTags: makeMap('a,colgroup,fieldset,legend,picture,table' - // #ifdef MP-WEIXIN - + (canIUse ? ',bdi,bdo,caption,rt,ruby' : '') - // #endif - ), - // 自闭合的标签 - selfClosingTags: makeMap( - 'area,base,basefont,br,col,circle,ellipse,embed,frame,hr,img,input,isindex,keygen,line,link,meta,param,path,polygon,rect,source,track,use,wbr' - ), - // 信任的属性 - trustAttrs: makeMap( - 'align,alt,app-id,author,autoplay,border,cellpadding,cellspacing,class,color,colspan,controls,data-src,dir,face,height,href,id,ignore,loop,media,muted,name,path,poster,rowspan,size,span,src,start,style,type,unit-id,width,xmlns' - ), - // bool 型的属性 - boolAttrs: makeMap('autoplay,controls,ignore,loop,muted'), - // 信任的标签 - trustTags: makeMap( - 'a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video' - // #ifdef MP-WEIXIN - + (canIUse ? ',bdi,bdo,caption,pre,rt,ruby' : '') - // #endif - // #ifdef APP-PLUS - + ',embed,iframe' - // #endif - ), - // 默认的标签样式 - userAgentStyles: { - address: 'font-style:italic', - big: 'display:inline;font-size:1.2em', - blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px', - caption: 'display:table-caption;text-align:center', - center: 'text-align:center', - cite: 'font-style:italic', - dd: 'margin-left:40px', - img: 'max-width:100%', - mark: 'background-color:yellow', - picture: 'max-width:100%', - pre: 'font-family:monospace;white-space:pre;overflow:scroll', - s: 'text-decoration:line-through', - small: 'display:inline;font-size:0.8em', - u: 'text-decoration:underline' - } -} - -function makeMap(str) { - var map = {}, - list = str.split(','); - for (var i = list.length; i--;) - map[list[i]] = true; - return map; -} diff --git a/app/components/jyf-parser/libs/handler.sjs b/app/components/jyf-parser/libs/handler.sjs deleted file mode 100644 index 5eca3fd..0000000 --- a/app/components/jyf-parser/libs/handler.sjs +++ /dev/null @@ -1,35 +0,0 @@ -var inlineTags = { - abbr: 1, - b: 1, - big: 1, - code: 1, - del: 1, - em: 1, - i: 1, - ins: 1, - label: 1, - q: 1, - small: 1, - span: 1, - strong: 1 -} -export default { - // 从顶层标签的样式中取出一些给 rich-text - getStyle: function(style) { - if (style) { - var i, j, res = ''; - if ((i = style.indexOf('display')) != -1) - res = style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j); - if ((i = style.indexOf('float')) != -1) - res += ';' + style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j); - return res; - } - }, - getNode: function(item) { - return [item]; - }, - // 是否通过 rich-text 显示 - useRichText: function(item) { - return !item.c && !inlineTags[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1; - } -} diff --git a/app/components/jyf-parser/libs/handler.wxs b/app/components/jyf-parser/libs/handler.wxs deleted file mode 100644 index c37cd40..0000000 --- a/app/components/jyf-parser/libs/handler.wxs +++ /dev/null @@ -1,44 +0,0 @@ -var inlineTags = { - abbr: 1, - b: 1, - big: 1, - code: 1, - del: 1, - em: 1, - i: 1, - ins: 1, - label: 1, - q: 1, - small: 1, - span: 1, - strong: 1 -} -module.exports = { - // 从顶层标签的样式中取出一些给 rich-text - getStyle: function(style) { - if (style) { - var i, j, res = ''; - if ((i = style.indexOf('display')) != -1) - res = style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j); - if ((i = style.indexOf('float')) != -1) - res += ';' + style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j); - return res; - } - }, - // 处理懒加载 - getNode: function(item, imgLoad) { - if (!imgLoad && item.attrs.i != '0') { - var img = { - name: 'img', - attrs: JSON.parse(JSON.stringify(item.attrs)) - } - delete img.attrs.src; - img.attrs.style += ';width:20px;height:20px'; - return [img]; - } else return [item]; - }, - // 是否通过 rich-text 显示 - useRichText: function(item) { - return !item.c && !inlineTags[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1; - } -} diff --git a/app/components/jyf-parser/libs/trees.vue b/app/components/jyf-parser/libs/trees.vue deleted file mode 100644 index 396eec3..0000000 --- a/app/components/jyf-parser/libs/trees.vue +++ /dev/null @@ -1,476 +0,0 @@ - -