新增富文本编辑器、新增一维数组变二维数组的js文件

master
chen 2022-04-22 18:37:00 +08:00
parent 752b59fcc4
commit b3537a2fcd
13 changed files with 794 additions and 20010 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,211 @@
<template>
<view class="container">
<view class="page-body">
<view class='wrapper'>
<view class='toolbar' @tap="format" style="height: 120px;overflow-y: auto;">
<!-- 字体加粗 -->
<view :class="formats.bold ? 'ql-active' : ''" class="iconfont icon-zitijiacu" data-name="bold"></view>
<view :class="formats.italic ? 'ql-active' : ''" class="iconfont icon-zitixieti" data-name="italic"></view>
<view :class="formats.underline ? 'ql-active' : ''" class="iconfont icon-zitixiahuaxian"
data-name="underline"></view>
<view :class="formats.strike ? 'ql-active' : ''" class="iconfont icon-zitishanchuxian"
data-name="strike"></view>
<view :class="formats.align === 'left' ? 'ql-active' : ''" class="iconfont icon-zuoduiqi"
data-name="align" data-value="left"></view>
<view :class="formats.align === 'center' ? 'ql-active' : ''" class="iconfont icon-juzhongduiqi"
data-name="align" data-value="center"></view>
<view :class="formats.align === 'right' ? 'ql-active' : ''" class="iconfont icon-youduiqi"
data-name="align" data-value="right"></view>
<view :class="formats.align === 'justify' ? 'ql-active' : ''" class="iconfont icon-zuoyouduiqi"
data-name="align" data-value="justify"></view>
<view :class="formats.lineHeight ? 'ql-active' : ''" class="iconfont icon-line-height"
data-name="lineHeight" data-value="2"></view>
<view :class="formats.letterSpacing ? 'ql-active' : ''" class="iconfont icon-Character-Spacing"
data-name="letterSpacing" data-value="2em"></view>
<view :class="formats.marginTop ? 'ql-active' : ''" class="iconfont icon-722bianjiqi_duanqianju"
data-name="marginTop" data-value="20px"></view>
<view :class="formats.previewarginBottom ? 'ql-active' : ''"
class="iconfont icon-723bianjiqi_duanhouju" data-name="marginBottom" data-value="20px"></view>
<view class="iconfont icon-clearedformat" @tap="removeFormat"></view>
<view :class="formats.fontFamily ? 'ql-active' : ''" class="iconfont icon-font"
data-name="fontFamily" data-value="Pacifico"></view>
<view :class="formats.fontSize === '24px' ? 'ql-active' : ''" class="iconfont icon-fontsize"
data-name="fontSize" data-value="24px"></view>
<view :class="formats.color === '#0000ff' ? 'ql-active' : ''" class="iconfont icon-text_color"
data-name="color" data-value="#0000ff"></view>
<view :class="formats.backgroundColor === '#00ff00' ? 'ql-active' : ''"
class="iconfont icon-fontbgcolor" data-name="backgroundColor" data-value="#00ff00"></view>
<view class="iconfont icon-date" @tap="insertDate"></view>
<view class="iconfont icon--checklist" data-name="list" data-value="check"></view>
<view :class="formats.list === 'ordered' ? 'ql-active' : ''" class="iconfont icon-youxupailie"
data-name="list" data-value="ordered"></view>
<view :class="formats.list === 'bullet' ? 'ql-active' : ''" class="iconfont icon-wuxupailie"
data-name="list" data-value="bullet"></view>
<view class="iconfont icon-undo" @tap="undo"></view>
<view class="iconfont icon-redo" @tap="redo"></view>
<view class="iconfont icon-outdent" data-name="indent" data-value="-1"></view>
<view class="iconfont icon-indent" data-name="indent" data-value="+1"></view>
<view class="iconfont icon-fengexian" @tap="insertDivider"></view>
<view class="iconfont icon-charutupian" @tap="insertImage"></view>
<view :class="formats.header === 1 ? 'ql-active' : ''" class="iconfont icon-format-header-1"
data-name="header" :data-value="1"></view>
<view :class="formats.script === 'sub' ? 'ql-active' : ''" class="iconfont icon-zitixiabiao"
data-name="script" data-value="sub"></view>
<view :class="formats.script === 'super' ? 'ql-active' : ''" class="iconfont icon-zitishangbiao"
data-name="script" data-value="super"></view>
<view class="iconfont icon-shanchu" @tap="clear"></view>
<view :class="formats.direction === 'rtl' ? 'ql-active' : ''" class="iconfont icon-direction-rtl"
data-name="direction" data-value="rtl"></view>
</view>
<view class="editor-wrapper">
<editor id="editor" class="ql-container" placeholder="开始输入..." showImgSize showImgToolbar
showImgResize @statuschange="onStatusChange" :read-only="readOnly" @ready="onEditorReady" @blur="getContents">
</editor>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name:'editor',
data() {
return {
readOnly: false,
formats: {}
}
},
methods: {
//
getContents(html){
this.$emit('getContents',html);
},
readOnlyChange() {
this.readOnly = !this.readOnly
},
onEditorReady() {
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
}).exec()
},
undo() {
this.editorCtx.undo()
},
redo() {
this.editorCtx.redo()
},
format(e) {
let {
name,
value
} = e.target.dataset
if (!name) return
// console.log('format', name, value)
this.editorCtx.format(name, value)
},
onStatusChange(e) {
const formats = e.detail
this.formats = formats
},
insertDivider() {
this.editorCtx.insertDivider({
success: function() {
console.log('insert divider success')
}
})
},
clear() {
this.editorCtx.clear({
success: function(res) {
console.log("clear success")
}
})
},
removeFormat() {
this.editorCtx.removeFormat()
},
insertDate() {
const date = new Date()
const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
this.editorCtx.insertText({
text: formatDate
})
},
insertImage() {
uni.chooseImage({
count: 1,
success: (res) => {
this.editorCtx.insertImage({
src: res.tempFilePaths[0],
alt: '图像',
success:()=> {
console.log('insert image success')
}
})
}
})
}
},
onLoad() {
uni.loadFontFace({
family: 'Pacifico',
source: 'url("https://sungd.github.io/Pacifico.ttf")'
})
},
}
</script>
<style>
@import "./editor-icon.css";
.page-body {
height: calc(100vh - var(--window-top) - var(--status-bar-height));
}
.wrapper {
height: 100%;
}
.editor-wrapper {
height: calc(100vh - var(--window-top) - var(--status-bar-height) - 140px);
background: #fff;
}
.iconfont {
display: inline-block;
padding: 8px 8px;
width: 24px;
height: 24px;
cursor: pointer;
font-size: 20px;
}
.toolbar {
box-sizing: border-box;
border-bottom: 0;
font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
}
.ql-container {
box-sizing: border-box;
padding: 12px 15px;
width: 100%;
min-height: 30vh;
height: 100%;
margin-top: 20px;
font-size: 16px;
line-height: 1.5;
}
.ql-active {
color: #06c;
}
</style>

