Commit 118e75d3 by xinlaa

素材接口,客户接口调试,配置更改等

1 parent df8c99af
# 开发环境配置
ENV = 'development'
# 若依管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'
# 塬微管理系统/开发环境
VUE_APP_BASE_API = 'http://106.13.201.219'
# VUE_APP_BASE_API = 'http://n3rpzt.natappfree.cc'
# 开发环境IP
VUE_APP_BASE_URL = 'http://192.168.0.101'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
# 生产环境配置
ENV = 'production'
# 若依管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
# 塬微管理系统/生产环境api
VUE_APP_BASE_API = 'http://106.13.201.219'
# 生产环境IP
VUE_APP_BASE_URL = 'http://106.13.201.219'
......@@ -5,7 +5,7 @@
"license": "MIT",
"scripts": {
"serve": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build": "vue-cli-service build",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src",
"test:unit": "jest --clearCache && vue-cli-service test:unit",
......@@ -35,7 +35,7 @@
],
"repository": {
"type": "git",
"url": "https://gitee.com/y_project/RuoYi-Vue.git"
"url": "https://gitee.com/LinkWeChat/link-wechat.git"
},
"dependencies": {
"@riophae/vue-treeselect": "0.4.0",
......@@ -55,6 +55,7 @@
"promise.prototype.finally": "^3.1.2",
"screenfull": "4.2.0",
"sortablejs": "1.8.4",
"video.js": "^7.10.2",
"vue": "2.6.10",
"vue-count-to": "1.0.13",
"vue-cropper": "0.4.9",
......@@ -103,4 +104,4 @@
"> 1%",
"last 2 versions"
]
}
}
\ No newline at end of file
......@@ -95,3 +95,13 @@ export function exportCustomer(query) {
params: query,
})
}
/**
*客户详情
* @param {*} externalUserid
*/
export function getDetail(externalUserid) {
return request({
url: service + '/getCustomersByUserId/' + externalUserid,
})
}
import request from '@/utils/request'
const service = window.CONFIG.CONFIG.services.wecom + '/group'
const service = window.CONFIG.services.wecom + '/group'
// 客户标签
......
......@@ -72,7 +72,7 @@ type:0 图片(image)、1 语音(voice)、2 视频(video),3 普通
*/
export function upload(data) {
return request({
url: window.CONFIG.services.wecom + '/upload',
url: service + '/upload',
method: 'post',
data,
})
......
<script>
import { upload } from '@/api/material'
import Video from 'video.js'
export default {
components: {},
props: {
......@@ -7,39 +8,49 @@ export default {
type: String,
default: '',
},
fileName: {
type: String,
default: '',
},
// 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file)
type: {
type: String,
default: '0',
},
beforeUpload: {
type: Function,
default: () => () => {},
},
// beforeUpload: {
// type: Function,
// default: function() {
// return function() {}
// },
// },
},
data() {
return {
loading: false,
action:
process.env.VUE_APP_BASE_API + window.CONFIG.services.wecom + '/upload',
process.env.VUE_APP_BASE_API +
window.CONFIG.services.wecom +
'/material/upload',
headers: window.CONFIG.headers,
}
},
watch: {},
computed: {
accept() {
return ['image/*', 'audio/*', 'video/*', '*'][this.type]
return ['image/*', '*', 'video/*', '*'][this.type]
},
},
created() {
upload()
},
created() {},
mounted() {},
methods: {
handleBeforeUpload(file) {
this.loading = true
let isFormat = true,
isSize = true
if (this.type === '0') {
// 图片
const isFormat = file.type === 'image/jpeg'
const isSize = file.size / 1024 / 1024 < 2
isFormat = file.type === 'image/jpeg'
isSize = file.size / 1024 / 1024 < 2
if (!isFormat) {
this.$message.error('上传文件只能是 JPG 格式!')
......@@ -47,11 +58,10 @@ export default {
if (!isSize) {
this.$message.error('上传文件大小不能超过 2MB!')
}
return isFormat && isSize
} else if (this.type === '1') {
// 语音
const isFormat = file.type === 'audio/amr'
const isSize = file.size / 1024 / 1024 < 2
isFormat = /.amr$/gi.test(file.name)
isSize = file.size / 1024 / 1024 < 2
if (!isFormat) {
this.$message.error('上传文件只能是 amr 格式!')
......@@ -59,11 +69,10 @@ export default {
if (!isSize) {
this.$message.error('上传文件大小不能超过 2MB!')
}
return isFormat && isSize
} else if (this.type === '2') {
// 视频
const isFormat = file.type === 'video/mp4'
const isSize = file.size / 1024 / 1024 < 10
isFormat = file.type === 'video/mp4'
isSize = file.size / 1024 / 1024 < 10
if (!isFormat) {
this.$message.error('上传文件只能是 mp4 格式!')
......@@ -71,20 +80,30 @@ export default {
if (!isSize) {
this.$message.error('上传文件大小不能超过 10MB!')
}
return isFormat && isSize
} else if (this.type === '3') {
// 普通文件
const isSize = file.size / 1024 / 1024 < 20
isSize = file.size / 1024 / 1024 < 20
if (!isSize) {
this.$message.error('上传文件大小不能超过 20MB!')
}
return isSize
}
return beforeUpload(file)
if (!isFormat || !isSize) {
this.loading = false
}
// if (beforeUpload) {
// return beforeUpload(file)
// }
return isFormat && isSize
},
onSuccess(res, file) {
this.fileUrl = URL.createObjectURL(file.raw)
if (res.code === 200) {
this.loading = false
this.$emit('update:fileUrl', res.data.materialUrl)
this.$emit('update:fileName', res.data.materialName)
// this.fileUrl = URL.createObjectURL(file.raw)
}
},
},
}
......@@ -93,16 +112,35 @@ export default {
<template>
<div>
<el-upload
v-loading="loading"
class="uploader"
:accept="accept"
:action="action"
:headers="headers"
:data="{ type: type }"
:data="{ mediaType: type }"
:show-file-list="false"
:on-success="onSuccess"
:before-upload="handleBeforeUpload"
>
<img v-if="fileUrl" :src="fileUrl" class="upload-img" />
<template v-if="fileUrl">
<img v-if="type === '0'" :src="fileUrl" class="upload-img" />
<div v-else-if="type === '2'">
<video
id="myVideo"
class="video-js vjs-default-skin
vjs-big-play-centered"
width="100%"
controls
webkit-playsinline="true"
playsinline="true"
autoplay="none"
preload="auto"
>
<source :src="fileUrl" type="video/mp4" />
</video>
</div>
<div v-else>{{ fileName }}</div>
</template>
<i v-else class="el-icon-plus uploader-icon"></i>
</el-upload>
<div class="tip">
......@@ -113,7 +151,6 @@ export default {
<style lang="scss" scoped>
/deep/.uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
......@@ -129,6 +166,8 @@ export default {
height: 178px;
line-height: 178px;
text-align: center;
border-radius: 6px;
border: 1px dashed #d9d9d9;
}
.upload-img {
width: 178px;
......
......@@ -14,6 +14,7 @@ Vue.use(Element, {
import '@/styles/common.scss' // common css
import '@/styles/index.scss' // global css
import 'video.js/dist/video-js.css'
import config from '@/config'
import App from './App'
......
......@@ -138,109 +138,142 @@ export const constantRoutes = [
// {
// path: 'staff',
// name: 'CodeStaff',
// component: (resolve) => require(['@/views/drainageCode/staff/list'], resolve),
// meta: { title: '员工活码', icon: '' }
// component: (resolve) =>
// require(['@/views/drainageCode/staff/list'], resolve),
// meta: { title: '员工活码', icon: '' },
// },
// {
// path: 'staffAdd',
// hidden: true,
// component: (resolve) => require(['@/views/drainageCode/staff/add'], resolve),
// meta: { title: '新建员工活码', icon: '', activeMenu: '/drainageCode/staff' }
// component: (resolve) =>
// require(['@/views/drainageCode/staff/add'], resolve),
// meta: {
// title: '新建员工活码',
// icon: '',
// activeMenu: '/drainageCode/staff',
// },
// },
// {
// path: 'staffDetail',
// hidden: true,
// component: (resolve) => require(['@/views/drainageCode/staff/detail'], resolve),
// meta: { title: '员工活码详情', icon: '', activeMenu: '/drainageCode/staff' }
// component: (resolve) =>
// require(['@/views/drainageCode/staff/detail'], resolve),
// meta: {
// title: '员工活码详情',
// icon: '',
// activeMenu: '/drainageCode/staff',
// },
// },
// {
// path: 'group',
// name: 'CodeGroup',
// component: (resolve) => require(['@/views/drainageCode/group/list'], resolve),
// meta: { title: '客户群活码', icon: '' }
// component: (resolve) =>
// require(['@/views/drainageCode/group/list'], resolve),
// meta: { title: '客户群活码', icon: '' },
// },
// {
// path: 'groupAdd',
// hidden: true,
// component: (resolve) => require(['@/views/drainageCode/group/add'], resolve),
// meta: { title: '新增客户群活码', icon: '', activeMenu: '/drainageCode/group' }
// component: (resolve) =>
// require(['@/views/drainageCode/group/add'], resolve),
// meta: {
// title: '新增客户群活码',
// icon: '',
// activeMenu: '/drainageCode/group',
// },
// },
// {
// path: 'groupDetail',
// hidden: true,
// component: (resolve) => require(['@/views/drainageCode/group/detail'], resolve),
// meta: { title: '客户群活码信息', icon: '', activeMenu: '/drainageCode/group' }
// component: (resolve) =>
// require(['@/views/drainageCode/group/detail'], resolve),
// meta: {
// title: '客户群活码信息',
// icon: '',
// activeMenu: '/drainageCode/group',
// },
// },
// {
// path: 'groupBaseInfo',
// hidden: true,
// component: (resolve) => require(['@/views/drainageCode/group/baseInfo'], resolve),
// meta: { title: '客户群活码', icon: '', activeMenu: '/drainageCode/group' }
// component: (resolve) =>
// require(['@/views/drainageCode/group/baseInfo'], resolve),
// meta: {
// title: '客户群活码',
// icon: '',
// activeMenu: '/drainageCode/group',
// },
// },
// {
// path: 'welcome',
// name: 'Welcome',
// component: (resolve) => require(['@/views/drainageCode/welcome/list'], resolve),
// meta: { title: '欢迎语', icon: '' }
// component: (resolve) =>
// require(['@/views/drainageCode/welcome/list'], resolve),
// meta: { title: '欢迎语', icon: '' },
// },
// {
// path: 'welcomeAdd',
// hidden: true,
// component: (resolve) => require(['@/views/drainageCode/welcome/add'], resolve),
// meta: { title: '新建欢迎语', icon: '', activeMenu: '/drainageCode/welcome' }
// component: (resolve) =>
// require(['@/views/drainageCode/welcome/add'], resolve),
// meta: {
// title: '新建欢迎语',
// icon: '',
// activeMenu: '/drainageCode/welcome',
// },
// },
// ]
// ],
// },
// {
// path: '/material',
// component: Layout,
// redirect: '/material/text',
// meta: { title: '素材中心', icon: 'material' },
// children: [
// {
// path: 'text',
// name: 'MaterialText',
// component: (resolve) => require(['@/views/material/text'], resolve),
// meta: { title: '文本', icon: '' },
// },
// {
// path: 'image',
// name: 'MaterialImage',
// component: (resolve) => require(['@/views/material/image'], resolve),
// meta: { title: '图片', icon: '' },
// },
// {
// path: 'web',
// name: 'MaterialWeb',
// component: (resolve) => require(['@/views/material/web'], resolve),
// meta: { title: '网页', icon: '' },
// },
// {
// path: 'audio',
// name: 'MaterialAudio',
// component: (resolve) => require(['@/views/material/audio'], resolve),
// meta: { title: '语音', icon: '' },
// },
// {
// path: 'video',
// name: 'MaterialVideo',
// component: (resolve) => require(['@/views/material/video'], resolve),
// meta: { title: '视频', icon: '' },
// },
// {
// path: 'file',
// name: 'MaterialFile',
// component: (resolve) => require(['@/views/material/file'], resolve),
// meta: { title: '文件', icon: '' },
// },
// {
// path: 'applet',
// name: 'MaterialApplet',
// component: (resolve) => require(['@/views/material/applet'], resolve),
// meta: { title: '小程序', icon: '' },
// },
// ],
// },
{
path: '/material',
component: Layout,
redirect: '/material/text',
meta: { title: '素材中心', icon: 'material' },
children: [
{
path: 'text',
name: 'MaterialText',
component: (resolve) => require(['@/views/material/text'], resolve),
meta: { title: '文本', icon: '' },
},
{
path: 'image',
name: 'MaterialImage',
component: (resolve) => require(['@/views/material/image'], resolve),
meta: { title: '图片', icon: '' },
},
{
path: 'web',
name: 'MaterialWeb',
component: (resolve) => require(['@/views/material/web'], resolve),
meta: { title: '网页', icon: '' },
},
{
path: 'audio',
name: 'MaterialAudio',
component: (resolve) => require(['@/views/material/audio'], resolve),
meta: { title: '语音', icon: '' },
},
{
path: 'video',
name: 'MaterialVideo',
component: (resolve) => require(['@/views/material/video'], resolve),
meta: { title: '视频', icon: '' },
},
{
path: 'file',
name: 'MaterialFile',
component: (resolve) => require(['@/views/material/file'], resolve),
meta: { title: '文件', icon: '' },
},
{
path: 'applet',
name: 'MaterialApplet',
component: (resolve) => require(['@/views/material/applet'], resolve),
meta: { title: '小程序', icon: '' },
},
],
},
// {
// path: '/appTool',
// component: Layout,
......
<script>
import * as api from "@/api/customer";
import { updateBirthday, getDetail } from '@/api/customer'
export default {
name: "CustomerDetail",
name: 'CustomerDetail',
data() {
return {
datePickerVisible: false,
customer: {
weFlowerCustomerRels: [],
},
birthday: "",
};
birthday: '',
}
},
created() {
this.customer = this.$route.query;
this.birthday = this.customer.birthday;
this.getDetail()
},
methods: {
updateBirthday() {
if (!this.birthday) {
return;
if (!this.birthday || this.birthday == this.customer.birthday) {
return
}
let data = {
externalUserid: this.customer.externalUserid,
birthday: this.birthday,
};
api.updateBirthday(data).then((response) => {
this.msgSuccess("操作成功");
// todo get info
this.datePickerVisible = false;
});
}
updateBirthday(data).then((response) => {
this.msgSuccess('操作成功')
this.getDetail()
this.datePickerVisible = false
})
},
getDetail() {
getDetail(this.$route.query.id).then(({ data }) => {
this.customer = data[0]
this.birthday = this.customer.birthday
})
},
},
};
}
</script>
<template>
......@@ -42,14 +47,20 @@ export default {
<el-avatar :size="100" :src="customer.avatar"></el-avatar>
<div class="info-wrap">
<div class="mb10">
{{customer.name}}
{{ customer.name }}
<span
:style="{color: customer.type == 1 ? '#4bde03' : '#f9a90b'}"
>{{ ({1: '@微信', 2: '@企业微信'})[customer.type] }}</span>
<i :class="['el-icon-s-custom', ({1: 'man', 2: 'woman'})[customer.gender]]"></i>
:style="{ color: customer.type == 1 ? '#4bde03' : '#f9a90b' }"
>{{ { 1: '@微信', 2: '@企业微信' }[customer.type] }}</span
>
<i
:class="[
'el-icon-s-custom',
{ 1: 'man', 2: 'woman' }[customer.gender],
]"
></i>
</div>
<div class="info">
出生日期:{{customer.birthday || '--'}}
出生日期:{{ customer.birthday || '--' }}
<div class="bfc-d ml20">
<el-date-picker
v-if="datePickerVisible"
......@@ -60,46 +71,61 @@ export default {
@blur="datePickerVisible = false"
@change="updateBirthday"
></el-date-picker>
<i v-else class="el-icon-edit" @click="datePickerVisible = true"></i>
<i
v-else
v-hasPermi="['customerManage:customer:edit']"
class="el-icon-edit"
@click="datePickerVisible = true"
></i>
</div>
</div>
</div>
</div>
<el-card shadow="never" :body-style="{width: '400px'}">
<el-card shadow="never" :body-style="{ width: '400px' }">
<div>
<el-row :gutter="10">
<el-col :span="10">备注名:</el-col>
<el-col :span="12">{{customer.name}}</el-col>
<el-col :span="12">{{ customer.name }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="10">标签:</el-col>
<el-col :span="12">
<div v-for="(item, index) in customer.weFlowerCustomerRels" :key="index">
<div
v-for="(item, index) in customer.weFlowerCustomerRels"
:key="index"
>
<el-tag
type="info"
v-for="(unit, unique) in item.weFlowerCustomerTagRels"
:key="unique"
>{{unit.tagName}}</el-tag>
>{{ unit.tagName }}</el-tag
>
</div>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="10">个人标签:</el-col>
<el-col :span="12">{{"--"}}</el-col>
<el-col :span="12">{{ '--' }}</el-col>
</el-row>
<el-divider></el-divider>
<el-row :gutter="10">
<el-col :span="10">添加人:</el-col>
<el-col :span="12">{{customer.weFlowerCustomerRels[0].userName}}</el-col>
<el-col :span="12">{{
customer.weFlowerCustomerRels[0].userName
}}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="10">所在部门:</el-col>
<el-col :span="12">{{customer.weFlowerCustomerRels[0].department}}</el-col>
<el-col :span="12">{{
customer.weFlowerCustomerRels[0].department
}}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="10">添加时间:</el-col>
<el-col :span="12">{{customer.weFlowerCustomerRels[0].createTime}}</el-col>
<el-col :span="12">{{
customer.weFlowerCustomerRels[0].createTime
}}</el-col>
</el-row>
</div>
</el-card>
......@@ -158,4 +184,4 @@ export default {
color: #f753b2;
}
}
</style>
\ No newline at end of file
</style>
<script>
import * as api from "@/api/customer/group";
import * as api from '@/api/customer/group'
export default {
name: "GroupDetail",
name: 'GroupDetail',
data() {
return {
// 遮罩层
......@@ -25,34 +25,34 @@ export default {
memberName: undefined,
},
joinScene: {
1: "由成员邀请入群(直接邀请入群)",
2: "由成员邀请入群(通过邀请链接入群)",
3: "通过扫描群二维码入群",
1: '由成员邀请入群(直接邀请入群)',
2: '由成员邀请入群(通过邀请链接入群)',
3: '通过扫描群二维码入群',
},
};
}
},
created() {
this.group = this.$route.query;
this.query.chatId = this.group.chatId;
this.getList();
this.group = this.$route.query
this.query.chatId = this.group.chatId
this.getList()
},
methods: {
getList(page) {
page && (this.query.pageNum = page);
this.loading = false;
page && (this.query.pageNum = page)
this.loading = false
api.getMembers(this.query).then((response) => {
this.list = response.rows;
this.total = +response.total;
this.loading = false;
});
this.list = response.rows
this.total = +response.total
this.loading = false
})
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.operId);
this.multiple = !selection.length;
this.ids = selection.map((item) => item.operId)
this.multiple = !selection.length
},
},
};
}
</script>
<template>
......@@ -64,16 +64,21 @@ export default {
src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png"
></el-avatar>
<div class="info-wrap">
<div style="margin-bottom: 20px;">{{group.groupName}}</div>
<div
class="info"
>群主:{{group.groupLeaderName}} | 创建时间:{{group.createTime}} | 群公告:{{group.notice || '未设置'}}</div>
<div style="margin-bottom: 20px;">{{ group.groupName }}</div>
<div class="info">
群主:{{ group.groupLeaderName }} | 创建时间:{{ group.createTime }} |
群公告:{{ group.notice || '未设置' }}
</div>
</div>
</div>
<el-input placeholder="请输入群成员" v-model="query.memberName" class>
<el-button slot="append" @click="getList(1)">查询</el-button>
</el-input>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="群成员" align="center" prop="memberName">
<template slot-scope="scope">
......@@ -84,7 +89,12 @@ export default {
<!-- <i :class="['el-icon-s-custom', ({1: 'man', 2: 'woman'})[scope.row.gender]]"></i> -->
</template>
</el-table-column>
<el-table-column label="进群时间" align="center" prop="joinTime" width="180"></el-table-column>
<el-table-column
label="进群时间"
align="center"
prop="joinTime"
width="180"
></el-table-column>
<el-table-column label="进群方式" align="center" prop="joinScene">
<template slot-scope="scope">
<span>{{ joinScene[scope.row.joinScene] }}</span>
......@@ -93,7 +103,7 @@ export default {
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
......@@ -133,4 +143,4 @@ export default {
color: #aaa;
}
}
</style>
\ No newline at end of file
</style>
......@@ -17,32 +17,24 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id) + ''
this.ids = selection.map((item) => item.id)
},
},
}
</script>
<template>
<MaPage ref="page" type="1" @listChange="listChange">
<MaPage ref="page" type="1" @listChange="listChange" :selected="ids">
<el-table :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="语音" align="center" prop="materialUrl" />
<el-table-column
label="时长"
align="center"
prop="userName"
:show-overflow-tooltip="true"
/>
<el-table-column label="语音" align="center" prop="materialName" />
<el-table-column label="时长" align="center" prop="audioTime" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="160"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
......
......@@ -62,14 +62,18 @@ export default {
emitPath: false,
},
typeTitle: ['图片', '语音', '视频', '普通文件', '文本'],
typeTitle: ['图片', '语音', '视频', '文件', '文本'],
form: {}, // 素材表单
fileUrl: '',
dialogVisible: false, // 素材表格对话框显隐
// 表单校验
rules: Object.freeze({
categoryId: [
{ required: true, message: '不能为空', trigger: 'change' },
],
content: [{ required: true, message: '不能为空', trigger: 'blur' }],
materialUrl: [{ required: true, message: '不能为空', trigger: 'blur' }],
materialUrl: [
{ required: true, message: '不能为空', trigger: 'change' },
],
materialName: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
......@@ -162,6 +166,7 @@ export default {
},
// 素材提交
submit() {
// this.$refs['form'].validateField
this.$refs['form'].validate((valid) => {
if (valid) {
let form = JSON.parse(JSON.stringify(this.form))
......@@ -179,7 +184,7 @@ export default {
},
// 素材删除
remove(id) {
const Ids = id || this.selected
const Ids = id || this.selected + ''
this.$confirm('是否确认删除吗?', '警告', {
type: 'warning',
})
......@@ -191,13 +196,18 @@ export default {
this.msgSuccess('删除成功')
})
},
// 移动分组
moveGroup() {
moveGroup(this.group, this.selected).then(() => {
moveGroup(this.group, this.selected + '').then(() => {
this.getList()
this.msgSuccess('操作成功')
this.groupDialogVisible = false
})
},
// 下载
download(data) {
window.open(data.materialUrl)
},
},
}
</script>
......@@ -207,7 +217,11 @@ export default {
<el-row :gutter="20">
<el-col :span="6" :xs="24">
<div>
<el-button slot="reference" type="primary" @click="treeEdit({}, 0)"
<el-button
v-hasPermi="['material:addType']"
slot="reference"
type="primary"
@click="treeEdit({}, 0)"
>添加分类</el-button
>
</div>
......@@ -226,20 +240,21 @@ export default {
<span>{{ node.label }}</span>
<span class="fr">
<i
v-hasPermi="['material:editType']"
class="el-icon-edit"
title="编辑"
@click.stop="treeEdit(data, 1)"
></i>
<i
v-hasPermi="['material:addType']"
class="el-icon-plus"
title="添加子分类"
v-hasPermi="['contacts:organization:addDep']"
@click.stop="treeEdit(data, 0)"
></i>
<i
v-hasPermi="['material:removeType']"
class="el-icon-minus"
title="删除"
v-hasPermi="['contacts:organization:removeDep']"
@click.stop="treeRemove(data.id)"
></i>
</span>
......@@ -264,7 +279,10 @@ export default {
style="width: 300px;"
/>
<el-button class="ml10" @click="getList(1)">搜索</el-button>
<el-button @click="remove" :disabled="selected.length === 0"
<el-button
v-hasPermi="['material:remove']"
@click="remove"
:disabled="selected.length === 0"
>删除</el-button
>
<el-popover placement="top" width="260" v-model="groupDialogVisible">
......@@ -285,6 +303,7 @@ export default {
>
</div>
<el-button
v-hasPermi="['material:edit']"
slot="reference"
class="ml10"
:disabled="selected.length === 0"
......@@ -293,7 +312,10 @@ export default {
</el-popover>
<div class="fr">
<el-button type="primary" @click="edit(1)"
<el-button
v-hasPermi="['material:add']"
type="primary"
@click="edit(1)"
>添加{{ typeTitle[type] }}</el-button
>
</div>
......@@ -347,7 +369,7 @@ export default {
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item :label="typeTitle[type] + '分类'">
<el-form-item label="分类" prop="categoryId">
<el-cascader
v-model="form.categoryId"
:options="treeData"
......@@ -364,32 +386,74 @@ export default {
></el-input>
</el-form-item>
<el-form-item label="图片" prop="materialUrl" v-else-if="type === '0'">
<upload :fileUrl.sync="form.fileUrl" :mediaType="type">
<div slot="tip">
支持JPG,PNG格式,图片大小不超过2M,建议上传宽高1:1的图片
</div>
</upload>
</el-form-item>
<template v-else-if="type === '0'">
<el-form-item label="文案" prop="content">
<el-input
v-model="form.content"
type="textarea"
:autosize="{ minRows: 2, maxRows: 50 }"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="图片" prop="materialUrl">
<upload
:fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName"
:type="type"
>
<div slot="tip">
支持JPG,PNG格式,图片大小不超过2M,建议上传宽高1:1的图片
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input
v-model="form.materialName"
placeholder="请输入"
></el-input>
</el-form-item>
</template>
<el-form-item label="语音" prop="materialUrl" v-else-if="type === '1'">
<upload :fileUrl.sync="form.fileUrl" :mediaType="type">
<div slot="tip">
只能上传amr格式的语音文件。单个文件大小不超过2M,时长不超过1分钟
</div>
</upload>
</el-form-item>
<template v-else-if="type === '1'">
<el-form-item label="语音" prop="materialUrl">
<upload
:fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName"
:type="type"
>
<div slot="tip">
只能上传amr格式的语音文件。单个文件大小不超过2M,时长不超过1分钟
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input
v-model="form.materialName"
placeholder="请输入"
></el-input>
</el-form-item>
</template>
<template v-else-if="type === '2'">
<el-form-item label="视频" prop="materialUrl">
<upload :fileUrl.sync="form.fileUrl" :mediaType="type">
<upload
:fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName"
:type="type"
>
<div slot="tip">
不超过10M, 文件格式: mp4
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input
v-model="form.materialName"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="封面">
<upload :fileUrl.sync="form.coverUrl" mediaType="0">
<upload :fileUrl.sync="form.coverUrl" type="0">
<div slot="tip">
建议尺寸:1068*455
</div>
......@@ -404,13 +468,25 @@ export default {
</el-form-item>
</template>
<el-form-item label="文件" prop="materialUrl" v-else-if="type === '3'">
<upload :fileUrl.sync="form.coverUrl" :mediaType="type">
<div slot="tip">
单个文件大小不超过20M
</div>
</upload>
</el-form-item>
<template v-else-if="type === '3'">
<el-form-item label="文件" prop="materialUrl">
<upload
:fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName"
:type="type"
>
<div slot="tip">
单个文件大小不超过20M
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input
v-model="form.materialName"
placeholder="请输入"
></el-input>
</el-form-item>
</template>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit">确 定</el-button>
......
......@@ -16,35 +16,25 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.userId)
this.single = selection.length != 1
this.multiple = !selection.length
this.ids = selection.map((item) => item.id)
},
},
}
</script>
<template>
<MaPage ref="page" type="4" @listChange="listChange">
<el-table :data="userList" @selection-change="handleSelectionChange">
<MaPage ref="page" type="3" @listChange="listChange" :selected="ids">
<el-table :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column
label="文件名"
align="center"
prop="materialUrl"
prop="materialName"
:show-overflow-tooltip="true"
/>
<el-table-column label="大小" align="center" prop="userName" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="160"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
<el-table-column label="创建时间" align="center" prop="createTime">
</el-table-column>
<el-table-column
label="操作"
......
......@@ -19,16 +19,12 @@ export default {
listChange(data) {
this.list = data
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.userId)
},
},
}
</script>
<template>
<MaPage ref="page" type="0" @listChange="listChange">
<MaPage ref="page" type="0" @listChange="listChange" :selected="ids">
<el-row :gutter="20">
<el-col
:span="6"
......@@ -58,7 +54,9 @@ export default {
</div>
</div>
<div style="padding: 14px;">
<el-checkbox v-model="ids">{{ item.name }}</el-checkbox>
<el-checkbox v-model="ids" :label="item.id">{{
item.materialName
}}</el-checkbox>
</div>
</el-card>
</el-col>
......
......@@ -18,7 +18,7 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id) + ''
this.ids = selection.map((item) => item.id)
},
},
}
......
<script>
import MaPage from '@/views/material/components/MaPage'
import Video from 'video.js'
export default {
components: {
......@@ -7,10 +8,6 @@ export default {
},
data() {
return {
srcList: [
'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg',
],
list: [], // 列表
ids: [], // 选中数组
}
......@@ -26,20 +23,29 @@ export default {
</script>
<template>
<MaPage ref="page" type="2" @listChange="listChange">
<MaPage ref="page" type="2" @listChange="listChange" :selected="ids">
<el-row :gutter="20">
<el-col
:span="6"
style="margin-top: 24px;"
style="margin-top: 24px;min-width: 280px;"
v-for="(item, index) in list"
:key="index"
>
<el-card shadow="hover" body-style="padding: 0px;">
<div class="img-wrap">
<el-image
:src="item.coverUrl"
:preview-src-list="srcList"
></el-image>
<video
id="video"
class="video-js vjs-default-skin
vjs-big-play-centered"
controls
webkit-playsinline="true"
playsinline="true"
autoplay="none"
preload="auto"
:poster="item.coverUrl"
>
<source :src="item.materialUrl" type="video/mp4" />
</video>
<div class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
......@@ -62,9 +68,11 @@ export default {
</div>
</div>
<div style="padding: 14px;">
<el-checkbox v-model="kl">{{ item.createTime }}</el-checkbox>
<div>{{ item.digest }}</div>
<el-checkbox v-model="ids" :label="item.id">{{
item.createTime
}}</el-checkbox>
<div>{{ item.digest }}</div>
<!-- <div>{{ item.digest }}</div> -->
</div>
</el-card>
</el-col>
......@@ -82,7 +90,7 @@ export default {
.el-upload-list__item-actions {
position: absolute;
width: 100%;
height: 50px;
height: 40px;
left: 0;
top: 0;
cursor: default;
......@@ -93,4 +101,8 @@ export default {
background-color: rgba(0, 0, 0, 0.5);
transition: opacity 0.3s;
}
#video {
width: 100%;
height: 100%;
}
</style>
......@@ -6,7 +6,6 @@ function resolve(dir) {
}
process.env.VUE_APP_TITLE = require('./package.json').description
process.env.VUE_APP_BASE_API = process.env.NODE_ENV === 'development' ? 'http://127.0.0.1:8080' : 'http://127.0.0.1:8080'
// vue.config.js 配置说明
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
// 这里只列一部分,具体配置参考文档
......@@ -14,7 +13,7 @@ module.exports = {
// 部署生产环境和开发环境下的URL。
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.xx.cn/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.xx.cn/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
......@@ -31,34 +30,34 @@ module.exports = {
open: true,
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
['/']: {
['http']: {
target: process.env.VUE_APP_BASE_API,
changeOrigin: true,
// pathRewrite: {
// ['^' + process.env.VUE_APP_BASE_API]: ''
// }
}
},
},
disableHostCheck: true
disableHostCheck: true,
},
css: {
loaderOptions: {
sass: {
//依次导入的公用的scss变量,公用的scss混入,共用的默认样式
prependData: `@import "./src/styles/variables.scss";`
}
}
//依次导入的公用的scss变量,公用的scss混入,共用的默认样式
prependData: `@import "./src/styles/variables.scss";`,
},
},
},
configureWebpack: {
resolve: {
alias: {
'@': resolve('src')
}
}
'@': resolve('src'),
},
},
},
chainWebpack(config) {
// 修复HMR
config.resolve.symlinks(true);
// 修复HMR
config.resolve.symlinks(true)
// set svg-sprite-loader
config.module
.rule('svg')
......@@ -72,51 +71,49 @@ module.exports = {
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
symbolId: 'icon-[name]',
})
.end()
config
.when(process.env.NODE_ENV !== 'development',
config => {
config
.plugin('ScriptExtHtmlWebpackPlugin')
.after('html')
.use('script-ext-html-webpack-plugin', [{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/
}])
.end()
config
.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial' // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
}
}
})
config.optimization.runtimeChunk('single'),
config.when(process.env.NODE_ENV !== 'development', (config) => {
config
.plugin('ScriptExtHtmlWebpackPlugin')
.after('html')
.use('script-ext-html-webpack-plugin', [
{
from: path.resolve(__dirname, './public/robots.txt'),//防爬虫文件
to: './',//到根目录下
}
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/,
},
])
.end()
config.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial', // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true,
},
},
})
config.optimization.runtimeChunk('single'),
{
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './', //到根目录下
}
)
}
})
},
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!