diff --git a/jiuyi2/api/mine.js b/jiuyi2/api/mine.js index aa487d3f..e0b9c5af 100644 --- a/jiuyi2/api/mine.js +++ b/jiuyi2/api/mine.js @@ -299,12 +299,12 @@ const mine = { }, /** - * 账号解冻 + * 我的账单列表 * @param {Object} param */ getWalletBillList(param) { return util.request({ - url: '/user/walletTransaction/list', + url: '/user/walletTransaction/app/list', data: param.data, query: param.query, method: 'GET', diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index 8443338c..d9448b2f 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -6,7 +6,7 @@ const config = { // host: 'h5api', // #endif // #ifndef H5 - host: 'http://91f.xyz:8080', + host: 'http://91f.xyz:8080', // #endif // 支付方式配置 payType: { diff --git a/jiuyi2/common/js/parseHtml.js b/jiuyi2/common/js/parseHtml.js new file mode 100644 index 00000000..0d28a40c --- /dev/null +++ b/jiuyi2/common/js/parseHtml.js @@ -0,0 +1,352 @@ +/* + * 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; \ No newline at end of file diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js index fe31a50b..36f0c9ca 100644 --- a/jiuyi2/common/js/util.js +++ b/jiuyi2/common/js/util.js @@ -616,10 +616,17 @@ const util = { mode: 'img', success(res) { if (res.code === 200) { - const result = res.data.url; - obj.success && obj.success({ - value: result, - }); + uni.getImageInfo({ + src: item.path, + success: imageInfo => { + const result = res.data.url; + obj.success && obj.success({ + value: result, + width: imageInfo.width, + height: imageInfo.height, + }); + }, + }) return; } util.alert(rs.msg); diff --git a/jiuyi2/components/public/editor/editor.vue b/jiuyi2/components/public/editor/editor.vue index 47a9317f..fbaca452 100644 --- a/jiuyi2/components/public/editor/editor.vue +++ b/jiuyi2/components/public/editor/editor.vue @@ -35,10 +35,14 @@ }) // 颜色板键值 const colorKey = ref('forecolor') + // 富文本编辑器宽度 + const editorWidth = ref(0) onMounted(() => { // 创建编辑器上下文对象 onEditorReady() + // 获取编辑器节点信息 + getEditorInfo() }) // 创建编辑器上下文对象 @@ -48,6 +52,14 @@ }).exec() } + // 获取编辑器节点信息 用来处理图片 + function getEditorInfo() { + const query = uni.createSelectorQuery().in(proxy); + query.select("#editor").boundingClientRect((data) => { + editorWidth.value = data.width + }).exec(); + } + // 初始化编辑器上下文对象 function init(html) { editorCtx.value.setContents({ @@ -55,15 +67,6 @@ }) } - // 获取内容 - function getEditorContents() { - editorCtx.value.getContents({ - success: rs => { - return rs - } - }) - } - // 撤销 function undo() { editorCtx.value.undo() @@ -85,7 +88,7 @@ } = event.target.dataset if (!name) return editorCtx.value.format(name, value) - } + } /** * 编辑器状态被变化 @@ -118,6 +121,8 @@ editorCtx.value.insertImage({ src: rs.value, alt: '图像', + width: Math.min(rs.width, editorWidth.value), + extClass: 'editorImg', }) } }) @@ -186,7 +191,6 @@ defineExpose({ init, - getEditorContents, }) @@ -196,7 +200,7 @@ 加粗 - 倾斜 + 下划线 @@ -208,7 +212,7 @@ 右对齐 - 两端对齐 + 清除所有格式 @@ -232,9 +236,9 @@ 重做 - 增加缩进 + - 减少缩进 + 分割线 @@ -242,9 +246,9 @@ 插入标题 - 下标 + - 上标 + 清空内容 diff --git a/jiuyi2/components/public/parse/libs/html2json.js b/jiuyi2/components/public/parse/libs/html2json.js new file mode 100644 index 00000000..b712e070 --- /dev/null +++ b/jiuyi2/components/public/parse/libs/html2json.js @@ -0,0 +1,271 @@ +/** + * html2Json 改造来自: https://github.com/Jxck/html2json + * + * + * author: Di (微信小程序开发工程师) + * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) + * 垂直微信小程序开发交流社区 + * + * github地址: https://github.com/icindy/wxParse + * + * for: 微信小程序富文本解析 + * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 + */ + +import wxDiscode from './wxDiscode'; +import HTMLParser from './htmlparser'; + +function makeMap(str) { + const obj = {}; + const items = str.split(','); + for (let i = 0; i < items.length; i += 1) obj[items[i]] = true; + return obj; +} + +// Block Elements - HTML 5 +const block = makeMap( + 'br,code,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,ins,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 +const inline = makeMap( + 'a,abbr,acronym,applet,b,basefont,bdo,big,button,cite,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) +const closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); + +function removeDOCTYPE(html) { + const isDocument = /([^]*)<\/body>/.test(html); + return isDocument ? RegExp.$1 : html; +} + +function trimHtml(html) { + return html + .replace(//gi, '') + .replace(/\/\*.*?\*\//gi, '') + .replace(/[ ]+/gi, '') + .replace(//gi, ''); +} + +function getScreenInfo() { + const screen = {}; + wx.getSystemInfo({ + success: (res) => { + screen.width = res.windowWidth; + screen.height = res.windowHeight; + }, + }); + return screen; +} + +function html2json(html, customHandler, imageProp, host) { + // 处理字符串 + html = removeDOCTYPE(html); + html = trimHtml(html); + html = wxDiscode.strDiscode(html); + // 生成node节点 + const bufArray = []; + const results = { + nodes: [], + imageUrls: [], + }; + + const screen = getScreenInfo(); + + function Node(tag) { + this.node = 'element'; + this.tag = tag; + + this.$screen = screen; + } + + HTMLParser(html, { + start(tag, attrs, unary) { + // node for this element + const node = new Node(tag); + + if (bufArray.length !== 0) { + const parent = bufArray[0]; + if (parent.nodes === undefined) { + parent.nodes = []; + } + } + + if (block[tag]) { + node.tagType = 'block'; + } else if (inline[tag]) { + node.tagType = 'inline'; + } else if (closeSelf[tag]) { + node.tagType = 'closeSelf'; + } + + node.attr = attrs.reduce((pre, attr) => { + const { + name + } = attr; + let { + value + } = attr; + if (name === 'class') { + node.classStr = value; + } + // has multi attibutes + // make it array of attribute + if (name === 'style') { + node.styleStr = value; + } + if (value.match(/ /)) { + value = value.split(' '); + } + + // if attr already exists + // merge it + if (pre[name]) { + if (Array.isArray(pre[name])) { + // already array, push to last + pre[name].push(value); + } else { + // single value, make it array + pre[name] = [pre[name], value]; + } + } else { + // not exist, put it + pre[name] = value; + } + + return pre; + }, {}); + + // 优化样式相关属性 + if (node.classStr) { + node.classStr += ` ${node.tag}`; + } else { + node.classStr = node.tag; + } + if (node.tagType === 'inline') { + node.classStr += ' inline'; + } + + // 对img添加额外数据 + if (node.tag === 'img') { + let imgUrl = node.attr.src; + imgUrl = wxDiscode.urlToHttpUrl(imgUrl, imageProp.domain); + Object.assign(node.attr, imageProp, { + src: imgUrl || '', + }); + if (imgUrl) { + results.imageUrls.push(imgUrl); + } + } + + // 处理a标签属性 + if (node.tag === 'a') { + node.attr.href = node.attr.href || ''; + } + + // 处理font标签样式属性 + if (node.tag === 'font') { + const fontSize = [ + 'x-small', + 'small', + 'medium', + 'large', + 'x-large', + 'xx-large', + '-webkit-xxx-large', + ]; + const styleAttrs = { + color: 'color', + face: 'font-family', + size: 'font-size', + }; + if (!node.styleStr) node.styleStr = ''; + Object.keys(styleAttrs).forEach((key) => { + if (node.attr[key]) { + const value = key === 'size' ? fontSize[node.attr[key] - 1] : node.attr[key]; + node.styleStr += `${styleAttrs[key]}: ${value};`; + } + }); + } + + // 临时记录source资源 + if (node.tag === 'source') { + results.source = node.attr.src; + } + + if (customHandler.start) { + customHandler.start(node, results); + } + + if (unary) { + // if this tag doesn't have end tag + // like + // add to parents + const parent = bufArray[0] || results; + if (parent.nodes === undefined) { + parent.nodes = []; + } + parent.nodes.push(node); + } else { + bufArray.unshift(node); + } + }, + end(tag) { + // merge into parent tag + const node = bufArray.shift(); + if (node.tag !== tag) { + console.error('invalid state: mismatch end tag'); + } + + // 当有缓存source资源时于于video补上src资源 + if (node.tag === 'video' && results.source) { + node.attr.src = results.source; + delete results.source; + } + + if (customHandler.end) { + customHandler.end(node, results); + } + + if (bufArray.length === 0) { + results.nodes.push(node); + } else { + const parent = bufArray[0]; + if (!parent.nodes) { + parent.nodes = []; + } + parent.nodes.push(node); + } + }, + chars(text, results) { + if (!text.trim()) return; + + const node = { + node: 'text', + text, + }; + if(results && results.styleStr) node.styleStr = results.styleStr + + if (customHandler.chars) { + customHandler.chars(node, results); + } + + if (bufArray.length === 0) { + results.nodes.push(node); + } else { + const parent = bufArray[0]; + if (parent.nodes === undefined) { + parent.nodes = []; + } + parent.nodes.push(node); + } + }, + }); + + return results; +} + +export default html2json; \ No newline at end of file diff --git a/jiuyi2/components/public/parse/libs/htmlparser.js b/jiuyi2/components/public/parse/libs/htmlparser.js new file mode 100644 index 00000000..2939da3d --- /dev/null +++ b/jiuyi2/components/public/parse/libs/htmlparser.js @@ -0,0 +1,156 @@ +/** + * + * htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser + * + * author: Di (微信小程序开发工程师) + * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) + * 垂直微信小程序开发交流社区 + * + * github地址: https://github.com/icindy/wxParse + * + * for: 微信小程序富文本解析 + * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 + */ +// Regular Expressions for parsing tags and attributes + +const startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z0-9_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/; +const endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/; +const attr = /([a-zA-Z0-9_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; + +function makeMap(str) { + const obj = {}; + const items = str.split(','); + for (let i = 0; i < items.length; i += 1) obj[items[i]] = true; + return obj; +} + +// Empty Elements - HTML 5 +const empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); + +// Block Elements - HTML 5 +const block = makeMap('address,code,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,ins,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 +const inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,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) +const closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); + +// Attributes that have their values filled in disabled="disabled" +const fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); + +function HTMLParser(html, handler) { + let index; + let chars; + let match; + let last = html; + const stack = []; + + stack.last = () => stack[stack.length - 1]; + + function parseEndTag(tag, tagName) { + // If no tag name is provided, clean shop + let pos; + if (!tagName) { + pos = 0; + } else { + // Find the closest opened tag of the same type + tagName = tagName.toLowerCase(); + for (pos = stack.length - 1; pos >= 0; pos -= 1) { + if (stack[pos] === tagName) break; + } + } + if (pos >= 0) { + // Close all the open elements, up the stack + for (let i = stack.length - 1; i >= pos; i -= 1) { + if (handler.end) handler.end(stack[i]); + } + + // Remove the open elements from the stack + stack.length = pos; + } + } + + 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) { + const attrs = []; + + rest.replace(attr, function genAttr(matches, name) { + const value = arguments[2] || arguments[3] || arguments[4] || (fillAttrs[name] ? name : ''); + + attrs.push({ + name, + value, + escaped: value.replace(/(^|[^\\])"/g, '$1\\"'), // " + }); + }); + + if (handler.start) { + handler.start(tagName, attrs, unary); + } + } + } + + while (html) { + chars = true; + + if (html.indexOf(''); + str = str.replace(/•/g, '•'); + + return str; +} + +// HTML 支持的其他实体 +function strOtherDiscode(str) { + str = str.replace(/Œ/g, 'Œ'); + str = str.replace(/œ/g, 'œ'); + str = str.replace(/Š/g, 'Š'); + str = str.replace(/š/g, 'š'); + str = str.replace(/Ÿ/g, 'Ÿ'); + str = str.replace(/ƒ/g, 'ƒ'); + str = str.replace(/ˆ/g, 'ˆ'); + str = str.replace(/˜/g, '˜'); + str = str.replace(/ /g, ''); + str = str.replace(/ /g, ''); + str = str.replace(/ /g, ''); + str = str.replace(/‌/g, ''); + str = str.replace(/‍/g, ''); + str = str.replace(/‎/g, ''); + str = str.replace(/‏/g, ''); + str = str.replace(/–/g, '–'); + str = str.replace(/—/g, '—'); + str = str.replace(/‘/g, '‘'); + str = str.replace(/’/g, '’'); + str = str.replace(/‚/g, '‚'); + str = str.replace(/“/g, '“'); + str = str.replace(/”/g, '”'); + str = str.replace(/„/g, '„'); + str = str.replace(/†/g, '†'); + str = str.replace(/‡/g, '‡'); + str = str.replace(/•/g, '•'); + str = str.replace(/…/g, '…'); + str = str.replace(/‰/g, '‰'); + str = str.replace(/′/g, '′'); + str = str.replace(/″/g, '″'); + str = str.replace(/‹/g, '‹'); + str = str.replace(/›/g, '›'); + str = str.replace(/‾/g, '‾'); + str = str.replace(/€/g, '€'); + str = str.replace(/™/g, '™'); + + str = str.replace(/←/g, '←'); + str = str.replace(/↑/g, '↑'); + str = str.replace(/→/g, '→'); + str = str.replace(/↓/g, '↓'); + str = str.replace(/↔/g, '↔'); + str = str.replace(/↵/g, '↵'); + str = str.replace(/⌈/g, '⌈'); + str = str.replace(/⌉/g, '⌉'); + + str = str.replace(/⌊/g, '⌊'); + str = str.replace(/⌋/g, '⌋'); + str = str.replace(/◊/g, '◊'); + str = str.replace(/♠/g, '♠'); + str = str.replace(/♣/g, '♣'); + str = str.replace(/♥/g, '♥'); + + str = str.replace(/♦/g, '♦'); + str = str.replace(/'/g, "'"); + return str; +} + +function strDiscode(str) { + str = strNumDiscode(str); + str = strGreeceDiscode(str); + str = strcharacterDiscode(str); + str = strOtherDiscode(str); + return str; +} + +function urlToHttpUrl(url, domain) { + if (/^\/\//.test(url)) { + return `https:${url}`; + } else if (/^\//.test(url)) { + return `https://${domain}${url}`; + } + return url; +} + +export default { + strDiscode, + urlToHttpUrl, +}; diff --git a/jiuyi2/components/public/parse/parse.vue b/jiuyi2/components/public/parse/parse.vue new file mode 100644 index 00000000..c79267f4 --- /dev/null +++ b/jiuyi2/components/public/parse/parse.vue @@ -0,0 +1,118 @@ + + + + + \ No newline at end of file diff --git a/jiuyi2/components/public/parse/parseTemplate.vue b/jiuyi2/components/public/parse/parseTemplate.vue new file mode 100644 index 00000000..e3e450d6 --- /dev/null +++ b/jiuyi2/components/public/parse/parseTemplate.vue @@ -0,0 +1,225 @@ + + + + + \ No newline at end of file diff --git a/jiuyi2/components/public/parse/style.scss b/jiuyi2/components/public/parse/style.scss new file mode 100644 index 00000000..87667aab --- /dev/null +++ b/jiuyi2/components/public/parse/style.scss @@ -0,0 +1,221 @@ +.parse { + width: 100%; + font-family: Helvetica, sans-serif; + font-size: 30upx; + color: #666; + line-height: 1.8; +} + +.parse view { + word-break: hyphenate; +} + +.parse .inline { + display: inline; + margin: 0; + padding: 0; +} + +.parse .div { + margin: 0; + padding: 0; +} + +.parse .h1 .text { + font-size: 2em; + margin: 0.67em 0; +} +.parse .h2 .text { + font-size: 1.5em; + margin: 0.83em 0; +} +.parse .h3 .text { + font-size: 1.17em; + margin: 1em 0; +} +.parse .h4 .text { + margin: 1.33em 0; +} +.parse .h5 .text { + font-size: 0.83em; + margin: 1.67em 0; +} +.parse .h6 .text { + font-size: 0.67em; + margin: 2.33em 0; +} + +.parse .h1 .text, +.parse .h2 .text, +.parse .h3 .text, +.parse .h4 .text, +.parse .h5 .text, +.parse .h6 .text, +.parse .b, +.parse .strong { + font-weight: bolder; +} + + +.parse .p { + margin: 1em 0; +} + +.parse .i, +.parse .cite, +.parse .em, +.parse .var, +.parse .address { + font-style: italic; +} + +.parse .pre, +.parse .tt, +.parse .code, +.parse .kbd, +.parse .samp { + font-family: monospace; +} +.parse .pre { + overflow: auto; + background: #f5f5f5; + padding: 16upx; + white-space: pre; + margin: 1em 0upx; +} +.parse .code { + display: inline; + background: #f5f5f5; +} + +.parse .big { + font-size: 1.17em; +} + +.parse .small, +.parse .sub, +.parse .sup { + font-size: 0.83em; +} + +.parse .sub { + vertical-align: sub; +} +.parse .sup { + vertical-align: super; +} + +.parse .s, +.parse .strike, +.parse .del { + text-decoration: line-through; +} + +.parse .strong, +.parse .s { + display: inline; +} + +.parse .a { + color: deepskyblue; +} + +.parse .video { + text-align: center; + margin: 22upx 0; +} + +.parse .video-video { + width: 100%; +} + +.parse .img { + /* display: inline-block; + width: 0; + height: 0; + max-width: 100%; + overflow: hidden; */ +} + +.parse .blockquote { + margin: 10upx 0; + padding: 22upx 0 22upx 22upx; + font-family: Courier, Calibri, "宋体"; + background: #f5f5f5; + border-left: 6upx solid #dbdbdb; +} +.parse .blockquote .p { + margin: 0; +} + +.parse .ul, .parse .ol { + display: block; + margin: 1em 0; + padding-left: 33upx; +} +.parse .ol { + list-style-type: disc; +} +.parse .ol { + list-style-type: decimal; +} +.parse .ol>weixin-parse-template,.parse .ul>weixin-parse-template { + display: list-item; + align-items: baseline; + text-align: match-parent; +} + +.parse .ol>.li,.parse .ul>.li { + display: list-item; + align-items: baseline; + text-align: match-parent; +} +.parse .ul .ul, .parse .ol .ul { + list-style-type: circle; +} +.parse .ol .ol .ul, .parse .ol .ul .ul, .parse .ul .ol .ul, .parse .ul .ul .ul { + list-style-type: square; +} + +.parse .u { + text-decoration: underline; +} +.parse .hide { + display: none; +} +.parse .del { + display: inline; +} +.parse .figure { + overflow: hidden; +} + +.parse .table { + width: 100%; +} +.parse .thead, .parse .tfoot, .parse .tr { + display: flex; + flex-direction: row; +} +.parse .tr { + width:100%; + display: flex; + border-right: 2upx solid #e0e0e0; + border-bottom: 2upx solid #e0e0e0; +} +.parse .th, +.parse .td { + display: flex; + width: 1276upx; + overflow: auto; + flex: 1; + padding: 11upx; + border-left: 2upx solid #e0e0e0; +} +.parse .td:last { + border-top: 2upx solid #e0e0e0; +} +.parse .th { + background: #f0f0f0; + border-top: 2upx solid #e0e0e0; +} diff --git a/jiuyi2/components/public/parse/wxParseAudio.vue b/jiuyi2/components/public/parse/wxParseAudio.vue new file mode 100644 index 00000000..86df2460 --- /dev/null +++ b/jiuyi2/components/public/parse/wxParseAudio.vue @@ -0,0 +1,27 @@ + + + diff --git a/jiuyi2/components/public/parse/wxParseImg.vue b/jiuyi2/components/public/parse/wxParseImg.vue new file mode 100644 index 00000000..2cc27e51 --- /dev/null +++ b/jiuyi2/components/public/parse/wxParseImg.vue @@ -0,0 +1,105 @@ + + + + + \ No newline at end of file diff --git a/jiuyi2/components/public/parse/wxParseVideo.vue b/jiuyi2/components/public/parse/wxParseVideo.vue new file mode 100644 index 00000000..a952f585 --- /dev/null +++ b/jiuyi2/components/public/parse/wxParseVideo.vue @@ -0,0 +1,15 @@ + + + diff --git a/jiuyi2/components/shop/detail/detail.vue b/jiuyi2/components/shop/detail/detail.vue index c133ffd9..f4d34dc3 100644 --- a/jiuyi2/components/shop/detail/detail.vue +++ b/jiuyi2/components/shop/detail/detail.vue @@ -20,6 +20,8 @@ import api from '@/api/index.js' // import util from '@/common/js/util.js' + // 富文本处理 + import parseRichText from '@/components/public/parse/parse.vue' // 传参 const props = defineProps({ @@ -62,6 +64,8 @@ // } } + // 编辑器上下文对象 + const editorCtx = ref(null) // 已选择的规格下标 const spaceIndex = ref(0) // 数量 @@ -84,8 +88,14 @@ return result }) // 当前登录的用户信息 - const userinfo = computed(() => { - return uni.$store.state.userinfo + const userinfo = computed(() => uni.$store.state.userinfo) + // 详情信息 + const infoRichText = computed(() => { + let result = '' + const richText = props.detail.infoRichText || '' + if (richText) result = decodeURIComponent(escape(atob(richText))) + console.log('richText', result, decodeURIComponent(escape(atob(richText)))) + return result }) onMounted(() => { @@ -95,7 +105,6 @@ getRecentOrder() }) - // 获取最近购买 function getRecentOrder() { api.shop.recentOrder({ @@ -368,7 +377,8 @@ - + + @@ -482,4 +492,10 @@ } } } + + // + .editorImg { + width: 700rpx; + height: 400rpx; + } \ No newline at end of file diff --git a/jiuyi2/manifest.json b/jiuyi2/manifest.json index 70301450..52effd61 100644 --- a/jiuyi2/manifest.json +++ b/jiuyi2/manifest.json @@ -2,8 +2,8 @@ "name" : "九亿", "appid" : "__UNI__08B31BC", "description" : "", - "versionName" : "1.0.9", - "versionCode" : 1009, + "versionName" : "1.0.12", + "versionCode" : 1012, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/jiuyi2/pages.json b/jiuyi2/pages.json index c08891ba..9adb3d86 100644 --- a/jiuyi2/pages.json +++ b/jiuyi2/pages.json @@ -88,7 +88,8 @@ { "path": "pages/news/chat/chat", "style": { - "navigationBarTitleText": "问答页" + "navigationBarTitleText": "", + "navigationStyle": "custom" } }, { @@ -771,6 +772,13 @@ "style": { "navigationBarTitleText": "登录密码" } + }, + { + "path" : "pages/index/seedLog", + "style" : + { + "navigationBarTitleText" : "流量点明细" + } } ], diff --git a/jiuyi2/pages/index/durian.vue b/jiuyi2/pages/index/durian.vue index 3f957c56..4414ebef 100644 --- a/jiuyi2/pages/index/durian.vue +++ b/jiuyi2/pages/index/durian.vue @@ -224,7 +224,7 @@ } // 跳转 - function navigateToPage(path) { + function link(path) { uni.navigateTo({ url: path }) @@ -261,7 +261,7 @@ - + @@ -280,10 +280,9 @@ - 置换 + 置换 - + 我的榴莲果树 @@ -308,14 +307,14 @@ 互转 - + 交易 - 置换流量 + 置换流量 diff --git a/jiuyi2/pages/index/durianLog.vue b/jiuyi2/pages/index/durianLog.vue index 600bf16a..5652004b 100644 --- a/jiuyi2/pages/index/durianLog.vue +++ b/jiuyi2/pages/index/durianLog.vue @@ -1,8 +1,7 @@ + + + + \ No newline at end of file diff --git a/jiuyi2/pages/index/trade.vue b/jiuyi2/pages/index/trade.vue index f8703a74..e9258968 100644 --- a/jiuyi2/pages/index/trade.vue +++ b/jiuyi2/pages/index/trade.vue @@ -64,7 +64,7 @@ } ]) // 类型下标 - const typeIndex = ref(0) + const typeIndex = ref(0) // 表单 const form = reactive({ sellNum: '', @@ -97,12 +97,10 @@ onLoad(() => { getList() - // 获取钱包 - util.getPurse() }) onReady(() => { - // proxy.$refs.orderDetail.open() + proxy.$refs.orderDetail.open() }) onPullDownRefresh(() => { @@ -139,6 +137,8 @@ // 获取列表 function getList() { + uni.stopPullDownRefresh() + return durianlApi.getOrderList({ query: { type: tabIndex.value, @@ -239,7 +239,7 @@ // 榴莲果交易数量 fruitAmount: form.sellNum, // 总价 - totalPrice:form.totalPrice, + totalPrice: form.totalPrice, // 对方姓名 name: `${form.first}${form.name}`, // 对方账号 diff --git a/jiuyi2/pages/index/wallet/bill.vue b/jiuyi2/pages/index/wallet/bill.vue index 0de9efec..6b1c3ce4 100644 --- a/jiuyi2/pages/index/wallet/bill.vue +++ b/jiuyi2/pages/index/wallet/bill.vue @@ -27,7 +27,7 @@ // 类型列表 const typeList = reactive([{ name: '全部', - id: '', + id: 'balance,score,fruit', }, { name: '余额', @@ -37,10 +37,10 @@ name: '积分', id: 'score', }, - { - name: '种子', - id: 'seed', - }, + // { + // name: '种子', + // id: 'seed', + // }, { name: '榴莲果', id: 'fruit', @@ -100,6 +100,9 @@ content: rs.msg, showCancel: false, }) + }).finally(() => { + // 停止下拉刷新 + uni.stopPullDownRefresh() }) } diff --git a/jiuyi2/pages/news/chat/chat.vue b/jiuyi2/pages/news/chat/chat.vue index 21bb310e..29d79320 100644 --- a/jiuyi2/pages/news/chat/chat.vue +++ b/jiuyi2/pages/news/chat/chat.vue @@ -1,459 +1,493 @@