Binary file not shown.

11
jsFile/array/array.js Normal file
View File

@ -0,0 +1,11 @@
const arrTool = {
oneArrToTwo(arr, size) { // arr是一维数组 size是二维数组包含几条数据
var arrTwo = []
for (var i = 0; i < arr.length; i = i + size) {
arrTwo.push(arr.slice(i, i + size))
}
return arrTwo // 新的二维数组
}
}
export default arrTool;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -429,7 +429,7 @@ const tools = {
uni.setStorageSync('url',route);
// 获取当前页面url带参数
let routeParam = pages[pages.length - 1].$page.fullPath;
console.log(routeParam.options,'获取当前url参数');
// console.log(routeParam.options,'获取当前url参数');
uni.setStorageSync('page-path-options',routeParam);
console.log(uni.getStorageSync('page-path-options'),'当前页面完整路径');
},
@ -478,6 +478,36 @@ const tools = {
}
})
return imgArr;
},
/**
* @description 打开小程序获取用户信息权限
*/
wxOpenSet() {
// #ifdef MP-WEIXIN
// 用户信息
uni.authorize({
scope:'scope.userInfo',
success: (res) => {},
fail: (res) => {
uni.showModal({
content:'检测到您没打开获取信息功能权限,是否去设置打开?',
confirmText: "确认",
cancelText:'取消',
success: (res) => {
if(res.confirm){
uni.openSetting({
success: (res) => {
console.log(res);
}
})
}else{
console.log('取消');
}
}
})
}
})
// #endif
}
}

15
package-lock.json generated Normal file
View File

@ -0,0 +1,15 @@
{
"name": "轮播视频和图片",
"version": "1.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "轮播视频和图片",
"version": "1.0.1",
"dependencies": {
"moment": "^2.29.3"
}
}
}
}

