Commit 9acc6e01 by 匡雅琴

Merge branch 'dev_v1.0.0' into kyq-province

2 parents af5163b2 098df0d7
Showing 79 changed files with 4390 additions and 780 deletions
{ {
"include": [ "include": [
"./src/packages/**/*.vue" "./src/packages/**/*.vue",
"./src/bcPackages/**/*.vue"
], ],
"title": "组件文档", "title": "组件文档",
"genType": "docute" "genType": "docute"
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
...@@ -21,46 +21,61 @@ ...@@ -21,46 +21,61 @@
new Docute({ new Docute({
target: '#docute', target: '#docute',
sidebar: [{ sidebar: [{
title: '组件文档', title: '基础组件',
links: [ links: [{
{ title: 'Blog',
title: 'Blog', link: '/components/Blog'
link: '/components/Blog' },
}, {
{ title: 'TestComp',
title: 'TestComp', link: '/components/TestComp'
link: '/components/TestComp' },
}, {
{ title: 'GLButton',
title: 'GLTable', link: '/components/GLButton'
link: '/components/GLTable' },
}, {
{ title: 'GLTable',
title: 'Popover(el)-气泡框', link: '/components/GLTable'
link: '/components/Popover' },
}, {
{ title: 'Popover(el)-气泡框',
title: 'GLSearchItem', link: '/components/Popover'
link: '/components/GLSearchItem' },
}, {
{ title: 'GLSearchItem',
title: 'GLSearch', link: '/components/GLSearchItem'
link: '/components/GLSearch' },
}, {
{ title: 'GLSearch',
title: 'GLTableButton', link: '/components/GLSearch'
link: '/components/GLTableButton' },
}, {
{ title: 'GLTableButton',
title: 'GLCombiForm', link: '/components/GLTableButton'
link: '/components/GLCombiForm' },
}, {
{ title: 'GLCombiForm',
title: 'GLProvince', link: '/components/GLCombiForm'
link: '/components/GLProvince' },
}, {
] title: 'GLProvince',
}] link: '/components/GLProvince'
},
{
title: 'GLDialog',
link: '/components/GLDialog'
},
]
},
{
title: '业务组件',
links: [{
title: 'GLBcTest',
link: '/components/GLBcTest'
}, ]
}
]
}) })
</script> </script>
</body> </body>
......
...@@ -7,26 +7,45 @@ const through2 = require('through2') ...@@ -7,26 +7,45 @@ const through2 = require('through2')
// // // 删除website/中的所有子目录 // // // 删除website/中的所有子目录
// async function clean(cb) { // async function clean(cb) {
// await del('./website') // await del('./website')
// cb() // // cb()
// } // }
// 迭代 components 下的所有 md 文件,并合并到 website/components 下的同名文件 // 迭代 components 下的所有 md 文件,并合并到 website/components 下的同名文件
function generateMd() { function generateMd(path) {
return src('./src/packages/**/*.md').pipe( return src(path).pipe(
through2.obj(function(file, _, cb) { through2.obj(function(file, _, cb) {
// console.log('file: ', file);
let filename = file.path.split(/\\/).pop() let filename = file.path.split(/\\/).pop()
console.log(filename) console.log(filename)
if (file.isBuffer()) { if (file.isBuffer()) {
try { try {
fs.readFile(`./website/components/${filename}`, (err, data) => { fs.readFile(`./website/components/${filename}`, (err, data) => {
const originalData = data.toString().replace(/<!-- <content> -->[\s\S]*<!-- <\/content> -->/g, '') // console.log('data: ', data);
if (err) throw err if (data) {
let fileContent = file.contents.toString() + '\n\n' + originalData // 存在合并
fs.writeFile(`./website/components/${filename}`, fileContent, err => { const originalData = data.toString().replace(/<!-- <content> -->[\s\S]*<!-- <\/content> -->/g, '')
if (err) return console.error(err) if (err) throw err
console.log(`写入 ${filename} 成功`) let fileContent = file.contents.toString() + '\n\n' + originalData
cb() fs.writeFile(`./website/components/${filename}`, fileContent, err => {
}) if (err) return console.error(err)
// console.log(`写入 ${filename} 成功`)
cb()
})
} else {
// 不存在创建
let filePath
if (filename === 'README.md') {
filePath = `./website/${filename}`
} else {
filePath = `./website/components/${filename}`
}
let fileContent = file.contents.toString()
fs.writeFile(filePath, fileContent, err => {
if (err) return console.error(err)
console.log(`写入 ${filename} 成功`)
cb()
})
}
}) })
} catch (exception) { } catch (exception) {
cb() cb()
...@@ -36,6 +55,11 @@ function generateMd() { ...@@ -36,6 +55,11 @@ function generateMd() {
) )
} }
async function generateAllMd() {
await generateMd('./src/packages/**/*.md')
await generateMd('./src/bcPackages/**/*.md')
}
function copyFile() { function copyFile() {
// return src(['./dist/*.js','./dist/*.css','./documents/index.html']).pipe(dest('./website/')) // return src(['./dist/*.js','./dist/*.css','./documents/index.html']).pipe(dest('./website/'))
...@@ -47,10 +71,10 @@ function copyFonts() { ...@@ -47,10 +71,10 @@ function copyFonts() {
// require("./build/gulp.css.js") // require("./build/gulp.css.js")
//监听这些文件的变换,不需要cb //监听这些文件的变换,不需要cb(只监听*.md,变化刷新)
function watcher() { function watcher() {
watch('src/**/*.*', generateMd, copyFile, copyFonts) watch('src/**/*.*', generateAllMd, copyFile, copyFonts)
watch('documents/**/*.*', generateMd, copyFile, copyFonts) watch('documents/**/*.*', generateAllMd, copyFile, copyFonts)
} }
exports.default = series([generateMd, copyFile, copyFonts, watcher]) exports.default = series([generateAllMd, copyFile, copyFonts, watcher])
This diff could not be displayed because it is too large.
{ {
"name": "glsx-components", "name": "glsx-components",
"description": "glsx vue components", "description": "glsx vue components",
"version": "1.4.0", "version": "1.4.7",
"author": "limin <17653212@qq.com>", "author": "limin <17653212@qq.com>",
"license": "MIT", "license": "MIT",
"main": "dist/glsx-components.common.js", "main": "dist/glsx-components.common.js",
...@@ -24,10 +24,14 @@ ...@@ -24,10 +24,14 @@
"vue-amap": "^0.5.10" "vue-amap": "^0.5.10"
}, },
"devDependencies": { "devDependencies": {
"@vue/babel-helper-vue-jsx-merge-props": "^1.2.1",
"@vue/babel-preset-jsx": "^1.3.0",
"@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "~4.5.0",
"@vuese/cli": "^2.14.3",
"concurrently": "^7.1.0", "concurrently": "^7.1.0",
"del": "^6.0.0", "del": "^6.0.0",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^8.0.0", "gulp-autoprefixer": "^8.0.0",
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
"gulp-cssmin": "^0.2.0", "gulp-cssmin": "^0.2.0",
...@@ -35,7 +39,6 @@ ...@@ -35,7 +39,6 @@
"gulp-sass": "^5.0.0", "gulp-sass": "^5.0.0",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
"sass-loader": "^8.0.0", "sass-loader": "^8.0.0",
"vue-template-compiler": "^2.6.11", "vue-template-compiler": "^2.6.11"
"vuese": "^1.4.7"
} }
} }
...@@ -4,11 +4,35 @@ ...@@ -4,11 +4,35 @@
<!-- <HelloWorld msg="Welcome to Your Vue.js App" /> <!-- <HelloWorld msg="Welcome to Your Vue.js App" />
<GLExternal url="//localhost:8080/html/employee/index.html" :subscribe="subscribe"></GLExternal> --> <GLExternal url="//localhost:8080/html/employee/index.html" :subscribe="subscribe"></GLExternal> -->
<hr /> <hr />
<h3>el-button调整</h3> <h3>el-button调整 大(默认按钮)40 中(small)32 小(mini)24</h3>
<GLButton @click="click" fn="1-1-1-11" mode="el-button" display="disabled">232321321</GLButton> <!-- display="disabled" -->
<el-button type="primary">aaa</el-button> <GLButton @click="click" fn="1-1-1-11" mode="el-button">232321321</GLButton>
<el-button type="primary" size="small">aaa</el-button> <div>
<el-button type="primary" size="mini">aaa</el-button> <el-button type="primary">一级</el-button>
<el-button type="primary" disabled>一级</el-button>
<el-button type="primary" :loading="true" icon="el-icon-star-off"></el-button>
</div>
<div>
<el-button plain>二级</el-button>
<el-button plain disabled>二级</el-button>
</div>
<div>
<el-button plain size="small" class="btn-three">三级</el-button>
<el-button plain size="small" class="btn-three" disabled>三级</el-button>
</div>
<div>
<el-button type="text">文字</el-button>
<el-button type="text" disabled>文字</el-button>
</div>
<div>
<el-button type="text" class="btn-link gap8">link按钮</el-button>
<el-button type="text" class="btn-link gap8" disabled>link按钮</el-button>
</div>
<div>
<el-button plain class="btn-three" size="mini">超小</el-button>
<el-button plain class="btn-three" size="mini" disabled>超小</el-button>
</div>
<hr /> <hr />
<h3>el-dialog调整</h3> <h3>el-dialog调整</h3>
<!-- <GLDialog :visible.sync="visible" title="aaaaaaaaa"> <!-- <GLDialog :visible.sync="visible" title="aaaaaaaaa">
...@@ -86,38 +110,103 @@ ...@@ -86,38 +110,103 @@
<hr /> <hr />
<!-- 测试 GlSearch --> <!-- 测试 GlSearch -->
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="searchFormData" @handleOk="handleOkFn" @handleRest="handleRestFn"></GLCombiForm>
<!-- <GLSearch @onOk="handleOkFn" @onRest="handleRestFn">
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-input size="small" v-model="input" placeholder="请输入内容"></el-input>
</GLSearchItem>
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-select v-model="value" size="small" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</GLSearchItem>
<GLSearchItem>
<div slot="name">我是文本输入框</div>
<el-date-picker size="small" v-model="value1" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</GLSearchItem>
<GLSearchItem>
<el-select v-model="selvalue" placeholder="请选择" size="small" slot="name">
<el-option v-for="item in seloptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
<el-input size="small" v-model="input" placeholder="请输入内容"></el-input>
</GLSearchItem>
</GLSearch> -->
<GLCombiForm ref="showSearch" :rowNumber="2" :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="searchFormData" @handleOk="handleOkFn" @handleRest="handleRestFn"></GLCombiForm>
<hr /> <hr />
<!-- 测试 GLFooter --> <!-- 测试 GLFooter -->
<GLFooter></GLFooter> <GLFooter></GLFooter>
<hr />
<!-- 测试 GLProvince --> <!-- 测试 GLProvince -->
<GLProvince ref="provinceForm" :subdistrict="subdistrict" @selectProvince="selectProvince" @selectCity="selectCity" @selectTown="selectTown"></GLProvince> <GLProvince ref="provinceForm2" :subdistrict="subdistrict" @selectProvince="selectProvince" @selectCity="selectCity" @selectTown="selectTown"></GLProvince>
<hr />
<!-- 测试业务组件GLBcTest -->
<GLBcTest></GLBcTest>
<hr />
<!-- 测试GLFull -->
<GLFull>SDK发就算冷冻机房乐山大佛</GLFull>
<hr />
<!-- 测试弹框组件 -->
<el-button plain @click="testDialog(1)">dialog(大)</el-button>
<el-button plain @click="testDialog2">dialog(中)</el-button>
<el-button plain @click="showDialog">dialog(小)</el-button>
<el-button plain @click="testDialog3">dialog(中)无按钮</el-button>
<el-button plain @click="testBeforeDialog">之前小弹窗</el-button>
<!-- :content="'hello HelloWorld'" -->
<GLDialog :mode="mode" bigTitle="大标题" :hasFooter="hasFooter" :type="'error'" @onOk="handleOk" @onCancel="handleCancel" :visible.sync="dialogShow">
<div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
</div>
<!-- <span slot="footer" class="dialog-footer">
<el-button plain size="small" class="btn-three" @click="dialogShow = false">取消123</el-button>
<el-button type="primary" size="small" @click="dialogShow = false">确定123</el-button>
</span> -->
</GLDialog>
<GLDialog :mode="mode" title="提示" :hasFooter="hasFooter" :type="'error'" :content="'hello HelloWorld'" @onOk="handleOk" @onCancel="handleCancel" :visible.sync="dialogShow2"></GLDialog>
<GLDialog title="提示123" :mode="mode" :hasFooter="hasFooter" :type="'info'" :content="'hello HelloWorld'" @onOk="handleOk" @onCancel="handleCancel" :visible.sync="dialogShow1"></GLDialog>
<hr />
</div> </div>
</template> </template>
<script> <script>
...@@ -276,7 +365,7 @@ export default { ...@@ -276,7 +365,7 @@ export default {
// tableData:[], // tableData:[],
tableData: [ tableData: [
{ {
name: '王小虎王小虎王小虎王', name: '___王小虎王小虎王小虎王',
liveStatus3: '132', liveStatus3: '132',
liveStatus4: '789', liveStatus4: '789',
name1: '123', name1: '123',
...@@ -452,7 +541,7 @@ export default { ...@@ -452,7 +541,7 @@ export default {
name: 'contractNo' name: 'contractNo'
}, },
{ {
label: '车架号', label: '车架号hias',
name: 'vin' name: 'vin'
} }
], ],
...@@ -588,14 +677,18 @@ export default { ...@@ -588,14 +677,18 @@ export default {
return '打开' return '打开'
}, },
condition: row => { condition: row => {
const h = this.$createElement
const vNode = h('span', '', '11323')
return true return true
}, },
attrs: { attrs: {
type: 'text', type: 'text',
//boolean或者函数 //boolean或者函数
disabled: (row, condition) => { disabled: (row, condition) => {
return true // console.log(123456)
return 1 == 1
} }
// disabled: false
}, },
listeners: { listeners: {
click: this.conditionFn click: this.conditionFn
...@@ -641,21 +734,25 @@ export default { ...@@ -641,21 +734,25 @@ export default {
// }, // },
name: '新增3', name: '新增3',
// 条件判断 fn 或者不传,默认显示(todo promise), 参数 row ,config // 条件判断 fn 或者不传,默认显示(todo promise), 参数 row ,config
// condition: row => {
// return true
// },
condition: row => { condition: row => {
// return new Promise((resolve, reject) => {
// setTimeout(resolve(true),2000)
// })
// console.log(123456)
return true return true
}, },
// condition: (row) => {
// return new Promise((resolve, reject) => {
// setTimeout(resolve(true),2000)
// })
// },
// 属性 // 属性
attrs: { attrs: {
type: 'text', type: 'text'
//boolean或者函数, 参数 row ,config //boolean或者函数, 参数 row ,config
disabled: (row, condition) => { // disabled: (row, condition) => {
return true // // console.log('disabled')
} // let flag = 1 == 1
// return flag
// }
}, },
//click事件 参数 row ,config //click事件 参数 row ,config
listeners: { listeners: {
...@@ -680,11 +777,17 @@ export default { ...@@ -680,11 +777,17 @@ export default {
} }
], ],
// 测试省市组件 // 测试省市组件
subdistrict: 3 subdistrict: 3,
//测试弹框
dialogShow: false,
dialogShow1: false,
dialogShow2: false,
mode: 'mid',
hasFooter: true
} }
}, },
mounted() { mounted() {
//测试改变 tableColumns // //测试改变 tableColumns
setTimeout(() => { setTimeout(() => {
// this.$refs.liveRoomRef.componentKey = Date.now() // this.$refs.liveRoomRef.componentKey = Date.now()
// console.log('测试改变 tableColumns') // console.log('测试改变 tableColumns')
...@@ -940,6 +1043,59 @@ export default { ...@@ -940,6 +1043,59 @@ export default {
}, },
selectTown(val) { selectTown(val) {
console.log(val) console.log(val)
},
//测试弹框
testDialog(number) {
this.dialogShow = !this.dialogShow
this.hasFooter = true
switch (number) {
case 1:
this.mode = 'big'
break
case 2:
this.mode = 'mid'
break
case 3:
this.mode = 'small'
break
case 4:
this.mode = 'mid'
this.hasFooter = false
break
}
},
testDialog2() {
this.mode = 'mid'
this.dialogShow2 = !this.dialogShow2
this.hasFooter = true
},
testDialog3() {
this.mode = 'mid'
this.dialogShow2 = !this.dialogShow2
this.hasFooter = false
},
showDialog() {
this.dialogShow1 = !this.dialogShow1
this.mode = 'small'
this.hasFooter = true
},
handleOk() {
console.log('点击确定')
this.dialogShow = false
this.dialogShow1 = false
},
handleCancel() {
console.log('点击取消')
this.dialogShow = false
this.dialogShow1 = false
},
testBeforeDialog() {
this.$confirm('检测到未保存的内容,是否在离开页面前保存修改?', '确认信息', {
// distinguishCancelAndClose: true,
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
})
} }
} }
} }
......
import GLBcTest from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLBcTest.install = function(Vue) {
Vue.component(GLBcTest.name, GLBcTest)
}
// 默认导出组件
export default GLBcTest
\ No newline at end of file \ No newline at end of file
<!-- <content> -->
<test-comp @click='btnClick'>常规按钮</test-comp>
<test-comp @click='btnClick' type='success'>成功按钮</test-comp>
<el-button type="warning" @click="toggleShow(1)">显示代码</el-button>
```js {mixin:true}
{
data() {
return {
demo1: true
}
},
methods:{
btnClick(){
alert('点击')
},
toggleShow(num){
// console.log(123)
this['demo' + num] = !this['demo' + num]
}
}
}
```
# 用来作为 markdown 代码的示例部分
<!-- <div v-if="demo1"> -->
```html
<template>
<test-comp @click="btnClick">常规按钮</test-comp>
<test-comp @click="btnClick" type="success">成功按钮</test-comp>
<test-comp @click="btnClick">789</test-comp>
</template>
<script>
export default {
data() {
return {}
},
methods: {
btnClick() {
alert('点击')
}
}
}
</script>
```
<!-- </div> -->
<!-- </content> -->
<template>
<div class="testcomp">
<el-button @click="btnClick" v-bind="$attrs" v-on="$listeners">
<!-- 默认插槽 -->
<slot>GLBcTest</slot>
</el-button>
</div>
</template>
<script>
// @group GroupA
export default {
name:'GLBcTest',
props:{
// bc类型的种类
demosize:{
type:String,
// `medium` / `small` / `mini`
default:'medium'
},
// demo类型
demotype:{
type:String,
// `primary` / `success`
default:'primary'
}
},
data(){
return{
}
},
methods:{
btnClick(){
// 这是点击事件
this.$emit('点击')
}
}
}
</script>
<style lang="scss">
.testcomp{
display:inline-block;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -3,12 +3,24 @@ ...@@ -3,12 +3,24 @@
*/ */
import Vue from 'vue' import Vue from 'vue'
import GLButton from './packages/Button' import GLButton from './packages/Button'
const componentsFiles = require.context(`./packages`, true, /\.vue$/)
componentsFiles.keys().forEach(path => { //自动读取并注册组件
const component = componentsFiles(path).default function registerComp(componentsFiles){
// console.log('component: ', component); componentsFiles.keys().forEach(path => {
Vue.component(component.name, component) const component = componentsFiles(path).default
}) // console.log('component: ', component);
Vue.component(component.name, component)
})
}
function registerComponent(){
const componentsFiles = require.context('./packages', true, /\.vue$/)
registerComp(componentsFiles)
const componentsFilesBc = require.context('./bcPackages', true, /\.vue$/)
registerComp(componentsFilesBc)
}
registerComponent()
//函数组件 //函数组件
const permissions = { const permissions = {
......
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
* 启动项目工程即可 * 启动项目工程即可
*/ */
//创建的组件 //创建的组件
import Vue from 'vue' import Vue from 'vue'
import { import {
// 基础
GLExternal, GLExternal,
GLButton, GLButton,
GLDialog, GLDialog,
...@@ -14,23 +15,32 @@ ...@@ -14,23 +15,32 @@
GLSearch, GLSearch,
GLSearchItem, GLSearchItem,
GLCombiForm, GLCombiForm,
GLTableButton GLTableButton,
// 业务
GLProvince,
GLBcTest,
GLEditor,
GLFull
} from '../../dist/glsx-components.umd.min.js' } from '../../dist/glsx-components.umd.min.js'
import '../../dist/glsx-components.css' import '../../dist/glsx-components.css'
const permissions = { const permissions = {
routes: [ routes: [
{ path: '/', meta: { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] } }, { path: '/', meta: { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] } },
{ path: '/a', meta: {} } { path: '/a', meta: {} }
], ],
routerBase: '' routerBase: ''
} }
Vue.use(GLButton, permissions) Vue.use(GLButton, permissions)
Vue.use(GLExternal) Vue.use(GLExternal)
Vue.use(GLDialog) Vue.use(GLDialog)
Vue.use(GLTable) Vue.use(GLTable)
Vue.use(GLFooter) Vue.use(GLFooter)
Vue.use(GLSearch) Vue.use(GLSearch)
Vue.use(GLSearchItem) Vue.use(GLSearchItem)
Vue.use(GLCombiForm) Vue.use(GLCombiForm)
Vue.use(GLTableButton) Vue.use(GLTableButton)
Vue.use(GLProvince)
Vue.use(GLBcTest)
Vue.use(GLEditor)
Vue.use(GLFull)
...@@ -6,6 +6,26 @@ ...@@ -6,6 +6,26 @@
```html ```html
更新日志 更新日志
v1.4.6
1.修复多个弹窗共存无法放大问题
v1.4.4
1.按钮(大中小)添加,样式调整
2.修复GlTableButton修复更多点击空白,触发事件
3.修复条件搜索展开 多 margin 20问题
4.组件库新增区分业务模块和基本模块
5.修复组件库全局引入使用问题
6.新增弹窗组件GLDialog
v1.4.3
1.调试处理table多级表头的顺序问题,动态columns
2.table search添加双选择框,选项
3.表头高度调整为48px
4.setTableHeightFun增加第二个参数添加高度(第一个参数减值,第二个参数增值)
5.调整tablecell无数据的“--”状态,不包含数字0,
6.添加gltablebutton中attrs的属性为函数的情况,传入该项和配置执行
v1.4.2 v1.4.2
1.调整GlTableButton、GlCombiForm穿透属性顺序 1.调整GlTableButton、GlCombiForm穿透属性顺序
2.修改table无数据的单元格状态 -- 2.修改table无数据的单元格状态 --
......
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
name: 'Blog', name: 'Blog',
props: { props: {
// 1.XX新增 // 1.XX新增
// hello // hello123
end: { end: {
type: String, type: String,
default: '' default: ''
......
<!-- <content> -->
# 调整el-button(不是 GLButton用法)
<h3>调整 el-button尺寸 大40 中32 小24</h3>
<div>
<el-button type="primary">一级</el-button>
<el-button type="primary" disabled>一级</el-button>
<el-button type="primary" :loading="true" icon="el-icon-star-off"></el-button>
</div>
<div>
<el-button plain>二级</el-button>
<el-button plain disabled>二级</el-button>
</div>
<div>
<el-button plain size="small" class="btn-three">三级</el-button>
<el-button plain size="small" class="btn-three" disabled>三级</el-button>
</div>
<div>
<el-button type="text">文字</el-button>
<el-button type="text" disabled>文字</el-button>
</div>
<div>
<el-button type="text" class="btn-link gap8">link按钮</el-button>
<el-button type="text" class="btn-link gap8" disabled>link按钮</el-button>
</div>
<div>
<el-button plain class="btn-three" size="mini">超小</el-button>
<el-button plain class="btn-three" size="mini" disabled>超小</el-button>
</div>
<el-button type="warning" @click="toggleShow(1)">显示代码</el-button>
```js {mixin:true}
{
data() {
return {
demo1: true
}
},
methods:{
btnClick(){
alert('点击')
},
toggleShow(num){
// console.log(123)
this['demo' + num] = !this['demo' + num]
}
}
}
```
<!-- ## 用来作为 markdown 代码的示例部分 -->
<div v-if="demo1">
```html
<template>
<div>
<!-- GLButton用法 -->
<GLButton @click="click" fn="1-1-1-11" mode="el-button">232321321</GLButton>
<div>
<el-button type="primary">一级</el-button>
<el-button type="primary" disabled>一级</el-button>
<el-button type="primary" :loading="true" icon="el-icon-star-off"></el-button>
</div>
<div>
<el-button plain>二级</el-button>
<el-button plain disabled>二级</el-button>
</div>
<div>
<el-button plain size="small" class="btn-three">三级</el-button>
<el-button plain size="small" class="btn-threethree" disabled>三级</el-button>
</div>
<div>
<el-button type="text">文字</el-button>
<el-button type="text" disabled>文字</el-button>
</div>
<div>
<el-button type="text" class="btn-link gap8">link按钮</el-button>
<el-button type="text" class="btn-link gap8" disabled>link按钮</el-button>
</div>
<div>
<el-button plain class="btn-three" size="mini">超小</el-button>
<el-button plain class="btn-three" size="mini" disabled>超小</el-button>
</div>
</div>
</template>
<script>
export default {
data() {
return {}
}
}
</script>
```
</div>
<!-- </content> -->
\ No newline at end of file \ No newline at end of file
...@@ -32,17 +32,21 @@ function __getRoutes(ctx) { ...@@ -32,17 +32,21 @@ function __getRoutes(ctx) {
return routes.find(route => location.pathname === `${routerBase}${route.path.split(':/')[0]}`) return routes.find(route => location.pathname === `${routerBase}${route.path.split(':/')[0]}`)
} }
// GLButton权限按钮组件
export default { export default {
functional: true, functional: true,
name: 'GLButton', name: 'GLButton',
props: { props: {
// fn权限对应的名字
fn: { fn: {
type: String type: String
}, },
// 生成的组件类型
mode: { mode: {
type: String, type: String,
default: 'el-button' default: 'el-button'
}, },
// 是否显示
display: { display: {
type: String, type: String,
default: '' default: ''
......
import GLEditor from './src/index.vue'
console.log(GLEditor)
// 为组件提供 install 安装方法,供按需引入
GLEditor.install = function (Vue) {
Vue.component(GLEditor.name, GLEditor)
}
// 默认导出组件
export default GLEditor
<template>
<div class="ly-emotion">
<slot></slot>
</div>
</template>
<script>
import emoji from '../../../utils/emo'
export default {
name: 'ly-emotion',
mounted() {
const name = this.$el.innerHTML
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(name)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
let imgHTML = `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
this.$nextTick(() => {
this.$el.innerHTML = imgHTML
})
}
}
</script>
<style scoped>
.ly-emotion {
display: inline-block;
}
.ly-static-emotion {
width: 24px;
height: 24px;
display: inline-block;
}
</style>
<template>
<div class="square-main">
<el-dialog title="选择活动" :visible.sync="dialogVisible" width="1088px" :before-close="handleClose">
<div class="model-panel" v-loading="loading">
<div class="model-panel-tab">
<label>活动类型:</label>
<el-tabs v-model="activeName" @tab-click="handleClick" type="card">
<template v-for="(item, index) in activityList">
<el-tab-pane :label="item.itemName" :name="item.itemValue" v-if="itemType != 'merchant'" :key="index"></el-tab-pane>
<el-tab-pane :label="item.itemName" v-if="openFlag && itemType == 'itemType'" :key="index"></el-tab-pane>
</template>
</el-tabs>
</div>
<div class="model-item-panel" v-if="modelList.length > 0">
<div class="model-item" :class="{ checked: selectItem == item }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)">
<template v-if="selectType == 'card'">
<div class="model-item-title" :title="item.equityName">{{ item.equityName }}</div>
<div class="model-item-content">领取方式:免费领用</div>
<div class="model-item-content"></div>
<div class="model-item-content model-item-contents">
试用天数:
<span>{{ item.freeDay }}天</span>
</div>
</template>
<template v-else-if="selectType == 'package'">
<div class="model-item-title" :title="item.packageName">{{ item.packageName }}</div>
<div class="model-item-content">领取方式:付费购买</div>
<div class="model-item-content"></div>
<div class="model-item-content model-item-contents">
销售价格:
<span>{{ item.packagePrice }}元</span>
</div>
</template>
<template v-else-if="selectType == 'coupon'">
<div class="model-item-title" :title="item.couponName">{{ item.couponName }}</div>
<div class="model-item-content" v-if="item.effectiveType == 3">有效期:无限制</div>
<div class="model-item-content" v-if="item.effectiveType == 6">有效期:{{ item.effectiveDays }}天</div>
<div class="model-item-content" v-if="item.effectiveType == 2">有效期:{{ item.effectiveStartTime ? item.effectiveStartTime.split(' ')[0] : '' }}~{{ item.effectiveEndTime ? item.effectiveEndTime.split(' ')[0] : '' }}</div>
<div class="model-item-content">
使用途径:
{{ item.useChannel == 1 ? '线上商品' : '到店核销' }}
</div>
<div class="model-item-content model-item-contents">
数量:
<span>{{ item.residueAmount }}</span>
</div>
</template>
<template v-else-if="selectType == 'activity'">
<div class="model-item-title" :title="item.activityName">{{ item.activityName }}</div>
<div class="model-item-content"></div>
<div class="model-item-content">
开始时间:
{{ item.startTime }}
</div>
<div class="model-item-content">
结束时间:
{{ item.endTime }}
</div>
</template>
<template v-else>
<div class="model-item-title" :title="item.couponName">{{ item.equityName }}</div>
<div class="model-item-content">获取方式:需先购买无忧服务套餐</div>
<div class="model-item-content">获取限制:每个服务套餐限领一次</div>
<div class="model-item-content model-item-weight">
赠送天数:
<span>{{ item.effectiveType == 2 ? item.effectivedDay + '天' : '永久有效' }}</span>
</div>
</template>
</div>
</div>
<div class="model-item-empty" v-else v-loading="loading">
<img src="../../../assets/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
<el-pagination v-if="selectType != 'card' && selectType != 'merchant'" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[12, 24, 36, 48]" :page-size="pageSize" :total="tableTotal" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelect" v-show="modelList.length">确 定</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && selectType == 'coupon' && memberMenu">立即添加</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && selectType == 'package' && couponMenu">立即添加</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && selectType == 'activity' && activityMenu">立即添加</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
const openUrl = function (url) {
const link = document.createElement('a')
link.href = url
link.target = '_blank'
link.rel = 'opener'
link.click()
}
export default {
name: 'ActivityModel',
data() {
return {
dialogVisible: false,
couponMenu: false,
loading: false,
activeName: 3,
modelList: [],
pageNum: 1,
pageSize: 12,
tableTotal: 0,
openFlag: 0,
selectItem: {
id: ''
}
}
},
props: {
activityList: Array
},
computed: {
selectType() {
return this.activityList.find(act => act.itemValue == this.activeName).itemType
}
},
methods: {
handleSelectItem(item) {
this.selectItem = item
if (item.equityClassId) {
this.selectItem.id = item.equityClassId
}
console.log(this.selectItem)
},
handleSelect() {
if (!this.selectItem.id) {
this.$message({
type: 'error',
message: '请选择活动'
})
return
}
this.dialogVisible = false
const marketingId = this.selectItem.id ? this.selectItem.id : this.selectItem.equityClassId
const marketingName = this.selectType == 'card' ? this.selectItem.equityName : this.selectType == 'package' ? this.selectItem.packageName : this.selectType == 'activity' ? this.selectItem.activityName : this.selectType == 'coupon' ? this.selectItem.couponName : this.selectItem.equityName
const marketingContent = { ...this.selectItem, selectType: this.selectType }
this.$emit('selectActivity', { marketingId, marketingType: this.activeName, marketingName, marketingContent })
},
handleSizeChange(val) {
this.pageSize = val
this.getModelList()
},
handleCurrentChange(val) {
this.pageNum = val
this.getModelList()
},
handleOpen() {
let url
switch (this.activeName) {
case '2':
url = '/marketing/couponManage/index'
break
case '4':
url = '/marketing/memberCenter/setmealAddUpdate?%24title=%25E5%2588%259B%25E5%25BB%25BA%25E5%25A5%2597%25E9%25A4%2590'
break
case '5':
url = '/marketing/seckillActivity/editActivity/1'
break
}
openUrl(location.origin + url)
this.dialogVisible = false
},
getModelList() {
this.modelList = []
this.loading = true
let params = {
pageSize: this.pageSize,
pageNum: this.pageNum
}
const activityChecked = this.activityList.find(act => act.itemValue == this.activeName)
Object.assign(params, activityChecked.params)
activityChecked
.getInterfaceApi(params)
.then(res => {
this.modelList = res.list ? res.list : res.data ? res.data : res
this.tableTotal = res.total ? res.total : 0
this.loading = false
})
.catch(() => {
this.loading = false
})
},
merchantOpen() {
let channel = null
if (location.host == 'scrm.cgacar.com') {
channel = 2
}
const activityMerchant = this.activityList.find(act => act.itemType == 'merchant')
let params = { channel, ...activityMerchant.merchantOpen.params }
activityMerchant.merchantOpen.merchantOpenApi(params).then(res => {
this.openFlag = res.openFlag
})
},
init() {
this.merchantOpen()
this.couponMenu = false
this.activityMenu = false
this.memberMenu = false
const menu = JSON.parse(sessionStorage['SCRM_BASE_MENULIST'])
menu.forEach(item => {
if (item.name == 'marketing') {
if (!item.children) {
return
}
item.children.forEach(itm => {
console.log(itm.path)
if (itm.path == '/couponManage/index') {
this.couponMenu = true
}
if (itm.path == '/seckillActivity/index') {
this.activityMenu = true
}
if (itm.path == '^') {
this.memberMenu = true
}
})
}
})
this.dialogVisible = true
this.getModelList()
this.selectItem = {}
},
handleClick() {
this.getModelList()
}
}
}
</script>
<style lang="scss" scoped>
.square-main {
/deep/ {
.el-dialog__footer {
text-align: center;
}
}
}
.model-panel {
.model-panel-tab {
display: flex;
align-items: center;
margin-bottom: 18px;
label {
font-size: 16px;
font-weight: 400;
color: #000000;
line-height: 24px;
}
/deep/ {
.el-checkbox:last-of-type {
margin-right: 8px;
}
.el-tabs__nav {
border: 0;
}
.el-tabs__header {
border: 0;
background-color: #f4f6fc;
margin: 0px;
}
.el-tabs__item {
border: none;
width: 180px;
height: 32px;
line-height: 32px;
margin: 2px;
text-align: center;
}
.el-tabs__item.is-active {
background-color: #fff;
border-radius: 4px;
font-weight: 600;
}
}
}
.model-item-empty {
> img {
display: block;
margin: 50px auto 0px;
width: 60px;
height: auto;
}
.empty-item {
text-align: center;
font-size: 14px;
font-weight: 400;
color: #000000;
line-height: 22px;
margin-bottom: 30px;
}
}
.model-item-panel {
// display: grid;
// grid-template-columns: repeat(4, 25%);
// grid-row-gap: 10px;
max-height: 38vh;
overflow: auto;
display: flex;
flex-wrap: wrap;
align-items: stretch;
flex-direction: row;
.model-item {
width: 240px;
margin-right: 24px;
margin-bottom: 24px;
padding: 12px 16px;
position: relative;
height: 128px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e6e6e6;
padding: 14px 24px;
box-sizing: border-box;
&:nth-child(4n) {
margin-right: 0px;
}
&.checked {
background: rgba(88, 80, 255, 0.1);
border: 1px solid #5850ff;
}
&-qrcode {
position: absolute;
right: 10px;
bottom: 10px;
width: 60px;
height: 60px;
border: 1px solid #979797;
}
&-title {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-bottom: 5px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
&-content {
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 16px;
height: 16px;
margin-top: 6px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
&.model-item-weight {
line-height: 20px;
height: 20px;
}
span {
color: #5850ff;
font-size: 20px;
}
}
&-contents {
line-height: 22px;
height: 22px;
}
}
}
}
</style>
<template>
<div>
<div class="emotion-box" :style="{ height: height + 'px' }">
<div class="emotion-box-line" v-for="(line, i) in list" :key="i">
<emotion class="emotion-item" v-for="(item, i) in line" :key="i" @click.native="clickHandler(item)">{{ item }}</emotion>
</div>
</div>
</div>
</template>
<script>
import emoji from '../../../utils/emo'
import Emotion from './Emotion'
export default {
props: {
height: {
type: Number,
default: 200
}
},
name: 'emotionWords',
data() {
return {
list: emoji
}
},
methods: {
clickHandler(i) {
let emotion = `${i}`
this.$emit('emotion', emotion)
}
},
components: {
Emotion
}
}
</script>
<style scoped lang="scss">
.emotion-box {
z-index: 2004;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.15);
width: 300px;
box-sizing: border-box;
padding: 5px;
overflow: hidden;
overflow-y: auto;
}
.emotion-box-line {
display: flex;
}
.emotion-item {
flex: 1;
text-align: center;
cursor: pointer;
line-height: 23px;
/deep/ {
img {
width: 24px;
-webkit-user-select: none;
cursor: default;
pointer-events: none;
}
}
}
</style>
<template>
<div class="welcome-box">
<div class="content">
<div class="content-bg">
<wTextarea ref="textContent" v-model="textValue" @updateText="updateText" :style="{ 'min-height': boxHeight + 'px' }"></wTextarea>
<vuedraggable animation="300" v-model="previewList" v-if="isPreview(previewList) && Isdraggable">
<transition-group class="welcome-file">
<template v-for="(itm, index) in previewList">
<div class="welcome-img-box" v-if="itm.attType == ATT_TYPE.IMAGE" :style="`background-image: url('${itm.attContent}')`" :key="itm">
<div class="welcome-img-checked">
<i class="el-icon-zoom-in" @click="handleEnlarge(itm.attContent)"></i>
<i class="el-icon-delete" @click="close(index)"></i>
,
</div>
</div>
<template v-if="itm.attType == ATT_TYPE.VEDIO">
<div class="video-panel" :key="itm">
<video id="video" width="100%" height="100%" preload loop muted>
<source :src="itm.attContent" type="video/mp4" />
</video>
<i class="el-icon-video-play" @click="handleEnlarge(itm.attContent, 'video')"></i>
<div class="video-pane-close" @click="close(index)"><img src="../../../assets/welcomeWord/close-video.png" alt="" /></div>
</div>
</template>
</template>
</transition-group>
</vuedraggable>
<div class="welcome-file" v-if="isPreview(previewList) && !Isdraggable">
<template v-for="(itm, index) in previewList">
<div v-if="itm.attType != ATT_TYPE.TEXT" :key="index">
<template v-if="itm.attType == ATT_TYPE.IMAGE">
<!-- <i v-show="index == previewList.length - 1 && loading" class="el-icon-loading"></i>
<img v-show="!loading" src="../../../assets/welcomeWord/icon-img.png" alt />
<span :title="itm.attContent">{{ itm.attContent }}</span> -->
<div class="welcome-img-box" :style="`background-image: url('${itm.attContent}')`">
<div class="welcome-img-checked">
<i class="el-icon-zoom-in" @click="handleEnlarge(itm.attContent)"></i>
<i class="el-icon-delete" @click="close(index)"></i>
</div>
</div>
</template>
<template v-else-if="itm.attType == ATT_TYPE.VEDIO">
<div class="video-panel">
<video id="video" width="100%" height="100%" preload loop muted>
<source :src="itm.attContent" type="video/mp4" />
</video>
<i class="el-icon-video-play" @click="handleEnlarge(itm.attContent, 'video')"></i>
<div class="video-pane-close" @click="close(index)"><img src="../../../assets/welcomeWord/close-video.png" alt="" /></div>
</div>
</template>
<template v-else-if="itm.attType == ATT_TYPE.ACTIVITY">
<div class="welcome-activity-panel">
<div class="welcome-activity-box">
<div class="welcome-activity-icon">
<img src="../../../assets/welcomeWord/coupon.png" alt="" v-if="marketingContent(itm).selectType == 'coupon'" />
<img src="../../../assets/welcomeWord/gift.png" alt="" v-else />
</div>
<div class="delete-solid">
<i class="el-icon-delete-solid" @click="close(index)"></i>
</div>
<div class="welcome-activity-desc">
<template v-if="marketingContent(itm).selectType == 'card'">
<div class="model-item-title" :title="marketingContent(itm).equityName">{{ marketingContent(itm).equityName }}</div>
<div class="model-item-content model-item-contents">
试用天数:
<span>{{ marketingContent(itm).freeDay }}天</span>
</div>
</template>
<template v-else-if="marketingContent(itm).selectType == 'package'">
<div class="model-item-title" :title="marketingContent(itm).packageName">{{ marketingContent(itm).packageName }}</div>
<div class="model-item-content model-item-contents">
销售价格:
<span>{{ marketingContent(itm).packagePrice }}元</span>
</div>
</template>
<template v-else-if="marketingContent(itm).selectType == 'coupon'">
<div class="model-item-title" :title="marketingContent(itm).couponName">{{ marketingContent(itm).couponName }}</div>
<div class="model-item-content model-item-contents">
数量:
<span>{{ marketingContent(itm).residueAmount }}</span>
</div>
</template>
<template v-else-if="marketingContent(itm).selectType == 'activity'">
<div class="model-item-title" :title="marketingContent(itm).activityName">{{ marketingContent(itm).activityName }}</div>
<div class="model-item-content"></div>
<div class="model-item-content">
开始时间:
{{ marketingContent(itm).startTime }}
</div>
<div class="model-item-content">
结束时间:
{{ marketingContent(itm).endTime }}
</div>
</template>
<template v-else>
<div class="model-item-title" :title="marketingContent(itm).couponName">{{ marketingContent(itm).equityName }}</div>
<div class="model-item-content model-item-weight">
赠送天数:
<span>{{ marketingContent(itm).effectiveType == 2 ? marketingContent(itm).effectivedDay + '天' : '永久有效' }}</span>
</div>
</template>
</div>
</div>
</div>
<!-- <img src="../../../assets/welcomeWord/icon-applet.png" alt />
<span :title="JSON.parse(itm.attContent).marketingName">{{ JSON.parse(itm.attContent).marketingName }}</span> -->
</template>
<template v-else-if="itm.attType == ATT_TYPE.MINIPROGRAM">
<img src="../../../assets/welcomeWord/icon-applet.png" alt />
<span :title="itm.attContent.title">{{ itm.attContent.title }}</span>
</template>
<template v-else-if="itm.attType == ATT_TYPE.FILE">
<div class="welcome-activity-panel">
<div class="welcome-activity-box">
<div class="welcome-activity-icon">
<img src="../../../assets/welcomeWord/pdf_r.png" v-if="itm.attContent" />
</div>
<div class="delete-solid">
<i class="el-icon-delete-solid" @click="close(index)"></i>
</div>
</div>
</div>
</template>
<!-- <i class="el-icon-circle-close" @click="close(index)"></i> -->
</div>
</template>
</div>
<div class="btn-group">
<div class="add-btn" v-for="item in btnList" :key="item.type">
<!-- <i class="el-icon-circle-plus-outline"></i> -->
<img :src="require(`../../../assets/welcomeWord/add-${checkedType(item.type)}.png`)" alt v-if="item.type == 'expression'" @click="selectEmotion" />
<img :src="require(`../../../assets/welcomeWord/add-${checkedType(item.type)}.png`)" v-else alt />
<span v-if="item.type == 'expression'" @click.stop="selectEmotion">{{ item.name }}</span>
<span v-else>{{ item.name }}</span>
<input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.type + 'file'" ref="file" class="welcome-input upload-img" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e)" />
<input v-else-if="item.type == 'video'" type="file" style="opacity: 0" :id="item.type + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'video/*'" @change="e => handleVideoChange(e)" />
<el-link v-else-if="item.type == 'nickname' || item.type == 'message' || item.type == 'activity' || item.type == 'material'" style="opacity: 0" @click="handleFun(item.type)">{{ item.name }}</el-link>
</div>
</div>
</div>
<div v-show="emotionStatus" class="emotion-panel">
<emotion class="emotion-panel-box" @emotion="handleEmotion" :height="280"></emotion>
</div>
</div>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="50%">
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<video width="100%" autoplay controls :src="dialogSrc" v-else></video>
</el-dialog>
<activity-model ref="activity" @selectActivity="selectActivity" :activityList="activityList"></activity-model>
<message-model ref="message" @selectItem="selectMessage" :messageList="messageList"></message-model>
<material-model ref="material" :materialList="materialList" @handleMaterialConfirm="handleMaterialConfirm"></material-model>
</div>
</template>
<script>
//1朋友圈模板-单图文,2朋友圈模板-多图文,3朋友圈模板-文字+视频,4朋友圈模板-文字,5优惠券-商城券,6活动-权益卡使用,7活动-权益套餐,8活动-秒杀活动,10-素材
const ATT_TYPE = {
TEXT: 1,
IMAGE: 2,
VEDIO: 3,
URL: 4,
MINIPROGRAM: 5,
FILE: 6,
ACTIVITY: 7,
MATERIAL: 10
}
const wordType = ['expression', 'img', 'video', 'nickname', 'activity', 'material', 'message']
import emoji from '../../../utils/emo'
import ActivityModel from './activityModel'
import MessageModel from './messageModel'
import materialModel from './materialModel'
import Emotion from './emotionWords'
import wTextarea from './tag-textarea'
import vuedraggable from 'vuedraggable'
import { utils } from 'glsx-common'
export default {
name: 'GLEditor',
components: {
ActivityModel,
Emotion,
wTextarea,
MessageModel,
materialModel,
vuedraggable
},
props: {
btnList: Array,
form: String,
boxHeight: {
type: Number,
default: 400
},
ATT_TYPE: {
type: Array,
default: ATT_TYPE
}
},
data() {
return {
myArr: [{ name: 888 }, { name: 888 }],
dialogVisibleImg: false,
dialogSrc: '',
dialogType: 'img',
loading: false,
emotionStatus: false,
guestForm: {},
previewList: [],
sendType: '',
sendTime: '',
sendDate: '',
editor: {},
textValue: '',
text: ''
}
},
mounted() {
console.log(vuedraggable)
},
computed: {
activityList() {
return this.btnList.find(item => item.type == 'activity').funParams || {}
},
messageList() {
return this.btnList.find(item => item.type == 'message') || {}
},
imageList() {
return this.btnList.find(item => item.type == 'img') || {}
},
Isdraggable() {
return (this.btnList.find(item => item.type == 'img') || {}).Isdraggable
},
videoList() {
return this.btnList.find(item => item.type == 'video') || {}
},
materialList() {
return this.btnList.find(item => item.type == 'material') || {}
},
materialItem() {
let attContent
this.previewList.forEach(item => {
if (item.attType == ATT_TYPE.FILE) {
}
})
return attContent
}
},
watch: {
previewList: {
handler(val) {
this.$emit('previewWord', val)
},
deep: true
}
},
methods: {
isPreview(preview) {
return preview.filter(item => item.attType != ATT_TYPE.TEXT).length
},
handleEnlarge(src, type) {
this.dialogVisibleImg = true
this.dialogSrc = src
this.dialogType = type ? type : 'img'
},
marketingContent(val) {
return JSON.parse(val.attContent).marketingContent
},
checkedType(type) {
return wordType.indexOf(type) !== -1 ? type : 'img'
},
//展开表情
selectEmotion() {
this.emotionStatus = !this.emotionStatus
},
//选择表情
handleEmotion(i) {
this.emotionStatus = false
const list = emoji.flat(Infinity)
let index = list.indexOf(i) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
this.$refs.textContent.addImg(`https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png`)
},
updateText(val) {
this.textInput(val)
},
previewFilter(togetherItem, attType) {
return this.previewList.filter(item => {
return togetherItem.includes(item.attType) || item.attType == attType
})
},
// 上传图片
handleImgChange(e) {
var reader = new FileReader()
var file = e.srcElement.files[0]
// 默认1MB
const limitSize = this.imageList.limitSize || 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
const limitNum = this.imageList.limitNum || 0
if (limitNum && this.previewList.filter(item => item.attType == ATT_TYPE.IMAGE).length >= limitNum) {
this.$message.error(`最多上传${limitNum}张图片`)
return
}
this.loading = true
reader.readAsDataURL(file)
this.previewList.push({
attType: this.ATT_TYPE.IMAGE,
attContent: ''
})
if (this.imageList.togetherItem) {
this.previewList = this.previewFilter(this.imageList.togetherItem, ATT_TYPE.IMAGE)
}
reader.onload = e => {
var image = new Image()
image.src = e.target.result
image.onload = () => {
const { limitWidth, limitHeight } = this.imageList
if (limitWidth && limitHeight && (image.width > limitWidth || image.height > limitHeight)) {
this.$message.error(`图片长宽不超过${limitWidth}x${limitHeight}`)
this.previewList.pop()
return
}
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.imageList.uploadApi({ file: base64 }).then(res => {
if (res) {
let len = this.previewList.length - 1
this.previewList[len].attContent = res
document.querySelector('.upload-img').value = ''
} else {
this.previewList.pop()
}
this.loading = false
})
}
}
},
// 上传视频
async handleVideoChange(e) {
var file
try {
file = await this.uploadFileVideo(e)
if (this.videoList.togetherItem) {
this.previewList = this.previewFilter(this.videoList.togetherItem, ATT_TYPE.VEDIO)
}
var reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.videoList.uploadApi({ file: base64 }).then(res => {
if (res) {
this.previewList.push({
attType: this.ATT_TYPE.VEDIO,
attContent: res
})
}
})
}
} catch (err) {
console.log(err)
}
},
uploadFileVideo(e) {
const _this = this
return new Promise((resolve, reject) => {
let file = e.srcElement.files[0]
// 默认10MB
const limitSize = this.videoList.limitSize || 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
_this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return reject()
}
const limitNum = this.videoList.limitNum || 0
if (limitNum && this.previewList.filter(item => item.attType == ATT_TYPE.VEDIO).length >= limitNum) {
this.$message.error(`最多上传${limitNum}条视频`)
return
}
let videoUrl = URL.createObjectURL(file)
let videoObj = document.createElement('video')
videoObj.src = videoUrl
videoObj.load()
videoObj.onloadedmetadata = function (evt) {
URL.revokeObjectURL(videoUrl)
const { limitWidth, limitHeight, limitTime } = _this.videoList
if (limitWidth && limitHeight && (videoObj.videoWidth > limitWidth || videoObj.videoHeight > limitHeight)) {
_this.$message.error(`上传视频不超过${limitWidth}x${limitHeight}`)
reject()
}
if (limitTime && videoObj.duration > limitTime) {
_this.$message.error(`上传视频不超过${limitTime}s`)
reject()
}
resolve(file)
}
})
},
handleFun(name) {
if (name == 'nickname') {
this.$refs.textContent.addTag('@昵称')
} else if (name == 'activity') {
this.$refs.activity.init()
} else if (name == 'message') {
this.$refs.message.init()
} else if (name == 'material') {
this.$refs.material.init()
}
},
close(index) {
this.previewList.splice(index, 1)
},
textInput(val) {
const hasText = this.previewList.some(item => item.attType == this.ATT_TYPE.TEXT)
if (hasText) {
this.$set(this.previewList, 0, {
attContent: val,
attType: this.ATT_TYPE.TEXT
})
} else {
this.previewList.unshift({
attContent: val,
attType: this.ATT_TYPE.TEXT
})
}
},
selectActivity(val) {
this.previewAddValue(val, 'ACTIVITY')
},
previewAddValue(val, type) {
let idx = this.previewList.findIndex(item => item.attType == this.ATT_TYPE[type])
if (idx !== -1) {
this.$set(this.previewList, idx, {
attContent: JSON.stringify(val),
attType: this.ATT_TYPE[type]
})
} else {
this.previewList.push({
attContent: JSON.stringify(val),
attType: this.ATT_TYPE[type]
})
}
},
// 素材
handleMaterialConfirm(val) {
console.log(val)
const { materialContent, objectName } = val
const imgSrc = materialContent.imgSrc
const videoSrc = materialContent.videoSrc
const pdfSrc = materialContent.pdfSrc
let html = materialContent.html ? materialContent.html : ''
if (pdfSrc && !this.materialList.pdfNo) {
this.previewList.push({
attContent: pdfSrc,
attType: this.ATT_TYPE.FILE
})
return
}
if (imgSrc && imgSrc.length) {
imgSrc.forEach(item => {
this.previewList.push({
attContent: item,
attType: this.ATT_TYPE.IMAGE
})
})
}
if (videoSrc && videoSrc.length && !this.materialList.videoNo) {
videoSrc.forEach(item => {
this.previewList.push({
attContent: item,
attType: this.ATT_TYPE.VEDIO
})
})
}
const idx = this.previewList.findIndex(item => item.attType == this.ATT_TYPE.TEXT)
if (idx !== -1) {
this.textValue = this.previewList[idx].attContent + html
this.$set(this.previewList, 0, {
attContent: this.previewList[idx].attContent + html,
attType: this.ATT_TYPE.TEXT
})
} else {
html = html.replace('\n', '')
this.previewList.unshift({
attContent: html,
attType: this.ATT_TYPE.TEXT
})
this.textValue = html
}
},
selectMessage(val) {
const content = val.content
this.updateText(content)
this.textValue = content
},
insertHtmlAtCaret(html) {
var sel, range, frag
if (window.getSelection) {
sel = window.getSelection()
if (sel.getRangeAt && sel.rangeCount) {
range = sel.getRangeAt(0)
range.deleteContents()
var el = document.createElement('span')
el.innerHTML = '<span contenteditable="false" class="nickname">@昵称<i class="el-icon-error"></i></span>'
// var el = document.createElement('div')
// el.innerHTML = html
frag = document.createDocumentFragment()
var node
var lastNode
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node)
}
range.insertNode(frag)
if (lastNode) {
range = range.cloneRange()
range.setEndAfter(lastNode)
range.collapse(true)
sel.removeAllRanges()
sel.addRange(range)
}
}
}
},
changeInput: utils.debounce(function () {
var allNodes = document.getElementById('editor').childNodes
var str = ''
allNodes.forEach(item => {
if (item.className == 'nickname') {
str += item.innerText
} else if (item.data) {
str += item.data
}
})
this.textInput(str)
}, 300),
updateList(val) {
this.previewList = this.$common.utils.deepClone(val)
// this.eventBus.$emit('update', this.previewList)
const obj = val.find(item => item.attType == this.ATT_TYPE.TEXT)
if (obj) {
let attContent = obj.attContent.replaceAll('[@昵称]', '<wise id="1">@昵称</wise>')
const htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function (res) {
let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
return `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
})
setTimeout(() => {
document.querySelector('.w-textarea_input').innerHTML = htm
}, 100)
} else {
this.textValue = ''
}
}
}
}
</script>
<style lang="scss" scoped>
.welcome-box {
}
.image-dialog {
/deep/ {
.el-dialog__header {
border-bottom: 0px;
padding: 0px;
}
}
}
.video-panel {
margin-right: 10px;
width: 56px;
height: 56px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
.video-pane-close {
position: absolute;
right: 0px;
top: 0px;
width: 14px;
height: 14px;
cursor: pointer;
}
video {
position: absolute;
object-fit: fill;
}
.el-icon-video-play {
z-index: 10;
font-size: 20px;
color: #fff;
cursor: pointer;
}
}
.welcome-img-box {
width: 56px;
height: 56px;
border-radius: 2px;
background-size: 100% 100%;
position: relative;
margin-right: 10px;
.welcome-img-checked {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
background: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity 0.3s;
&:hover {
opacity: 1;
}
i {
color: rgba(255, 255, 255, 0.8);
font-size: 12px;
&:first-child {
margin-right: 5px;
}
}
}
}
.welcome-activity-panel {
display: flex;
margin-right: 10px;
.welcome-activity-box {
cursor: pointer;
position: relative;
min-width: 180px;
background: #fafbfe;
border-radius: 2px;
border: 1px solid #e8e8ea;
padding: 8px;
box-sizing: border-box;
display: flex;
&:hover {
.delete-solid {
opacity: 1;
}
}
.welcome-activity-icon {
width: 36px;
height: 36px;
margin-right: 8px;
position: relative;
background-size: 100% 100%;
img {
width: 100%;
height: 100%;
}
video {
object-fit: fill;
}
.el-icon-video-play {
position: absolute;
top: 7px;
left: 7px;
font-size: 22px;
color: rgba(255, 255, 255, 0.8);
}
.img-filter-box {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
color: rgba(255, 255, 255, 0.8);
display: flex;
font-size: 13px;
align-items: center;
justify-content: center;
}
}
.delete-solid {
transition: all 0.5s;
opacity: 0;
position: absolute;
top: 0px;
right: 0px;
width: 14px;
height: 14px;
background: rgba(0, 0, 0, 0.5);
display: flex;
font-size: 12px;
align-items: center;
justify-content: center;
}
.el-icon-delete-solid {
color: rgba(255, 255, 255, 0.5);
}
.model-item-title {
font-size: 14px;
font-weight: 600;
color: #333333;
line-height: 20px;
}
.model-item-content {
font-size: 12px;
font-weight: 400;
color: #999999;
line-height: 17px;
span {
color: #5850ff;
}
}
}
}
.emotion-panel {
position: relative;
height: 0px;
&-box {
position: absolute;
bottom: 48px;
left: 2px;
}
}
.content-bg {
// background-color: #f7f7f7;
}
.content {
display: inline-block;
vertical-align: text-top;
// width: calc(100% - 103px);
width: 100%;
// margin-left: 12px;
.welcome-file {
display: flex;
align-items: center;
color: #999;
line-height: 20px;
padding: 10px;
overflow-x: auto;
border-left: 1px solid #dcdfe6;
border-right: 1px solid #dcdfe6;
border-bottom: 1px solid #e5e5e5;
i {
cursor: pointer;
}
.el-icon-loading {
font-size: 24px;
}
&:last-child {
margin-bottom: 0;
}
}
.btn-group {
padding: 10px 0 10px 20px;
border: 1px solid #e5e5e5;
border-top: 0;
background: #fafbfe;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
.add-btn {
display: inline-flex;
position: relative;
align-items: center;
padding-right: 25px;
font-size: 16px;
color: #666;
cursor: pointer;
span {
font-size: 14px;
margin-left: 5px;
cursor: pointer;
}
input {
position: absolute;
width: 100%;
cursor: pointer;
font-size: 0;
height: 40px;
}
img {
width: 16px;
height: 16px;
cursor: pointer;
}
.el-link {
position: absolute;
width: 100%;
}
}
}
.date-picker {
margin-top: 10px;
font-size: 14px;
color: #999;
}
}
.required {
display: inline-block;
line-height: 40px;
text-align: right;
width: 90px;
}
.required::before {
content: '*';
color: #f56c6c;
margin-right: 4 px;
}
.form-tips {
font-size: 12px;
color: #999;
}
.form-upload {
position: absolute;
top: 0;
width: 140px;
// width: 100%;
height: 100%;
cursor: pointer;
z-index: 1;
}
/deep/ {
.el-textarea__inner {
background-color: #f7f7f7;
border-radius: 0;
}
.el-textarea__inner:focus {
border-color: #dcdfe6;
}
.el-textarea .el-input__count {
background-color: #f7f7f7;
}
}
.upload {
position: relative;
}
.upload-bg {
position: relative;
width: 140px;
height: 140px;
background-color: #f7f7f7;
color: #999;
border: 1px dashed #dcdfe6;
i {
position: absolute;
top: 40px;
left: 50%;
transform: translateX(-50%);
font-size: 30px;
}
.upload-text {
position: absolute;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
font-size: 12px;
}
}
.tips-text {
display: flex;
align-items: center;
justify-self: center;
color: #000;
font-size: 14px;
padding: 0 16px;
margin-top: 10px;
background-color: rgba(230, 233, 255, 0.49);
border: 1px solid rgba(88, 80, 255, 0.49);
border-radius: 4px;
.tips-icon {
width: 14px;
height: 14px;
margin-right: 8px;
}
}
// 编辑器
.editor-container {
border: 1px solid #dcdfe6;
min-height: 165px;
/deep/ {
.w-e-text {
background-color: #f7f7f7;
}
}
}
.text-editor {
outline: 0;
width: 100%;
min-height: 200px;
max-height: 200px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
padding: 5px;
line-height: 20px;
font-size: 12px;
word-wrap: break-word;
overflow-x: hidden;
overflow-y: auto;
_overflow-y: visible;
}
/deep/.nickname {
display: inline;
// width: 64px;
// height: 20px;
border-radius: 2px;
background-color: #fff;
font-size: 14px;
color: #5850ff;
line-height: 20px;
padding: 2px;
margin: 0 5px;
i {
font-size: 10px;
}
}
</style>
<!-- 素材弹窗 -->
<template>
<el-dialog title="选择素材" :visible.sync="isMaterialVisible" width="70%" class="relateStore">
<GLCombiForm :rowNumber="1" ref="showSearch" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="model-panel">
<div class="model-item-panel" v-if="modelList.length > 0" v-loading="loading">
<div class="model-item" :class="{ checked: selectItem.id == item.id }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)">
<el-tooltip effect="dark" placement="top" :content="item.materialContentRpcResponse.materialName" :disabled="item.materialContentRpcResponse.materialName.length < 16">
<!-- <span class="hide-content">{{ item.materialContentRpcResponse.materialName }}</span> -->
<div class="model-item-title" :title="item.materialContentRpcResponse.materialName">{{ item.materialContentRpcResponse ? item.materialContentRpcResponse.materialName : '-' }}</div>
</el-tooltip>
<!-- <img :src="item.materialContentRpcResponse.materialUrl" /> -->
<!-- 素材内容 -->
<!-- <div slot="materialContentRpcResponse" slot-scope="scope" style="text-align: center"> -->
<!-- 素材为PDF -->
<span v-if="item.materialType == 1" class="material-content">
<!-- <el-tooltip effect="dark" placement="top" :content="item.materialContentRpcResponse.materialName" :disabled="item.materialContentRpcResponse.materialName.length < 16">
<span class="hide-content">{{ item.materialContentRpcResponse.materialName }}</span>
</el-tooltip> -->
<img class="img-pdf" src="../../../assets/welcomeWord/pdf.png" alt="" />
<p class="model-item-content">{{ item.materialContentRpcResponse.materialName }}.png</p>
</span>
<!-- 素材为自定义链接 -->
<!-- <span v-if="item.materialType == 2"></span> -->
<!-- 图文 -->
<span v-if="item.materialType == 3" class="material-content">
<!-- <el-tooltip effect="dark" placement="top" :content="item.materialContentRpcResponse.materialName" :disabled="item.materialContentRpcResponse.materialName.length < 16">
<span>{{ item.materialContentRpcResponse.materialName }}</span>
</el-tooltip> -->
<!-- <el-popover placement="top" trigger="click">
<div>
<img style="width: 72px; height: 72px;" v-if="item.materialContentRpcResponse.materialUrl" :src="item.materialContentRpcResponse.materialUrl" alt="" />
<img class="img-material" v-else src="@/assets/material/car.png" alt="" />
</div>
<span slot="reference">
<img v-if="item.materialContentRpcResponse.materialUrl" class="img-material" :src="item.materialContentRpcResponse.materialUrl" />
<img v-else class="img-material" src="@/assets/material/car.png" alt="" />
</span>
</el-popover> -->
<img v-if="item.materialContent && item.materialContent.urlType == 'img'" class="img-material" :src="item.materialContent.materialUrl" />
<video v-if="item.materialContent && item.materialContent.urlType == 'video'" class="img-material" width="100%" height="100%" preload loop muted>
<source :src="item.materialContent.materialUrl" type="video/mp4" />
</video>
</span>
</div>
<!-- </div> -->
</div>
<div class="model-item-empty" v-else v-loading="loading">
<img src="../../../assets/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[12, 24, 36, 48]" :page-size="pageSize" :total="tableTotal" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="isMaterialVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleMaterialConfirm">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
import GLCombiForm from '../../GlCombiForm/src/index'
export default {
name: 'materialModel',
components: {
GLCombiForm
},
data() {
return {
isMaterialVisible: false,
searchForm: {
groupId: '',
materialType: ''
},
searchFormData: [
{
label: '素材分组',
name: 'groupId',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'materialGroupName',
optionsName: 'groupList'
},
{
label: '素材类型',
name: 'materialType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'materialTypeList'
}
],
// selectedData: [],
// selectingData: [],
// needTip: ['editProduct'],
modelList: [],
selectItem: {
id: ''
},
// 分页
pageNum: 1,
pageSize: 12,
tableTotal: 0,
baseData: {
groupList: [],
materialTypeList: [
{
confId: 1,
confName: 'PDF'
},
// {
// confId: 2,
// confName: '自定义链接'
// },
{
confId: 3,
confName: '图文'
}
]
}
}
},
props: {
materialList: Object
},
methods: {
init() {
this.getBaseData()
this.getModelList()
this.isMaterialVisible = true
},
getBaseData() {
this.materialList.groupListApi({}).then(res => {
this.baseData.groupList = res
this.getOptionsList('searchFormData')
})
},
handleSelectItem(item) {
this.selectItem = item
},
getimgsrc(htmlstr) {
var reg = /<img.+?src=('|")?([^'"]+)('|")?(?:\s+|>)/gim
var arr = []
var tem
while ((tem = reg.exec(htmlstr))) {
arr.push(tem[2])
}
return arr
},
getvideosrc(htmlstr) {
var reg = /<video.+?src=('|")?([^'"]+)('|")?(?:\s+|>)/gim
var arr = []
var tem
while ((tem = reg.exec(htmlstr))) {
arr.push(tem[2])
}
return arr
},
getModelList() {
var params = {
...this.searchForm,
status: 0,
pageNum: this.pageNum,
pageSize: this.pageSize
}
this.materialList.materialListApi(params).then(res => {
this.modelList = res.data
this.tableTotal = res.count
let tableData = []
this.modelList.forEach(item => {
if (item.materialType == 1) {
this.$set(item, 'materialContent', { pdfSrc: decodeURIComponent(item.materialContentRpcResponse.materialUrl) })
return
}
let html = decodeURIComponent(item.materialContentRpcResponse.materialUrl)
let imgSrc = this.getimgsrc(html)
let videoSrc = this.getvideosrc(html)
let imgHtml = html.match(/<img.*?(?:>|\/>)/g)
let videoHtml = html.match(/<video.*<\/video>/g)
let materialUrl, urlType, imgCount
if (imgSrc.length) {
materialUrl = imgSrc[0]
urlType = 'img'
imgCount = imgSrc.length
for (let i = 0; i < imgHtml.length; i++) {
html = html.replace(imgHtml[i], '')
}
}
if (videoSrc.length) {
materialUrl = videoSrc[0]
urlType = 'video'
for (let i = 0; i < videoHtml.length; i++) {
html = html.replace(videoHtml[i], '')
}
}
html = html.replace(/<p><\/p>/g, '').replace(/<p>([\s\S]+)<\/p>/, '\n$1')
if (materialUrl) {
this.$set(item, 'materialContent', { materialUrl, imgCount, urlType, imgSrc, videoSrc, html })
} else {
this.$set(item, 'materialContent', { html })
}
})
})
},
handleReset() {
this.searchForm = {
groupId: '',
materialType: ''
}
this.handleSearch()
},
handleSearch() {
this.pageNum = 1
this.getModelList()
},
handleSizeChange(val) {
this.pageSize = val
this.getModelList()
},
handleCurrentChange(val) {
this.pageNum = val
this.getModelList()
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleMaterialConfirm() {
console.log(this.selectItem)
this.isMaterialVisible = false
this.$emit('handleMaterialConfirm', {
objectId: this.selectItem.id,
objectName: this.selectItem.materialContentRpcResponse.materialName,
materialContent: this.selectItem.materialContent
})
}
}
}
</script>
<style lang="scss" scoped>
.relateStore {
/deep/ {
.gl-operate {
margin-left: 10px;
}
}
}
.model-panel {
.model-panel-tab {
display: flex;
align-items: center;
margin-bottom: 18px;
label {
font-size: 16px;
font-weight: 400;
color: #000000;
line-height: 24px;
}
/deep/ {
.el-checkbox:last-of-type {
margin-right: 8px;
}
.el-tabs__nav {
border: 0;
}
.el-tabs__header {
border: 0;
background-color: #f4f6fc;
margin: 0px;
}
.el-tabs__item {
border: none;
width: 180px;
height: 32px;
line-height: 32px;
margin: 2px;
text-align: center;
}
.el-tabs__item.is-active {
background-color: #fff;
border-radius: 4px;
font-weight: 600;
}
.el-pagination {
padding: 5px;
}
}
}
.model-item-empty {
> img {
display: block;
margin: 50px auto 0px;
width: 60px;
height: auto;
}
.empty-item {
text-align: center;
font-size: 14px;
font-weight: 400;
color: #000000;
line-height: 22px;
margin-bottom: 30px;
}
}
.model-item-panel {
// display: grid;
// grid-template-columns: repeat(4, 25%);
// grid-row-gap: 10px;
max-height: 38vh;
overflow: auto;
display: flex;
flex-wrap: wrap;
align-items: stretch;
flex-direction: row;
.model-item {
width: 240px;
margin-right: 24px;
margin-bottom: 24px;
padding: 12px 16px;
position: relative;
text-align: center;
// height: 128px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e6e6e6;
padding: 14px 24px;
box-sizing: border-box;
&:nth-child(4n) {
margin-right: 0px;
}
&.checked {
background: rgba(88, 80, 255, 0.1);
border: 1px solid #5850ff;
}
&-qrcode {
position: absolute;
right: 10px;
bottom: 10px;
width: 60px;
height: 60px;
border: 1px solid #979797;
}
&-title {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-bottom: 5px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.img-pdf {
width: 40px;
height: 40px;
margin-top: 10px;
}
.img-material {
width: 72px;
height: 72px;
object-fit: fill;
}
&-content {
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 16px;
height: 16px;
margin-top: 6px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
&.model-item-weight {
line-height: 20px;
height: 20px;
}
span {
color: #5850ff;
font-size: 20px;
}
}
&-contents {
line-height: 22px;
height: 22px;
}
}
}
}
</style>
<template>
<div class="square-main">
<el-dialog title="选择模板" :visible.sync="dialogVisible" width="1142px" :before-close="handleClose" :close-on-click-modal="false">
<div class="model-panel" v-loading="messageLoading">
<el-form :inline="true" class="message-form" :model="searchForm" ref="searchForm">
<el-form-item label="模板标题" size="small">
<el-input v-model="searchForm.title" :size="size" placeholder="请输入模板名称搜索"></el-input>
</el-form-item>
<el-form-item label="创建者" size="small" style="margin-left: 10px">
<el-select v-model="searchForm.createdBy" :size="size" placeholder="全部">
<el-option v-for="item in createdList" :key="item.id" :label="item.createdName" :value="item.createdBy"></el-option>
</el-select>
</el-form-item>
<el-form-item size="small" style="margin-left: 10px">
<el-button type="primary" :size="size" @click="search">查询</el-button>
</el-form-item>
<el-form-item style="float: right; margin-right: 0">
<el-button :size="size" icon="el-icon-plus" @click="createModel">新增模板</el-button>
</el-form-item>
</el-form>
<!-- <div class="model-panel-tab">
<label>模板类型:</label>
<el-tabs v-model="activeName" @tab-click="handleClick" type="card">
<el-tab-pane label="售前" name="1"></el-tab-pane>
<el-tab-pane label="售中" name="2"></el-tab-pane>
<el-tab-pane label="售后" name="3"></el-tab-pane>
</el-tabs>
</div>-->
<div class="model-item-panel" v-if="!loading && modelList.length > 0" v-loading="loading">
<div class="model-item" v-for="item in modelList" :key="item.id">
<div class="model-item-radio">
<el-radio v-model="messageRadio" :label="item"></el-radio>
</div>
<div class="model-item-title">
<div class="model-title-h1">{{ item.title }}</div>
<div class="model-title-h2">{{ item.content }}</div>
</div>
<div class="model-item-content">
<div class="model-content">创建人:{{ item.createdName }}</div>
<div class="model-content">创建日期:{{ item.createdTime }}</div>
</div>
<div class="model-item-btn">
<el-button v-if="item.createdBy == userId" type="text" :size="size" @click="editModel(item.id)">编辑</el-button>
</div>
</div>
</div>
<div class="model-item-panel" v-else>
<img src="../../../assets/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[10, 20, 30, 40]" :page-size="pageSize" :total="tableTotal" :layout="layout"></el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleClose">取 消</el-button>
<el-button size="small" type="primary" @click="selectModelItem">复制文本</el-button>
</span>
</el-dialog>
<el-dialog :title="modelTitle" :visible.sync="createVisible" width="547px" :before-close="handleCreateClose" :close-on-click-modal="false">
<el-form :model="templateForm" :rules="templateRules" ref="templateForm" label-width="100px" class="templateForm">
<el-form-item label="标题" prop="title">
<el-input v-model="templateForm.title" maxlength="10" show-word-limit placeholder="输入10个字以内的标题,如活动促销"></el-input>
</el-form-item>
<el-form-item label="内容说明" prop="content">
<el-input type="textarea" v-model="templateForm.content" maxlength="600" :rows="7" show-word-limit placeholder="输入不超过600字内的文字说明"></el-input>
</el-form-item>
</el-form>
<div class="template-footer">
<el-button size="small" @click="createModel">取 消</el-button>
<el-button size="small" type="primary" :loading="createLoading" @click="handleCreate">立即创建</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'MessageModel',
data() {
return {
dialogVisible: false,
createVisible: false,
loading: false,
activeName: '1',
messageRadio: {},
messageLoading: false,
modelList: [
// {
// title: '121',
// content: 'jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开',
// createdTime: '2022-01-04'
// }
],
pageNum: 1,
pageSize: 10,
tableTotal: 0,
layout: '',
searchForm: {},
templateForm: {},
templateRules: {
title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
content: [{ required: true, message: '请输入标题', trigger: 'blur' }]
},
createLoading: false,
createdList: [],
modelTitle: '创建群发模板',
userId: ''
}
},
mounted() {
console.log(this.$globalState, '222323')
if (this.$globalState) {
this.userId = this.$globalState.session.id
}
},
props: {
messageList: Object
},
methods: {
init() {
this.messageLoading = true
this.pageNum = 1
this.messageRadio = {}
this.dialogVisible = true
this.dracImMessage()
this.getCreatedList()
},
selectModelItem() {
this.dialogVisible = false
this.$emit('selectItem', this.messageRadio)
},
handleClick() {
this.dracImMessage()
},
search() {
this.dracImMessage(this.searchForm)
},
handleClose() {
this.dialogVisible = false
this.modelList = []
this.tableTotal = 0
},
dracImMessage(searcher) {
this.modelList = []
this.loading = true
let params = {
pageSize: this.pageSize,
pageNum: this.pageNum
}
if (searcher) {
params.title = searcher.title
params.createdBy = searcher.createdBy
}
const { templateApi } = this.messageList
templateApi(params).then(res => {
if (res) {
this.modelList = res.data
this.tableTotal = res.count
if (res.count > 10) {
this.layout = 'pager'
}
}
this.loading = false
})
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
},
handleCurrentChange(val) {
this.pageNum = val
this.dracImMessage()
console.log(`当前页: ${val}`)
},
createModel() {
this.createVisible = !this.createVisible
if (!this.createVisible) {
this.templateForm = {}
}
},
handleCreate() {
this.$refs.templateForm.validate(valid => {
if (valid) {
console.log(this.templateForm)
this.createLoading = true
const params = {
title: this.templateForm.title,
content: this.templateForm.content
}
const { templateSaveApi, templateUpdateApi } = this.messageList
let api = templateSaveApi
if (this.templateForm.id) {
api = templateUpdateApi
params.id = this.templateForm.id
}
api(params).then(res => {
console.log(res)
this.createLoading = false
if (res) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.pageNum = 1
this.createModel()
this.dracImMessage()
}
})
}
})
},
editModel(id) {
this.createModel()
this.modelTitle = '编辑群发模板'
this.getTemplateDetail(id)
},
getCreatedList() {
const { getSearchApi } = this.messageList
getSearchApi({}).then(res => {
this.createdList = res
this.$nextTick(() => {
this.messageLoading = false
})
})
},
getTemplateDetail(id) {
const { templateDetailApi } = this.messageList
templateDetailApi({ id }).then(res => {
console.log(res)
if (res) {
this.templateForm = res
}
})
}
}
}
</script>
<style lang="scss" scoped>
.model-panel {
padding: 0 20px;
.model-panel-tab {
display: flex;
align-items: center;
margin-bottom: 18px;
label {
font-size: 16px;
font-weight: 400;
color: #000000;
line-height: 24px;
}
/deep/ {
.el-checkbox:last-of-type {
margin-right: 8px;
}
.el-tabs__nav {
border: 0;
}
.el-tabs__header {
border: 0;
background-color: #f4f6fc;
margin: 0px;
}
.el-tabs__item {
border: none;
width: 180px;
height: 32px;
line-height: 32px;
margin: 2px;
text-align: center;
}
.el-tabs__item.is-active {
background-color: #fff;
border-radius: 4px;
}
}
}
.model-item-panel {
max-height: 400px;
overflow: auto;
> img {
display: block;
margin: 50px auto 0px;
width: 60px;
height: auto;
}
.empty-item {
text-align: center;
font-size: 14px;
font-weight: 400;
color: #000000;
line-height: 22px;
margin-bottom: 30px;
}
.model-item {
display: flex;
padding: 20px;
border-bottom: 1px solid #e9e9e9;
&:last-child {
border-bottom: none;
}
&-radio {
width: 60px;
/deep/ {
.el-radio__input {
margin-top: 10px;
}
.el-radio__label {
display: none;
}
}
}
&-content {
min-width: 210px;
margin-right: 50px;
.model-content {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
}
}
&-title {
flex: 1;
.model-title-h1 {
font-size: 14px;
font-weight: 400;
max-width: 658px;
color: #333333;
line-height: 20px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.model-title-h2 {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
max-width: 658px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
&-btn {
width: 30px;
height: 40px;
}
}
}
}
.message-form .el-form-item {
margin-bottom: 0 !important;
}
/deep/ .el-pager {
height: 30px;
}
.el-pagination {
margin-top: 21px;
}
.templateForm {
padding: 0 20px;
/deep/ {
.el-textarea__inner {
background-color: #fff;
}
.el-textarea .el-input__count {
background-color: #fff;
}
}
}
.template-footer {
text-align: center;
border-top: 1px solid #e6e6e6;
padding-top: 16px;
margin-bottom: -14px;
}
/deep/ {
.el-dialog__body {
padding: 30px 0;
}
}
</style>
<template>
<div class="w-textarea" ref="wTextarea" v-bind="$attr">
<div contenteditable="true" class="w-textarea_input" ref="wTextareaContent" :id="contentId" @click="inputClick($event)" @focus="onFocus" @blur="onBlur" @keydown.delete="handleDelete($event)" @input="handleInput($event.target)"></div>
<!-- <div class="w-textarea_tools" v-if="tools.length > 0 || maxlength">
<button
class="w-textarea_tools__item"
v-for="item in tools"
:key="item.type"
@click="openTagDialog(item.type)"
>{{item.text}}</button>
<span
:class="['w-textarea_tools__text',
count.num < 0 ? '__danger' : '']"
v-if="maxlength"
>{{count.text}}</span>
</div>-->
<!-- <div class="w-textarea_dialog">
<slot></slot>
</div>-->
</div>
</template>
<script>
import emoji from '../../../utils/emo'
export default {
name: 'wTextarea',
data() {
return {
// 记录currentText以计算长度
currentText: this.value,
// 为input区域生成随机id,当在页面上有多个组件时,用于监听光标的变化
contentId: `content${this.getGuid()}`,
// 输入的时候锁定,禁止更新innerHTML
isLocked: false,
isInsert: false,
// 记录当前选中tag的ID
currentTagId: null,
// 当前光标位置
savedRange: {}
}
},
props: {
value: {
type: String,
default: ''
},
tag: {
// 自定义模版标签的标签名
type: String,
// 默认使用wise作为标签名,并添加了默认样式
// 当使用其他标签名的时候,需要另写标签样式
default: 'wise'
},
tools: {
// 自定义扩展功能:超链接'link',模版标签'tag'
type: Array,
default() {
return [
{ type: 'link', text: '添加超链接' },
{ type: 'tag', text: '添加模版标签' }
]
}
},
maxlength: {
// 最大输入长度
type: [String, Number],
default: ''
}
},
computed: {
count() {
// 字符长度记数
let num = this.maxlength - this.currentText.length
let text = num < 0 ? `已超出${Math.abs(num)}个字符` : `还可以输入${num}个字符`
return { num, text }
}
},
mounted() {
// 初始化数据
this.currentText && (this.$refs.wTextareaContent.innerHTML = this.currentText)
// 创建模版标签的style
this.createStyle()
// 每次光标变化的时候,保存 range
document.addEventListener('selectionchange', this.selectHandler)
},
beforeDestroy() {
// 卸载事件
document.removeEventListener('selectionchange', this.selectHandler)
},
methods: {
updateData(text) {
this.$emit('input', text)
},
createStyle() {
// 为自定义的模版标签添加样式,使之不可编辑
let style = document.createElement('style')
style.innerHTML = `.w-textarea ${this.tag} {
cursor: default;
-webkit-user-modify: read-only !important;
}`
this.$refs.wTextarea.appendChild(style)
},
closeModal() {
this.form.text = ''
this.showModal = false
},
openTagDialog(type) {
// if (addLink)
// 将事件抛给父组件处理
// 处理后需要调用 addTag() 或者 addLink() 将内容传回来
this.$emit('add', type)
},
addTag(text) {
// 创建模版标签
let node = document.createElement(this.tag)
if (navigator.userAgent.indexOf('Firefox') > 0) {
node.setAttribute('contenteditable', 'false')
}
node.innerText = text
// 添加id便于删除
node.id = this.getGuid()
this.insertNode(node)
},
addNode() {
let target = this.$refs.wTextareaContent
this.updateData(target.innerHTML)
},
promiseAdd(item, num) {
return new Promise((resolve, reject) => {
setTimeout(() => {
document.querySelector('.w-textarea_input').innerHTML += item
document.querySelector('.w-textarea_input').focus()
resolve()
}, num * 100)
})
},
promiseAddNode(item, num) {
return new Promise((resolve, reject) => {
setTimeout(() => {
document.querySelector('.w-textarea_input').innerHTML += item
document.querySelector('.w-textarea_input').focus()
resolve()
}, num * 100)
})
},
addContent(attContent) {
attContent.forEach(async (item, index) => {
await this.promiseAdd(item, index)
this.addTag('@昵称')
// await this.promiseAddNode(item, index)
// this.addNode()
// t2(item)
})
// for (let i = 0; i < attContent.length; i++) {
// if (attContent[i] || (i == 0 && !attContent[i])) {
// document.querySelector('.w-textarea_input').innerHTML += attContent[i]
// document.querySelector('.w-textarea_input').focus()
// document.querySelector('.w-textarea_input').click()
// this.$nextTick(()=>{
// this.addTag('@昵称')
// })
// }
// // 代码格式
// // (function(a) {})(b)
// }
},
addLink(text, url) {
// 创建a标签
let node = document.createElement('a')
node.innerText = text
node.href = url
node.target = 'blank'
this.insertNode(node)
},
addImg(url) {
// 创建a标签
let node = document.createElement('img')
node.src = url
// node.setAttribute('ondragstart', 'return false;')
this.insertNode(node)
},
onFocus() {
this.isLocked = true
this.isInsert = true
},
onBlur() {
this.isLocked = false
},
insertNode(node) {
// 在内容中插入标签
// 删掉选中的内容(如有)
if (this.savedRange.startContainer) {
this.insertNodeFirst(node)
} else {
document.querySelector('.w-textarea_input').focus()
setTimeout(() => {
this.insertNodeFirst(node)
document.querySelector('.w-textarea_input').blur()
}, 100)
}
},
insertNodeFirst(node) {
this.savedRange.deleteContents()
// 插入链接
if (this.isInsert) {
this.savedRange.insertNode(node)
} else {
document.querySelector('.w-textarea_input').appendChild(node)
}
this.isInsert = false
// 更新双向绑定数据
let target = this.$refs.wTextareaContent
if (navigator.userAgent.indexOf('Firefox') > 0 || navigator.userAgent.indexOf('QQBrowser') > 0) {
this.updateData(target.innerHTML + '&nbsp;')
} else {
this.updateData(target.innerHTML)
}
let htm = target.innerHTML
const list = emoji.flat(Infinity)
const cutImg = htm
.replace(/<img src="https:\/\/img01.glsx.com.cn\/weapp\/resource\/saas\/scrm\/emoji/g, '')
.replaceAll('<wise id="1">@昵称</wise>', '@昵称')
.replace(/<br>/g, '\n')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function (str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = replaceImg.substring(0, 600)
console.log(this.currentText)
this.$emit('updateText', this.currentText)
},
placeCaretAtEnd(el) {
//传入光标要去的jq节点对象
el.focus()
if (typeof window.getSelection != 'undefined' && typeof document.createRange != 'undefined') {
var range = document.createRange()
range.selectNodeContents(el)
range.collapse(false)
var sel = window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
} else if (typeof document.body.createTextRange != 'undefined') {
var textRange = document.body.createTextRange()
textRange.moveToElementText(el)
textRange.collapse(false)
textRange.select()
}
},
handleInput(target) {
// 即时更新数据
this.updateData(target.innerHTML)
let htm = target.innerHTML
console.log(htm)
const list = emoji.flat(Infinity)
const cutImg = htm.replaceAll('<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/', '')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function (str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = Textnode.innerText.substring(0, 600)
this.$emit('updateText', this.currentText)
},
handleDelete(e) {
// 监听“删除”事件
if (this.currentTagId) {
// 若已选中模版标签,直接删除dom节点
let t = document.getElementById(this.currentTagId)
this.$refs.wTextareaContent.removeChild(t)
this.currentTagId = null
// 阻止浏览器默认的删除事件,并手动更新数据
e.preventDefault()
this.handleInput(e.target)
}
},
inputClick(e) {
// 监听点击事件
this.isLocked = true
const TAG_NAME = e.target.nodeName
if (TAG_NAME === this.tag.toUpperCase()) {
// 点击模版标签时,记录id
this.currentTagId = e.target.id
e.target.className = 'active'
} else if (this.currentTagId) {
// 清空active样式
let target = document.getElementById(this.currentTagId)
target.className = ''
this.currentTagId = null
} else {
this.currentTagId = null
}
},
getGuid() {
// 生成随机ID
return 1
// return `r${new Date().getTime()}d${Math.ceil(Math.random() * 1000)}`
},
selectHandler() {
// 监听选定文本的变动
let sel = window.getSelection()
let range = sel.rangeCount > 0 ? sel.getRangeAt(0) : null
if (range && range.commonAncestorContainer.ownerDocument.activeElement.id === this.contentId) {
this.savedRange = range
}
}
},
watch: {
value(val) {
// 非锁定状态下,实时更新innerHTML
if (!this.isLocked) {
this.$refs.wTextareaContent.innerHTML = val
}
}
}
}
</script>
<style lang="scss">
.w-textarea {
wise {
border-radius: 2px;
background-color: #fff;
font-size: 14px;
color: #5850ff;
line-height: 20px;
padding: 2px;
margin: 0 5px;
color: #26a2ff;
// padding: 0 1px;
white-space: nowrap;
cursor: default;
-webkit-user-modify: read-only !important;
}
img {
width: 18px;
height: 18px;
-webkit-user-select: none;
cursor: default;
pointer-events: none;
vertical-align: middle;
}
.active {
background: #dcdfe6;
}
}
</style>
<style lang="scss" scoped>
$borderColor: #e5e5e5;
$bgColor: #f5f7fa;
$textColor: #666;
.w-textarea {
width: 100%;
box-sizing: border-box;
border-top-right-radius: 4px;
border-top-left-radius: 4px;
border: 1px solid $borderColor;
position: relative;
overflow-y: auto;
&_input {
width: 100%;
height: 200px;
min-height: 100px;
box-sizing: border-box;
padding: 10px;
line-height: 1.5;
word-break: break-word;
// 允许编辑,禁止富文本
-webkit-user-modify: read-write-plaintext-only !important;
&:focus {
outline: none;
}
}
&_tools {
padding: 0 10px;
height: 40px;
line-height: 40px;
border-top: 1px solid $borderColor;
background-color: $bgColor;
color: $textColor;
font-size: 12px;
&__item {
display: inline-block;
line-height: 1;
padding: 5px 8px;
margin-right: 8px;
color: $textColor;
cursor: pointer;
border: 1px solid $borderColor;
border-radius: 4px;
background: #fff;
transition: all 0.3s;
&:hover {
background: $bgColor;
opacity: 0.7;
}
&:focus {
outline: none;
}
}
&__text {
display: inline-block;
line-height: 40px;
padding: 0 8px;
float: right;
color: $textColor;
cursor: default;
transition: all 0.3s;
&:hover {
opacity: 1;
}
&.__danger {
color: red;
}
}
}
}
</style>
<template> <template>
<div <div class="scrm-footer-panel">
<!-- <div
class="scrm-footer-panel" class="scrm-footer-panel"
:style="{ :style="{
left: footerLeft + 'px', left: footerLeft + 'px',
width: footerWidth + 'px' width: footerWidth + 'px'
}" }"
> > -->
<slot></slot> <slot></slot>
</div> </div>
</template> </template>
<script> <script>
import { utils } from 'glsx-common'
export default { export default {
name: 'GLFooter', name: 'GLFooter',
props: { props: {
...@@ -21,21 +23,25 @@ export default { ...@@ -21,21 +23,25 @@ export default {
data() { data() {
return { return {
footerLeft: 0, footerLeft: 0,
footerWidth: 0 footerWidth: 0,
aside: ''
} }
}, },
methods: { methods: {
resize() { resize: utils.debounce(function () {
this.footerLeft = document.querySelector(this.className)?document.querySelector(this.className).offsetLeft : 0 this.footerLeft = document.querySelector(this.className) ? document.querySelector(this.className).offsetLeft : 0
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
} }, 100)
}, },
destroyed() { destroyed() {
window.removeEventListener('resize', this.resize) window.removeEventListener('resize', this.resize)
this.aside && this.aside.removeEventListener('DOMSubtreeModified', this.resize)
}, },
mounted() { mounted() {
this.resize() // this.resize()
window.addEventListener('resize', this.resize) // this.aside = document.querySelector('.base-container-aside')
// this.aside && this.aside.addEventListener('DOMSubtreeModified', this.resize)
// window.addEventListener('resize', this.resize)
} }
} }
</script> </script>
...@@ -45,10 +51,9 @@ export default { ...@@ -45,10 +51,9 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: fixed; position: static !important;
bottom: 0px; height: auto !important;
height: 64px; background: none !important;
background: #ffffff; box-shadow: none !important;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
} }
</style> </style>
<!-- <content> -->
# GLDialog
<!-- 测试弹框组件 -->
<el-button plain @click="testDialog(1)">dialog(大)</el-button>
<el-button plain @click="testDialog2">dialog(中)</el-button>
<el-button plain @click="showDialog">dialog(小)</el-button>
<el-button plain @click="testDialog3">dialog(中)无按钮</el-button>
<el-button plain @click="testBeforeDialog">之前小弹窗</el-button>
<!-- :content="'hello HelloWorld'" -->
<GLDialog
:mode="mode"
bigTitle="大标题"
:hasFooter="hasFooter"
:type="'error'"
@onOk="handleOk"
@onCancel="handleCancel"
:visible.sync="dialogShow">
<div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
</div>
</GLDialog>
<GLDialog
:mode="mode"
title="提示"
:hasFooter="hasFooter"
:type="'error'"
:content="'hello HelloWorld'"
@onOk="handleOk"
@onCancel="handleCancel"
:visible.sync="dialogShow2">
</GLDialog>
<GLDialog
title="提示123"
:mode="mode"
:hasFooter="hasFooter"
:type="'error'"
:content="'hello HelloWorld'"
@onOk="handleOk"
@onCancel="handleCancel"
:visible.sync="dialogShow1">
</GLDialog>
<el-button type="warning" @click="toggleShow(1)">显示代码</el-button>
```js {mixin:true}
{
data() {
return {
demo1: true,
//测试弹框
dialogShow:false,
dialogShow1:false,
dialogShow2:false,
mode:"mid",
hasFooter: true
}
},
methods:{
btnClick(){
alert('点击')
},
toggleShow(num){
// console.log(123)
this['demo' + num] = !this['demo' + num]
},
//测试弹框
testDialog(number){
this.dialogShow = !this.dialogShow
this.hasFooter = true
switch (number) {
case 1:
this.mode = 'big'
break;
case 2:
this.mode = 'mid'
break;
case 3:
this.mode = 'small'
break;
case 4:
this.mode = 'mid'
this.hasFooter = false
break;
}
},
testDialog2(){
this. mode = 'mid'
this.dialogShow2 = !this.dialogShow2
this.hasFooter = true
},
testDialog3(){
this. mode = 'mid'
this.dialogShow2 = !this.dialogShow2
this.hasFooter = false
},
showDialog(){
this.dialogShow1 = !this.dialogShow1
this.mode = 'small'
this.hasFooter = true
},
handleOk(){
console.log('点击确定')
this.dialogShow = false
this.dialogShow1 = false
},
handleCancel(){
console.log('点击取消')
this.dialogShow = false
this.dialogShow1 = false
},
testBeforeDialog(){
this.$confirm('检测到未保存的内容,是否在离开页面前保存修改?', '确认信息', {
// distinguishCancelAndClose: true,
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
})
}
}
}
```
<div v-if="demo1">
```html
<template>
<div>
<GLDialog
:mode="mode"
bigTitle="大标题"
:hasFooter="hasFooter"
:type="'error'"
@onOk="handleOk"
@onCancel="handleCancel"
:visible.sync="dialogShow">
<div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
<div>这是一段信息</div>
</div>
<!-- <span slot="footer" class="dialog-footer">
<el-button plain size="small" class="btn-three" @click="dialogShow = false">取消123</el-button>
<el-button type="primary" size="small" @click="dialogShow = false">确定123</el-button>
</span> -->
</GLDialog>
<GLDialog
:mode="mode"
title="提示"
:hasFooter="hasFooter"
:type="'error'"
:content="'hello HelloWorld'"
@onOk="handleOk"
@onCancel="handleCancel"
:visible.sync="dialogShow2">
</GLDialog>
<GLDialog
title="提示123"
:mode="mode"
:hasFooter="hasFooter"
:type="'error'"
:content="'hello HelloWorld'"
@onOk="handleOk"
@onCancel="handleCancel"
:visible.sync="dialogShow1">
</GLDialog>
</div>
</template>
<script>
export default {
data() {
return {
//测试弹框
dialogShow:false,
dialogShow1:false,
dialogShow2:false,
mode:"mid",
hasFooter: true
}
},
methods: {
btnClick() {
alert('点击')
},
//测试弹框
testDialog(number){
this.dialogShow = !this.dialogShow
this.hasFooter = true
switch (number) {
case 1:
this.mode = 'big'
break;
case 2:
this.mode = 'mid'
break;
case 3:
this.mode = 'small'
break;
case 4:
this.mode = 'mid'
this.hasFooter = false
break;
}
},
testDialog2(){
this. mode = 'mid'
this.dialogShow2 = !this.dialogShow2
this.hasFooter = true
},
testDialog3(){
this. mode = 'mid'
this.dialogShow2 = !this.dialogShow2
this.hasFooter = false
},
showDialog(){
this.dialogShow1 = !this.dialogShow1
this.mode = 'small'
this.hasFooter = true
},
handleOk(){
console.log('点击确定')
this.dialogShow = false
this.dialogShow1 = false
},
handleCancel(){
console.log('点击取消')
this.dialogShow = false
this.dialogShow1 = false
},
testBeforeDialog(){
this.$confirm('检测到未保存的内容,是否在离开页面前保存修改?', '确认信息', {
// distinguishCancelAndClose: true,
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
})
}
}
}
</script>
```
</div>
<!-- </content> -->
<template>
<div class="gl-dialog-wrap " :class="mode" :id="idDom">
<el-dialog v-bind="$attrs" v-on="$listeners">
<template v-slot:title>
<!-- 标题插槽 -->
<slot name="title" v-if="!bigTitle"></slot>
<template v-if="bigTitle">
<template v-if="mode === 'big'">
<span class="el-dialog__title" v-if="!$slots.custombigtitle">
{{ bigTitle }}
</span>
<span class="el-dialog__title" v-if="$slots.custombigtitle">
<!-- 大弹窗自定义插槽 -->
<slot name="custombigtitle"></slot>
</span>
<button type="button" aria-label="Close" class="el-dialog__headerbtn">
<!-- <i v-if="mode === 'big'" class="el-icon-full-screen full-screen" @click="fullScreenFn"></i> -->
<i v-if="mode === 'big'" :class="isFull ? 's-full-screen' : 'full-screen'" @click="fullScreenFn"></i>
<!-- <i class="el-icon-close "></i> -->
</button>
</template>
</template>
</template>
<template v-slot:default>
<!-- 默认插槽 -->
<slot name="default" v-if="!content"></slot>
<template v-if="content">
<div v-if="mode === 'small'" class="small-content">
<i :class="iconType"></i>
<div class="content">{{ content }}</div>
</div>
<div v-else class="content">{{ content }}</div>
</template>
</template>
<template v-slot:footer v-if="hasFooter">
<template v-if="!$slots.footer">
<span class="dialog-footer">
<el-button plain size="small" class="btn-three" @click="cancel">{{ cancelName }}</el-button>
<el-button type="primary" size="small" @click="ok">{{ okName }}</el-button>
</span>
</template>
<!-- footer插槽 -->
<slot name="footer" v-if="$slots.footer"></slot>
</template>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'GLDialog',
inheritAttrs: false,
// 传入width会覆盖默认的宽度
props: {
// 弹框模式
mode: {
type: String,
// `big` / `mid` / `small`
default: 'mid'
},
// 是否有按钮
hasFooter: {
type: Boolean,
default: true
},
// 取消按钮名称
cancelText: {
type: String,
default: ''
},
// 确定按钮名称
okText: {
type: String,
default: ''
},
// 大标题(不与title(低)共存)
bigTitle: {
type: String,
default: ''
},
// 内容(small生效)
content: {
type: String,
default: ''
},
// 消息类型(图标,small生效)
type: {
type: String,
// `success` / `info` / `warning` / `error`
default: ''
}
},
data() {
return {
isFull: false,
idDom:Math.random().toString(36).slice(-8)
}
},
mounted(){
document.addEventListener('keyup', (e)=>{
this.keyupHook(e)
});
},
computed: {
okName: function() {
let resName
switch (this.mode) {
case 'small':
resName = this.okText ? this.okText : '是'
break
default:
resName = this.okText ? this.okText : '确定'
break
}
return resName
},
cancelName: function() {
let resName
switch (this.mode) {
case 'small':
resName = this.cancelText ? this.cancelText : '否'
break
default:
resName = this.cancelText ? this.cancelText : '取消'
break
}
return resName
},
iconType: function() {
let type
switch (this.type) {
case 'success':
type = 'el-icon-success'
break
case 'info':
type = 'el-icon-info'
break
case 'warning':
type = 'el-icon-warning'
break
case 'error':
type = 'el-icon-error'
break
}
return type
}
},
methods: {
ok() {
// 这是确认事件
this.$emit('onOk')
},
cancel() {
// 这是取消事件
this.$emit('onCancel')
},
escFn(){
setTimeout(() => {
this.isFull = false
this.exitFullscreenHook()
},300)
},
fullScreenFn() {
if(this.isFull){
this.exitFullscreenHook()
this.isFull = false
}else{
this.fullScreenHook()
this.isFull = true
}
},
fullScreenHook(){
const rootdom = document.getElementById(this.idDom)
const dialog = rootdom.getElementsByClassName('el-dialog')[0]
const dialogBody = rootdom.getElementsByClassName('el-dialog__body')[0]
dialog.style.margin = 0
dialog.style.width = window.innerWidth +'px'
dialog.style.height = window.innerHeight +'px'
// dialogBody.style.maxHeight = window.innerHeight -60 -40 -64 + 'px'
dialogBody.style.minHeight = window.innerHeight -60 -40 -64 + 'px'
},
exitFullscreenHook(){
const rootdom = document.getElementById(this.idDom)
const dialog = rootdom.getElementsByClassName('el-dialog')[0]
const dialogBody = rootdom.getElementsByClassName('el-dialog__body')[0]
if(dialogBody){
// dialogBody.style.maxHeight = '586px'
dialogBody.style.minHeight = '156px'
}
dialog.style.margin = '15vh auto 50px'
dialog.style.width = 1080 +'px'
dialog.style.height = 'auto'
},
keyupHook(e){
if(this.isFull){
if( e.key === 'Escape'){
this.escFn()
}
}
}
},
beforeDestroy(){
document.removeEventListener('keyup',(e)=>{
this.keyupHook(e)
})
}
}
</script>
<style lang="scss">
.gl-dialog-wrap {
&.big {
.el-dialog {
width: 1080px;
}
.el-dialog__body {
min-height: 156px;
max-height: 586px;
}
}
&.mid {
.el-dialog {
width: 720px;
}
.el-dialog__body {
min-height: 156px;
max-height: 586px;
}
}
&.small {
.el-dialog {
width: 576px;
}
.el-dialog__body {
height: 152px;
}
.el-dialog__footer {
text-align: center;
}
.small-content {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.el-icon-success {
font-size: 48px;
color: #67c23a;
}
.el-icon-info {
font-size: 48px;
color: #909399;
}
.el-icon-warning {
font-size: 48px;
color: #e6a23c;
}
.el-icon-error {
font-size: 48px;
color: #f56c6c;
}
.content {
margin-top: 16px;
}
}
}
.el-dialog__header {
padding: 16px 20px;
.el-dialog__headerbtn {
top: 18px;
font-size: 24px;
font-weight: 600;
line-height: 24px;
color: #000;
.full-screen {
display: block;
margin-right: 34px;
width: 24px;
height: 24px;
background-image: url('../../../assets/full-screen.png');
background-size: 100% 100%;
// &:hover {
// color: $color-primary;
// }
}
.s-full-screen {
display: block;
margin-right: 34px;
width: 24px;
height: 24px;
background-image: url('../../../assets/s-full-screen.png');
background-size: 100% 100%;
}
}
}
.el-dialog__body {
padding: 20px;
overflow: auto;
}
.el-dialog__footer {
padding: 15px 20px 16px;
}
.el-table .el-table__row td {
height: 40px;
}
}
</style>
import GLFull from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLFull.install = function (Vue) {
Vue.component(GLFull.name, GLFull)
}
// 默认导出组件
export default GLFull
<template>
<div class="full-container">
<el-tooltip placement="top" v-if="hoverStatus">
<div slot="content">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
<div :class="['full-text', identification]" :style="{ width: labelWidth + 'px' }" @mouseenter="hoverFun" v-if="textType != 'text' && !haveClose">
<el-tag type="info" class="full-text" :disable-transitions="false">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
{{ label }}
</el-tag>
</div>
<div v-if="textType != 'text' && haveClose" @mouseenter="hoverFun">
<el-tag class="tag-user-closable" :style="{ 'max-width': labelWidth + 'px' }" type="info" :disable-transitions="false" closable @close="handleRemove">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<span :class="['full-text-user', { 'user-icon-checked': textType == 'user' && haveClose }, identification]">{{ label }}</span>
</el-tag>
</div>
<div :class="[line ? 'full-text-line' : 'full-text', identification]" @mouseenter="hoverFun" :style="{ width: labelWidth + 'px', '-webkit-line-clamp': line }" v-if="textType == 'text'">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
</el-tooltip>
<template v-else>
<div :class="['full-text', identification]" @mouseenter="hoverFun" :style="{ width: labelWidth + 'px' }" v-if="textType != 'text' && !haveClose">
<el-tag type="info" class="full-text" :disable-transitions="false">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
{{ label }}
</el-tag>
</div>
<div @mouseenter="hoverFun" v-if="textType != 'text' && haveClose">
<el-tag class="tag-user-closable" type="info" :style="{ 'max-width': labelWidth + 'px' }" :disable-transitions="false" closable @close="handleRemove">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<span :class="['full-text-user', identification]">{{ label }}</span>
</el-tag>
</div>
<div :class="[line ? 'full-text-line' : 'full-text', identification]" @mouseenter="hoverFun" :style="{ width: labelWidth + 'px', '-webkit-line-clamp': line }" v-if="textType == 'text'">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
</template>
</div>
</template>
<script>
export default {
name: 'GLFull',
data() {
return {
hoverStatus: false
}
},
props: {
//唯一标识
identi: {
type: String,
default: 'identi'
},
//文本
label: {
type: String,
default: ''
},
//文本宽度
labelWidth: {
type: Number,
default: 100
},
//行数
line: {
type: Number,
default: 0
},
textType: {
type: String,
default: 'text', // text 文本 user 跟进员工 tag 标签
validator: function (value) {
return ['text', 'user', 'tag'].indexOf(value) !== -1
}
},
//是否包含关闭按钮
haveClose: {
type: Boolean,
default: false
}
},
computed: {
identification() {
return 'text_' + this.identi
}
},
methods: {
hoverFun() {
if (this.haveClose) {
//this.hoverStatus = this.identi ? document.querySelector(`.${this.identification}`).scrollWidth > document.querySelector(`.${this.identification}`).offsetWidth : document.querySelector(`.full-text`).scrollWidth > this.labelWidth - 30
this.hoverStatus = document.querySelector(`.${this.identification}`).scrollWidth > document.querySelector(`.${this.identification}`).offsetWidth
} else {
let widthMuti = this.textType == 'user' ? 17 : this.textType == 'tag' ? 20 : 0
// this.hoverStatus = this.identi ? document.querySelector(`.${this.identification}`).scrollWidth - widthMuti > this.labelWidth : document.querySelector(`.full-text`).scrollWidth > this.labelWidth
this.hoverStatus = document.querySelector(`.${this.identification}`).scrollWidth - widthMuti > this.labelWidth
}
},
handleRemove() {
this.$emit('handleRemove')
}
}
}
</script>
<style scoped lang="scss">
.full-container {
display: inline-block;
/deep/ {
.el-tag {
height: 26px;
line-height: 26px;
}
}
}
.full-text {
max-width: 100%;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.full-text-user {
max-width: calc(100% - 14px);
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
&.user-icon-checked {
max-width: calc(100% - 30px);
}
}
.tag-user-closable {
display: flex;
align-items: center;
/deep/ {
.el-icon-close {
margin-top: 2px;
}
}
}
.full-text-line {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
word-break: break-all;
}
.el-icon-user-solid {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
</style>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<div class="operate"> <div class="operate">
<el-button size="small" type="primary" @click="handleOkFn">查询</el-button> <el-button size="small" type="primary" @click="handleOkFn">查询</el-button>
<el-button size="small" @click="handleRestFn">重置</el-button> <el-button size="small" @click="handleRestFn">重置</el-button>
<el-button type="text" size="small" @click="expandFn" v-if="hasExpand"> <el-button type="text" size="small" class="gl-padding0" @click="expandFn" v-if="hasExpand">
<span>{{ !expand ? '展开' : '收起' }}</span> <span>{{ !expand ? '展开' : '收起' }}</span>
<i class="expand" :class="classIcon"></i> <i class="expand" :class="classIcon"></i>
</el-button> </el-button>
...@@ -247,17 +247,17 @@ export default { ...@@ -247,17 +247,17 @@ export default {
const clientWidth = window.innerWidth const clientWidth = window.innerWidth
if (clientWidth <= 1062) { if (clientWidth <= 1062) {
// 1个1行
this.hasExpand = this.ifHasExpand(1)
} else if (clientWidth <= 1440 && clientWidth > 1062) {
// 2个1行 // 2个1行
this.hasExpand = this.ifHasExpand(2) this.hasExpand = this.ifHasExpand(2)
} else if (clientWidth <= 1720 && clientWidth > 1440) { } else if (clientWidth <= 1440 && clientWidth > 1062) {
// 3个1行 // 3个1行
this.hasExpand = this.ifHasExpand(3) this.hasExpand = this.ifHasExpand(3)
} else { } else if (clientWidth <= 1720 && clientWidth > 1440) {
// 4个1行 // 4个1行
this.hasExpand = this.ifHasExpand(4) this.hasExpand = this.ifHasExpand(4)
} else {
// 5个1行
this.hasExpand = this.ifHasExpand(5)
} }
}, 100) }, 100)
}, },
...@@ -310,7 +310,7 @@ export default { ...@@ -310,7 +310,7 @@ export default {
} */ } */
@media screen and (max-width: 1062px) { @media screen and (max-width: 1062px) {
.glsx-combi-form .el-form-item--small { .glsx-combi-form .el-form-item--small {
width: 100%; width: 50%;
} }
.glsx-combi-form .el-form-item--small .el-form-item__content { .glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%; width: 100%;
...@@ -321,7 +321,7 @@ export default { ...@@ -321,7 +321,7 @@ export default {
} }
@media screen and (min-width: 1062px) and (max-width: 1440px) { @media screen and (min-width: 1062px) and (max-width: 1440px) {
.glsx-combi-form .el-form-item--small { .glsx-combi-form .el-form-item--small {
width: 50%; width: 33.33%;
} }
.glsx-combi-form .el-form-item--small .el-form-item__content { .glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%; width: 100%;
...@@ -332,7 +332,7 @@ export default { ...@@ -332,7 +332,7 @@ export default {
} }
@media screen and (min-width: 1440px) and (max-width: 1720px) { @media screen and (min-width: 1440px) and (max-width: 1720px) {
.glsx-combi-form .el-form-item--small { .glsx-combi-form .el-form-item--small {
width: 33.33%; width: 25%;
} }
.glsx-combi-form .el-form-item--small .el-form-item__content { .glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%; width: 100%;
...@@ -343,7 +343,7 @@ export default { ...@@ -343,7 +343,7 @@ export default {
} }
@media screen and (min-width: 1720px) { @media screen and (min-width: 1720px) {
.glsx-combi-form .el-form-item--small { .glsx-combi-form .el-form-item--small {
width: 25%; width: 20%;
} }
.glsx-combi-form .el-form-item--small .el-form-item__content { .glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%; width: 100%;
......
...@@ -202,7 +202,6 @@ export default { ...@@ -202,7 +202,6 @@ export default {
.operate { .operate {
text-align: left; text-align: left;
width: 190px; width: 190px;
margin-bottom: 20px;
.expand { .expand {
font-size: 14px; font-size: 14px;
} }
......
<!-- <content> --> <!-- <content> -->
# GLTableButton
<GLTable ref="liveRoomRef" :tableParams="tableParams" :tableData="tableData"> <GLTable ref="liveRoomRef" :tableParams="tableParams" :tableData="tableData">
<span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope"> <span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope">
...@@ -207,7 +208,7 @@ ...@@ -207,7 +208,7 @@
} }
``` ```
# 用来作为 markdown 代码的示例部分 <!-- # 用来作为 markdown 代码的示例部分 -->
<div v-if="demo1"> <div v-if="demo1">
......
<script> <script>
import { hasPermission } from '../../Button' import { hasPermission } from '../../Button'
import { objectType } from '../../../utils/index' import { objectType } from '../../../utils/index'
import { utils } from 'glsx-common'
export default { export default {
name: 'GLTableButton', name: 'GLTableButton',
props: { props: {
...@@ -20,29 +21,6 @@ export default { ...@@ -20,29 +21,6 @@ export default {
default: 3 default: 3
} }
}, },
data() {
return {
// buttonList: [
// {
// type: 'el-button',
// name: '编辑',
// condition: row => {
// console.log('row: ', row)
// return false
// },
// attrs: {
// type: 'text'
// },
// listeners: {
// click: this.conditionFn
// }
// }
// ]
}
},
mounted() {
// console.log(hasPermission.call(this, '1-1-1-1'))
},
render() { render() {
/** /**
* 创建el button 实例 * 创建el button 实例
...@@ -55,9 +33,7 @@ export default { ...@@ -55,9 +33,7 @@ export default {
onClick={() => { onClick={() => {
component.listeners.click(this.buttonItem, component) component.listeners.click(this.buttonItem, component)
}} }}
domPropsInnerHTML={component.name ? (objectType(component.name) == 'String' ? component.name : component.name(this.buttonItem)) : ''}> domPropsInnerHTML={component.name ? (objectType(component.name) == 'String' ? component.name : component.name(this.buttonItem)) : ''}></el-button>
// {component.name}
</el-button>
) )
} }
/** /**
...@@ -71,9 +47,7 @@ export default { ...@@ -71,9 +47,7 @@ export default {
onClick={() => { onClick={() => {
component.listeners.click(this.buttonItem, component) component.listeners.click(this.buttonItem, component)
}} }}
domPropsInnerHTML={component.name ? (objectType(component.name) == 'String' ? component.name : component.name(this.buttonItem)) : ''}> domPropsInnerHTML={component.name ? (objectType(component.name) == 'String' ? component.name : component.name(this.buttonItem)) : ''}></GLButton>
// {component.name}
</GLButton>
) )
} }
/** /**
...@@ -104,6 +78,17 @@ export default { ...@@ -104,6 +78,17 @@ export default {
// //1.筛选过滤条件 // //1.筛选过滤条件
const componentList = this.buttonList const componentList = this.buttonList
.map(item => { .map(item => {
//处理attrs中属性为函数情况
item = utils.deepClone(item)
let attrKeys = item.attrs ? Object.keys(item.attrs) : []
if (attrKeys.length > 0) {
for (let key of attrKeys) {
if (objectType(item.attrs[key]) === 'Function') {
item.attrs[key] = item.attrs[key](this.buttonItem, item)
}
}
}
//不传条件,默认显示 //不传条件,默认显示
if (!item.condition) { if (!item.condition) {
return item return item
...@@ -125,8 +110,8 @@ export default { ...@@ -125,8 +110,8 @@ export default {
} else if (item.type == 'GLButton') { } else if (item.type == 'GLButton') {
status = item.condition(this.buttonItem, item) && hasPermission.call(this, item.attrs.fn) status = item.condition(this.buttonItem, item) && hasPermission.call(this, item.attrs.fn)
} }
//处理disabled情况(函数或者boolean) // //处理disabled情况(函数或者boolean)
item.attrs.disabled = item.attrs.disabled ? (objectType(item.attrs.disabled) === 'Function' ? item.attrs.disabled(this.buttonItem, item) : item.attrs.disabled) : false // item.attrs.disabled = item.attrs.disabled ? (objectType(item.attrs.disabled) === 'Function' ? item.attrs.disabled(this.buttonItem, item) : item.attrs.disabled) : false
if (status) { if (status) {
return item return item
...@@ -151,7 +136,9 @@ export default { ...@@ -151,7 +136,9 @@ export default {
selectComp = ( selectComp = (
<el-dropdown class="gl-dropdown"> <el-dropdown class="gl-dropdown">
<span class="el-dropdown-link">更多</span> <span class="el-dropdown-link">更多</span>
<el-dropdown-menu slot="dropdown">{postButtons.map(item => handleVNode(item, true))}</el-dropdown-menu> <el-dropdown-menu slot="dropdown" class="gl-dropdown-menu__item">
{postButtons.map(item => handleVNode(item, true))}
</el-dropdown-menu>
</el-dropdown> </el-dropdown>
) )
} else { } else {
...@@ -179,5 +166,20 @@ export default { ...@@ -179,5 +166,20 @@ export default {
margin-left: 10px; margin-left: 10px;
color: $color-primary; color: $color-primary;
} }
.el-button + .el-button {
margin-left: 10px;
}
}
.gl-dropdown-menu__item {
.el-dropdown-menu__item {
padding: 0;
.el-button--text {
// background: red;
width: 100%;
height: 36px;
display: inline-block;
padding: 0 20px;
}
}
} }
</style> </style>
## 首页
​
欢迎使用glsx-components组件库。
​
> npm install glsx-components --save
​
<!-- ---
​
1. 有序1
2. 有序2 -->
\ No newline at end of file \ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<script> <script>
export default { export default {
name: 'Popover', name: 'GLPopover',
props: { props: {
// props的种类参考el-popover // props的种类参考el-popover
demoProps: { demoProps: {
......
<template>
<div class="glsx-table">
<el-table id="initTable" v-bind="$attrs" v-on="$listeners" :key="componentKey" :ref="tableParams.mutiSelectName + 'MutiTable' || 'MutiTable'" :data="getListApi ? data : tableData" :row-class-name="tableParams.rowClassName" :row-style="tableParams.rowStyle" :row-key="tableParams.mutiSelectUniqueKey || ''" v-loading="loading" :height="tableHeightValues" :border="border" :tableId="tableId" @sort-change="sortChange" @selection-change="handleSelect" :size="size" :header-cell-style="headerStyle" :show-summary="tableParams.showSummary" :summary-method="tableParams.summaryMethod">
<el-table-column v-if="tableParams.mutiSelectUniqueKey && tableParams.mutiSelectName" type="selection" width="55" :selectable="checkSelectable" :reserve-selection="true"></el-table-column>
<el-table-column v-if="hasNum" align="center" width="60px" label="序号" type="index" :index="index => index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1"></el-table-column>
<el-table-column v-for="(item, index) in tableColumns" :key="index" :label="item.label" :prop="item.prop" :width="item.width" :min-width="item.minWidth" :fixed="item.fixed" :align="item.align || 'center'" :sortable="item.sortable" :render-header="item.renderHeader">
<template slot-scope="scope">
<slot v-if="item.addHtml" :name="item.addHtml" :scope="scope.row" :prop="item.prop" :width="item.width"></slot>
<template v-else-if="item.formatter">
<span class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" :title="item.formatter(scope.row)" v-text="item.formatter(scope.row)"></span>
</template>
<template v-else-if="getListApi">
<span class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" :title="scope.row[item.prop]" v-text="scope.row[item.prop]"></span>
</template>
<!-- <template v-else-if="item.labelchildren">
<el-table-column v-for="(labelitem, labelindex) in tableColumns.labelchildren" :key="'labelindex'+labelindex">
<span>123456</span>
</el-table-column> -->
<!-- <span class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" :title="tableData[scope.$index][item.prop]" v-text="tableData[scope.$index][item.prop]"></span> -->
<!-- </template> -->
<template v-else>
<!-- 大于10或 20个字节长度 -->
<el-popover v-if="tableData[scope.$index][item.prop] && tableData[scope.$index][item.prop].length >= 10 * item.line" placement="top" title="标题" width="200" trigger="click" :content="tableData[scope.$index][item.prop]">
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" v-text="tableData[scope.$index][item.prop]"></span>
</el-popover>
<span v-else class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" v-text="tableData[scope.$index][item.prop]"></span>
</template>
<template v-if="item.addSymbol">
<span v-text="item.addSymbol"></span>
</template>
</template>
<!-- 递归 -->
<sub-el-table-column v-if="item.children" :data="item.children"></sub-el-table-column>
</el-table-column>
<el-table-column v-if="tableParams.tableOption" label="操作" :align="tableParams.tableOption.align || 'center'" :width="tableParams.tableOption.width || '200'" fixed="right">
<template slot-scope="scope">
<slot name="auth-button" :scope="scope.row"></slot>
</template>
</el-table-column>
<template slot="empty" class="emptyBg">
<img class="noDataImg" :src="noDataImg" v-if="noDataImg" alt="" />
<div>{{ noDataText }}</div>
<slot name="additionalContent"></slot>
</template>
</el-table>
<el-pagination v-if="hasPage" background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page[this.pageConf.pageNum]" :page-sizes="[10, 20, 30, 40]" :page-size="page[this.pageConf.pageSize]" :total="getListApi ? total : tableTotal" :layout="layout"></el-pagination>
</div>
</template>
<script>
import SubElTableColumn from './sub-el-table-column.vue'
// import { Table, TableColumn, Pagination } from 'element-ui'
import { Table } from 'element-ui'
// 解决 ElTable 自动宽度高度导致的「ResizeObserver loop limit exceeded」问题
const fixElTableErr = table => {
const oldResizeListener = table.methods.resizeListener
table.methods.resizeListener = function () {
window.requestAnimationFrame(oldResizeListener.bind(this))
}
}
fixElTableErr(Table)
export default {
name: 'GLTable',
components: {
[Table.name]: Table,
// [TableColumn.name]: TableColumn,
// [Pagination.name]: Pagination,
SubElTableColumn
},
props: {
size: {
type: String,
default: 'medium'
},
height: {
type: String,
default: ''
},
// maxHeight:{
// type:String,
// default:'3000'
// },
noDataImg: {
type: String,
default: ''
},
noDataText: {
type: String,
default: '暂无数据'
},
border: {
type: Boolean,
default: false
},
headerStyle: {
type: Object,
default: () => {}
},
//表格需要多传入一个id的情况
tableId: {
type: String,
default: ''
},
// 搜索条件
searchForm: {
type: Object,
default: () => {}
},
// 是否定制表头
isCustomHead: {
type: Boolean,
default: false
},
// 表头展示
customHeadShowList: {
type: Array,
default: () => []
},
// 表格数据-外部传入
tableData: {
type: Array,
default: () => []
},
tableTotal: {
type: Number,
default: 0
},
// 获取列表接口
getListApi: {
type: Function,
default: null
},
// 搜索前操作
beforeSearchFn: {
type: Function,
default: () => {
return new Promise((resolve, reject) => {
resolve()
})
}
},
// 分页,默认有
hasPage: {
type: Boolean,
default: true
},
pageConf: {
type: Object,
default: () => ({
pageSize: 'pageSize',
pageNum: 'pageNum',
totalCount: 'totalCount'
})
},
// 分页组件配置
layout: {
type: String,
default: 'sizes,total,->,prev,pager,next,jumper'
},
// 序号,默认有
hasNum: {
type: Boolean,
default: true
},
tableParams: {
type: Object,
default: () => {
return {
// 多选-判断来自哪个页面
// mutiSelectName: {
// type: String,
// default: ''
// },
// 多选-唯一标识-行数据的key
// mutiSelectUniqueKey: {
// type: String,
// default: ''
// },
// 设置禁止选中的行数据
checkSelectKey: {
type: String,
default: ''
},
// 设置禁止选中的值
checkSelectVal: {
type: Array,
default: () => []
},
// 后端返回列表参数名
listName: {
type: String,
default: ''
},
// 表格操作,默认没有
// tableOption: {
// type: Object,
// default: null
// },
// 表格栏
tableColumns: {
type: Array,
default: () => []
}
}
}
}
},
data() {
return {
loading: false,
data: [],
// 页码
page: {},
total: 10,
// 多选数组
mutiSelectArr: {},
tableColumns: [],
showClass: false,
tableHeightValues: null,
bAntiShike:false, //防抖
componentKey:Date.now(), //用于更新组件
}
},
watch: {
customHeadShowList(val) {
this.isCustomHead && this.findShowHeadCol()
}
// data: {
// immediate: true,
// handler(val) {
// this.showClass = val.length > 0 ? true : false
// },
// deep: true
// }
},
methods: {
findShowHeadCol() {
this.tableColumns = []
this.tableParams.tableColumns.forEach(item => {
let isCustomCol = item.hasOwnProperty('isCustomCol')
if (!isCustomCol || (isCustomCol && this.customHeadShowList.includes(item.label))) {
this.tableColumns.push(item)
}
})
},
// 设置禁止选中的行数据
checkSelectable(row) {
if (this.tableParams.checkSelectKey && this.tableParams.checkSelectVal.length > 0) {
return this.tableParams.checkSelectVal.indexOf(row[this.tableParams.checkSelectKey]) == -1
} else {
return true
}
},
// 排序
sortChange({ column, prop, order }) {
this.$emit('sortChange', { column, prop, order })
},
// 多选
handleSelect(val) {
this.mutiSelectArr[this.tableParams.mutiSelectName] = val
this.$emit('selectionTable', val)
},
// 清空多选
clearMutiSelect() {
this.mutiSelectArr[this.tableParams.mutiSelectName] = []
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection()
},
//设置表格高度
setTableHeightFun(navHeight = 0) {
//navHeight 传值底部高度
var baseNavEle = document.querySelector('.scrm-base-nav')
var baseSubNavEle = document.querySelector('.scrm-base-sub-nav')
var baseNavEleHeight = baseNavEle ? baseNavEle.clientHeight : 0
var baseSubNavEleHeight = baseSubNavEle ? baseSubNavEle.clientHeight : 0
let paginationHeight
if (document.querySelector('.el-pagination')) {
paginationHeight = document.querySelector('.el-pagination').clientHeight + 20
} else {
paginationHeight = 0
}
let offsettop = document.getElementById('initTable').offsetTop
let clientHeight = document.documentElement.clientHeight
// document.getElementById('initTable').style.height = clientHeight - offsettop - paginationHeight - navHeight + 'px'
// document.querySelector('.el-table__empty-block').style.height=(clientHeight - offsettop - paginationHeight - navHeight)+'px';
this.tableHeightValues = clientHeight - offsettop - paginationHeight - baseNavEleHeight - baseSubNavEleHeight - 10 - 30 - 20 + 'px'
},
refreshTable(isResetPageNum = true, isClearMuti = true) {
this.beforeSearchFn().then(res => {
// 清空多选
isClearMuti && this.clearMutiSelect()
this.loading = true
isResetPageNum && (this.page[this.pageConf.pageNum] = 1)
var params = {
...this.page,
...this.searchForm
}
if (this.tableId) {
params.id = this.tableId
}
this.getListApi(params)
.then(res => {
this.data = this.findVal(res, this.tableParams.listName)
this.total = this.findVal(res, this.pageConf.totalCount)
this.loading = false
this.$nextTick(() => {
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].doLayout()
})
this.$emit('setTableFinishFun', this.data) //表格请求到数据
})
.catch(() => {
this.loading = false
})
})
},
// 找返回值
findVal(res, rankStr) {
var rankList = rankStr.split('.')
if (!rankStr) {
return res
}
return this.findVal(res[rankList[0]], rankList.splice(1).join('.'))
},
// 每页条数
handleSizeChange(value) {
let offsettop = document.getElementById('initTable').offsetTop
this.page[this.pageConf.pageSize] = value
this.getListApi ? this.refreshTable(false, false) : this.$emit('refreshTable', this.page)
},
// 页码
handleCurrentChange(value) {
this.page[this.pageConf.pageNum] = value
this.getListApi ? this.refreshTable(false, false) : this.$emit('refreshTable', this.page)
}
},
mounted() {
this.isCustomHead ? this.findShowHeadCol() : (this.tableColumns = this.tableParams.tableColumns)
this.page = {}
this.page[this.pageConf.pageSize] = 10
this.page[this.pageConf.pageNum] = 1
this.getListApi && this.refreshTable()
// 注册事件 -- 防抖
window.onresize = () => {
if (!this.bAntiShike) {
this.bAntiShike = true
setTimeout(() => {
// console.log('组件跟新时间')
this.bAntiShike = false
this.componentKey = Date.now()
}, 300)
}
}
},
beforeDestroy () {
// 事件注销
window.onresize = null
}
}
</script>
<style>
.a-click {
cursor: pointer;
}
.el-table .cell {
line-height: 14px;
}
.glsx-table p {
margin: 10px 0;
}
.glsx-table .line-ellipsis {
display: -webkit-box;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
/* -webkit-line-clamp: 2; */
-webkit-box-orient: vertical;
}
.el-table-column--selection .cell {
padding-left: 14px !important;
padding-right: 14px !important;
}
.glsx-table .emptyBg {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
}
.el-table__body-wrapper::-webkit-scrollbar {
width: 8px;
height: 8px;
/* display: none; */
}
/*正常情况下滑块的样式*/
.el-table__body-wrapper::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.05);
border-radius: 8px;
box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.1);
}
/*鼠标悬浮在该类指向的控件上时滑块的样式*/
.el-table__body-wrapper::-webkit-scrollbar-thumb {
/* background-color: rgba(0, 0, 0, 0.2); */
background: #e9e8ff;
border-radius: 8px;
box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.1);
}
/*鼠标悬浮在滑块上时滑块的样式*/
/* &::-webkit-scrollbar-thumb:hover {
background-color: rgba(0, 0, 0, 0.4);
box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.1);
} */
/*正常时候的主干部分*/
.el-table__body-wrapper::-webkit-scrollbar-track {
border-radius: 8px;
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
background-color: white;
}
/*鼠标悬浮在滚动条上的主干部分*/
/* .el-table__body-wrapper::-webkit-scrollbar-track:hover {
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
background-color: rgba(0, 0, 0, 0.01);
} */
/* .hasTableContent .el-table__body{
height: 100%;
} */
/* .hasTableContent .el-table__body-wrapper{
height: 100%;
} */
/* 样式新增光亮tr */
/* .el-table */
.el-table .el-table__body tr.hover-row {
position: relative;
/* z-index: 100; */
box-shadow: 0px 3px 10px 0px rgba(60, 58, 96, 0.3), 0px 1px 0px 0px rgba(255, 255, 255, 0.85);
}
.el-table .el-table__body tr.hover-row > td.el-table__cell {
background-color: #f4f4fc;
}
.el-table .el-table__body tr.hover-row::after {
position: absolute;
top: 0;
left: 0;
display: inline-block;
content: '';
width: 5px;
height: 100%;
background-color: #5850ff;
}
/* 样式新增光亮tr */
</style>
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<!-- 递归 --> <!-- 递归 -->
<sub-el-table-column v-if="item.children" :data="item.children" :tableData="tableData" :getListApi="getListApi"></sub-el-table-column> <sub-el-table-column v-if="item.children" :data="item.children" :tableData="tableData" :getListApi="getListApi"></sub-el-table-column>
</el-table-column> </el-table-column>
<el-table-column v-if="tableParams.tableOption" label="操作" :align="tableParams.tableOption.align || 'left'" :width="tableParams.tableOption.width || '200'" fixed="right"> <el-table-column v-if="tableParams.tableOption" label="操作" :align="tableParams.tableOption.align || 'left'" :width="tableParams.tableOption.width || '200'" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -76,14 +77,14 @@ ...@@ -76,14 +77,14 @@
<script> <script>
import noDataImgUrl from '@/assets/empty.png' import noDataImgUrl from '@/assets/empty.png'
import SubElTableColumn from './sub-el-table-column.vue' import SubElTableColumn from './sub-el-table-column.vue'
import GlSubTableColumn from '../../GlSubTableColumn' // import GlSubTableColumn from '../../GlSubTableColumn'
import GlSubTable from '../../GlSubTable' // import GlSubTable from '../../GlSubTable'
export default { export default {
name: 'GLTable', name: 'GLTable',
components: { components: {
SubElTableColumn, SubElTableColumn,
GlSubTableColumn, // GlSubTableColumn,
GlSubTable // GlSubTable
}, },
props: { props: {
// `medium` / `small` / `mini` // `medium` / `small` / `mini`
......
<template>
<div class="sub-el-table-column">
<el-table-column v-for="(item, index) in reverseData" :key="index" :label="item.label" :prop="item.prop" :width="item.width" :min-width="item.minWidth" :fixed="item.fixed" :align="item.align || 'center'" :sortable="item.sortable" :render-header="item.renderHeader">
<template slot-scope="scope">
<slot v-if="item.addHtml" :name="item.addHtml" :scope="scope.row" :prop="item.prop" :width="item.width"></slot>
<template v-else-if="item.formatter">
<span class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" :title="item.formatter(scope.row)" v-text="item.formatter(scope.row)"></span>
</template>
<template v-else-if="getListApi">
<span class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" :title="scope.row[item.prop]" v-text="scope.row[item.prop]"></span>
</template>
<!-- <template v-else-if="item.labelchildren">
<el-table-column v-for="(labelitem, labelindex) in tableColumns.labelchildren" :key="'labelindex'+labelindex">
<span>123456</span>
</el-table-column> -->
<!-- <span class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" :title="tableData[scope.$index][item.prop]" v-text="tableData[scope.$index][item.prop]"></span> -->
<!-- </template> -->
<template v-else>
<!-- 大于10或 20个字节长度 -->
<el-popover v-if="tableData[scope.$index][item.prop] && tableData[scope.$index][item.prop].length >= 10 * item.line" placement="top" title="标题" width="200" trigger="click" :content="tableData[scope.$index][item.prop]">
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" v-text="tableData[scope.$index][item.prop]"></span>
</el-popover>
<span v-else class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" v-text="tableData[scope.$index][item.prop]"></span>
</template>
<template v-if="item.addSymbol">
<span v-text="item.addSymbol"></span>
</template>
</template>
<!-- 递归 -->
<sub-el-table-column v-if="item.children" :data="item.children"></sub-el-table-column>
</el-table-column>
</div>
</template>
<script>
export default {
name: 'sub-el-table-column',
props: {
data: {
type: Array,
default: () => []
}
},
computed: {
reverseData() {
return [...this.data].reverse()
}
}
// created(){
// // console.log('data',this.data)
// }
}
</script>
<style lang="scss">
// .sub-el-table-column {
// }
</style>
\ No newline at end of file \ No newline at end of file
...@@ -48,12 +48,14 @@ ...@@ -48,12 +48,14 @@
<!-- 递归 --> <!-- 递归 -->
<sub-el-table-column v-if="item.children" :data="item.children" :tableData="tableData" :getListApi="getListApi"></sub-el-table-column> <sub-el-table-column v-if="item.children" :data="item.children" :tableData="tableData" :getListApi="getListApi"></sub-el-table-column>
</el-table-column> </el-table-column>
</div> </div>
</template> </template>
<script> <script>
import GlSubTableColumn from '../../GlSubTableColumn' // import GlSubTableColumn from '../../GlSubTableColumn'
export default { export default {
name: 'sub-el-table-column', name: 'sub-el-table-column',
props: { props: {
...@@ -80,9 +82,9 @@ export default { ...@@ -80,9 +82,9 @@ export default {
return arr return arr
} }
}, },
components: { // components: {
GlSubTableColumn // GlSubTableColumn
} // }
// created(){ // created(){
// // console.log('data',this.data) // // console.log('data',this.data)
// } // }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
</template> </template>
<script> <script>
// @group GroupA
export default { export default {
name:'TestComp', name:'TestComp',
props:{ props:{
......
...@@ -3,31 +3,40 @@ ...@@ -3,31 +3,40 @@
*/ */
// 导入颜色选择器组件 // 导入颜色选择器组件
// import '@/plugins/element.js' // import '@/plugins/element.js'
import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu } from '@/plugins/element.js' import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox } from '@/plugins/element.js'
import '@/theme/theme.scss' import '@/theme/theme.scss'
// 一次性注册所有的过滤器 本地测试 // 一次性注册所有的过滤器 本地测试
import filters from '@/filters' import filters from '@/filters'
// test 组件 // 导入基础组件
import TestComp from './TestComp' import TestComp from './TestComp'
import GLExternal from './External' import GLExternal from './External'
import GLButton from './Button' import GLButton from './Button'
import GLDialog from './Dialog' import GLDialog from './GLDialog'
import GLTable from './Table' import GLTable from './Table'
import GLFooter from './Footer' import GLFooter from './Footer'
import GLSearch from './GlSearch' import GLSearch from './GlSearch'
import GLSearchItem from './GlSearchItem' import GLSearchItem from './GlSearchItem'
import GLCombiForm from './GlCombiForm' import GLCombiForm from './GlCombiForm'
import GLTableButton from './GlTableButton' import GLTableButton from './GlTableButton'
// 导入业务组件
import GLProvince from './GLProvince' import GLProvince from './GLProvince'
import GLFull from './GLFull'
import GLEditor from './Editor'
import GLBcTest from '@/bcPackages/GLBcTest'
//el原始组件 //el原始组件
const ElComponent = [Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu] const ElComponent = [Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox]
// 业务组件导入列表
const BcComponent = [GLBcTest]
// 存储组件列表 // 存储组件列表
const components = [TestComp, GLExternal, GLButton, GLDialog, GLTable, GLFooter, GLSearch, GLSearchItem, GLCombiForm, GLTableButton, GLProvince].concat(ElComponent) const components = [TestComp, GLExternal, GLButton, GLDialog, GLTable, GLFooter, GLSearch, GLSearchItem, GLCombiForm, GLTableButton, GLProvince, GLFull, GLEditor].concat(ElComponent).concat(BcComponent)
// console.log('components: ', components); // console.log('components: ', components);
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册 // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
...@@ -39,17 +48,36 @@ const install = function (Vue) { ...@@ -39,17 +48,36 @@ const install = function (Vue) {
// 判断是否安装 // 判断是否安装
if (install.installed) return if (install.installed) return
// 遍历注册全局组件 // 遍历注册全局组件
components.map(component => Vue.component(component.name, component)) components.map(component => {
if (!component.name) return
Vue.component(component.name, component)
})
} }
// 判断是否是直接引入文件 // 判断是否是直接引入文件
if (typeof window !== 'undefined' && window.Vue) { if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue) install(window.Vue)
} }
/**
*
* @param {*} compArr 组件数组,将他们转化为obj导出
* @returns compObj {}
*/
const getNameComp = compArr => {
if (compArr.length === 0) return
let compObj = {}
compArr.forEach(item => {
compObj[item.name] = item
})
return compObj
}
export default { export default {
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装 // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
install, install,
...ElComponent, ...getNameComp(ElComponent),
// ...BcComponent,
// 基础组件
TestComp, TestComp,
GLExternal, GLExternal,
GLButton, GLButton,
...@@ -60,5 +88,9 @@ export default { ...@@ -60,5 +88,9 @@ export default {
GLSearchItem, GLSearchItem,
GLCombiForm, GLCombiForm,
GLTableButton, GLTableButton,
GLProvince //业务组件
GLProvince,
GLBcTest,
GLFull,
GLEditor
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
*/ */
import Vue from 'vue' import Vue from 'vue'
import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, Message, MessageBox } from 'element-ui' import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox } from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css' //todo 按需引入插件样式 // import 'element-ui/lib/theme-chalk/index.css' //todo 按需引入插件样式
import 'element-ui/lib/theme-chalk/table.css' import 'element-ui/lib/theme-chalk/table.css'
import 'element-ui/lib/theme-chalk/table-column.css' import 'element-ui/lib/theme-chalk/table-column.css'
...@@ -24,6 +24,8 @@ import 'element-ui/lib/theme-chalk/dropdown.css' ...@@ -24,6 +24,8 @@ import 'element-ui/lib/theme-chalk/dropdown.css'
import 'element-ui/lib/theme-chalk/dropdown-item.css' import 'element-ui/lib/theme-chalk/dropdown-item.css'
import 'element-ui/lib/theme-chalk/dropdown-menu.css' import 'element-ui/lib/theme-chalk/dropdown-menu.css'
import 'element-ui/lib/theme-chalk/dialog.css' import 'element-ui/lib/theme-chalk/dialog.css'
import 'element-ui/lib/theme-chalk/message.css'
import 'element-ui/lib/theme-chalk/message-box.css'
// 解决 ElTable 自动宽度高度导致的「ResizeObserver loop limit exceeded」问题 // 解决 ElTable 自动宽度高度导致的「ResizeObserver loop limit exceeded」问题
const fixElTableErr = table => { const fixElTableErr = table => {
...@@ -53,7 +55,8 @@ Vue.use(Dropdown) ...@@ -53,7 +55,8 @@ Vue.use(Dropdown)
Vue.use(DropdownItem) Vue.use(DropdownItem)
Vue.use(DropdownMenu) Vue.use(DropdownMenu)
Vue.use(Dialog) Vue.use(Dialog)
Vue.prototype.$message = Message // Vue.use(MessageBox)
Vue.prototype.$confirm = MessageBox.confirm
//打包后的组件dist 测试组件可能需要的 //打包后的组件dist 测试组件可能需要的
export { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, Message } export { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox }
/**
重置样式,公共样式
*/
.gl-padding0{
padding: 0 !important;
}
.gl-margin0{
margin: 0 !important;
}
\ No newline at end of file \ No newline at end of file
@import "utils.scss"; @import "utils.scss";
@import "global.scss"; @import "global.scss";
@import "reset.scss";
// $defaultColor: #5850ff; // $defaultColor: #5850ff;
// $lightColor: #7973ff; // $lightColor: #7973ff;
...@@ -8,6 +9,7 @@ ...@@ -8,6 +9,7 @@
$defaultColor: $color-primary; $defaultColor: $color-primary;
$lightColor: $color-primary-light07; $lightColor: $color-primary-light07;
$dackColor: $color-primary-dark30; $dackColor: $color-primary-dark30;
$lightColorDisabled: $color-primary-light04;
//滚动条的公共样式 //滚动条的公共样式
.scrollbar-common { .scrollbar-common {
...@@ -47,9 +49,10 @@ $dackColor: $color-primary-dark30; ...@@ -47,9 +49,10 @@ $dackColor: $color-primary-dark30;
/* 按钮 */ /* 按钮 */
.el-button { .el-button {
padding: 12px 20px; padding: 12px 23px;
font-size: 14px; font-size: 14px;
border-radius: 4px; border-radius: 4px;
min-width: 76px;
} }
.el-button:hover, .el-button:hover,
.el-button:focus { .el-button:focus {
...@@ -64,7 +67,7 @@ $dackColor: $color-primary-dark30; ...@@ -64,7 +67,7 @@ $dackColor: $color-primary-dark30;
} }
.el-button.is-round { .el-button.is-round {
padding: 12px 20px; padding: 12px 23px;
} }
.el-button--primary { .el-button--primary {
color: #fff; color: #fff;
...@@ -76,24 +79,89 @@ $dackColor: $color-primary-dark30; ...@@ -76,24 +79,89 @@ $dackColor: $color-primary-dark30;
background: $dackColor; background: $dackColor;
border-color: $dackColor; border-color: $dackColor;
} }
.el-button--primary:focus, .el-button--primary:focus {
color: #fff;
background-color: $defaultColor;
border-color: $defaultColor;
}
.el-button--primary:hover { .el-button--primary:hover {
background: $lightColor; background: $lightColor;
border-color: $lightColor; border-color: $lightColor;
color: #fff; color: #fff;
} }
.el-button--text {
color: $defaultColor;
padding: 0px;
min-width: 0 !important;
}
.el-button--text:focus, .el-button--text:focus,
.el-button--text:hover { .el-button--text:hover {
color: $lightColor; color: $lightColor;
border-color: transparent; border-color: transparent;
background-color: transparent; background-color: transparent;
} }
.el-button--text:active {
color: $dackColor;
}
.el-button.is-disabled.el-button--text, .el-button.is-disabled.el-button--text:focus, .el-button.is-disabled.el-button--text:hover{
// border-color: $lightColorDisabled;
color: $lightColorDisabled;
}
// 文字链接
.el-button--text.btn-link:hover,.el-button--text.btn-link:active{
text-decoration:underline;
}
.el-button.is-disabled.el-button--text.btn-link, .el-button.is-disabled.el-button--text.btn-link:focus, .el-button.is-disabled.el-button--text.btn-link:hover{
text-decoration:underline;
}
.el-button.is-plain:focus, .el-button.is-plain:focus,
.el-button.is-plain:hover { .el-button.is-plain:hover {
background: #fff; background: transparent;
border-color: $lightColor; border-color: $lightColor;
color: $lightColor; color: $lightColor;
} }
.el-button.is-plain{
border-color: $defaultColor;
color: $defaultColor;
background: transparent;
}
.el-button.is-plain:active {
border-color: $dackColor;
color: $dackColor;
}
.el-button.is-disabled.is-plain, .el-button.is-disabled.is-plain:focus, .el-button.is-disabled.is-plain:hover{
border-color: $lightColorDisabled;
color: $lightColorDisabled;
background-color:transparent;
}
// 三级按钮样式 以is-plain为基础
.el-button.is-plain.btn-three{
border-color: #C8C8C8;
color: #666;
&:focus,&:hover {
opacity: 0.7;
}
&:active{
opacity: 1;
border-color: #484848;
color: #484848;
}
&.is-disabled{
opacity: 0.4;
border-color: #666;
color: #666;
&:focus,&:hover{
opacity: 0.4;
border-color: #666;
color: #666;
}
}
}
.el-button--primary.is-active, .el-button--primary.is-active,
.el-button--primary:active { .el-button--primary:active {
background: $dackColor; background: $dackColor;
...@@ -103,25 +171,52 @@ $dackColor: $color-primary-dark30; ...@@ -103,25 +171,52 @@ $dackColor: $color-primary-dark30;
.el-button--primary.is-plain{ .el-button--primary.is-plain{
background: #fff; background: #fff;
} }
.el-select .el-input__inner:focus { .el-select .el-input__inner:focus {
border-color: $dackColor; border-color: $dackColor;
} }
.el-button--small { .el-button--small {
padding: 8px 16px; padding: 8px 15px;
font-size: 14px; font-size: 14px;
border-radius: 4px; border-radius: 4px;
min-width: 60px;
} }
.el-button--small.is-round { .el-button--small.is-round {
padding: 8px 16px; padding: 8px 15px;
} }
.el-button--mini { .el-button--mini {
padding: 5px 10px; padding: 4px 7px;
font-size: 14px; font-size: 14px;
border-radius: 4px; border-radius: 4px;
min-width: 44px;
} }
.el-button--mini.is-round { .el-button--mini.is-round {
padding: 5px 10px; padding: 4px 7px;
}
.el-button--primary.is-disabled,
.el-button--primary.is-disabled:active,
.el-button--primary.is-disabled:focus,
.el-button--primary.is-disabled:hover {
// background-color: #e9e9e9;
// border-color: #e9e9e9;
// color: #a3a3a3;
background-color: $lightColorDisabled;
border-color: $lightColorDisabled;
color: #fff;
} }
// 按钮间距
.el-button+.el-button{
margin-left: 20px;
}
.el-button--mini+.el-button--mini{
margin-left: 12px;
}
.gap8+.gap8{
margin-left: 8px;
}
.el-dialog__title { .el-dialog__title {
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
...@@ -173,10 +268,7 @@ $dackColor: $color-primary-dark30; ...@@ -173,10 +268,7 @@ $dackColor: $color-primary-dark30;
.el-select .el-input.is-focus .el-input__inner { .el-select .el-input.is-focus .el-input__inner {
border-color: $defaultColor; border-color: $defaultColor;
} }
.el-button--text {
color: $defaultColor;
padding: 0px;
}
.el-select-dropdown__item.selected { .el-select-dropdown__item.selected {
color: $defaultColor; color: $defaultColor;
font-weight: bold; font-weight: bold;
...@@ -418,14 +510,7 @@ $dackColor: $color-primary-dark30; ...@@ -418,14 +510,7 @@ $dackColor: $color-primary-dark30;
.el-message-box__headerbtn:hover .el-message-box__close { .el-message-box__headerbtn:hover .el-message-box__close {
color: $defaultColor; color: $defaultColor;
} }
.el-button--primary.is-disabled,
.el-button--primary.is-disabled:active,
.el-button--primary.is-disabled:focus,
.el-button--primary.is-disabled:hover {
background-color: #e9e9e9;
border-color: #e9e9e9;
color: #a3a3a3;
}
/*弹框*/ /*弹框*/
.el-dialog__header { .el-dialog__header {
border-bottom: 1px solid #e6e6e6; border-bottom: 1px solid #e6e6e6;
...@@ -448,7 +533,7 @@ $dackColor: $color-primary-dark30; ...@@ -448,7 +533,7 @@ $dackColor: $color-primary-dark30;
border-color: $defaultColor; border-color: $defaultColor;
} }
.el-dialog__title { .el-dialog__title {
height: 30px; height: 27px;
display: block; display: block;
} }
.el-table--enable-row-hover .el-table__body tr:hover { .el-table--enable-row-hover .el-table__body tr:hover {
...@@ -466,27 +551,69 @@ $dackColor: $color-primary-dark30; ...@@ -466,27 +551,69 @@ $dackColor: $color-primary-dark30;
background: #f4f4fc; background: #f4f4fc;
} }
.el-message-box .el-message-box__title, //message box 之前小弹窗
.el-message-box{
vertical-align: baseline;
width: 576px;
padding-bottom: 0px;
}
.el-message-box .el-message-box__title{
font-size: 20px;
height: 27px;
}
.el-message-box .el-message-box__header{
padding: 16px 20px;
border-bottom: 1px solid #e6e6e6;
}
.el-message-box .el-message-box__headerbtn { .el-message-box .el-message-box__headerbtn {
display: none; font-size: 24px;
} }
.el-message-box__content { .el-message-box__content {
text-align: center; text-align: center;
padding: 50px 0px 50px; padding: 20px;
height: 152px;
} }
.el-message-box__status.el-icon-warning { .el-message-box__status.el-icon-warning {
display: none; // display: none;
} }
.el-message-box__btns { .el-message-box__btns {
text-align: center; text-align: center;
padding: 20px 0px 10px; padding: 15px 20px 16px;
border-top: 1px solid #e6e6e6; border-top: 1px solid #e6e6e6;
} }
.el-message-box__btns button:nth-child(1) {
border-color: #C8C8C8;
color: #666;
background-color: #fff;
&:focus,&:hover {
opacity: 0.7;
}
&:active{
opacity: 1;
border-color: #484848;
color: #484848;
}
&.is-disabled{
opacity: 0.4;
border-color: #666;
color: #666;
&:focus,&:hover{
opacity: 0.4;
border-color: #666;
color: #666;
}
}
}
.el-message-box__btns button:nth-child(2) { .el-message-box__btns button:nth-child(2) {
margin-left: 40px; margin-left: 20px;
}
.el-message-box__status{
left: 50%;
font-size: 48px !important;
transform: translate3d(-50%,-50%,0);
} }
.el-message-box__status + .el-message-box__message { .el-message-box__status+.el-message-box__message{
padding: 0px 10px; padding-top: 95px;
} }
// 气泡相关的样式调整 // 气泡相关的样式调整
...@@ -517,3 +644,22 @@ $dackColor: $color-primary-dark30; ...@@ -517,3 +644,22 @@ $dackColor: $color-primary-dark30;
@extend .scrollbar-common; @extend .scrollbar-common;
} }
} }
// this.$confirm样式
.gl-message-box {
.el-message-box__title {
line-height: 27px;
}
.el-message-box__headerbtn {
height: 100%;
top: 0;
}
.el-message-box__message {
p {
line-height: 22px;
}
}
.el-message-box__status+.el-message-box__message {
padding-top: 112.5px;
}
}
const emoji = [
['微笑', '撇嘴', '色', '发呆', '得意', '流泪', '害羞', '闭嘴'],
['睡', '大哭', '尴尬', '发怒', '调皮', '呲牙', '惊讶', '难过'],
['酷', '囧', '抓狂', '吐', '微笑', '愉快', '白眼', '傲慢'],
['饥饿', '困', '惊恐', '流汗', '憨笑', '大兵', '奋斗', '咒骂'],
['疑问', '嘘', '晕', '折磨', '衰', '骷髅', '敲打', '再见'],
['擦汗', '抠鼻', '鼓掌', '糗大了', '坏笑', '左哼哼', '右哼哼', '哈欠'],
['鄙视', '委屈', '快哭了', '阴险', '亲亲', '吓', '可怜', '菜刀'],
['西瓜', '啤酒', '篮球', '乒乓', '咖啡', '饭', '猪头', '玫瑰'],
['凋谢', '示爱', '爱心', '心碎', '蛋糕', '闪电', '炸弹', '刀'],
['足球', '瓢虫', '便便', '月亮', '太阳', '礼物', '拥抱', '强'],
['弱', '握手', '胜利', '抱拳', '勾引', '拳头', '差劲', '爱你'],
['NO', 'OK', '爱情', '飞吻', '跳跳', '发抖', '怄火', '转圈'],
['磕头', '回头', '跳绳', '投降', '挥手', '激动', '街舞', '左太极'],
['右太极', '嘿哈', '捂脸', '奸笑', '机智', '皱眉', '耶', '社会社会'],
['让我看看', '666', '红包', '蜡烛', '烟花', '福', '庆祝', '爆竹']
]
export default emoji
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!