View File

@ -141,6 +141,24 @@
"enablePullDownRefresh": false
}
}
,{
"path" : "test/test",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "editor/editor",
"style" :
{
"navigationBarTitleText": "富文本编辑",
"enablePullDownRefresh": false
}
}
]
}
],

32
pagesB/editor/editor.vue Normal file
View File

@ -0,0 +1,32 @@
<template>
<view class="container">
<custom-editor @getContents="getContents"></custom-editor>
</view>
</template>
<script>
import editor from '@/components/editor/editor.vue';
export default {
components:{
'custom-editor':editor
},
data() {
return {
}
},
methods: {
//
getContents(html){
console.log(html,89);
},
},
onLoad() {
},
}
</script>
<style>
</style>

92
pagesB/test/test.vue Normal file
View File

@ -0,0 +1,92 @@
<template>
<view>
<view @touchstart="touchstart" @touchend="touchend" @tap="bgImgTap(num)">
<image style="z-index: 3;" src="/static/del/500478055.png" mode="aspectFill" :animation="num==0?showpic:hidepic"></image>
<image style="z-index: 2;" src="/static/del/img001.png" v-if="picshow" mode="aspectFill" :animation="num==1?showpic:hidepic"></image>
</view>
<view class="switchit pf">
<view class="switchspot" :style="num== index?'opacity:0.8':'opacity:0.2'" v-for="(item,index) in 2" :key="index"></view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
num:0,
picnum:[],
picshow:true,
hidepic:false,
showpic:'showpic'
}
},
onLoad() {
this.animationtest();
},
methods: {
animationtest(){ //
var num=this.num;
this.changePic(num);
},
changePic(num){//
clearInterval(this.setInter1);//
var animation= uni.createAnimation({
timingFunction: 'ease',
}) //
this.animation = animation
this.setInter1=setInterval(function(){//
this.num=num;
num++;
if(num>this.picmaxnum){
num=0;
}
//
animation.opacity(1).step({duration:1500}) //
this.showpic=animation.export() //
//
animation.opacity(0).step({duration:1500})
this.hidepic=animation.export()
}.bind(this),4000)
},
touchstart(e){//
this.startData.clientX=e.changedTouches[0].clientX;
this.startData.clientY=e.changedTouches[0].clientY;
},
touchend(e){//
const subX=e.changedTouches[0].clientX-this.startData.clientX;
const subY=e.changedTouches[0].clientY - this.startData.clientY;
if(subY>50 || subY<-50){// console.log('')
}else{
if(subX>100){//
if(this.num==0)
this.num=this.picmaxnum;
else
this.num--;
this.changePic(this.num);
}else if(subX<-100){//
if(this.num==this.picmaxnum)
this.num=0;
else
this.num++;
this.changePic(this.num);
}
}
},
bgImgTap(num){
if(num==0){
uni.switchTab({
url:'../a'
})
}else{
//
}
},
}
}
</script>
<style>
</style>

145
readme/README-图表.md Normal file
View File

@ -0,0 +1,145 @@
# 前言
* 一个基于Vue前端框架和第三方图表库echarts构建的可视化大数据平台通过vue项目构建、指令的灵活运用、组件封装、组件之间通信使内部图表组件库可实现自由替换和组合。
* 项目中部分前端库采用外部CDN引入可以减少打包文件体积加快页面渲染。
* 可视化数据大屏展示对前端性能要求高建议使用谷歌浏览器查看或开发屏幕尺寸为1920px宽和1080px高是最佳效果。
* 目前制作数据可视化大屏前端比较流行的第三方库有Echarts百度AntV阿里Highcharts国外公司D3.js国外公司
* 如果感觉还不错的话老铁们是不是赏个★Star鼓励一哈后续会持续更新和优化也期待大家的交流。
[在线效果演示](https://jackchen0120.github.io/vueDataV/)
## 学习教程分上下篇
* [Vue+Echarts构建可视化大数据平台实战项目分享](https://juejin.cn/post/6844904158181457933)
* [Vue+Echarts构建大数据可视化酷炫展示公司品牌实战项目分享](https://juejin.cn/post/6845166890449371149)
# 效果截图
## 登录界面
<img src="https://github.com/jackchen0120/vueDataV/blob/master/public/img/login_0.png" width="900" alt="登录界面" />
<img src="https://github.com/jackchen0120/vueDataV/blob/master/public/img/login_1.png" width="900" alt="登录界面" />
<img src="https://github.com/jackchen0120/vueDataV/blob/master/public/img/login_2.png" width="900" alt="登录界面" />
## 首页酷屏统计图
<img src="https://github.com/jackchen0120/vueDataV/blob/master/public/img/dataV_1.png" width="900" alt="首页酷屏统计图" />
<img src="https://github.com/jackchen0120/vueDataV/blob/master/public/img/dataV_2.png" width="900" alt="首页酷屏统计图" />
<img src="https://github.com/jackchen0120/vueDataV/blob/master/public/img/dataV_3.png" width="900" alt="首页酷屏统计图" />
<img src="https://github.com/jackchen0120/vueDataV/blob/master/public/img/dataV_4.png" width="900" alt="首页酷屏统计图" />
## 公司品牌介绍
<img src="https://github.com/jackchen0120/vueDataV/blob/master/public/img/brand.png" width="900" alt="炫酷展示公司品牌" />
# 项目架构
```
│ vue.config.js // webpack配置
├─public
│ favicon.ico // ico图标
│ index.html // 入口html文件
└─src
│ App.vue // 根组件
│ main.js // 程序入口文件
├─assets
│ ├─iconfont // 引用阿里巴巴矢量图标库
│ ├─img // 存放公共图片文件夹
│ ├─js
│ │ utils.js // 封装工具类方法
│ └─styles
│ │ base.scss // 基础样式文件
│ │ common.scss // 公用样式文件
│ └─fonts // 字体库文件
├─components
│ │ index.js // 封装组件库
│ ├─bar3d // 3D立体柱状图
│ ├─bgAnimation // 登录界面背景图动画
│ ├─cakeLinkage // 柱饼组合联动
│ ├─circleNesting // 圆环套圆环
│ ├─circleRunway // 环形跑道图
│ ├─colorfulArea // 多彩轮播面积
│ ├─colorfulRadar // 多彩雷达
│ ├─companySummary
│ │ business.vue // 业务范围
│ │ distrbution.vue // 客户分布
│ │ history.vue // 发展历程
│ │ income.vue // 营业收入
│ │ talent.vue // 人才队伍
│ │ wordCloud.vue // 产品热词
│ ├─dynamicLine // 动态轮播折线图
│ ├─dynamicList // 动态列表动画
│ ├─flashCloud // 闪动云
│ ├─gauge // 仪表盘
│ ├─modal // 自定义全局模态框
│ ├─pyramid // 金字塔动画
│ ├─pyramidTrend // 金字塔趋势
│ ├─rainbow // 彩虹轨道图
│ ├─ringPie // 环形饼图
│ ├─ringPin // 环形气泡图
│ ├─rotateColorful // 旋转多彩图
│ ├─scanRadius // 扫描半径图
│ ├─scrollArc // 滚动弧形线
│ ├─seamless // 新闻无缝滚动
│ ├─sinan // 司南排名图
│ ├─staffMix // 人员占比
│ ├─szBar // 双轴柱状图
│ ├─toast
│ │ index.js // 注册全局消息提示框组件
│ │ index.vue // 自定义消息提示框模板
│ └─waterPolo
│ index.vue // 水球图、水波图
├─router
│ index.js // 单页面路由注册组件
├─store
│ index.js // 状态管理仓库未使用到
└─views
Brand.vue // 公司品牌介绍
Home.vue // 酷屏首页统计图
Login.vue // 登录界面
```
# 技术栈
* vue2.6
* echarts4.7
* axios
* webpack
* ES6
* scss
* css3
* jquery
* iconfont
# 功能模块
* 登录界面抖动
* 粒子动效
* 背景图轮播
* 自定义全局模态框
* 自定义消息提示框
* 酷屏首页组件库
* 各种酷炫小部件
* 炫酷展示公司品牌
# 下载安装依赖
```
git clone https://github.com/jackchen0120/vueDataV.git
cd vueDataV
npm install 或 yarn
```
## 开发模式
```
npm run serve
```
运行之后访问地址http://localhost:8081
## 生产环境打包
```
npm run build
```
#### 获取更多项目实战经验及各种源码资源,请关注作者公众号:懒人码农
<img src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly91c2VyLWdvbGQtY2RuLnhpdHUuaW8vMjAyMC81LzEzLzE3MjBlM2U0ZmQ5NDZiZDQ?x-oss-process=image/format,png" width="430" alt="公众号二维码" />